@embedpdf/snippet 2.0.0-next.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-awZxztMA-34e61bde.js +1 -0
- package/dist/components/app.d.ts.map +1 -1
- package/dist/components/outline-sidebar.d.ts.map +1 -1
- package/dist/{direct-engine-351ee24a.js → direct-engine-3d50b393.js} +1 -1
- package/dist/embedpdf-a6523bfa.js +3 -0
- package/dist/embedpdf.js +1 -1
- package/dist/worker-engine-bd76f3e1.js +1 -0
- package/package.json +30 -30
- package/dist/browser-Cm3DA8l_-7a7c1b22.js +0 -1
- package/dist/embedpdf-bc35fbd4.js +0 -3
- package/dist/worker-engine-0d859ee9.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(e,t,n,o,i,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,i)}function n(e){return function(){var n=this,o=arguments;return new Promise(function(i,r){var a=e.apply(n,o);function s(e){t(a,i,r,s,l,"next",e)}function l(e){t(a,i,r,s,l,"throw",e)}s(void 0)})}}function o(e,t,n){return t=c(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,w(o.key),o)}}function a(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=C(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function l(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function g(e,t){if(null==e)return{};var n,o,i=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function p(){
|
|
2
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var e,t,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function r(n,o,i,r){var l=o&&o.prototype instanceof s?o:s,c=Object.create(l.prototype);return v(c,"_invoke",function(n,o,i){var r,s,l,c=0,d=i||[],u=!1,h={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return r=t,s=0,l=e,h.n=n,a}};function m(n,o){for(s=n,l=o,t=0;!u&&c&&!i&&t<d.length;t++){var i,r=d[t],m=h.p,g=r[2];n>3?(i=g===o)&&(l=r[(s=r[4])?5:(s=3,3)],r[4]=r[5]=e):r[0]<=m&&((i=n<2&&m<r[1])?(s=0,h.v=o,h.n=r[1]):m<g&&(i=n<3||r[0]>o||o>g)&&(r[4]=n,r[5]=o,h.n=g,s=0))}if(i||n>1)return a;throw u=!0,o}return function(i,d,g){if(c>1)throw TypeError("Generator is already running");for(u&&1===d&&m(d,g),s=d,l=g;(t=s<2?e:l)||!u;){r||(s?s<3?(s>1&&(h.n=-1),m(s,l)):h.n=l:h.v=l);try{if(c=2,r){if(s||(i="next"),t=r[i]){if(!(t=t.call(r,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=r.return)&&t.call(r),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);r=e}else if((t=(u=h.n<0)?l:n.call(o,h))!==a)break}catch(t){r=e,s=1,l=t}finally{c=1}}return{value:t,done:u}}}(n,i,r),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var d=[][o]?t(t([][o]())):(v(t={},o,function(){return this}),t),u=c.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,v(e,i,"GeneratorFunction")),e.prototype=Object.create(u),e}return l.prototype=c,v(u,"constructor",c),v(c,"constructor",l),l.displayName="GeneratorFunction",v(c,i,"GeneratorFunction"),v(u),v(u,i,"Generator"),v(u,o,function(){return this}),v(u,"toString",function(){return"[object Generator]"}),(p=function(){return{w:r,m:h}})()}function v(e,t,n,o){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}v=function(e,t,n,o){function r(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[t]=n:(r("next",0),r("throw",1),r("return",2))},v(e,t,n,o)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}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 o,i,r,a,s=[],l=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=r.call(n)).done)&&(s.push(o.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||C(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.")}()}function b(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||C(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function x(e){return x="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},x(e)}function C(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}var I,S,k,D,M,P,A,T,z,E,_,R,N={},O=[],L=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$=Array.isArray;function F(e,t){for(var n in t)e[n]=t[n];return e}function j(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function H(e,t,n){var o,i,r,a={};for(r in t)"key"==r?o=t[r]:"ref"==r?i=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?I.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===a[r]&&(a[r]=e.defaultProps[r]);return U(e,a,o,i,null)}function U(e,t,n,o,i){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++k:i,__i:-1,__u:0};return null==i&&null!=S.vnode&&S.vnode(r),r}function W(e){return e.children}function B(e,t){this.props=e,this.context=t}function q(e,t){if(null==t)return e.__?q(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?q(e):null}function G(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return G(e)}}function V(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!Z.__r++||M!=S.debounceRendering)&&((M=S.debounceRendering)||P)(Z)}function Z(){for(var e,t,n,o,i,r,a,s=1;D.length;)D.length>s&&D.sort(A),e=D.shift(),s=D.length,e.__d&&(n=void 0,o=void 0,i=(o=(t=e).__v).__e,r=[],a=[],t.__P&&((n=F({},o)).__v=o.__v+1,S.vnode&&S.vnode(n),ne(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[i]:null,r,null==i?q(o):i,!!(32&o.__u),a),n.__v=o.__v,n.__.__k[n.__i]=n,ie(r,n,a),o.__e=o.__=null,n.__e!=i&&G(n)));Z.__r=0}function K(e,t,n,o,i,r,a,s,l,c,d){var u,h,m,g,p,v,f,y=o&&o.__k||O,b=t.length;for(l=function(e,t,n,o,i){var r,a,s,l,c,d=n.length,u=d,h=0;for(e.__k=new Array(i),r=0;r<i;r++)null!=(a=t[r])&&"boolean"!=typeof a&&"function"!=typeof a?(l=r+h,(a=e.__k[r]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?U(null,a,null,null,null):$(a)?U(W,{children:a},null,null,null):null==a.constructor&&a.__b>0?U(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,-1!=(c=a.__i=Q(a,n,l,u))&&(u--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(i>d?h--:i<d&&h++),"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[r]=null;if(u)for(r=0;r<d;r++)null!=(s=n[r])&&!(2&s.__u)&&(s.__e==o&&(o=q(s)),le(s,s));return o}(n,t,y,l,b),u=0;u<b;u++)null!=(m=n.__k[u])&&(h=-1==m.__i?N:y[m.__i]||N,m.__i=u,v=ne(e,m,h,i,r,a,s,l,c,d),g=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&se(h.ref,null,m),d.push(m.ref,m.__c||g,m)),null==p&&null!=g&&(p=g),(f=!!(4&m.__u))||h.__k===m.__k?l=Y(m,l,e,f):"function"==typeof m.type&&void 0!==v?l=v:g&&(l=g.nextSibling),m.__u&=-7);return n.__e=p,l}function Y(e,t,n,o){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Y(i[r],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=q(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function X(e,t){return t=t||[],null==e||"boolean"==typeof e||($(e)?e.some(function(e){X(e,t)}):t.push(e)),t}function Q(e,t,n,o){var i,r,a,s=e.key,l=e.type,c=t[n],d=null!=c&&!(2&c.__u);if(null===c&&null==e.key||d&&s==c.key&&l==c.type)return n;if(o>(d?1:0))for(i=n-1,r=n+1;i>=0||r<t.length;)if(null!=(c=t[a=i>=0?i--:r++])&&!(2&c.__u)&&s==c.key&&l==c.type)return a;return-1}function J(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||L.test(t)?n:n+"px"}function ee(e,t,n,o,i){var r,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||J(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||J(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(T,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o?n.u=o.u:(n.u=z,e.addEventListener(t,r?_:E,r)):e.removeEventListener(t,r?_:E,r);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function te(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=z++;else if(t.t<n.u)return;return n(S.event?S.event(t):t)}}}function ne(e,t,n,o,i,r,a,s,l,c){var d,u,h,m,g,p,v,f,y,b,w,x,C,I,k,D,M,P=t.type;if(null!=t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),r=[s=t.__e=n.__e]),(d=S.__b)&&d(t);e:if("function"==typeof P)try{if(f=t.props,y="prototype"in P&&P.prototype.render,b=(d=P.contextType)&&o[d.__c],w=d?b?b.props.value:d.__:o,n.__c?v=(u=t.__c=n.__c).__=u.__E:(y?t.__c=u=new P(f,w):(t.__c=u=new B(f,w),u.constructor=P,u.render=ce),b&&b.sub(u),u.props=f,u.state||(u.state={}),u.context=w,u.__n=o,h=u.__d=!0,u.__h=[],u._sb=[]),y&&null==u.__s&&(u.__s=u.state),y&&null!=P.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=F({},u.__s)),F(u.__s,P.getDerivedStateFromProps(f,u.__s))),m=u.props,g=u.state,u.__v=t,h)y&&null==P.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),y&&null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(y&&null==P.getDerivedStateFromProps&&f!==m&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(f,w),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(f,u.__s,w)||t.__v==n.__v){for(t.__v!=n.__v&&(u.props=f,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&a.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(f,u.__s,w),y&&null!=u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(m,g,p)})}if(u.context=w,u.props=f,u.__P=e,u.__e=!1,C=S.__r,I=0,y){for(u.state=u.__s,u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,C&&C(t),d=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++I<25);u.state=u.__s,null!=u.getChildContext&&(o=F(F({},o),u.getChildContext())),y&&!h&&null!=u.getSnapshotBeforeUpdate&&(p=u.getSnapshotBeforeUpdate(m,g)),D=d,null!=d&&d.type===W&&null==d.key&&(D=re(d.props.children)),s=K(e,$(D)?D:[D],t,n,o,i,r,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),v&&(u.__E=u.__=null)}catch(e){if(t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;r[r.indexOf(s)]=null,t.__e=s}else{for(M=r.length;M--;)j(r[M]);oe(t)}else t.__e=n.__e,t.__k=n.__k,e.then||oe(t);S.__e(e,t,n)}else null==r&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ae(n.__e,t,n,o,i,r,a,l,c);return(d=S.diffed)&&d(t),128&t.__u?void 0:s}function oe(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(oe)}function ie(e,t,n){for(var o=0;o<n.length;o++)se(n[o],n[++o],n[++o]);S.__c&&S.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){S.__e(e,t.__v)}})}function re(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:$(e)?e.map(re):F({},e)}function ae(e,t,n,o,i,r,a,s,l){var c,d,u,h,m,g,p,v=n.props,f=t.props,y=t.type;if("svg"==y?i="http://www.w3.org/2000/svg":"math"==y?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;c<r.length;c++)if((m=r[c])&&"setAttribute"in m==!!y&&(y?m.localName==y:3==m.nodeType)){e=m,r[c]=null;break}if(null==e){if(null==y)return document.createTextNode(f);e=document.createElementNS(i,y,f.is&&f),s&&(S.__m&&S.__m(t,r),s=!1),r=null}if(null==y)v===f||s&&e.data==f||(e.data=f);else{if(r=r&&I.call(e.childNodes),v=n.props||N,!s&&null!=r)for(v={},c=0;c<e.attributes.length;c++)v[(m=e.attributes[c]).name]=m.value;for(c in v)if(m=v[c],"children"==c);else if("dangerouslySetInnerHTML"==c)u=m;else if(!(c in f)){if("value"==c&&"defaultValue"in f||"checked"==c&&"defaultChecked"in f)continue;ee(e,c,null,m,i)}for(c in f)m=f[c],"children"==c?h=m:"dangerouslySetInnerHTML"==c?d=m:"value"==c?g=m:"checked"==c?p=m:s&&"function"!=typeof m||v[c]===m||ee(e,c,m,v[c],i);if(d)s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),K("template"==t.type?e.content:e,$(h)?h:[h],t,n,o,"foreignObject"==y?"http://www.w3.org/1999/xhtml":i,r,a,r?r[0]:n.__k&&q(n,0),s,l),null!=r)for(c=r.length;c--;)j(r[c]);s||(c="value","progress"==y&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[c]||"progress"==y&&!g||"option"==y&&g!=v[c])&&ee(e,c,g,v[c],i),c="checked",null!=p&&p!=e[c]&&ee(e,c,p,v[c],i))}return e}function se(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){S.__e(e,n)}}function le(e,t,n){var o,i;if(S.unmount&&S.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||se(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){S.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&le(o[i],t,n||"function"!=typeof e.type);n||j(e.__e),e.__c=e.__=e.__e=void 0}function ce(e,t,n){return this.constructor(e,n)}function de(e,t,n){var o,i,r,a;t==document&&(t=document.documentElement),S.__&&S.__(e,t),i=(o="function"==typeof n)?null:n&&n.__k||t.__k,r=[],a=[],ne(t,e=(!o&&n||t).__k=H(W,null,[e]),i||N,N,t.namespaceURI,!o&&n?[n]:i?null:t.firstChild?I.call(t.childNodes):null,r,!o&&n?n:i?i.__e:t.firstChild,o,a),ie(r,e,a)}function ue(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,V(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+R++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}I=O.slice,S={__e:function(e,t,n,o){for(var i,r,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,o||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},k=0,B.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=F({},this.state),"function"==typeof e&&(e=e(F({},n),this.props)),e&&F(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),V(this))},B.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),V(this))},B.prototype.render=W,D=[],P="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,A=function(e,t){return e.__v.__b-t.__v.__b},Z.__r=0,T=/(PointerCapture)$|Capture$/i,z=0,E=te(!1),_=te(!0),R=0;var he,me,ge,pe,ve=0,fe=[],ye=S,be=ye.__b,we=ye.__r,xe=ye.diffed,Ce=ye.__c,Ie=ye.unmount,Se=ye.__;function ke(e,t){ye.__h&&ye.__h(me,e,ve||t),ve=0;var n=me.__H||(me.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function De(e){return ve=1,Me(je,e)}function Me(e,t,n){var o=ke(he++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):je(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=me,!me.__f)){var i=function(e,t,n){if(!o.__c.__H)return!0;var i=o.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!r||r.call(this,e,t,n);var a=o.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),r&&r.call(this,e,t,n)||a};me.__f=!0;var r=me.shouldComponentUpdate,a=me.componentWillUpdate;me.componentWillUpdate=function(e,t,n){if(this.__e){var o=r;r=void 0,i(e,t,n),r=o}a&&a.call(this,e,t,n)},me.shouldComponentUpdate=i}return o.__N||o.__}function Pe(e,t){var n=ke(he++,3);!ye.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,me.__H.__h.push(n))}function Ae(e,t){var n=ke(he++,4);!ye.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,me.__h.push(n))}function Te(e){return ve=5,ze(function(){return{current:e}},[])}function ze(e,t){var n=ke(he++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ee(e,t){return ve=8,ze(function(){return e},t)}function _e(e){var t=me.context[e.__c],n=ke(he++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(me)),t.props.value):e.__}function Re(){for(var e;e=fe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Le),e.__H.__h.forEach($e),e.__H.__h=[]}catch(t){e.__H.__h=[],ye.__e(t,e.__v)}}ye.__b=function(e){me=null,be&&be(e)},ye.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Se&&Se(e,t)},ye.__r=function(e){we&&we(e),he=0;var t=(me=e.__c).__H;t&&(ge===me?(t.__h=[],me.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(Le),t.__h.forEach($e),t.__h=[],he=0)),ge=me},ye.diffed=function(e){xe&&xe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==fe.push(t)&&pe===ye.requestAnimationFrame||((pe=ye.requestAnimationFrame)||Oe)(Re)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ge=me=null},ye.__c=function(e,t){t.some(function(e){try{e.__h.forEach(Le),e.__h=e.__h.filter(function(e){return!e.__||$e(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],ye.__e(n,e.__v)}}),Ce&&Ce(e,t)},ye.unmount=function(e){Ie&&Ie(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Le(e)}catch(e){t=e}}),n.__H=void 0,t&&ye.__e(t,n.__v))};var Ne="function"==typeof requestAnimationFrame;function Oe(e){var t,n=function(){clearTimeout(o),Ne&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Ne&&(t=requestAnimationFrame(n))}function Le(e){var t=me,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),me=t}function $e(e){var t=me;e.__c=e.__(),me=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function je(e,t){return"function"==typeof t?t(e):t}var He='/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */\n@layer properties;\n@layer theme, base, components, utilities;\n@layer theme {\n :root, :host {\n --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",\n "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",\n "Courier New", monospace;\n --color-red-500: oklch(63.7% 0.237 25.331);\n --color-yellow-500: oklch(79.5% 0.184 86.047);\n --color-green-500: oklch(72.3% 0.219 149.579);\n --color-teal-500: oklch(70.4% 0.14 182.503);\n --color-blue-500: oklch(62.3% 0.214 259.815);\n --color-blue-600: oklch(54.6% 0.245 262.881);\n --color-blue-700: oklch(48.8% 0.243 264.376);\n --color-indigo-500: oklch(58.5% 0.233 277.117);\n --color-purple-500: oklch(62.7% 0.265 303.9);\n --color-pink-500: oklch(65.6% 0.241 354.308);\n --color-gray-50: oklch(98.5% 0.002 247.839);\n --color-gray-200: oklch(92.8% 0.006 264.531);\n --color-gray-300: oklch(87.2% 0.01 258.338);\n --color-gray-700: oklch(37.3% 0.034 259.733);\n --color-white: #fff;\n --spacing: 0.25rem;\n --container-sm: 24rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --leading-relaxed: 1.625;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n --color-bg-app: var(--ep-background-app);\n --color-bg-surface: var(--ep-background-surface);\n --color-bg-surface-alt: var(--ep-background-surface-alt);\n --color-bg-elevated: var(--ep-background-elevated);\n --color-bg-overlay: var(--ep-background-overlay);\n --color-bg-input: var(--ep-background-input);\n --color-fg-primary: var(--ep-foreground-primary);\n --color-fg-secondary: var(--ep-foreground-secondary);\n --color-fg-muted: var(--ep-foreground-muted);\n --color-fg-disabled: var(--ep-foreground-disabled);\n --color-fg-on-accent: var(--ep-foreground-on-accent);\n --color-border-default: var(--ep-border-default);\n --color-border-subtle: var(--ep-border-subtle);\n --color-border-strong: var(--ep-border-strong);\n --color-accent: var(--ep-accent-primary);\n --color-accent-hover: var(--ep-accent-primary-hover);\n --color-accent-light: var(--ep-accent-primary-light);\n --color-accent-fg: var(--ep-accent-primary-foreground);\n --color-interactive-hover: var(--ep-interactive-hover);\n --color-interactive-active: var(--ep-interactive-active);\n --color-interactive-selected: var(--ep-interactive-selected);\n --color-interactive-focus-ring: var(--ep-interactive-focus-ring);\n --color-state-error: var(--ep-state-error);\n --color-state-error-light: var(--ep-state-error-light);\n --color-state-info-light: var(--ep-state-info-light);\n --color-tooltip-bg: var(--ep-tooltip-background);\n --color-tooltip-fg: var(--ep-tooltip-foreground);\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::-moz-placeholder {\n opacity: 1;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::-moz-placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n ::placeholder {\n color: currentcolor;\n @supports (color: color-mix(in lab, red, red)) {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {\n -webkit-appearance: button;\n -moz-appearance: button;\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden="until-found"])) {\n display: none !important;\n }\n}\n@layer utilities {\n .pointer-events-auto {\n pointer-events: auto;\n }\n .pointer-events-none {\n pointer-events: none;\n }\n .visible {\n visibility: visible;\n }\n .absolute {\n position: absolute;\n }\n .fixed {\n position: fixed;\n }\n .relative {\n position: relative;\n }\n .static {\n position: static;\n }\n .sticky {\n position: sticky;\n }\n .inset-0 {\n inset: calc(var(--spacing) * 0);\n }\n .inset-x-0 {\n inset-inline: calc(var(--spacing) * 0);\n }\n .inset-y-0 {\n inset-block: calc(var(--spacing) * 0);\n }\n .top-0 {\n top: calc(var(--spacing) * 0);\n }\n .top-1\\/2 {\n top: calc(1/2 * 100%);\n }\n .top-4 {\n top: calc(var(--spacing) * 4);\n }\n .top-6 {\n top: calc(var(--spacing) * 6);\n }\n .right-0 {\n right: calc(var(--spacing) * 0);\n }\n .right-1 {\n right: calc(var(--spacing) * 1);\n }\n .right-4 {\n right: calc(var(--spacing) * 4);\n }\n .bottom-0 {\n bottom: calc(var(--spacing) * 0);\n }\n .left-0 {\n left: calc(var(--spacing) * 0);\n }\n .left-1\\/2 {\n left: calc(1/2 * 100%);\n }\n .z-10 {\n z-index: 10;\n }\n .z-40 {\n z-index: 40;\n }\n .z-50 {\n z-index: 50;\n }\n .z-100 {\n z-index: 100;\n }\n .col-start-1 {\n grid-column-start: 1;\n }\n .row-start-1 {\n grid-row-start: 1;\n }\n .container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n }\n .mx-4 {\n margin-inline: calc(var(--spacing) * 4);\n }\n .my-2 {\n margin-block: calc(var(--spacing) * 2);\n }\n .my-4 {\n margin-block: calc(var(--spacing) * 4);\n }\n .mt-0\\.5 {\n margin-top: calc(var(--spacing) * 0.5);\n }\n .mt-1 {\n margin-top: calc(var(--spacing) * 1);\n }\n .mt-2 {\n margin-top: calc(var(--spacing) * 2);\n }\n .mt-3 {\n margin-top: calc(var(--spacing) * 3);\n }\n .mt-4 {\n margin-top: calc(var(--spacing) * 4);\n }\n .mt-5 {\n margin-top: calc(var(--spacing) * 5);\n }\n .mt-6 {\n margin-top: calc(var(--spacing) * 6);\n }\n .mr-2 {\n margin-right: calc(var(--spacing) * 2);\n }\n .mb-1 {\n margin-bottom: calc(var(--spacing) * 1);\n }\n .mb-1\\.5 {\n margin-bottom: calc(var(--spacing) * 1.5);\n }\n .mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n }\n .mb-3 {\n margin-bottom: calc(var(--spacing) * 3);\n }\n .mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n }\n .mb-6 {\n margin-bottom: calc(var(--spacing) * 6);\n }\n .ml-1 {\n margin-left: calc(var(--spacing) * 1);\n }\n .block {\n display: block;\n }\n .contents {\n display: contents;\n }\n .flex {\n display: flex;\n }\n .grid {\n display: grid;\n }\n .hidden {\n display: none;\n }\n .inline {\n display: inline;\n }\n .inline-block {\n display: inline-block;\n }\n .inline-flex {\n display: inline-flex;\n }\n .h-1 {\n height: calc(var(--spacing) * 1);\n }\n .h-1\\.5 {\n height: calc(var(--spacing) * 1.5);\n }\n .h-2 {\n height: calc(var(--spacing) * 2);\n }\n .h-3 {\n height: calc(var(--spacing) * 3);\n }\n .h-3\\.5 {\n height: calc(var(--spacing) * 3.5);\n }\n .h-4 {\n height: calc(var(--spacing) * 4);\n }\n .h-5 {\n height: calc(var(--spacing) * 5);\n }\n .h-6 {\n height: calc(var(--spacing) * 6);\n }\n .h-7 {\n height: calc(var(--spacing) * 7);\n }\n .h-8 {\n height: calc(var(--spacing) * 8);\n }\n .h-9 {\n height: calc(var(--spacing) * 9);\n }\n .h-10 {\n height: calc(var(--spacing) * 10);\n }\n .h-16 {\n height: calc(var(--spacing) * 16);\n }\n .h-18 {\n height: calc(var(--spacing) * 18);\n }\n .h-\\[32px\\] {\n height: 32px;\n }\n .h-full {\n height: 100%;\n }\n .h-px {\n height: 1px;\n }\n .max-h-48 {\n max-height: calc(var(--spacing) * 48);\n }\n .max-h-60 {\n max-height: calc(var(--spacing) * 60);\n }\n .min-h-0 {\n min-height: calc(var(--spacing) * 0);\n }\n .\\!w-full {\n width: 100% !important;\n }\n .w-2 {\n width: calc(var(--spacing) * 2);\n }\n .w-3 {\n width: calc(var(--spacing) * 3);\n }\n .w-3\\.5 {\n width: calc(var(--spacing) * 3.5);\n }\n .w-4 {\n width: calc(var(--spacing) * 4);\n }\n .w-5 {\n width: calc(var(--spacing) * 5);\n }\n .w-6 {\n width: calc(var(--spacing) * 6);\n }\n .w-8 {\n width: calc(var(--spacing) * 8);\n }\n .w-9 {\n width: calc(var(--spacing) * 9);\n }\n .w-10 {\n width: calc(var(--spacing) * 10);\n }\n .w-12 {\n width: calc(var(--spacing) * 12);\n }\n .w-16 {\n width: calc(var(--spacing) * 16);\n }\n .w-18 {\n width: calc(var(--spacing) * 18);\n }\n .w-32 {\n width: calc(var(--spacing) * 32);\n }\n .w-36 {\n width: calc(var(--spacing) * 36);\n }\n .w-\\[32px\\] {\n width: 32px;\n }\n .w-auto {\n width: auto;\n }\n .w-full {\n width: 100%;\n }\n .w-px {\n width: 1px;\n }\n .max-w-\\[150px\\] {\n max-width: 150px;\n }\n .max-w-\\[240px\\] {\n max-width: 240px;\n }\n .max-w-sm {\n max-width: var(--container-sm);\n }\n .min-w-0 {\n min-width: calc(var(--spacing) * 0);\n }\n .min-w-\\[8rem\\] {\n min-width: 8rem;\n }\n .min-w-\\[32px\\] {\n min-width: 32px;\n }\n .min-w-\\[120px\\] {\n min-width: 120px;\n }\n .min-w-\\[200px\\] {\n min-width: 200px;\n }\n .flex-1 {\n flex: 1;\n }\n .flex-shrink-0 {\n flex-shrink: 0;\n }\n .shrink-0 {\n flex-shrink: 0;\n }\n .-translate-x-1\\/2 {\n --tw-translate-x: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .translate-x-\\[1px\\] {\n --tw-translate-x: 1px;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .-translate-y-1\\/2 {\n --tw-translate-y: calc(calc(1/2 * 100%) * -1);\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .translate-y-\\[1px\\] {\n --tw-translate-y: 1px;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n .scale-95 {\n --tw-scale-x: 95%;\n --tw-scale-y: 95%;\n --tw-scale-z: 95%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n .scale-100 {\n --tw-scale-x: 100%;\n --tw-scale-y: 100%;\n --tw-scale-z: 100%;\n scale: var(--tw-scale-x) var(--tw-scale-y);\n }\n .rotate-45 {\n rotate: 45deg;\n }\n .transform {\n transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);\n }\n .animate-pulse {\n animation: var(--animate-pulse);\n }\n .animate-spin {\n animation: var(--animate-spin);\n }\n .cursor-default {\n cursor: default;\n }\n .cursor-grab {\n cursor: grab;\n }\n .cursor-not-allowed {\n cursor: not-allowed;\n }\n .cursor-pointer {\n cursor: pointer;\n }\n .touch-none {\n touch-action: none;\n }\n .resize {\n resize: both;\n }\n .appearance-none {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n .grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n .grid-cols-6 {\n grid-template-columns: repeat(6, minmax(0, 1fr));\n }\n .flex-col {\n flex-direction: column;\n }\n .flex-row {\n flex-direction: row;\n }\n .flex-wrap {\n flex-wrap: wrap;\n }\n .items-center {\n align-items: center;\n }\n .items-end {\n align-items: flex-end;\n }\n .items-start {\n align-items: flex-start;\n }\n .justify-between {\n justify-content: space-between;\n }\n .justify-center {\n justify-content: center;\n }\n .justify-end {\n justify-content: flex-end;\n }\n .justify-start {\n justify-content: flex-start;\n }\n .gap-1 {\n gap: calc(var(--spacing) * 1);\n }\n .gap-2 {\n gap: calc(var(--spacing) * 2);\n }\n .gap-3 {\n gap: calc(var(--spacing) * 3);\n }\n .gap-4 {\n gap: calc(var(--spacing) * 4);\n }\n .space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-3 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-4 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .space-y-6 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)));\n }\n }\n .gap-x-1 {\n -moz-column-gap: calc(var(--spacing) * 1);\n column-gap: calc(var(--spacing) * 1);\n }\n .space-x-2 {\n :where(& > :not(:last-child)) {\n --tw-space-x-reverse: 0;\n margin-inline-start: calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));\n margin-inline-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));\n }\n }\n .space-x-3 {\n :where(& > :not(:last-child)) {\n --tw-space-x-reverse: 0;\n margin-inline-start: calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));\n margin-inline-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)));\n }\n }\n .gap-y-4 {\n row-gap: calc(var(--spacing) * 4);\n }\n .divide-y {\n :where(& > :not(:last-child)) {\n --tw-divide-y-reverse: 0;\n border-bottom-style: var(--tw-border-style);\n border-top-style: var(--tw-border-style);\n border-top-width: calc(1px * var(--tw-divide-y-reverse));\n border-bottom-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));\n }\n }\n .divide-border-subtle {\n :where(& > :not(:last-child)) {\n border-color: var(--color-border-subtle);\n }\n }\n .truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .overflow-auto {\n overflow: auto;\n }\n .overflow-hidden {\n overflow: hidden;\n }\n .overflow-x-auto {\n overflow-x: auto;\n }\n .overflow-y-auto {\n overflow-y: auto;\n }\n .rounded {\n border-radius: 0.25rem;\n }\n .rounded-\\[3px\\] {\n border-radius: 3px;\n }\n .rounded-full {\n border-radius: calc(infinity * 1px);\n }\n .rounded-lg {\n border-radius: var(--radius-lg);\n }\n .rounded-md {\n border-radius: var(--radius-md);\n }\n .rounded-none {\n border-radius: 0;\n }\n .rounded-xl {\n border-radius: var(--radius-xl);\n }\n .rounded-t-2xl {\n border-top-left-radius: var(--radius-2xl);\n border-top-right-radius: var(--radius-2xl);\n }\n .rounded-t-lg {\n border-top-left-radius: var(--radius-lg);\n border-top-right-radius: var(--radius-lg);\n }\n .rounded-l-md {\n border-top-left-radius: var(--radius-md);\n border-bottom-left-radius: var(--radius-md);\n }\n .rounded-r-md {\n border-top-right-radius: var(--radius-md);\n border-bottom-right-radius: var(--radius-md);\n }\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n .border-0 {\n border-style: var(--tw-border-style);\n border-width: 0px;\n }\n .border-2 {\n border-style: var(--tw-border-style);\n border-width: 2px;\n }\n .border-3 {\n border-style: var(--tw-border-style);\n border-width: 3px;\n }\n .border-4 {\n border-style: var(--tw-border-style);\n border-width: 4px;\n }\n .border-t {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n }\n .border-r {\n border-right-style: var(--tw-border-style);\n border-right-width: 1px;\n }\n .border-r-0 {\n border-right-style: var(--tw-border-style);\n border-right-width: 0px;\n }\n .border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n }\n .border-b-2 {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 2px;\n }\n .border-l {\n border-left-style: var(--tw-border-style);\n border-left-width: 1px;\n }\n .border-none {\n --tw-border-style: none;\n border-style: none;\n }\n .border-\\[\\#cfd4da\\] {\n border-color: #cfd4da;\n }\n .border-accent {\n border-color: var(--color-accent);\n }\n .border-border-default {\n border-color: var(--color-border-default);\n }\n .border-border-strong {\n border-color: var(--color-border-strong);\n }\n .border-border-subtle {\n border-color: var(--color-border-subtle);\n }\n .border-gray-200 {\n border-color: var(--color-gray-200);\n }\n .border-gray-300 {\n border-color: var(--color-gray-300);\n }\n .border-state-error {\n border-color: var(--color-state-error);\n }\n .border-transparent {\n border-color: transparent;\n }\n .border-t-accent {\n border-top-color: var(--color-accent);\n }\n .border-r-accent {\n border-right-color: var(--color-accent);\n }\n .border-b-accent {\n border-bottom-color: var(--color-accent);\n }\n .border-b-transparent {\n border-bottom-color: transparent;\n }\n .bg-\\[\\#f8f9fa\\] {\n background-color: #f8f9fa;\n }\n .bg-accent {\n background-color: var(--color-accent);\n }\n .bg-accent-light {\n background-color: var(--color-accent-light);\n }\n .bg-bg-app {\n background-color: var(--color-bg-app);\n }\n .bg-bg-elevated {\n background-color: var(--color-bg-elevated);\n }\n .bg-bg-input {\n background-color: var(--color-bg-input);\n }\n .bg-bg-overlay {\n background-color: var(--color-bg-overlay);\n }\n .bg-bg-surface {\n background-color: var(--color-bg-surface);\n }\n .bg-bg-surface-alt {\n background-color: var(--color-bg-surface-alt);\n }\n .bg-bg-surface\\/80 {\n background-color: var(--color-bg-surface);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-bg-surface) 80%, transparent);\n }\n }\n .bg-blue-500 {\n background-color: var(--color-blue-500);\n }\n .bg-blue-600 {\n background-color: var(--color-blue-600);\n }\n .bg-border-default {\n background-color: var(--color-border-default);\n }\n .bg-border-subtle {\n background-color: var(--color-border-subtle);\n }\n .bg-green-500 {\n background-color: var(--color-green-500);\n }\n .bg-indigo-500 {\n background-color: var(--color-indigo-500);\n }\n .bg-inherit {\n background-color: inherit;\n }\n .bg-interactive-hover {\n background-color: var(--color-interactive-hover);\n }\n .bg-interactive-selected {\n background-color: var(--color-interactive-selected);\n }\n .bg-pink-500 {\n background-color: var(--color-pink-500);\n }\n .bg-purple-500 {\n background-color: var(--color-purple-500);\n }\n .bg-red-500 {\n background-color: var(--color-red-500);\n }\n .bg-state-error-light {\n background-color: var(--color-state-error-light);\n }\n .bg-state-info-light {\n background-color: var(--color-state-info-light);\n }\n .bg-teal-500 {\n background-color: var(--color-teal-500);\n }\n .bg-tooltip-bg {\n background-color: var(--color-tooltip-bg);\n }\n .bg-transparent {\n background-color: transparent;\n }\n .bg-white {\n background-color: var(--color-white);\n }\n .bg-yellow-500 {\n background-color: var(--color-yellow-500);\n }\n .p-0 {\n padding: calc(var(--spacing) * 0);\n }\n .p-1 {\n padding: calc(var(--spacing) * 1);\n }\n .p-1\\.5 {\n padding: calc(var(--spacing) * 1.5);\n }\n .p-2 {\n padding: calc(var(--spacing) * 2);\n }\n .p-3 {\n padding: calc(var(--spacing) * 3);\n }\n .p-4 {\n padding: calc(var(--spacing) * 4);\n }\n .p-5 {\n padding: calc(var(--spacing) * 5);\n }\n .p-6 {\n padding: calc(var(--spacing) * 6);\n }\n .p-8 {\n padding: calc(var(--spacing) * 8);\n }\n .p-\\[5px\\] {\n padding: 5px;\n }\n .px-1 {\n padding-inline: calc(var(--spacing) * 1);\n }\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n .px-4 {\n padding-inline: calc(var(--spacing) * 4);\n }\n .px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n .px-6 {\n padding-inline: calc(var(--spacing) * 6);\n }\n .py-1 {\n padding-block: calc(var(--spacing) * 1);\n }\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n .py-2\\.5 {\n padding-block: calc(var(--spacing) * 2.5);\n }\n .py-3 {\n padding-block: calc(var(--spacing) * 3);\n }\n .py-4 {\n padding-block: calc(var(--spacing) * 4);\n }\n .pt-2 {\n padding-top: calc(var(--spacing) * 2);\n }\n .pt-4 {\n padding-top: calc(var(--spacing) * 4);\n }\n .pr-2 {\n padding-right: calc(var(--spacing) * 2);\n }\n .pr-3 {\n padding-right: calc(var(--spacing) * 3);\n }\n .pr-7 {\n padding-right: calc(var(--spacing) * 7);\n }\n .pr-9 {\n padding-right: calc(var(--spacing) * 9);\n }\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n .pl-2 {\n padding-left: calc(var(--spacing) * 2);\n }\n .pl-3 {\n padding-left: calc(var(--spacing) * 3);\n }\n .pl-4 {\n padding-left: calc(var(--spacing) * 4);\n }\n .pl-8 {\n padding-left: calc(var(--spacing) * 8);\n }\n .text-center {\n text-align: center;\n }\n .text-left {\n text-align: left;\n }\n .text-right {\n text-align: right;\n }\n .text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n }\n .text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n }\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n .text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n }\n .text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n }\n .text-\\[13px\\] {\n font-size: 13px;\n }\n .leading-none {\n --tw-leading: 1;\n line-height: 1;\n }\n .leading-relaxed {\n --tw-leading: var(--leading-relaxed);\n line-height: var(--leading-relaxed);\n }\n .font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n }\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n .whitespace-nowrap {\n white-space: nowrap;\n }\n .text-accent {\n color: var(--color-accent);\n }\n .text-accent-fg {\n color: var(--color-accent-fg);\n }\n .text-fg-disabled {\n color: var(--color-fg-disabled);\n }\n .text-fg-muted {\n color: var(--color-fg-muted);\n }\n .text-fg-on-accent {\n color: var(--color-fg-on-accent);\n }\n .text-fg-primary {\n color: var(--color-fg-primary);\n }\n .text-fg-secondary {\n color: var(--color-fg-secondary);\n }\n .text-gray-700 {\n color: var(--color-gray-700);\n }\n .text-state-error {\n color: var(--color-state-error);\n }\n .text-tooltip-fg {\n color: var(--color-tooltip-fg);\n }\n .text-white {\n color: var(--color-white);\n }\n .uppercase {\n text-transform: uppercase;\n }\n .italic {\n font-style: italic;\n }\n .underline {\n text-decoration-line: underline;\n }\n .placeholder-fg-muted {\n &::-moz-placeholder {\n color: var(--color-fg-muted);\n }\n &::placeholder {\n color: var(--color-fg-muted);\n }\n }\n .accent-accent {\n accent-color: var(--color-accent);\n }\n .opacity-0 {\n opacity: 0%;\n }\n .opacity-50 {\n opacity: 50%;\n }\n .opacity-100 {\n opacity: 100%;\n }\n .shadow {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-2xl {\n --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-lg {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .shadow-sm {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-1 {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-2 {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .ring-accent {\n --tw-ring-color: var(--color-accent);\n }\n .ring-border-default {\n --tw-ring-color: var(--color-border-default);\n }\n .ring-interactive-focus-ring {\n --tw-ring-color: var(--color-interactive-focus-ring);\n }\n .outline {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n }\n .outline-1 {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n }\n .outline-2 {\n outline-style: var(--tw-outline-style);\n outline-width: 2px;\n }\n .-outline-offset-1 {\n outline-offset: calc(1px * -1);\n }\n .outline-offset-2 {\n outline-offset: 2px;\n }\n .outline-accent {\n outline-color: var(--color-accent);\n }\n .outline-border-default {\n outline-color: var(--color-border-default);\n }\n .backdrop-blur {\n --tw-backdrop-blur: blur(8px);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n }\n .transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter, display, content-visibility, overlay, pointer-events;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-\\[height\\] {\n transition-property: height;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-all {\n transition-property: all;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-colors {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-opacity {\n transition-property: opacity;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n .duration-150 {\n --tw-duration: 150ms;\n transition-duration: 150ms;\n }\n .duration-200 {\n --tw-duration: 200ms;\n transition-duration: 200ms;\n }\n .duration-300 {\n --tw-duration: 300ms;\n transition-duration: 300ms;\n }\n .ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n }\n .ease-out {\n --tw-ease: var(--ease-out);\n transition-timing-function: var(--ease-out);\n }\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n .select-none {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n .group-hover\\:opacity-100 {\n &:is(:where(.group):hover *) {\n @media (hover: hover) {\n opacity: 100%;\n }\n }\n }\n .peer-checked\\:opacity-100 {\n &:is(:where(.peer):checked ~ *) {\n opacity: 100%;\n }\n }\n .placeholder\\:text-fg-muted {\n &::-moz-placeholder {\n color: var(--color-fg-muted);\n }\n &::placeholder {\n color: var(--color-fg-muted);\n }\n }\n .first\\:mt-0 {\n &:first-child {\n margin-top: calc(var(--spacing) * 0);\n }\n }\n .checked\\:border-accent {\n &:checked {\n border-color: var(--color-accent);\n }\n }\n .checked\\:bg-accent {\n &:checked {\n background-color: var(--color-accent);\n }\n }\n .hover\\:border-b-accent {\n &:hover {\n @media (hover: hover) {\n border-bottom-color: var(--color-accent);\n }\n }\n }\n .hover\\:border-b-fg-muted {\n &:hover {\n @media (hover: hover) {\n border-bottom-color: var(--color-fg-muted);\n }\n }\n }\n .hover\\:\\!bg-accent-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-accent-hover) !important;\n }\n }\n }\n .hover\\:\\!bg-blue-700 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-blue-700) !important;\n }\n }\n }\n .hover\\:bg-accent {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-accent);\n }\n }\n }\n .hover\\:bg-accent-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-accent-hover);\n }\n }\n }\n .hover\\:bg-border-default {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-border-default);\n }\n }\n }\n .hover\\:bg-gray-50 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-gray-50);\n }\n }\n }\n .hover\\:bg-interactive-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-interactive-hover);\n }\n }\n }\n .hover\\:bg-transparent {\n &:hover {\n @media (hover: hover) {\n background-color: transparent;\n }\n }\n }\n .hover\\:text-accent-hover {\n &:hover {\n @media (hover: hover) {\n color: var(--color-accent-hover);\n }\n }\n }\n .hover\\:text-fg-on-accent {\n &:hover {\n @media (hover: hover) {\n color: var(--color-fg-on-accent);\n }\n }\n }\n .hover\\:text-fg-primary {\n &:hover {\n @media (hover: hover) {\n color: var(--color-fg-primary);\n }\n }\n }\n .hover\\:text-fg-secondary {\n &:hover {\n @media (hover: hover) {\n color: var(--color-fg-secondary);\n }\n }\n }\n .hover\\:shadow-md {\n &:hover {\n @media (hover: hover) {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:ring {\n &:hover {\n @media (hover: hover) {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:ring-0 {\n &:hover {\n @media (hover: hover) {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n .hover\\:ring-accent {\n &:hover {\n @media (hover: hover) {\n --tw-ring-color: var(--color-accent);\n }\n }\n }\n .hover\\:ring-transparent {\n &:hover {\n @media (hover: hover) {\n --tw-ring-color: transparent;\n }\n }\n }\n .focus\\:border-accent {\n &:focus {\n border-color: var(--color-accent);\n }\n }\n .focus\\:border-blue-500 {\n &:focus {\n border-color: var(--color-blue-500);\n }\n }\n .focus\\:border-transparent {\n &:focus {\n border-color: transparent;\n }\n }\n .focus\\:ring-1 {\n &:focus {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n .focus\\:ring-2 {\n &:focus {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n .focus\\:ring-accent {\n &:focus {\n --tw-ring-color: var(--color-accent);\n }\n }\n .focus\\:ring-blue-500 {\n &:focus {\n --tw-ring-color: var(--color-blue-500);\n }\n }\n .focus\\:outline-none {\n &:focus {\n --tw-outline-style: none;\n outline-style: none;\n }\n }\n .active\\:cursor-grabbing {\n &:active {\n cursor: grabbing;\n }\n }\n .active\\:bg-interactive-active {\n &:active {\n background-color: var(--color-interactive-active);\n }\n }\n .disabled\\:cursor-not-allowed {\n &:disabled {\n cursor: not-allowed;\n }\n }\n .disabled\\:opacity-40 {\n &:disabled {\n opacity: 40%;\n }\n }\n .disabled\\:opacity-50 {\n &:disabled {\n opacity: 50%;\n }\n }\n .disabled\\:hover\\:bg-transparent {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n background-color: transparent;\n }\n }\n }\n }\n .disabled\\:hover\\:ring-0 {\n &:disabled {\n &:hover {\n @media (hover: hover) {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n }\n }\n .md\\:flex {\n @media (width >= 48rem) {\n display: flex;\n }\n }\n .md\\:h-auto {\n @media (width >= 48rem) {\n height: auto;\n }\n }\n .md\\:max-h-\\[80vh\\] {\n @media (width >= 48rem) {\n max-height: 80vh;\n }\n }\n .md\\:w-\\[28rem\\] {\n @media (width >= 48rem) {\n width: 28rem;\n }\n }\n .md\\:max-w-\\[90vw\\] {\n @media (width >= 48rem) {\n max-width: 90vw;\n }\n }\n .md\\:flex-none {\n @media (width >= 48rem) {\n flex: none;\n }\n }\n .md\\:items-center {\n @media (width >= 48rem) {\n align-items: center;\n }\n }\n .md\\:justify-center {\n @media (width >= 48rem) {\n justify-content: center;\n }\n }\n .md\\:rounded-lg {\n @media (width >= 48rem) {\n border-radius: var(--radius-lg);\n }\n }\n .md\\:border {\n @media (width >= 48rem) {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n }\n .md\\:border-border-subtle {\n @media (width >= 48rem) {\n border-color: var(--color-border-subtle);\n }\n }\n .md\\:shadow-lg {\n @media (width >= 48rem) {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n }\n}\n@import url(\'https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap\');\n:host {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-rotate-x: rotateX(0);\n --tw-rotate-y: rotateY(0);\n --tw-rotate-z: rotateZ(0);\n --tw-skew-x: skewX(0);\n --tw-skew-y: skewY(0);\n --tw-border-style: solid;\n --tw-gradient-from: #0000;\n --tw-gradient-via: #0000;\n --tw-gradient-to: #0000;\n --tw-gradient-from-position: 0%;\n --tw-gradient-via-position: 50%;\n --tw-gradient-to-position: 100%;\n --tw-shadow: 0 0 #0000;\n --tw-inset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-outline-style: solid;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n height: 100%;\n font-family: \'Open Sans\', system-ui, sans-serif;\n color: var(--ep-foreground-primary);\n background-color: var(--ep-background-surface);\n}\n:host *::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\n:host *::-webkit-scrollbar-track {\n background: var(--ep-scrollbar-track);\n}\n:host *::-webkit-scrollbar-thumb {\n background: var(--ep-scrollbar-thumb);\n border-radius: 4px;\n}\n:host *::-webkit-scrollbar-thumb:hover {\n background: var(--ep-scrollbar-thumb-hover);\n}\n@property --tw-translate-x {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-y {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-translate-z {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-scale-x {\n syntax: "*";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-scale-y {\n syntax: "*";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-scale-z {\n syntax: "*";\n inherits: false;\n initial-value: 1;\n}\n@property --tw-rotate-x {\n syntax: "*";\n inherits: false;\n}\n@property --tw-rotate-y {\n syntax: "*";\n inherits: false;\n}\n@property --tw-rotate-z {\n syntax: "*";\n inherits: false;\n}\n@property --tw-skew-x {\n syntax: "*";\n inherits: false;\n}\n@property --tw-skew-y {\n syntax: "*";\n inherits: false;\n}\n@property --tw-space-y-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-space-x-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-divide-y-reverse {\n syntax: "*";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: "*";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-leading {\n syntax: "*";\n inherits: false;\n}\n@property --tw-font-weight {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-inset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-shadow-alpha {\n syntax: "<percentage>";\n inherits: false;\n initial-value: 100%;\n}\n@property --tw-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: "*";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: "<length>";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: "*";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: "*";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-outline-style {\n syntax: "*";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-backdrop-blur {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: "*";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: "*";\n inherits: false;\n}\n@property --tw-duration {\n syntax: "*";\n inherits: false;\n}\n@property --tw-ease {\n syntax: "*";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@layer properties {\n @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n *, ::before, ::after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-scale-z: 1;\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-space-y-reverse: 0;\n --tw-space-x-reverse: 0;\n --tw-divide-y-reverse: 0;\n --tw-border-style: solid;\n --tw-leading: initial;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-outline-style: solid;\n --tw-backdrop-blur: initial;\n --tw-backdrop-brightness: initial;\n --tw-backdrop-contrast: initial;\n --tw-backdrop-grayscale: initial;\n --tw-backdrop-hue-rotate: initial;\n --tw-backdrop-invert: initial;\n --tw-backdrop-opacity: initial;\n --tw-backdrop-saturate: initial;\n --tw-backdrop-sepia: initial;\n --tw-duration: initial;\n --tw-ease: initial;\n }\n }\n}\n',Ue=0;function We(e,t,n,o,i,r){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)"ref"==s?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ue,__i:-1,__u:0,__source:i,__self:r};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===l[s]&&(l[s]=a[s]);return S.vnode&&S.vnode(c),c}var Be=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(Be||{});function qe(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function Ge(e){return{width:Math.ceil(e.width),height:Math.ceil(e.height)}}function Ve(e){return{origin:qe(e.origin),size:Ge(e.size)}}function Ze(e){const{width:t,height:n}=e;return{width:n,height:t}}function Ke(e,t,n){return{width:(e=t%2==0?e:Ze(e)).width*n,height:e.height*n}}function Ye(e){const t=[e.p1.x,e.p2.x,e.p3.x,e.p4.x],n=[e.p1.y,e.p2.y,e.p3.y,e.p4.y];return{origin:{x:Math.min(...t),y:Math.min(...n)},size:{width:Math.max(...t)-Math.min(...t),height:Math.max(...n)-Math.min(...n)}}}function Xe(e){return{p1:{x:e.origin.x,y:e.origin.y},p2:{x:e.origin.x+e.size.width,y:e.origin.y},p3:{x:e.origin.x+e.size.width,y:e.origin.y+e.size.height},p4:{x:e.origin.x,y:e.origin.y+e.size.height}}}function Qe(e,t,n){let o=t.x,i=t.y;switch(n){case 0:o=t.x,i=t.y;break;case 1:o=e.height-t.y,i=t.x;break;case 2:o=e.width-t.x,i=e.height-t.y;break;case 3:o=t.y,i=e.width-t.x}return{x:o,y:i}}function Je(e,t){return{x:e.x*t,y:e.y*t}}function et(e){if(0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};const t=e.map(e=>e.x),n=e.map(e=>e.y),o=Math.min(...t),i=Math.min(...n);return{origin:{x:o,y:i},size:{width:Math.max(...t)-o,height:Math.max(...n)-i}}}function tt(e,t){return{origin:{x:e.origin.x-t,y:e.origin.y-t},size:{width:e.size.width+2*t,height:e.size.height+2*t}}}function nt(e,t,n){let o=t.origin.x,i=t.origin.y,r=t.size;switch(n){case 0:break;case 1:o=e.height-t.origin.y-t.size.height,i=t.origin.x,r=Ze(t.size);break;case 2:o=e.width-t.origin.x-t.size.width,i=e.height-t.origin.y-t.size.height;break;case 3:o=t.origin.y,i=e.width-t.origin.x-t.size.width,r=Ze(t.size)}return{origin:{x:o,y:i},size:{width:r.width,height:r.height}}}function ot(e,t){return{origin:{x:e.origin.x*t,y:e.origin.y*t},size:{width:e.size.width*t,height:e.size.height*t}}}function it(e,t,n,o){return ot(nt(e,t,n),o)}function rt(e){if(0===e.length)return null;let t=e[0].origin.x,n=e[0].origin.y,o=e[0].origin.x+e[0].size.width,i=e[0].origin.y+e[0].size.height;for(const r of e)t=Math.min(t,r.origin.x),n=Math.min(n,r.origin.y),o=Math.max(o,r.origin.x+r.size.width),i=Math.max(i,r.origin.y+r.size.height);return{origin:{x:t,y:n},size:{width:o-t,height:i-n}}}function at(e,t,n,o){const i=e.origin.x,r=e.origin.y,a=e.size.width,s=e.size.height,l=n/a,c=o/s,d=n/s,u=o/a;switch(t){case 0:return{a:l,b:0,c:0,d:c,e:-l*i,f:-c*r};case 3:return{a:0,b:-u,c:d,d:0,e:-d*r,f:u*(i+a)};case 2:return{a:-l,b:0,c:0,d:-c,e:l*(i+a),f:c*(r+s)};case 1:return{a:0,b:u,c:-d,d:0,e:d*(r+s),f:-u*i}}}class st{isEnabled(){return!1}debug(){}info(){}warn(){}error(){}perf(){}}class lt{isEnabled(){return!0}debug(e,t,...n){console.debug(`${e}.${t}`,...n)}info(e,t,...n){console.info(`${e}.${t}`,...n)}warn(e,t,...n){console.warn(`${e}.${t}`,...n)}error(e,t,...n){console.error(`${e}.${t}`,...n)}perf(e,t,n,o,...i){console.info(`${e}.${t}.${n}.${o}`,...i)}}class ct{constructor(e,t){this.logger=e,this.level=t}isEnabled(e){return this.level<={debug:0,info:1,warn:2,error:3}[e]}debug(e,t,...n){this.level<=0&&this.logger.debug(e,t,...n)}info(e,t,...n){this.level<=1&&this.logger.info(e,t,...n)}warn(e,t,...n){this.level<=2&&this.logger.warn(e,t,...n)}error(e,t,...n){this.level<=3&&this.logger.error(e,t,...n)}perf(e,t,n,o,...i){this.logger.perf(e,t,n,o,...i)}}class dt{constructor(){this.marks=new Map}isEnabled(){return!1}debug(e,t,...n){}info(e,t,...n){}warn(e,t,...n){}error(e,t,...n){}perf(e,t,n,o,i,...r){const a=`${e}.${t}.${n}.${o}.${i}`;switch(o){case"Begin":globalThis.performance.mark(a,{detail:r}),this.marks.set(`${e}.${t}.${n}.${i}`,Date.now());break;case"End":globalThis.performance.mark(a,{detail:r});const o=`${e}.${t}.${n}.Measure.${i}`,s=`${e}.${t}.${n}.Begin.${i}`;globalThis.performance.measure(o,s,a);const l=this.marks.get(`${e}.${t}.${n}.${i}`);if(l){const o=Date.now()-l;console.info(`⏱️ ${e}.${t}.${n}.${i}: ${o}ms`),this.marks.delete(`${e}.${t}.${n}.${i}`)}}}}class ut{constructor(e){this.loggers=e}isEnabled(e){return this.loggers.some(t=>t.isEnabled(e))}debug(e,t,...n){for(const o of this.loggers)o.debug(e,t,...n)}info(e,t,...n){for(const o of this.loggers)o.info(e,t,...n)}warn(e,t,...n){for(const o of this.loggers)o.warn(e,t,...n)}error(e,t,...n){for(const o of this.loggers)o.error(e,t,...n)}perf(e,t,n,o,...i){for(const r of this.loggers)r.perf(e,t,n,o,...i)}}var ht=(e=>(e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected",e[e.Aborted=3]="Aborted",e))(ht||{});class mt extends Error{constructor(e){super(`Task aborted: ${JSON.stringify(e)}`),this.name="TaskAbortedError",this.reason=e}}class gt extends Error{constructor(e){super(`Task rejected: ${JSON.stringify(e)}`),this.name="TaskRejectedError",this.reason=e}}class pt{constructor(){this.state={stage:0},this.resolvedCallbacks=[],this.rejectedCallbacks=[],this._promise=null,this.progressCbs=[]}toPromise(){return this._promise||(this._promise=new Promise((e,t)=>{this.wait(t=>e(t),e=>{"abort"===e.type?t(new mt(e.reason)):t(new gt(e.reason))})})),this._promise}wait(e,t){switch(this.state.stage){case 0:this.resolvedCallbacks.push(e),this.rejectedCallbacks.push(t);break;case 1:e(this.state.result);break;case 2:t({type:"reject",reason:this.state.reason});break;case 3:t({type:"abort",reason:this.state.reason})}}resolve(e){if(0===this.state.stage){this.state={stage:1,result:e};for(const t of this.resolvedCallbacks)try{t(e)}catch(e){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}reject(e){if(0===this.state.stage){this.state={stage:2,reason:e};for(const t of this.rejectedCallbacks)try{t({type:"reject",reason:e})}catch(e){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}abort(e){if(0===this.state.stage){this.state={stage:3,reason:e};for(const t of this.rejectedCallbacks)try{t({type:"abort",reason:e})}catch(e){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}fail(e){"abort"===e.type?this.abort(e.reason):this.reject(e.reason)}onProgress(e){this.progressCbs.push(e)}progress(e){for(const t of this.progressCbs)t(e)}static all(e){const t=new pt;if(0===e.length)return t.resolve([]),t;const n=new Array(e.length);let o=0,i=!1;return e.forEach((r,a)=>{r.wait(r=>{i||(n[a]=r,o++,o===e.length&&(i=!0,t.resolve(n)))},e=>{i||(i=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))})}),t}static allSettled(e){const t=new pt;if(0===e.length)return t.resolve([]),t;const n=new Array(e.length);let o=0;return e.forEach((i,r)=>{i.wait(i=>{n[r]={status:"resolved",value:i},o++,o===e.length&&t.resolve(n)},i=>{n[r]={status:"abort"===i.type?"aborted":"rejected",reason:i.reason},o++,o===e.length&&t.resolve(n)})}),t}static race(e){const t=new pt;if(0===e.length)return t.reject("No tasks provided"),t;let n=!1;return e.forEach(e=>{e.wait(e=>{n||(n=!0,t.resolve(e))},e=>{n||(n=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))})}),t}static withProgress(e,t){const n=pt.all(e);if(t){let n=0;e.forEach(o=>{o.wait(()=>{n++,t(n,e.length)},()=>{n++,t(n,e.length)})})}return n}}const vt=Object.freeze(["","","","\ufeff","",""]),ft=new RegExp(`[${vt.join("")}]`,"g");function yt(e){return e.replace(ft,"")}var bt=(e=>(e[e.Unknown=0]="Unknown",e[e.XYZ=1]="XYZ",e[e.FitPage=2]="FitPage",e[e.FitHorizontal=3]="FitHorizontal",e[e.FitVertical=4]="FitVertical",e[e.FitRectangle=5]="FitRectangle",e[e.FitBoundingBox=6]="FitBoundingBox",e[e.FitBoundingBoxHorizontal=7]="FitBoundingBoxHorizontal",e[e.FitBoundingBoxVertical=8]="FitBoundingBoxVertical",e))(bt||{}),wt=(e=>(e[e.NotSet=0]="NotSet",e[e.True=1]="True",e[e.False=2]="False",e[e.Unknown=3]="Unknown",e))(wt||{}),xt=(e=>(e[e.Unknown=-1]="Unknown",e[e.Courier=0]="Courier",e[e.Courier_Bold=1]="Courier_Bold",e[e.Courier_BoldOblique=2]="Courier_BoldOblique",e[e.Courier_Oblique=3]="Courier_Oblique",e[e.Helvetica=4]="Helvetica",e[e.Helvetica_Bold=5]="Helvetica_Bold",e[e.Helvetica_BoldOblique=6]="Helvetica_BoldOblique",e[e.Helvetica_Oblique=7]="Helvetica_Oblique",e[e.Times_Roman=8]="Times_Roman",e[e.Times_Bold=9]="Times_Bold",e[e.Times_BoldItalic=10]="Times_BoldItalic",e[e.Times_Italic=11]="Times_Italic",e[e.Symbol=12]="Symbol",e[e.ZapfDingbats=13]="ZapfDingbats",e))(xt||{}),Ct=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(Ct||{}),It=(e=>(e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom",e))(It||{}),St=(e=>(e[e.Normal=0]="Normal",e[e.Multiply=1]="Multiply",e[e.Screen=2]="Screen",e[e.Overlay=3]="Overlay",e[e.Darken=4]="Darken",e[e.Lighten=5]="Lighten",e[e.ColorDodge=6]="ColorDodge",e[e.ColorBurn=7]="ColorBurn",e[e.HardLight=8]="HardLight",e[e.SoftLight=9]="SoftLight",e[e.Difference=10]="Difference",e[e.Exclusion=11]="Exclusion",e[e.Hue=12]="Hue",e[e.Saturation=13]="Saturation",e[e.Color=14]="Color",e[e.Luminosity=15]="Luminosity",e))(St||{}),kt=(e=>(e[e.Contain=0]="Contain",e[e.Cover=1]="Cover",e[e.Stretch=2]="Stretch",e))(kt||{}),Dt=(e=>(e[e.Unsupported=0]="Unsupported",e[e.Goto=1]="Goto",e[e.RemoteGoto=2]="RemoteGoto",e[e.URI=3]="URI",e[e.LaunchAppOrOpenFile=4]="LaunchAppOrOpenFile",e))(Dt||{}),Mt=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.LINK=2]="LINK",e[e.FREETEXT=3]="FREETEXT",e[e.LINE=4]="LINE",e[e.SQUARE=5]="SQUARE",e[e.CIRCLE=6]="CIRCLE",e[e.POLYGON=7]="POLYGON",e[e.POLYLINE=8]="POLYLINE",e[e.HIGHLIGHT=9]="HIGHLIGHT",e[e.UNDERLINE=10]="UNDERLINE",e[e.SQUIGGLY=11]="SQUIGGLY",e[e.STRIKEOUT=12]="STRIKEOUT",e[e.STAMP=13]="STAMP",e[e.CARET=14]="CARET",e[e.INK=15]="INK",e[e.POPUP=16]="POPUP",e[e.FILEATTACHMENT=17]="FILEATTACHMENT",e[e.SOUND=18]="SOUND",e[e.MOVIE=19]="MOVIE",e[e.WIDGET=20]="WIDGET",e[e.SCREEN=21]="SCREEN",e[e.PRINTERMARK=22]="PRINTERMARK",e[e.TRAPNET=23]="TRAPNET",e[e.WATERMARK=24]="WATERMARK",e[e.THREED=25]="THREED",e[e.RICHMEDIA=26]="RICHMEDIA",e[e.XFAWIDGET=27]="XFAWIDGET",e[e.REDACT=28]="REDACT",e))(Mt||{}),Pt=(e=>(e[e.Normal=0]="Normal",e[e.Rollover=1]="Rollover",e[e.Down=2]="Down",e))(Pt||{}),At=(e=>(e[e.Unknown=-1]="Unknown",e[e.Comment=0]="Comment",e[e.Key=1]="Key",e[e.Note=2]="Note",e[e.Help=3]="Help",e[e.NewParagraph=4]="NewParagraph",e[e.Paragraph=5]="Paragraph",e[e.Insert=6]="Insert",e[e.Graph=7]="Graph",e[e.PushPin=8]="PushPin",e[e.Paperclip=9]="Paperclip",e[e.Tag=10]="Tag",e[e.Speaker=11]="Speaker",e[e.Mic=12]="Mic",e[e.Approved=13]="Approved",e[e.Experimental=14]="Experimental",e[e.NotApproved=15]="NotApproved",e[e.AsIs=16]="AsIs",e[e.Expired=17]="Expired",e[e.NotForPublicRelease=18]="NotForPublicRelease",e[e.Confidential=19]="Confidential",e[e.Final=20]="Final",e[e.Sold=21]="Sold",e[e.Departmental=22]="Departmental",e[e.ForComment=23]="ForComment",e[e.TopSecret=24]="TopSecret",e[e.Draft=25]="Draft",e[e.ForPublicRelease=26]="ForPublicRelease",e))(At||{}),Tt=(e=>(e[e.None=0]="None",e[e.Square=1]="Square",e[e.Circle=2]="Circle",e[e.Diamond=3]="Diamond",e[e.OpenArrow=4]="OpenArrow",e[e.ClosedArrow=5]="ClosedArrow",e[e.Butt=6]="Butt",e[e.ROpenArrow=7]="ROpenArrow",e[e.RClosedArrow=8]="RClosedArrow",e[e.Slash=9]="Slash",e[e.Unknown=10]="Unknown",e))(Tt||{}),zt=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.PUSHBUTTON=1]="PUSHBUTTON",e[e.CHECKBOX=2]="CHECKBOX",e[e.RADIOBUTTON=3]="RADIOBUTTON",e[e.COMBOBOX=4]="COMBOBOX",e[e.LISTBOX=5]="LISTBOX",e[e.TEXTFIELD=6]="TEXTFIELD",e[e.SIGNATURE=7]="SIGNATURE",e[e.XFA=8]="XFA",e[e.XFA_CHECKBOX=9]="XFA_CHECKBOX",e[e.XFA_COMBOBOX=10]="XFA_COMBOBOX",e[e.XFA_IMAGEFIELD=11]="XFA_IMAGEFIELD",e[e.XFA_LISTBOX=12]="XFA_LISTBOX",e[e.XFA_PUSHBUTTON=13]="XFA_PUSHBUTTON",e[e.XFA_SIGNATURE=14]="XFA_SIGNATURE",e[e.XFA_TEXTFIELD=15]="XFA_TEXTFIELD",e))(zt||{}),Et=(e=>(e[e.Color=0]="Color",e[e.InteriorColor=1]="InteriorColor",e))(Et||{}),_t=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.SOLID=1]="SOLID",e[e.DASHED=2]="DASHED",e[e.BEVELED=3]="BEVELED",e[e.INSET=4]="INSET",e[e.UNDERLINE=5]="UNDERLINE",e[e.CLOUDY=6]="CLOUDY",e))(_t||{}),Rt=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.PATH=2]="PATH",e[e.IMAGE=3]="IMAGE",e[e.SHADING=4]="SHADING",e[e.FORM=5]="FORM",e))(Rt||{});const Nt=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView"}),Ot=Object.entries(Nt).reduce((e,[t,n])=>(e[n]=Number(t),e),{});function Lt(e){return Object.keys(Nt).filter(t=>0!==(e&t)).map(e=>Nt[e])}function $t(e){return e.reduce((e,t)=>e|Ot[t],0)}var Ft=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))(Ft||{}),jt=(e=>(e[e.None=0]="None",e[e.MatchCase=1]="MatchCase",e[e.MatchWholeWord=2]="MatchWholeWord",e[e.MatchConsecutive=4]="MatchConsecutive",e))(jt||{}),Ht=(e=>(e[e.Display=0]="Display",e[e.Print=1]="Print",e))(Ht||{}),Ut=(e=>(e[e.Ok=0]="Ok",e[e.Unknown=1]="Unknown",e[e.NotFound=2]="NotFound",e[e.WrongFormat=3]="WrongFormat",e[e.Password=4]="Password",e[e.Security=5]="Security",e[e.PageError=6]="PageError",e[e.XFALoad=7]="XFALoad",e[e.XFALayout=8]="XFALayout",e[e.Cancelled=9]="Cancelled",e[e.Initialization=10]="Initialization",e[e.NotReady=11]="NotReady",e[e.NotSupport=12]="NotSupport",e[e.LoadDoc=13]="LoadDoc",e[e.DocNotOpen=14]="DocNotOpen",e[e.CantCloseDoc=15]="CantCloseDoc",e[e.CantCreateNewDoc=16]="CantCreateNewDoc",e[e.CantImportPages=17]="CantImportPages",e[e.CantCreateAnnot=18]="CantCreateAnnot",e[e.CantSetAnnotRect=19]="CantSetAnnotRect",e[e.CantSetAnnotContent=20]="CantSetAnnotContent",e[e.CantRemoveInkList=21]="CantRemoveInkList",e[e.CantAddInkStoke=22]="CantAddInkStoke",e[e.CantReadAttachmentSize=23]="CantReadAttachmentSize",e[e.CantReadAttachmentContent=24]="CantReadAttachmentContent",e[e.CantFocusAnnot=25]="CantFocusAnnot",e[e.CantSelectText=26]="CantSelectText",e[e.CantSelectOption=27]="CantSelectOption",e[e.CantCheckField=28]="CantCheckField",e[e.CantSetAnnotString=29]="CantSetAnnotString",e))(Ut||{});class Wt{static create(){return new pt}static resolve(e){const t=new pt;return t.resolve(e),t}static reject(e){const t=new pt;return t.reject(e),t}static abort(e){const t=new pt;return t.reject(e),t}}function Bt(e){const t=e=>(e=>Math.max(0,Math.min(255,e)))(e).toString(16).padStart(2,"0");return`#${t(e.red)}${t(e.green)}${t(e.blue)}`}function qt(e){/^#?[0-9a-f]{3}$/i.test(e)&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3").toLowerCase());const[,t,n,o]=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e)??(()=>{throw new Error(`Invalid hex colour: "${e}"`)})();return{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(o,16)}}function Gt(e){return(e=>Math.max(0,Math.min(255,e)))(e)/255}function Vt(e){return((e,t=255)=>Math.max(0,Math.min(t,e)))(Math.round(255*e))}function Zt(e){if(!(null==e?void 0:e.startsWith("D:"))||e.length<16)return;const t=+e.slice(2,6),n=+e.slice(6,8)-1,o=+e.slice(8,10),i=+e.slice(10,12),r=+e.slice(12,14),a=+e.slice(14,16);return new Date(Date.UTC(t,n,o,i,r,a))}function Kt(e=new Date){const t=(e,t=2)=>e.toString().padStart(t,"0");return`D:${e.getUTCFullYear()}${t(e.getUTCMonth()+1)}${t(e.getUTCDate())}${t(e.getUTCHours())}${t(e.getUTCMinutes())}${t(e.getUTCSeconds())}`}const Yt=Object.freeze([{id:Ct.Left,label:"Left",css:"left"},{id:Ct.Center,label:"Center",css:"center"},{id:Ct.Right,label:"Right",css:"right"}]),Xt=Yt.reduce((e,t)=>(e[t.id]=t,e),{});function Qt(e){return function(e){return Xt[e]??Xt[Ct.Left]}(e).css}Yt.reduce((e,t)=>(e[t.css]=t.id,e),{}),Yt.map(e=>({value:e.id,label:e.label}));var Jt=(e=>(e.Courier="Courier",e.Helvetica="Helvetica",e.Times="Times",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats",e.Unknown="Unknown",e))(Jt||{});const en=xt.Helvetica,tn={id:xt.Helvetica,family:"Helvetica",bold:!1,italic:!1,label:"Helvetica",css:"Helvetica, Arial, sans-serif"},nn=Object.freeze([{id:xt.Courier,family:"Courier",bold:!1,italic:!1,label:"Courier",css:"Courier, monospace"},{id:xt.Courier_Bold,family:"Courier",bold:!0,italic:!1,label:"Courier Bold",css:'"Courier-Bold", Courier, monospace'},{id:xt.Courier_BoldOblique,family:"Courier",bold:!0,italic:!0,label:"Courier Bold Oblique",css:'"Courier-BoldOblique", Courier, monospace'},{id:xt.Courier_Oblique,family:"Courier",bold:!1,italic:!0,label:"Courier Oblique",css:'"Courier-Oblique", Courier, monospace'},tn,{id:xt.Helvetica_Bold,family:"Helvetica",bold:!0,italic:!1,label:"Helvetica Bold",css:'"Helvetica-Bold", Arial, sans-serif'},{id:xt.Helvetica_BoldOblique,family:"Helvetica",bold:!0,italic:!0,label:"Helvetica Bold Oblique",css:'"Helvetica-BoldOblique", Arial, sans-serif'},{id:xt.Helvetica_Oblique,family:"Helvetica",bold:!1,italic:!0,label:"Helvetica Oblique",css:'"Helvetica-Oblique", Arial, sans-serif'},{id:xt.Times_Roman,family:"Times",bold:!1,italic:!1,label:"Times Roman",css:'"Times New Roman", Times, serif'},{id:xt.Times_Bold,family:"Times",bold:!0,italic:!1,label:"Times Bold",css:'"Times New Roman Bold", Times, serif'},{id:xt.Times_BoldItalic,family:"Times",bold:!0,italic:!0,label:"Times Bold Italic",css:'"Times New Roman Bold Italic", Times, serif'},{id:xt.Times_Italic,family:"Times",bold:!1,italic:!0,label:"Times Italic",css:'"Times New Roman Italic", Times, serif'},{id:xt.Symbol,family:"Symbol",bold:!1,italic:!1,label:"Symbol",css:"Symbol"},{id:xt.ZapfDingbats,family:"ZapfDingbats",bold:!1,italic:!1,label:"Zapf Dingbats",css:"ZapfDingbats"}]),on=nn.reduce((e,t)=>(e[t.id]=t,e),{}),rn=new Map;for(const e of nn)rn.set(`${e.family}_${e.bold}_${e.italic}`,e.id);function an(e){return on[e]??tn}function sn(e){return an(e).bold}function ln(e){return an(e).italic}function cn(e,{bold:t,italic:n}){return rn.get(`${e}_${t}_${n}`)??en}Object.values(Jt).filter(e=>"Unknown"!==e).map(e=>({value:e,label:e}));const dn=[...new Set(nn.map(e=>e.family))];function un(e){switch(e){case"Courier":return"Courier";case"Helvetica":default:return"Helvetica";case"Times":return"Times";case"Symbol":return"Symbol";case"ZapfDingbats":return"ZapfDingbats"}}const hn=Object.freeze([{id:St.Normal,label:"Normal",css:"normal"},{id:St.Multiply,label:"Multiply",css:"multiply"},{id:St.Screen,label:"Screen",css:"screen"},{id:St.Overlay,label:"Overlay",css:"overlay"},{id:St.Darken,label:"Darken",css:"darken"},{id:St.Lighten,label:"Lighten",css:"lighten"},{id:St.ColorDodge,label:"Color Dodge",css:"color-dodge"},{id:St.ColorBurn,label:"Color Burn",css:"color-burn"},{id:St.HardLight,label:"Hard Light",css:"hard-light"},{id:St.SoftLight,label:"Soft Light",css:"soft-light"},{id:St.Difference,label:"Difference",css:"difference"},{id:St.Exclusion,label:"Exclusion",css:"exclusion"},{id:St.Hue,label:"Hue",css:"hue"},{id:St.Saturation,label:"Saturation",css:"saturation"},{id:St.Color,label:"Color",css:"color"},{id:St.Luminosity,label:"Luminosity",css:"luminosity"}]),mn=hn.reduce((e,t)=>(e[t.id]=t,e),{});function gn(e){return function(e){return mn[e]??mn[St.Normal]}(e).css}hn.reduce((e,t)=>(e[t.css]=t.id,e),{}),hn.map(e=>({value:e.id,label:e.label}));const pn=hn.map(e=>e.id);function vn(e){if(e instanceof st)return{type:"noop"};if(e instanceof lt)return{type:"console"};if(e instanceof dt)return{type:"perf"};if(e instanceof ct){const t=e;return{type:"level",config:{level:t.level,logger:vn(t.logger)}}}if(e instanceof ut){return{type:"all",config:{loggers:e.loggers.map(vn)}}}return{type:"noop"}}const fn=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function yn(e){return fn.test(e)}function bn(){var e;if("function"==typeof(null==(e=globalThis.crypto)?void 0:e.randomUUID))return globalThis.crypto.randomUUID();const t=function(e){var t;if("function"==typeof(null==(t=globalThis.crypto)?void 0:t.getRandomValues))return globalThis.crypto.getRandomValues(new Uint8Array(e));if("function"==typeof require)try{const{randomBytes:t}=require("crypto");return t(e)}catch{}const n=new Uint8Array(e);for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}(16);t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}class wn extends pt{constructor(e={}){super(),this.children=new Map,this.childResults=[],this.completedCount=0,this.expectedCount=0,this.isFinalized=!1,this.config={aggregate:e.aggregate??(e=>e),onChildComplete:e.onChildComplete??(()=>{}),failFast:e.failFast??!0}}addChild(e,t){if(this.state.stage!==ht.Pending)return this.state.stage===ht.Aborted&&e.abort(this.state.reason),this;const n=t??this.expectedCount;return this.expectedCount=Math.max(this.expectedCount,n+1),this.children.set(e,n),e.wait(t=>this.handleChildSuccess(e,t,n),t=>this.handleChildError(e,t,n)),this}finalize(){return this.isFinalized||(this.isFinalized=!0,0===this.expectedCount&&this.resolve(this.config.aggregate([]))),this}handleChildSuccess(e,t,n){if(this.state.stage!==ht.Pending)return;this.childResults[n]=t,this.completedCount++,this.children.delete(e);const o=this.config.onChildComplete(this.completedCount,this.expectedCount,t,n);if(void 0!==o&&this.progress(o),this.completedCount===this.expectedCount){const e=this.config.aggregate(this.childResults);this.resolve(e)}}handleChildError(e,t,n){if(this.state.stage===ht.Pending)if(this.children.delete(e),this.config.failFast){for(const[e]of this.children)e.abort("Sibling task failed");this.children.clear(),this.fail(t)}else if(this.childResults[n]=void 0,this.completedCount++,this.completedCount===this.expectedCount){const e=this.config.aggregate(this.childResults);this.resolve(e)}}abort(e){for(const[t]of this.children)t.abort(e);this.children.clear(),super.abort(e)}reject(e){for(const[t]of this.children)t.abort(e);this.children.clear(),super.reject(e)}getPendingCount(){return this.children.size}getCompletedCount(){return this.completedCount}static gather(e){const t=new wn({aggregate:e=>e,onChildComplete:(e,t)=>({completed:e,total:t})});return e.forEach((e,n)=>t.addChild(e,n)),t.finalize(),t}static gatherIndexed(e){const t=new wn({aggregate:e=>{const t={};return e.forEach((e,n)=>{t[n]=e}),t},onChildComplete:(e,t,n,o)=>({page:o,result:n})});return e.forEach((e,n)=>t.addChild(e,n)),t.finalize(),t}static gatherFrom(e,t){const n=new wn(t);return e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}static first(e){let t=!1;const n=new wn({aggregate:e=>e[0],failFast:!1});return n.handleChildSuccess=(e,o)=>{if(!t){t=!0;for(const[t]of n.children)t!==e&&t.abort("Race won by sibling");n.resolve(o)}},e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}}function xn(){}class Cn{constructor(){this.dependencyGraph=new Map}addNode(e,t=[]){this.dependencyGraph.set(e,new Set(t))}hasCircularDependencies(){const e=new Set,t=new Set,n=o=>{e.add(o),t.add(o);const i=this.dependencyGraph.get(o)||new Set;for(const o of i)if(e.has(o)){if(t.has(o))return!0}else if(n(o))return!0;return t.delete(o),!1};for(const t of this.dependencyGraph.keys())if(!e.has(t)&&n(t))return!0;return!1}resolveLoadOrder(){if(this.hasCircularDependencies())throw new Error("Circular dependencies detected");const e=[],t=new Set,n=new Set,o=i=>{if(n.has(i))throw new Error("Circular dependency");if(t.has(i))return;n.add(i);const r=this.dependencyGraph.get(i)||new Set;for(const e of r)o(e);n.delete(i),t.add(i),e.push(i)};for(const e of this.dependencyGraph.keys())t.has(e)||o(e);return e}}class In extends Error{constructor(e){super(e),this.name="PluginRegistrationError"}}class Sn extends Error{constructor(e){super(e),this.name="PluginNotFoundError"}}class kn extends Error{constructor(e){super(e),this.name="CircularDependencyError"}}class Dn extends Error{constructor(e){super(e),this.name="PluginConfigurationError"}}class Mn{constructor(e,t){this.store=e,this.pluginId=t}getState(){return this.store.getState().plugins[this.pluginId]}dispatch(e){return this.store.dispatchToPlugin(this.pluginId,e)}subscribeToState(e){return this.store.subscribeToPlugin(this.pluginId,(t,n,o)=>{e(t,n,o)})}onAction(e,t){return this.store.onAction(e,(e,n,o)=>{t(e,n.plugins[this.pluginId],o.plugins[this.pluginId])})}}const Pn="START_LOADING_DOCUMENT",An="UPDATE_DOCUMENT_LOADING_PROGRESS",Tn="SET_DOCUMENT_LOADED",zn="SET_DOCUMENT_ERROR",En="RETRY_LOADING_DOCUMENT",_n="CLOSE_DOCUMENT",Rn="SET_ACTIVE_DOCUMENT",Nn="REORDER_DOCUMENTS",On="MOVE_DOCUMENT",Ln="REFRESH_PAGES",$n="SET_SCALE",Fn="SET_ROTATION",jn=[Pn,An,Tn,_n,Rn,zn,En,"REFRESH_DOCUMENT",Ln,"SET_PAGES",$n,Fn,"SET_DEFAULT_SCALE","SET_DEFAULT_ROTATION",Nn,On],Hn=(e,t,n,o,i,r)=>({type:Pn,payload:{documentId:e,name:t,scale:n,rotation:o,passwordProvided:i,autoActivate:r}}),Un=(e,t)=>({type:_n,payload:{documentId:e,nextActiveDocumentId:t}}),Wn=(e,t)=>({type:Ln,payload:{documentId:e,pageIndexes:t}}),Bn=(e,t)=>({type:Fn,payload:{rotation:e,documentId:t}});class qn{constructor(e,t){this.initialCoreState=t,this.pluginReducers={},this.listeners=[],this.pluginListeners={},this.isDispatching=!1,this.state={core:t,plugins:{}},this.coreReducer=e}addPluginReducer(e,t,n){this.state.plugins[e]=n,this.pluginReducers[e]=t}dispatchToCore(e){if(!this.coreReducer)return this.getState();if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const t=this.getState();try{this.isDispatching=!0,this.state.core=this.coreReducer(this.state.core,e)}finally{this.isDispatching=!1}return this.listeners.forEach(n=>{const o=this.getState();n(e,o,t)}),this.getState()}dispatchToPlugin(e,t,n=!0){if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const o=this.getState(),i=this.pluginReducers[e];if(!i)return o.plugins[e];const r=o.plugins[e];try{this.isDispatching=!0;const n=i(r,t);this.state.plugins[e]=n}finally{this.isDispatching=!1}return n&&this.listeners.forEach(e=>{const n=this.getState();e(t,n,o)}),this.pluginListeners[e]&&this.pluginListeners[e].forEach(n=>{const o=this.getState().plugins[e];n(t,o,r)}),this.getState().plugins[e]}dispatch(e){if(this.isDispatching)throw new Error("Reducers may not dispatch actions. To trigger cascading actions, dispatch from a listener callback instead.");const t=this.getState();try{this.isDispatching=!0,this.isCoreAction(e)&&(this.state.core=this.coreReducer(this.state.core,e));for(const n in this.pluginReducers){const o=this.pluginReducers[n],i=t.plugins[n];o&&(this.state.plugins[n]=o(i,e))}}finally{this.isDispatching=!1}return this.listeners.forEach(n=>{const o=this.getState();n(e,o,t)}),this.getState()}getState(){if(this.isDispatching)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return{core:{...this.state.core},plugins:{...this.state.plugins}}}subscribe(e){if(this.isDispatching)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state.");return this.listeners.push(e),()=>{if(this.isDispatching)throw new Error("You may not unsubscribe from a store listener while the reducer is executing.");this.listeners=this.listeners.filter(t=>t!==e)}}subscribeToPlugin(e,t){if(!(e in this.state.plugins))throw new Error(`Plugin state not found for plugin "${e}". Did you forget to call addPluginReducer?`);if(this.isDispatching)throw new Error("You may not call store.subscribeToPlugin() while the reducer is executing.");return this.pluginListeners[e]||(this.pluginListeners[e]=[]),this.pluginListeners[e].push(t),()=>{if(this.isDispatching)throw new Error("You may not unsubscribe from a store listener while the reducer is executing.");this.pluginListeners[e]=this.pluginListeners[e].filter(e=>e!==t),0===this.pluginListeners[e].length&&delete this.pluginListeners[e]}}onAction(e,t){return this.subscribe((n,o,i)=>{n.type===e&&t(n,o,i)})}getPluginStore(e){if(!(e in this.state.plugins))throw new Error(`Plugin state not found for plugin "${e}". Did you forget to call addPluginReducer?`);return new Mn(this,e)}isCoreAction(e){return jn.includes(e.type)}destroy(){var e,t;this.listeners.length=0;for(const n in this.pluginListeners)null==(t=null==(e=this.pluginListeners[n])?void 0:e.splice)||t.call(e,0);this.pluginListeners={},this.pluginReducers={},this.state.plugins={},this.state.core={...this.initialCoreState}}}function Gn(e,t,n){const o=e.activeDocumentId;if(o!==t)return o;if(void 0!==n)return n&&e.documents[n]?n:null;const i=e.documentOrder.indexOf(t);return-1===i?null:i>0?e.documentOrder[i-1]:i<e.documentOrder.length-1?e.documentOrder[i+1]:null}const Vn=(e,t)=>{switch(t.type){case Pn:{const{documentId:n,name:o,scale:i,rotation:r,passwordProvided:a,autoActivate:s=!0}=t.payload,l={id:n,name:o,status:"loading",loadingProgress:0,error:null,document:null,scale:i??e.defaultScale,rotation:r??e.defaultRotation,passwordProvided:a??!1,pageRefreshVersions:{},loadStartedAt:Date.now()};return{...e,documents:{...e.documents,[n]:l},documentOrder:[...e.documentOrder,n],activeDocumentId:s||!e.activeDocumentId?n:e.activeDocumentId}}case An:{const{documentId:n,progress:o}=t.payload,i=e.documents[n];return i&&"loading"===i.status?{...e,documents:{...e.documents,[n]:{...i,loadingProgress:o}}}:e}case Tn:{const{documentId:n,document:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,status:"loaded",document:o,error:null,errorCode:void 0,errorDetails:void 0,passwordProvided:void 0,loadedAt:Date.now()}}}:e}case zn:{const{documentId:n,error:o,errorCode:i,errorDetails:r}=t.payload,a=e.documents[n];return a?{...e,documents:{...e.documents,[n]:{...a,status:"error",error:o,errorCode:i,errorDetails:r}}}:e}case En:{const{documentId:n,passwordProvided:o}=t.payload,i=e.documents[n];return i&&"error"===i.status?{...e,documents:{...e.documents,[n]:{...i,status:"loading",loadingProgress:0,error:null,errorCode:void 0,errorDetails:void 0,passwordProvided:o??!1,loadStartedAt:Date.now()}}}:e}case _n:{const{documentId:n,nextActiveDocumentId:o}=t.payload,{[n]:i,...r}=e.documents;return{...e,documents:r,documentOrder:e.documentOrder.filter(e=>e!==n),activeDocumentId:Gn(e,n,o)}}case On:{const{documentId:n,toIndex:o}=t.payload,i=function(e,t,n){const o=e.indexOf(t);if(-1===o)return null;if(n<0||n>=e.length)return null;if(o===n)return null;const i=[...e];return i.splice(o,1),i.splice(n,0,t),i}(e.documentOrder,n,o);return i?{...e,documentOrder:i}:e}case Nn:return{...e,documentOrder:t.payload};case Rn:return{...e,activeDocumentId:t.payload};case $n:{const{scale:n,documentId:o}=t.payload,i=o??e.activeDocumentId;if(!i)return e;const r=e.documents[i];return r?{...e,documents:{...e.documents,[i]:{...r,scale:n}}}:e}case Fn:{const{rotation:n,documentId:o}=t.payload,i=o??e.activeDocumentId;if(!i)return e;const r=e.documents[i];return r?{...e,documents:{...e.documents,[i]:{...r,rotation:n}}}:e}case Ln:{const{documentId:n,pageIndexes:o}=t.payload,i=e.documents[n];if(!i)return e;const r={...i.pageRefreshVersions};for(const e of o)r[e]=(r[e]||0)+1;return{...e,documents:{...e.documents,[n]:{...i,pageRefreshVersions:r}}}}default:return e}};class Zn{constructor(e,t){this.plugins=new Map,this.manifests=new Map,this.capabilities=new Map,this.status=new Map,this.configurations=new Map,this.engineInitialized=!1,this.initPromise=null,this.pendingRegistrations=[],this.processingRegistrations=[],this.initialized=!1,this.isInitializing=!1,this.pluginsReadyPromise=null,this.destroyed=!1,this.resolver=new Cn,this.engine=e,this.initialCoreState=(e=>({documents:{},documentOrder:[],activeDocumentId:null,defaultScale:(null==e?void 0:e.defaultScale)??1,defaultRotation:(null==e?void 0:e.defaultRotation)??Be.Degree0}))(t),this.store=new qn(Vn,this.initialCoreState),this.logger=(null==t?void 0:t.logger)??new st}getLogger(){return this.logger}async ensureEngineInitialized(){if(!this.engineInitialized)if(this.engine.initialize){const e=this.engine.initialize();await e.toPromise(),this.engineInitialized=!0}else this.engineInitialized=!0}registerPlugin(e,t){if(this.initialized&&!this.isInitializing)throw new In("Cannot register plugins after initialization");this.validateManifest(e.manifest),this.store.addPluginReducer(e.manifest.id,e.reducer,"function"==typeof e.initialState?e.initialState(this.initialCoreState,{...e.manifest.defaultConfig,...t}):e.initialState),this.pendingRegistrations.push({package:e,config:t})}getStore(){return this.store}getEngine(){return this.engine}pluginsReady(){return this.pluginsReadyPromise||(this.pluginsReadyPromise=(async()=>{this.initialized||await this.initialize();const e=Array.from(this.plugins.values()).map(e=>"function"==typeof e.ready?e.ready():Promise.resolve());await Promise.all(e)})()),this.pluginsReadyPromise}async initialize(){if(this.destroyed)throw new In("Registry has been destroyed");return this.initPromise||(this.initPromise=(async()=>{if(this.initialized)throw new In("Registry is already initialized");this.isInitializing=!0;try{if(await this.ensureEngineInitialized(),this.destroyed)return;for(;this.pendingRegistrations.length>0;){if(this.destroyed)return;this.processingRegistrations=[...this.pendingRegistrations],this.pendingRegistrations=[];for(const e of this.processingRegistrations){const t=new Set,n=[...e.package.manifest.requires,...e.package.manifest.optional];for(const e of n){const n=this.processingRegistrations.find(t=>t.package.manifest.provides.includes(e));n&&t.add(n.package.manifest.id)}this.resolver.addNode(e.package.manifest.id,[...t])}const e=this.resolver.resolveLoadOrder();for(const t of e){const e=this.processingRegistrations.find(e=>e.package.manifest.id===t);this.instantiatePlugin(e.package.manifest,e.package.create,e.config)}for(const t of e)await this.runPluginInitialization(t);this.processingRegistrations=[],this.resolver=new Cn}this.initialized=!0}catch(e){if(e instanceof Error)throw new kn(`Failed to resolve plugin dependencies: ${e.message}`);throw e}finally{this.isInitializing=!1}})()),this.initPromise}instantiatePlugin(e,t,n){const o={...e.defaultConfig,...n};this.validateConfig(e.id,o,e.defaultConfig);const i=t(this,o);this.validatePlugin(i);for(const t of e.provides){if(this.capabilities.has(t))throw new In(`Capability ${t} is already provided by plugin ${this.capabilities.get(t)}`);this.capabilities.set(t,e.id)}this.plugins.set(e.id,i),this.manifests.set(e.id,e),this.status.set(e.id,"registered"),this.configurations.set(e.id,o)}async runPluginInitialization(e){const t=this.plugins.get(e);if(!t)return;const n=this.manifests.get(e),o=this.configurations.get(e);for(const t of n.requires)if(!this.capabilities.has(t))throw new In(`Missing required capability: ${t} for plugin ${e}`);this.logger.debug("PluginRegistry","InitializePlugin",`Initializing plugin ${e}`);try{t.initialize&&await t.initialize(o),this.status.set(e,"active"),this.logger.info("PluginRegistry","PluginInitialized",`Plugin ${e} initialized successfully`)}catch(t){throw this.status.set(e,"error"),this.logger.error("PluginRegistry","InitializationFailed",`Plugin ${e} initialization failed`,{error:t}),t}}getPluginConfig(e){const t=this.configurations.get(e);if(!t)throw new Sn(`Configuration for plugin ${e} not found`);return t}validateConfig(e,t,n){const o=Object.keys(n).filter(e=>!t.hasOwnProperty(e));if(o.length>0)throw new Dn(`Missing required configuration keys for plugin ${e}: ${o.join(", ")}`)}async updatePluginConfig(e,t){const n=this.getPlugin(e);if(!n)throw new Sn(`Plugin ${e} not found`);const o=this.manifests.get(e),i=this.configurations.get(e);if(!o||!i)throw new Sn(`Plugin ${e} not found`);const r={...i,...t};this.validateConfig(e,r,o.defaultConfig),this.configurations.set(e,r),n.initialize&&await n.initialize(r)}registerPluginBatch(e){for(const t of e)this.registerPlugin(t.package,t.config)}async unregisterPlugin(e){const t=this.plugins.get(e);if(!t)throw new Sn(`Plugin ${e} is not registered`);const n=this.manifests.get(e);if(!n)throw new Sn(`Manifest for plugin ${e} not found`);for(const[t,o]of this.manifests.entries()){if(t===e)continue;if([...o.requires,...o.optional].some(e=>n.provides.includes(e)))throw new In(`Cannot unregister plugin ${e}: plugin ${t} depends on it`)}try{t.destroy&&await t.destroy();for(const e of n.provides)this.capabilities.delete(e);this.plugins.delete(e),this.manifests.delete(e),this.status.delete(e)}catch(t){if(t instanceof Error)throw new Error(`Failed to unregister plugin ${e}: ${t.message}`);throw t}}getPlugin(e){const t=this.plugins.get(e);return t||null}getCapabilityProvider(e){const t=this.capabilities.get(e);return t?this.getPlugin(t):null}hasCapability(e){return this.capabilities.has(e)}getAllPlugins(){return Array.from(this.plugins.values())}getPluginStatus(e){const t=this.status.get(e);if(!t)throw new Sn(`Plugin ${e} not found`);return t}validatePlugin(e){if(!e.id)throw new In("Plugin must have an id")}validateManifest(e){if(!e.id)throw new In("Manifest must have an id");if(!e.name)throw new In("Manifest must have a name");if(!e.version)throw new In("Manifest must have a version");if(!Array.isArray(e.provides))throw new In("Manifest must have a provides array");if(!Array.isArray(e.requires))throw new In("Manifest must have a requires array");if(!Array.isArray(e.optional))throw new In("Manifest must have an optional array")}isDestroyed(){return this.destroyed}async destroy(){var e;if(this.destroyed)throw new In("Registry has already been destroyed");this.destroyed=!0;try{await this.initPromise}catch{}for(const t of Array.from(this.plugins.values()).reverse())await(null==(e=t.destroy)?void 0:e.call(t));this.store.destroy(),this.plugins.clear(),this.manifests.clear(),this.capabilities.clear(),this.status.clear(),this.pendingRegistrations.length=0,this.processingRegistrations.length=0}}function Kn(e,t){return{package:e,config:t}}function Yn(e){return"autoMountElements"in e&&"function"==typeof e.autoMountElements}class Xn{constructor(e,t){if(this.id=e,this.registry=t,this.cooldownActions={},this.debouncedTimeouts={},this.unsubscribeFromState=null,this.unsubscribeFromCoreStore=null,this.unsubscribeFromStartLoadingDocument=null,this.unsubscribeFromSetDocumentLoaded=null,this.unsubscribeFromCloseDocument=null,this.unsubscribeFromSetScale=null,this.unsubscribeFromSetRotation=null,e!==this.constructor.id)throw new Error(`Plugin ID mismatch: ${e} !== ${this.constructor.id}`);this.engine=this.registry.getEngine(),this.logger=this.registry.getLogger(),this.coreStore=this.registry.getStore(),this.pluginStore=this.coreStore.getPluginStore(this.id),this.unsubscribeFromState=this.pluginStore.subscribeToState((e,t,n)=>{this.onStoreUpdated(n,t)}),this.unsubscribeFromCoreStore=this.coreStore.subscribe((e,t,n)=>{this.onCoreStoreUpdated(n,t),t.core.activeDocumentId!==n.core.activeDocumentId&&this.onActiveDocumentChanged(n.core.activeDocumentId,t.core.activeDocumentId)}),this.unsubscribeFromStartLoadingDocument=this.coreStore.onAction(Pn,e=>{this.onDocumentLoadingStarted(e.payload.documentId)}),this.unsubscribeFromSetDocumentLoaded=this.coreStore.onAction(Tn,e=>{this.onDocumentLoaded(e.payload.documentId)}),this.unsubscribeFromCloseDocument=this.coreStore.onAction(_n,e=>{this.onDocumentClosed(e.payload.documentId)}),this.unsubscribeFromSetScale=this.coreStore.onAction($n,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onScaleChanged(n,e.payload.scale)}),this.unsubscribeFromSetRotation=this.coreStore.onAction(Fn,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onRotationChanged(n,e.payload.rotation)}),this.readyPromise=new Promise(e=>{this.readyResolve=e}),this.readyResolve()}provides(){if(!this._capability){const e=this.buildCapability();this._capability=Object.freeze(e)}return this._capability}get state(){return this.pluginStore.getState()}get coreState(){return this.coreStore.getState()}getState(){return this.pluginStore.getState()}getCoreState(){return this.coreStore.getState()}dispatchCoreAction(e){return this.coreStore.dispatchToCore(e)}dispatchToAllPlugins(e){return this.coreStore.dispatch(e)}dispatch(e){return this.pluginStore.dispatch(e)}cooldownDispatch(e,t=100){const n=Date.now();return n-(this.cooldownActions[e.type]||0)>=t&&(this.cooldownActions[e.type]=n,this.dispatch(e),!0)}debouncedDispatch(e,t=100){const n=e.type;this.debouncedTimeouts[n]&&clearTimeout(this.debouncedTimeouts[n]),this.debouncedTimeouts[n]=setTimeout(()=>{this.dispatch(e),delete this.debouncedTimeouts[n]},t)}cancelDebouncedDispatch(e){this.debouncedTimeouts[e]&&(clearTimeout(this.debouncedTimeouts[e]),delete this.debouncedTimeouts[e])}subscribe(e){return this.pluginStore.subscribeToState(e)}subscribeToCoreStore(e){return this.coreStore.subscribe(e)}onStoreUpdated(e,t){}onCoreStoreUpdated(e,t){}onDocumentLoadingStarted(e){}onDocumentLoaded(e){}onDocumentClosed(e){}onActiveDocumentChanged(e,t){}onScaleChanged(e,t){}onRotationChanged(e,t){}destroy(){Object.values(this.debouncedTimeouts).forEach(e=>{clearTimeout(e)}),this.debouncedTimeouts={},this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=null),this.unsubscribeFromCoreStore&&(this.unsubscribeFromCoreStore(),this.unsubscribeFromCoreStore=null),this.unsubscribeFromStartLoadingDocument&&(this.unsubscribeFromStartLoadingDocument(),this.unsubscribeFromStartLoadingDocument=null),this.unsubscribeFromSetDocumentLoaded&&(this.unsubscribeFromSetDocumentLoaded(),this.unsubscribeFromSetDocumentLoaded=null),this.unsubscribeFromCloseDocument&&(this.unsubscribeFromCloseDocument(),this.unsubscribeFromCloseDocument=null),this.unsubscribeFromSetScale&&(this.unsubscribeFromSetScale(),this.unsubscribeFromSetScale=null),this.unsubscribeFromSetRotation&&(this.unsubscribeFromSetRotation(),this.unsubscribeFromSetRotation=null)}ready(){return this.readyPromise}markReady(){this.readyResolve()}resetReady(){this.readyPromise=new Promise(e=>{this.readyResolve=e})}getActiveDocumentId(){const e=this.coreState.core.activeDocumentId;if(!e)throw new Error("No active document");return e}getActiveDocumentIdOrNull(){return this.coreState.core.activeDocumentId}getCoreDocument(e){const t=e??this.getActiveDocumentIdOrNull();return t?this.coreState.core.documents[t]??null:null}getCoreDocumentOrThrow(e){const t=this.getCoreDocument(e);if(!t)throw new Error(`Document not found: ${e??"active"}`);return t}}class Qn{constructor(e,t){this.handler=e,this.options=t,this.lastRun=0,this.handle=e=>{"debounce"===this.options.mode?this.debounce(e):this.throttle(e)}}debounce(e){this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.handler(e),this.timeoutId=void 0},this.options.wait)}throttle(e){if("debounce"===this.options.mode)return;const t=Date.now(),n=this.options.throttleMode||"leading-trailing";t-this.lastRun>=this.options.wait&&("leading-trailing"===n&&this.handler(e),this.lastRun=t),this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.handler(e),this.lastRun=Date.now(),this.timeoutId=void 0},this.options.wait-(t-this.lastRun))}destroy(){this.timeoutId&&window.clearTimeout(this.timeoutId)}}class Jn{constructor(e,t){this.handler=e,this.options=t,this.controls=new Map,this.handle=e=>{const t=String(this.options.keyExtractor(e));let n=this.controls.get(t);n||(n=new Qn(this.handler,this.baseOptions),this.controls.set(t,n)),n.handle(e)},this.baseOptions={mode:t.mode,wait:t.wait,..."throttle"===t.mode&&"throttleMode"in t?{throttleMode:t.throttleMode}:{}}}destroy(){for(const e of this.controls.values())e.destroy();this.controls.clear()}}function eo(e){return"keyExtractor"in e}function to(e,t,n){return e<t?t:e>n?n:e}function no(e,t,n){if(e===t)return!0;if(null==e||null==t)return e===t;const o=typeof e;if(o!==typeof t)return!1;if("object"===o){n||(n=new Set);const o=function(e,t){return`${ro(e)}__${ro(t)}`}(e,t);if(n.has(o))return!0;n.add(o);const i=Array.isArray(e),r=Array.isArray(t);return i&&r?function(e,t,n){if(e.length!==t.length)return!1;const o=new Array(t.length).fill(!1);e:for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<t.length;e++)if(!o[e]&&no(r,t[e],n)){o[e]=!0;continue e}return!1}return!0}(e,t,n):!i&&!r&&function(e,t,n){const o=Object.keys(e).sort(),i=Object.keys(t).sort();if(o.length!==i.length)return!1;for(let e=0;e<o.length;e++)if(o[e]!==i[e])return!1;for(const i of o){if(!no(e[i],t[i],n))return!1}return!0}(e,t,n)}return!1}let oo=0;const io=new WeakMap;function ro(e){return io.has(e)||io.set(e,++oo),io.get(e)}function ao(){const e=new Set;return{emit:(t=void 0)=>e.forEach(e=>e(t)),on:t=>(e.add(t),()=>e.delete(t)),off:t=>e.delete(t),clear:()=>e.clear()}}function so(e,t=no){const n=new Set,o=new Map;let i=e;const r=(e,t)=>{let r=e,a=()=>{};if(t){if(eo(t)){const n=new Jn(e,t);r=n.handle,a=()=>n.destroy()}else{const n=new Qn(e,t);r=n.handle,a=()=>n.destroy()}o.set(e,{wrapped:r,destroy:a})}return void 0!==i&&r(i),n.add(r),()=>{n.delete(r),a(),o.delete(e)}};return{get value(){return i},emit(e=void 0){void 0!==i&&t(i,e)||(i=e,(e=>{n.forEach(t=>t(e))})(e))},on:r,off(e){const t=o.get(e);t?(n.delete(t.wrapped),t.destroy(),o.delete(e)):n.delete(e)},clear(){n.clear(),o.forEach(e=>e.destroy()),o.clear()},select:(e,t=no)=>(n,o)=>{let a;if(void 0!==i){const t=e(i);a=t,n(t)}return r(o=>{const i=e(o);void 0!==a&&t(a,i)||(a=i,n(i))},o)}}}function lo(e,t){const n=(null==t?void 0:t.cache)??!0,o=(null==t?void 0:t.equality)??no,i=new Map,r=new Map,a=new Map,s=new Set,l=new Map,c=e=>String(e);return{emit(t,a){const l=c(t);if(n){const e=i.get(l);if(void 0!==e&&o(e,a))return;i.set(l,a)}const d=r.get(l);d&&d.forEach(e=>e(a));const u=e(t,a);s.forEach(e=>e(u))},forScope(e){const t=c(e);return(e,o)=>{const s=(e=>{let t=r.get(e);return t||(t=new Set,r.set(e,t)),t})(t),l=(e=>{let t=a.get(e);return t||(t=new Map,a.set(e,t)),t})(t);let c=e,d=()=>{};if(o){if(eo(o)){const t=new Jn(e,o);c=t.handle,d=()=>t.destroy()}else{const t=new Qn(e,o);c=t.handle,d=()=>t.destroy()}l.set(e,{wrapped:c,destroy:d})}if(n){const e=i.get(t);void 0!==e&&c(e)}return s.add(c),()=>{s.delete(c),d(),l.delete(e),0===s.size&&r.delete(t),0===l.size&&a.delete(t)}}},onGlobal:(e,t)=>{let n=e,o=()=>{};if(t){if(eo(t)){const i=new Jn(e,t);n=i.handle,o=()=>i.destroy()}else{const i=new Qn(e,t);n=i.handle,o=()=>i.destroy()}l.set(e,{wrapped:n,destroy:o})}return s.add(n),()=>{s.delete(n),o(),l.delete(e)}},getValue:e=>n?i.get(c(e)):void 0,getScopes:()=>n?Array.from(i.keys()):Array.from(r.keys()),clearScope(e){const t=c(e);n&&i.delete(t);const o=r.get(t);o&&(o.clear(),r.delete(t));const s=a.get(t);s&&(s.forEach(e=>e.destroy()),s.clear(),a.delete(t))},clear(){n&&i.clear(),r.forEach(e=>e.clear()),r.clear(),a.forEach(e=>{e.forEach(e=>e.destroy()),e.clear()}),a.clear(),s.clear(),l.forEach(e=>e.destroy()),l.clear()}}}class co{constructor(e){this.autoMountElements=[],this.package=e}addUtility(e){return this.autoMountElements.push({component:e,type:"utility"}),this}addWrapper(e){return this.autoMountElements.push({component:e,type:"wrapper"}),this}build(){return{...this.package,autoMountElements:()=>this.autoMountElements}}}function uo(e){return new co(e)}const ho=ue({registry:null,coreState:null,isInitializing:!0,pluginsReady:!1,activeDocumentId:null,activeDocument:null,documents:{},documentStates:[]});function mo({plugins:e,children:t}){const{utilities:n,wrappers:o}=ze(()=>{const t=[],n=[];for(const o of e){const e=o.package;if(Yn(e)){const o=e.autoMountElements()||[];for(const e of o)"utility"===e.type?t.push(e.component):"wrapper"===e.type&&n.push(e.component)}}return{utilities:t,wrappers:n}},[e]);return We(W,{children:[o.reduce((e,t)=>We(t,{children:e}),t),n.map((e,t)=>We(e,{},`utility-${t}`))]})}function go({engine:e,logger:t,onInitialized:n,plugins:o,children:i,autoMountDomElements:r=!0}){const[a,s]=De(null),[l,c]=De(null),[d,u]=De(!0),[h,m]=De(!1),g=Te(n);Pe(()=>{g.current=n},[n]),Pe(()=>{const n=new Zn(e,{logger:t});n.registerPluginBatch(o);let i;return(async()=>{var e;if(await n.initialize(),n.isDestroyed())return;const t=n.getStore();c(t.getState().core);const o=t.subscribe((e,n,o)=>{t.isCoreAction(e)&&n.core!==o.core&&c(n.core)});if(await(null==(e=g.current)?void 0:e.call(g,n)),!n.isDestroyed())return n.pluginsReady().then(()=>{n.isDestroyed()||m(!0)}),s(n),u(!1),o;o()})().then(e=>{i=e}).catch(console.error),()=>{null==i||i(),n.destroy(),s(null),c(null),u(!0),m(!1)}},[e,o]);const p=ze(()=>{const e=(null==l?void 0:l.activeDocumentId)??null,t=(null==l?void 0:l.documents)??{},n=(null==l?void 0:l.documentOrder)??[],o=e&&t[e]?t[e]:null,i=n.map(e=>t[e]).filter(e=>null!=e);return{registry:a,coreState:l,isInitializing:d,pluginsReady:h,activeDocumentId:e,activeDocument:o,documents:t,documentStates:i}},[a,l,d,h]),v="function"==typeof i?i(p):i;return We(ho.Provider,{value:p,children:h&&r?We(mo,{plugins:o,children:v}):v})}function po(e){const{registry:t}=function(){const e=_e(ho);if(void 0===e)throw new Error("useCapability must be used within a PDFContext.Provider");const{registry:t,isInitializing:n}=e;if(n)return e;if(null===t)throw new Error("PDF registry failed to initialize properly");return e}();if(null===t)return{plugin:null,isLoading:!0,ready:new Promise(()=>{})};const n=t.getPlugin(e);if(!n)throw new Error(`Plugin ${e} not found`);return{plugin:n,isLoading:!1,ready:n.ready()}}function vo(e){const{plugin:t,isLoading:n,ready:o}=po(e);if(!t)return{provides:null,isLoading:n,ready:o};if(!t.provides)throw new Error(`Plugin ${e} does not provide a capability`);return{provides:t.provides(),isLoading:n,ready:o}}function fo(){const{coreState:e}=_e(ho);return e}function yo(e){const t=fo();return ze(()=>t&&e?t.documents[e]??null:null,[t,e])}const bo="https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.0.0-next.3/dist/pdfium.wasm";ue(void 0);const wo="viewport",xo={id:wo,name:"Viewport Plugin",version:"1.0.0",provides:["viewport"],requires:[],optional:[],defaultConfig:{viewportGap:10,scrollEndDelay:300}},Co="INIT_VIEWPORT_STATE",Io="CLEANUP_VIEWPORT_STATE",So="REGISTER_VIEWPORT",ko="UNREGISTER_VIEWPORT",Do="SET_VIEWPORT_METRICS",Mo="SET_VIEWPORT_SCROLL_METRICS",Po="SET_VIEWPORT_GAP",Ao="SET_SCROLL_ACTIVITY",To="SET_SMOOTH_SCROLL_ACTIVITY",zo="ADD_VIEWPORT_GATE",Eo="REMOVE_VIEWPORT_GATE";function _o(e,t){return{type:To,payload:{documentId:e,isSmoothScrolling:t}}}const Ro={viewportMetrics:{width:0,height:0,scrollTop:0,scrollLeft:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0,relativePosition:{x:0,y:0}},isScrolling:!1,isSmoothScrolling:!1,gates:new Set},No={viewportGap:0,documents:{},activeViewports:new Set,activeDocumentId:null},Oo=class extends Xn{constructor(e,t,n){var o;super(e,t),this.id=e,this.viewportResize$=so(),this.viewportMetrics$=so(),this.scrollMetrics$=so(),this.scrollActivity$=so(),this.gateState$=so(),this.scrollRequests$=new Map,this.rectProviders=new Map,n.viewportGap&&this.dispatch((o=n.viewportGap,{type:Po,payload:o})),this.scrollEndDelay=n.scrollEndDelay||100}onDocumentLoadingStarted(e){this.dispatch(function(e){return{type:Co,payload:{documentId:e}}}(e)),this.scrollRequests$.set(e,ao()),this.logger.debug("ViewportPlugin","DocumentOpened",`Initialized viewport state for document: ${e}`)}onDocumentClosed(e){var t;this.dispatch(function(e){return{type:Io,payload:{documentId:e}}}(e)),null==(t=this.scrollRequests$.get(e))||t.clear(),this.scrollRequests$.delete(e),this.rectProviders.delete(e),this.logger.debug("ViewportPlugin","DocumentClosed",`Cleaned up viewport state for document: ${e}`)}buildCapability(){return{getViewportGap:()=>this.state.viewportGap,getMetrics:()=>this.getMetrics(),scrollTo:e=>this.scrollTo(e),isScrolling:()=>this.isScrolling(),isSmoothScrolling:()=>this.isSmoothScrolling(),isGated:e=>this.isGated(e),hasGate:(e,t)=>this.hasGate(e,t),getGates:e=>this.getGates(e),getBoundingRect:()=>this.getBoundingRect(),forDocument:e=>this.createViewportScope(e),gate:(e,t)=>this.gate(e,t),releaseGate:(e,t)=>this.releaseGate(e,t),isViewportMounted:e=>this.state.activeViewports.has(e),onViewportChange:this.viewportMetrics$.on,onViewportResize:this.viewportResize$.on,onScrollChange:this.scrollMetrics$.on,onScrollActivity:this.scrollActivity$.on,onGateChange:this.gateState$.on}}createViewportScope(e){return{getMetrics:()=>this.getMetrics(e),scrollTo:t=>this.scrollTo(t,e),isScrolling:()=>this.isScrolling(e),isSmoothScrolling:()=>this.isSmoothScrolling(e),isGated:()=>this.isGated(e),hasGate:t=>this.hasGate(t,e),getGates:()=>this.getGates(e),gate:t=>this.gate(t,e),releaseGate:t=>this.releaseGate(t,e),getBoundingRect:()=>this.getBoundingRect(e),onViewportChange:t=>this.viewportMetrics$.on(n=>{n.documentId===e&&t(n.metrics)}),onScrollChange:t=>this.scrollMetrics$.on(n=>{n.documentId===e&&t(n.scrollMetrics)}),onScrollActivity:t=>this.scrollActivity$.on(n=>{n.documentId===e&&t(n.activity)}),onGateChange:t=>this.gateState$.on(n=>{(null==n?void 0:n.documentId)===e&&t(n)})}}registerViewport(e){if(!this.state.documents[e])throw new Error(`Cannot register viewport for ${e}: document state not found. Document must be opened before registering viewport.`);this.state.activeViewports.has(e)||(this.dispatch(function(e){return{type:So,payload:{documentId:e}}}(e)),this.logger.debug("ViewportPlugin","RegisterViewport",`Registered viewport (DOM mounted) for document: ${e}`))}unregisterViewport(e){this.registry.isDestroyed()||this.state.activeViewports.has(e)&&(this.dispatch(function(e){return{type:ko,payload:{documentId:e}}}(e)),this.rectProviders.delete(e),this.logger.debug("ViewportPlugin","UnregisterViewport",`Unregistered viewport (DOM unmounted) for document: ${e}. State preserved.`))}setViewportResizeMetrics(e,t){if(this.registry.isDestroyed())return;this.dispatch(function(e,t){return{type:Do,payload:{documentId:e,metrics:t}}}(e,t));const n=this.state.documents[e];n&&this.viewportResize$.emit({documentId:e,metrics:n.viewportMetrics})}setViewportScrollMetrics(e,t){if(this.registry.isDestroyed())return;const n=this.state.documents[e];n&&(t.scrollTop===n.viewportMetrics.scrollTop&&t.scrollLeft===n.viewportMetrics.scrollLeft||(this.dispatch(function(e,t){return{type:Mo,payload:{documentId:e,scrollMetrics:t}}}(e,t)),this.bumpScrollActivity(e),this.scrollMetrics$.emit({documentId:e,scrollMetrics:t})))}onScrollRequest(e,t){const n=this.scrollRequests$.get(e);if(!n)throw new Error(`Cannot subscribe to scroll requests for ${e}: document state not initialized`);return n.on(t)}registerBoundingRectProvider(e,t){t?this.rectProviders.set(e,t):this.rectProviders.delete(e)}gate(e,t){const n=this.state.documents[t];n?n.gates.has(e)||(this.dispatch(function(e,t){return{type:zo,payload:{documentId:e,key:t}}}(t,e)),this.logger.debug("ViewportPlugin","GateAdded",`Added gate '${e}' for document: ${t}. Total gates: ${n.gates.size+1}`)):this.logger.warn("ViewportPlugin","GateViewport",`Cannot gate viewport for ${t}: document not found`)}releaseGate(e,t){const n=this.state.documents[t];n?n.gates.has(e)&&(this.dispatch(function(e,t){return{type:Eo,payload:{documentId:e,key:t}}}(t,e)),this.logger.debug("ViewportPlugin","GateReleased",`Released gate '${e}' for document: ${t}. Remaining gates: ${n.gates.size-1}`)):this.logger.warn("ViewportPlugin","ReleaseGate",`Cannot release gate for ${t}: document not found`)}getViewportState(e){const t=e??this.getActiveDocumentId(),n=this.state.documents[t];if(!n)throw new Error(`Viewport state not found for document: ${t}`);return n}getMetrics(e){return this.getViewportState(e).viewportMetrics}isScrolling(e){return this.getViewportState(e).isScrolling}isSmoothScrolling(e){return this.getViewportState(e).isSmoothScrolling}isGated(e){return this.getViewportState(e).gates.size>0}hasGate(e,t){return this.getViewportState(t).gates.has(e)}getGates(e){const t=this.getViewportState(e);return Array.from(t.gates)}getBoundingRect(e){const t=e??this.getActiveDocumentId(),n=this.rectProviders.get(t);return(null==n?void 0:n())??{origin:{x:0,y:0},size:{width:0,height:0}}}scrollTo(e,t){const n=t??this.getActiveDocumentId(),o=this.getViewportState(n),{x:i,y:r,alignX:a,alignY:s,behavior:l="auto"}=e;"smooth"===l&&this.dispatch(_o(n,!0));const c=o.viewportMetrics;let d=i,u=r;void 0!==a&&(d=i-c.clientWidth*(a/100)),void 0!==s&&(u=r-c.clientHeight*(s/100));const h=this.scrollRequests$.get(n);h&&h.emit({x:d,y:u,behavior:l})}bumpScrollActivity(e){this.debouncedDispatch(function(e,t){return{type:Ao,payload:{documentId:e,isScrolling:t}}}(e,!1),this.scrollEndDelay),this.debouncedDispatch(_o(e,!1),this.scrollEndDelay)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];if(o!==i&&(this.viewportMetrics$.emit({documentId:n,metrics:i.viewportMetrics}),!o||o.isScrolling===i.isScrolling&&o.isSmoothScrolling===i.isSmoothScrolling||this.scrollActivity$.emit({documentId:n,activity:{isScrolling:i.isScrolling,isSmoothScrolling:i.isSmoothScrolling}}),o&&o.gates!==i.gates)){const e=Array.from(o.gates),t=Array.from(i.gates),r=t.find(t=>!e.includes(t)),a=e.find(e=>!t.includes(e));this.gateState$.emit({documentId:n,isGated:i.gates.size>0,gates:t,addedGate:r,removedGate:a}),this.logger.debug("ViewportPlugin","GateStateChanged",`Gate state changed for document ${n}. Gates: [${t.join(", ")}], Gated: ${i.gates.size>0}`)}}}async initialize(e){this.logger.info("ViewportPlugin","Initialize","Viewport plugin initialized")}async destroy(){this.viewportMetrics$.clear(),this.viewportResize$.clear(),this.scrollMetrics$.clear(),this.scrollActivity$.clear(),this.gateState$.clear(),this.scrollRequests$.forEach(e=>e.clear()),this.scrollRequests$.clear(),this.rectProviders.clear(),super.destroy()}};Oo.id="viewport";let Lo=Oo;const $o={manifest:xo,create:(e,t)=>new Lo(wo,e,t),reducer:(e=No,t)=>{switch(t.type){case Co:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...Ro,gates:new Set}}}}case Io:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents,r=new Set(e.activeViewports);return r.delete(n),{...e,documents:i,activeViewports:r,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case So:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.add(n),{...e,activeViewports:o,activeDocumentId:e.activeDocumentId??n}}case ko:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.delete(n),{...e,activeViewports:o}}case"SET_ACTIVE_VIEWPORT_DOCUMENT":return{...e,activeDocumentId:t.payload};case Po:return{...e,viewportGap:t.payload};case Do:{const{documentId:n,metrics:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,viewportMetrics:{width:o.width,height:o.height,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft,clientWidth:o.clientWidth,clientHeight:o.clientHeight,scrollWidth:o.scrollWidth,scrollHeight:o.scrollHeight,relativePosition:{x:o.scrollWidth<=o.clientWidth?0:o.scrollLeft/(o.scrollWidth-o.clientWidth),y:o.scrollHeight<=o.clientHeight?0:o.scrollTop/(o.scrollHeight-o.clientHeight)}}}}}:e}case Mo:{const{documentId:n,scrollMetrics:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,viewportMetrics:{...i.viewportMetrics,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft},isScrolling:!0}}}:e}case Ao:{const{documentId:n,isScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isScrolling:o}}}:e}case To:{const{documentId:n,isSmoothScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isSmoothScrolling:o}}}:e}case zo:{const{documentId:n,key:o}=t.payload,i=e.documents[n];if(!i)return e;const r=new Set(i.gates);return r.add(o),{...e,documents:{...e.documents,[n]:{...i,gates:r}}}}case Eo:{const{documentId:n,key:o}=t.payload,i=e.documents[n];if(!i)return e;const r=new Set(i.gates);return r.delete(o),{...e,documents:{...e.documents,[n]:{...i,gates:r}}}}default:return e}},initialState:No},Fo=()=>vo(Lo.id);function jo(e){const{plugin:t}=po(Lo.id),n=Te(null);return Ae(()=>{if(!t)return;const o=n.current;if(!o)return;try{t.registerViewport(e)}catch(t){return void console.error(`Failed to register viewport for document ${e}:`,t)}t.registerBoundingRectProvider(e,()=>{const e=o.getBoundingClientRect();return{origin:{x:e.left,y:e.top},size:{width:e.width,height:e.height}}});const i=()=>{t.setViewportScrollMetrics(e,{scrollTop:o.scrollTop,scrollLeft:o.scrollLeft})};o.addEventListener("scroll",i);const r=new ResizeObserver(()=>{t.setViewportResizeMetrics(e,{width:o.offsetWidth,height:o.offsetHeight,clientWidth:o.clientWidth,clientHeight:o.clientHeight,scrollTop:o.scrollTop,scrollLeft:o.scrollLeft,scrollWidth:o.scrollWidth,scrollHeight:o.scrollHeight})});r.observe(o);const a=t.onScrollRequest(e,({x:e,y:t,behavior:n="auto"})=>{requestAnimationFrame(()=>{o.scrollTo({left:e,top:t,behavior:n})})});return()=>{t.unregisterViewport(e),t.registerBoundingRectProvider(e,null),r.disconnect(),o.removeEventListener("scroll",i),a()}},[t,e]),n}function Ho({children:e,documentId:t,...n}){const[o,i]=De(0),r=jo(t),{provides:a}=Fo(),s=(e=>{const{provides:t}=Fo(),[n,o]=De((null==t?void 0:t.isGated(e))??!1);return Pe(()=>{if(t)return o(t.isGated(e)),t.onGateChange(t=>{t.documentId===e&&o(t.isGated)})},[t,e]),n})(t);Pe(()=>{a&&i(a.getViewportGap())},[a]);const{style:l,...c}=n;return We("div",{...c,ref:r,style:{width:"100%",height:"100%",overflow:"auto",..."object"==typeof l?l:{},padding:`${o}px`},children:!s&&e})}var Uo=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(Uo||{});class Wo{constructor(e){this.pageGap=e.pageGap??20,this.viewportGap=e.viewportGap??20,this.bufferSize=e.bufferSize??2}getVisibleRange(e,t,n){const o=this.getScrollOffset(e),i=o,r=o+this.getClientSize(e);let a=0;for(;a<t.length&&(t[a].offset+t[a].height)*n<=i;)a++;let s=a;for(;s<t.length&&t[s].offset*n<=r;)s++;return{start:Math.max(0,a-this.bufferSize),end:Math.min(t.length-1,s+this.bufferSize-1)}}handleScroll(e,t,n){const o=this.getVisibleRange(e,t,n),i=t.slice(o.start,o.end+1),r=this.calculatePageVisibility(i,e,n),a=r.map(e=>e.pageNumber),s=t.slice(o.start,o.end+1).flatMap(e=>e.index),l=this.determineCurrentPage(r),c=t[o.start],d=t[o.end],u=c?c.offset*n:0,h=d?(t[t.length-1].offset+t[t.length-1].height)*n-(d.offset+d.height)*n:0;return{currentPage:l,visiblePages:a,pageVisibilityMetrics:r,renderedPageIndexes:s,scrollOffset:{x:e.scrollLeft,y:e.scrollTop},startSpacing:u,endSpacing:h}}calculatePageVisibility(e,t,n){const o=[];return e.forEach(e=>{e.pageLayouts.forEach(i=>{const r=e.x*n,a=e.y*n,s=r+i.x*n,l=a+i.y*n,c=i.rotatedWidth*n,d=i.rotatedHeight*n,u=t.scrollLeft,h=t.scrollTop,m=u+t.clientWidth,g=h+t.clientHeight,p=Math.max(s,u),v=Math.max(l,h),f=Math.min(s+c,m),y=Math.min(l+d,g);if(p<f&&v<y){const e=f-p,t=y-v,r=c*d,a=e*t;o.push({pageNumber:i.pageNumber,viewportX:p-u,viewportY:v-h,visiblePercentage:a/r*100,original:{pageX:(p-s)/n,pageY:(v-l)/n,visibleWidth:e/n,visibleHeight:t/n,scale:1},scaled:{pageX:p-s,pageY:v-l,visibleWidth:e,visibleHeight:t,scale:n}})}})}),o}determineCurrentPage(e){if(0===e.length)return 1;const t=Math.max(...e.map(e=>e.visiblePercentage)),n=e.filter(e=>e.visiblePercentage===t);return 1===n.length?n[0].pageNumber:n.sort((e,t)=>e.pageNumber-t.pageNumber)[0].pageNumber}getRectLocationForPage(e,t,n){const o=t.find(t=>t.pageNumbers.includes(e));if(!o)return null;const i=o.pageLayouts.find(t=>t.pageNumber===e);if(!i)return null;let r=0;if(n){const e=n.width;o.width<e&&(r=(e-o.width)/2)}return{origin:{x:o.x+i.x+r,y:o.y+i.y},size:{width:i.width,height:i.height}}}getScrollPositionForPage(e,t,n,o,i){const r=this.getTotalContentSize(t),a=this.getRectLocationForPage(e,t,r);if(!a)return null;const s=Je(a.origin,n);if(i){const e=function(e,t,n,o){return Je(Qe(e,t,n),o)}({width:a.size.width,height:a.size.height},{x:i.x,y:i.y},o,n);return{x:s.x+e.x+this.viewportGap,y:s.y+e.y+this.viewportGap}}return{x:s.x+this.viewportGap,y:s.y+this.viewportGap}}getRectPositionForPage(e,t,n,o,i){const r=this.getTotalContentSize(t),a=this.getRectLocationForPage(e,t,r);if(!a)return null;const s=Je(a.origin,n),l=it({width:a.size.width,height:a.size.height},i,o,n);return{origin:{x:s.x+l.origin.x,y:s.y+l.origin.y},size:l.size}}}class Bo extends Wo{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let o=0;const i=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:o,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height};return o+=e.rotatedSize.width+this.pageGap,t}),r=e.reduce((t,n,o)=>t+n.rotatedSize.width+(o<e.length-1?this.pageGap:0),0),a=Math.max(...e.map(e=>e.rotatedSize.height)),s={id:`item-${n}`,x:0,y:t,offset:t,width:r,height:a,pageLayouts:i,pageNumbers:e.map(e=>e.index+1),index:n};return t+=a+this.pageGap,s})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:Math.max(...e.map(e=>e.width)),height:e[e.length-1].y+e[e.length-1].height}}getScrollOffset(e){return e.scrollTop}getClientSize(e){return e.clientHeight}}class qo extends Wo{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let o=0;const i=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:o,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height};return o+=e.rotatedSize.width+this.pageGap,t}),r=e.reduce((t,n,o)=>t+n.rotatedSize.width+(o<e.length-1?this.pageGap:0),0),a=Math.max(...e.map(e=>e.rotatedSize.height)),s={id:`item-${n}`,x:t,y:0,offset:t,width:r,height:a,pageLayouts:i,pageNumbers:e.map(e=>e.index+1),index:n};return t+=r+this.pageGap,s})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:e[e.length-1].x+e[e.length-1].width,height:Math.max(...e.map(e=>e.height))}}getScrollOffset(e){return e.scrollLeft}getClientSize(e){return e.clientWidth}}const Go="INIT_SCROLL_STATE",Vo="CLEANUP_SCROLL_STATE",Zo="UPDATE_DOCUMENT_SCROLL_STATE",Ko="SET_SCROLL_STRATEGY";function Yo(e,t){return{type:Zo,payload:{documentId:e,state:t}}}const Xo={isChanging:!1,targetPage:1,fromPage:1,startTime:0},Qo=class extends Xn{constructor(e,t,n){var o,i;super(e,t),this.id=e,this.config=n,this.strategies=new Map,this.layoutReady=new Set,this.initialLayoutFired=new Set,this.scrollerLayoutEmitters=new Map,this.pageChange$=so(),this.scroll$=so(),this.layoutChange$=so(),this.pageChangeState$=so(),this.layoutReady$=so(),this.state$=so(),this.viewport=this.registry.getPlugin("viewport").provides(),this.spread=(null==(o=this.registry.getPlugin("spread"))?void 0:o.provides())??null,this.viewport.onScrollActivity(e=>{const t=this.getDocumentState(e.documentId);(null==t?void 0:t.pageChangeState.isChanging)&&!e.activity.isSmoothScrolling&&this.completePageChange(e.documentId)}),null==(i=this.spread)||i.onSpreadChange(e=>{this.refreshDocumentLayout(e.documentId)}),this.viewport.onViewportChange(e=>{const t=this.getDocumentState(e.documentId);if(!t)return;const n=this.computeMetrics(e.documentId,e.metrics);this.layoutReady.has(e.documentId)?this.commitMetrics(e.documentId,n):this.commitMetrics(e.documentId,{...n,scrollOffset:t.scrollOffset})})}onDocumentLoadingStarted(e){const t=this.getCoreDocument(e);if(!t)return;const n=this.createDocumentState(t);this.dispatch(function(e,t){return{type:Go,payload:{documentId:e,state:t}}}(e,n));const o=this.createStrategy(n.strategy);this.strategies.set(e,o),this.scrollerLayoutEmitters.set(e,so())}onDocumentLoaded(e){var t;const n=this.getCoreDocument(e);n&&(this.dispatch(Yo(e,{totalPages:(null==(t=n.document)?void 0:t.pageCount)??0})),this.refreshDocumentLayout(e),this.logger.debug("ScrollPlugin","DocumentOpened",`Initialized scroll state for document: ${e}`))}onDocumentClosed(e){this.strategies.delete(e),this.layoutReady.delete(e),this.initialLayoutFired.delete(e);const t=this.scrollerLayoutEmitters.get(e);t&&(t.clear(),this.scrollerLayoutEmitters.delete(e)),this.dispatch(function(e){return{type:Vo,payload:e}}(e)),this.logger.debug("ScrollPlugin","DocumentClosed",`Cleaned up scroll state for document: ${e}`)}onScaleChanged(e){const t=this.coreState.core.documents[e];if(!t||"loaded"!==t.status)return;const n=this.viewport.forDocument(e),o=this.computeMetrics(e,n.getMetrics());this.commitMetrics(e,o)}onRotationChanged(e){this.refreshDocumentLayout(e)}onScrollerData(e,t){const n=this.scrollerLayoutEmitters.get(e);if(!n)throw new Error(`No scroller layout emitter found for document: ${e}`);return n.on(t)}getScrollerLayout(e){const t=this.getDocumentState(e),n=this.getCoreDocumentOrThrow(e);if(!t||!n)throw new Error(`Cannot get scroller layout for document: ${e}`);return o=t,i=n.scale,{startSpacing:o.startSpacing,endSpacing:o.endSpacing,totalWidth:o.totalContentSize.width*i,totalHeight:o.totalContentSize.height*i,pageGap:o.pageGap*i,strategy:o.strategy,items:o.renderedPageIndexes.map(e=>({...o.virtualItems[e],pageLayouts:o.virtualItems[e].pageLayouts.map(e=>({...e,rotatedWidth:e.rotatedWidth*i,rotatedHeight:e.rotatedHeight*i,width:e.width*i,height:e.height*i}))}))};var o,i}setLayoutReady(e){if(this.layoutReady.has(e))return;const t=this.getDocumentState(e);if(!t)return;this.layoutReady.add(e);const n=!this.initialLayoutFired.has(e);n&&this.initialLayoutFired.add(e);this.viewport.forDocument(e).scrollTo({...t.scrollOffset,behavior:"instant"}),this.layoutReady$.emit({documentId:e,isInitial:n,pageNumber:t.currentPage,totalPages:t.totalPages})}clearLayoutReady(e){this.layoutReady.delete(e)}buildCapability(){return{getCurrentPage:()=>this.getCurrentPage(),getTotalPages:()=>this.getTotalPages(),getPageChangeState:()=>this.getPageChangeState(),scrollToPage:e=>this.scrollToPage(e),scrollToNextPage:e=>this.scrollToNextPage(e),scrollToPreviousPage:e=>this.scrollToPreviousPage(e),getMetrics:e=>this.getMetrics(e),getLayout:()=>this.getLayout(),getRectPositionForPage:(e,t,n,o)=>this.getRectPositionForPage(e,t,n,o),forDocument:e=>this.createScrollScope(e),setScrollStrategy:(e,t)=>this.setScrollStrategyForDocument(e,t),getPageGap:()=>this.state.defaultPageGap,onPageChange:this.pageChange$.on,onScroll:this.scroll$.on,onLayoutChange:this.layoutChange$.on,onLayoutReady:this.layoutReady$.on,onPageChangeState:this.pageChangeState$.on,onStateChange:this.state$.on}}createScrollScope(e){return{getCurrentPage:()=>this.getCurrentPage(e),getTotalPages:()=>this.getTotalPages(e),getPageChangeState:()=>this.getPageChangeState(e),scrollToPage:t=>this.scrollToPage(t,e),scrollToNextPage:t=>this.scrollToNextPage(t,e),scrollToPreviousPage:t=>this.scrollToPreviousPage(t,e),getSpreadPagesWithRotatedSize:()=>this.getSpreadPagesWithRotatedSize(e),getMetrics:t=>this.getMetrics(t,e),getLayout:()=>this.getLayout(e),getRectPositionForPage:(t,n,o,i)=>this.getRectPositionForPage(t,n,o,i,e),setScrollStrategy:t=>this.setScrollStrategyForDocument(t,e),onPageChange:t=>this.pageChange$.on(n=>{n.documentId===e&&t(n)}),onScroll:t=>this.scroll$.on(n=>{n.documentId===e&&t(n.metrics)}),onLayoutChange:t=>this.layoutChange$.on(n=>{n.documentId===e&&t(n.layout)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Scroll state not found for document: ${e??"active"}`);return t}getStrategy(e){const t=e??this.getActiveDocumentId(),n=this.strategies.get(t);if(!n)throw new Error(`Strategy not found for document: ${t}`);return n}createStrategy(e){const t={pageGap:this.state.defaultPageGap,viewportGap:this.viewport.getViewportGap(),bufferSize:this.state.defaultBufferSize};return e===Uo.Horizontal?new qo(t):new Bo(t)}createDocumentState(e){var t;return{virtualItems:[],totalPages:(null==(t=e.document)?void 0:t.pageCount)??0,currentPage:1,totalContentSize:{width:0,height:0},strategy:this.state.defaultStrategy,pageGap:this.state.defaultPageGap,visiblePages:[],pageVisibilityMetrics:[],renderedPageIndexes:[],scrollOffset:{x:0,y:0},startSpacing:0,endSpacing:0,pageChangeState:Xo}}startPageChange(e,t,n="smooth"){const o=this.getDocumentState(e);if(!o)return;const i={isChanging:!0,targetPage:t,fromPage:o.currentPage,startTime:Date.now()};this.dispatch(Yo(e,{pageChangeState:i})),"instant"===n&&this.completePageChange(e)}completePageChange(e){const t=this.getDocumentState(e);if(!t||!t.pageChangeState.isChanging)return;const n={isChanging:!1,targetPage:t.pageChangeState.targetPage,fromPage:t.pageChangeState.fromPage,startTime:t.pageChangeState.startTime};this.dispatch(Yo(e,{pageChangeState:n}))}computeLayout(e,t){const n=this.getStrategy(e),o=n.createVirtualItems(t);return{virtualItems:o,totalContentSize:n.getTotalContentSize(o)}}computeMetrics(e,t,n){const o=this.getCoreDocumentOrThrow(e),i=this.getDocumentState(e),r=this.getStrategy(e);if(!i)throw new Error(`Document state not found: ${e}`);return r.handleScroll(t,n??i.virtualItems,o.scale)}commitMetrics(e,t){const n=this.getDocumentState(e);n&&(this.dispatch(Yo(e,t)),this.scroll$.emit({documentId:e,metrics:t}),t.currentPage!==n.currentPage&&this.pageChange$.emit({documentId:e,pageNumber:t.currentPage,totalPages:n.totalPages}),this.pushScrollerLayout(e))}pushScrollerLayout(e){const t=this.scrollerLayoutEmitters.get(e);if(t)try{const n=this.getScrollerLayout(e);t.emit(n)}catch(e){}}refreshDocumentLayout(e){const t=this.coreState.core.documents[e],n=this.getDocumentState(e);if(!t||!n||"loaded"!==t.status)return;const o=this.getSpreadPagesWithRotatedSize(e),i=this.computeLayout(e,o),r=this.viewport.forDocument(e),a=this.computeMetrics(e,r.getMetrics(),i.virtualItems);this.dispatch(Yo(e,{...i,...a})),this.layoutChange$.emit({documentId:e,layout:i}),this.pushScrollerLayout(e)}getSpreadPagesWithRotatedSize(e){var t,n;const o=e??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!i)throw new Error(`Document ${o} not loaded`);return((null==(t=this.spread)?void 0:t.forDocument(o).getSpreadPages())||(null==(n=i.document)?void 0:n.pages.map(e=>[e]))||[]).map(e=>e.map(e=>({...e,rotatedSize:Ke(e.size,i.rotation,1)})))}getCurrentPage(e){return this.getDocumentStateOrThrow(e).currentPage}getTotalPages(e){return this.getDocumentStateOrThrow(e).totalPages}getPageChangeState(e){return this.getDocumentStateOrThrow(e).pageChangeState}scrollToPage(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.getStrategy(n),r=this.getCoreDocumentOrThrow(n),{pageNumber:a,behavior:s="smooth",pageCoordinates:l,alignX:c,alignY:d}=e;this.startPageChange(n,a,s);const u=i.getScrollPositionForPage(a,o.virtualItems,r.scale,r.rotation,l);if(u){this.viewport.forDocument(n).scrollTo({...u,behavior:s,alignX:c,alignY:d})}else this.completePageChange(n)}scrollToNextPage(e="smooth",t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.getStrategy(n),r=this.getCoreDocumentOrThrow(n),a=o.virtualItems.findIndex(e=>e.pageNumbers.includes(o.currentPage));if(a>=0&&a<o.virtualItems.length-1){const t=o.virtualItems[a+1].pageNumbers[0];this.startPageChange(n,t,e);const s=i.getScrollPositionForPage(t,o.virtualItems,r.scale,r.rotation);if(s){this.viewport.forDocument(n).scrollTo({...s,behavior:e})}else this.completePageChange(n)}}scrollToPreviousPage(e="smooth",t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.getStrategy(n),r=this.coreState.core.documents[n],a=o.virtualItems.findIndex(e=>e.pageNumbers.includes(o.currentPage));if(a>0){const t=o.virtualItems[a-1].pageNumbers[0];this.startPageChange(n,t,e);const s=i.getScrollPositionForPage(t,o.virtualItems,r.scale,r.rotation);if(s){this.viewport.forDocument(n).scrollTo({...s,behavior:e})}else this.completePageChange(n)}}getMetrics(e,t){const n=t??this.getActiveDocumentId();if(e)return this.computeMetrics(n,e);const o=this.viewport.forDocument(n);return this.computeMetrics(n,o.getMetrics())}getLayout(e){const t=this.getDocumentStateOrThrow(e);return{virtualItems:t.virtualItems,totalContentSize:t.totalContentSize}}getRectPositionForPage(e,t,n,o,i){const r=i??this.getActiveDocumentId(),a=this.getDocumentStateOrThrow(r),s=this.getStrategy(r),l=this.getCoreDocumentOrThrow(r);return s.getRectPositionForPage(e+1,a.virtualItems,n??l.scale,o??l.rotation,t)}setScrollStrategyForDocument(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentState(n);if(!o||o.strategy===e)return;const i=this.createStrategy(e);this.strategies.set(n,i),this.dispatch(function(e,t){return{type:Ko,payload:{documentId:e,strategy:t}}}(n,e)),this.refreshDocumentLayout(n)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.state$.emit(i),(null==o?void 0:o.pageChangeState)!==i.pageChangeState&&this.pageChangeState$.emit({documentId:n,state:i.pageChangeState}),this.pushScrollerLayout(n))}}async initialize(){this.logger.info("ScrollPlugin","Initialize","Scroll plugin initialized")}async destroy(){this.strategies.clear(),this.layoutReady.clear(),this.initialLayoutFired.clear();for(const e of this.scrollerLayoutEmitters.values())e.clear();this.scrollerLayoutEmitters.clear(),this.pageChange$.clear(),this.scroll$.clear(),this.layoutChange$.clear(),this.pageChangeState$.clear(),this.layoutReady$.clear(),this.state$.clear(),super.destroy()}};Qo.id="scroll";let Jo=Qo;const ei="scroll",ti={manifest:{id:ei,name:"Scroll Plugin",version:"1.0.0",provides:["scroll"],requires:["viewport"],optional:["spread"],defaultConfig:{defaultPageGap:10,defaultBufferSize:4,defaultStrategy:Uo.Vertical}},create:(e,t)=>new Jo(ei,e,t),reducer:(e,t)=>{switch(t.type){case Go:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case Vo:{const{[t.payload]:n,...o}=e.documents;return{...e,documents:o}}case Zo:{const{documentId:n,state:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,...o}}}:e}case Ko:{const{documentId:n,strategy:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,strategy:o}}}:e}default:return e}},initialState:(e,t)=>((e,t)=>({defaultStrategy:t.defaultStrategy??Uo.Vertical,defaultPageGap:t.defaultPageGap??10,defaultBufferSize:t.defaultBufferSize??2,documents:{}}))(0,t)},ni=()=>vo(Jo.id),oi=e=>{const{provides:t}=ni(),[n,o]=De(1),[i,r]=De(1);return Pe(()=>{if(!t||!e)return;const n=t.forDocument(e);return o(n.getCurrentPage()),r(n.getTotalPages()),t.onPageChange(t=>{t.documentId===e&&(o(t.pageNumber),r(t.totalPages))})},[t,e]),{provides:(null==t?void 0:t.forDocument(e))??null,state:{currentPage:n,totalPages:i}}};function ii({documentId:e,renderPage:t,...n}){const{plugin:o}=po(Jo.id),[i,r]=De({layout:null,docId:null});Pe(()=>{if(!o||!e)return;const t=o.onScrollerData(e,t=>{r({layout:t,docId:e})});return()=>{t(),r({layout:null,docId:null}),o.clearLayoutReady(e)}},[o,e]);const a=i.docId===e?i.layout:null;return Ae(()=>{o&&e&&a&&o.setLayoutReady(e)},[o,e,a]),a?We("div",{...n,style:{width:`${a.totalWidth}px`,height:`${a.totalHeight}px`,position:"relative",boxSizing:"border-box",margin:"0 auto",...a.strategy===Uo.Horizontal&&{display:"flex",flexDirection:"row"}},children:[We("div",{style:{...a.strategy===Uo.Horizontal?{width:a.startSpacing,height:"100%",flexShrink:0}:{height:a.startSpacing,width:"100%"}}}),We("div",{style:{gap:a.pageGap,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",...a.strategy===Uo.Horizontal?{flexDirection:"row",minHeight:"100%"}:{flexDirection:"column",minWidth:"fit-content"}},children:a.items.map(e=>We("div",{style:{display:"flex",justifyContent:"center",gap:a.pageGap},children:e.pageLayouts.map(e=>We("div",{style:{width:`${e.rotatedWidth}px`,height:`${e.rotatedHeight}px`},children:t({...e})},e.pageNumber))},e.pageNumbers[0]))}),We("div",{style:{...a.strategy===Uo.Horizontal?{width:a.endSpacing,height:"100%",flexShrink:0}:{height:a.endSpacing,width:"100%"}}})]}):null}var ri=(e=>(e.None="none",e.Odd="odd",e.Even="even",e))(ri||{});const ai="SPREAD/INIT_STATE",si="SPREAD/CLEANUP_STATE",li="SPREAD/SET_SPREAD_MODE",ci="SPREAD/SET_PAGE_GROUPING";function di(e,t){return{type:ci,payload:{documentId:e,grouping:t}}}const ui=class extends Xn{constructor(e,t,n){var o;super(e,t),this.spreadEmitter$=so(),this.defaultSpreadMode=n.defaultSpreadMode??ri.None,this.viewport=(null==(o=t.getPlugin("viewport"))?void 0:o.provides())??null}onDocumentLoadingStarted(e){var t;const n={spreadMode:this.defaultSpreadMode};this.dispatch(function(e,t){return{type:ai,payload:{documentId:e,state:t}}}(e,n)),null==(t=this.viewport)||t.gate("spread",e),this.logger.debug("SpreadPlugin","DocumentOpened",`Initialized spread state for document: ${e}`)}onDocumentLoaded(e){var t;const n=this.coreState.core.documents[e];if(null==n?void 0:n.document){const t=this.calculatePageGrouping(e,n.document.pages.length);this.dispatch(di(e,t))}null==(t=this.viewport)||t.releaseGate("spread",e)}onDocumentClosed(e){this.dispatch(function(e){return{type:si,payload:e}}(e)),this.logger.debug("SpreadPlugin","DocumentClosed",`Cleaned up spread state for document: ${e}`)}buildCapability(){return{setSpreadMode:e=>this.setSpreadModeForDocument(e),getSpreadMode:()=>this.getSpreadModeForDocument(),getSpreadPages:()=>this.getSpreadPages(),forDocument:e=>this.createSpreadScope(e),onSpreadChange:this.spreadEmitter$.on}}createSpreadScope(e){return{setSpreadMode:t=>this.setSpreadModeForDocument(t,e),getSpreadMode:()=>this.getSpreadModeForDocument(e),getSpreadPages:()=>this.getSpreadPages(e),onSpreadChange:t=>this.spreadEmitter$.on(n=>{n.documentId===e&&t(n.spreadMode)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Spread state not found for document: ${e??"active"}`);return t}setSpreadModeForDocument(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentStateOrThrow(n),i=this.coreState.core.documents[n];if(!(null==i?void 0:i.document))throw new Error(`Document ${n} not loaded`);if(o.spreadMode!==e){this.dispatch(function(e,t){return{type:li,payload:{documentId:e,spreadMode:t}}}(n,e));const t=this.calculatePageGrouping(n,i.document.pages.length);this.dispatch(di(n,t)),this.spreadEmitter$.emit({documentId:n,spreadMode:e})}}getSpreadModeForDocument(e){return this.getDocumentStateOrThrow(e).spreadMode}calculatePageGrouping(e,t){switch(this.getDocumentStateOrThrow(e).spreadMode){case ri.None:return Array.from({length:t},(e,t)=>[t]);case ri.Odd:return Array.from({length:Math.ceil(t/2)},(e,n)=>{const o=[2*n];return 2*n+1<t&&o.push(2*n+1),o});case ri.Even:return[[0],...Array.from({length:Math.ceil((t-1)/2)},(e,n)=>{const o=[1+2*n];return 1+2*n+1<t&&o.push(1+2*n+1),o})];default:return Array.from({length:t},(e,t)=>[t])}}getSpreadPages(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t],o=this.getDocumentStateOrThrow(t);if(!(null==n?void 0:n.document))throw new Error(`Document ${t} not loaded`);const i=o.pageGrouping??[],r=n.document.pages;return i.map(e=>e.map(e=>r[e]).filter(Boolean))}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];(null==o?void 0:o.spreadMode)!==i.spreadMode&&this.logger.debug("SpreadPlugin","SpreadModeChanged",`Spread mode changed for document ${n}: ${(null==o?void 0:o.spreadMode)??ri.None} -> ${i.spreadMode}`)}}async initialize(e){this.logger.info("SpreadPlugin","Initialize","Spread plugin initialized")}async destroy(){this.spreadEmitter$.clear(),super.destroy()}};ui.id="spread";let hi=ui;const mi="spread",gi={id:mi,name:"Spread Plugin",version:"1.0.0",provides:["spread"],requires:[],optional:["viewport"],defaultConfig:{}};ri.None;const pi={documents:{},activeDocumentId:null},vi={manifest:gi,create:(e,t)=>new hi(mi,e,t),reducer:(e=pi,t)=>{switch(t.type){case ai:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case si:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"SPREAD/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case li:{const{documentId:n,spreadMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,spreadMode:o}}}:e}case ci:{const{documentId:n,grouping:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,pageGrouping:o}}}:e}default:return e}},initialState:pi},fi="ui",yi={id:fi,name:"UI Plugin",version:"1.0.0",provides:["ui"],requires:["commands"],optional:["i18n"],defaultConfig:{schema:{id:"empty",version:"1.0.0",toolbars:{},menus:{},sidebars:{},modals:{},selectionMenus:{}}}},bi="UI/INIT_STATE",wi="UI/CLEANUP_STATE",xi="UI/SET_ACTIVE_TOOLBAR",Ci="UI/CLOSE_TOOLBAR_SLOT",Ii="UI/SET_ACTIVE_SIDEBAR",Si="UI/CLOSE_SIDEBAR_SLOT",ki="UI/SET_SIDEBAR_TAB",Di="UI/OPEN_MODAL",Mi="UI/CLOSE_MODAL",Pi="UI/CLEAR_MODAL",Ai="UI/OPEN_MENU",Ti="UI/CLOSE_MENU",zi="UI/CLOSE_ALL_MENUS",Ei="UI/SET_DISABLED_CATEGORIES",_i="UI/SET_HIDDEN_ITEMS",Ri=(e,t,n,o,i)=>({type:Ii,payload:{documentId:e,placement:t,slot:n,sidebarId:o,activeTab:i}}),Ni=(e,t,n)=>({type:Si,payload:{documentId:e,placement:t,slot:n}}),Oi=(e,t)=>({type:Ai,payload:{documentId:e,menuState:t}}),Li=(e,t)=>({type:Ti,payload:{documentId:e,menuId:t}}),$i=e=>({type:Ei,payload:{categories:e}}),Fi=e=>({type:_i,payload:{hiddenItems:e}});function ji(e,t){if(!t)return e;const n={...e};for(const[e,o]of Object.entries(t))n[e]?n[e]={...n[e],...o,items:o.items??n[e].items,responsive:o.responsive??n[e].responsive}:n[e]=o;return n}function Hi(e,t){if(!t)return e;const n={...e};for(const[e,o]of Object.entries(t))n[e]?n[e]={...n[e],...o,items:o.items??n[e].items}:n[e]=o;return n}function Ui(e,t){if(!t)return e;const n={...e};for(const[e,o]of Object.entries(t))n[e]?n[e]={...n[e],...o,content:o.content??n[e].content}:n[e]=o;return n}function Wi(e,t){var n;if(!(null==(n=e.responsive)?void 0:n.breakpoints))return null;const o=function(e,t,n){if(!n||!(null==t?void 0:t.groups))return e;const o=t.groups.find(e=>e.locales.includes(n));if(!o)return e;const i={};for(const[t,n]of Object.entries(e)){const e=o.breakpoints[t];e?i[t]={minWidth:n.minWidth,maxWidth:n.maxWidth,hide:e.replaceHide?e.replaceHide:[...n.hide||[],...e.hide||[]],show:e.replaceShow?e.replaceShow:[...n.show||[],...e.show||[]]}:i[t]=n}return i}(e.responsive.breakpoints,e.responsive.localeOverrides,t),i=new Map,r=new Map;for(const[e,t]of Object.entries(o))r.set(e,{minWidth:t.minWidth,maxWidth:t.maxWidth});const a=new Set,s=e=>{e.forEach(e=>{a.add(e.id),"group"===e.type&&e.items&&s(e.items),"tab-group"===e.type&&e.tabs&&s(e.tabs),"section"===e.type&&e.items&&s(e.items)})};s(e.items);for(const e of a){const t=[];let n=!0;const r=Array.from(Object.entries(o)).sort((e,t)=>(e[1].minWidth??0)-(t[1].minWidth??0));r.forEach(([o,i],r)=>{var a,s;const l=null==(a=i.hide)?void 0:a.includes(e),c=null==(s=i.show)?void 0:s.includes(e);(l||c)&&(t.push({breakpointId:o,minWidth:i.minWidth,maxWidth:i.maxWidth,visible:c||!l,priority:r}),0===r&&(n=c||!l))}),t.length>0&&i.set(e,{itemId:e,shouldRender:!0,visibilityRules:t,defaultVisible:n})}return{items:i,breakpoints:r}}const Bi="data-epdf",qi="data-epdf-s",Gi="data-epdf-i",Vi="data-epdf-cat",Zi="data-epdf-dis",Ki="data-epdf-hid",Yi={ROOT:`[${Bi}]`,STYLES:`[${qi}]`,ITEM:e=>`[${Gi}="${e}"]`,CATEGORIES:e=>`[${Vi}~="${e}"]`,DISABLED_CATEGORY:e=>`[${Zi}~="${e}"]`,HIDDEN_ITEM:e=>`[${Ki}~="${e}"]`},Xi={useContainerQueries:!0};function Qi(e,t={}){const n={...Xi,...t.config},o=t.locale,i=er(e,o),r=[];r.push(function(e){const t=e?` (locale: ${e})`:"";return`/* ═══════════════════════════════════════════════════════════════════════════ */\n/* EmbedPDF UI Stylesheet - Auto-generated${t} */\n/* DO NOT EDIT MANUALLY - This file is generated from your UI schema */\n/* ═══════════════════════════════════════════════════════════════════════════ */`}(o));const a=function(e,t){const n=[],o=t.useContainerQueries?"@container":"@media",i=new Set;return e.responsiveItems.forEach((e,t)=>{if(i.has(t))return;i.add(t);const r=function(e,t,n){if(0===t.visibilityRules.length)return null;const o=[],i=Yi.ITEM(e);t.defaultVisible||o.push(`${i} { display: none; }`);for(const e of t.visibilityRules){const t=[];if(void 0!==e.minWidth&&t.push(`(min-width: ${e.minWidth}px)`),void 0!==e.maxWidth&&t.push(`(max-width: ${e.maxWidth}px)`),t.length>0){const r=e.visible?"flex":"none";o.push(`${n} ${t.join(" and ")} {\n ${i} { display: ${r}; }\n}`)}}return o.length>0?o.join("\n"):null}(t,e,o);r&&n.push(r)}),0===n.length?"":`/* ─── Responsive Visibility Rules ─── */\n/* Items show/hide based on container width */\n\n${n.join("\n\n")}`}(i,n);a&&r.push(a);const s=function(e){if(0===e.categories.size)return"";const t=[],n=Array.from(e.categories).sort();for(const e of n)t.push(`${Yi.ROOT}[${Zi}~="${e}"] [${Vi}~="${e}"] {\n display: none !important;\n}`);return`/* ─── Category Visibility Rules ─── */\n/* Items hide when ANY of their categories is disabled */\n/* Use: data-disabled-categories="category1 category2" on root element */\n\n${t.join("\n\n")}`}(i);s&&r.push(s);const l=function(e,t){if(0===e.dependencies.length)return"";const n=[],o=t.useContainerQueries?"@container":"@media";for(const t of e.dependencies){const i=hr(t,e,o);i.length>0&&n.push(...i)}return 0===n.length?"":`/* ─── Dependency Visibility Rules ─── */\n/* Container elements hide when all their dependencies are hidden */\n\n${n.join("\n\n")}`}(i,n);return l&&r.push(l),r.filter(e=>e.trim()).join("\n\n")}function Ji(e,t){const n=new Set(t),o=[];return e.forEach((e,t)=>{e.some(e=>n.has(e))&&o.push(t)}),o}function er(e,t){const n=new Set,o=new Map,i=[],r=new Map,a=new Map;for(const[s,l]of Object.entries(e.menus))tr(s,l,n,o,i,r,a,t);for(const[r,s]of Object.entries(e.toolbars))rr(r,s,n,o,i,a,t);for(const[t,r]of Object.entries(e.sidebars))lr(t,r,n,o,i);for(const[r,s]of Object.entries(e.selectionMenus||{}))cr(r,s,n,o,i,a,t);return{categories:n,itemCategories:o,dependencies:i,menuBreakpoints:r,responsiveItems:a}}function tr(e,t,n,o,i,r,a,s){ur(e,t.categories,t.visibilityDependsOn,n,o,i),nr(t.items,n,o,i);const l=Wi(t,s);l&&l.items.forEach((e,t)=>{a.set(t,e)});const c=function(e,t,n){var o;const i=[],r=Wi(e,n);if((null==(o=e.responsive)?void 0:o.breakpoints)&&r){const e=Array.from(r.breakpoints.entries()).sort((e,t)=>(e[1].minWidth??0)-(t[1].minWidth??0));for(const[n,o]of e){const e=ir(r,o),n=new Set;for(const o of e){const e=t.get(o);e&&e.forEach(e=>n.add(e))}i.push({minWidth:o.minWidth,maxWidth:o.maxWidth,visibleItemIds:e,visibleCategories:n})}}else{const n=[],o=new Set;or(e.items,t,n,o),i.push({visibleItemIds:n,visibleCategories:o})}return i}(t,o,s);r.set(e,c)}function nr(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o),"section"===i.type&&nr(i.items,t,n,o)}function or(e,t,n,o){for(const i of e){n.push(i.id);const e=t.get(i.id);e&&e.forEach(e=>o.add(e)),"section"===i.type&&or(i.items,t,n,o)}}function ir(e,t){const n=[];return e.items.forEach((e,o)=>{let i=e.defaultVisible;for(const n of e.visibilityRules){(void 0===n.minWidth||void 0!==t.minWidth&&t.minWidth>=n.minWidth)&&(void 0===n.maxWidth||void 0!==t.maxWidth&&t.maxWidth<=n.maxWidth)&&(i=n.visible)}i&&n.push(o)}),n}function rr(e,t,n,o,i,r,a){ur(e,t.categories,t.visibilityDependsOn,n,o,i);const s=Wi(t,a);s&&s.items.forEach((e,t)=>{r.set(t,e)}),ar(t.items,n,o,i)}function ar(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&ar(i.items,t,n,o),"tab-group"===i.type&&i.tabs&&sr(i.tabs,t,n,o)}function sr(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o)}function lr(e,t,n,o,i){if(ur(e,t.categories,t.visibilityDependsOn,n,o,i),"tabs"===t.content.type)for(const e of t.content.tabs)ur(e.id,e.categories,e.visibilityDependsOn,n,o,i)}function cr(e,t,n,o,i,r,a){if(ur(e,t.categories,t.visibilityDependsOn,n,o,i),t.responsive){const e=Wi(t,a);e&&e.items.forEach((e,t)=>{r.set(t,e)})}dr(t.items,n,o,i)}function dr(e,t,n,o){for(const i of e)ur(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&dr(i.items,t,n,o)}function ur(e,t,n,o,i,r){var a;(null==t?void 0:t.length)&&(t.forEach(e=>o.add(e)),i.set(e,t)),n&&(n.menuId||(null==(a=n.itemIds)?void 0:a.length))&&r.push({itemId:e,dependsOnMenuId:n.menuId,dependsOnItemIds:n.itemIds})}function hr(e,t,n,o){var i;const r=[];if(e.dependsOnMenuId){const o=t.menuBreakpoints.get(e.dependsOnMenuId);if(o&&o.length>0){r.push(`/* "${e.itemId}" depends on menu "${e.dependsOnMenuId}" */`);for(const t of o){if(0===t.visibleItemIds.length)continue;const o=t.visibleItemIds.sort().map(e=>Yi.HIDDEN_ITEM(e)).join(""),i=`${Yi.ROOT}${o} ${Yi.ITEM(e.itemId)} {\n display: none !important;\n}`,a=[];void 0!==t.minWidth&&a.push(`(min-width: ${t.minWidth}px)`),void 0!==t.maxWidth&&a.push(`(max-width: ${t.maxWidth}px)`),a.length>0?r.push(`${n} ${a.join(" and ")} {\n ${i}\n}`):r.push(i)}}}if(null==(i=e.dependsOnItemIds)?void 0:i.length){r.push(`/* "${e.itemId}" depends on items: ${e.dependsOnItemIds.join(", ")} */`);const t=e.dependsOnItemIds.sort().map(e=>Yi.HIDDEN_ITEM(e)).join("");r.push(`${Yi.ROOT}${t} ${Yi.ITEM(e.itemId)} {\n display: none !important;\n}`)}return r}function mr(e,t){var n;return{[Gi]:e.id,[Vi]:(null==(n=e.categories)?void 0:n.join(" "))||void 0,...t}}const gr=class extends Xn{constructor(e,t,n){var o,i;if(super(e,t),this.cachedStylesheet=null,this.cachedLocale=null,this.i18n=null,this.i18nCleanup=null,this.categoryChanged$=so(),this.stylesheetInvalidated$=ao(),this.toolbarChanged$=lo((e,t)=>({documentId:e,...t}),{cache:!1}),this.sidebarChanged$=lo((e,t)=>({documentId:e,...t}),{cache:!1}),this.modalChanged$=lo((e,t)=>({documentId:e,...t}),{cache:!1}),this.menuChanged$=lo((e,t)=>({documentId:e,...t}),{cache:!1}),this.schema=n.schema,this.stylesheetConfig=n.stylesheetConfig||{},this.itemCategories=er(this.schema).itemCategories,null==(o=n.disabledCategories)?void 0:o.length){this.dispatch($i(n.disabledCategories));const e=Ji(this.itemCategories,n.disabledCategories);this.dispatch(Fi(e))}this.i18n=(null==(i=t.getPlugin("i18n"))?void 0:i.provides())??null,this.i18n&&(this.i18nCleanup=this.i18n.onLocaleChange(({currentLocale:e})=>{this.handleLocaleChange(e)}),this.cachedLocale=this.i18n.getLocale())}async initialize(){this.logger.info("UIPlugin","Initialize","UI plugin initialized")}async destroy(){this.i18nCleanup&&(this.i18nCleanup(),this.i18nCleanup=null),this.toolbarChanged$.clear(),this.sidebarChanged$.clear(),this.modalChanged$.clear(),this.menuChanged$.clear(),this.stylesheetInvalidated$.clear(),super.destroy()}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:bi,payload:{documentId:e,schema:t}}))(e,this.schema))}onDocumentClosed(e){this.dispatch((e=>({type:wi,payload:{documentId:e}}))(e)),this.toolbarChanged$.clearScope(e),this.sidebarChanged$.clearScope(e),this.modalChanged$.clearScope(e),this.menuChanged$.clearScope(e)}handleLocaleChange(e){this.cachedLocale!==e&&(this.logger.debug("UIPlugin","LocaleChange",`Locale changed: ${this.cachedLocale} -> ${e}`),this.cachedLocale=e,this.invalidateStylesheet(),this.stylesheetInvalidated$.emit())}getStylesheet(){var e;const t=(null==(e=this.i18n)?void 0:e.getLocale())??null;return this.cachedStylesheet&&this.cachedLocale===t||(this.cachedStylesheet=Qi(this.schema,{config:this.stylesheetConfig,locale:t??void 0}),this.cachedLocale=t),this.cachedStylesheet}getLocale(){var e;return(null==(e=this.i18n)?void 0:e.getLocale())??null}invalidateStylesheet(){this.cachedStylesheet=null}onStylesheetInvalidated(e){return this.stylesheetInvalidated$.on(e)}disableCategoryImpl(e){const t=new Set(this.state.disabledCategories);if(!t.has(e)){t.add(e);const n=Array.from(t);this.dispatch($i(n));const o=Ji(this.itemCategories,n);this.dispatch(Fi(o)),this.categoryChanged$.emit({disabledCategories:n,hiddenItems:o})}}enableCategoryImpl(e){const t=new Set(this.state.disabledCategories);if(t.has(e)){t.delete(e);const n=Array.from(t);this.dispatch($i(n));const o=Ji(this.itemCategories,n);this.dispatch(Fi(o)),this.categoryChanged$.emit({disabledCategories:n,hiddenItems:o})}}toggleCategoryImpl(e){this.state.disabledCategories.includes(e)?this.enableCategoryImpl(e):this.disableCategoryImpl(e)}setDisabledCategoriesImpl(e){this.dispatch($i(e));const t=Ji(this.itemCategories,e);this.dispatch(Fi(t)),this.categoryChanged$.emit({disabledCategories:e,hiddenItems:t})}buildCapability(){return{setActiveToolbar:(e,t,n,o)=>this.setToolbarForDocument(e,t,n,o),setActiveSidebar:(e,t,n,o,i)=>this.setSidebarForDocument(e,t,n,o,i),toggleSidebar:(e,t,n,o,i)=>this.toggleSidebarForDocument(e,t,n,o,i),openModal:(e,t)=>this.openModalForDocument(e,t),openMenu:(e,t,n,o)=>this.openMenuForDocument(e,t,n,o),toggleMenu:(e,t,n,o)=>this.toggleMenuForDocument(e,t,n,o),forDocument:e=>this.createUIScope(e),getSchema:()=>this.schema,mergeSchema:e=>{var t,n;this.schema=(t=this.schema,n=e,{...t,...n,toolbars:ji(t.toolbars,n.toolbars),menus:Hi(t.menus,n.menus),sidebars:Ui(t.sidebars,n.sidebars)})},disableCategory:e=>this.disableCategoryImpl(e),enableCategory:e=>this.enableCategoryImpl(e),toggleCategory:e=>this.toggleCategoryImpl(e),setDisabledCategories:e=>this.setDisabledCategoriesImpl(e),getDisabledCategories:()=>this.state.disabledCategories,isCategoryDisabled:e=>this.state.disabledCategories.includes(e),getHiddenItems:()=>this.state.hiddenItems,onToolbarChanged:this.toolbarChanged$.onGlobal,onSidebarChanged:this.sidebarChanged$.onGlobal,onModalChanged:this.modalChanged$.onGlobal,onMenuChanged:this.menuChanged$.onGlobal,onCategoryChanged:this.categoryChanged$.on}}createUIScope(e){return{setActiveToolbar:(t,n,o)=>this.setToolbarForDocument(t,n,o,e),getActiveToolbar:(t,n)=>this.getToolbarForDocument(t,n,e),closeToolbarSlot:(t,n)=>this.closeToolbarForDocument(t,n,e),isToolbarOpen:(t,n,o)=>this.isToolbarOpenForDocument(t,n,o,e),setActiveSidebar:(t,n,o,i)=>this.setSidebarForDocument(t,n,o,e,i),getActiveSidebar:(t,n)=>this.getSidebarForDocument(t,n,e),closeSidebarSlot:(t,n)=>this.closeSidebarForDocument(t,n,e),toggleSidebar:(t,n,o,i)=>this.toggleSidebarForDocument(t,n,o,e,i),isSidebarOpen:(t,n,o)=>this.isSidebarOpenForDocument(t,n,o,e),setSidebarTab:(t,n)=>this.setSidebarTabForDocument(t,n,e),getSidebarTab:t=>this.getSidebarTabForDocument(t,e),openModal:t=>this.openModalForDocument(t,e),closeModal:()=>this.closeModalForDocument(e),clearModal:()=>this.clearModalForDocument(e),getActiveModal:()=>this.getActiveModalForDocument(e),isModalOpen:()=>this.isModalOpenForDocument(e),openMenu:(t,n,o)=>this.openMenuForDocument(t,n,o,e),closeMenu:t=>this.closeMenuForDocument(t,e),toggleMenu:(t,n,o)=>this.toggleMenuForDocument(t,n,o,e),closeAllMenus:()=>this.closeAllMenusForDocument(e),isMenuOpen:t=>this.isMenuOpenForDocument(t,e),getOpenMenus:()=>this.getOpenMenusForDocument(e),getSchema:()=>this.schema,getState:()=>this.getDocumentStateOrThrow(e),onToolbarChanged:this.toolbarChanged$.forScope(e),onSidebarChanged:this.sidebarChanged$.forScope(e),onModalChanged:this.modalChanged$.forScope(e),onMenuChanged:this.menuChanged$.forScope(e)}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`UI state not found for document: ${e??"active"}`);return t}setToolbarForDocument(e,t,n,o){const i=o??this.getActiveDocumentId();this.dispatch(((e,t,n,o)=>({type:xi,payload:{documentId:e,placement:t,slot:n,toolbarId:o}}))(i,e,t,n)),this.toolbarChanged$.emit(i,{placement:e,slot:t,toolbarId:n})}getToolbarForDocument(e,t,n){const o=`${e}-${t}`,i=this.getDocumentStateOrThrow(n).activeToolbars[o];return(null==i?void 0:i.isOpen)?i.toolbarId:null}closeToolbarForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:Ci,payload:{documentId:e,placement:t,slot:n}}))(o,e,t)),this.toolbarChanged$.emit(o,{placement:e,slot:t,toolbarId:""})}isToolbarOpenForDocument(e,t,n,o){const i=`${e}-${t}`,r=this.getDocumentStateOrThrow(o).activeToolbars[i];return!(!r||!r.isOpen)&&(!n||r.toolbarId===n)}setSidebarForDocument(e,t,n,o,i){const r=o??this.getActiveDocumentId();this.dispatch(Ri(r,e,t,n,i)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:n})}getSidebarForDocument(e,t,n){const o=`${e}-${t}`,i=this.getDocumentStateOrThrow(n).activeSidebars[o];return(null==i?void 0:i.isOpen)?i.sidebarId:null}closeSidebarForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(Ni(o,e,t)),this.sidebarChanged$.emit(o,{placement:e,slot:t,sidebarId:""})}toggleSidebarForDocument(e,t,n,o,i){const r=o??this.getActiveDocumentId(),a=`${e}-${t}`,s=this.getDocumentStateOrThrow(r).activeSidebars[a];(null==s?void 0:s.sidebarId)===n&&(null==s?void 0:s.isOpen)?(this.dispatch(Ni(r,e,t)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:""})):(this.dispatch(Ri(r,e,t,n,i)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:n}))}isSidebarOpenForDocument(e,t,n,o){const i=`${e}-${t}`,r=this.getDocumentStateOrThrow(o).activeSidebars[i];return!(!r||!r.isOpen)&&(!n||r.sidebarId===n)}setSidebarTabForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:ki,payload:{documentId:e,sidebarId:t,tabId:n}}))(o,e,t))}getSidebarTabForDocument(e,t){return this.getDocumentStateOrThrow(t).sidebarTabs[e]??null}openModalForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(((e,t)=>({type:Di,payload:{documentId:e,modalId:t}}))(n,e)),this.modalChanged$.emit(n,{modalId:e,isOpen:!0})}closeModalForDocument(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).activeModal;this.dispatch((e=>({type:Mi,payload:{documentId:e}}))(t)),this.modalChanged$.emit(t,{modalId:(null==n?void 0:n.modalId)??null,isOpen:!1})}clearModalForDocument(e){const t=e??this.getActiveDocumentId();this.dispatch((e=>({type:Pi,payload:{documentId:e}}))(t))}getActiveModalForDocument(e){return this.getDocumentStateOrThrow(e).activeModal}isModalOpenForDocument(e){const t=this.getDocumentStateOrThrow(e).activeModal;return(null==t?void 0:t.isOpen)??!1}openMenuForDocument(e,t,n,o){const i=o??this.getActiveDocumentId();this.dispatch(Oi(i,{menuId:e,triggeredByCommandId:t,triggeredByItemId:n})),this.menuChanged$.emit(i,{menuId:e,isOpen:!0})}closeMenuForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(Li(n,e)),this.menuChanged$.emit(n,{menuId:e,isOpen:!1})}toggleMenuForDocument(e,t,n,o){const i=o??this.getActiveDocumentId();!!this.getDocumentStateOrThrow(i).openMenus[e]?(this.dispatch(Li(i,e)),this.menuChanged$.emit(i,{menuId:e,isOpen:!1})):(this.dispatch(Oi(i,{menuId:e,triggeredByCommandId:t,triggeredByItemId:n})),this.menuChanged$.emit(i,{menuId:e,isOpen:!0}))}closeAllMenusForDocument(e){const t=e??this.getActiveDocumentId();this.dispatch((e=>({type:zi,payload:{documentId:e}}))(t))}isMenuOpenForDocument(e,t){return!!this.getDocumentStateOrThrow(t).openMenus[e]}getOpenMenusForDocument(e){return Object.values(this.getDocumentStateOrThrow(e).openMenus)}};gr.id="ui";let pr=gr;const vr={activeToolbars:{},activeSidebars:{},activeModal:null,openMenus:{},sidebarTabs:{}},fr={documents:{},disabledCategories:[],hiddenItems:[]};function yr(e,t){const n=function(e){return e.ui??null}(e);return(null==n?void 0:n.documents[t])??null}function br(e,t){return`${e}-${t}`}function wr(e,t,n,o,i){const r=function(e,t,n,o){const i=yr(e,t);return i?i.activeToolbars[br(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.toolbarId===i)}function xr(e,t,n,o,i){const r=function(e,t,n,o){const i=yr(e,t);return i?i.activeSidebars[br(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.sidebarId===i)}const Cr={manifest:yi,create:(e,t)=>new pr(fi,e,t),reducer:(e=fr,t)=>{var n;switch(t.type){case bi:{const{documentId:n,schema:o}=t.payload,i={};return Object.values(o.toolbars).forEach(e=>{if(e.permanent&&e.position){const t=`${e.position.placement}-${e.position.slot}`;i[t]={toolbarId:e.id,isOpen:!0}}}),{...e,documents:{...e.documents,[n]:{...vr,activeToolbars:i}}}}case wi:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case xi:{const{documentId:n,placement:o,slot:i,toolbarId:r}=t.payload,a=e.documents[n]||vr,s=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...a,activeToolbars:{...a.activeToolbars,[s]:{toolbarId:r,isOpen:!0}}}}}}case Ci:{const{documentId:n,placement:o,slot:i}=t.payload,r=e.documents[n];if(!r)return e;const a=`${o}-${i}`,s=r.activeToolbars[a];return s?{...e,documents:{...e.documents,[n]:{...r,activeToolbars:{...r.activeToolbars,[a]:{...s,isOpen:!1}}}}}:e}case Ii:{const{documentId:n,placement:o,slot:i,sidebarId:r,activeTab:a}=t.payload,s=e.documents[n]||vr,l=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...s,activeSidebars:{...s.activeSidebars,[l]:{sidebarId:r,isOpen:!0}},...a&&{sidebarTabs:{...s.sidebarTabs,[r]:a}}}}}}case Si:{const{documentId:n,placement:o,slot:i}=t.payload,r=e.documents[n];if(!r)return e;const a=`${o}-${i}`,s=r.activeSidebars[a];return s?{...e,documents:{...e.documents,[n]:{...r,activeSidebars:{...r.activeSidebars,[a]:{...s,isOpen:!1}}}}}:e}case ki:{const{documentId:n,sidebarId:o,tabId:i}=t.payload,r=e.documents[n]||vr;return{...e,documents:{...e.documents,[n]:{...r,sidebarTabs:{...r.sidebarTabs,[o]:i}}}}}case Di:{const{documentId:n,modalId:o}=t.payload,i=e.documents[n]||vr;return{...e,documents:{...e.documents,[n]:{...i,activeModal:{modalId:o,isOpen:!0},openMenus:{}}}}}case Mi:{const{documentId:n}=t.payload,o=e.documents[n];return(null==o?void 0:o.activeModal)?{...e,documents:{...e.documents,[n]:{...o,activeModal:{...o.activeModal,isOpen:!1}}}}:e}case Pi:{const{documentId:o}=t.payload,i=e.documents[o];return i?(null==(n=i.activeModal)?void 0:n.isOpen)?e:{...e,documents:{...e.documents,[o]:{...i,activeModal:null}}}:e}case Ai:{const{documentId:n,menuState:o}=t.payload,i=e.documents[n]||vr;return{...e,documents:{...e.documents,[n]:{...i,openMenus:{[o.menuId]:o}}}}}case Ti:{const{documentId:n,menuId:o}=t.payload,i=e.documents[n];if(!i)return e;const{[o]:r,...a}=i.openMenus;return{...e,documents:{...e.documents,[n]:{...i,openMenus:a}}}}case zi:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,openMenus:{}}}}:e}case Ei:return{...e,disabledCategories:t.payload.categories};case _i:return{...e,hiddenItems:t.payload.hiddenItems};default:return e}},initialState:fr},Ir=()=>vo(pr.id),Sr=e=>{const{provides:t}=Ir(),[n,o]=De(null);return Pe(()=>{if(!t)return;const n=t.forDocument(e);o(n.getState());const i=n.onToolbarChanged(()=>o(n.getState())),r=n.onSidebarChanged(()=>o(n.getState())),a=n.onModalChanged(()=>o(n.getState())),s=n.onMenuChanged(()=>o(n.getState()));return()=>{i(),r(),a(),s()}},[t,e]),n},kr=ue(null);function Dr(){const e=_e(kr);if(!e)throw new Error("useUIContainer must be used within a UIProvider");return e}const Mr=ue(null);function Pr({children:e}){const t=Te(new Map),n={register:Ee((e,n,o)=>{const i=`${e}:${n}`;t.current.set(i,o)},[]),unregister:Ee((e,n)=>{const o=`${e}:${n}`;t.current.delete(o)},[]),getAnchor:Ee((e,n)=>{const o=`${e}:${n}`;return t.current.get(o)||null},[])};return We(Mr.Provider,{value:n,children:e})}function Ar(){const e=_e(Mr);if(!e)throw new Error("useAnchorRegistry must be used within UIProvider");return e}function Tr(e,t){const n=Ar(),o=Te(null),i=Te(e),r=Te(t);return i.current=e,r.current=t,Ee(e=>{const t=o.current;o.current=e,e?e!==t&&n.register(i.current,r.current,e):t&&n.unregister(i.current,r.current)},[n])}const zr=ue(null);function Er({children:e,initialComponents:t={}}){const n=Te(new Map(Object.entries(t))),o={register:Ee((e,t)=>{n.current.set(e,t)},[]),unregister:Ee(e=>{n.current.delete(e)},[]),get:Ee(e=>n.current.get(e),[]),has:Ee(e=>n.current.has(e),[]),getRegisteredIds:Ee(()=>Array.from(n.current.keys()),[])};return We(zr.Provider,{value:o,children:e})}function _r(){const e=function(){const e=_e(zr);if(!e)throw new Error("useComponentRegistry must be used within UIProvider");return e}();return{renderCustomComponent:(t,n,o)=>{const i=e.get(t);return i?We(i,{documentId:n,...o||{}}):(console.error(`Component "${t}" not found in registry`),null)}}}const Rr=ue(null);function Nr({children:e,renderers:t}){return We(Rr.Provider,{value:t,children:e})}function Or(){const e=_e(Rr);if(!e)throw new Error("useRenderers must be used within UIProvider");return e}function Lr(e,t){var n;const{provides:o}=Ir(),i=Or(),r=Ee(n=>{var r;const a=null==o?void 0:o.getSchema(),s=null==(r=null==a?void 0:a.selectionMenus)?void 0:r[e];if(!s)return null;if(!n.selected)return null;return We(i.selectionMenu,{schema:s,documentId:t,props:n})},[o,i,e,t]),a=null==o?void 0:o.getSchema();if(null==(n=null==a?void 0:a.selectionMenus)?void 0:n[e])return r}function $r({container:e,documentId:t}){const n=Sr(t),{provides:o}=Ir(),i=Ar(),r=Or(),[a,s]=De(null),l=(null==n?void 0:n.openMenus)||{},c=null==o?void 0:o.getSchema();Pe(()=>{const e=Object.keys(l);if(e.length>0){const n=e[0];if(!n)return void s(null);const o=l[n];if(o&&o.triggeredByItemId){const e=i.getAnchor(t,o.triggeredByItemId);s({menuId:n,anchorEl:e})}else s(null)}else s(null)},[l,i,t]);if(!a||!c)return null;const d=c.menus[a.menuId];if(!d)return console.warn(`Menu "${a.menuId}" not found in schema`),null;return We(r.menu,{schema:d,documentId:t,anchorEl:a.anchorEl,onClose:()=>{a&&(null==o||o.forDocument(t).closeMenu(a.menuId))},container:e})}function Fr({children:e,style:t,...n}){const{plugin:o}=po(pr.id),{provides:i}=Ir(),[r,a]=De([]),[s,l]=De([]),c=Te(null),d=Te(null),u=Te(null),h=Te(null),m=ze(()=>({containerRef:h,getContainer:()=>h.current}),[]),g=Ee(e=>{const t=u.current;if(u.current=e,h.current=e,e&&e!==t&&o){const t=function(e){const t=e.getRootNode();return t instanceof ShadowRoot?t:document.head}(e);d.current=t;const n=t.querySelector(Yi.STYLES);if(n)return c.current=n,void(n.textContent=o.getStylesheet());const i=o.getStylesheet(),r=document.createElement("style");r.setAttribute(qi,""),r.textContent=i,t instanceof ShadowRoot?t.insertBefore(r,t.firstChild):t.appendChild(r),c.current=r}},[o]);Pe(()=>()=>{var e;(null==(e=c.current)?void 0:e.parentNode)&&!u.current&&c.current.remove(),c.current=null,d.current=null},[]),Pe(()=>{if(o)return o.onStylesheetInvalidated(()=>{c.current&&(c.current.textContent=o.getStylesheet())})},[o]),Pe(()=>{if(i)return a(i.getDisabledCategories()),l(i.getHiddenItems()),i.onCategoryChanged(({disabledCategories:e,hiddenItems:t})=>{a(e),l(t)})},[i]);const p=ze(()=>r.length>0?r.join(" "):void 0,[r]),v=ze(()=>s.length>0?s.join(" "):void 0,[s]),f=ze(()=>{const e={containerType:"inline-size"};return t&&"object"==typeof t?{...e,...t}:e},[t]),y={[Bi]:"",[Zi]:p,[Ki]:v};return We(kr.Provider,{value:m,children:We("div",{ref:g,...y,...n,style:f,children:e})})}function jr({children:e,documentId:t,components:n={},renderers:o,menuContainer:i,...r}){return We(Pr,{children:We(Er,{initialComponents:n,children:We(Nr,{renderers:o,children:We(Fr,{...r,children:[e,We($r,{documentId:t,container:i})]})})})})}const Hr=class extends Xn{constructor(e,t,n){super(e,t),this.id=e,this.documentOpened$=so(),this.documentClosed$=so(),this.activeDocumentChanged$=so(),this.documentError$=so(),this.documentOrderChanged$=so(),this.openFileRequest$=ao(),this.loadOptions=new Map,this.maxDocuments=null==n?void 0:n.maxDocuments}buildCapability(){return{openFileDialog:e=>this.openFileDialog(e),openDocumentUrl:e=>this.openDocumentUrl(e),openDocumentBuffer:e=>this.openDocumentBuffer(e),retryDocument:(e,t)=>this.retryDocument(e,t),closeDocument:e=>this.closeDocument(e),closeAllDocuments:()=>this.closeAllDocuments(),setActiveDocument:e=>{if(!this.isDocumentOpen(e))throw new Error(`Cannot set active document: ${e} is not open`);this.dispatchCoreAction((e=>({type:Rn,payload:e}))(e))},getActiveDocumentId:()=>this.coreState.core.activeDocumentId,getActiveDocument:()=>{var e;const t=this.coreState.core.activeDocumentId;return t?(null==(e=this.coreState.core.documents[t])?void 0:e.document)??null:null},getDocumentOrder:()=>this.coreState.core.documentOrder,moveDocument:(e,t)=>{this.dispatchCoreAction(((e,t)=>({type:On,payload:{documentId:e,toIndex:t}}))(e,t))},swapDocuments:(e,t)=>{const n=this.coreState.core.documentOrder,o=n.indexOf(e),i=n.indexOf(t);if(-1===o||-1===i)throw new Error("One or both documents not found in order");const r=[...n];[r[o],r[i]]=[r[i],r[o]],this.dispatchCoreAction((e=>({type:Nn,payload:e}))(r))},getDocument:e=>{var t;return(null==(t=this.coreState.core.documents[e])?void 0:t.document)??null},getDocumentState:e=>this.coreState.core.documents[e]??null,getOpenDocuments:()=>this.coreState.core.documentOrder.map(e=>this.coreState.core.documents[e]).filter(e=>null!==e),isDocumentOpen:e=>this.isDocumentOpen(e),getDocumentCount:()=>Object.keys(this.coreState.core.documents).length,getDocumentIndex:e=>this.coreState.core.documentOrder.indexOf(e),onDocumentOpened:this.documentOpened$.on,onDocumentClosed:this.documentClosed$.on,onDocumentError:this.documentError$.on,onActiveDocumentChanged:this.activeDocumentChanged$.on,onDocumentOrderChanged:this.documentOrderChanged$.on}}isDocumentOpen(e){return!!this.coreState.core.documents[e]}onDocumentLoaded(e){const t=this.coreState.core.documents[e];t&&"loaded"===t.status&&(this.loadOptions.delete(e),this.documentOpened$.emit(t),this.logger.info("DocumentManagerPlugin","DocumentOpened",`Document ${e} opened successfully`,{name:t.name}))}onDocumentClosed(e){this.loadOptions.delete(e),this.documentClosed$.emit(e),this.logger.info("DocumentManagerPlugin","DocumentClosed",`Document ${e} closed`)}onActiveDocumentChanged(e,t){this.activeDocumentChanged$.emit({previousDocumentId:e,currentDocumentId:t}),this.logger.info("DocumentManagerPlugin","ActiveDocumentChanged",`Active document changed from ${e} to ${t}`)}onCoreStoreUpdated(e,t){e.core.documentOrder!==t.core.documentOrder&&this.documentOrderChanged$.emit({order:t.core.documentOrder})}onOpenFileRequest(e){return this.openFileRequest$.on(e)}openDocumentUrl(e){const t=new pt,n=e.documentId||this.generateDocumentId(),o=this.checkDocumentLimit();if(o)return t.reject(o),t;const i=this.extractNameFromUrl(e.url);this.loadOptions.set(n,e),this.dispatchCoreAction(Hn(n,i,e.scale,e.rotation,!!e.password,e.autoActivate)),this.logger.info("DocumentManagerPlugin","OpenDocumentUrl",`Starting to load document from URL: ${e.url}`,{documentId:n,passwordProvided:!!e.password});const r={id:n,url:e.url},a=this.engine.openDocumentUrl(r,{password:e.password,mode:e.mode,requestOptions:e.requestOptions});return t.resolve({documentId:n,task:a}),this.handleLoadTask(n,a,"OpenDocumentUrl"),t}openDocumentBuffer(e){const t=new pt,n=this.checkDocumentLimit();if(n)return t.reject(n),t;const o=e.documentId||this.generateDocumentId();this.loadOptions.set(o,e),this.dispatchCoreAction(Hn(o,e.name,e.scale,e.rotation,!!e.password,e.autoActivate)),this.logger.info("DocumentManagerPlugin","OpenDocumentBuffer",`Starting to load document from buffer: ${e.name}`,{documentId:o,passwordProvided:!!e.password});const i={id:o,content:e.buffer},r=this.engine.openDocumentBuffer(i,{password:e.password});return t.resolve({documentId:o,task:r}),this.handleLoadTask(o,r,"OpenDocumentBuffer"),t}retryDocument(e,t){const n=new pt,o=this.validateRetry(e);if(!o.valid)return n.reject(o.error),n;const i={...this.loadOptions.get(e),...(null==t?void 0:t.password)&&{password:t.password}};this.loadOptions.set(e,i),this.dispatchCoreAction(((e,t)=>({type:En,payload:{documentId:e,passwordProvided:t}}))(e,!!(null==t?void 0:t.password))),this.logger.info("DocumentManagerPlugin","RetryDocument",`Retrying to load document ${e}`,{passwordProvided:!!(null==t?void 0:t.password)});const r="url"in i?this.retryUrlDocument(e,i):this.retryBufferDocument(e,i);return n.resolve({documentId:e,task:r}),this.handleLoadTask(e,r,"RetryDocument"),n}openFileDialog(e){const t=new pt;return this.openFileRequest$.emit({task:t,options:e}),t}closeDocument(e){const t=new pt,n=this.coreState.core.documents[e];return n?("loaded"===n.status&&n.document?this.engine.closeDocument(n.document).wait(()=>{this.dispatchCoreAction(Un(e)),t.resolve()},n=>{this.logger.error("DocumentManagerPlugin","CloseDocument",`Failed to close document ${e}`,n),t.fail(n)}):(this.logger.info("DocumentManagerPlugin","CloseDocument",`Closing document ${e} in ${n.status} state (skipping engine close)`),this.dispatchCoreAction(Un(e)),t.resolve()),t):(this.logger.warn("DocumentManagerPlugin","CloseDocument",`Cannot close document ${e}: not found in state`),t.resolve(),t)}closeAllDocuments(){const e=Object.keys(this.coreState.core.documents),t=e.map(e=>this.closeDocument(e));return this.logger.info("DocumentManagerPlugin","CloseAllDocuments",`Closing ${e.length} documents`),pt.all(t)}checkDocumentLimit(){return this.maxDocuments&&Object.keys(this.coreState.core.documents).length>=this.maxDocuments?{code:Ut.Unknown,message:`Maximum number of documents (${this.maxDocuments}) reached`}:null}validateRetry(e){const t=this.coreState.core.documents[e];return t?"loaded"===t.status?{valid:!1,error:{code:Ut.Unknown,message:`Document ${e} is already loaded successfully`}}:"error"!==t.status?{valid:!1,error:{code:Ut.Unknown,message:`Document ${e} is not in error state (current state: ${t.status})`}}:this.loadOptions.has(e)?{valid:!0}:{valid:!1,error:{code:Ut.Unknown,message:`No retry information available for document ${e}`}}:{valid:!1,error:{code:Ut.NotFound,message:`Document ${e} not found`}}}retryUrlDocument(e,t){const n={id:e,url:t.url};return this.engine.openDocumentUrl(n,{password:t.password,mode:t.mode,requestOptions:t.requestOptions})}retryBufferDocument(e,t){const n={id:e,content:t.buffer};return this.engine.openDocumentBuffer(n,{password:t.password})}handleLoadTask(e,t,n){t.wait(t=>{this.dispatchCoreAction(((e,t)=>({type:Tn,payload:{documentId:e,document:t}}))(e,t))},t=>{this.handleLoadError(e,t,n)})}handleLoadError(e,t,n){var o,i,r;const a=(null==(o=t.reason)?void 0:o.message)||"Failed to load document";this.logger.error("DocumentManagerPlugin",n,"Failed to load document",t),this.dispatchCoreAction(((e,t,n,o)=>({type:zn,payload:{documentId:e,error:t,errorCode:n,errorDetails:o}}))(e,a,null==(i=t.reason)?void 0:i.code,t.reason)),this.documentError$.emit({documentId:e,message:a,code:null==(r=t.reason)?void 0:r.code,reason:t.reason})}generateDocumentId(){return`doc-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}extractNameFromUrl(e){try{const t=new URL(e),n=t.pathname.split("/").pop()||"document.pdf";return decodeURIComponent(n)}catch{return"document.pdf"}}async initialize(e){var t;if(this.logger.info("DocumentManagerPlugin","Initialize","Document Manager Plugin initialized",{maxDocuments:this.maxDocuments,initialDocumentsCount:(null==(t=e.initialDocuments)?void 0:t.length)??0}),e.initialDocuments&&e.initialDocuments.length>0)for(const t of e.initialDocuments)try{"buffer"in t?this.openDocumentBuffer(t):"url"in t&&this.openDocumentUrl(t)}catch(e){this.logger.error("DocumentManagerPlugin","Initialize","Failed to initiate initial document load",e)}}async destroy(){await this.closeAllDocuments().toPromise(),this.loadOptions.clear(),this.documentOpened$.clear(),this.documentClosed$.clear(),this.activeDocumentChanged$.clear(),this.documentOrderChanged$.clear(),this.documentError$.clear(),super.destroy()}};Hr.id="document-manager";let Ur=Hr;const Wr="document-manager";function Br({documentId:e,children:t}){const n=yo(e);if(!n)return null;return We(W,{children:t({documentState:n,isLoading:"loading"===n.status,isError:"error"===n.status,isLoaded:"loaded"===n.status})})}const qr=()=>vo(Ur.id);const Gr=uo({manifest:{id:Wr,name:"Document Manager Plugin",version:"1.0.0",provides:["document-manager"],requires:[],optional:[],defaultConfig:{maxDocuments:10}},create:(e,t)=>new Ur(Wr,e,t),reducer:e=>e,initialState:{}}).addUtility(function(){const{plugin:e}=po(Ur.id),{provides:t}=qr(),n=Te(null),o=Te(null),i=Te(void 0);return Pe(()=>{if(!(null==e?void 0:e.onOpenFileRequest))return;return e.onOpenFileRequest(({task:e,options:t})=>{var r;o.current=e,i.current=t,null==(r=n.current)||r.click()})},[e]),We("input",{ref:n,type:"file",accept:"application/pdf",style:{display:"none"},onChange:async e=>{var n,r,a,s,l;const c=null==(n=e.currentTarget.files)?void 0:n[0];if(!c||!t)return;const d=await c.arrayBuffer();t.openDocumentBuffer({name:c.name,buffer:d,documentId:null==(r=i.current)?void 0:r.documentId,scale:null==(a=i.current)?void 0:a.scale,rotation:null==(s=i.current)?void 0:s.rotation,autoActivate:null==(l=i.current)?void 0:l.autoActivate}).wait(e=>{var t;null==(t=o.current)||t.resolve(e)},e=>{var t;null==(t=o.current)||t.fail(e)})}})}).build(),Vr="commands",Zr={id:Vr,name:"Commands Plugin",version:"1.0.0",provides:["commands"],requires:[],optional:["i18n"],defaultConfig:{commands:{}}},Kr="COMMANDS/SET_DISABLED_CATEGORIES",Yr=e=>({type:Kr,payload:e}),Xr=class extends Xn{constructor(e,t,n){var o;super(e,t),this.commands=new Map,this.i18n=null,this.shortcutMap=new Map,this.commandExecuted$=ao(),this.commandStateChanged$=ao(),this.shortcutExecuted$=ao(),this.categoryChanged$=so(),this.previousStates=new Map;const i=t.getPlugin("i18n");this.i18n=(null==i?void 0:i.provides())??null,(null==(o=n.disabledCategories)?void 0:o.length)&&this.dispatch(Yr(n.disabledCategories)),Object.values(n.commands).forEach(e=>{this.registerCommand(e)}),this.registry.getStore().subscribe((e,t)=>{this.onGlobalStoreChange(t)})}onDocumentClosed(e){this.previousStates.delete(e),this.logger.debug("CommandsPlugin","DocumentClosed",`Cleaned up command state cache for document: ${e}`)}async initialize(){this.logger.info("CommandsPlugin","Initialize","Commands plugin initialized")}async destroy(){this.commandExecuted$.clear(),this.commandStateChanged$.clear(),this.shortcutExecuted$.clear(),this.categoryChanged$.clear(),this.commands.clear(),this.shortcutMap.clear(),this.previousStates.clear(),super.destroy()}disableCategoryImpl(e){const t=new Set(this.state.disabledCategories);t.has(e)||(t.add(e),this.dispatch(Yr(Array.from(t))),this.categoryChanged$.emit({disabledCategories:Array.from(t)}))}enableCategoryImpl(e){const t=new Set(this.state.disabledCategories);t.has(e)&&(t.delete(e),this.dispatch(Yr(Array.from(t))),this.categoryChanged$.emit({disabledCategories:Array.from(t)}))}toggleCategoryImpl(e){this.state.disabledCategories.includes(e)?this.enableCategoryImpl(e):this.disableCategoryImpl(e)}setDisabledCategoriesImpl(e){this.dispatch(Yr(e)),this.categoryChanged$.emit({disabledCategories:e})}isCommandCategoryDisabled(e){var t;return!!(null==(t=e.categories)?void 0:t.length)&&e.categories.some(e=>this.state.disabledCategories.includes(e))}buildCapability(){return{resolve:(e,t)=>this.resolve(e,t),execute:(e,t,n="ui")=>this.execute(e,t,n),getAllCommands:e=>this.getAllCommands(e),getCommandsByCategory:(e,t)=>this.getCommandsByCategory(e,t),getCommandByShortcut:e=>this.getCommandByShortcut(e),getAllShortcuts:()=>new Map(this.shortcutMap),forDocument:e=>this.createCommandScope(e),registerCommand:e=>this.registerCommand(e),unregisterCommand:e=>this.unregisterCommand(e),disableCategory:e=>this.disableCategoryImpl(e),enableCategory:e=>this.enableCategoryImpl(e),toggleCategory:e=>this.toggleCategoryImpl(e),setDisabledCategories:e=>this.setDisabledCategoriesImpl(e),getDisabledCategories:()=>this.state.disabledCategories,isCategoryDisabled:e=>this.state.disabledCategories.includes(e),onCommandExecuted:this.commandExecuted$.on,onCommandStateChanged:this.commandStateChanged$.on,onShortcutExecuted:this.shortcutExecuted$.on,onCategoryChanged:this.categoryChanged$.on}}createCommandScope(e){return{resolve:t=>this.resolve(t,e),execute:(t,n="ui")=>this.execute(t,e,n),getAllCommands:()=>this.getAllCommands(e),getCommandsByCategory:t=>this.getCommandsByCategory(t,e),onCommandStateChanged:t=>this.commandStateChanged$.on(n=>{if(n.documentId===e){const{documentId:e,...o}=n;t(o)}})}}resolve(e,t){const n=t??this.getActiveDocumentId(),o=this.commands.get(e);if(!o)throw new Error(`Command not found: ${e}`);const i=this.registry.getStore().getState(),r=this.resolveLabel(o,i,n),a=o.shortcuts?Array.isArray(o.shortcuts)?o.shortcuts:[o.shortcuts]:void 0,s=this.resolveDynamic(o.disabled,i,n)??!1,l=this.isCommandCategoryDisabled(o),c=s||l;return{id:o.id,label:r,icon:this.resolveDynamic(o.icon,i,n),iconProps:this.resolveDynamic(o.iconProps,i,n),active:this.resolveDynamic(o.active,i,n)??!1,disabled:c,visible:this.resolveDynamic(o.visible,i,n)??!0,shortcuts:a,shortcutLabel:o.shortcutLabel,categories:o.categories,description:o.description,execute:()=>o.action({registry:this.registry,state:i,documentId:n})}}resolveLabel(e,t,n){if(e.labelKey&&this.i18n){const o=this.resolveDynamic(e.labelParams,t,n);return this.i18n.t(e.labelKey,{params:o,documentId:n})}return e.label?e.label:e.id}resolveDynamic(e,t,n){if(void 0!==e)return"function"==typeof e?e({state:t,documentId:n}):e}execute(e,t,n="ui"){const o=t??this.getActiveDocumentId(),i=this.resolve(e,o);i.disabled?this.logger.warn("CommandsPlugin","ExecutionBlocked",`Command '${e}' is disabled for document '${o}'`):i.visible?(i.execute(),this.commandExecuted$.emit({commandId:e,documentId:o,source:n}),this.logger.debug("CommandsPlugin","CommandExecuted",`Command '${e}' executed for document '${o}' (source: ${n})`)):this.logger.warn("CommandsPlugin","ExecutionBlocked",`Command '${e}' is not visible for document '${o}'`)}registerCommand(e){if(this.commands.has(e.id)&&this.logger.warn("CommandsPlugin","CommandOverwrite",`Command '${e.id}' already exists and will be overwritten`),this.commands.set(e.id,e),e.shortcuts){(Array.isArray(e.shortcuts)?e.shortcuts:[e.shortcuts]).forEach(t=>{const n=this.normalizeShortcut(t);this.shortcutMap.set(n,e.id)})}this.logger.debug("CommandsPlugin","CommandRegistered",`Command '${e.id}' registered`)}unregisterCommand(e){const t=this.commands.get(e);if(t){if(t.shortcuts){(Array.isArray(t.shortcuts)?t.shortcuts:[t.shortcuts]).forEach(e=>{const t=this.normalizeShortcut(e);this.shortcutMap.delete(t)})}this.commands.delete(e),this.logger.debug("CommandsPlugin","CommandUnregistered",`Command '${e}' unregistered`)}}getCommandByShortcut(e){const t=this.normalizeShortcut(e),n=this.shortcutMap.get(t);return n?this.commands.get(n)??null:null}normalizeShortcut(e){return e.toLowerCase().split("+").sort().join("+")}getAllCommands(e){const t=e??this.getActiveDocumentId();return Array.from(this.commands.keys()).map(e=>this.resolve(e,t))}getCommandsByCategory(e,t){const n=t??this.getActiveDocumentId();return Array.from(this.commands.values()).filter(t=>{var n;return null==(n=t.categories)?void 0:n.includes(e)}).map(e=>this.resolve(e.id,n))}onGlobalStoreChange(e){Object.keys(e.core.documents).forEach(t=>{this.detectCommandChanges(t,e)})}detectCommandChanges(e,t){const n=this.previousStates.get(e)??new Map;this.commands.forEach((t,o)=>{const i=this.resolve(o,e),r=n.get(o);if(!r)return void n.set(o,i);const a={};r.active!==i.active&&(a.active=i.active),r.disabled!==i.disabled&&(a.disabled=i.disabled),r.visible!==i.visible&&(a.visible=i.visible),r.label!==i.label&&(a.label=i.label),no(r.iconProps,i.iconProps)||(a.iconProps=i.iconProps),Object.keys(a).length>0&&(n.set(o,i),this.commandStateChanged$.emit({commandId:o,documentId:e,changes:a}))}),this.previousStates.set(e,n)}};Xr.id="commands";let Qr=Xr;const Jr={disabledCategories:[]},ea=()=>vo(Qr.id),ta=(e,t)=>{const{provides:n}=ea(),[o,i]=De(()=>n?n.resolve(e,t):null);return Pe(()=>{if(!n)return void i(null);i(n.resolve(e,t));return n.onCommandStateChanged(o=>{o.commandId===e&&o.documentId===t&&i(n.resolve(e,t))})},[n,e,t]),o};const na=uo({manifest:Zr,create:(e,t)=>new Qr(Vr,e,t),reducer:(e=Jr,t)=>t.type===Kr?{...e,disabledCategories:t.payload}:e,initialState:Jr}).addUtility(function(){const{provides:e}=ea();return Pe(()=>{if(!e)return;const t=function(e){return t=>{const n=t.composedPath()[0]||t.target;if("INPUT"===n.tagName||"TEXTAREA"===n.tagName||n.isContentEditable)return;const o=function(e){const t=[];e.ctrlKey&&t.push("ctrl"),e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.metaKey&&t.push("meta");const n=e.key.toLowerCase();return["control","shift","alt","meta"].includes(n)?null:[...t,n].sort().join("+")}(t);if(!o)return;const i=e.getCommandByShortcut(o);if(!i)return;const r=e.resolve(i.id);!r.disabled&&r.visible&&(t.preventDefault(),t.stopPropagation(),e.execute(i.id,void 0,"keyboard"))}}(e);return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e]),null}).build(),oa="i18n",ia={id:oa,name:"I18n Plugin",version:"1.0.0",provides:["i18n"],requires:[],optional:[],defaultConfig:{defaultLocale:"en",locales:[{code:"en",name:"English",translations:{commands:{zoom:{in:"Zoom In",out:"Zoom Out",fitWidth:"Fit to Width",fitPage:"Fit to Page",automatic:"Automatic",level:"Zoom Level ({level}%)",inArea:"Zoom In Area"},fullscreen:{enter:"Enter Full Screen",exit:"Exit Full Screen"},rotate:{clockwise:"Rotate Clockwise",counterclockwise:"Rotate Counter-Clockwise"},menu:"Menu",sidebar:"Sidebar",search:"Search",comment:"Comment",download:"Download",print:"Print",openFile:"Open PDF",save:"Save",settings:"Settings",view:"View",annotate:"Annotate",shapes:"Shapes",redact:"Redact",fillAndSign:"Fill and Sign",form:"Form",pan:"Pan",pointer:"Pointer",undo:"Undo",redo:"Redo",copy:"Copy",screenshot:"Screenshot",nextPage:"Next Page",previousPage:"Previous Page"}}},{code:"es",name:"Español",translations:{commands:{zoom:{in:"Acercar",out:"Alejar",fitWidth:"Ajustar al ancho",fitPage:"Ajustar a la página",automatic:"Automático",level:"Nivel de zoom ({level}%)",inArea:"Acercar área"},fullscreen:{enter:"Pantalla completa",exit:"Salir de pantalla completa"},rotate:{clockwise:"Girar a la derecha",counterclockwise:"Girar a la izquierda"},menu:"Menú",sidebar:"Barra lateral",search:"Buscar",comment:"Comentario",download:"Descargar",print:"Imprimir",openFile:"Abrir PDF",save:"Guardar",settings:"Configuración",view:"Ver",annotate:"Anotar",shapes:"Formas",redact:"Redactar",fillAndSign:"Rellenar y firmar",form:"Formulario",pan:"Desplazar",pointer:"Puntero",undo:"Deshacer",redo:"Rehacer",copy:"Copiar",screenshot:"Captura de pantalla",nextPage:"Página siguiente",previousPage:"Página anterior"}}}]}},ra="I18N/SET_LOCALE",aa="I18N/REGISTER_LOCALE",sa=e=>({type:ra,payload:e}),la=e=>({type:aa,payload:e}),ca=class extends Xn{constructor(e,t,n){super(e,t),this.locales=new Map,this.paramResolvers=new Map,this.paramsCache=new Map,this.localeChange$=ao(),this.paramsChanged$=lo((e,t)=>({documentId:e,...t}),{cache:!1}),this.config=n,n.locales.forEach(e=>{this.locales.set(e.code,e),this.dispatch(la(e.code))}),n.paramResolvers&&Object.entries(n.paramResolvers).forEach(([e,t])=>{this.paramResolvers.set(e,t)}),this.dispatch(sa(n.defaultLocale)),this.registry.getStore().subscribe((e,t)=>{this.detectParamChanges(t)})}async initialize(){this.logger.info("I18nPlugin","Initialize","I18n plugin initialized")}async destroy(){this.localeChange$.clear(),this.paramsChanged$.clear(),this.paramResolvers.clear(),this.paramsCache.clear(),super.destroy()}onDocumentClosed(e){this.paramsCache.delete(e),this.paramsChanged$.clearScope(e),this.logger.debug("I18nPlugin","DocumentClosed",`Cleaned up params cache for document: ${e}`)}buildCapability(){return{t:(e,t)=>this.translate(e,t),forDocument:e=>this.createI18nScope(e),registerParamResolver:(e,t)=>this.registerParamResolver(e,t),unregisterParamResolver:e=>this.unregisterParamResolver(e),setLocale:e=>this.setLocale(e),getLocale:()=>this.state.currentLocale,getAvailableLocales:()=>[...this.state.availableLocales],getLocaleInfo:e=>this.locales.get(e)??null,registerLocale:e=>this.registerLocale(e),hasLocale:e=>this.locales.has(e),onLocaleChange:this.localeChange$.on,onParamsChanged:this.paramsChanged$.onGlobal}}createI18nScope(e){return{t:(t,n)=>this.translate(t,{documentId:e,...n}),onParamsChanged:this.paramsChanged$.forScope(e)}}translate(e,t){const n=this.locales.get(this.state.currentLocale),o=this.config.fallbackLocale?this.locales.get(this.config.fallbackLocale):null;let i=this.getNestedValue(null==n?void 0:n.translations,e);if(!i&&o&&(i=this.getNestedValue(o.translations,e)),!i){if(!(null==t?void 0:t.fallback))return this.logger.warn("I18nPlugin","MissingTranslation",`Translation not found for key: ${e}`),e;i=t.fallback}let r=null==t?void 0:t.params;return!r&&this.paramResolvers.has(e)&&(r=this.resolveParams(e,null==t?void 0:t.documentId)),this.interpolate(i,r)}resolveParams(e,t){const n=this.paramResolvers.get(e);if(!n)return;const o=this.registry.getStore().getState();try{return n({state:o,documentId:t})}catch(t){return void this.logger.error("I18nPlugin","ParamResolverError",`Error resolving params for key "${e}":`,t)}}getNestedValue(e,t){if(!e)return;const n=t.split(".");let o=e;for(const e of n){if(null==o)return;o=o[e]}return"string"==typeof o?o:void 0}interpolate(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>{const o=t[n];return void 0!==o?String(o):e}):e}detectParamChanges(e){Object.keys(e.core.documents).forEach(t=>{this.detectDocumentParamChanges(t,e)})}detectDocumentParamChanges(e,t){const n=this.paramsCache.get(e),o=[];this.paramResolvers.forEach((i,r)=>{try{const a=i({state:t,documentId:e});no(null==n?void 0:n.get(r),a)||(o.push(r),this.paramsCache.has(e)||this.paramsCache.set(e,new Map),this.paramsCache.get(e).set(r,a))}catch(e){this.logger.error("I18nPlugin","ParamDetectionError",`Error detecting param changes for key "${r}":`,e)}}),o.length>0&&(this.paramsChanged$.emit(e,{changedKeys:o}),this.logger.debug("I18nPlugin","ParamsChanged",`Translation params changed for document ${e}:`,o))}registerParamResolver(e,t){this.paramResolvers.has(e)&&this.logger.warn("I18nPlugin","ResolverOverwrite",`Param resolver for "${e}" already exists and will be overwritten`),this.paramResolvers.set(e,t),this.paramsCache.forEach(t=>{t.delete(e)}),this.logger.debug("I18nPlugin","ResolverRegistered",`Param resolver registered for: ${e}`)}unregisterParamResolver(e){this.paramResolvers.delete(e)&&(this.paramsCache.forEach(t=>{t.delete(e)}),this.logger.debug("I18nPlugin","ResolverUnregistered",`Param resolver unregistered for: ${e}`))}setLocale(e){if(!this.locales.has(e))return void this.logger.warn("I18nPlugin","LocaleNotFound",`Locale '${e}' is not registered`);const t=this.state.currentLocale;t!==e&&(this.dispatch(sa(e)),this.localeChange$.emit({previousLocale:t,currentLocale:e}),this.logger.info("I18nPlugin","LocaleChanged",`Locale changed to: ${e}`))}registerLocale(e){this.locales.has(e.code)?this.logger.warn("I18nPlugin","LocaleAlreadyRegistered",`Locale '${e.code}' is already registered`):(this.locales.set(e.code,e),this.dispatch(la(e.code)),this.logger.info("I18nPlugin","LocaleRegistered",`Locale registered: ${e.code}`))}};ca.id="i18n";let da=ca;const ua={currentLocale:"en",availableLocales:[]},ha={manifest:ia,create:(e,t)=>new da(oa,e,t),reducer:(e=ua,t)=>{switch(t.type){case ra:{const n=t.payload;return e.availableLocales.includes(n)?{...e,currentLocale:n}:(console.warn(`I18nPlugin: Locale '${n}' not available`),e)}case aa:{const n=t.payload;return e.availableLocales.includes(n)?e:{...e,availableLocales:[...e.availableLocales,n]}}default:return e}},initialState:ua},ma=e=>{const{provides:t}=vo(da.id),[,n]=Me(e=>e+1,0),o=Ee((n,o)=>t?t.t(n,{documentId:e,params:null==o?void 0:o.params,fallback:null==o?void 0:o.fallback}):(null==o?void 0:o.fallback)??n,[t,e]);return Pe(()=>{if(!t)return;const o=t.onLocaleChange(()=>{n()}),i=e?t.forDocument(e).onParamsChanged(()=>{n()}):t.onParamsChanged(()=>{n()});return()=>{o(),i()}},[t,e]),{translate:o,locale:(null==t?void 0:t.getLocale())??"en"}};var ga=(e=>(e.Automatic="automatic",e.FitPage="fit-page",e.FitWidth="fit-width",e))(ga||{}),pa=(e=>(e[e.Center=0]="Center",e[e.Top=1]="Top",e))(pa||{});const va="zoom",fa={id:va,name:"Zoom Plugin",version:"1.0.0",provides:["zoom"],requires:["viewport","scroll"],optional:["interaction-manager","spread"],defaultConfig:{defaultZoomLevel:ga.Automatic,minZoom:.2,maxZoom:60,zoomStep:.1,zoomRanges:[{min:.2,max:.5,step:.05},{min:.5,max:1,step:.1},{min:1,max:2,step:.2},{min:2,max:4,step:.4},{min:4,max:10,step:.8},{min:10,max:20,step:1.6},{min:20,max:40,step:3.2},{min:40,max:60,step:6.4}],presets:[{name:"Fit Page",value:ga.FitPage},{name:"Fit Width",value:ga.FitWidth},{name:"Automatic",value:ga.Automatic},{name:"25%",value:.25},{name:"50%",value:.5},{name:"100%",value:1},{name:"125%",value:1.25},{name:"150%",value:1.5},{name:"200%",value:2},{name:"400%",value:4},{name:"800%",value:8},{name:"1600%",value:16}]}},ya="ZOOM/INIT_STATE",ba="ZOOM/CLEANUP_STATE",wa="ZOOM/SET_ZOOM_LEVEL",xa="ZOOM/SET_MARQUEE_ZOOM_ACTIVE";const Ca={zoomLevel:ga.Automatic,currentZoomLevel:1,isMarqueeZoomActive:!1},Ia={documents:{},activeDocumentId:null};const Sa=class extends Xn{constructor(e,t,n){var o,i,r;super(e,t),this.zoom$=ao(),this.state$=so(),this.viewportPlugin=t.getPlugin("viewport"),this.viewport=this.viewportPlugin.provides(),this.scroll=t.getPlugin("scroll").provides();const a=t.getPlugin("interaction-manager");this.interactionManager=(null==a?void 0:a.provides())??null;const s=t.getPlugin("spread");this.spread=(null==s?void 0:s.provides())??null,this.minZoom=n.minZoom??.25,this.maxZoom=n.maxZoom??10,this.zoomStep=n.zoomStep??.1,this.defaultZoomLevel=n.defaultZoomLevel,this.presets=n.presets??[],this.zoomRanges=this.normalizeRanges(n.zoomRanges??[]),this.viewport.onViewportResize(e=>this.recalcAuto(e.documentId,pa.Top),{mode:"debounce",wait:150,keyExtractor:e=>e.documentId}),null==(o=this.spread)||o.onSpreadChange(e=>{this.recalcAuto(e.documentId,pa.Top)}),null==(i=this.interactionManager)||i.registerMode({id:"marqueeZoom",scope:"page",exclusive:!0,cursor:"zoom-in"}),null==(r=this.interactionManager)||r.onModeChange(e=>{const t="marqueeZoom"===e.activeMode,n=this.getDocumentState(e.documentId);var o;n&&n.isMarqueeZoomActive!==t&&this.dispatch((o=e.documentId,{type:xa,payload:{documentId:o,isActive:t}}))})}onDocumentLoadingStarted(e){this.viewport.gate("zoom",e);const t={...Ca,zoomLevel:this.defaultZoomLevel};this.dispatch(function(e,t){return{type:ya,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("ZoomPlugin","DocumentOpened",`Initialized zoom state for document: ${e}`)}onDocumentLoaded(e){this.recalcAuto(e,pa.Top)}onDocumentClosed(e){this.dispatch(function(e){return{type:ba,payload:e}}(e)),this.logger.debug("ZoomPlugin","DocumentClosed",`Cleaned up zoom state for document: ${e}`)}onRotationChanged(e){this.recalcAuto(e,pa.Top)}buildCapability(){return{requestZoom:(e,t)=>this.requestZoom(e,t),requestZoomBy:(e,t)=>this.requestZoomBy(e,t),zoomIn:()=>this.zoomIn(),zoomOut:()=>this.zoomOut(),zoomToArea:(e,t)=>this.zoomToArea(e,t),enableMarqueeZoom:()=>this.enableMarqueeZoom(),disableMarqueeZoom:()=>this.disableMarqueeZoom(),toggleMarqueeZoom:()=>this.toggleMarqueeZoom(),isMarqueeZoomActive:()=>this.isMarqueeZoomActive(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createZoomScope(e),registerMarqueeOnPage:e=>this.registerMarqueeOnPage(e),getPresets:()=>this.presets,onZoomChange:this.zoom$.on,onStateChange:this.state$.on}}createZoomScope(e){return{requestZoom:(t,n)=>this.requestZoom(t,n,e),requestZoomBy:(t,n)=>this.requestZoomBy(t,n,e),zoomIn:()=>this.zoomIn(e),zoomOut:()=>this.zoomOut(e),zoomToArea:(t,n)=>this.zoomToArea(t,n,e),enableMarqueeZoom:()=>this.enableMarqueeZoom(e),disableMarqueeZoom:()=>this.disableMarqueeZoom(e),toggleMarqueeZoom:()=>this.toggleMarqueeZoom(e),isMarqueeZoomActive:()=>this.isMarqueeZoomActive(e),getState:()=>this.getDocumentStateOrThrow(e),onZoomChange:t=>this.zoom$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Zoom state not found for document: ${e??"active"}`);return t}requestZoom(e,t,n){this.handleRequest({level:e,center:t},n)}requestZoomBy(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getDocumentStateOrThrow(o).currentZoomLevel,r=this.toZoom(i+e);this.handleRequest({level:r,center:t},o)}zoomIn(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).currentZoomLevel;this.handleRequest({level:n,delta:this.stepFor(n)},t)}zoomOut(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).currentZoomLevel;this.handleRequest({level:n,delta:-this.stepFor(n)},t)}zoomToArea(e,t,n){const o=n??this.getActiveDocumentId();this.handleZoomToArea(o,e,t)}enableMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManager)||t.forDocument(n).activate("marqueeZoom")}disableMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManager)||t.forDocument(n).activateDefaultMode()}toggleMarqueeZoom(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManager)?void 0:t.forDocument(n);"marqueeZoom"===(null==o?void 0:o.getActiveMode())?o.activateDefaultMode():null==o||o.activate("marqueeZoom")}isMarqueeZoomActive(e){var t;const n=e??this.getActiveDocumentId();return"marqueeZoom"===(null==(t=this.interactionManager)?void 0:t.forDocument(n).getActiveMode())}handleRequest({level:e,delta:t=0,center:n,focus:o=pa.Center,align:i="keep"},r){const a=r??this.getActiveDocumentId(),s=this.getDocumentStateOrThrow(a);if(!this.coreState.core.documents[a])return;const l=this.viewport.forDocument(a),c=l.getMetrics(),d=s.currentZoomLevel;if(0===c.clientWidth||0===c.clientHeight)return;const u="number"==typeof e?e:this.computeZoomForMode(a,e,c);if(!1===u)return;const h=to(u+t,this.minZoom,this.maxZoom),m=Math.floor(1e3*h)/1e3,g=n??{vx:c.clientWidth/2,vy:o===pa.Top?0:c.clientHeight/2},{desiredScrollLeft:p,desiredScrollTop:v}=this.computeScrollForZoomChange(a,c,d,m,g,i);isNaN(p)||isNaN(v)||this.viewportPlugin.setViewportScrollMetrics(a,{scrollLeft:p,scrollTop:v}),this.dispatch(function(e,t,n){return{type:wa,payload:{documentId:e,zoomLevel:t,currentZoomLevel:n}}}(a,"number"==typeof e?m:e,m)),this.dispatchCoreAction(((e,t)=>({type:$n,payload:{scale:e,documentId:t}}))(m,a)),this.viewport.isGated(a)&&this.viewport.releaseGate("zoom",a),l.scrollTo({x:p,y:v,behavior:"instant"});const f={documentId:a,oldZoom:d,newZoom:m,level:e,center:g,desiredScrollLeft:p,desiredScrollTop:v,viewport:c};this.zoom$.emit(f)}computeZoomForMode(e,t,n){if(!this.coreState.core.documents[e])return!1;const o=this.scroll.forDocument(e),i=o?this.scroll.getPageGap():0,r=this.viewport.getViewportGap(),a=o.getSpreadPagesWithRotatedSize();if(!a.length)return!1;if(0===n.clientWidth||0===n.clientHeight)return!1;const s=n.clientWidth-2*r,l=n.clientHeight-2*r;if(s<=0||l<=0)return!1;let c=0,d=0;switch(a.forEach(e=>{const t=e.reduce((e,t,n)=>e+t.rotatedSize.width+(n?i:0),0),n=Math.max(...e.map(e=>e.rotatedSize.height));c=Math.max(c,t),d=Math.max(d,n)}),t){case ga.FitWidth:return s/c;case ga.FitPage:return Math.min(s/c,l/d);case ga.Automatic:return Math.min(s/c,1);default:return 1}}computeScrollForZoomChange(e,t,n,o,i,r="keep"){const a=this.scroll.forDocument(e).getLayout(),s=this.viewport.getViewportGap(),l=a.totalContentSize.width,c=a.totalContentSize.height,d=t.clientWidth-2*s,u=t.clientHeight-2*s,h=(e,t,n)=>t*n<e?(e-t*n)/2:0,m=h(d,l,n),g=h(u,c,n),p=h(d,l,o),v=h(u,c,o),f=(t.scrollLeft+i.vx-s-m)/n*o+s+p,y=(t.scrollTop+i.vy-s-g)/n*o+s+v,b="center"===r?f-t.clientWidth/2:f-i.vx,w="center"===r?y-t.clientHeight/2:y-i.vy;return{desiredScrollLeft:Math.max(0,b),desiredScrollTop:Math.max(0,w)}}handleZoomToArea(e,t,n){const o=this.coreState.core.documents[e];if(!o)return;const i=o.rotation,r=this.viewport.forDocument(e).getMetrics(),a=this.viewport.getViewportGap(),s=this.getDocumentStateOrThrow(e).currentZoomLevel,l=r.clientWidth-2*a,c=r.clientHeight-2*a,d=this.scroll.forDocument(e).getLayout(),u=d.virtualItems.find(e=>e.pageLayouts.some(e=>e.pageIndex===t));if(!u)return;const h=u.pageLayouts.find(e=>e.pageIndex===t),m=nt({width:h.width,height:h.height},n,i),g=this.toZoom(Math.min(l/m.size.width,c/m.size.height)),p=u.x+h.x,v=u.y+h.y,f=p+m.origin.x+m.size.width/2,y=v+m.origin.y+m.size.height/2,b=(e,t,n)=>t*n<e?(e-t*n)/2:0,w=b(l,d.totalContentSize.width,s),x=b(c,d.totalContentSize.height,s),C=a+w+f*s-r.scrollLeft,I=a+x+y*s-r.scrollTop;this.handleRequest({level:g,center:{vx:C,vy:I},align:"center"},e)}recalcAuto(e,t){const n=this.getDocumentState(e);n&&(n.zoomLevel!==ga.Automatic&&n.zoomLevel!==ga.FitPage&&n.zoomLevel!==ga.FitWidth||this.handleRequest({level:n.zoomLevel,focus:t},e))}normalizeRanges(e){return[...e].filter(e=>e.step>0&&e.max>e.min).sort((e,t)=>e.min-t.min)}stepFor(e){const t=this.zoomRanges.find(t=>e>=t.min&&e<t.max);return t?t.step:this.zoomStep}toZoom(e){return parseFloat(to(e,this.minZoom,this.maxZoom).toFixed(2))}registerMarqueeOnPage(e){if(!this.interactionManager)return this.logger.warn("ZoomPlugin","MissingDependency","Interaction manager plugin not loaded, marquee zoom disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!t||!t.document)return this.logger.warn("ZoomPlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("ZoomPlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const o=function(e){const{pageSize:t,scale:n,minDragPx:o=5,onPreview:i,onCommit:r,onSmallDrag:a}=e;let s=null,l=null;return{onPointerDown:(e,t)=>{var n;s=e,l={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==i||i(l),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!s)return;const n=to(e.x,0,t.width),o=to(e.y,0,t.height);l={origin:{x:Math.min(s.x,n),y:Math.min(s.y,o)},size:{width:Math.abs(n-s.x),height:Math.abs(o-s.y)}},null==i||i(l)},onPointerUp:(e,t)=>{var c;l&&(Math.max(l.size.width,l.size.height)*n>o?null==r||r(l):null==a||a()),s=null,l=null,null==i||i(null),null==(c=t.releasePointerCapture)||c.call(t)},onPointerCancel:(e,t)=>{var n;s=null,l=null,null==i||i(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,o;this.zoomToArea(e.pageIndex,t,e.documentId),null==(o=(n=e.callback).onCommit)||o.call(n,t)},onSmallDrag:()=>{var t,n;this.zoomIn(e.documentId),null==(n=(t=e.callback).onSmallDrag)||n.call(t)}});return this.interactionManager.registerHandlers({documentId:e.documentId,modeId:"marqueeZoom",handlers:o,pageIndex:e.pageIndex})}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o&&i&&(o.currentZoomLevel!==i.currentZoomLevel||o.zoomLevel!==i.zoomLevel||o.isMarqueeZoomActive!==i.isMarqueeZoomActive)&&this.state$.emit({documentId:n,state:i})}}async initialize(){this.logger.info("ZoomPlugin","Initialize","Zoom plugin initialized")}async destroy(){this.zoom$.clear(),this.state$.clear(),super.destroy()}};Sa.id="zoom";let ka=Sa;const Da={manifest:fa,create:(e,t)=>new ka(va,e,t),reducer:(e=Ia,t)=>{switch(t.type){case ya:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case ba:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ZOOM/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case wa:{const{documentId:n,zoomLevel:o,currentZoomLevel:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,zoomLevel:o,currentZoomLevel:i}}}:e}case xa:{const{documentId:n,isActive:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isMarqueeZoomActive:o}}}:e}default:return e}},initialState:Ia},Ma=()=>vo(ka.id),Pa=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="rgba(33,150,243,0.8)",fill:r="rgba(33,150,243,0.15)"})=>{const{provides:a}=Ma(),s=yo(e),[l,c]=De(null),d=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Pe(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?We("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*d,top:l.origin.y*d,width:l.size.width*d,height:l.size.height*d,border:`1px solid ${i}`,background:r,boxSizing:"border-box"},className:o}):null},Aa=class extends Xn{constructor(e,t,n){super(e,t),this.config=n}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:t=>this.renderPage(t,e),renderPageRect:t=>this.renderPageRect(t,e)}}renderPage({pageIndex:e,options:t},n){const o=n??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))throw new Error(`Document ${o} not loaded`);const r=i.document.pages.find(t=>t.index===e);if(!r)throw new Error(`Page ${e} not found in document ${o}`);const a={...t??{},withForms:(null==t?void 0:t.withForms)??this.config.withForms??!1,withAnnotations:(null==t?void 0:t.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==t?void 0:t.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==t?void 0:t.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPage(i.document,r,a)}renderPageRect({pageIndex:e,rect:t,options:n},o){const i=o??this.getActiveDocumentId(),r=this.coreState.core.documents[i];if(!(null==r?void 0:r.document))throw new Error(`Document ${i} not loaded`);const a=r.document.pages.find(t=>t.index===e);if(!a)throw new Error(`Page ${e} not found in document ${i}`);const s={...n??{},withForms:(null==n?void 0:n.withForms)??this.config.withForms??!1,withAnnotations:(null==n?void 0:n.withAnnotations)??this.config.withAnnotations??!1,imageType:(null==n?void 0:n.imageType)??this.config.defaultImageType??"image/png",imageQuality:(null==n?void 0:n.imageQuality)??this.config.defaultImageQuality??.92};return this.engine.renderPageRect(r.document,a,t,s)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};Aa.id="render";let Ta=Aa;const za="render",Ea={manifest:{id:za,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new Ta(za,e,t),reducer:()=>{},initialState:{}};function _a({documentId:e,pageIndex:t,scale:n,dpr:o,style:i,...r}){const{provides:a}=vo(Ta.id),s=yo(e),[l,c]=De(null),d=Te(null),u=ze(()=>s&&s.pageRefreshVersions[t]||0,[s,t]),h=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),m=ze(()=>void 0!==o?o:window.devicePixelRatio,[o]);Pe(()=>{if(!a)return;const n=a.forDocument(e).renderPage({pageIndex:t,options:{scaleFactor:h,dpr:m}});return n.wait(e=>{const t=URL.createObjectURL(e);c(t),d.current=t},xn),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):n.abort({code:Ut.Cancelled,message:"canceled render task"})}},[e,t,h,m,a,u]);return We(W,{children:l&&We("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...r,style:{width:"100%",height:"100%",...i||{}}})})}const Ra="rotate",Na={id:Ra,name:"Rotate Plugin",version:"1.0.0",provides:["rotate"],requires:[],optional:[],defaultConfig:{}};const Oa="ROTATE/INIT_STATE",La="ROTATE/CLEANUP_STATE",$a="ROTATE/SET_ROTATION";const Fa=class extends Xn{constructor(e,t,n){super(e,t),this.rotate$=so(),this.defaultRotation=n.defaultRotation??0}onDocumentLoadingStarted(e){const t={rotation:this.defaultRotation};this.dispatch(function(e,t){return{type:Oa,payload:{documentId:e,state:t}}}(e,t)),this.dispatchCoreAction(Bn(this.defaultRotation,e)),this.logger.debug("RotatePlugin","DocumentOpened",`Initialized rotation state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:La,payload:e}}(e)),this.logger.debug("RotatePlugin","DocumentClosed",`Cleaned up rotation state for document: ${e}`)}buildCapability(){return{setRotation:e=>this.setRotationForDocument(e),getRotation:()=>this.getRotationForDocument(),rotateForward:()=>this.rotateForward(),rotateBackward:()=>this.rotateBackward(),forDocument:e=>this.createRotateScope(e),onRotateChange:this.rotate$.on}}createRotateScope(e){return{setRotation:t=>this.setRotationForDocument(t,e),getRotation:()=>this.getRotationForDocument(e),rotateForward:()=>this.rotateForward(e),rotateBackward:()=>this.rotateBackward(e),onRotateChange:t=>this.rotate$.on(n=>{n.documentId===e&&t(n.rotation)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Rotation state not found for document: ${e??"active"}`);return t}setRotationForDocument(e,t){const n=t??this.getActiveDocumentId(),o=this.coreState.core.documents[n];if(!(null==o?void 0:o.document))throw new Error(`Document ${n} not loaded`);this.dispatch(function(e,t){return{type:$a,payload:{documentId:e,rotation:t}}}(n,e)),this.dispatchCoreAction(Bn(e,n)),this.rotate$.emit({documentId:n,rotation:e})}getRotationForDocument(e){return this.getDocumentStateOrThrow(e).rotation}rotateForward(e){const t=e??this.getActiveDocumentId(),n=this.getRotationForDocument(t),o=(n+1)%4;this.setRotationForDocument(o,t)}rotateBackward(e){const t=e??this.getActiveDocumentId(),n=this.getRotationForDocument(t),o=(n+3)%4;this.setRotationForDocument(o,t)}getMatrixAsString(e){return function(e,t,n){const[o,i,r,a,s,l]=function(e,t,n){let o=1,i=0,r=0,a=1,s=0,l=0;switch(e){case 1:o=0,i=1,r=-1,a=0,s=n;break;case 2:o=-1,i=0,r=0,a=-1,s=t,l=n;break;case 3:o=0,i=-1,r=1,a=0,l=t}return[o,i,r,a,s,l]}(e,t,n);return`matrix(${o},${i},${r},${a},${s},${l})`}(e.rotation,e.width,e.height)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];(null==o?void 0:o.rotation)!==i.rotation&&this.logger.debug("RotatePlugin","RotationChanged",`Rotation changed for document ${n}: ${(null==o?void 0:o.rotation)??0} -> ${i.rotation}`)}}async initialize(e){this.logger.info("RotatePlugin","Initialize","Rotate plugin initialized")}async destroy(){this.rotate$.clear(),super.destroy()}};Fa.id="rotate";let ja=Fa;const Ha={documents:{},activeDocumentId:null},Ua={manifest:Na,create:(e,t)=>new ja(Ra,e,t),reducer:(e=Ha,t)=>{switch(t.type){case Oa:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case La:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ROTATE/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case $a:{const{documentId:n,rotation:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,rotation:o}}}:e}default:return e}},initialState:Ha};function Wa({children:e,documentId:t,pageIndex:n,rotation:o,scale:i,style:r,...a}){var s,l,c,d;const{plugin:u}=po(ja.id),h=yo(t),m=null==(l=null==(s=null==h?void 0:h.document)?void 0:s.pages)?void 0:l[n],g=(null==(c=null==m?void 0:m.size)?void 0:c.width)??0,p=(null==(d=null==m?void 0:m.size)?void 0:d.height)??0,v=o??(null==h?void 0:h.rotation)??0,f=i??(null==h?void 0:h.scale)??1,y=(null==u?void 0:u.getMatrixAsString({width:g*f,height:p*f,rotation:v}))??"matrix(1, 0, 0, 1, 0, 0)";return m?We("div",{...a,style:{position:"absolute",transformOrigin:"0 0",transform:y,...r},children:e}):null}const Ba="SEARCH/INIT_STATE",qa="SEARCH/CLEANUP_STATE",Ga="SEARCH/START_SEARCH_SESSION",Va="SEARCH/STOP_SEARCH_SESSION",Za="SEARCH/SET_SEARCH_FLAGS",Ka="SEARCH/SET_SHOW_ALL_RESULTS",Ya="SEARCH/START_SEARCH",Xa="SEARCH/SET_SEARCH_RESULTS",Qa="SEARCH/APPEND_SEARCH_RESULTS",Ja="SEARCH/SET_ACTIVE_RESULT_INDEX";function es(e,t){return{type:Ka,payload:{documentId:e,showAll:t}}}function ts(e,t,n,o){return{type:Xa,payload:{documentId:e,results:t,total:n,activeResultIndex:o}}}function ns(e,t){return{type:Ja,payload:{documentId:e,index:t}}}const os={flags:[],results:[],total:0,activeResultIndex:-1,showAllResults:!0,query:"",loading:!1,active:!1},is={documents:{}},rs=(e,t,n)=>{const o=e.documents[t]||os;return{...e,documents:{...e.documents,[t]:{...o,...n}}}},as=class extends Xn{constructor(e,t,n){super(e,t),this.searchStop$=so(),this.searchStart$=so(),this.searchResult$=so(),this.searchActiveResultChange$=so(),this.searchResultState$=so(),this.searchState$=so(),this.currentTask=new Map,this.pluginConfig=n}onDocumentLoadingStarted(e){const t={...os,flags:this.pluginConfig.flags||[],showAllResults:this.pluginConfig.showAllResults??!0};this.dispatch(function(e,t){return{type:Ba,payload:{documentId:e,state:t}}}(e,t))}onDocumentClosed(e){this.stopSearchSession(e),this.dispatch(function(e){return{type:qa,payload:e}}(e)),this.currentTask.delete(e)}async initialize(){}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.searchState$.emit({documentId:n,state:i}),o&&o.results===i.results&&o.activeResultIndex===i.activeResultIndex&&o.showAllResults===i.showAllResults&&o.active===i.active||this.searchResultState$.emit({documentId:n,state:{results:i.results,activeResultIndex:i.activeResultIndex,showAllResults:i.showAllResults,active:i.active}}))}}buildCapability(){const e=e=>e??this.getActiveDocumentId(),t=t=>{const n=e(t),o=this.state.documents[n];if(!o)throw new Error(`Search state not found for document ${n}`);return o};return{startSearch:t=>this.startSearchSession(e(t)),stopSearch:t=>this.stopSearchSession(e(t)),searchAllPages:(t,n)=>this.searchAllPages(t,e(n)),nextResult:t=>this.nextResult(e(t)),previousResult:t=>this.previousResult(e(t)),goToResult:(t,n)=>this.goToResult(t,e(n)),setShowAllResults:(t,n)=>this.dispatch(es(e(n),t)),getShowAllResults:e=>t(e).showAllResults,getFlags:e=>t(e).flags,setFlags:(t,n)=>this.setFlags(t,e(n)),getState:e=>t(e),forDocument:this.createSearchScope.bind(this),onSearchResult:this.searchResult$.on,onSearchStart:this.searchStart$.on,onSearchStop:this.searchStop$.on,onActiveResultChange:this.searchActiveResultChange$.on,onSearchResultStateChange:this.searchResultState$.on,onStateChange:this.searchState$.on}}createSearchScope(e){const t=()=>{const t=this.state.documents[e];if(!t)throw new Error(`Search state not found for document ${e}`);return t};return{startSearch:()=>this.startSearchSession(e),stopSearch:()=>this.stopSearchSession(e),searchAllPages:t=>this.searchAllPages(t,e),nextResult:()=>this.nextResult(e),previousResult:()=>this.previousResult(e),goToResult:t=>this.goToResult(t,e),setShowAllResults:t=>this.dispatch(es(e,t)),getShowAllResults:()=>t().showAllResults,getFlags:()=>t().flags,setFlags:t=>this.setFlags(t,e),getState:t,onSearchResult:t=>this.searchResult$.on(n=>{n.documentId===e&&t(n.results)}),onSearchStart:t=>this.searchStart$.on(n=>{n.documentId===e&&t()}),onSearchStop:t=>this.searchStop$.on(n=>{n.documentId===e&&t()}),onActiveResultChange:t=>this.searchActiveResultChange$.on(n=>{n.documentId===e&&t(n.index)}),onSearchResultStateChange:t=>this.searchResultState$.on(n=>{n.documentId===e&&t(n.state)}),onStateChange:t=>this.searchState$.on(n=>{n.documentId===e&&t(n.state)})}}setFlags(e,t){this.dispatch(function(e,t){return{type:Za,payload:{documentId:e,flags:t}}}(t,e));const n=this.state.documents[t];(null==n?void 0:n.active)&&this.searchAllPages(n.query,t,!0)}notifySearchStart(e){this.searchStart$.emit({documentId:e})}notifySearchStop(e){this.searchStop$.emit({documentId:e})}notifyActiveResultChange(e,t){this.searchActiveResultChange$.emit({documentId:e,index:t})}startSearchSession(e){this.getCoreDocument(e)&&(this.dispatch(function(e){return{type:Ga,payload:{documentId:e}}}(e)),this.notifySearchStart(e))}stopSearchSession(e){var t;const n=this.state.documents[e];if(!(null==n?void 0:n.active))return;const o=this.currentTask.get(e);if(o){try{null==(t=o.abort)||t.call(o,{code:Ut.Cancelled,message:"search stopped"})}catch{}this.currentTask.delete(e)}this.dispatch(function(e){return{type:Va,payload:{documentId:e}}}(e)),this.notifySearchStop(e)}searchAllPages(e,t,n=!1){var o;const i=this.state.documents[t];if(!i)return Wt.reject({code:Ut.NotFound,message:"Search state not initialized"});const r=this.getCoreDocument(t);if(!(null==r?void 0:r.document))return Wt.reject({code:Ut.NotFound,message:"Document not loaded"});const a=e.trim();if(i.query===a&&!n)return Wt.resolve({results:i.results,total:i.total});const s=this.currentTask.get(t);if(s){try{null==(o=s.abort)||o.call(s,{code:Ut.Cancelled,message:"new search"})}catch{}this.currentTask.delete(t)}if(this.dispatch(function(e,t){return{type:Ya,payload:{documentId:e,query:t}}}(t,a)),!a)return this.dispatch(ts(t,[],0,-1)),Wt.resolve({results:[],total:0});i.active||this.startSearchSession(t);const l=this.engine.searchAllPages(r.document,a,{flags:i.flags});return this.currentTask.set(t,l),l.onProgress(e=>{var n;(null==(n=null==e?void 0:e.results)?void 0:n.length)&&this.currentTask.get(t)===l&&(this.dispatch(function(e,t){return{type:Qa,payload:{documentId:e,results:t}}}(t,e.results)),-1===this.state.documents[t].activeResultIndex&&(this.dispatch(ns(t,0)),this.notifyActiveResultChange(t,0)))}),l.wait(e=>{this.currentTask.delete(t);const n=e.total>0?0:-1;this.dispatch(ts(t,e.results,e.total,n)),this.searchResult$.emit({documentId:t,results:e}),e.total>0&&this.notifyActiveResultChange(t,0)},e=>{var n;(null==(n=null==e?void 0:e.reason)?void 0:n.code)!==Ut.Cancelled&&(console.error("Error during search:",e),this.dispatch(ts(t,[],0,-1))),this.currentTask.delete(t)}),l}nextResult(e){const t=this.state.documents[e];if(!t||0===t.results.length)return-1;const n=t.activeResultIndex>=t.results.length-1?0:t.activeResultIndex+1;return this.goToResult(n,e)}previousResult(e){const t=this.state.documents[e];if(!t||0===t.results.length)return-1;const n=t.activeResultIndex<=0?t.results.length-1:t.activeResultIndex-1;return this.goToResult(n,e)}goToResult(e,t){const n=this.state.documents[t];return!n||0===n.results.length||e<0||e>=n.results.length?-1:(this.dispatch(ns(t,e)),this.notifyActiveResultChange(t,e),e)}async destroy(){for(const e of Object.keys(this.state.documents))this.stopSearchSession(e);this.searchResult$.clear(),this.searchStart$.clear(),this.searchStop$.clear(),this.searchActiveResultChange$.clear(),this.searchResultState$.clear(),this.searchState$.clear(),super.destroy()}};as.id="search";let ss=as;const ls="search",cs={manifest:{id:ls,name:"Search Plugin",version:"1.0.0",provides:["search"],requires:[],optional:[],defaultConfig:{flags:[]}},create:(e,t)=>new ss(ls,e,t),reducer:(e=is,t)=>{switch(t.type){case Ba:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case qa:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Ga:return rs(e,t.payload.documentId,{active:!0});case Va:return rs(e,t.payload.documentId,{results:[],total:0,activeResultIndex:-1,query:"",loading:!1,active:!1});case Za:return rs(e,t.payload.documentId,{flags:t.payload.flags});case Ka:return rs(e,t.payload.documentId,{showAllResults:t.payload.showAll});case Ya:return rs(e,t.payload.documentId,{loading:!0,query:t.payload.query,results:[],total:0,activeResultIndex:-1});case Qa:{const{documentId:n,results:o}=t.payload,i=e.documents[n];if(!i)return e;const r=[...i.results,...o],a=-1===i.activeResultIndex&&r.length>0?0:i.activeResultIndex;return rs(e,n,{results:r,total:r.length,activeResultIndex:a,loading:!0})}case Xa:{const{documentId:n,results:o,total:i,activeResultIndex:r}=t.payload;return rs(e,n,{results:o,total:i,activeResultIndex:r,loading:!1})}case Ja:return rs(e,t.payload.documentId,{activeResultIndex:t.payload.index});default:return e}},initialState:is},ds=()=>vo(ss.id);function us({documentId:e,pageIndex:t,scale:n,style:o,highlightColor:i="#FFFF00",activeHighlightColor:r="#FFBF00",...a}){const{provides:s}=ds(),[l,c]=De(null),d=yo(e),u=ze(()=>null==s?void 0:s.forDocument(e),[s,e]),h=ze(()=>void 0!==n?n:(null==d?void 0:d.scale)??1,[n,null==d?void 0:d.scale]);if(Pe(()=>{if(!u)return void c(null);const e=u.getState();return c({results:e.results,activeResultIndex:e.activeResultIndex,showAllResults:e.showAllResults,active:e.active}),u.onSearchResultStateChange(e=>{c(e)})},[u]),!l||!l.active)return null;return We("div",{style:{...o,pointerEvents:"none"},...a,children:l.results.map((e,t)=>({result:e,originalIndex:t})).filter(({result:e})=>e.pageIndex===t).filter(({originalIndex:e})=>l.showAllResults||e===l.activeResultIndex).map(({result:e,originalIndex:t})=>e.rects.map((e,n)=>We("div",{style:{position:"absolute",top:e.origin.y*h,left:e.origin.x*h,width:e.size.width*h,height:e.size.height*h,backgroundColor:t===l.activeResultIndex?r:i,mixBlendMode:"multiply",transform:"scale(1.02)",transformOrigin:"center",transition:"opacity .3s ease-in-out",opacity:1}},`${t}-${n}`)))})}const hs="selection",ms={id:hs,name:"Selection Plugin",version:"1.0.0",provides:["selection"],requires:["interaction-manager"],optional:["viewport","scroll"],defaultConfig:{menuHeight:40}},gs="SELECTION/INIT_STATE",ps="SELECTION/CLEANUP_STATE",vs="SELECTION/CACHE_PAGE_GEOMETRY",fs="SELECTION/SET_SELECTION",ys="SELECTION/START_SELECTION",bs="SELECTION/END_SELECTION",ws="SELECTION/CLEAR_SELECTION",xs="SELECTION/SET_RECTS",Cs="SELECTION/SET_SLICES",Is={geometry:{},rects:{},slices:{},selection:null,active:!1,selecting:!1},Ss={documents:{}},ks=(e,t,n)=>({...e,documents:{...e.documents,[t]:n}});function Ds(e,t){return e.rects[t]??[]}function Ms(e,t){return rt(Ds(e,t))}function Ps(e){const t=[],n=e.rects;for(const e in n){const o=Number(e),i=rt(n[o]);i&&t.push({page:o,rect:i})}return t}function As(e,t){const n=e.rects[t]||[];if(0===n.length)return null;const o=Ms(e,t);return o?{pageIndex:t,rect:o,segmentRects:n}:null}function Ts(e){const t=[],n=Object.keys(e.rects).map(Number);for(const o of n){const n=e.rects[o]||[];if(0===n.length)continue;const i=Ms(e,o);i&&t.push({pageIndex:o,rect:i,segmentRects:n})}return t}function zs(e,t){for(const n of e.runs){if(!(t.y>=n.rect.y&&t.y<=n.rect.y+n.rect.height&&t.x>=n.rect.x&&t.x<=n.rect.x+n.rect.width))continue;const e=n.glyphs.findIndex(e=>t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height);if(-1!==e)return n.charStart+e}return-1}function Es(e,t,n){if(!e||!t)return null;if(n<e.start.page||n>e.end.page)return null;const o=n===e.start.page?e.start.index:0,i=t.runs[t.runs.length-1],r=i.charStart+i.glyphs.length-1;return{from:o,to:n===e.end.page?e.end.index:r}}function _s(e,t,n,o=!0){const i=[];for(const o of e.runs){const e=o.charStart,r=e+o.glyphs.length-1;if(r<t||e>n)continue;const a=Math.max(t,e)-e,s=Math.min(n,r)-e;let l=1/0,c=-1/0,d=1/0,u=-1/0,h=0;for(let e=a;e<=s;e++){const t=o.glyphs[e];2!==t.flags&&(l=Math.min(l,t.x),c=Math.max(c,t.x+t.width),d=Math.min(d,t.y),u=Math.max(u,t.y+t.height),h++)}l!==1/0&&h>0&&i.push({rect:{origin:{x:l,y:d},size:{width:c-l,height:u-d}},charCount:h})}return o?function(e){const t=[];let n=null,o=null;for(const i of e)n&&o?Ls(n,i)?o=Rs(o,i.rect):(t.push(o),o=i.rect):o=i.rect,n=i;o&&!Ns(o)&&t.push(o);return t}(i):i.map(e=>e.rect)}function Rs(e,t){const n=Math.min(e.origin.x,t.origin.x),o=Math.min(e.origin.y,t.origin.y);return{origin:{x:n,y:o},size:{width:Math.max(e.origin.x+e.size.width,t.origin.x+t.size.width)-n,height:Math.max(e.origin.y+e.size.height,t.origin.y+t.size.height)-o}}}function Ns(e){return e.size.width<=0||e.size.height<=0}function Os(e,t){if(Ns(e)||Ns(t))return 0;const n=Rs(e,t);if(n.size.height===e.size.height||n.size.height===t.size.height)return 1;const o=function(e,t){const n=Math.max(e.origin.x,t.origin.x),o=Math.max(e.origin.y,t.origin.y),i=Math.min(e.origin.x+e.size.width,t.origin.x+t.size.width),r=Math.min(e.origin.y+e.size.height,t.origin.y+t.size.height);return{origin:{x:n,y:o},size:{width:Math.max(0,i-n),height:Math.max(0,r-o)}}}(e,t);return o.size.height/n.size.height}function Ls(e,t){const n=e.rect,o=t.rect;if(Os(n,o)<.8)return!1;const i=1*n.size.width/e.charCount,r=1*o.size.width/t.charCount,a=n.origin.x-i,s=n.origin.x+n.size.width+i,l=o.origin.x-r;return a<o.origin.x+o.size.width+r&&s>l}const $s=class extends Xn{constructor(e,t,n){var o,i,r;super(e,t),this.enabledModesPerDoc=new Map,this.selecting=new Map,this.anchor=new Map,this.pageCallbacks=new Map,this.menuPlacement$=lo((e,t)=>({documentId:e,placement:t})),this.selChange$=lo((e,t)=>({documentId:e,selection:t})),this.textRetrieved$=lo((e,t)=>({documentId:e,text:t})),this.copyToClipboard$=lo((e,t)=>({documentId:e,text:t}),{cache:!1}),this.beginSelection$=lo((e,t)=>({documentId:e,page:t.page,index:t.index}),{cache:!1}),this.endSelection$=lo(e=>({documentId:e}),{cache:!1}),this.viewportCapability=null,this.scrollCapability=null,this.menuHeight=n.menuHeight??40;const a=t.getPlugin("interaction-manager");if(!a)throw new Error("SelectionPlugin: InteractionManagerPlugin is required.");this.interactionManagerCapability=a.provides(),this.viewportCapability=(null==(o=t.getPlugin("viewport"))?void 0:o.provides())??null,this.scrollCapability=(null==(i=t.getPlugin("scroll"))?void 0:i.provides())??null,this.coreStore.onAction(Ln,e=>{const{documentId:t,pageIndexes:n}=e.payload,o=n.map(e=>this.getNewPageGeometryAndCache(t,e));pt.all(o).wait(()=>{n.forEach(e=>{this.notifyPage(t,e)})},xn)}),null==(r=this.viewportCapability)||r.onViewportChange(e=>{this.recalculateMenuPlacement(e.documentId)},{mode:"throttle",wait:100})}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:gs,payload:{documentId:e,state:t}}))(e,Is)),this.enabledModesPerDoc.set(e,new Set(["pointerMode"])),this.pageCallbacks.set(e,new Map),this.selecting.set(e,!1),this.anchor.set(e,void 0)}onDocumentClosed(e){this.dispatch((e=>({type:ps,payload:e}))(e)),this.enabledModesPerDoc.delete(e),this.pageCallbacks.delete(e),this.selecting.delete(e),this.anchor.delete(e),this.selChange$.clearScope(e),this.textRetrieved$.clearScope(e),this.copyToClipboard$.clearScope(e),this.beginSelection$.clearScope(e),this.endSelection$.clearScope(e),this.menuPlacement$.clearScope(e)}async initialize(){}async destroy(){this.selChange$.clear(),this.textRetrieved$.clear(),this.copyToClipboard$.clear(),this.beginSelection$.clear(),this.endSelection$.clear(),this.menuPlacement$.clear(),super.destroy()}buildCapability(){const e=e=>e??this.getActiveDocumentId();return{getFormattedSelection:t=>Ts(this.getDocumentState(e(t))),getFormattedSelectionForPage:(t,n)=>As(this.getDocumentState(e(n)),t),getHighlightRectsForPage:(t,n)=>Ds(this.getDocumentState(e(n)),t),getHighlightRects:t=>this.getDocumentState(e(t)).rects,getBoundingRectForPage:(t,n)=>Ms(this.getDocumentState(e(n)),t),getBoundingRects:t=>Ps(this.getDocumentState(e(t))),getSelectedText:t=>this.getSelectedText(e(t)),clear:t=>this.clearSelection(e(t)),copyToClipboard:t=>this.copyToClipboard(e(t)),getState:t=>this.getDocumentState(e(t)),enableForMode:(t,n)=>{var o;return null==(o=this.enabledModesPerDoc.get(e(n)))?void 0:o.add(t)},isEnabledForMode:(t,n)=>{var o;return(null==(o=this.enabledModesPerDoc.get(e(n)))?void 0:o.has(t))??!1},forDocument:this.createSelectionScope.bind(this),onCopyToClipboard:this.copyToClipboard$.onGlobal,onSelectionChange:this.selChange$.onGlobal,onTextRetrieved:this.textRetrieved$.onGlobal,onBeginSelection:this.beginSelection$.onGlobal,onEndSelection:this.endSelection$.onGlobal}}createSelectionScope(e){return{getFormattedSelection:()=>Ts(this.getDocumentState(e)),getFormattedSelectionForPage:t=>As(this.getDocumentState(e),t),getHighlightRectsForPage:t=>Ds(this.getDocumentState(e),t),getHighlightRects:()=>this.getDocumentState(e).rects,getBoundingRectForPage:t=>Ms(this.getDocumentState(e),t),getBoundingRects:()=>Ps(this.getDocumentState(e)),getSelectedText:()=>this.getSelectedText(e),clear:()=>this.clearSelection(e),copyToClipboard:()=>this.copyToClipboard(e),getState:()=>this.getDocumentState(e),onSelectionChange:this.selChange$.forScope(e),onTextRetrieved:this.textRetrieved$.forScope(e),onCopyToClipboard:this.copyToClipboard$.forScope(e),onBeginSelection:this.beginSelection$.forScope(e),onEndSelection:this.endSelection$.forScope(e)}}getDocumentState(e){const t=this.state.documents[e];if(!t)throw new Error(`Selection state not found for document: ${e}`);return t}onMenuPlacement(e,t){return this.menuPlacement$.forScope(e)(t)}registerSelectionOnPage(e){var t;const{documentId:n,pageIndex:o,onRectsChange:i}=e,r=this.state.documents[n];if(!r)return this.logger.warn("SelectionPlugin","RegisterFailed",`Cannot register selection on page ${o} for document ${n}: document state not initialized.`),()=>{};null==(t=this.pageCallbacks.get(n))||t.set(o,i);const a=this.getOrLoadGeometry(n,o),s=this.interactionManagerCapability.forDocument(n),l=this.enabledModesPerDoc.get(n);i({rects:Ds(r,o),boundingRect:Ms(r,o)});const c={onPointerDown:(e,t,i)=>{if(!(null==l?void 0:l.has(i)))return;this.clearSelection(n);const r=this.getDocumentState(n).geometry[o];if(r){const t=zs(r,e);-1!==t&&this.beginSelection(n,o,t)}},onPointerMove:(e,t,i)=>{if(!(null==l?void 0:l.has(i)))return;const r=this.getDocumentState(n).geometry[o];if(r){const t=zs(r,e);-1!==t?s.setCursor("selection-text","text",10):s.removeCursor("selection-text"),this.selecting.get(n)&&-1!==t&&this.updateSelection(n,o,t)}},onPointerUp:(e,t,o)=>{(null==l?void 0:l.has(o))&&this.endSelection(n)},onHandlerActiveEnd:e=>{(null==l?void 0:l.has(e))&&this.clearSelection(n)}},d=this.interactionManagerCapability.registerAlways({scope:{type:"page",documentId:n,pageIndex:o},handlers:c});return()=>{var e;d(),null==(e=this.pageCallbacks.get(n))||e.delete(o),a.abort({code:Ut.Cancelled,message:"Cleanup"})}}getPlacementMetrics(e,t,n,o){var i;const r=null==(i=this.scrollCapability)?void 0:i.forDocument(e),a=null==r?void 0:r.getRectPositionForPage(t,n);if(!a)return null;const s=a.origin.y-o.scrollTop,l=a.origin.y+a.size.height-o.scrollTop;return{pageIndex:t,rect:n,spaceAbove:s,spaceBelow:o.clientHeight-l,isBottomVisible:l>0&&l<=o.clientHeight,isTopVisible:s>=0&&s<o.clientHeight}}recalculateMenuPlacement(e){const t=this.state.documents[e];if(!t)return;if(t.selecting||null===t.selection)return void this.menuPlacement$.emit(e,null);const n=Ps(t);if(0===n.length)return void this.menuPlacement$.emit(e,null);const o=n[n.length-1];if(!this.viewportCapability||!this.scrollCapability)return void this.menuPlacement$.emit(e,{pageIndex:o.page,rect:o.rect,spaceAbove:0,spaceBelow:1/0,suggestTop:!1,isVisible:!0});const i=this.viewportCapability.forDocument(e).getMetrics(),r=n[0],a=this.getPlacementMetrics(e,o.page,o.rect,i),s=this.getPlacementMetrics(e,r.page,r.rect,i);a&&a.isBottomVisible&&a.spaceBelow>this.menuHeight?this.menuPlacement$.emit(e,{...a,suggestTop:!1,isVisible:!0}):s&&s.isTopVisible?this.menuPlacement$.emit(e,{...s,suggestTop:!0,isVisible:!0}):a&&a.isBottomVisible?this.menuPlacement$.emit(e,{...a,suggestTop:!1,isVisible:!0}):this.menuPlacement$.emit(e,null)}notifyPage(e,t){var n;const o=null==(n=this.pageCallbacks.get(e))?void 0:n.get(t);if(o){const n=this.getDocumentState(e);o("pointerMode"===this.interactionManagerCapability.forDocument(e).getActiveMode()?{rects:Ds(n,t),boundingRect:Ms(n,t)}:{rects:[],boundingRect:null})}}notifyAllPages(e){var t;null==(t=this.pageCallbacks.get(e))||t.forEach((t,n)=>{this.notifyPage(e,n)})}getNewPageGeometryAndCache(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return Wt.reject({code:Ut.NotFound,message:"Doc Not Found"});const o=n.document.pages.find(e=>e.index===t),i=this.engine.getPageGeometry(n.document,o);return i.wait(n=>{this.dispatch(((e,t,n)=>({type:vs,payload:{documentId:e,page:t,geo:n}}))(e,t,n))},xn),i}getOrLoadGeometry(e,t){const n=this.getDocumentState(e).geometry[t];return n?Wt.resolve(n):this.getNewPageGeometryAndCache(e,t)}beginSelection(e,t,n){this.selecting.set(e,!0),this.anchor.set(e,{page:t,index:n}),this.dispatch((e=>({type:ys,payload:{documentId:e}}))(e)),this.beginSelection$.emit(e,{page:t,index:n}),this.recalculateMenuPlacement(e)}endSelection(e){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch((e=>({type:bs,payload:{documentId:e}}))(e)),this.endSelection$.emit(e),this.recalculateMenuPlacement(e)}clearSelection(e){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch((e=>({type:ws,payload:{documentId:e}}))(e)),this.selChange$.emit(e,null),this.menuPlacement$.emit(e,null),this.notifyAllPages(e)}updateSelection(e,t,n){if(!this.selecting.get(e)||!this.anchor.get(e))return;const o=this.anchor.get(e),i=t>o.page||t===o.page&&n>=o.index,r={start:i?o:{page:t,index:n},end:i?{page:t,index:n}:o};this.dispatch(((e,t)=>({type:fs,payload:{documentId:e,selection:t}}))(e,r)),this.updateRectsAndSlices(e,r),this.selChange$.emit(e,r);for(let t=r.start.page;t<=r.end.page;t++)this.notifyPage(e,t)}updateRectsAndSlices(e,t){const n=this.getDocumentState(e),o={},i={};for(let e=t.start.page;e<=t.end.page;e++){const r=n.geometry[e],a=Es(t,r,e);a&&(o[e]=_s(r,a.from,a.to),i[e]={start:a.from,count:a.to-a.from+1})}this.dispatch(((e,t)=>({type:xs,payload:{documentId:e,rects:t}}))(e,o)),this.dispatch(((e,t)=>({type:Cs,payload:{documentId:e,slices:t}}))(e,i))}getSelectedText(e){const t=this.getCoreDocument(e),n=this.getDocumentState(e);if(!(null==t?void 0:t.document)||!n.selection)return Wt.reject({code:Ut.NotFound,message:"Doc Not Found or No Selection"});const o=n.selection,i=[];for(let e=o.start.page;e<=o.end.page;e++){const t=n.slices[e];t&&i.push({pageIndex:e,charIndex:t.start,charCount:t.count})}if(0===i.length)return Wt.resolve([]);const r=this.engine.getTextSlices(t.document,i);return r.wait(t=>{this.textRetrieved$.emit(e,t)},xn),r}copyToClipboard(e){this.getSelectedText(e).wait(t=>{this.copyToClipboard$.emit(e,t.join("\n"))},xn)}};$s.id="selection";let Fs=$s;const js={manifest:ms,create:(e,t)=>new Fs(hs,e,t),reducer:(e=Ss,t)=>{switch(t.type){case gs:{const{documentId:n,state:o}=t.payload;return ks(e,n,o)}case ps:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case vs:{const{documentId:n,page:o,geo:i}=t.payload,r=e.documents[n];return r?ks(e,n,{...r,geometry:{...r.geometry,[o]:i}}):e}case fs:{const{documentId:n,selection:o}=t.payload,i=e.documents[n];return i?ks(e,n,{...i,selection:o,active:!0}):e}case ys:{const{documentId:n}=t.payload,o=e.documents[n];return o?ks(e,n,{...o,selecting:!0,selection:null,rects:{}}):e}case bs:{const{documentId:n}=t.payload,o=e.documents[n];return o?ks(e,n,{...o,selecting:!1}):e}case ws:{const{documentId:n}=t.payload,o=e.documents[n];return o?ks(e,n,{...o,selecting:!1,selection:null,rects:{},active:!1}):e}case xs:{const{documentId:n,rects:o}=t.payload,i=e.documents[n];return i?ks(e,n,{...i,rects:o}):e}case Cs:{const{documentId:n,slices:o}=t.payload,i=e.documents[n];return i?ks(e,n,{...i,slices:o}):e}case"SELECTION/RESET":{const{documentId:n}=t.payload;return e.documents[n]?ks(e,n,Is):e}default:return e}},initialState:Ss};const Hs="onDblClick";function Us({children:e,...t}){const{rect:n,rotation:o}=t,{matrix:i,width:r,height:a}=function(e,t){const{width:n,height:o}=e.size;switch(t%4){case 1:return{matrix:`matrix(0, -1, 1, 0, 0, ${o})`,width:o,height:n};case 2:return{matrix:`matrix(-1, 0, 0, -1, ${n}, ${o})`,width:n,height:o};case 3:return{matrix:`matrix(0, 1, -1, 0, ${n}, 0)`,width:o,height:n};default:return{matrix:"matrix(1, 0, 0, 1, 0, 0)",width:n,height:o}}}(n,o),s=Te(null);Pe(()=>{const e=s.current;if(!e)return;const t=e=>{e.stopPropagation()},n=e=>{e.stopPropagation()};return e.addEventListener("pointerdown",t,{capture:!0}),e.addEventListener("touchstart",n,{capture:!0}),()=>{e.removeEventListener("pointerdown",t,{capture:!0}),e.removeEventListener("touchstart",n,{capture:!0})}},[]);return We(W,{children:e({menuWrapperProps:{style:{position:"absolute",left:n.origin.x,top:n.origin.y,transform:i,transformOrigin:"0 0",width:r,height:a,pointerEvents:"none",zIndex:3},ref:e=>{s.current=e}},matrix:i,rect:{origin:{x:n.origin.x,y:n.origin.y},size:{width:r,height:a}}})})}class Ws{constructor(e,t){this.config=e,this.onUpdate=t,this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[],this.currentVertices=[],this.currentVertices=e.vertices||[]}updateConfig(e){this.config={...this.config,...e},this.currentVertices=e.vertices||[]}startDrag(e,t){this.state="dragging",this.startPoint={x:e,y:t},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"move",changes:{rect:this.startElement}}})}startResize(e,t,n){this.state="resizing",this.activeHandle=e,this.startPoint={x:t,y:n},this.startElement={...this.config.element},this.currentPosition={...this.config.element},this.onUpdate({state:"start",transformData:{type:"resize",changes:{rect:this.startElement},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}startVertexEdit(e,t,n){this.currentVertices=[...this.config.vertices??this.currentVertices],e<0||e>=this.currentVertices.length||(this.state="vertex-editing",this.activeVertexIndex=e,this.startPoint={x:t,y:n},this.startVertices=[...this.currentVertices],this.onUpdate({state:"start",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:e}}}))}move(e,t){if("idle"!==this.state&&this.startPoint)if("dragging"===this.state&&this.startElement){const n=this.calculateDelta(e,t),o=this.calculateDragPosition(n);this.currentPosition=o,this.onUpdate({state:"move",transformData:{type:"move",changes:{rect:o}}})}else if("resizing"===this.state&&this.activeHandle&&this.startElement){const n=this.calculateDelta(e,t),o=this.calculateResizePosition(n,this.activeHandle);this.currentPosition=o,this.onUpdate({state:"move",transformData:{type:"resize",changes:{rect:o},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio}}})}else if("vertex-editing"===this.state&&null!==this.activeVertexIndex){const n=this.calculateVertexPosition(e,t);this.currentVertices=n,this.onUpdate({state:"move",transformData:{type:"vertex-edit",changes:{vertices:n},metadata:{vertexIndex:this.activeVertexIndex}}})}}end(){if("idle"===this.state)return;const e=this.state,t=this.activeHandle,n=this.activeVertexIndex;if("vertex-editing"===e)this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.currentVertices},metadata:{vertexIndex:n||void 0}}});else{const n=this.getCurrentPosition();this.onUpdate({state:"end",transformData:{type:"dragging"===e?"move":"resize",changes:{rect:n},metadata:"dragging"===e?void 0:{handle:t||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}})}this.reset()}cancel(){"idle"!==this.state&&("vertex-editing"===this.state?this.onUpdate({state:"end",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:this.activeVertexIndex||void 0}}}):this.startElement&&this.onUpdate({state:"end",transformData:{type:"dragging"===this.state?"move":"resize",changes:{rect:this.startElement},metadata:"dragging"===this.state?void 0:{handle:this.activeHandle||void 0,maintainAspectRatio:this.config.maintainAspectRatio}}}),this.reset())}reset(){this.state="idle",this.startPoint=null,this.startElement=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[]}getCurrentPosition(){return this.currentPosition||this.config.element}calculateDelta(e,t){if(!this.startPoint)return{x:0,y:0};const n={x:e-this.startPoint.x,y:t-this.startPoint.y};return this.transformDelta(n)}transformDelta(e){const{pageRotation:t=0,scale:n=1}=this.config,o=t*Math.PI/2,i=Math.cos(o),r=Math.sin(o),a=e.x/n,s=e.y/n;return{x:i*a+r*s,y:-r*a+i*s}}clampPoint(e){var t;const n=null==(t=this.config.constraints)?void 0:t.boundingBox;return n?{x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))}:e}calculateVertexPosition(e,t){if(null===this.activeVertexIndex)return this.startVertices;const n=this.calculateDelta(e,t),o=[...this.startVertices],i=o[this.activeVertexIndex],r={x:i.x+n.x,y:i.y+n.y};return o[this.activeVertexIndex]=this.clampPoint(r),o}calculateDragPosition(e){if(!this.startElement)return this.config.element;const t={origin:{x:this.startElement.origin.x+e.x,y:this.startElement.origin.y+e.y},size:{width:this.startElement.size.width,height:this.startElement.size.height}};return this.applyConstraints(t)}calculateResizePosition(e,t){var n;if(!this.startElement)return this.config.element;let{origin:{x:o,y:i},size:{width:r,height:a}}=this.startElement;switch(t){case"se":r+=e.x,a+=e.y;break;case"sw":o+=e.x,r-=e.x,a+=e.y;break;case"ne":r+=e.x,i+=e.y,a-=e.y;break;case"nw":o+=e.x,r-=e.x,i+=e.y,a-=e.y;break;case"n":i+=e.y,a-=e.y;break;case"s":a+=e.y;break;case"e":r+=e.x;break;case"w":o+=e.x,r-=e.x}if(this.config.maintainAspectRatio&&this.startElement){const e=this.startElement.size.width/this.startElement.size.height;if(["n","s","e","w"].includes(t))if("n"===t||"s"===t){const t=a*e,n=t-r;r=t,o-=n/2}else{const n=r/e,s=n-a;a=n,"w"===t&&(o=this.startElement.origin.x+this.startElement.size.width-r),i-=s/2}else{Math.abs(r-this.startElement.size.width)>Math.abs(a-this.startElement.size.height)?a=r/e:r=a*e,t.includes("w")&&(o=this.startElement.origin.x+this.startElement.size.width-r),t.includes("n")&&(i=this.startElement.origin.y+this.startElement.size.height-a)}}const s=null==(n=this.config.constraints)?void 0:n.boundingBox;if(s)switch(t){case"e":r=Math.min(r,s.width-o);break;case"s":a=Math.min(a,s.height-i);break;case"se":r=Math.min(r,s.width-o),a=Math.min(a,s.height-i);break;case"w":o<0&&(r+=o,o=0);break;case"n":i<0&&(a+=i,i=0);break;case"sw":o<0&&(r+=o,o=0),a=Math.min(a,s.height-i);break;case"nw":o<0&&(r+=o,o=0),i<0&&(a+=i,i=0);break;case"ne":r=Math.min(r,s.width-o),i<0&&(a+=i,i=0)}return this.applyConstraints({origin:{x:o,y:i},size:{width:r,height:a}})}applyConstraints(e){const{constraints:t}=this.config;if(!t)return e;let{origin:{x:n,y:o},size:{width:i,height:r}}=e;return i=Math.max(t.minWidth||1,i),r=Math.max(t.minHeight||1,r),t.maxWidth&&(i=Math.min(t.maxWidth,i)),t.maxHeight&&(r=Math.min(t.maxHeight,r)),t.boundingBox&&(n=Math.max(0,Math.min(n,t.boundingBox.width-i)),o=Math.max(0,Math.min(o,t.boundingBox.height-r))),{origin:{x:n,y:o},size:{width:i,height:r}}}}function Bs(e,t){return"n"===e||"s"===e?"ns-resize":"e"===e||"w"===e?"ew-resize":t%2==0?{nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"}[e]:{nw:"nesw-resize",ne:"nwse-resize",sw:"nwse-resize",se:"nesw-resize"}[e]}function qs(e,t,n){const o=-e/2;return"center"===n?o:"outside"===n?o-t:o+t}function Gs(e){const{controller:t,resizeUI:n,vertexUI:o,includeVertices:i=!1,handleAttrs:r,vertexAttrs:a}=e,{dragProps:s,createResizeProps:l,createVertexProps:c}=function(e){const{onUpdate:t,enabled:n=!0,...o}=e,i=Te(null),r=Te(t);Pe(()=>{r.current=t},[t]),Pe(()=>{i.current?i.current.updateConfig(o):i.current=new Ws(o,e=>{var t;return null==(t=r.current)?void 0:t.call(r,e)})},[o.element,o.constraints,o.maintainAspectRatio,o.pageRotation,o.scale,o.vertices]);const a=Ee(e=>{var t;n&&(e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.startDrag(e.clientX,e.clientY),e.currentTarget.setPointerCapture(e.pointerId))},[n]),s=Ee(e=>{var t;e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.move(e.clientX,e.clientY)},[]),l=Ee(e=>{var t,n,o;e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.end(),null==(o=(n=e.currentTarget).releasePointerCapture)||o.call(n,e.pointerId)},[]),c=Ee(e=>({onPointerDown:t=>{var o;n&&(t.preventDefault(),t.stopPropagation(),null==(o=i.current)||o.startResize(e,t.clientX,t.clientY),t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove:s,onPointerUp:l,onPointerCancel:l}),[n,s,l]),d=Ee(e=>({onPointerDown:t=>{var o;n&&(t.preventDefault(),t.stopPropagation(),null==(o=i.current)||o.startVertexEdit(e,t.clientX,t.clientY),t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove:s,onPointerUp:l,onPointerCancel:l}),[n,s,l]);return{dragProps:n?{onPointerDown:a,onPointerMove:s,onPointerUp:l,onPointerCancel:l}:{},createResizeProps:c,createVertexProps:d}}(t),d=ze(()=>function(e,t={}){const{handleSize:n=8,spacing:o=1,offsetMode:i="outside",includeSides:r=!1,zIndex:a=3,rotationAwareCursor:s=!0}=t,l=(e.pageRotation??0)%4,c=e=>({[e]:qs(n,o,i)+"px"});return[["nw",{...c("top"),...c("left")}],["ne",{...c("top"),...c("right")}],["sw",{...c("bottom"),...c("left")}],["se",{...c("bottom"),...c("right")}],...r?[["n",{...c("top"),left:`calc(50% - ${n/2}px)`}],["s",{...c("bottom"),left:`calc(50% - ${n/2}px)`}],["w",{...c("left"),top:`calc(50% - ${n/2}px)`}],["e",{...c("right"),top:`calc(50% - ${n/2}px)`}]]:[]].map(([e,t])=>({handle:e,style:{position:"absolute",width:n+"px",height:n+"px",borderRadius:"50%",zIndex:a,cursor:s?Bs(e,l):"default",touchAction:"none",...t},attrs:{"data-epdf-handle":e}}))}(t,n).map(e=>{var t;return{key:null==(t=e.attrs)?void 0:t["data-epdf-handle"],style:e.style,...l(e.handle),...e.attrs??{},...(null==r?void 0:r(e.handle))??{}}}),[t.element.origin.x,t.element.origin.y,t.element.size.width,t.element.size.height,t.scale,t.pageRotation,t.maintainAspectRatio,null==n?void 0:n.handleSize,null==n?void 0:n.spacing,null==n?void 0:n.offsetMode,null==n?void 0:n.includeSides,null==n?void 0:n.zIndex,null==n?void 0:n.rotationAwareCursor,l,r]),u=ze(()=>{if(!i)return[];const e=function(e,t={},n){const{vertexSize:o=12,zIndex:i=4}=t,r=e.element,a=e.scale??1;return(n??e.vertices??[]).map((e,t)=>({handle:"nw",style:{position:"absolute",left:(e.x-r.origin.x)*a-o/2+"px",top:(e.y-r.origin.y)*a-o/2+"px",width:o+"px",height:o+"px",borderRadius:"50%",cursor:"pointer",zIndex:i,touchAction:"none"},attrs:{"data-epdf-vertex":t}}))}(t,o,t.vertices);return e.map((e,t)=>({key:t,style:e.style,...c(t),...e.attrs??{},...(null==a?void 0:a(t))??{}}))},[i,t.element.origin.x,t.element.origin.y,t.element.size.width,t.element.size.height,t.scale,t.vertices,null==o?void 0:o.vertexSize,null==o?void 0:o.zIndex,c,a]);return{dragProps:s,resize:d,vertices:u}}const Vs=()=>vo(Fs.id);function Zs({documentId:e,pageIndex:t,scale:n,rotation:o,background:i="rgba(33,150,243)",selectionMenu:r}){const{plugin:a}=po(Fs.id),s=yo(e),[l,c]=De([]),[d,u]=De(null),[h,m]=De(null);Pe(()=>{if(a&&e)return a.registerSelectionOnPage({documentId:e,pageIndex:t,onRectsChange:({rects:e,boundingRect:t})=>{c(e),u(t)}})},[a,e,t]),Pe(()=>{if(a&&e)return a.onMenuPlacement(e,e=>{m(e)})},[a,e]);const g=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),p=ze(()=>void 0!==o?o:(null==s?void 0:s.rotation)??Be.Degree0,[o,null==s?void 0:s.rotation]),v=r&&h&&h.pageIndex===t&&h.isVisible;return d?We(W,{children:[We("div",{style:{position:"absolute",left:d.origin.x*g,top:d.origin.y*g,width:d.size.width*g,height:d.size.height*g,mixBlendMode:"multiply",isolation:"isolate",pointerEvents:"none"},children:l.map((e,t)=>We("div",{style:{position:"absolute",left:(e.origin.x-d.origin.x)*g,top:(e.origin.y-d.origin.y)*g,width:e.size.width*g,height:e.size.height*g,background:i}},t))}),v&&We(Us,{rect:{origin:{x:h.rect.origin.x*g,y:h.rect.origin.y*g},size:{width:h.rect.size.width*g,height:h.rect.size.height*g}},rotation:p,children:e=>r({...e,context:{type:"selection",pageIndex:t},selected:!0,placement:h})})]}):null}const Ks=uo(js).addUtility(function(){const{provides:e}=Vs();return Pe(()=>{if(e)return e.onCopyToClipboard(({text:e})=>{navigator.clipboard.writeText(e)})},[e]),null}).build(),Ys="tiling",Xs={id:Ys,name:"Tiling Plugin",version:"1.0.0",provides:["tiling"],requires:["render","scroll","viewport"],optional:[],defaultConfig:{tileSize:768,overlapPx:2.5,extraRings:0}},Qs="TILING/INIT_STATE",Js="TILING/CLEANUP_STATE",el="TILING/UPDATE_VISIBLE_TILES",tl="TILING/MARK_TILE_STATUS",nl=(e,t)=>({type:el,payload:{documentId:e,tiles:t}}),ol=(e,t,n,o)=>({type:tl,payload:{documentId:e,pageIndex:t,tileId:n,status:o}}),il={visibleTiles:{}};function rl({tileSize:e=768,overlapPx:t=2.5,extraRings:n=0,scale:o,rotation:i,page:r,metric:a}){const s=r.size.width*o,l=r.size.height*o,c=e-t,d=function(e,t,n,o){return ot(nt(e,t,(4-n)%4),1/o)}(Ke(r.size,i,o),{origin:{x:a.scaled.pageX,y:a.scaled.pageY},size:{width:a.scaled.visibleWidth,height:a.scaled.visibleHeight}},i,1),u=d.origin.x,h=d.origin.y,m=u+d.size.width,g=h+d.size.height,p=Math.floor((s-1)/c),v=Math.floor((l-1)/c),f=Math.max(0,Math.floor(u/c)-n),y=Math.min(p,Math.floor((m-1)/c)+n),b=Math.max(0,Math.floor(h/c)-n),w=Math.min(v,Math.floor((g-1)/c)+n),x=[];for(let t=f;t<=y;t++){const n=t*c,i=Math.min(e,s-n),a=n/o,d=i/o;for(let s=b;s<=w;s++){const u=s*c,h=Math.min(e,l-u),m=u/o,g=h/o;x.push({id:`p${r.index}-${o}-x${n}-y${u}-w${i}-h${h}`,col:t,row:s,pageRect:{origin:{x:a,y:m},size:{width:d,height:g}},screenRect:{origin:{x:n,y:u},size:{width:i,height:h}},status:"queued",srcScale:o,isFallback:!1})}}return x}const al=class extends Xn{constructor(e,t,n){super(e,t),this.tileRendering$=so(),this.config=n,this.renderCapability=this.registry.getPlugin("render").provides(),this.scrollCapability=this.registry.getPlugin("scroll").provides(),this.viewportCapability=this.registry.getPlugin("viewport").provides(),this.scrollCapability.onScroll(e=>this.calculateVisibleTiles(e.documentId,e.metrics),{mode:"throttle",wait:50,throttleMode:"trailing"}),this.coreStore.onAction(Ln,e=>this.recalculateTiles(e.payload))}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:Qs,payload:{documentId:e,state:t}}))(e,il))}onDocumentClosed(e){this.dispatch((e=>({type:Js,payload:e}))(e))}onScaleChanged(e){this.recalculateTilesForDocument(e)}onRotationChanged(e){this.recalculateTilesForDocument(e)}recalculateTilesForDocument(e){const t=this.scrollCapability.forDocument(e),n=this.viewportCapability.forDocument(e),o=t.getMetrics(n.getMetrics());this.calculateVisibleTiles(e,o)}async recalculateTiles(e){const{documentId:t,pageIndexes:n}=e,o=this.getCoreDocument(t);if(!o||!o.document)return;const i=this.scrollCapability.forDocument(t),r=this.viewportCapability.forDocument(t),a=i.getMetrics(r.getMetrics()),s={},l=Date.now(),c=o.scale,d=o.rotation;for(const e of n){const t=a.pageVisibilityMetrics.find(t=>t.pageNumber===e+1);if(!t)continue;const n=o.document.pages[e];n&&(s[e]=rl({page:n,metric:t,scale:c,rotation:d,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings}).map(e=>({...e,id:`${e.id}-r${l}`})))}Object.keys(s).length>0&&this.dispatch(nl(t,s))}async initialize(){}calculateVisibleTiles(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return;const o=n.scale,i=n.rotation,r={};for(const e of t.pageVisibilityMetrics){const t=e.pageNumber-1,a=n.document.pages[t];if(!a)continue;const s=rl({page:a,metric:e,scale:o,rotation:i,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings});r[t]=s}this.dispatch(nl(e,r))}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&this.tileRendering$.emit({documentId:n,tiles:i.visibleTiles})}}buildCapability(){return{renderTile:this.renderTile.bind(this),forDocument:this.createTilingScope.bind(this),onTileRendering:this.tileRendering$.on}}createTilingScope(e){return{renderTile:t=>this.renderTile(t,e),onTileRendering:t=>this.tileRendering$.on(n=>{n.documentId===e&&t(n.tiles)})}}renderTile(e,t){const n=t??this.getActiveDocumentId();if(!this.renderCapability)throw new Error("Render capability not available.");this.dispatch(ol(n,e.pageIndex,e.tile.id,"rendering"));const o=this.renderCapability.forDocument(n).renderPageRect({pageIndex:e.pageIndex,rect:e.tile.pageRect,options:{scaleFactor:e.tile.srcScale,dpr:e.dpr}});return o.wait(()=>{this.dispatch(ol(n,e.pageIndex,e.tile.id,"ready"))},xn),o}};al.id="tiling";let sl=al;const ll={manifest:Xs,create:(e,t)=>new sl(Ys,e,t),reducer:(e,t)=>((e,t)=>{var n,o;switch(t.type){case Qs:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case Js:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case el:{const{documentId:o,tiles:i}=t.payload,r=e.documents[o];if(!r)return e;const a={...r.visibleTiles};for(const e in i){const t=Number(e),o=i[t],r=a[t]??[],s=null==(n=r.find(e=>!e.isFallback))?void 0:n.srcScale,l=o.length>0?o[0].srcScale:s;if(void 0!==s&&s!==l){const e=r.filter(e=>!e.isFallback&&"ready"===e.status).map(e=>({...e,isFallback:!0})),n=e.length>0?[]:r.filter(e=>e.isFallback);a[t]=[...n,...e,...o]}else{const e=new Set(o.map(e=>e.id)),n=[],i=new Set;for(const t of r)(t.isFallback||e.has(t.id))&&(n.push(t),i.add(t.id));for(const e of o)i.has(e.id)||n.push(e);a[t]=n}}return{...e,documents:{...e.documents,[o]:{...r,visibleTiles:a}}}}case tl:{const{documentId:n,pageIndex:i,tileId:r,status:a}=t.payload,s=e.documents[n];if(!s)return e;const l=(null==(o=s.visibleTiles[i])?void 0:o.map(e=>e.id===r?{...e,status:a}:e))??[],c=l.filter(e=>!e.isFallback),d=c.length>0&&c.every(e=>"ready"===e.status),u=d?c:l;return{...e,documents:{...e.documents,[n]:{...s,visibleTiles:{...s.visibleTiles,[i]:u}}}}}default:return e}})(e,t),initialState:{documents:{}}},cl=()=>vo(sl.id);function dl({documentId:e,pageIndex:t,tile:n,dpr:o,scale:i}){const{provides:r}=cl(),a=ze(()=>null==r?void 0:r.forDocument(e),[r,e]),[s,l]=De(),c=Te(null),d=i/n.srcScale;Pe(()=>{if("ready"===n.status&&c.current)return;if(!a)return;const e=a.renderTile({pageIndex:t,tile:n,dpr:o});return e.wait(e=>{const t=URL.createObjectURL(e);c.current=t,l(t)},xn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):e.abort({code:Ut.Cancelled,message:"canceled render task"})}},[a,t,n.id]);return s?We("img",{src:s,onLoad:()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},style:{position:"absolute",left:n.screenRect.origin.x*d,top:n.screenRect.origin.y*d,width:n.screenRect.size.width*d,height:n.screenRect.size.height*d,display:"block"}}):null}function ul({documentId:e,pageIndex:t,scale:n,style:o,...i}){const{provides:r}=cl(),a=yo(e),[s,l]=De([]);Pe(()=>{if(r)return r.onTileRendering(n=>{n.documentId===e&&l(n.tiles[t]??[])})},[r,e,t]);const c=ze(()=>void 0!==n?n:(null==a?void 0:a.scale)??1,[n,null==a?void 0:a.scale]);return We("div",{style:{...o},...i,children:null==s?void 0:s.map(n=>We(dl,{documentId:e,pageIndex:t,tile:n,dpr:window.devicePixelRatio,scale:c},n.id))})}const hl="thumbnail",ml={id:hl,name:"Thumbnail Plugin",version:"1.0.0",provides:["thumbnail"],requires:["render"],optional:["scroll"],defaultConfig:{width:150,gap:10,buffer:3,labelHeight:16,autoScroll:!0,scrollBehavior:"smooth",imagePadding:0,paddingY:0}},gl="THUMBNAIL/INIT_STATE",pl="THUMBNAIL/CLEANUP_STATE",vl="THUMBNAIL/SET_WINDOW_STATE",fl="THUMBNAIL/UPDATE_VIEWPORT_METRICS";function yl(e,t){return{type:gl,payload:{documentId:e,state:t}}}const bl={thumbs:[],window:null,viewportH:0,scrollY:0},wl={documents:{},activeDocumentId:null},xl=class extends Xn{constructor(e,t,n){var o;super(e,t),this.cfg=n,this.scrollCapability=null,this.taskCaches=new Map,this.canAutoScroll=new Map,this.window$=lo((e,t)=>({documentId:e,window:t})),this.scrollTo$=lo((e,t)=>({documentId:e,options:t})),this.refreshPages$=lo((e,t)=>({documentId:e,pages:t}),{cache:!1}),this.renderCapability=this.registry.getPlugin("render").provides(),this.scrollCapability=(null==(o=this.registry.getPlugin("scroll"))?void 0:o.provides())??null,this.coreStore.onAction(Ln,e=>{const t=e.payload.documentId??this.getActiveDocumentId(),n=e.payload.pageIndexes;this.refreshPages$.emit(t,n);const o=this.taskCaches.get(t);if(o)for(const e of n)o.delete(e)}),this.scrollCapability&&!1!==this.cfg.autoScroll&&(this.scrollCapability.onPageChangeState(({documentId:e,state:t})=>{this.canAutoScroll.set(e,!t.isChanging),t.isChanging||this.scrollToThumb(t.targetPage-1,e)}),this.scrollCapability.onPageChange(({documentId:e,pageNumber:t})=>{!1!==this.canAutoScroll.get(e)&&this.scrollToThumb(t-1,e)}))}onDocumentLoadingStarted(e){this.dispatch(yl(e,{...bl})),this.taskCaches.set(e,new Map),this.canAutoScroll.set(e,!0),this.logger.debug("ThumbnailPlugin","DocumentOpened",`Initialized thumbnail state for document: ${e}`)}onDocumentLoaded(e){this.calculateWindowState(e)}onDocumentClosed(e){this.dispatch(function(e){return{type:pl,payload:e}}(e));const t=this.taskCaches.get(e);t&&(t.forEach(e=>{e.abort({code:"cancelled",message:"Document closed"})}),t.clear(),this.taskCaches.delete(e)),this.canAutoScroll.delete(e),this.window$.clearScope(e),this.scrollTo$.clearScope(e),this.refreshPages$.clearScope(e),this.logger.debug("ThumbnailPlugin","DocumentClosed",`Cleaned up thumbnail state for document: ${e}`)}onRotationChanged(e){this.calculateWindowState(e)}buildCapability(){return{scrollToThumb:e=>this.scrollToThumb(e),renderThumb:(e,t)=>this.renderThumb(e,t),updateWindow:(e,t)=>this.updateWindow(e,t),getWindow:()=>this.getWindow(),forDocument:e=>this.createThumbnailScope(e),onWindow:this.window$.onGlobal,onScrollTo:this.scrollTo$.onGlobal,onRefreshPages:this.refreshPages$.onGlobal}}createThumbnailScope(e){return{scrollToThumb:t=>this.scrollToThumb(t,e),renderThumb:(t,n)=>this.renderThumb(t,n,e),updateWindow:(t,n)=>this.updateWindow(t,n,e),getWindow:()=>this.getWindow(e),onWindow:this.window$.forScope(e),onScrollTo:this.scrollTo$.forScope(e),onRefreshPages:this.refreshPages$.forScope(e)}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}calculateWindowState(e){const t=this.coreState.core.documents[e];if(!(null==t?void 0:t.document))return;const n=this.cfg.width??120,o=this.cfg.labelHeight??16,i=this.cfg.gap??8,r=this.cfg.imagePadding??0,a=this.cfg.paddingY??0,s=Math.max(1,n-2*r);let l=a;const c=t.document.pages.map(e=>{const t=e.size.height/e.size.width,n=Math.round(s*t),a=r+n+r+o,c={pageIndex:e.index,width:s,height:n,wrapperHeight:a,top:l,labelHeight:o,padding:r};return l+=a+i,c}),d={start:-1,end:-1,items:[],totalHeight:l-i+a},u=this.getDocumentState(e);u&&(this.dispatch(yl(e,{...u,thumbs:c,window:d})),u.viewportH>0?this.updateWindow(u.scrollY,u.viewportH,e):this.window$.emit(e,d))}updateWindow(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getDocumentState(o);if(!i||!i.window||0===i.thumbs.length)return;const r=this.cfg.buffer??3;this.dispatch(function(e,t,n){return{type:fl,payload:{documentId:e,scrollY:t,viewportH:n}}}(o,e,t));let a=0,s=i.thumbs.length-1,l=0;for(;a<=s;){const t=a+s>>1,n=i.thumbs[t];n.top+n.wrapperHeight<e?a=t+1:(l=t,s=t-1)}let c=l;const d=e+t;for(;c+1<i.thumbs.length&&i.thumbs[c].top<d;)c++;c=Math.min(i.thumbs.length-1,c+r);const u=Math.max(0,l-r);if(u===i.window.start&&c===i.window.end)return;const h={start:u,end:c,items:i.thumbs.slice(u,c+1),totalHeight:i.window.totalHeight};this.dispatch(function(e,t){return{type:vl,payload:{documentId:e,window:t}}}(o,h)),this.window$.emit(o,h)}getWindow(e){const t=this.getDocumentState(e);return(null==t?void 0:t.window)??null}scrollToThumb(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentState(n);if(!o||!o.window)return;const i=o.thumbs[e];if(!i)return;const r=this.cfg.scrollBehavior??"smooth",a=this.cfg.paddingY??0;if(o.viewportH<=0){const e=Math.max(a,i.top-i.wrapperHeight);return void this.scrollTo$.emit(n,{top:e,behavior:r})}const s=i.top,l=i.top+i.wrapperHeight,c=s<o.scrollY+8+a,d=l>o.scrollY+o.viewportH-8;c?this.scrollTo$.emit(n,{top:Math.max(0,s-a),behavior:r}):d&&this.scrollTo$.emit(n,{top:Math.max(0,l-o.viewportH+a),behavior:r})}renderThumb(e,t,n){const o=n??this.getActiveDocumentId(),i=this.taskCaches.get(o);if(!i)throw new Error(`Task cache not found for document: ${o}`);if(i.has(e))return i.get(e);const r=this.coreState.core.documents[o];if(!(null==r?void 0:r.document))throw new Error(`Document not found: ${o}`);const a=r.document.pages[e];if(!a)throw new Error(`Page ${e} not found in document: ${o}`);const s=this.cfg.width??120,l=this.cfg.imagePadding??0,c=Math.max(1,s-2*l)/a.size.width,d=this.renderCapability.forDocument(o).renderPageRect({pageIndex:e,rect:{origin:{x:0,y:0},size:a.size},options:{scaleFactor:c,dpr:t}});return i.set(e,d),d.wait(xn,()=>i.delete(e)),d}async initialize(){this.logger.info("ThumbnailPlugin","Initialize","Thumbnail plugin initialized")}async destroy(){this.window$.clear(),this.refreshPages$.clear(),this.scrollTo$.clear(),this.taskCaches.forEach(e=>{e.forEach(e=>{e.abort({code:"cancelled",message:"Plugin destroyed"})}),e.clear()}),this.taskCaches.clear(),this.canAutoScroll.clear(),super.destroy()}};xl.id="thumbnail";let Cl=xl;const Il={manifest:ml,create:(e,t)=>new Cl(hl,e,t),reducer:(e=wl,t)=>{switch(t.type){case gl:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case pl:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"THUMBNAIL/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case vl:{const{documentId:n,window:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,window:o}}}:e}case fl:{const{documentId:n,scrollY:o,viewportH:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,scrollY:o,viewportH:i}}}:e}default:return e}},initialState:wl},Sl=()=>po(Cl.id);function kl({documentId:e,style:t,children:n,...o}){const{plugin:i}=Sl(),r=Te(null),[a,s]=De({window:null,docId:null}),l=a.docId===e?a.window:null;Pe(()=>{if(!i)return;const t=i.provides().forDocument(e),n=t.getWindow();n&&s({window:n,docId:e});const o=t.onWindow(t=>{s({window:t,docId:e})});return()=>{o(),s({window:null,docId:null})}},[i,e]),Pe(()=>{const t=r.current;if(!t||!i)return;const n=i.provides().forDocument(e),o=()=>n.updateWindow(t.scrollTop,t.clientHeight);return t.addEventListener("scroll",o),()=>t.removeEventListener("scroll",o)},[i,e]),Pe(()=>{const t=r.current;if(!t||!i)return;const n=i.provides().forDocument(e),o=new ResizeObserver(()=>{n.updateWindow(t.scrollTop,t.clientHeight)});return o.observe(t),()=>o.disconnect()},[i,e]),Pe(()=>{const t=r.current;if(!t||!i)return;i.provides().forDocument(e).updateWindow(t.scrollTop,t.clientHeight)},[l,i,e]),Pe(()=>{const t=r.current;if(!t||!i||!l)return;return i.provides().forDocument(e).onScrollTo(({top:e,behavior:n})=>{t.scrollTo({top:e,behavior:n})})},[i,e,!!l]);const c=(null==i?void 0:i.cfg.paddingY)??0;return We("div",{ref:r,style:{overflowY:"auto",position:"relative",paddingTop:c,paddingBottom:c,height:"100%",...t},...o,children:We("div",{style:{height:(null==l?void 0:l.totalHeight)??0,position:"relative"},children:null==l?void 0:l.items.map(e=>n(e))})})}function Dl({documentId:e,meta:t,style:n,...o}){const{provides:i}=vo(Cl.id),{plugin:r}=Sl(),[a,s]=De(),l=Te(null),[c,d]=De(0);Pe(()=>{if(!r)return;return r.provides().forDocument(e).onRefreshPages(e=>{e.includes(t.pageIndex)&&d(e=>e+1)})},[r,e,t.pageIndex]),Pe(()=>{const n=null==i?void 0:i.forDocument(e),o=null==n?void 0:n.renderThumb(t.pageIndex,window.devicePixelRatio);return null==o||o.wait(e=>{const t=URL.createObjectURL(e);l.current=t,s(t)},xn),()=>{l.current?(URL.revokeObjectURL(l.current),l.current=null):null==o||o.abort({code:Ut.Cancelled,message:"canceled render task"})}},[i,e,t.pageIndex,c]);return a?We("img",{src:a,onLoad:()=>{l.current&&(URL.revokeObjectURL(l.current),l.current=null)},style:n,...o}):null}const Ml="annotation",Pl={id:Ml,name:"Annotation Plugin",version:"1.0.0",provides:["annotation"],requires:["interaction-manager","selection"],optional:["history"],defaultConfig:{autoCommit:!0,annotationAuthor:"Guest",deactivateToolAfterCreate:!1,selectAfterCreate:!0}},Al="ANNOTATION/INIT_STATE",Tl="ANNOTATION/CLEANUP_STATE",zl="ANNOTATION/SET_ANNOTATIONS",El="ANNOTATION/SELECT_ANNOTATION",_l="ANNOTATION/DESELECT_ANNOTATION",Rl="ANNOTATION/SET_ACTIVE_TOOL_ID",Nl="ANNOTATION/CREATE_ANNOTATION",Ol="ANNOTATION/PATCH_ANNOTATION",Ll="ANNOTATION/DELETE_ANNOTATION",$l="ANNOTATION/COMMIT",Fl="ANNOTATION/PURGE_ANNOTATION",jl="ANNOTATION/ADD_COLOR_PRESET",Hl="ANNOTATION/SET_TOOL_DEFAULTS",Ul="ANNOTATION/ADD_TOOL";const Wl=e=>({type:_l,payload:{documentId:e}}),Bl=(e,t)=>({type:Rl,payload:{documentId:e,toolId:t}}),ql=(e,t,n)=>({type:Nl,payload:{documentId:e,pageIndex:t,annotation:n}}),Gl=(e,t,n,o)=>({type:Ol,payload:{documentId:e,pageIndex:t,id:n,patch:o}}),Vl=(e,t,n)=>({type:Ll,payload:{documentId:e,pageIndex:t,id:n}}),Zl=(e,t)=>({type:Fl,payload:{documentId:e,uid:t}});function Kl(e){return e.object.type===Mt.INK}function Yl(e){return e.object.type===Mt.CIRCLE}function Xl(e){return e.object.type===Mt.POLYGON}function Ql(e){return e.object.type===Mt.SQUARE}function Jl(e){return e.object.type===Mt.LINE}function ec(e){return e.object.type===Mt.POLYLINE}function tc(e){return e.object.type===Mt.HIGHLIGHT}function nc(e){return e.object.type===Mt.UNDERLINE}function oc(e){return e.object.type===Mt.STRIKEOUT}function ic(e){return e.object.type===Mt.SQUIGGLY}function rc(e){return e.object.type===Mt.FREETEXT}function ac(e){return e.object.type===Mt.STAMP}function sc(e){return e.object.type===Mt.TEXT}function lc(e){return function(e){return tc(e)||nc(e)||oc(e)||ic(e)}(e)||Kl(e)||Ql(e)||Yl(e)||Xl(e)||Jl(e)||ec(e)||rc(e)||ac(e)}const cc=(e,t)=>(e.pages[t]??[]).map(t=>e.byUid[t]),dc=(e,t)=>e.byUid[t]??null,uc=(e,t)=>{if(!e.selectedUid)return null;return(e.pages[t]??[]).includes(e.selectedUid)?e.byUid[e.selectedUid]:null};function hc(e,t){const n=e.tools.find(e=>e.id===t);return null==n?void 0:n.defaults}const mc=[{id:"highlight",name:"Highlight",matchScore:e=>e.type===Mt.HIGHLIGHT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1},defaults:{type:Mt.HIGHLIGHT,color:"#FFCD45",opacity:1,blendMode:St.Multiply}},{id:"underline",name:"Underline",matchScore:e=>e.type===Mt.UNDERLINE?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1},defaults:{type:Mt.UNDERLINE,color:"#E44234",opacity:1}},{id:"strikeout",name:"Strikeout",matchScore:e=>e.type===Mt.STRIKEOUT?1:0,interaction:{exclusive:!1,textSelection:!0},defaults:{type:Mt.STRIKEOUT,color:"#E44234",opacity:1}},{id:"squiggly",name:"Squiggly",matchScore:e=>e.type===Mt.SQUIGGLY?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1},defaults:{type:Mt.SQUIGGLY,color:"#E44234",opacity:1}},{id:"ink",name:"Pen",matchScore:e=>e.type===Mt.INK&&"InkHighlight"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.INK,color:"#E44234",opacity:1,strokeWidth:6}},{id:"inkHighlighter",name:"Ink Highlighter",matchScore:e=>e.type===Mt.INK&&"InkHighlight"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.INK,intent:"InkHighlight",color:"#FFCD45",opacity:1,strokeWidth:14,blendMode:St.Multiply}},{id:"circle",name:"Circle",matchScore:e=>e.type===Mt.CIRCLE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.CIRCLE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:_t.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"square",name:"Square",matchScore:e=>e.type===Mt.SQUARE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.SQUARE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:_t.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"line",name:"Line",matchScore:e=>e.type===Mt.LINE&&"LineArrow"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Mt.LINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"lineArrow",name:"Arrow",matchScore:e=>e.type===Mt.LINE&&"LineArrow"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Mt.LINE,intent:"LineArrow",color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",lineEndings:{start:Tt.None,end:Tt.OpenArrow}},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"polyline",name:"Polyline",matchScore:e=>e.type===Mt.POLYLINE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Mt.POLYLINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"}},{id:"polygon",name:"Polygon",matchScore:e=>e.type===Mt.POLYGON?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1},defaults:{type:Mt.POLYGON,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"}},{id:"freeText",name:"Free Text",matchScore:e=>e.type===Mt.FREETEXT?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:Mt.FREETEXT,contents:"Insert text",fontSize:14,fontColor:"#E44234",fontFamily:xt.Helvetica,textAlign:Ct.Left,verticalAlign:It.Top,backgroundColor:"transparent",opacity:1},clickBehavior:{enabled:!0,defaultSize:{width:100,height:20},defaultContent:"Insert text"}},{id:"stamp",name:"Image",matchScore:e=>e.type===Mt.STAMP?1:0,interaction:{exclusive:!1,cursor:"copy",isDraggable:!0,isResizable:!0,lockAspectRatio:!0},defaults:{type:Mt.STAMP}}],gc=["#E44234","#FF8D00","#FFCD45","#5CC96E","#25D2D1","#597CE2","#C544CE","#7D2E25","#000000","#FFFFFF"],pc=(e,t,n)=>{const o=e.byUid[t];return o?{...e,byUid:{...e.byUid,[t]:{...o,commitState:"synced"===o.commitState?"dirty":o.commitState,object:{...o.object,...n}}},hasPendingChanges:!0}:e};function vc(e){let t=e;return[()=>t,e=>{t=e}]}const fc={annotationType:Mt.INK,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=vc([]),[s,l]=vc(!1),c={current:null},d=e=>({x:to(e.x,0,i.width),y:to(e.y,0,i.height)}),u=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},h=()=>{const e=r();if(0===e.length||0===e[0].points.length)return null;const t=u();if(!t)return null;const n=e.flatMap(e=>e.points),o=tt(et(n),t.strokeWidth/2);return{type:Mt.INK,bounds:o,data:{...t,rect:o,inkList:e}}};return{onPointerDown:(e,t)=>{var o;const i=d(e);l(!0),c.current&&clearTimeout(c.current);const s=[...r(),{points:[i]}];a(s),n(h()),null==(o=t.setPointerCapture)||o.call(t)},onPointerMove:e=>{if(!s())return;const t=r();if(0===t.length)return;const o=d(e);t[t.length-1].points.push(o),a(t),n(h())},onPointerUp:(o,i)=>{var s;l(!1),null==(s=i.releasePointerCapture)||s.call(i),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{const o=r();if(o.length>0&&o[0].points.length>1){const n=u();if(!n)return;const i=o.flatMap(e=>e.points),r=tt(et(i),n.strokeWidth/2);t({...n,inkList:o,rect:r,type:Mt.INK,pageIndex:e.pageIndex,id:bn(),created:new Date})}a([]),n(null)},800)},onPointerCancel:(e,t)=>{var o;a([]),l(!1),n(null),c.current&&clearTimeout(c.current),null==(o=t.releasePointerCapture)||o.call(t)}}}};function yc({threshold:e=5,getTool:t,onClickDetected:n}){const[o,i]=vc(null),[r,a]=vc(!1);return{onStart:e=>{i(e),a(!1)},onMove:t=>{const n=o();if(!n||r())return;Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))>e&&a(!0)},onEnd:e=>{var s;if(o()&&!r()){const o=t();o&&"clickBehavior"in o&&(null==(s=o.clickBehavior)?void 0:s.enabled)&&n(e,o)}i(null),a(!1)},hasMoved:r,reset:()=>{i(null),a(!1)}}}const bc={annotationType:Mt.FREETEXT,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i,pageIndex:r}=e,[a,s]=vc(null),l=e=>({x:to(e.x,0,i.width),y:to(e.y,0,i.height)}),c=()=>{const e=o();return e?{...e.defaults,fontColor:e.defaults.fontColor??"#000000",opacity:e.defaults.opacity??1,fontSize:e.defaults.fontSize??12,fontFamily:e.defaults.fontFamily??xt.Helvetica,backgroundColor:e.defaults.backgroundColor??"transparent",textAlign:e.defaults.textAlign??Ct.Left,verticalAlign:e.defaults.verticalAlign??It.Top,contents:e.defaults.contents??"Insert text here",flags:e.defaults.flags??["print"]}:null},d=yc({threshold:5,getTool:o,onClickDetected:(e,n)=>{const o=c();if(!o)return;const a=n.clickBehavior;if(!(null==a?void 0:a.enabled))return;const{width:s,height:l}=a.defaultSize,d=s/2,u=l/2,h={origin:{x:to(e.x-d,0,i.width-s),y:to(e.y-u,0,i.height-l)},size:{width:s,height:l}},m=a.defaultContent??o.contents,g={...o,contents:m,type:Mt.FREETEXT,rect:h,pageIndex:r,id:bn(),created:new Date};t(g)}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o={origin:{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)},size:{width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}};return{type:Mt.FREETEXT,bounds:o,data:{...n,rect:o}}};return{onPointerDown:(e,t)=>{var o;const i=l(e);s(i),d.onStart(i),n(u(i)),null==(o=t.setPointerCapture)||o.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&n(u(t))},onPointerUp:(o,i)=>{var r;const u=a();if(!u)return;const h=c();if(!h)return;const m=l(o);if(d.hasMoved()){const n={origin:{x:Math.min(u.x,m.x),y:Math.min(u.y,m.y)},size:{width:Math.abs(u.x-m.x),height:Math.abs(u.y-m.y)}},o={...h,type:Mt.FREETEXT,rect:n,pageIndex:e.pageIndex,id:bn(),created:new Date};t(o)}else d.onEnd(m);s(null),n(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var o;s(null),n(null),d.reset(),null==(o=t.releasePointerCapture)||o.call(t)},onPointerCancel:(e,t)=>{var o;s(null),n(null),d.reset(),null==(o=t.releasePointerCapture)||o.call(t)}}}};function wc(e){const t=e=>{const t=9*e,n=Math.PI/6;return{x:-t*Math.cos(n),y:t*Math.sin(n)}};return{getSvgPath:n=>{const{x:o,y:i}=t(n);return e?`M 0 0 L ${o} ${i} L ${o} ${-i} Z`:`M ${o} ${i} L 0 0 L ${o} ${-i}`},getLocalPoints:e=>{const{x:n,y:o}=t(e);return[{x:0,y:0},{x:n,y:o},{x:n,y:-o}]},getRotation:e=>e,filled:e}}function xc(e,t){const n=t=>t*e/2;return{getSvgPath:e=>{const t=n(e);return`M ${-t} 0 L ${t} 0`},getLocalPoints:e=>{const t=n(e);return[{x:-t,y:0},{x:t,y:0}]},getRotation:t,filled:!1}}const Cc=wc(!1),Ic=wc(!0),Sc={[Tt.OpenArrow]:Cc,[Tt.ClosedArrow]:Ic,[Tt.ROpenArrow]:{...Cc,getRotation:e=>e+Math.PI},[Tt.RClosedArrow]:{...Ic,getRotation:e=>e+Math.PI},[Tt.Circle]:{getSvgPath:e=>{const t=5*e/2;return`M ${t} 0 A ${t} ${t} 0 1 1 ${-t} 0 A ${t} ${t} 0 1 1 ${t} 0`},getLocalPoints:e=>{const t=5*e/2;return[{x:-t,y:-t},{x:t,y:t}]},getRotation:()=>0,filled:!0},[Tt.Square]:{getSvgPath:e=>{const t=6*e/2;return`M ${-t} ${-t} L ${t} ${-t} L ${t} ${t} L ${-t} ${t} Z`},getLocalPoints:e=>{const t=6*e/2;return[{x:-t,y:-t},{x:t,y:-t},{x:t,y:t},{x:-t,y:t}]},getRotation:e=>e,filled:!0},[Tt.Diamond]:{getSvgPath:e=>{const t=6*e/2;return`M 0 ${-t} L ${t} 0 L 0 ${t} L ${-t} 0 Z`},getLocalPoints:e=>{const t=6*e/2;return[{x:0,y:-t},{x:t,y:0},{x:0,y:t},{x:-t,y:0}]},getRotation:e=>e,filled:!0},[Tt.Butt]:xc(6,e=>e+Math.PI/2),[Tt.Slash]:xc(18,e=>e+Math.PI/1.5)};function kc(e,t,n){if(!e||0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};const o=[...e],i=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),r=(e,n,i)=>{if(!e)return;const r=Sc[e];if(!r)return;const a=r.getLocalPoints(t),s=r.getRotation(i),l=a.map(e=>function(e,t,n){const o=Math.cos(t),i=Math.sin(t),r=e.x*o-e.y*i,a=e.x*i+e.y*o;return{x:r+n.x,y:a+n.y}}(e,s,n));o.push(...l)};if(e.length>=2){const t=i(e[1],e[0]);r(null==n?void 0:n.start,e[0],t);const o=e.length-1,a=i(e[o-1],e[o]);r(null==n?void 0:n.end,e[o],a)}if(o.length<=1){const n=e[0]||{x:0,y:0},o=t;return{origin:{x:n.x-o,y:n.y-o},size:{width:2*o,height:2*o}}}return tt(et(o),t/2+1.2*t)}class Dc{constructor(){this.patches=new Map}register(e,t){this.patches.set(e,t)}transform(e,t){const n=this.patches.get(e.type);return n?n(e,t):t.changes}}const Mc=new Dc,Pc=Object.freeze(Object.defineProperty({__proto__:null,LINE_ENDING_HANDLERS:Sc,PatchRegistry:Dc,createEnding:function(e,t,n,o,i){if(!e)return null;const r=Sc[e];if(!r)return null;const a=r.getRotation(n);return{d:r.getSvgPath(t),transform:`translate(${o} ${i}) rotate(${(e=>180*e/Math.PI)(a)})`,filled:r.filled}},lineRectWithEndings:kc,patchRegistry:Mc},Symbol.toStringTag,{value:"Module"})),Ac={annotationType:Mt.LINE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=vc(null),l=e=>({x:to(e.x,0,r.width),y:to(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:Tt.None,end:Tt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeStyle:e.defaults.strokeStyle??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],strokeColor:e.defaults.strokeColor??"#000000",flags:e.defaults.flags??["print"]}:null},d=yc({threshold:5,getTool:i,onClickDetected:(e,o)=>{const i=c();if(!i)return;const r=o.clickBehavior;if(!(null==r?void 0:r.enabled))return;const a=r.defaultAngle??0,s=r.defaultLength/2,d=e.x-s*Math.cos(a),u=e.y-s*Math.sin(a),h=e.x+s*Math.cos(a),m=e.y+s*Math.sin(a),g=l({x:d,y:u}),p=l({x:h,y:m}),v=kc([g,p],i.strokeWidth,i.lineEndings);n({...i,rect:v,linePoints:{start:g,end:p},pageIndex:t,id:bn(),created:new Date,type:Mt.LINE})}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=kc([t,e],n.strokeWidth,n.lineEndings);return{type:Mt.LINE,bounds:o,data:{...n,rect:o,linePoints:{start:t,end:e}}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;const u=a();if(!u)return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;if(Math.abs(h.x-u.x)>2||Math.abs(h.y-u.y)>2){const o=kc([u,h],e.strokeWidth,e.lineEndings);n({...e,rect:o,linePoints:{start:u,end:h},pageIndex:t,id:bn(),flags:["print"],created:new Date,type:Mt.LINE})}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Tc={annotationType:Mt.POLYLINE,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=vc([]),[s,l]=vc(null),c=e=>({x:to(e.x,0,i.width),y:to(e.y,0,i.height)}),d=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:Tt.None,end:Tt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],flags:e.defaults.flags??["print"]}:null},u=()=>{const e=r(),t=s();if(0===e.length||!t)return null;const n=d();if(!n)return null;const o=[...e,t],i=kc(o,n.strokeWidth,n.lineEndings);return{type:Mt.POLYLINE,bounds:i,data:{...n,rect:i,vertices:o,currentVertex:t}}};return{onClick:e=>{const t=c(e),o=r(),i=o[o.length-1];i&&Math.abs(i.x-t.x)<1&&Math.abs(i.y-t.y)<1||(a([...o,t]),l(t),n(u()))},onDoubleClick:()=>{(()=>{const o=r();if(o.length<2)return;const i=d();if(!i)return;const s=kc(o,i.strokeWidth,i.lineEndings),c={...i,vertices:o,rect:s,type:Mt.POLYLINE,pageIndex:e.pageIndex,id:bn(),created:new Date};t(c),a([]),l(null),n(null)})()},onPointerMove:e=>{if(r().length>0){const t=c(e);l(t),n(u())}},onPointerCancel:()=>{a([]),l(null),n(null)}}}},zc={annotationType:Mt.POLYGON,create(e){const{onCommit:t,onPreview:n,getTool:o,scale:i,pageSize:r}=e,[a,s]=vc([]),[l,c]=vc(null),d=e=>({x:to(e.x,0,r.width),y:to(e.y,0,r.height)}),u=()=>{const e=o();return e?{...e.defaults,color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeWidth:e.defaults.strokeWidth??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],flags:e.defaults.flags??["print"]}:null},h=()=>{const o=a();if(o.length<3)return;const i=u();if(!i)return;const r=tt(et(o),i.strokeWidth/2),l={...i,vertices:o,rect:r,type:Mt.POLYGON,pageIndex:e.pageIndex,id:bn(),created:new Date};t(l),s([]),c(null),n(null)},m=()=>{const e=a(),t=l();if(0===e.length||!t)return null;const n=u();if(!n)return null;const o=tt(et([...e,t]),n.strokeWidth/2);return{type:Mt.POLYGON,bounds:o,data:{...n,rect:o,vertices:e,currentVertex:t}}};return{onClick:e=>{const t=d(e);if((e=>{const t=a();if(t.length<2)return!1;const n=14/i/2,o=t[0];return e.x>=o.x-n&&e.x<=o.x+n&&e.y>=o.y-n&&e.y<=o.y+n})(t)&&a().length>=3)return void h();const o=a(),r=o[o.length-1];r&&Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(s([...o,t]),c(t),n(m()))},onDoubleClick:e=>{h()},onPointerMove:e=>{if(a().length>0){const t=d(e);c(t),n(m())}},onPointerCancel:e=>{s([]),c(null),n(null)}}}},Ec={annotationType:Mt.SQUARE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=vc(null),l=e=>({x:to(e.x,0,r.width),y:to(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,flags:e.defaults.flags??["print"],strokeWidth:e.defaults.strokeWidth??2,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1}:null},d=yc({threshold:5,getTool:i,onClickDetected:(e,o)=>{const i=c();if(!i)return;const a=o.clickBehavior;if(!(null==a?void 0:a.enabled))return;const{width:s,height:l}=a.defaultSize,d=s/2,u=l/2,h=to(e.x-d,0,r.width-s),m=to(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,v={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},f={...i,type:Mt.SQUARE,created:new Date,id:bn(),pageIndex:t,rect:v};n(f)}}),u=e=>{const t=a();if(!t)return null;const n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),s=c();if(!s)return null;const l=s.strokeWidth,d=l/2,u={origin:{x:n-d,y:o-d},size:{width:i+l,height:r+l}};return{type:Mt.SQUARE,bounds:u,data:{rect:u,...s}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;if(!a())return;if(!c())return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;const o=u(h);if(o){const i={...e,type:Mt.SQUARE,created:new Date,id:bn(),pageIndex:t,rect:o.data.rect};n(i)}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},_c={annotationType:Mt.STAMP,create(e){const{services:t,onCommit:n,getTool:o,pageSize:i}=e;return{onPointerDown:r=>{const a=o();if(!a)return;const{imageSrc:s,imageSize:l}=a.defaults,c=(t,o,s)=>{const l=r.x-o/2,c=r.y-s/2,d={origin:{x:to(l,0,i.width-o),y:to(c,0,i.height-s)},size:{width:o,height:s}},u={...a.defaults,rect:d,type:Mt.STAMP,icon:a.defaults.icon??At.Draft,subject:a.defaults.subject??"Stamp",flags:a.defaults.flags??["print"],pageIndex:e.pageIndex,id:bn(),created:new Date};n(u,{imageData:t})};s?t.processImage({source:s,maxWidth:i.width,maxHeight:i.height,onComplete:e=>c(e.imageData,(null==l?void 0:l.width)??e.width,(null==l?void 0:l.height)??e.height)}):t.requestFile({accept:"image/png,image/jpeg",onFile:e=>{t.processImage({source:e,maxWidth:i.width,maxHeight:i.height,onComplete:e=>c(e.imageData,e.width,e.height)})}})}}}},Rc={annotationType:Mt.CIRCLE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=vc(null),l=e=>({x:to(e.x,0,r.width),y:to(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??2,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??_t.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},d=yc({threshold:5,getTool:i,onClickDetected:(e,o)=>{const i=c();if(!i)return;const a=o.clickBehavior;if(!(null==a?void 0:a.enabled))return;const{width:s,height:l}=a.defaultSize,d=s/2,u=l/2,h=to(e.x-d,0,r.width-s),m=to(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,v={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},f={...i,type:Mt.CIRCLE,created:new Date,id:bn(),pageIndex:t,rect:v};n(f)}}),u=e=>{const t=a();if(!t)return null;const n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),s=c();if(!s)return null;const l=s.strokeWidth,d=l/2,u={origin:{x:n-d,y:o-d},size:{width:i+l,height:r+l}};return{type:Mt.CIRCLE,bounds:u,data:{rect:u,...s}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;if(!a())return;if(!c())return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;const o=u(h);if(o){const i={...e,type:Mt.CIRCLE,flags:["print"],created:new Date,id:bn(),pageIndex:t,rect:o.data.rect};n(i)}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Nc=(e,t)=>{var n;switch(t.type){case"vertex-edit":default:return t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y,i=e.inkList.map(e=>({points:e.points.map(e=>({x:e.x+n,y:e.y+o}))}));return{rect:t.changes.rect,inkList:i}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l=(e,t)=>({origin:{x:e.origin.x+t,y:e.origin.y+t},size:{width:Math.max(1,e.size.width-2*t),height:Math.max(1,e.size.height-2*t)}}),c=Math.min(t.changes.rect.size.width/o.size.width,t.changes.rect.size.height/o.size.height),d=Math.max(1,Math.round(e.strokeWidth*c)),u=l(o,e.strokeWidth/2),h=l(t.changes.rect,d/2),m=h.size.width/Math.max(u.size.width,1e-6),g=h.size.height/Math.max(u.size.height,1e-6),p=e.inkList.map(e=>({points:e.points.map(e=>({x:h.origin.x+(e.x-u.origin.x)*m,y:h.origin.y+(e.y-u.origin.y)*g}))}));return{rect:t.changes.rect,inkList:p,strokeWidth:d}}return t.changes;case"property-update":if(void 0!==t.changes.strokeWidth){const n={...e,...t.changes},o=n.inkList.flatMap(e=>e.points),i=tt(et(o),n.strokeWidth/2);return{...t.changes,rect:i}}return t.changes}},Oc=(e,t)=>{var n;switch(t.type){case"vertex-edit":if(t.changes.linePoints){const{start:n,end:o}=t.changes.linePoints;return{rect:kc([n,o],e.strokeWidth,e.lineEndings),linePoints:{start:n,end:o}}}return t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y;return{rect:t.changes.rect,linePoints:{start:{x:e.linePoints.start.x+n,y:e.linePoints.start.y+o},end:{x:e.linePoints.end.x+n,y:e.linePoints.end.y+o}}}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l={start:{x:t.changes.rect.origin.x+(e.linePoints.start.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.linePoints.start.y-o.origin.y)*a},end:{x:t.changes.rect.origin.x+(e.linePoints.end.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.linePoints.end.y-o.origin.y)*a}};return{rect:t.changes.rect,linePoints:l}}return t.changes;case"property-update":if(t.changes.strokeWidth||t.changes.lineEndings){const n={...e,...t.changes},o=kc([n.linePoints.start,n.linePoints.end],n.strokeWidth,n.lineEndings);return{...t.changes,rect:o}}return t.changes;default:return t.changes}},Lc=(e,t)=>{var n;switch(t.type){case"vertex-edit":return t.changes.vertices&&t.changes.vertices.length?{rect:kc(t.changes.vertices,e.strokeWidth,e.lineEndings),vertices:t.changes.vertices}:t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y,i=e.vertices.map(e=>({x:e.x+n,y:e.y+o}));return{rect:t.changes.rect,vertices:i}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l=e.vertices.map(e=>({x:t.changes.rect.origin.x+(e.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.y-o.origin.y)*a}));return{rect:t.changes.rect,vertices:l}}return t.changes;case"property-update":if(void 0!==t.changes.strokeWidth||void 0!==t.changes.lineEndings){const n={...e,...t.changes},o=kc(n.vertices,n.strokeWidth,n.lineEndings);return{...t.changes,rect:o}}return t.changes;default:return t.changes}},$c=(e,t)=>{var n;switch(t.type){case"vertex-edit":if(t.changes.vertices&&t.changes.vertices.length){const n=e.strokeWidth/2;return{rect:tt(et(t.changes.vertices),n),vertices:t.changes.vertices}}return t.changes;case"move":if(t.changes.rect){const n=t.changes.rect.origin.x-e.rect.origin.x,o=t.changes.rect.origin.y-e.rect.origin.y,i=e.vertices.map(e=>({x:e.x+n,y:e.y+o}));return{rect:t.changes.rect,vertices:i}}return t.changes;case"resize":if(t.changes.rect){const o=e.rect,i=t.changes.rect;let r=i.size.width/o.size.width,a=i.size.height/o.size.height;const s=10;if((i.size.width<s||i.size.height<s)&&(r=Math.max(r,s/o.size.width),a=Math.max(a,s/o.size.height),t.changes.rect={origin:i.origin,size:{width:o.size.width*r,height:o.size.height*a}}),null==(n=t.metadata)?void 0:n.maintainAspectRatio){const e=Math.min(r,a);r=e,a=e,t.changes.rect.size={width:o.size.width*e,height:o.size.height*e}}const l=e.vertices.map(e=>({x:t.changes.rect.origin.x+(e.x-o.origin.x)*r,y:t.changes.rect.origin.y+(e.y-o.origin.y)*a}));return{rect:t.changes.rect,vertices:l}}return t.changes;case"property-update":if(void 0!==t.changes.strokeWidth){const n={...e,...t.changes},o=n.strokeWidth/2,i=tt(et(n.vertices),o);return{...t.changes,rect:i}}return t.changes;default:return t.changes}},Fc=class extends Xn{constructor(e,t,n){var o,i,r;super(e,t),this.ANNOTATION_HISTORY_TOPIC="annotations",this.state$=so(),this.pendingContexts=new Map,this.isInitialLoadComplete=new Map,this.importQueue=new Map,this.handlerFactories=new Map,this.activeTool$=so(),this.events$=so(),this.toolsChange$=so(),this.patchRegistry=new Dc,this.config=n,this.selection=(null==(o=t.getPlugin("selection"))?void 0:o.provides())??null,this.history=(null==(i=t.getPlugin("history"))?void 0:i.provides())??null,this.interactionManager=(null==(r=t.getPlugin("interaction-manager"))?void 0:r.provides())??null,this.registerHandlerFactories(),this.registerBuiltInPatches()}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Al,payload:{documentId:e,state:t}}}(e,{pages:{},byUid:{},selectedUid:null,activeToolId:null,hasPendingChanges:!1})),this.pendingContexts.set(e,new Map),this.isInitialLoadComplete.set(e,!1),this.importQueue.set(e,[]),this.logger.debug("AnnotationPlugin","DocumentOpened",`Initialized annotation state for document: ${e}`)}onDocumentLoaded(e){const t=this.getCoreDocument(e);if((null==t?void 0:t.document)&&this.getAllAnnotations(e,t.document),this.selection)for(const e of this.state.tools)e.interaction.textSelection&&this.selection.enableForMode(e.interaction.mode??e.id)}onDocumentClosed(e){this.dispatch(function(e){return{type:Tl,payload:e}}(e)),this.pendingContexts.delete(e),this.isInitialLoadComplete.delete(e),this.importQueue.delete(e),this.logger.debug("AnnotationPlugin","DocumentClosed",`Cleaned up annotation state for document: ${e}`)}registerHandlerFactories(){this.handlerFactories.set(Mt.CIRCLE,Rc),this.handlerFactories.set(Mt.SQUARE,Ec),this.handlerFactories.set(Mt.STAMP,_c),this.handlerFactories.set(Mt.POLYGON,zc),this.handlerFactories.set(Mt.POLYLINE,Tc),this.handlerFactories.set(Mt.LINE,Ac),this.handlerFactories.set(Mt.INK,fc),this.handlerFactories.set(Mt.FREETEXT,bc)}registerBuiltInPatches(){this.patchRegistry.register(Mt.INK,Nc),this.patchRegistry.register(Mt.LINE,Oc),this.patchRegistry.register(Mt.POLYLINE,Lc),this.patchRegistry.register(Mt.POLYGON,$c)}async initialize(){var e,t;this.state.tools.forEach(e=>this.registerInteractionForTool(e)),this.history&&this.history.onHistoryChange(e=>{e.topic===this.ANNOTATION_HISTORY_TOPIC&&!1!==this.config.autoCommit&&this.commit(e.documentId)}),null==(e=this.interactionManager)||e.onModeChange(e=>{var t,n;const o=(null==(t=this.state.tools.find(t=>(t.interaction.mode??t.id)===e.activeMode))?void 0:t.id)??null;o!==((null==(n=this.state.documents[e.documentId])?void 0:n.activeToolId)??null)&&e.documentId&&this.dispatch(Bl(e.documentId,o))}),null==(t=this.selection)||t.onEndSelection(({documentId:e})=>{var t,n,o;const i=this.getActiveTool(e);if(!i||!i.interaction.textSelection)return;const r=null==(t=this.selection)?void 0:t.getFormattedSelection(),a=null==(n=this.selection)?void 0:n.getSelectedText();if(r&&a){for(const t of r)a.wait(n=>{const o=bn();this.createAnnotation(t.pageIndex,{...i.defaults,rect:t.rect,segmentRects:t.segmentRects,pageIndex:t.pageIndex,created:new Date,id:o,custom:{text:n.join("\n")}},void 0,e),this.getToolBehavior(i,"deactivateToolAfterCreate")&&this.setActiveTool(null,e),this.getToolBehavior(i,"selectAfterCreate")&&this.selectAnnotation(t.pageIndex,o,e)},xn);null==(o=this.selection)||o.clear()}})}registerInteractionForTool(e){var t;null==(t=this.interactionManager)||t.registerMode({id:e.interaction.mode??e.id,scope:"page",exclusive:e.interaction.exclusive,cursor:e.interaction.cursor})}buildCapability(){return{getActiveTool:()=>this.getActiveTool(),setActiveTool:e=>this.setActiveTool(e),getState:()=>this.getDocumentState(),getPageAnnotations:e=>this.getPageAnnotations(e),getSelectedAnnotation:()=>this.getSelectedAnnotation(),getAnnotationById:e=>this.getAnnotationById(e),selectAnnotation:(e,t)=>this.selectAnnotation(e,t),deselectAnnotation:()=>this.deselectAnnotation(),importAnnotations:e=>this.importAnnotations(e),createAnnotation:(e,t,n)=>this.createAnnotation(e,t,n),updateAnnotation:(e,t,n)=>this.updateAnnotation(e,t,n),deleteAnnotation:(e,t)=>this.deleteAnnotation(e,t),renderAnnotation:e=>this.renderAnnotation(e),commit:()=>this.commit(),forDocument:e=>this.createAnnotationScope(e),getTools:()=>this.state.tools,getTool:e=>this.getTool(e),addTool:e=>{this.dispatch((e=>({type:Ul,payload:e}))(e)),this.registerInteractionForTool(e)},findToolForAnnotation:e=>this.findToolForAnnotation(e),setToolDefaults:(e,t)=>this.dispatch(((e,t)=>({type:Hl,payload:{toolId:e,patch:t}}))(e,t)),getColorPresets:()=>[...this.state.colorPresets],addColorPreset:e=>this.dispatch((e=>({type:jl,payload:e}))(e)),transformAnnotation:(e,t)=>this.transformAnnotation(e,t),registerPatchFunction:(e,t)=>this.registerPatchFunction(e,t),onStateChange:this.state$.on,onActiveToolChange:this.activeTool$.on,onAnnotationEvent:this.events$.on,onToolsChange:this.toolsChange$.on}}createAnnotationScope(e){return{getState:()=>this.getDocumentState(e),getPageAnnotations:t=>this.getPageAnnotations(t,e),getSelectedAnnotation:()=>this.getSelectedAnnotation(e),getAnnotationById:t=>this.getAnnotationById(t,e),selectAnnotation:(t,n)=>this.selectAnnotation(t,n,e),deselectAnnotation:()=>this.deselectAnnotation(e),getActiveTool:()=>this.getActiveTool(e),setActiveTool:t=>this.setActiveTool(t,e),findToolForAnnotation:e=>this.findToolForAnnotation(e),importAnnotations:t=>this.importAnnotations(t,e),createAnnotation:(t,n,o)=>this.createAnnotation(t,n,o,e),updateAnnotation:(t,n,o)=>this.updateAnnotation(t,n,o,e),deleteAnnotation:(t,n)=>this.deleteAnnotation(t,n,e),renderAnnotation:t=>this.renderAnnotation(t,e),commit:()=>this.commit(e),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)}),onAnnotationEvent:t=>this.events$.on(n=>{n.documentId===e&&t(n)}),onActiveToolChange:t=>this.activeTool$.on(n=>{n.documentId===e&&t(n.tool)})}}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.state$.emit({documentId:n,state:i}),o&&o.activeToolId!==i.activeToolId&&this.activeTool$.emit({documentId:n,tool:this.getActiveTool(n)}))}if(e.tools!==t.tools){for(const e in t.documents)this.activeTool$.emit({documentId:e,tool:this.getActiveTool(e)});this.toolsChange$.emit({tools:t.tools})}}registerPatchFunction(e,t){this.patchRegistry.register(e,t)}transformAnnotation(e,t){const n={type:t.type,changes:t.changes,metadata:t.metadata};return this.patchRegistry.transform(e,n)}registerPageHandlers(e,t,n,o){var i;const r=this.getCoreDocument(e),a=null==(i=null==r?void 0:r.document)?void 0:i.pages[t];if(!a)return()=>{};if(!this.interactionManager)return()=>{};const s=[];for(const i of this.state.tools){if(!i.defaults.type)continue;const r=this.handlerFactories.get(i.defaults.type);if(!r)continue;const l={pageIndex:t,pageSize:a.size,scale:n,services:o.services,onPreview:e=>o.onPreview(i.id,e),onCommit:(n,o)=>{this.createAnnotation(t,n,o,e),this.getToolBehavior(i,"deactivateToolAfterCreate")&&this.setActiveTool(null,e),this.getToolBehavior(i,"selectAfterCreate")&&this.selectAnnotation(t,n.id,e)},getTool:()=>this.state.tools.find(e=>e.id===i.id)},c=this.interactionManager.registerHandlers({documentId:e,modeId:i.interaction.mode??i.id,handlers:r.create(l),pageIndex:t});s.push(c)}return()=>s.forEach(e=>e())}getDocumentState(e){const t=e??this.getActiveDocumentId(),n=this.state.documents[t];if(!n)throw new Error(`Annotation state not found for document: ${t}`);return n}getAllAnnotations(e,t){this.engine.getAllAnnotations(t).wait(t=>{this.dispatch(((e,t)=>({type:zl,payload:{documentId:e,annotations:t}}))(e,t)),this.isInitialLoadComplete.set(e,!0);const n=this.importQueue.get(e);n&&n.length>0&&this.processImportQueue(e),this.events$.emit({type:"loaded",documentId:e,total:Object.values(t).reduce((e,t)=>e+t.length,0)})},xn)}getPageAnnotations(e,t){const{pageIndex:n}=e,o=t??this.getActiveDocumentId(),i=this.getCoreDocument(o),r=null==i?void 0:i.document;if(!r)return Wt.reject({code:Ut.NotFound,message:"Document not found"});const a=r.pages.find(e=>e.index===n);return a?this.engine.getPageAnnotations(r,a):Wt.reject({code:Ut.NotFound,message:"Page not found"})}getSelectedAnnotation(e){return(e=>e.selectedUid?e.byUid[e.selectedUid]:null)(this.getDocumentState(e))}getAnnotationById(e,t){const n=this.getDocumentState(t);return dc(n,e)}renderAnnotation({pageIndex:e,annotation:t,options:n},o){const i=o??this.getActiveDocumentId(),r=this.getCoreDocument(i),a=null==r?void 0:r.document;if(!a)return Wt.reject({code:Ut.NotFound,message:"Document not found"});const s=a.pages.find(t=>t.index===e);return s?this.engine.renderPageAnnotation(a,s,t,n):Wt.reject({code:Ut.NotFound,message:"Page not found"})}importAnnotations(e,t){const n=t??this.getActiveDocumentId();if(!this.isInitialLoadComplete.get(n)){const t=this.importQueue.get(n)||[];return t.push(...e),void this.importQueue.set(n,t)}this.processImportItems(n,e)}processImportQueue(e){const t=this.importQueue.get(e);if(!t||0===t.length)return;const n=[...t];this.importQueue.set(e,[]),this.processImportItems(e,n)}processImportItems(e,t){const n=this.pendingContexts.get(e);if(n){for(const o of t){const{annotation:t,ctx:i}=o,r=t.pageIndex,a=t.id;this.dispatch(ql(e,r,t)),i&&n.set(a,i)}!1!==this.config.autoCommit&&this.commit(e)}}createAnnotation(e,t,n,o){const i=t.id,r=o??this.getActiveDocumentId(),a=this.pendingContexts.get(r);if(!a)return;const s={...t,author:t.author??this.config.annotationAuthor},l=()=>{this.dispatch(ql(r,e,s)),n&&a.set(i,n),this.events$.emit({type:"create",documentId:r,annotation:s,pageIndex:e,ctx:n,committed:!1})};if(!this.history)return l(),void(this.config.autoCommit&&this.commit(r));const c={execute:l,undo:()=>{a.delete(i),this.dispatch(Wl(r)),this.dispatch(Vl(r,e,i)),this.events$.emit({type:"delete",documentId:r,annotation:s,pageIndex:e,committed:!1})}};this.history.forDocument(r).register(c,this.ANNOTATION_HISTORY_TOPIC)}buildPatch(e,t){return"rect"in t?t:this.transformAnnotation(e,{type:"property-update",changes:t})}updateAnnotation(e,t,n,o){const i=o??this.getActiveDocumentId(),r=this.getDocumentState(i).byUid[t].object,a=this.buildPatch(r,{...n,author:n.author??this.config.annotationAuthor}),s=()=>{this.dispatch(Gl(i,e,t,a)),this.events$.emit({type:"update",documentId:i,annotation:r,pageIndex:e,patch:a,committed:!1})};if(!this.history)return s(),void(!1!==this.config.autoCommit&&this.commit(i));const l=Object.fromEntries(Object.keys(n).map(e=>[e,r[e]])),c={execute:s,undo:()=>{this.dispatch(Gl(i,e,t,l)),this.events$.emit({type:"update",documentId:i,annotation:r,pageIndex:e,patch:l,committed:!1})}};this.history.forDocument(i).register(c,this.ANNOTATION_HISTORY_TOPIC)}deleteAnnotation(e,t,n){var o;const i=n??this.getActiveDocumentId(),r=null==(o=this.getDocumentState(i).byUid[t])?void 0:o.object;if(!r)return;const a=()=>{this.dispatch(Wl(i)),this.dispatch(Vl(i,e,t)),this.events$.emit({type:"delete",documentId:i,annotation:r,pageIndex:e,committed:!1})};if(!this.history)return a(),void(!1!==this.config.autoCommit&&this.commit(i));const s={execute:a,undo:()=>{this.dispatch(ql(i,e,r)),this.events$.emit({type:"create",documentId:i,annotation:r,pageIndex:e,committed:!1})}};this.history.forDocument(i).register(s,this.ANNOTATION_HISTORY_TOPIC)}selectAnnotation(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:El,payload:{documentId:e,pageIndex:t,id:n}}))(o,e,t))}deselectAnnotation(e){const t=e??this.getActiveDocumentId();this.dispatch(Wl(t))}getActiveTool(e){const t=this.getDocumentState(e);return t.activeToolId?this.state.tools.find(e=>e.id===t.activeToolId)??null:null}setActiveTool(e,t){var n,o;const i=t??this.getActiveDocumentId(),r=this.getDocumentState(i);if(e===r.activeToolId)return;this.dispatch(Bl(i,e));const a=this.state.tools.find(t=>t.id===e);a?null==(n=this.interactionManager)||n.forDocument(i).activate(a.interaction.mode??a.id):null==(o=this.interactionManager)||o.forDocument(i).activateDefaultMode()}getTool(e){return this.state.tools.find(t=>t.id===e)}findToolForAnnotation(e){let t=null,n=0;for(const o of this.state.tools){const i=o.matchScore(e);i>n&&(n=i,t=o)}return t}commit(e){const t=new pt,n=e??this.getActiveDocumentId(),o=this.getDocumentState(n);if(!o.hasPendingChanges)return Wt.resolve(!0);const i=this.getCoreDocument(n),r=null==i?void 0:i.document;if(!r)return Wt.reject({code:Ut.NotFound,message:"Document not found"});const a=this.pendingContexts.get(n);if(!a)return Wt.resolve(!0);const s=[],l=[],c=[];for(const[e,t]of Object.entries(o.byUid)){if("synced"===t.commitState)continue;const o=r.pages.find(e=>e.index===t.object.pageIndex);if(o)switch(t.commitState){case"new":const i=a.get(t.object.id),d=this.engine.createPageAnnotation(r,o,t.object,i);d.wait(()=>{this.events$.emit({type:"create",documentId:n,annotation:t.object,pageIndex:t.object.pageIndex,ctx:i,committed:!0}),a.delete(t.object.id)},xn),s.push(d);break;case"dirty":const u=this.engine.updatePageAnnotation(r,o,t.object);u.wait(()=>{this.events$.emit({type:"update",documentId:n,annotation:t.object,pageIndex:t.object.pageIndex,patch:t.object,committed:!0})},xn),l.push(u);break;case"deleted":c.push({ta:t,uid:e})}}const d=[];for(const{ta:e,uid:t}of c){const o=r.pages.find(t=>t.index===e.object.pageIndex);if("deleted"===e.commitState&&e.object.id){const i=new pt;this.engine.removePageAnnotation(r,o,e.object).wait(()=>{this.dispatch(Zl(n,t)),this.events$.emit({type:"delete",documentId:n,annotation:e.object,pageIndex:e.object.pageIndex,committed:!0}),i.resolve(!0)},i.fail),d.push(i)}else this.dispatch(Zl(n,t))}const u=[...s,...l,...d];return pt.allSettled(u).wait(()=>{this.dispatch((e=>({type:$l,payload:{documentId:e}}))(n)),t.resolve(!0)},t.fail),t}getToolBehavior(e,t){var n;return void 0!==(null==(n=e.behavior)?void 0:n[t])?e.behavior[t]:!1!==this.config[t]}};Fc.id="annotation";let jc=Fc;function Hc(e){return t=>(null==t?void 0:t.id)===e}const Uc=Hc("highlight"),Wc=Hc("squiggly"),Bc=Hc("underline"),qc=Hc("strikeout"),Gc={manifest:Pl,create:(e,t)=>new jc(Ml,e,t),reducer:(e,t)=>{switch(t.type){case Al:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Tl:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"ANNOTATION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case zl:{const{documentId:n,annotations:o}=t.payload,i=e.documents[n];if(!i)return e;const r={},a={};for(const[e,t]of Object.entries(o)){const n=Number(e),o=i.pages[n]||[];for(const e of o)delete a[e];const s=t.map(e=>{const t=e.id;return a[t]={commitState:"synced",object:e},t});r[n]=s}return{...e,documents:{...e.documents,[n]:{...i,pages:r,byUid:a}}}}case El:{const{documentId:n,id:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUid:o}}}:e}case _l:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selectedUid:null}}}:e}case Rl:{const{documentId:n,toolId:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeToolId:o}}}:e}case Nl:{const{documentId:n,pageIndex:o,annotation:i}=t.payload,r=e.documents[n];if(!r)return e;const a=i.id;return{...e,documents:{...e.documents,[n]:{...r,pages:{...r.pages,[o]:[...r.pages[o]??[],a]},byUid:{...r.byUid,[a]:{commitState:"new",object:i}},hasPendingChanges:!0}}}}case Ll:{const{documentId:n,pageIndex:o,id:i}=t.payload,r=e.documents[n];return r&&r.byUid[i]?{...e,documents:{...e.documents,[n]:{...r,pages:{...r.pages,[o]:(r.pages[o]??[]).filter(e=>e!==i)},byUid:{...r.byUid,[i]:{...r.byUid[i],commitState:"deleted"}},hasPendingChanges:!0}}}:e}case Ol:{const{documentId:n,id:o,patch:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:pc(r,o,i)}}:e}case $l:{const{documentId:n}=t.payload,o=e.documents[n];if(!o)return e;const i={};for(const[e,t]of Object.entries(o.byUid))i[e]={...t,commitState:"dirty"===t.commitState||"new"===t.commitState?"synced":t.commitState};return{...e,documents:{...e.documents,[n]:{...o,byUid:i,hasPendingChanges:!1}}}}case Fl:{const{documentId:n,uid:o}=t.payload,i=e.documents[n];if(!i)return e;const{[o]:r,...a}=i.byUid;return{...e,documents:{...e.documents,[n]:{...i,byUid:a}}}}case Ul:{const n=new Map(e.tools.map(e=>[e.id,e]));return n.set(t.payload.id,t.payload),{...e,tools:Array.from(n.values())}}case Hl:{const{toolId:n,patch:o}=t.payload;return{...e,tools:e.tools.map(e=>e.id===n?{...e,defaults:{...e.defaults,...o}}:e)}}case jl:return e.colorPresets.includes(t.payload)?e:{...e,colorPresets:[...e.colorPresets,t.payload]};default:return e}},initialState:(e,t)=>(e=>{const t=new Map;return mc.forEach(e=>t.set(e.id,e)),(e.tools||[]).forEach(e=>t.set(e.id,e)),{documents:{},activeDocumentId:null,tools:Array.from(t.values()),colorPresets:e.colorPresets??gc}})(t)},Vc="INTERACTION/INIT_STATE",Zc="INTERACTION/CLEANUP_STATE",Kc="INTERACTION/ACTIVATE_MODE",Yc="INTERACTION/PAUSE",Xc="INTERACTION/RESUME",Qc="INTERACTION/SET_CURSOR",Jc="INTERACTION/SET_DEFAULT_MODE",ed="INTERACTION/SET_EXCLUSION_RULES",td="INTERACTION/ADD_EXCLUSION_CLASS",nd="INTERACTION/REMOVE_EXCLUSION_CLASS",od="INTERACTION/ADD_EXCLUSION_ATTRIBUTE",id="INTERACTION/REMOVE_EXCLUSION_ATTRIBUTE";function rd(e){return{type:Jc,payload:{mode:e}}}function ad(e){return{type:ed,payload:{rules:e}}}const sd="pointerMode",ld=class extends Xn{constructor(e,t,n){super(e,t),this.modes=new Map,this.cursorClaims=new Map,this.buckets=new Map,this.alwaysGlobal=new Map,this.alwaysPage=new Map,this.onModeChange$=ao(),this.onHandlerChange$=ao(),this.onCursorChange$=ao(),this.onStateChange$=so(),this.registerMode({id:sd,scope:"page",exclusive:!1,cursor:"auto"}),this.dispatch(rd(sd)),n.exclusionRules&&this.dispatch(ad(n.exclusionRules))}onDocumentLoadingStarted(e){const t={activeMode:this.state.defaultMode,cursor:"auto",paused:!1};this.dispatch(function(e,t){return{type:Vc,payload:{documentId:e,state:t}}}(e,t)),this.cursorClaims.set(e,new Map),this.buckets.set(e,new Map),this.alwaysGlobal.set(e,new Set),this.alwaysPage.set(e,new Map);const n=this.buckets.get(e);for(const e of this.modes.keys())n.set(e,{global:new Set,page:new Map});this.logger.debug("InteractionManagerPlugin","DocumentOpened",`Initialized interaction state for document: ${e}`)}onDocumentClosed(e){this.cursorClaims.delete(e),this.buckets.delete(e),this.alwaysGlobal.delete(e),this.alwaysPage.delete(e),this.dispatch(function(e){return{type:Zc,payload:e}}(e)),this.logger.debug("InteractionManagerPlugin","DocumentClosed",`Cleaned up interaction state for document: ${e}`)}buildCapability(){return{getActiveMode:()=>this.getActiveMode(),getActiveInteractionMode:()=>this.getActiveInteractionMode(),activate:e=>this.activate(e),activateDefaultMode:()=>this.activateDefaultMode(),setCursor:(e,t,n)=>this.setCursor(e,t,n),getCurrentCursor:()=>this.getCurrentCursor(),removeCursor:e=>this.removeCursor(e),getHandlersForScope:e=>this.getHandlersForScope(e),activeModeIsExclusive:()=>this.activeModeIsExclusive(),pause:()=>this.pause(),resume:()=>this.resume(),isPaused:()=>this.registry.isDestroyed()||this.isPaused(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createInteractionScope(e),registerMode:e=>this.registerMode(e),registerHandlers:e=>this.registerHandlers(e),registerAlways:e=>this.registerAlways(e),setDefaultMode:e=>this.setDefaultMode(e),getDefaultMode:()=>this.state.defaultMode,getExclusionRules:()=>this.state.exclusionRules,setExclusionRules:e=>this.dispatch(ad(e)),addExclusionClass:e=>this.dispatch(function(e){return{type:td,payload:{className:e}}}(e)),removeExclusionClass:e=>this.dispatch(function(e){return{type:nd,payload:{className:e}}}(e)),addExclusionAttribute:e=>this.dispatch(function(e){return{type:od,payload:{attribute:e}}}(e)),removeExclusionAttribute:e=>this.dispatch(function(e){return{type:id,payload:{attribute:e}}}(e)),onModeChange:this.onModeChange$.on,onCursorChange:this.onCursorChange$.on,onHandlerChange:this.onHandlerChange$.on,onStateChange:this.onStateChange$.on}}createInteractionScope(e){return{getActiveMode:()=>this.getActiveMode(e),getActiveInteractionMode:()=>this.getActiveInteractionMode(e),activate:t=>this.activate(t,e),activateDefaultMode:()=>this.activateDefaultMode(e),setCursor:(t,n,o)=>this.setCursor(t,n,o,e),getCurrentCursor:()=>this.getCurrentCursor(e),removeCursor:t=>this.removeCursor(t,e),getHandlersForScope:e=>this.getHandlersForScope(e),activeModeIsExclusive:()=>this.activeModeIsExclusive(e),pause:()=>this.pause(e),resume:()=>this.resume(e),isPaused:()=>this.isPaused(e),getState:()=>this.getDocumentStateOrThrow(e),onModeChange:t=>this.onModeChange$.on(n=>{n.documentId===e&&t(n.activeMode)}),onCursorChange:t=>this.onCursorChange$.on(n=>{n.documentId===e&&t(n.cursor)}),onStateChange:t=>this.onStateChange$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Interaction state not found for document: ${e??"active"}`);return t}activate(e,t){var n;const o=t??this.getActiveDocumentId(),i=this.getDocumentStateOrThrow(o);if(!this.modes.has(e))throw new Error(`[interaction] unknown mode '${e}'`);if(e===i.activeMode)return;const r=i.activeMode;null==(n=this.cursorClaims.get(o))||n.clear(),this.notifyHandlersInactive(o,r),this.dispatch(function(e,t){return{type:Kc,payload:{documentId:e,mode:t}}}(o,e)),this.emitCursor(o),this.notifyHandlersActive(o,e),this.onModeChange$.emit({documentId:o,activeMode:e,previousMode:r})}activateDefaultMode(e){const t=e??this.getActiveDocumentId();this.activate(this.state.defaultMode,t)}setDefaultMode(e){if(!this.modes.has(e))throw new Error(`[interaction] cannot set unknown mode '${e}' as default`);this.dispatch(rd(e))}getActiveMode(e){return this.getDocumentStateOrThrow(e).activeMode}getActiveInteractionMode(e){const t=this.getDocumentState(e);return t?this.modes.get(t.activeMode)??null:null}activeModeIsExclusive(e){const t=this.getActiveInteractionMode(e);return!!(null==t?void 0:t.exclusive)}pause(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:Yc,payload:e}}(t))}resume(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:Xc,payload:e}}(t))}isPaused(e){return this.getDocumentStateOrThrow(e).paused}registerMode(e){this.modes.set(e.id,e);for(const t of this.buckets.keys()){const n=this.buckets.get(t);n.has(e.id)||n.set(e.id,{global:new Set,page:new Map})}}registerHandlers({documentId:e,modeId:t,handlers:n,pageIndex:o}){const i=Array.isArray(t)?t:[t],r=[],a=this.buckets.get(e);if(!a)throw new Error(`No buckets found for document: ${e}`);for(const e of i){const t=a.get(e);if(!t)throw new Error(`unknown mode '${e}'`);if(null==o)t.global.add(n);else{const e=t.page.get(o)??new Set;e.add(n),t.page.set(o,e)}r.push(()=>{if(null==o)t.global.delete(n);else{const e=t.page.get(o);e&&(e.delete(n),0===e.size&&t.page.delete(o))}})}return this.onHandlerChange$.emit({...this.state}),()=>{r.forEach(e=>e()),this.onHandlerChange$.emit({...this.state})}}registerAlways({scope:e,handlers:t}){if("global"===e.type){const n=this.alwaysGlobal.get(e.documentId)??new Set;return n.add(t),this.alwaysGlobal.set(e.documentId,n),this.onHandlerChange$.emit({...this.state}),()=>{n.delete(t),this.onHandlerChange$.emit({...this.state})}}const n=this.alwaysPage.get(e.documentId)??new Map,o=n.get(e.pageIndex)??new Set;return o.add(t),n.set(e.pageIndex,o),this.alwaysPage.set(e.documentId,n),this.onHandlerChange$.emit({...this.state}),()=>{o.delete(t),this.onHandlerChange$.emit({...this.state})}}getHandlersForScope(e){var t;const n=this.getDocumentState(e.documentId);if(!n)return null;const o=this.modes.get(n.activeMode);if(!o)return null;const i=this.buckets.get(e.documentId);if(!i)return null;const r=i.get(o.id);if(!r)return null;const a=(e,t)=>e.size||t.size?function(e){const t=["onPointerDown","onPointerUp","onPointerMove","onPointerEnter","onPointerLeave","onPointerCancel","onMouseDown","onMouseUp","onMouseMove","onMouseEnter","onMouseLeave","onMouseCancel","onClick","onDoubleClick"],n={};for(const o of t)n[o]=(t,n,i)=>{var r;for(const a of e)null==(r=a[o])||r.call(a,t,n,i)};return n}([...e,...t]):null;if("global"===e.type){return a(this.alwaysGlobal.get(e.documentId)??new Set,"global"===o.scope?r.global:new Set)}return a((null==(t=this.alwaysPage.get(e.documentId))?void 0:t.get(e.pageIndex))??new Set,"page"===o.scope?r.page.get(e.pageIndex)??new Set:new Set)}setCursor(e,t,n=0,o){const i=o??this.getActiveDocumentId(),r=this.cursorClaims.get(i);r&&(r.set(e,{cursor:t,priority:n}),this.emitCursor(i))}removeCursor(e,t){const n=t??this.getActiveDocumentId(),o=this.cursorClaims.get(n);o&&(o.delete(e),this.emitCursor(n))}getCurrentCursor(e){return this.getDocumentStateOrThrow(e).cursor}emitCursor(e){var t;const n=this.cursorClaims.get(e);if(!n)return;const o=this.getDocumentState(e);if(!o)return;const i=[...n.values()].sort((e,t)=>t.priority-e.priority)[0]??{cursor:(null==(t=this.modes.get(o.activeMode))?void 0:t.cursor)??"auto"};i.cursor!==o.cursor&&(this.dispatch(function(e,t){return{type:Qc,payload:{documentId:e,cursor:t}}}(e,i.cursor)),this.onCursorChange$.emit({documentId:e,cursor:i.cursor}))}notifyHandlersActive(e,t){var n,o;null==(n=this.alwaysGlobal.get(e))||n.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)}),null==(o=this.alwaysPage.get(e))||o.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)})});const i=this.modes.get(t);if(!i)return;const r=this.buckets.get(e);if(!r)return;const a=r.get(t);a&&("global"===i.scope&&a.global.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)}),"page"===i.scope&&a.page.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveStart)||n.call(e,t)})}))}notifyHandlersInactive(e,t){var n,o;null==(n=this.alwaysGlobal.get(e))||n.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)}),null==(o=this.alwaysPage.get(e))||o.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)})});const i=this.modes.get(t);if(!i)return;const r=this.buckets.get(e);if(!r)return;const a=r.get(t);a&&("global"===i.scope&&a.global.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)}),"page"===i.scope&&a.page.forEach(e=>{e.forEach(e=>{var n;null==(n=e.onHandlerActiveEnd)||n.call(e,t)})}))}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&this.onStateChange$.emit({documentId:n,state:i})}}async initialize(e){this.logger.info("InteractionManagerPlugin","Initialize","Interaction Manager Plugin initialized")}async destroy(){this.onModeChange$.clear(),this.onCursorChange$.clear(),this.onHandlerChange$.clear(),this.onStateChange$.clear(),await super.destroy()}};ld.id="interaction-manager";let cd=ld;const dd="interaction-manager",ud="pointerMode",hd={activeMode:ud,cursor:"auto",paused:!1},md={defaultMode:ud,exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]},documents:{},activeDocumentId:null},gd={manifest:{id:dd,name:"Interaction Manager Plugin",version:"1.0.0",provides:["interaction-manager"],requires:[],optional:[],defaultConfig:{exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]}}},create:(e,t)=>new cd(dd,e,t),reducer:(e=md,t)=>{switch(t.type){case Vc:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Zc:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"INTERACTION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Kc:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeMode:o}}}:e}case Qc:{const{documentId:n,cursor:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,cursor:o}}}:e}case Yc:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!0}}}:e}case Xc:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!1}}}:e}case Jc:return{...e,defaultMode:t.payload.mode};case ed:return{...e,exclusionRules:t.payload.rules};case td:return{...e,exclusionRules:{...e.exclusionRules,classes:[...e.exclusionRules.classes||[],t.payload.className].filter((e,t,n)=>n.indexOf(e)===t)}};case nd:return{...e,exclusionRules:{...e.exclusionRules,classes:(e.exclusionRules.classes||[]).filter(e=>e!==t.payload.className)}};case od:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:[...e.exclusionRules.dataAttributes||[],t.payload.attribute].filter((e,t,n)=>n.indexOf(e)===t)}};case id:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:(e.exclusionRules.dataAttributes||[]).filter(e=>e!==t.payload.attribute)}};default:return e}},initialState:md},pd=()=>vo(cd.id);const vd={pointerdown:"onPointerDown",pointerup:"onPointerUp",pointermove:"onPointerMove",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",pointercancel:"onPointerCancel",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousecancel:"onMouseCancel",click:"onClick",dblclick:"onDoubleClick",touchstart:"onPointerDown",touchend:"onPointerUp",touchmove:"onPointerMove",touchcancel:"onPointerCancel"},fd=["pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mousecancel","click","dblclick"],yd="undefined"!=typeof PointerEvent?fd:[...fd,"touchstart","touchend","touchmove","touchcancel"];function bd(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function wd(e,t,n,o){const i=e.forDocument(t.documentId);let r=e.getHandlersForScope(t);const a=()=>{var e;return!1!==(null==(e=i.getActiveInteractionMode())?void 0:e.wantsRawTouch)},s={};let l=a();const c=e=>{yd.forEach(t=>{const o=s[t]??(s[t]=f);var i;n.addEventListener(t,o,(i=e,t.startsWith("touch")?{passive:!i}:{passive:!1}))})},d=()=>{yd.forEach(e=>{const t=s[e];t&&n.removeEventListener(e,t)})};c(l),n.style.touchAction=l?"none":"";const u=i.onModeChange(()=>{if("global"===t.type){const e=i.getActiveInteractionMode();n.style.cursor="global"===(null==e?void 0:e.scope)?e.cursor??"auto":"auto"}r=e.getHandlersForScope(t);const o=a();o!==l&&(d(),c(o),l=o,n.style.touchAction=l?"none":"")}),h=e.onHandlerChange(()=>{r=e.getHandlersForScope(t)}),m=i.getActiveInteractionMode(),g=i.getCurrentCursor();n.style.cursor="global"===t.type&&"global"!==(null==m?void 0:m.scope)?"auto":g;const p=i.onCursorChange(e=>{var o;"global"===t.type&&"global"!==(null==(o=i.getActiveInteractionMode())?void 0:o.scope)||(n.style.cursor=e)}),v=(e,t)=>{if(o)return o(e,t);const n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}};function f(t){var o;if(e.isPaused())return;const a=e.getExclusionRules();if(t.target&&function(e,t){var n,o,i;if(!e)return!1;let r=e;for(;r;){if(null==(n=t.classes)?void 0:n.length)for(const e of t.classes)if(null==(o=r.classList)?void 0:o.contains(e))return!0;if(null==(i=t.dataAttributes)?void 0:i.length)for(const e of t.dataAttributes)if(r.hasAttribute(e))return!0;r=r.parentElement}return!1}(t.target,a))return;const s=vd[t.type];if(!s||!(null==r?void 0:r[s]))return;let c,d;if(bd(t)&&l&&("touchmove"===t.type||"touchcancel"===t.type)&&t.preventDefault(),bd(t)){const e="touchend"===t.type||"touchcancel"===t.type?t.changedTouches[0]:t.touches[0];if(!e)return;c=v(e,n),d={clientX:e.clientX,clientY:e.clientY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,target:t.target,currentTarget:t.currentTarget,setPointerCapture:()=>{},releasePointerCapture:()=>{}}}else{const e=t;c=v(e,n),d={clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,target:e.target,currentTarget:e.currentTarget,setPointerCapture:()=>{var t,n;null==(n=null==(t=e.target)?void 0:t.setPointerCapture)||n.call(t,e.pointerId)},releasePointerCapture:()=>{var t,n;null==(n=null==(t=e.target)?void 0:t.releasePointerCapture)||n.call(t,e.pointerId)}}}null==(o=r[s])||o.call(r,c,d,i.getActiveMode())}return()=>{d(),u(),p(),h()}}const xd=({children:e,documentId:t,style:n,...o})=>{const i=Te(null),{provides:r}=pd();return Pe(()=>{if(r&&i.current)return wd(r,{type:"global",documentId:t},i.current)},[r,t]),We("div",{ref:i,style:{width:"100%",height:"100%",...n},...o,children:e})},Cd=({documentId:e,pageIndex:t,children:n,rotation:o,scale:i,convertEventToPoint:r,style:a,...s})=>{var l,c;const d=Te(null),{provides:u}=pd(),h=function(e){const{provides:t}=pd(),[n,o]=De(()=>{if(!t)return!1;const n=t.forDocument(e).getActiveInteractionMode();return"page"===(null==n?void 0:n.scope)&&!!n.exclusive});return Pe(()=>{if(!t)return;const n=t.forDocument(e);return n.onModeChange(()=>{const e=n.getActiveInteractionMode();o("page"===(null==e?void 0:e.scope)&&!!(null==e?void 0:e.exclusive))})},[t,e]),n}(e),m=yo(e),g=null==(c=null==(l=null==m?void 0:m.document)?void 0:l.pages)?void 0:c[t],p=(null==g?void 0:g.size)??{width:0,height:0},v=o??(null==m?void 0:m.rotation)??0,f=i??(null==m?void 0:m.scale)??1,y=Ke(p,0,f),b=Ee((e,t)=>{const n=t.getBoundingClientRect(),o={x:e.clientX-n.left,y:e.clientY-n.top};return function(e,t,n,o){return Je(Qe(e,t,(4-n)%4),1/o)}(Ke({width:y.width,height:y.height},v,1),o,v,f)},[p,v,f]);return Pe(()=>{if(u&&d.current)return wd(u,{type:"page",documentId:e,pageIndex:t},d.current,r||b)},[u,e,t,r,b]),We("div",{ref:d,style:{position:"relative",width:y.width,height:y.height,...a},...s,children:[n,h&&We("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}})]})},Id={},Sd=()=>vo(jc.id),kd=e=>{var t;const{provides:n}=Sd(),[o,i]=De((null==(t=null==n?void 0:n.forDocument(e))?void 0:t.getState())??{pages:{},byUid:{},selectedUid:null,activeToolId:null,hasPendingChanges:!1});return Pe(()=>{if(!n)return;const t=n.forDocument(e);return i(t.getState()),t.onStateChange(e=>{i(e)})},[n,e]),{state:o,provides:(null==n?void 0:n.forDocument(e))??null}};function Dd({scale:e,documentId:t,pageIndex:n,rotation:o,pageWidth:i,pageHeight:r,trackedAnnotation:a,children:s,isSelected:l,isDraggable:c,isResizable:d,lockAspectRatio:u=!1,style:h={},vertexConfig:m,selectionMenu:g,outlineOffset:p=1,onDoubleClick:v,onSelect:f,zIndex:y=1,resizeUI:b,vertexUI:w,selectionOutlineColor:x="#007ACC",customAnnotationRenderer:C,...I}){const[S,k]=De(a.object),{provides:D}=Sd(),M=Te(null),P=ze(()=>D?D.forDocument(t):null,[D,t]),A=S?{...a.object,...S}:a.object,T=(null==b?void 0:b.color)??"#007ACC",z=(null==w?void 0:w.color)??"#007ACC",E=(null==b?void 0:b.size)??12,_=(null==w?void 0:w.size)??12,{dragProps:R,vertices:N,resize:O}=Gs({controller:{element:A.rect,vertices:null==m?void 0:m.extractVertices(A),constraints:{minWidth:10,minHeight:10,boundingBox:{width:i,height:r}},maintainAspectRatio:u,pageRotation:o,scale:e,enabled:l,onUpdate:e=>{var t;if(!(null==(t=e.transformData)?void 0:t.type))return;"start"===e.state&&(M.current=A);const o=e.transformData.type,i=M.current??A,r=e.transformData.changes.vertices?null==m?void 0:m.transformAnnotation(i,e.transformData.changes.vertices):{rect:e.transformData.changes.rect},s=null==D?void 0:D.transformAnnotation(i,{type:o,changes:r,metadata:e.transformData.metadata});s&&k(e=>({...e,...s})),"end"===e.state&&s&&(M.current=null,null==P||P.updateAnnotation(n,a.object.id,s))}},resizeUI:{handleSize:E,spacing:p,offsetMode:"outside",includeSides:!u,zIndex:y+1},vertexUI:{vertexSize:_,zIndex:y+2},includeVertices:!!m}),L=function(e,{delay:t=300,tolerancePx:n=18}={}){const o=Te({t:0,x:0,y:0}),i=Ee(i=>{if(!e)return;if("mouse"===i.pointerType||!1===i.isPrimary)return;const r=performance.now(),a=i.clientX,s=i.clientY,l=r-o.current.t<=t,c=a-o.current.x,d=s-o.current.y;l&&c*c+d*d<=n*n&&(null==e||e(i)),o.current={t:r,x:a,y:s}},[e,t,n]),r=Ee(t=>{null==e||e(t)},[e]);return e?{[Hs]:r,onPointerUpCapture:i}:{}}(v);return Pe(()=>{k(a.object)},[a.object]),We("div",{"data-no-interaction":!0,children:[We("div",{...c&&l?R:{},...L,style:{position:"absolute",left:A.rect.origin.x*e,top:A.rect.origin.y*e,width:A.rect.size.width*e,height:A.rect.size.height*e,outline:l?`1px solid ${x}`:"none",outlineOffset:l?`${p}px`:"0px",pointerEvents:l?"auto":"none",touchAction:"none",cursor:l&&c?"move":"default",zIndex:y,...h},...I,children:[(()=>{const t="function"==typeof s?s(A):s,a=null==C?void 0:C({annotation:A,children:t,isSelected:l,scale:e,rotation:o,pageWidth:i,pageHeight:r,pageIndex:n,onSelect:f});return null!=a?a:t})(),l&&d&&O.map(({key:e,...t})=>(null==b?void 0:b.component)?b.component({key:e,...t,backgroundColor:T}):We("div",{...t,style:{...t.style,backgroundColor:T}},e)),l&&N.map(({key:e,...t})=>(null==w?void 0:w.component)?w.component({key:e,...t,backgroundColor:z}):We("div",{...t,style:{...t.style,backgroundColor:z}},e))]}),g&&We(Us,{rect:{origin:{x:A.rect.origin.x*e,y:A.rect.origin.y*e},size:{width:A.rect.size.width*e,height:A.rect.size.height*e}},rotation:o,children:e=>g({...e,context:{type:"annotation",annotation:a,pageIndex:n},selected:l,placement:{suggestTop:!1}})})]})}function Md({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){return We(W,{children:n.map((n,s)=>We("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?n.origin.x-o.origin.x:n.origin.x)*i,top:(o?n.origin.y-o.origin.y:n.origin.y)*i,width:n.size.width*i,height:n.size.height*i,background:e,opacity:t,pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:void 0,...a}},s))})}function Pd({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i;return We(W,{children:n.map((n,l)=>We("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?n.origin.x-o.origin.x:n.origin.x)*i,top:(o?n.origin.y-o.origin.y:n.origin.y)*i,width:n.size.width*i,height:n.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:We("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:s,background:e,opacity:t,pointerEvents:"none"}})},l))})}function Ad({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i;return We(W,{children:n.map((n,l)=>We("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?n.origin.x-o.origin.x:n.origin.x)*i,top:(o?n.origin.y-o.origin.y:n.origin.y)*i,width:n.size.width*i,height:n.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:We("div",{style:{position:"absolute",left:0,top:"50%",width:"100%",height:s,background:e,opacity:t,transform:"translateY(-50%)",pointerEvents:"none"}})},l))})}function Td({color:e="#FFFF00",opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i,l=6*i,c=`url("data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${2*s}" viewBox="0 0 ${l} ${2*s}">\n <path d="M0 ${s} Q ${l/4} 0 ${l/2} ${s} T ${l} ${s}"\n fill="none" stroke="${e}" stroke-width="${s}" stroke-linecap="round"/>\n </svg>`)}")`;return We(W,{children:n.map((e,n)=>We("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?e.origin.x-o.origin.x:e.origin.x)*i,top:(o?e.origin.y-o.origin.y:e.origin.y)*i,width:e.size.width*i,height:e.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:We("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:2*s,backgroundImage:c,backgroundRepeat:"repeat-x",backgroundSize:`${l}px ${2*s}px`,opacity:t,pointerEvents:"none"}})},n))})}function zd({isSelected:e,color:t="#000000",opacity:n=1,strokeWidth:o,inkList:i,rect:r,scale:a,onClick:s}){const l=ze(()=>i.map(({points:e})=>{let t="";return e.forEach(({x:e,y:n},o)=>{const i=e-r.origin.x,a=n-r.origin.y;t+=(0===o?"M":"L")+i+" "+a+" "}),t.trim()}),[i,r]),c=r.size.width*a,d=r.size.height*a;return We("svg",{style:{position:"absolute",width:c,height:d,pointerEvents:"none",zIndex:2,overflow:"visible"},width:c,height:d,viewBox:`0 0 ${r.size.width} ${r.size.height}`,children:l.map((i,r)=>We("path",{d:i,fill:"none",opacity:n,onPointerDown:s,onTouchStart:s,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"visibleStroke",stroke:t,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}},r))})}function Ed({isSelected:e,color:t="#000000",strokeColor:n,opacity:o=1,strokeWidth:i,strokeStyle:r=_t.SOLID,strokeDashArray:a,rect:s,scale:l,onClick:c}){const{width:d,height:u,x:h,y:m}=ze(()=>{const e=s.size.width,t=s.size.height;return{width:Math.max(e-i,0),height:Math.max(t-i,0),x:i/2,y:i/2}},[s,i]),g=(d+i)*l,p=(u+i)*l;return We("svg",{style:{position:"absolute",width:g,height:p,pointerEvents:"none",zIndex:2},width:g,height:p,viewBox:`0 0 ${d+i} ${u+i}`,children:We("rect",{x:h,y:m,width:d,height:u,fill:t,opacity:o,onPointerDown:c,onTouchStart:c,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"transparent"===t?"visibleStroke":"visible",stroke:n??t,strokeWidth:i,...r===_t.DASHED&&{strokeDasharray:null==a?void 0:a.join(",")}}})})}function _d({color:e="#000000",strokeColor:t,opacity:n=1,strokeWidth:o,strokeStyle:i=_t.SOLID,strokeDashArray:r,rect:a,scale:s,onClick:l,isSelected:c}){const{width:d,height:u,cx:h,cy:m,rx:g,ry:p}=ze(()=>{const e=a.size.width,t=a.size.height,n=Math.max(e-o,0),i=Math.max(t-o,0);return{width:e,height:t,cx:o/2+n/2,cy:o/2+i/2,rx:n/2,ry:i/2}},[a,o]),v=d*s,f=u*s;return We("svg",{style:{position:"absolute",width:v,height:f,pointerEvents:"none",zIndex:2},width:v,height:f,viewBox:`0 0 ${d} ${u}`,children:We("ellipse",{cx:h,cy:m,rx:g,ry:p,fill:e,opacity:n,onPointerDown:l,onTouchStart:l,style:{cursor:c?"move":"pointer",pointerEvents:c?"none":"transparent"===e?"visibleStroke":"visible",stroke:t??e,strokeWidth:o,...i===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}})})}function Rd({color:e="transparent",opacity:t=1,strokeWidth:n,strokeColor:o="#000000",strokeStyle:i=_t.SOLID,strokeDashArray:r,rect:a,linePoints:s,lineEndings:l,scale:c,onClick:d,isSelected:u}){const{x1:h,y1:m,x2:g,y2:p}=ze(()=>({x1:s.start.x-a.origin.x,y1:s.start.y-a.origin.y,x2:s.end.x-a.origin.x,y2:s.end.y-a.origin.y}),[s,a]),v=ze(()=>{const e=Math.atan2(p-m,g-h);return{start:Pc.createEnding(null==l?void 0:l.start,n,e+Math.PI,h,m),end:Pc.createEnding(null==l?void 0:l.end,n,e,g,p)}},[l,n,h,m,g,p]),f=a.size.width*c,y=a.size.height*c;return We("svg",{style:{position:"absolute",width:f,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:f,height:y,viewBox:`0 0 ${a.size.width} ${a.size.height}`,children:[We("line",{x1:h,y1:m,x2:g,y2:p,opacity:t,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",pointerEvents:u?"none":"visibleStroke",stroke:o,strokeWidth:n,strokeLinecap:"butt",...i===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}),v.start&&We("path",{d:v.start.d,transform:v.start.transform,onPointerDown:d,onTouchStart:d,stroke:o,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":v.start.filled?"visible":"visibleStroke",...i===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:v.start.filled?e:"none"}),v.end&&We("path",{d:v.end.d,transform:v.end.transform,stroke:o,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":v.end.filled?"visible":"visibleStroke",...i===_t.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:v.end.filled?e:"none"})]})}function Nd({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,scale:a,isSelected:s,onClick:l,lineEndings:c}){const d=ze(()=>t.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[t,e]),u=ze(()=>{if(!d.length)return"";const[e,...t]=d;return`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("").trim()},[d]),h=ze(()=>{if(d.length<2)return{start:null,end:null};const e=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),t=e(d[0],d[1]),n=e(d[d.length-2],d[d.length-1]);return{start:Pc.createEnding(null==c?void 0:c.start,r,t+Math.PI,d[0].x,d[0].y),end:Pc.createEnding(null==c?void 0:c.end,r,n,d[d.length-1].x,d[d.length-1].y)}},[d,c,r]),m=e.size.width*a,g=e.size.height*a;return We("svg",{style:{position:"absolute",width:m,height:g,pointerEvents:"none",zIndex:2,overflow:"visible"},width:m,height:g,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[We("path",{d:u,onPointerDown:l,onTouchStart:l,opacity:i,style:{fill:"none",stroke:o??n,strokeWidth:r,cursor:s?"move":"pointer",pointerEvents:s?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"}}),h.start&&We("path",{d:h.start.d,transform:h.start.transform,stroke:o,fill:h.start.filled?n:"none",onPointerDown:l,onTouchStart:l,style:{cursor:s?"move":"pointer",strokeWidth:r,pointerEvents:s?"none":h.start.filled?"visible":"visibleStroke",strokeLinecap:"butt"}}),h.end&&We("path",{d:h.end.d,transform:h.end.transform,stroke:o,fill:h.end.filled?n:"none",onPointerDown:l,onTouchStart:l,style:{cursor:s?"move":"pointer",strokeWidth:r,pointerEvents:s?"none":h.end.filled?"visible":"visibleStroke",strokeLinecap:"butt"}})]})}function Od({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,strokeStyle:a=_t.SOLID,strokeDashArray:s,scale:l,isSelected:c,onClick:d,currentVertex:u,handleSize:h=14}){const m=u?[...t,u]:t,g=ze(()=>m.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[m,e]),p=ze(()=>{if(!g.length)return"";const[e,...t]=g,n=!!u;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()},[g,u]),v=u&&t.length>0,f=e.size.width*l,y=e.size.height*l;return We("svg",{style:{position:"absolute",width:f,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:f,height:y,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[We("path",{d:p,onPointerDown:d,onTouchStart:d,opacity:i,style:{fill:u?"none":n,stroke:o??n,strokeWidth:r,cursor:c?"move":"pointer",pointerEvents:c?"none":"transparent"===n?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...a===_t.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),v&&t.length>1&&We("path",{d:`M ${g[g.length-1].x} ${g[g.length-1].y} L ${g[0].x} ${g[0].y}`,fill:"none",style:{stroke:o,strokeWidth:r,strokeDasharray:"4,4",opacity:.7}}),v&&t.length>=2&&We("rect",{x:g[0].x-h/l/2,y:g[0].y-h/l/2,width:h/l,height:h/l,fill:o,opacity:.4,stroke:o,strokeWidth:r/2})]})}function Ld({isSelected:e,isEditing:t,annotation:n,pageIndex:o,scale:i,onClick:r}){const a=Te(null),{provides:s}=Sd(),[l,c]=De(!1);Pe(()=>{if(t&&a.current){const e=a.current;e.focus();const t=window.getSelection();if(t){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}},[t]),Ae(()=>{try{const e=navigator,t=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1;c(t)}catch{c(!1)}},[]);const d=n.object.fontSize*i,u=l&&t&&d>0&&d<16,h=u?16:d,m=u?d/16:1,g=u?100/m:100;return We("div",{style:{position:"absolute",width:n.object.rect.size.width*i,height:n.object.rect.size.height*i,cursor:e&&!t?"move":"default",pointerEvents:e&&!t?"none":"auto",zIndex:2},onPointerDown:r,onTouchStart:r,children:We("span",{ref:a,onBlur:()=>{s&&a.current&&s.updateAnnotation(o,n.object.id,{contents:a.current.innerText})},tabIndex:0,style:{color:n.object.fontColor,fontSize:h,fontFamily:(p=n.object.fontFamily,an(p).css),textAlign:Qt(n.object.textAlign),flexDirection:"column",justifyContent:n.object.verticalAlign===It.Top?"flex-start":n.object.verticalAlign===It.Middle?"center":"flex-end",display:"flex",backgroundColor:n.object.backgroundColor,opacity:n.object.opacity,width:u?`${g}%`:"100%",height:u?`${g}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:t?"text":"pointer",outline:"none",transform:u?`scale(${m})`:void 0,transformOrigin:"top left"},contentEditable:t,...Id,children:n.object.contents})});var p}function $d({documentId:e,pageIndex:t,annotation:n,scaleFactor:o=1,style:i,...r}){const{provides:a}=Sd(),[s,l]=De(null),c=Te(null),{width:d,height:u}=n.rect.size;Pe(()=>{if(a){const i=a.forDocument(e).renderAnnotation({pageIndex:t,annotation:n,options:{scaleFactor:o,dpr:window.devicePixelRatio}});return i.wait(e=>{const t=URL.createObjectURL(e);l(t),c.current=t},xn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):i.abort({code:Ut.Cancelled,message:"canceled render task"})}}},[t,o,a,e,n.id,d,u]);return We(W,{children:s&&We("img",{src:s,onLoad:()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},...r,style:{width:"100%",height:"100%",display:"block",...i||{}}})})}function Fd({isSelected:e,annotation:t,documentId:n,pageIndex:o,scale:i,onClick:r}){return We("div",{style:{position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e?"none":"auto",cursor:"pointer"},onPointerDown:r,onTouchStart:r,children:We($d,{documentId:n,pageIndex:o,annotation:{...t.object,id:t.object.id},scaleFactor:i})})}function jd(e){const{documentId:t,pageIndex:n,scale:o,selectionMenu:i}=e,{provides:r}=Sd(),{provides:a}=Vs(),[s,l]=De([]),{register:c}=function({modeId:e,pageIndex:t,documentId:n}){const{provides:o}=pd();return{register:(i,r)=>{const a=(null==r?void 0:r.modeId)??e,s=(null==r?void 0:r.pageIndex)??t,l=(null==r?void 0:r.documentId)??n;return a?null==o?void 0:o.registerHandlers({modeId:a,handlers:i,pageIndex:s,documentId:l}):null==o?void 0:o.registerAlways({scope:void 0!==s?{type:"page",documentId:l,pageIndex:s}:{type:"global",documentId:l},handlers:i})}}}({documentId:t,pageIndex:n}),[d,u]=De(null),[h,m]=De(null),g=ze(()=>r?r.forDocument(t):null,[r,t]);Pe(()=>{if(g){const e=g.getState();return l(cc(e,n)),u(uc(e,n)),g.onStateChange(e=>{l(cc(e,n)),u(uc(e,n))})}},[g,n]);const p=ze(()=>({onPointerDown:(e,t)=>{t.target===t.currentTarget&&g&&(g.deselectAnnotation(),m(null))}}),[g]),v=Ee((e,t)=>{e.stopPropagation(),g&&a&&(g.selectAnnotation(n,t.object.id),a.clear(),t.object.id!==h&&m(null))},[g,a,h,n]);return Pe(()=>c(p,{documentId:t}),[c,p]),We(W,{children:s.map(r=>{const a=(null==d?void 0:d.object.id)===r.object.id,s=h===r.object.id,l=null==g?void 0:g.findToolForAnnotation(r.object);return Kl(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(zd,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})},r.object.id):Ql(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(Ed,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})},r.object.id):Yl(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(_d,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})},r.object.id):nc(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(Pd,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):oc(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(Ad,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):ic(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(Td,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):tc(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!1,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),zIndex:0,style:{mixBlendMode:gn(r.object.blendMode??St.Multiply)},...e,children:e=>We(Md,{...e,scale:o,onClick:e=>v(e,r)})},r.object.id):Jl(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),vertexConfig:{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})},style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(W,{children:We(Rd,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})})},r.object.id):ec(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(W,{children:We(Nd,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})})},r.object.id):Xl(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!1,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(W,{children:We(Od,{...e,isSelected:a,scale:o,onClick:e=>v(e,r)})})},r.object.id):rc(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:((null==l?void 0:l.interaction.isDraggable)??!0)&&!s,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},onDoubleClick:e=>{e.stopPropagation(),m(r.object.id)},...e,children:e=>We(Ld,{isSelected:a,isEditing:s,annotation:{...r,object:e},pageIndex:n,scale:o,onClick:e=>v(e,r)})},r.object.id):ac(r)?We(Dd,{trackedAnnotation:r,isSelected:a,isDraggable:(null==l?void 0:l.interaction.isDraggable)??!0,isResizable:(null==l?void 0:l.interaction.isResizable)??!0,lockAspectRatio:(null==l?void 0:l.interaction.lockAspectRatio)??!1,selectionMenu:i,onSelect:e=>v(e,r),style:{mixBlendMode:gn(r.object.blendMode??St.Normal)},...e,children:e=>We(Fd,{isSelected:a,annotation:r,documentId:t,pageIndex:n,scale:o,onClick:e=>v(e,r)})},r.object.id):null})})}function Hd({documentId:e,pageIndex:t,scale:n}){var o,i,r,a,s,l,c,d,u,h,m,g;const{provides:p}=Vs(),{provides:v}=Sd(),[f,y]=De([]),[b,w]=De(null),[x,C]=De(null);if(Pe(()=>{if(p)return p.forDocument(e).onSelectionChange(()=>{y(p.forDocument(e).getHighlightRectsForPage(t)),w(p.forDocument(e).getBoundingRectForPage(t))})},[p,e,t]),Pe(()=>{if(v)return C(v.forDocument(e).getActiveTool()),v.forDocument(e).onActiveToolChange(e=>C(e))},[v,e]),!b)return null;if(!x||!x.defaults)return null;switch(x.defaults.type){case Mt.UNDERLINE:return We("div",{style:{mixBlendMode:gn((null==(o=x.defaults)?void 0:o.blendMode)??St.Normal),pointerEvents:"none",position:"absolute",inset:0},children:We(Pd,{color:null==(i=x.defaults)?void 0:i.color,opacity:null==(r=x.defaults)?void 0:r.opacity,segmentRects:f,scale:n})});case Mt.HIGHLIGHT:return We("div",{style:{mixBlendMode:gn((null==(a=x.defaults)?void 0:a.blendMode)??St.Multiply),pointerEvents:"none",position:"absolute",inset:0},children:We(Md,{color:null==(s=x.defaults)?void 0:s.color,opacity:null==(l=x.defaults)?void 0:l.opacity,segmentRects:f,scale:n})});case Mt.STRIKEOUT:return We("div",{style:{mixBlendMode:gn((null==(c=x.defaults)?void 0:c.blendMode)??St.Normal),pointerEvents:"none",position:"absolute",inset:0},children:We(Ad,{color:null==(d=x.defaults)?void 0:d.color,opacity:null==(u=x.defaults)?void 0:u.opacity,segmentRects:f,scale:n})});case Mt.SQUIGGLY:return We("div",{style:{mixBlendMode:gn((null==(h=x.defaults)?void 0:h.blendMode)??St.Normal),pointerEvents:"none",position:"absolute",inset:0},children:We(Td,{color:null==(m=x.defaults)?void 0:m.color,opacity:null==(g=x.defaults)?void 0:g.opacity,segmentRects:f,scale:n})});default:return null}}function Ud({preview:e,scale:t}){const{bounds:n}=e,o={position:"absolute",left:n.origin.x*t,top:n.origin.y*t,width:n.size.width*t,height:n.size.height*t,pointerEvents:"none",zIndex:10};return e.type===Mt.CIRCLE?We("div",{style:o,children:We(_d,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.SQUARE?We("div",{style:o,children:We(Ed,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.POLYGON?We("div",{style:o,children:We(Od,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.POLYLINE?We("div",{style:o,children:We(Nd,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.LINE?We("div",{style:o,children:We(Rd,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.INK?We("div",{style:o,children:We(zd,{isSelected:!1,scale:t,...e.data})}):e.type===Mt.FREETEXT?We("div",{style:o,children:We("div",{style:{width:"100%",height:"100%",border:`1px dashed ${e.data.fontColor||"#000000"}`,backgroundColor:"transparent"}})}):null}function Wd({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=po(jc.id),[i,r]=De(new Map),a=Te(null),s=Te(null),l=ze(()=>({requestFile:({accept:e,onFile:t})=>{if(!a.current)return;const n=a.current;n.accept=e,n.onchange=e=>{var o;const i=null==(o=e.target.files)?void 0:o[0];i&&(t(i),n.value="")},n.click()},processImage:({source:e,maxWidth:t,maxHeight:n,onComplete:o})=>{const i=s.current;if(!i||!i.getContext)return;const r=i.getContext("2d");if(!r)return;const a=new Image;a.crossOrigin="Anonymous",a.onload=()=>{let{naturalWidth:s,naturalHeight:l}=a;const c=t?t/s:1,d=n?n/l:1,u=Math.min(c,d,1),h=s*u,m=l*u;i.width=h,i.height=m,r.drawImage(a,0,0,h,m);const g=r.getImageData(0,0,h,m);"string"!=typeof e&&URL.revokeObjectURL(a.src),o({imageData:g,width:h,height:m})},a.src="string"==typeof e?e:URL.createObjectURL(e)}}),[]);return Pe(()=>{if(o)return o.registerPageHandlers(e,t,n,{services:l,onPreview:(e,t)=>{r(n=>{const o=new Map(n);return t?o.set(e,t):o.delete(e),o})}})},[e,t,n,o,l]),We(W,{children:[We("input",{ref:a,type:"file",style:{display:"none"}}),We("canvas",{ref:s,style:{display:"none"}}),Array.from(i.entries()).map(([e,t])=>We(Ud,{preview:t,scale:n},e))]})}function Bd({style:e,documentId:t,pageIndex:n,scale:o,rotation:i,selectionMenu:r,resizeUI:a,vertexUI:s,selectionOutlineColor:l,customAnnotationRenderer:c,...d}){var u,h,m,g;const p=yo(t),v=null==(h=null==(u=null==p?void 0:p.document)?void 0:u.pages)?void 0:h[n],f=(null==(m=null==v?void 0:v.size)?void 0:m.width)??0,y=(null==(g=null==v?void 0:v.size)?void 0:g.height)??0,b=ze(()=>void 0!==o?o:(null==p?void 0:p.scale)??1,[o,null==p?void 0:p.scale]);return We("div",{style:{...e},...d,children:[We(jd,{documentId:t,selectionMenu:r,pageIndex:n,scale:b,rotation:ze(()=>void 0!==i?i:(null==p?void 0:p.rotation)??Be.Degree0,[i,null==p?void 0:p.rotation]),pageWidth:f,pageHeight:y,resizeUI:a,vertexUI:s,selectionOutlineColor:l,customAnnotationRenderer:c}),We(Hd,{documentId:t,pageIndex:n,scale:b}),We(Wd,{documentId:t,pageIndex:n,scale:b})]})}const qd="print",Gd={id:qd,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{}},Vd=class extends Xn{constructor(e,t,n){super(e,t),this.printReady$=ao()}buildCapability(){return{print:e=>this.print(e),forDocument:e=>this.createPrintScope(e)}}createPrintScope(e){return{print:t=>this.print(t,e)}}print(e,t){const n=t??this.getActiveDocumentId(),o=e??{},i=new pt;i.progress({stage:"preparing",message:"Preparing document..."});return this.preparePrintDocument(o,n).wait(e=>{i.progress({stage:"document-ready",message:"Document prepared successfully"}),this.printReady$.emit({documentId:n,options:o,buffer:e,task:i})},e=>i.fail(e)),i}preparePrintDocument(e,t){const n=this.coreState.core.documents[t];return(null==n?void 0:n.document)?this.engine.preparePrintDocument(n.document,e):Wt.reject({code:Ut.DocNotOpen,message:`Document ${t} not found`})}onPrintRequest(e){return this.printReady$.on(e)}async initialize(e){this.logger.info("PrintPlugin","Initialize","Print plugin initialized")}async destroy(){this.printReady$.clear(),await super.destroy()}};Vd.id="print";let Zd=Vd;const Kd=()=>vo(Zd.id);const Yd=uo({manifest:Gd,create:(e,t)=>new Zd(qd,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{provides:e}=Kd(),{plugin:t}=po(Zd.id),n=Te(null),o=Te(null);return Pe(()=>{if(!e||!t)return;const i=t.onPrintRequest(({buffer:e,task:t})=>{const i=n.current;if(!i)return;o.current&&(URL.revokeObjectURL(o.current),o.current=null);const r=URL.createObjectURL(new Blob([e],{type:"application/pdf"}));o.current=r,i.onload=()=>{var n,o;i.src===r&&(t.progress({stage:"iframe-ready",message:"Ready to print"}),null==(n=i.contentWindow)||n.focus(),null==(o=i.contentWindow)||o.print(),t.progress({stage:"printing",message:"Print dialog opened"}),t.resolve(e))},i.src=r});return()=>{i(),o.current&&URL.revokeObjectURL(o.current)}},[e,t]),We("iframe",{ref:n,style:{position:"absolute",display:"none"},title:"Print Document",src:"about:blank"})}).build(),Xd="fullscreen",Qd={id:Xd,name:"Fullscreen Plugin",version:"1.0.0",provides:["fullscreen"],requires:[],optional:[],defaultConfig:{}},Jd="SET_FULLSCREEN";const eu=class extends Xn{constructor(e,t,n){super(e,t),this.onStateChange$=so(),this.fullscreenRequest$=ao(),this.config=n}async initialize(e){}buildCapability(){return{isFullscreen:()=>this.state.isFullscreen,enableFullscreen:e=>this.enableFullscreen(e),exitFullscreen:()=>this.exitFullscreen(),toggleFullscreen:e=>this.toggleFullscreen(e),onRequest:this.fullscreenRequest$.on,onStateChange:this.onStateChange$.on}}getTargetSelector(){return this.currentTargetElement??this.config.targetElement}toggleFullscreen(e){this.state.isFullscreen?this.exitFullscreen():this.enableFullscreen(e)}enableFullscreen(e){this.currentTargetElement=e??this.config.targetElement,this.fullscreenRequest$.emit({action:"enter",targetElement:this.currentTargetElement})}exitFullscreen(){this.fullscreenRequest$.emit({action:"exit"}),this.currentTargetElement=void 0}onStoreUpdated(e,t){this.onStateChange$.emit(t)}setFullscreenState(e){this.dispatch({type:Jd,payload:e})}async destroy(){this.fullscreenRequest$.clear(),super.destroy()}};eu.id="fullscreen";let tu=eu;const nu=()=>po(tu.id);async function ou(e,t,n){if("enter"===e.action){const o=function(e,t,n){if(!t||"enter"!==e.action)return t;let o=null;return n&&(o=t.querySelector(n),o||console.warn(`Fullscreen: Could not find element with selector "${n}" within the wrapper. Falling back to wrapper element.`)),o||(o=t),o}(e,t,n);o&&!document.fullscreenElement&&await o.requestFullscreen()}else document.fullscreenElement&&await document.exitFullscreen()}const iu=uo({manifest:Qd,create:(e,t)=>new tu(Xd,e,t),reducer:(e,t)=>t.type===Jd?{...e,isFullscreen:t.payload}:e,initialState:{isFullscreen:!1}}).addWrapper(function({children:e,...t}){const{provides:n}=vo(tu.id),{plugin:o}=nu(),{plugin:i}=nu(),r=Te(null);return Pe(()=>{if(!n||!o)return;return n.onRequest(async e=>{const t=o.getTargetSelector();await ou(e,r.current,t)})},[n,o]),Pe(()=>{if(!i)return;const e=()=>i.setFullscreenState(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[i]),We("div",{...t,style:{position:"relative",width:"100%",height:"100%",...t.style},ref:r,children:e})}).build(),ru="bookmark",au={id:ru,name:"Bookmark Plugin",version:"1.0.0",provides:["bookmark"],requires:[],optional:[],defaultConfig:{}},su=class extends Xn{constructor(e,t){super(e,t)}async initialize(e){}buildCapability(){return{getBookmarks:()=>this.getBookmarks(),forDocument:e=>this.createBookmarkScope(e)}}createBookmarkScope(e){return{getBookmarks:()=>this.getBookmarks(e)}}getBookmarks(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))throw new Error(`Document ${t} not loaded`);return this.engine.getBookmarks(n.document)}};su.id="bookmark";let lu=su;const cu={manifest:au,create:e=>new lu(ru,e),reducer:()=>{},initialState:{}},du=class extends Xn{constructor(e,t,n){super(e,t),this.downloadRequest$=ao(),this.config=n}buildCapability(){return{saveAsCopy:()=>this.saveAsCopy(),download:()=>this.download(),forDocument:e=>this.createExportScope(e)}}createExportScope(e){return{saveAsCopy:()=>this.saveAsCopy(e),download:()=>this.download(e)}}download(e){const t=e??this.getActiveDocumentId();this.downloadRequest$.emit({documentId:t})}saveAsCopy(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];return(null==n?void 0:n.document)?this.engine.saveAsCopy(n.document):Wt.reject({code:Ut.DocNotOpen,message:`Document ${t} not found`})}saveAsCopyAndGetBufferAndName(e){const t=new pt,n=this.coreState.core.documents[e];return(null==n?void 0:n.document)?(this.saveAsCopy(e).wait(e=>{t.resolve({buffer:e,name:n.name??this.config.defaultFileName})},e=>t.fail(e)),t):Wt.reject({code:Ut.DocNotOpen,message:`Document ${e} not found`})}onRequest(e){return this.downloadRequest$.on(e)}async initialize(e){this.logger.info("ExportPlugin","Initialize","Export plugin initialized")}async destroy(){this.downloadRequest$.clear(),await super.destroy()}};du.id="export";let uu=du;const hu="export";const mu=uo({manifest:{id:hu,name:"Export Plugin",version:"1.0.0",provides:["export"],requires:[],optional:[],defaultConfig:{defaultFileName:"document.pdf"}},create:(e,t)=>new uu(hu,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{plugin:e}=po(uu.id),t=Te(null);return Pe(()=>{if(!e)return;return e.onRequest(n=>{const o=t.current;if(!o)return;e.saveAsCopyAndGetBufferAndName(n.documentId).wait(({buffer:e,name:t})=>{const n=URL.createObjectURL(new Blob([e]));o.href=n,o.download=t,o.click(),URL.revokeObjectURL(n)},xn)})},[e]),We("a",{style:{display:"none"},ref:t})}).build(),gu="PAN/INIT_STATE",pu="PAN/CLEANUP_STATE",vu="PAN/SET_PAN_MODE";const fu=class extends Xn{constructor(e,t,n){var o,i,r;super(e,t),this.panMode$=so(),this.documentHandlers=new Map,this.config=n,this.interactionManager=null==(o=t.getPlugin(cd.id))?void 0:o.provides(),this.viewport=null==(i=t.getPlugin(Lo.id))?void 0:i.provides(),this.interactionManager&&(this.interactionManager.registerMode({id:"panMode",scope:"global",exclusive:!1,cursor:"grab",wantsRawTouch:!1}),null==(r=this.interactionManager)||r.onModeChange(e=>{const t="panMode"===e.activeMode,n=this.getDocumentState(e.documentId);n&&n.isPanMode!==t&&this.dispatch(function(e,t){return{type:vu,payload:{documentId:e,isPanMode:t}}}(e.documentId,t))}))}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:gu,payload:{documentId:e,state:t}}}(e,{isPanMode:!1})),this.registerPanHandlersForDocument(e),"always"===this.config.defaultMode&&this.makePanDefault(!0),this.logger.debug("PanPlugin","DocumentOpened",`Initialized pan state for document: ${e}`)}onDocumentClosed(e){const t=this.documentHandlers.get(e);t&&(t(),this.documentHandlers.delete(e)),this.dispatch(function(e){return{type:pu,payload:e}}(e)),this.logger.debug("PanPlugin","DocumentClosed",`Cleaned up pan state for document: ${e}`)}buildCapability(){return{enablePan:()=>this.enablePan(),disablePan:()=>this.disablePan(),togglePan:()=>this.togglePan(),makePanDefault:e=>this.makePanDefault(e),isPanMode:()=>this.isPanMode(),forDocument:e=>this.createPanScope(e),onPanModeChange:this.panMode$.on}}createPanScope(e){return{enablePan:()=>this.enablePan(e),disablePan:()=>this.disablePan(e),togglePan:()=>this.togglePan(e),isPanMode:()=>this.isPanMode(e),onPanModeChange:t=>this.panMode$.on(n=>{n.documentId===e&&t(n.isPanMode)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Pan state not found for document: ${e??"active"}`);return t}enablePan(e){const t=e??this.getActiveDocumentId();this.interactionManager.forDocument(t).activate("panMode")}disablePan(e){const t=e??this.getActiveDocumentId();this.interactionManager.forDocument(t).activateDefaultMode()}togglePan(e){const t=e??this.getActiveDocumentId(),n=this.interactionManager.forDocument(t);"panMode"===n.getActiveMode()?n.activateDefaultMode():n.activate("panMode")}makePanDefault(e=!0){this.interactionManager&&(this.interactionManager.setDefaultMode("panMode"),e&&this.interactionManager.activateDefaultMode())}isPanMode(e){return this.getDocumentStateOrThrow(e).isPanMode}registerPanHandlersForDocument(e){if(!this.interactionManager||!this.viewport)return;let t=null;const n=this.interactionManager.forDocument(e),o=this.viewport.forDocument(e),i={onMouseDown:(e,i)=>{const r=o.getMetrics();t={startX:i.clientX,startY:i.clientY,startLeft:r.scrollLeft,startTop:r.scrollTop},n.setCursor("panMode","grabbing",10)},onMouseMove:(e,n)=>{if(!t)return;const i=n.clientX-t.startX,r=n.clientY-t.startY;o.scrollTo({x:t.startLeft-i,y:t.startTop-r})},onMouseUp:()=>{t&&(t=null,n.removeCursor("panMode"))},onMouseLeave:()=>{t&&(t=null,n.removeCursor("panMode"))},onMouseCancel:()=>{t&&(t=null,n.removeCursor("panMode"))}},r=this.interactionManager.registerHandlers({documentId:e,modeId:"panMode",handlers:i});this.documentHandlers.set(e,r)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];(null==o?void 0:o.isPanMode)!==i.isPanMode&&(this.panMode$.emit({documentId:n,isPanMode:i.isPanMode}),this.logger.debug("PanPlugin","PanModeChanged",`Pan mode changed for document ${n}: ${(null==o?void 0:o.isPanMode)??!1} -> ${i.isPanMode}`))}}async initialize(e){this.logger.info("PanPlugin","Initialize","Pan plugin initialized")}async destroy(){this.documentHandlers.forEach(e=>e()),this.documentHandlers.clear(),this.panMode$.clear(),await super.destroy()}};fu.id="pan";let yu=fu;const bu={documents:{},activeDocumentId:null},wu=uo({manifest:{id:"pan",name:"Pan Plugin",version:"1.0.0",provides:["pan"],requires:["interaction-manager","viewport"],optional:[],defaultConfig:{defaultMode:"mobile"}},create:(e,t)=>new yu("pan",e,t),reducer:(e=bu,t)=>{switch(t.type){case gu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case pu:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"PAN/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case vu:{const{documentId:n,isPanMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isPanMode:o}}}:e}default:return e}},initialState:bu}).addUtility(()=>{const{provides:e}=vo(yu.id),{plugin:t}=po(yu.id);return Pe(()=>{var n;if(!e||!t)return;const o=(null==(n=t.config)?void 0:n.defaultMode)??"never",i="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);"mobile"===o&&i&&e.makePanDefault()},[e,t]),null}).build(),xu="capture",Cu={id:xu,name:"Capture Plugin",version:"1.0.0",provides:["capture"],requires:["render"],optional:["interaction-manager"],defaultConfig:{scale:1,imageType:"image/png",withAnnotations:!1}};const Iu="CAPTURE/INIT_STATE",Su="CAPTURE/CLEANUP_STATE",ku="CAPTURE/SET_MARQUEE_CAPTURE_ACTIVE";const Du={isMarqueeCaptureActive:!1},Mu={documents:{},activeDocumentId:null},Pu=class extends Xn{constructor(e,t,n){var o;super(e,t),this.captureArea$=ao(),this.state$=so(),this.config=n,this.renderCapability=this.registry.getPlugin("render").provides(),this.interactionManagerCapability=null==(o=this.registry.getPlugin("interaction-manager"))?void 0:o.provides(),this.interactionManagerCapability&&(this.interactionManagerCapability.registerMode({id:"marqueeCapture",scope:"page",exclusive:!0,cursor:"crosshair"}),this.interactionManagerCapability.onModeChange(e=>{const t="marqueeCapture"===e.activeMode,n=this.getDocumentState(e.documentId);var o;n&&n.isMarqueeCaptureActive!==t&&this.dispatch((o=e.documentId,{type:ku,payload:{documentId:o,isActive:t}}))}))}onDocumentLoadingStarted(e){const t={...Du};this.dispatch(function(e,t){return{type:Iu,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("CapturePlugin","DocumentOpened",`Initialized capture state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:Su,payload:e}}(e)),this.logger.debug("CapturePlugin","DocumentClosed",`Cleaned up capture state for document: ${e}`)}async initialize(e){}buildCapability(){return{captureArea:(e,t)=>this.captureArea(e,t),enableMarqueeCapture:()=>this.enableMarqueeCapture(),disableMarqueeCapture:()=>this.disableMarqueeCapture(),toggleMarqueeCapture:()=>this.toggleMarqueeCapture(),isMarqueeCaptureActive:()=>this.isMarqueeCaptureActive(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createCaptureScope(e),registerMarqueeOnPage:e=>this.registerMarqueeOnPage(e),onCaptureArea:this.captureArea$.on,onStateChange:this.state$.on}}createCaptureScope(e){return{captureArea:(t,n)=>this.captureArea(t,n,e),enableMarqueeCapture:()=>this.enableMarqueeCapture(e),disableMarqueeCapture:()=>this.disableMarqueeCapture(e),toggleMarqueeCapture:()=>this.toggleMarqueeCapture(e),isMarqueeCaptureActive:()=>this.isMarqueeCaptureActive(e),getState:()=>this.getDocumentStateOrThrow(e),onCaptureArea:t=>this.captureArea$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Capture state not found for document: ${e??"active"}`);return t}registerMarqueeOnPage(e){if(!this.interactionManagerCapability)return this.logger.warn("CapturePlugin","MissingDependency","Interaction manager plugin not loaded, marquee capture disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!t||!t.document)return this.logger.warn("CapturePlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("CapturePlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const o=function(e){const{pageSize:t,scale:n,minDragPx:o=5,onPreview:i,onCommit:r}=e;let a=null,s=null;return{onPointerDown:(e,t)=>{var n;a=e,s={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==i||i(s),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!a)return;const n=to(e.x,0,t.width),o=to(e.y,0,t.height);s={origin:{x:Math.min(a.x,n),y:Math.min(a.y,o)},size:{width:Math.abs(n-a.x),height:Math.abs(o-a.y)}},null==i||i(s)},onPointerUp:(e,t)=>{var l;s&&Math.max(s.size.width,s.size.height)*n>o&&(null==r||r(s)),a=null,s=null,null==i||i(null),null==(l=t.releasePointerCapture)||l.call(t)},onPointerCancel:(e,t)=>{var n;a=null,s=null,null==i||i(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,o;this.captureArea(e.pageIndex,t,e.documentId),null==(o=(n=e.callback).onCommit)||o.call(n,t)}});return this.interactionManagerCapability.registerHandlers({documentId:e.documentId,modeId:"marqueeCapture",handlers:o,pageIndex:e.pageIndex})}captureArea(e,t,n){const o=n??this.getActiveDocumentId();this.disableMarqueeCapture(o);this.renderCapability.forDocument(o).renderPageRect({pageIndex:e,rect:t,options:{imageType:this.config.imageType,scaleFactor:this.config.scale,withAnnotations:this.config.withAnnotations||!1}}).wait(n=>{this.captureArea$.emit({documentId:o,pageIndex:e,rect:t,blob:n,imageType:this.config.imageType||"image/png",scale:this.config.scale||1,withAnnotations:this.config.withAnnotations||!1})},xn)}enableMarqueeCapture(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate("marqueeCapture")}disableMarqueeCapture(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activateDefaultMode()}toggleMarqueeCapture(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);"marqueeCapture"===(null==o?void 0:o.getActiveMode())?o.activateDefaultMode():null==o||o.activate("marqueeCapture")}isMarqueeCaptureActive(e){var t;const n=e??this.getActiveDocumentId();return"marqueeCapture"===(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o&&i&&o.isMarqueeCaptureActive!==i.isMarqueeCaptureActive&&this.state$.emit({documentId:n,state:i})}}async destroy(){this.captureArea$.clear(),this.state$.clear(),super.destroy()}};Pu.id="capture";let Au=Pu;const Tu={manifest:Cu,create:(e,t)=>new Au(xu,e,t),reducer:(e=Mu,t)=>{switch(t.type){case Iu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Su:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"CAPTURE/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case ku:{const{documentId:n,isActive:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isMarqueeCaptureActive:o}}}:e}default:return e}},initialState:Mu},zu=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="rgba(33,150,243,0.8)",fill:r="rgba(33,150,243,0.15)"})=>{const{provides:a}=vo(Au.id),s=yo(e),[l,c]=De(null),d=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Pe(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?We("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*d,top:l.origin.y*d,width:l.size.width*d,height:l.size.height*d,border:`1px solid ${i}`,background:r,boxSizing:"border-box"},className:o}):null},Eu="history",_u={id:Eu,name:"History Plugin",version:"1.0.0",provides:["history"],requires:[],optional:[],defaultConfig:{}},Ru="HISTORY/INIT_STATE",Nu="HISTORY/CLEANUP_STATE",Ou="HISTORY/SET_DOCUMENT_STATE",Lu=class extends Xn{constructor(e,t){super(e,t),this.documentHistories=new Map,this.historyChange$=ao()}async initialize(e){this.logger.info("HistoryPlugin","Initialize","History plugin initialized")}onDocumentLoadingStarted(e){this.dispatch((e=>({type:Ru,payload:{documentId:e}}))(e)),this.documentHistories.set(e,{topicHistories:new Map,globalTimeline:[],globalIndex:-1}),this.logger.debug("HistoryPlugin","DocumentOpened",`Initialized history state for document: ${e}`)}onDocumentClosed(e){this.dispatch((e=>({type:Nu,payload:{documentId:e}}))(e)),this.documentHistories.delete(e),this.logger.debug("HistoryPlugin","DocumentClosed",`Cleaned up history state for document: ${e}`)}getDocumentHistoryData(e){const t=e??this.getActiveDocumentId(),n=this.documentHistories.get(t);if(!n)throw new Error(`History data not found for document: ${t}`);return n}getDocumentHistoryState(e){const t=this.documentHistories.get(e);if(!t)throw new Error(`History data not found for document: ${e}`);const n={};return Array.from(t.topicHistories.entries()).forEach(([e,t])=>{n[e]={canUndo:t.currentIndex>-1,canRedo:t.currentIndex<t.commands.length-1}}),{global:{canUndo:t.globalIndex>-1,canRedo:t.globalIndex<t.globalTimeline.length-1},topics:n}}emitHistoryChange(e,t){const n=this.getDocumentHistoryState(e);this.dispatch(((e,t)=>({type:Ou,payload:{documentId:e,state:t}}))(e,n)),this.historyChange$.emit({documentId:e,topic:t,state:n})}register(e,t,n){const o=this.getDocumentHistoryData(n);o.topicHistories.has(t)||o.topicHistories.set(t,{commands:[],currentIndex:-1});const i=o.topicHistories.get(t);i.commands.splice(i.currentIndex+1),i.commands.push(e),i.currentIndex++;const r={command:e,topic:t};o.globalTimeline.splice(o.globalIndex+1),o.globalTimeline.push(r),o.globalIndex++,e.execute(),this.emitHistoryChange(n,t)}undo(e,t){const n=this.getDocumentHistoryData(t);let o;if(e){const t=n.topicHistories.get(e);t&&t.currentIndex>-1&&(t.commands[t.currentIndex].undo(),t.currentIndex--,o=e)}else if(n.globalIndex>-1){const e=n.globalTimeline[n.globalIndex];e.command.undo(),n.topicHistories.get(e.topic).currentIndex--,n.globalIndex--,o=e.topic}o&&this.emitHistoryChange(t,o)}redo(e,t){const n=this.getDocumentHistoryData(t);let o;if(e){const t=n.topicHistories.get(e);t&&t.currentIndex<t.commands.length-1&&(t.currentIndex++,t.commands[t.currentIndex].execute(),o=e)}else if(n.globalIndex<n.globalTimeline.length-1){n.globalIndex++;const e=n.globalTimeline[n.globalIndex];e.command.execute(),n.topicHistories.get(e.topic).currentIndex++,o=e.topic}o&&this.emitHistoryChange(t,o)}canUndo(e,t){const n=this.getDocumentHistoryData(t);if(e){const t=n.topicHistories.get(e);return!!t&&t.currentIndex>-1}return n.globalIndex>-1}canRedo(e,t){const n=this.getDocumentHistoryData(t);if(e){const t=n.topicHistories.get(e);return!!t&&t.currentIndex<t.commands.length-1}return n.globalIndex<n.globalTimeline.length-1}createHistoryScope(e){return{register:(t,n)=>this.register(t,n,e),undo:t=>this.undo(t,e),redo:t=>this.redo(t,e),canUndo:t=>this.canUndo(t,e),canRedo:t=>this.canRedo(t,e),getHistoryState:()=>this.getDocumentHistoryState(e),onHistoryChange:t=>this.historyChange$.on(n=>{n.documentId===e&&t(n.topic)})}}buildCapability(){return{register:(e,t)=>{const n=this.getActiveDocumentId();this.register(e,t,n)},undo:e=>{const t=this.getActiveDocumentId();this.undo(e,t)},redo:e=>{const t=this.getActiveDocumentId();this.redo(e,t)},canUndo:e=>{const t=this.getActiveDocumentId();return this.canUndo(e,t)},canRedo:e=>{const t=this.getActiveDocumentId();return this.canRedo(e,t)},getHistoryState:()=>{const e=this.getActiveDocumentId();return this.getDocumentHistoryState(e)},forDocument:e=>this.createHistoryScope(e),onHistoryChange:this.historyChange$.on}}async destroy(){this.historyChange$.clear(),this.documentHistories.clear(),super.destroy()}};Lu.id="history";let $u=Lu;const Fu={global:{canUndo:!1,canRedo:!1},topics:{}},ju={documents:{},activeDocumentId:null},Hu={manifest:_u,create:e=>new $u(Eu,e),reducer:(e=ju,t)=>{switch(t.type){case Ru:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...Fu}}}}case Nu:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case Ou:{const{documentId:n,state:o}=t.payload;return e.documents[n]?{...e,documents:{...e.documents,[n]:o}}:e}case"HISTORY/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};default:return e}},initialState:ju};var Uu=(e=>(e.MarqueeRedact="marqueeRedact",e.RedactSelection="redactSelection",e))(Uu||{});const Wu="REDACTION/INIT_STATE",Bu="REDACTION/CLEANUP_STATE",qu="START_REDACTION",Gu="END_REDACTION",Vu="ADD_PENDING",Zu="REMOVE_PENDING",Ku="CLEAR_PENDING",Yu="SELECT_PENDING",Xu="DESELECT_PENDING";const Qu=(e,t)=>({type:Vu,payload:{documentId:e,items:t}}),Ju=(e,t,n)=>({type:Zu,payload:{documentId:e,page:t,id:n}}),eh=e=>({type:Ku,payload:e}),th=(e,t)=>({type:qu,payload:{documentId:e,mode:t}});const nh=e=>Object.values(e).reduce((e,t)=>e+t.length,0),oh={isRedacting:!1,activeType:null,pending:{},pendingCount:0,selected:null},ih={documents:{},activeDocumentId:null},rh=class extends Xn{constructor(e,t,n){var o,i,r;super(e,t),this.redactionSelection$=new Map,this.pending$=so(),this.selected$=so(),this.state$=so(),this.events$=so(),this.documentUnsubscribers=new Map,this.config=n,this.selectionCapability=null==(o=this.registry.getPlugin("selection"))?void 0:o.provides(),this.interactionManagerCapability=null==(i=this.registry.getPlugin("interaction-manager"))?void 0:i.provides(),this.interactionManagerCapability&&(this.interactionManagerCapability.registerMode({id:Uu.MarqueeRedact,scope:"page",exclusive:!0,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:Uu.RedactSelection,scope:"page",exclusive:!1})),null==(r=this.interactionManagerCapability)||r.onModeChange(e=>{const t=e.documentId;if(e.activeMode===Uu.RedactSelection)this.dispatch(th(t,Uu.RedactSelection));else if(e.activeMode===Uu.MarqueeRedact)this.dispatch(th(t,Uu.MarqueeRedact));else{const e=this.getDocumentState(t);(null==e?void 0:e.isRedacting)&&this.dispatch((e=>({type:Gu,payload:e}))(t))}})}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Wu,payload:{documentId:e,state:t}}}(e,{...oh})),this.redactionSelection$.set(e,so());const t=[];if(this.selectionCapability){const n=this.selectionCapability.forDocument(e),o=n.onSelectionChange(()=>{const t=this.getDocumentState(e);if(!(null==t?void 0:t.isRedacting))return;const o=n.getFormattedSelection(),i=this.redactionSelection$.get(e);null==i||i.emit(o)}),i=n.onEndSelection(()=>{const t=this.getDocumentState(e);if(!(null==t?void 0:t.isRedacting))return;const o=n.getFormattedSelection().map(e=>({id:bn(),kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects}));this.dispatch(Qu(e,o));const i=this.redactionSelection$.get(e);null==i||i.emit([]),n.clear(),this.emitPendingChange(e),o.length&&this.selectPending(o[o.length-1].page,o[o.length-1].id,e)});t.push(o,i)}this.documentUnsubscribers.set(e,t),this.logger.debug("RedactionPlugin","DocumentOpened",`Initialized redaction state for document: ${e}`)}onDocumentLoaded(e){var t;null==(t=this.selectionCapability)||t.enableForMode(Uu.RedactSelection,e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Bu,payload:e}}(e));const t=this.redactionSelection$.get(e);null==t||t.clear(),this.redactionSelection$.delete(e);const n=this.documentUnsubscribers.get(e);n&&(n.forEach(e=>e()),this.documentUnsubscribers.delete(e)),this.logger.debug("RedactionPlugin","DocumentClosed",`Cleaned up redaction state for document: ${e}`)}async initialize(e){this.logger.info("RedactionPlugin","Initialize","Redaction plugin initialized")}buildCapability(){return{queueCurrentSelectionAsPending:()=>this.queueCurrentSelectionAsPending(),enableMarqueeRedact:()=>this.enableMarqueeRedact(),toggleMarqueeRedact:()=>this.toggleMarqueeRedact(),isMarqueeRedactActive:()=>this.isMarqueeRedactActive(),enableRedactSelection:()=>this.enableRedactSelection(),toggleRedactSelection:()=>this.toggleRedactSelection(),isRedactSelectionActive:()=>this.isRedactSelectionActive(),addPending:e=>this.addPendingItems(e),removePending:(e,t)=>this.removePendingItem(e,t),clearPending:()=>this.clearPendingItems(),commitAllPending:()=>this.commitAllPending(),commitPending:(e,t)=>this.commitPendingOne(e,t),endRedaction:()=>this.endRedactionMode(),startRedaction:()=>this.startRedactionMode(),selectPending:(e,t)=>this.selectPending(e,t),getSelectedPending:()=>this.getSelectedPending(),deselectPending:()=>this.deselectPending(),getState:()=>this.getDocumentStateOrThrow(),forDocument:e=>this.createRedactionScope(e),onPendingChange:this.pending$.on,onSelectedChange:this.selected$.on,onRedactionEvent:this.events$.on,onStateChange:this.state$.on}}createRedactionScope(e){return{queueCurrentSelectionAsPending:()=>this.queueCurrentSelectionAsPending(e),enableMarqueeRedact:()=>this.enableMarqueeRedact(e),toggleMarqueeRedact:()=>this.toggleMarqueeRedact(e),isMarqueeRedactActive:()=>this.isMarqueeRedactActive(e),enableRedactSelection:()=>this.enableRedactSelection(e),toggleRedactSelection:()=>this.toggleRedactSelection(e),isRedactSelectionActive:()=>this.isRedactSelectionActive(e),addPending:t=>this.addPendingItems(t,e),removePending:(t,n)=>this.removePendingItem(t,n,e),clearPending:()=>this.clearPendingItems(e),commitAllPending:()=>this.commitAllPending(e),commitPending:(t,n)=>this.commitPendingOne(t,n,e),endRedaction:()=>this.endRedactionMode(e),startRedaction:()=>this.startRedactionMode(e),selectPending:(t,n)=>this.selectPending(t,n,e),getSelectedPending:()=>this.getSelectedPending(e),deselectPending:()=>this.deselectPending(e),getState:()=>this.getDocumentStateOrThrow(e),onPendingChange:t=>this.pending$.on(n=>{n.documentId===e&&t(n.pending)}),onSelectedChange:t=>this.selected$.on(n=>{n.documentId===e&&t(n.selected)}),onRedactionEvent:t=>this.events$.on(n=>{n.documentId===e&&t(n)}),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)})}}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??null}getDocumentStateOrThrow(e){const t=this.getDocumentState(e);if(!t)throw new Error(`Redaction state not found for document: ${e??"active"}`);return t}addPendingItems(e,t){const n=t??this.getActiveDocumentId();this.dispatch(Qu(n,e)),this.emitPendingChange(n),this.events$.emit({type:"add",documentId:n,items:e})}removePendingItem(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(Ju(o,e,t)),this.emitPendingChange(o),this.events$.emit({type:"remove",documentId:o,page:e,id:t})}clearPendingItems(e){const t=e??this.getActiveDocumentId();this.dispatch(eh(t)),this.emitPendingChange(t),this.events$.emit({type:"clear",documentId:t})}selectPending(e,t,n){var o;const i=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:Yu,payload:{documentId:e,page:t,id:n}}))(i,e,t)),null==(o=this.selectionCapability)||o.forDocument(i).clear(),this.emitSelectedChange(i)}getSelectedPending(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.getDocumentState(n))?void 0:t.selected)??null}deselectPending(e){const t=e??this.getActiveDocumentId();this.dispatch((e=>({type:Xu,payload:e}))(t)),this.emitSelectedChange(t)}enableRedactSelection(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Uu.RedactSelection)}toggleRedactSelection(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);(null==o?void 0:o.getActiveMode())===Uu.RedactSelection?o.activateDefaultMode():null==o||o.activate(Uu.RedactSelection)}isRedactSelectionActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===Uu.RedactSelection}enableMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Uu.MarqueeRedact)}toggleMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);(null==o?void 0:o.getActiveMode())===Uu.MarqueeRedact?o.activateDefaultMode():null==o||o.activate(Uu.MarqueeRedact)}isMarqueeRedactActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===Uu.MarqueeRedact}startRedactionMode(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Uu.RedactSelection)}endRedactionMode(e){var t;const n=e??this.getActiveDocumentId();null==(t=this.interactionManagerCapability)||t.forDocument(n).activateDefaultMode()}onRedactionSelectionChange(e,t){const n=this.redactionSelection$.get(e);return(null==n?void 0:n.on(t))??(()=>{})}registerMarqueeOnPage(e){if(!this.interactionManagerCapability)return this.logger.warn("RedactionPlugin","MissingDependency","Interaction manager plugin not loaded, marquee redaction disabled"),()=>{};const t=this.coreState.core.documents[e.documentId];if(!(null==t?void 0:t.document))return this.logger.warn("RedactionPlugin","DocumentNotFound","Document not found"),()=>{};const n=t.document.pages[e.pageIndex];if(!n)return this.logger.warn("RedactionPlugin","PageNotFound",`Page ${e.pageIndex} not found`),()=>{};const o=function(e){const{pageSize:t,scale:n,minDragPx:o=5,onPreview:i,onCommit:r}=e;let a=null,s=null;return{onPointerDown:(e,t)=>{var n;a=e,s={origin:{x:e.x,y:e.y},size:{width:0,height:0}},null==i||i(s),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{if(!a)return;const n=to(e.x,0,t.width),o=to(e.y,0,t.height);s={origin:{x:Math.min(a.x,n),y:Math.min(a.y,o)},size:{width:Math.abs(n-a.x),height:Math.abs(o-a.y)}},null==i||i(s)},onPointerUp:(e,t)=>{var l;s&&Math.max(s.size.width,s.size.height)*n>o&&(null==r||r(s)),a=null,s=null,null==i||i(null),null==(l=t.releasePointerCapture)||l.call(t)},onPointerCancel:(e,t)=>{var n;a=null,s=null,null==i||i(null),null==(n=t.releasePointerCapture)||n.call(t)}}}({pageSize:n.size,scale:e.scale,onPreview:e.callback.onPreview,onCommit:t=>{var n,o;const i={id:bn(),kind:"area",page:e.pageIndex,rect:t};this.dispatch(Qu(e.documentId,[i])),this.emitPendingChange(e.documentId),null==(o=(n=e.callback).onCommit)||o.call(n,t),this.enableRedactSelection(e.documentId),this.selectPending(e.pageIndex,i.id,e.documentId)}}),i=this.interactionManagerCapability.registerAlways({handlers:{onPointerDown:(t,n)=>{n.target===n.currentTarget&&this.deselectPending(e.documentId)}},scope:{type:"page",documentId:e.documentId,pageIndex:e.pageIndex}}),r=this.interactionManagerCapability.registerHandlers({documentId:e.documentId,modeId:Uu.MarqueeRedact,handlers:o,pageIndex:e.pageIndex});return()=>{i(),r()}}queueCurrentSelectionAsPending(e){const t=e??this.getActiveDocumentId();if(!this.selectionCapability)return Wt.reject({code:Ut.NotFound,message:"[RedactionPlugin] selection plugin required"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Wt.reject({code:Ut.NotFound,message:"Document not found"});const o=this.selectionCapability.forDocument(t),i=o.getFormattedSelection();if(!i.length)return Wt.resolve(!0);const r=bn(),a=i.map(e=>({id:r,kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects}));this.enableRedactSelection(t),this.dispatch(Qu(t,a)),this.emitPendingChange(t);const s=a[a.length-1];this.selectPending(s.page,s.id,t);const l=this.redactionSelection$.get(t);return null==l||l.emit([]),o.clear(),Wt.resolve(!0)}commitPendingOne(e,t,n){const o=n??this.getActiveDocumentId(),i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))return Wt.reject({code:Ut.NotFound,message:"Document not found"});const r=this.getDocumentState(o);if(!r)return Wt.reject({code:Ut.NotFound,message:"Document state not found"});const a=(r.pending[e]??[]).find(e=>e.id===t);if(!a)return Wt.resolve(!0);const s="text"===a.kind?a.rects:[a.rect],l=i.document.pages[e];if(!l)return Wt.reject({code:Ut.NotFound,message:"Page not found"});const c=new pt;return this.engine.redactTextInRects(i.document,l,s,{drawBlackBoxes:this.config.drawBlackBoxes}).wait(()=>{this.dispatch(Ju(o,e,t)),this.emitPendingChange(o),this.dispatchCoreAction(Wn(o,[e])),this.events$.emit({type:"commit",documentId:o,success:!0}),c.resolve(!0)},e=>{this.events$.emit({type:"commit",documentId:o,success:!1,error:e.reason}),c.reject({code:Ut.Unknown,message:"Failed to commit redactions"})}),c}commitAllPending(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Wt.reject({code:Ut.NotFound,message:"Document not found"});const o=this.getDocumentState(t);if(!o)return Wt.reject({code:Ut.NotFound,message:"Document state not found"});const i=new Map;for(const[e,t]of Object.entries(o.pending)){const n=Number(e),o=i.get(n)??[];for(const e of t)"text"===e.kind?o.push(...e.rects):o.push(e.rect);i.set(n,o)}const r=Array.from(i.entries()).filter(([e,t])=>t.length>0).map(([e])=>e),a=[];for(const[e,t]of i){const o=n.document.pages[e];o&&(t.length&&a.push(this.engine.redactTextInRects(n.document,o,t,{drawBlackBoxes:this.config.drawBlackBoxes})))}const s=new pt;return pt.all(a).wait(()=>{this.dispatch(eh(t)),this.dispatchCoreAction(Wn(t,r)),this.emitPendingChange(t),this.events$.emit({type:"commit",documentId:t,success:!0}),s.resolve(!0)},e=>{this.events$.emit({type:"commit",documentId:t,success:!1,error:e.reason}),s.reject({code:Ut.Unknown,message:"Failed to commit redactions"})}),s}emitPendingChange(e){const t=this.getDocumentState(e);t&&this.pending$.emit({documentId:e,pending:t.pending})}emitSelectedChange(e){const t=this.getDocumentState(e);t&&this.selected$.emit({documentId:e,selected:t.selected})}emitStateChange(e){const t=this.getDocumentState(e);t&&this.state$.emit({documentId:e,state:t})}onStoreUpdated(e,t){for(const e in t.documents){t.documents[e]&&(this.emitPendingChange(e),this.emitSelectedChange(e),this.emitStateChange(e))}}async destroy(){this.pending$.clear(),this.selected$.clear(),this.state$.clear(),this.events$.clear(),this.redactionSelection$.forEach(e=>e.clear()),this.redactionSelection$.clear(),this.documentUnsubscribers.forEach(e=>{e.forEach(e=>e())}),this.documentUnsubscribers.clear(),await super.destroy()}};rh.id="redaction";let ah=rh;const sh="redaction",lh={manifest:{id:sh,name:"Redaction Plugin",version:"1.0.0",provides:["redaction"],requires:[],optional:["interaction-manager","selection"],defaultConfig:{drawBlackBoxes:!0}},create:(e,t)=>new ah(sh,e,t),reducer:(e=ih,t)=>{switch(t.type){case Wu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Bu:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case"REDACTION/SET_ACTIVE_DOCUMENT":return{...e,activeDocumentId:t.payload};case Vu:{const{documentId:n,items:o}=t.payload,i=e.documents[n];if(!i)return e;const r={...i.pending};for(const e of o)r[e.page]=(r[e.page]??[]).concat(e);return{...e,documents:{...e.documents,[n]:{...i,pending:r,pendingCount:nh(r)}}}}case Zu:{const{documentId:n,page:o,id:i}=t.payload,r=e.documents[n];if(!r)return e;const a=(r.pending[o]??[]).filter(e=>e.id!==i),s={...r.pending,[o]:a},l=r.selected&&!(r.selected.page===o&&r.selected.id===i);return{...e,documents:{...e.documents,[n]:{...r,pending:s,pendingCount:nh(s),selected:l?r.selected:null}}}}case Ku:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null}}}:e}case Yu:{const{documentId:n,page:o,id:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:{...r,selected:{page:o,id:i}}}}:e}case Xu:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selected:null}}}:e}case qu:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isRedacting:!0,activeType:o}}}:e}case Gu:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null,isRedacting:!1,activeType:null}}}:e}case"SET_ACTIVE_TYPE":{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeType:o}}}:e}default:return e}},initialState:ih},ch=()=>po(ah.id),dh=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i="red",fill:r="transparent"})=>{const{plugin:a}=ch(),s=yo(e),[l,c]=De(null),d=ze(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Pe(()=>{if(a&&e)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?We("div",{style:{position:"absolute",pointerEvents:"none",left:l.origin.x*d,top:l.origin.y*d,width:l.size.width*d,height:l.size.height*d,border:`1px solid ${i}`,background:r,boxSizing:"border-box"},className:o}):null};function uh({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:o,rect:i,scale:r,onClick:a,style:s,...l}){return We(W,{children:o.map((o,c)=>We("div",{onPointerDown:a,onTouchStart:a,style:{position:"absolute",border:n,left:(i?o.origin.x-i.origin.x:o.origin.x)*r,top:(i?o.origin.y-i.origin.y:o.origin.y)*r,width:o.size.width*r,height:o.size.height*r,background:e,opacity:t,pointerEvents:a?"auto":"none",cursor:a?"pointer":"default",zIndex:a?1:void 0,...s},...l},c))})}function hh({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=ch(),[i,r]=De([]),[a,s]=De(null);return Pe(()=>{if(o)return o.onRedactionSelectionChange(e,e=>{const n=e.find(e=>e.pageIndex===t);r((null==n?void 0:n.segmentRects)??[]),s((null==n?void 0:n.rect)??null)})},[o,e,t]),a?We("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:We(uh,{color:"transparent",opacity:1,rects:i,scale:n,border:"1px solid red"})}):null}function mh({documentId:e,pageIndex:t,scale:n,bboxStroke:o="rgba(0,0,0,0.8)",rotation:i=Be.Degree0,selectionMenu:r}){const{provides:a}=vo(ah.id),[s,l]=De([]),[c,d]=De(null);Pe(()=>{if(!a)return;const n=a.forDocument(e),o=n.getState();l(o.pending[t]??[]),d(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>l(e[t]??[])),r=n.onSelectedChange(e=>{d(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[a,e,t]);const u=Ee((n,o)=>{n.stopPropagation(),a&&a.forDocument(e).selectPending(t,o)},[a,e,t]);return s.length?We("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:s.map(e=>{if("area"===e.kind){const a=e.rect;return We(W,{children:[We("div",{style:{position:"absolute",left:a.origin.x*n,top:a.origin.y*n,width:a.size.width*n,height:a.size.height*n,background:"transparent",outline:c===e.id?`1px solid ${o}`:"none",outlineOffset:"2px",border:"1px solid red",pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>u(t,e.id),onTouchStart:t=>u(t,e.id)}),r&&We(Us,{rect:{origin:{x:a.origin.x*n,y:a.origin.y*n},size:{width:a.size.width*n,height:a.size.height*n}},rotation:i,children:n=>r({...n,context:{type:"redaction",item:e,pageIndex:t},selected:c===e.id,placement:{suggestTop:!1}})})]},e.id)}const a=e.rect;return We(W,{children:[We("div",{style:{position:"absolute",left:a.origin.x*n,top:a.origin.y*n,width:a.size.width*n,height:a.size.height*n,background:"transparent",outline:c===e.id?`1px solid ${o}`:"none",outlineOffset:"2px",pointerEvents:"auto",cursor:c===e.id?"pointer":"default"},children:We(uh,{rect:a,rects:e.rects,color:"transparent",border:"1px solid red",scale:n,onClick:t=>u(t,e.id)})}),r&&We(Us,{rect:{origin:{x:a.origin.x*n,y:a.origin.y*n},size:{width:a.size.width*n,height:a.size.height*n}},rotation:i,children:n=>r({...n,context:{type:"redaction",item:e,pageIndex:t},selected:c===e.id,placement:{suggestTop:!1}})})]},e.id)})}):null}const gh=({documentId:e,pageIndex:t,scale:n,rotation:o,selectionMenu:i})=>{const r=yo(e),a=ze(()=>void 0!==n?n:(null==r?void 0:r.scale)??1,[n,null==r?void 0:r.scale]);return We(W,{children:[We(mh,{documentId:e,pageIndex:t,scale:a,rotation:ze(()=>void 0!==o?o:(null==r?void 0:r.rotation)??Be.Degree0,[o,null==r?void 0:r.rotation]),selectionMenu:i}),We(dh,{documentId:e,pageIndex:t,scale:a}),We(hh,{documentId:e,pageIndex:t,scale:a})]})},ph=class extends Xn{constructor(e,t){super(e,t)}async initialize(e){}buildCapability(){return{getAttachments:()=>this.getAttachments(),downloadAttachment:e=>this.downloadAttachment(e),forDocument:e=>this.createAttachmentScope(e)}}createAttachmentScope(e){return{getAttachments:()=>this.getAttachments(e),downloadAttachment:t=>this.downloadAttachment(t,e)}}downloadAttachment(e,t){const n=t??this.getActiveDocumentId(),o=this.coreState.core.documents[n];return(null==o?void 0:o.document)?this.engine.readAttachmentContent(o.document,e):Wt.reject({code:Ut.NotFound,message:`Document ${n} not found`})}getAttachments(e){const t=e??this.getActiveDocumentId(),n=this.coreState.core.documents[t];return(null==n?void 0:n.document)?this.engine.getAttachments(n.document):Wt.reject({code:Ut.NotFound,message:`Document ${t} not found`})}};ph.id="attachment";let vh=ph;const fh="attachment",yh={manifest:{id:fh,name:"Attachment Plugin",version:"1.0.0",provides:["attachment"],requires:[],optional:[],defaultConfig:{}},create:e=>new vh(fh,e),reducer:()=>{},initialState:{}},bh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),wh="-",xh=[],Ch=e=>{const t=kh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Sh(e);const n=e.split(wh),o=""===n[0]&&n.length>1?1:0;return Ih(n,o,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=o[e],i=n[e];return t?i?((e,t)=>{const n=new Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n})(i,t):t:i||xh}return n[e]||xh}}},Ih=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const n=Ih(e,t+1,i);if(n)return n}const r=n.validators;if(null===r)return;const a=0===t?e.join(wh):e.slice(t).join(wh),s=r.length;for(let e=0;e<s;e++){const t=r[e];if(t.validator(a))return t.classGroupId}},Sh=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?"arbitrary.."+o:void 0})(),kh=e=>{const{theme:t,classGroups:n}=e;return Dh(n,t)},Dh=(e,t)=>{const n=bh();for(const o in e){const i=e[o];Mh(i,n,o,t)}return n},Mh=(e,t,n,o)=>{const i=e.length;for(let r=0;r<i;r++){const i=e[r];Ph(i,t,n,o)}},Ph=(e,t,n,o)=>{"string"!=typeof e?"function"!=typeof e?zh(e,t,n,o):Th(e,t,n,o):Ah(e,t,n)},Ah=(e,t,n)=>{(""===e?t:Eh(t,e)).classGroupId=n},Th=(e,t,n,o)=>{_h(e)?Mh(e(o),t,n,o):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},zh=(e,t,n,o)=>{const i=Object.entries(e),r=i.length;for(let e=0;e<r;e++){const[r,a]=i[e];Mh(a,Eh(t,r),n,o)}},Eh=(e,t)=>{let n=e;const o=t.split(wh),i=o.length;for(let e=0;e<i;e++){const t=o[e];let i=n.nextPart.get(t);i||(i=bh(),n.nextPart.set(t,i)),n=i}return n},_h=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Rh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const i=(i,r)=>{n[i]=r,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=o[e])?(i(e,t),t):void 0},set(e,t){e in n?n[e]=t:i(e,t)}}},Nh=[],Oh=(e,t,n,o,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:i}),Lh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=e=>{const t=[];let n,o=0,i=0,r=0;const a=e.length;for(let s=0;s<a;s++){const a=e[s];if(0===o&&0===i){if(":"===a){t.push(e.slice(r,s)),r=s+1;continue}if("/"===a){n=s;continue}}"["===a?o++:"]"===a?o--:"("===a?i++:")"===a&&i--}const s=0===t.length?e:e.slice(r);let l=s,c=!1;s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0);return Oh(t,c,l,n&&n>r?n-r:void 0)};if(t){const e=t+":",n=o;o=t=>t.startsWith(e)?n(t.slice(e.length)):Oh(Nh,!1,t,void 0,!0)}if(n){const e=o;o=t=>n({className:t,parseClassName:e})}return o},$h=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let o=[];for(let i=0;i<e.length;i++){const r=e[i],a="["===r[0],s=t.has(r);a||s?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(r)):o.push(r)}return o.length>0&&(o.sort(),n.push(...o)),n}},Fh=/\s+/,jh=e=>{if("string"==typeof e)return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=jh(e[o]))&&(n&&(n+=" "),n+=t);return n},Hh=(e,...t)=>{let n,o,i,r;const a=e=>{const t=o(e);if(t)return t;const r=((e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i,sortModifiers:r}=t,a=[],s=e.trim().split(Fh);let l="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:m}=n(t);if(c){l=t+(l.length>0?" "+l:l);continue}let g=!!m,p=o(g?h.substring(0,m):h);if(!p){if(!g){l=t+(l.length>0?" "+l:l);continue}if(p=o(h),!p){l=t+(l.length>0?" "+l:l);continue}g=!1}const v=0===d.length?"":1===d.length?d[0]:r(d).join(":"),f=u?v+"!":v,y=f+p;if(a.indexOf(y)>-1)continue;a.push(y);const b=i(p,g);for(let e=0;e<b.length;++e){const t=b[e];a.push(f+t)}l=t+(l.length>0?" "+l:l)}return l})(e,n);return i(e,r),r};return r=s=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:Rh(e.cacheSize),parseClassName:Lh(e),sortModifiers:$h(e),...Ch(e)}))(l),o=n.cache.get,i=n.cache.set,r=a,a(s)},(...e)=>r(((...e)=>{let t,n,o=0,i="";for(;o<e.length;)(t=e[o++])&&(n=jh(t))&&(i&&(i+=" "),i+=n);return i})(...e))},Uh=[],Wh=e=>{const t=t=>t[e]||Uh;return t.isThemeGetter=!0,t},Bh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,qh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gh=/^\d+\/\d+$/,Vh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Kh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Yh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qh=e=>Gh.test(e),Jh=e=>!!e&&!Number.isNaN(Number(e)),em=e=>!!e&&Number.isInteger(Number(e)),tm=e=>e.endsWith("%")&&Jh(e.slice(0,-1)),nm=e=>Vh.test(e),om=()=>!0,im=e=>Zh.test(e)&&!Kh.test(e),rm=()=>!1,am=e=>Yh.test(e),sm=e=>Xh.test(e),lm=e=>!dm(e)&&!vm(e),cm=e=>Im(e,Mm,rm),dm=e=>Bh.test(e),um=e=>Im(e,Pm,im),hm=e=>Im(e,Am,Jh),mm=e=>Im(e,km,rm),gm=e=>Im(e,Dm,sm),pm=e=>Im(e,zm,am),vm=e=>qh.test(e),fm=e=>Sm(e,Pm),ym=e=>Sm(e,Tm),bm=e=>Sm(e,km),wm=e=>Sm(e,Mm),xm=e=>Sm(e,Dm),Cm=e=>Sm(e,zm,!0),Im=(e,t,n)=>{const o=Bh.exec(e);return!!o&&(o[1]?t(o[1]):n(o[2]))},Sm=(e,t,n=!1)=>{const o=qh.exec(e);return!!o&&(o[1]?t(o[1]):n)},km=e=>"position"===e||"percentage"===e,Dm=e=>"image"===e||"url"===e,Mm=e=>"length"===e||"size"===e||"bg-size"===e,Pm=e=>"length"===e,Am=e=>"number"===e,Tm=e=>"family-name"===e,zm=e=>"shadow"===e,Em=Hh(()=>{const e=Wh("color"),t=Wh("font"),n=Wh("text"),o=Wh("font-weight"),i=Wh("tracking"),r=Wh("leading"),a=Wh("breakpoint"),s=Wh("container"),l=Wh("spacing"),c=Wh("radius"),d=Wh("shadow"),u=Wh("inset-shadow"),h=Wh("text-shadow"),m=Wh("drop-shadow"),g=Wh("blur"),p=Wh("perspective"),v=Wh("aspect"),f=Wh("ease"),y=Wh("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",vm,dm],w=()=>[vm,dm,l],x=()=>[Qh,"full","auto",...w()],C=()=>[em,"none","subgrid",vm,dm],I=()=>["auto",{span:["full",em,vm,dm]},em,vm,dm],S=()=>[em,"auto",vm,dm],k=()=>["auto","min","max","fr",vm,dm],D=()=>["auto",...w()],M=()=>[Qh,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],P=()=>[e,vm,dm],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",bm,mm,{position:[vm,dm]}],T=()=>["auto","cover","contain",wm,cm,{size:[vm,dm]}],z=()=>[tm,fm,um],E=()=>["","none","full",c,vm,dm],_=()=>["",Jh,fm,um],R=()=>[Jh,tm,bm,mm],N=()=>["","none",g,vm,dm],O=()=>["none",Jh,vm,dm],L=()=>["none",Jh,vm,dm],$=()=>[Jh,vm,dm],F=()=>[Qh,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[nm],breakpoint:[nm],color:[om],container:[nm],"drop-shadow":[nm],ease:["in","out","in-out"],font:[lm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[nm],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[nm],shadow:[nm],spacing:["px",Jh],text:[nm],"text-shadow":[nm],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Qh,dm,vm,v]}],container:["container"],columns:[{columns:[Jh,dm,vm,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[em,"auto",vm,dm]}],basis:[{basis:[Qh,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Jh,Qh,"auto","initial","none",dm]}],grow:[{grow:["",Jh,vm,dm]}],shrink:[{shrink:["",Jh,vm,dm]}],order:[{order:[em,"first","last","none",vm,dm]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],w:[{w:[s,"screen",...M()]}],"min-w":[{"min-w":[s,"screen","none",...M()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh",...M()]}],"font-size":[{text:["base",n,fm,um]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,vm,hm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",tm,dm]}],"font-family":[{font:[ym,dm,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,vm,dm]}],"line-clamp":[{"line-clamp":[Jh,"none",vm,hm]}],leading:[{leading:[r,...w()]}],"list-image":[{"list-image":["none",vm,dm]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",vm,dm]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Jh,"from-font","auto",vm,um]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Jh,"auto",vm,dm]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",vm,dm]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",vm,dm]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:A()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},em,vm,dm],radial:["",vm,dm],conic:[em,vm,dm]},xm,gm]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:E()}],"rounded-s":[{"rounded-s":E()}],"rounded-e":[{"rounded-e":E()}],"rounded-t":[{"rounded-t":E()}],"rounded-r":[{"rounded-r":E()}],"rounded-b":[{"rounded-b":E()}],"rounded-l":[{"rounded-l":E()}],"rounded-ss":[{"rounded-ss":E()}],"rounded-se":[{"rounded-se":E()}],"rounded-ee":[{"rounded-ee":E()}],"rounded-es":[{"rounded-es":E()}],"rounded-tl":[{"rounded-tl":E()}],"rounded-tr":[{"rounded-tr":E()}],"rounded-br":[{"rounded-br":E()}],"rounded-bl":[{"rounded-bl":E()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Jh,vm,dm]}],"outline-w":[{outline:["",Jh,fm,um]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,Cm,pm]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,Cm,pm]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Jh,um]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,Cm,pm]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Jh,vm,dm]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Jh]}],"mask-image-linear-from-pos":[{"mask-linear-from":R()}],"mask-image-linear-to-pos":[{"mask-linear-to":R()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":R()}],"mask-image-t-to-pos":[{"mask-t-to":R()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":R()}],"mask-image-r-to-pos":[{"mask-r-to":R()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":R()}],"mask-image-b-to-pos":[{"mask-b-to":R()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":R()}],"mask-image-l-to-pos":[{"mask-l-to":R()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":R()}],"mask-image-x-to-pos":[{"mask-x-to":R()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":R()}],"mask-image-y-to-pos":[{"mask-y-to":R()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[vm,dm]}],"mask-image-radial-from-pos":[{"mask-radial-from":R()}],"mask-image-radial-to-pos":[{"mask-radial-to":R()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Jh]}],"mask-image-conic-from-pos":[{"mask-conic-from":R()}],"mask-image-conic-to-pos":[{"mask-conic-to":R()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:A()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",vm,dm]}],filter:[{filter:["","none",vm,dm]}],blur:[{blur:N()}],brightness:[{brightness:[Jh,vm,dm]}],contrast:[{contrast:[Jh,vm,dm]}],"drop-shadow":[{"drop-shadow":["","none",m,Cm,pm]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Jh,vm,dm]}],"hue-rotate":[{"hue-rotate":[Jh,vm,dm]}],invert:[{invert:["",Jh,vm,dm]}],saturate:[{saturate:[Jh,vm,dm]}],sepia:[{sepia:["",Jh,vm,dm]}],"backdrop-filter":[{"backdrop-filter":["","none",vm,dm]}],"backdrop-blur":[{"backdrop-blur":N()}],"backdrop-brightness":[{"backdrop-brightness":[Jh,vm,dm]}],"backdrop-contrast":[{"backdrop-contrast":[Jh,vm,dm]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Jh,vm,dm]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Jh,vm,dm]}],"backdrop-invert":[{"backdrop-invert":["",Jh,vm,dm]}],"backdrop-opacity":[{"backdrop-opacity":[Jh,vm,dm]}],"backdrop-saturate":[{"backdrop-saturate":[Jh,vm,dm]}],"backdrop-sepia":[{"backdrop-sepia":["",Jh,vm,dm]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",vm,dm]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Jh,"initial",vm,dm]}],ease:[{ease:["linear","initial",f,vm,dm]}],delay:[{delay:[Jh,vm,dm]}],animate:[{animate:["none",y,vm,dm]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,vm,dm]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:O()}],"rotate-x":[{"rotate-x":O()}],"rotate-y":[{"rotate-y":O()}],"rotate-z":[{"rotate-z":O()}],scale:[{scale:L()}],"scale-x":[{"scale-x":L()}],"scale-y":[{"scale-y":L()}],"scale-z":[{"scale-z":L()}],"scale-3d":["scale-3d"],skew:[{skew:$()}],"skew-x":[{"skew-x":$()}],"skew-y":[{"skew-y":$()}],transform:[{transform:[vm,dm,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:F()}],"translate-x":[{"translate-x":F()}],"translate-y":[{"translate-y":F()}],"translate-z":[{"translate-z":F()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",vm,dm]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",vm,dm]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Jh,fm,um,hm]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});var _m=["children","onClick","active","disabled","className","anchorRef"];function Rm(e){var t=e.children,n=e.onClick,o=e.active,i=void 0!==o&&o,r=e.disabled,a=void 0!==r&&r,s=e.className,l=void 0===s?"":s,c=e.anchorRef,d=g(e,_m);return H("button",m({ref:c,onClick:n,disabled:a,className:Em("flex h-[32px] w-auto min-w-[32px] items-center justify-center rounded-md p-[5px] transition-colors hover:bg-interactive-hover hover:ring hover:ring-accent cursor-pointer rounded-none px-2 py-1 text-sm hover:bg-transparent border-b-2 hover:border-b-fg-muted hover:ring-transparent",i?"border-b-accent text-accent hover:border-b-accent":"border-b-transparent",a?"cursor-not-allowed opacity-50":"",l)},d),t)}var Nm=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M9 6l6 6l-6 6"}))},Om=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M15 6l-6 6l6 6"}))},Lm=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M6 9l6 6l6 -6"}))},$m=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),H("path",{d:"M21 21l-6 -6"}))},Fm=function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M18 6l-12 12"}),H("path",{d:"M6 6l12 12"}))};var jm={download:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),H("path",{d:"M7 11l5 5l5 -5"}),H("path",{d:"M12 4l0 12"}))},menu:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 8l16 0"}),H("path",{d:"M4 16l16 0"}))},fullscreen:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),H("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),H("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),H("path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2"}))},fullscreenExit:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 8v-2c0 -.551 .223 -1.05 .584 -1.412"}),H("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),H("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),H("path",{d:"M16 20h2c.545 0 1.04 -.218 1.4 -.572"}),H("path",{d:"M3 3l18 18"}))},save:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"}),H("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),H("path",{d:"M14 4l0 4l-6 0l0 -4"}))},print:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M17 17h2a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2h-14a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h2"}),H("path",{d:"M17 9v-4a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v4"}),H("path",{d:"M7 13m0 2a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -2 -2z"}))},settings:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"}),H("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"}))},viewSettings:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),H("path",{d:"M12 10.5v1.5"}),H("path",{d:"M12 16v1.5"}),H("path",{d:"M15.031 12.25l-1.299 .75"}),H("path",{d:"M10.268 15l-1.3 .75"}),H("path",{d:"M15 15.803l-1.285 -.773"}),H("path",{d:"M10.285 12.97l-1.285 -.773"}),H("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),H("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}))},rotateClockwise:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4.05 11a8 8 0 1 1 .5 4m-.5 5v-5h5"}))},rotateCounterClockwise:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M19.95 11a8 8 0 1 0 -.5 4m.5 5v-5h-5"}))},singlePage:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M5 3m0 1a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1z"}))},doublePage:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18"}))},zoomIn:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"}),H("path",{d:"M9 12h6"}),H("path",{d:"M12 9v6"}))},zoomOut:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),H("path",{d:"M9 12l6 0"}))},fitToWidth:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v6"}),H("path",{d:"M10 18h-7"}),H("path",{d:"M21 18h-7"}),H("path",{d:"M6 15l-3 3l3 3"}),H("path",{d:"M18 15l3 3l-3 3"}))},fitToPage:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h6"}),H("path",{d:"M18 14v7"}),H("path",{d:"M18 3v7"}),H("path",{d:"M15 18l3 3l3 -3"}),H("path",{d:"M15 6l3 -3l3 3"}))},chevronRight:Nm,chevronLeft:Om,chevronDown:Lm,search:$m,comment:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M12 11v.01"}),H("path",{d:"M8 11v.01"}),H("path",{d:"M16 11v.01"}),H("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"}))},sidebar:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 18v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"}),H("path",{d:"M14 18v-12a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2z"}))},dots:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),H("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),H("path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}))},vertical:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M8 7l4 -4l4 4"}),H("path",{d:"M8 17l4 4l4 -4"}),H("path",{d:"M12 3l0 18"}))},horizontal:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M7 8l-4 4l4 4"}),H("path",{d:"M17 8l4 4l-4 4"}),H("path",{d:"M3 12l18 0"}))},book:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),H("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),H("path",{d:"M3 6l0 13"}),H("path",{d:"M12 6l0 13"}),H("path",{d:"M21 6l0 13"}))},book2:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12z"}),H("path",{d:"M19 16h-12a2 2 0 0 0 -2 2"}),H("path",{d:"M9 8h6"}))},squares:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M8 10a2 2 0 0 1 2 -2h9a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-9a2 2 0 0 1 -2 -2z"}),H("path",{d:"M16 8v-3a2 2 0 0 0 -2 -2h-9a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h3"}))},listTree:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M9 6h11"}),H("path",{d:"M12 12h8"}),H("path",{d:"M15 18h5"}),H("path",{d:"M5 6v.01"}),H("path",{d:"M8 12v.01"}),H("path",{d:"M11 18v.01"}))},paperclip:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5"}))},copy:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),H("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"}))},underline:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 20h16",stroke:a}),H("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),H("path",{d:"M8 10h8",stroke:"currentColor"}))},squiggly:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),H("path",{d:"M8 10h8",stroke:"currentColor"}),H("path",{d:"M4 20c1.5 -1.5 3.5 -1.5 5 0s3.5 1.5 5 0 3.5 -1.5 5 0",stroke:a}))},strikethrough:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),H("path",{d:"M4 10h16",stroke:a}))},highlight:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("rect",{x:"2",y:"6",width:"20",height:"16",rx:"2",fill:a,stroke:"none"}),H("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),H("path",{d:"M8 10h8",stroke:"currentColor"}))},palette:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"}),H("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),H("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),H("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}))},x:Fm,fileImport:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),H("path",{d:"M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3"}))},hand:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),H("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),H("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),H("path",{d:"M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47"}))},zoomInArea:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M15 13v4"}),H("path",{d:"M13 15h4"}),H("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),H("path",{d:"M22 22l-3 -3"}),H("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),H("path",{d:"M3 11v-1"}),H("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),H("path",{d:"M10 3h1"}),H("path",{d:"M15 3h1a2 2 0 0 1 2 2v1"}))},screenshot:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M7 19a2 2 0 0 1 -2 -2"}),H("path",{d:"M5 13v-2"}),H("path",{d:"M5 7a2 2 0 0 1 2 -2"}),H("path",{d:"M11 5h2"}),H("path",{d:"M17 5a2 2 0 0 1 2 2"}),H("path",{d:"M19 11v2"}),H("path",{d:"M19 17v4"}),H("path",{d:"M21 19h-4"}),H("path",{d:"M13 19h-2"}))},arrowBackUp:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M9 14l-4 -4l4 -4"}),H("path",{d:"M5 10h11a4 4 0 1 1 0 8h-1"}))},arrowForwardUp:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M15 14l4 -4l-4 -4"}),H("path",{d:"M19 10h-11a4 4 0 1 0 0 8h1"}))},trash:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 7l16 0"}),H("path",{d:"M10 11l0 6"}),H("path",{d:"M14 11l0 6"}),H("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),H("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"}))},deviceFloppy:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"}),H("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),H("path",{d:"M14 4l0 4l-6 0l0 -4"}))},pencilMarker:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":i,class:e.className,role:"img","aria-label":e.title},H("path",{d:"m9.109 16.275 8.856-8.097c.812-.743.87-2.014.127-2.826s-2.014-.869-2.826-.127L6.41 13.322l-.127 2.826zM13.79 6.575l2.7 2.952",stroke:"currentColor"}),H("path",{stroke:a,d:"M19.375 20.125c.569.063-4.05-.562-6.412-.437s-4.759 1.229-6.857 1.625c-1.764.687-3.404-.938-1.981-2.5"}))},circle:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.secondaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:void 0===s?"none":s,stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}))},square:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.secondaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:void 0===s?"none":s,stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}))},line:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2.2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M20 4l-16 16"}))},lineArrow:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2.2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M20 4l-16 16"}),H("path",{d:"M16 3h5v5"}))},polygon:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.secondaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:void 0===s?"none":s,stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M13.163 2.168l8.021 5.828c.694 .504 .984 1.397 .719 2.212l-3.064 9.43a1.978 1.978 0 0 1 -1.881 1.367h-9.916a1.978 1.978 0 0 1 -1.881 -1.367l-3.064 -9.43a1.978 1.978 0 0 1 .719 -2.212l8.021 -5.828a1.978 1.978 0 0 1 2.326 0z"}))},zigzag:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{d:"M12 2.4L21.36 11.76L2.64 12.24L12 21.6"}))},text:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M6.5 15.5m-3.5 0a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0"}),H("path",{d:"M14 19v-10.5a3.5 3.5 0 0 1 7 0v10.5"}),H("path",{d:"M14 13h7"}),H("path",{d:"M10 12v7"}))},italic:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M11 5l6 0"}),H("path",{d:"M7 19l6 0"}),H("path",{d:"M14 5l-4 14"}))},bold:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),H("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"}))},alignLeft:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 6l16 0"}),H("path",{d:"M4 12l10 0"}),H("path",{d:"M4 18l14 0"}))},alignCenter:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 6l16 0"}),H("path",{d:"M8 12l8 0"}),H("path",{d:"M6 18l12 0"}))},alignRight:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M4 6l16 0"}),H("path",{d:"M10 12l10 0"}),H("path",{d:"M6 18l14 0"}))},alignTop:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}),H("path",{d:"M11 13h2"}),H("path",{d:"M9 10h6"}),H("path",{d:"M10 7h4"}))},alignMiddle:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}),H("path",{d:"M11 15h2"}),H("path",{d:"M9 12h6"}),H("path",{d:"M10 9h4"}))},alignBottom:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M3 19v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"}),H("path",{d:"M11 17h2"}),H("path",{d:"M9 14h6"}),H("path",{d:"M10 11h4"}))},photo:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M15 8h.01"}),H("path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"}),H("path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"}),H("path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"}))},pointer:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M7.904 17.563a1.2 1.2 0 0 0 2.228 .308l2.09 -3.093l4.907 4.907a1.067 1.067 0 0 0 1.509 0l1.047 -1.047a1.067 1.067 0 0 0 0 -1.509l-4.907 -4.907l3.113 -2.09a1.2 1.2 0 0 0 -.309 -2.228l-13.582 -3.904l3.904 13.563z"}))},redact:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M7 4h10"}),H("path",{d:"M12 4v8"}),H("defs",null,H("clipPath",{id:"stripeClip"},H("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2"}))),H("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2",fill:"none"}),H("g",{"clip-path":"url(#stripeClip)"},H("path",{d:"M-7 24l12 -12"}),H("path",{d:"M-3 24l12 -12"}),H("path",{d:"M1 24l12 -12"}),H("path",{d:"M5 24l12 -12"}),H("path",{d:"M9 24l12 -12"}),H("path",{d:"M13 24l12 -12"}),H("path",{d:"M17 24l12 -12"}),H("path",{d:"M21 24l12 -12"}),H("path",{d:"M25 24l12 -12"})))},redactArea:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M6 20h-1a2 2 0 0 1 -2 -2v-1"}),H("path",{d:"M3 13v-3"}),H("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),H("path",{d:"M10 3h3"}),H("path",{d:"M17 3h1a2 2 0 0 1 2 2v1"}),H("defs",null,H("clipPath",{id:"redactClip"},H("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2"}))),H("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2",fill:"none"}),H("g",{"clip-path":"url(#redactClip)"},H("path",{d:"M-2 24l14 -14"}),H("path",{d:"M2 24l14 -14"}),H("path",{d:"M6 24l14 -14"}),H("path",{d:"M10 24l15 -15"}),H("path",{d:"M14 24l15 -15"}),H("path",{d:"M18 24l15 -15"})))},check:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor;return H("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:void 0===r?"currentColor":r,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},H("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),H("path",{d:"M5 12l5 5l10 -10"}))},file:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.className,l=e.title;return H("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:s,"aria-hidden":!l,role:l?"img":"presentation"},l&&H("title",null,l),H("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),H("polyline",{points:"14 2 14 8 20 8"}))},plus:function(e){var t=e.size,n=void 0===t?24:t,o=e.strokeWidth,i=void 0===o?2:o,r=e.primaryColor,a=void 0===r?"currentColor":r,s=e.className,l=e.title;return H("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:s,"aria-hidden":!l,role:l?"img":"presentation"},l&&H("title",null,l),H("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),H("line",{x1:"5",y1:"12",x2:"19",y2:"12"}))},lock:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return H("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:void 0===o?"":o,style:e.style},H("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),H("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))},alertTriangle:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return H("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:void 0===o?"":o,style:e.style},H("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),H("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),H("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))}},Hm=new Map,Um=/^[MmZzLlHhVvCcSsQqTtAa0-9\s,.\-eE]+$/;function Wm(e){return Um.test(e.trim())}function Bm(e,t){for(var n=function(e){var t,n;return"path"in e?{viewBox:e.viewBox||"0 0 24 24",paths:[{d:e.path,stroke:null!==(t=e.stroke)&&void 0!==t?t:"primary",fill:null!==(n=e.fill)&&void 0!==n?n:"none",strokeWidth:e.strokeWidth}],strokeLinecap:e.strokeLinecap||"round",strokeLinejoin:e.strokeLinejoin||"round",strokeWidth:e.strokeWidth}:{viewBox:e.viewBox||"0 0 24 24",paths:e.paths,strokeLinecap:e.strokeLinecap||"round",strokeLinejoin:e.strokeLinejoin||"round",strokeWidth:e.strokeWidth}}(t),o=0;o<n.paths.length;o++){var i=n.paths[o];if(!i.d||!Wm(i.d))throw new Error('Invalid path data for icon "'.concat(e,'" at path index ').concat(o,". ")+"Path must only contain valid SVG path commands.")}Hm.set(e,n)}function qm(e){for(var t=0,n=Object.entries(e);t<n.length;t++){var o=y(n[t],2);Bm(o[0],o[1])}}function Gm(e,t,n){return e&&"none"!==e?"primary"===e?t:"secondary"===e?n:"currentColor"===e?"currentColor":e:"none"}function Vm(e){var t,n=e.icon,o=e.title,i=e.size,r=void 0===i?24:i,a=e.strokeWidth,s=void 0===a?2:a,l=e.primaryColor,c=void 0===l?"currentColor":l,d=e.secondaryColor,u=void 0===d?"none":d,h=e.className,m=jm[n];if(m)return H(m,{size:r,strokeWidth:s,primaryColor:c,secondaryColor:u,className:h,title:o});if(t=n,Hm.has(t)){var g=function(e){return Hm.get(e)}(n);return function(e,t){var n,o=t.size,i=t.strokeWidth,r=t.primaryColor,a=t.secondaryColor,s=t.className,l=t.title,c=null!==(n=e.strokeWidth)&&void 0!==n?n:i;return H("svg",{width:o,height:o,viewBox:e.viewBox,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,class:s,role:"img","aria-label":l},e.paths.map(function(e,t){var n,o=Gm(e.stroke,r,a),i=Gm(e.fill,r,a),s=null!==(n=e.strokeWidth)&&void 0!==n?n:c;return H("path",{key:t,d:e.d,stroke:o,fill:i,"stroke-width":"none"!==o?s:void 0,opacity:e.opacity})}))}(g,{size:r,strokeWidth:s,primaryColor:c,secondaryColor:u,className:h,title:o})}return console.warn("Icon not found: ".concat(n)),null}var Zm=["id","children","onClick","active","disabled","className","tooltip","elementRef"];function Km(e){var t=e.id,n=e.children,o=e.onClick,i=e.active,r=void 0!==i&&i,a=e.disabled,s=void 0!==a&&a,l=e.className,c=void 0===l?"":l,d=e.tooltip,u=e.elementRef,h=g(e,Zm);return H("button",m({id:t,ref:u,onClick:o,className:"flex h-[32px] w-auto min-w-[32px] items-center justify-center rounded-md p-[5px] transition-colors ".concat(r?"bg-interactive-selected text-accent ring-accent border-none shadow ring":"hover:bg-interactive-hover hover:ring-accent hover:ring"," ").concat(s?"cursor-not-allowed opacity-50 hover:bg-transparent hover:ring-0":"cursor-pointer"," ").concat(c),title:d},h),n)}const Ym=Math.min,Xm=Math.max,Qm=Math.round,Jm=Math.floor,eg=e=>({x:e,y:e}),tg={left:"right",right:"left",bottom:"top",top:"bottom"},ng={start:"end",end:"start"};function og(e,t,n){return Xm(e,Ym(t,n))}function ig(e,t){return"function"==typeof e?e(t):e}function rg(e){return e.split("-")[0]}function ag(e){return e.split("-")[1]}function sg(e){return"x"===e?"y":"x"}function lg(e){return"y"===e?"height":"width"}const cg=new Set(["top","bottom"]);function dg(e){return cg.has(rg(e))?"y":"x"}function ug(e){return sg(dg(e))}function hg(e){return e.replace(/start|end/g,e=>ng[e])}const mg=["left","right"],gg=["right","left"],pg=["top","bottom"],vg=["bottom","top"];function fg(e,t,n,o){const i=ag(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?gg:mg:t?mg:gg;case"left":case"right":return t?pg:vg;default:return[]}}(rg(e),"start"===n,o);return i&&(r=r.map(e=>e+"-"+i),t&&(r=r.concat(r.map(hg)))),r}function yg(e){return e.replace(/left|right|bottom|top/g,e=>tg[e])}function bg(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function wg(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function xg(e,t,n){let{reference:o,floating:i}=e;const r=dg(t),a=ug(t),s=lg(a),l=rg(t),c="y"===r,d=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,h=o[s]/2-i[s]/2;let m;switch(l){case"top":m={x:d,y:o.y-i.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:u};break;case"left":m={x:o.x-i.width,y:u};break;default:m={x:o.x,y:o.y}}switch(ag(t)){case"start":m[a]-=h*(n&&c?-1:1);break;case"end":m[a]+=h*(n&&c?-1:1)}return m}async function Cg(e,t){var n;void 0===t&&(t={});const{x:o,y:i,platform:r,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=ig(t,e),g=bg(m),p=s[h?"floating"===u?"reference":"floating":u],v=wg(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(p)))||n?p:p.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),f="floating"===u?{x:o,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),b=await(null==r.isElement?void 0:r.isElement(y))&&await(null==r.getScale?void 0:r.getScale(y))||{x:1,y:1},w=wg(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:f,offsetParent:y,strategy:l}):f);return{top:(v.top-w.top+g.top)/b.y,bottom:(w.bottom-v.bottom+g.bottom)/b.y,left:(v.left-w.left+g.left)/b.x,right:(w.right-v.right+g.right)/b.x}}const Ig=new Set(["left","top"]);function Sg(){return"undefined"!=typeof window}function kg(e){return Pg(e)?(e.nodeName||"").toLowerCase():"#document"}function Dg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Mg(e){var t;return null==(t=(Pg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Pg(e){return!!Sg()&&(e instanceof Node||e instanceof Dg(e).Node)}function Ag(e){return!!Sg()&&(e instanceof Element||e instanceof Dg(e).Element)}function Tg(e){return!!Sg()&&(e instanceof HTMLElement||e instanceof Dg(e).HTMLElement)}function zg(e){return!(!Sg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Dg(e).ShadowRoot)}const Eg=new Set(["inline","contents"]);function _g(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=qg(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Eg.has(i)}const Rg=new Set(["table","td","th"]);function Ng(e){return Rg.has(kg(e))}const Og=[":popover-open",":modal"];function Lg(e){return Og.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const $g=["transform","translate","scale","rotate","perspective"],Fg=["transform","translate","scale","rotate","perspective","filter"],jg=["paint","layout","strict","content"];function Hg(e){const t=Ug(),n=Ag(e)?qg(e):e;return $g.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Fg.some(e=>(n.willChange||"").includes(e))||jg.some(e=>(n.contain||"").includes(e))}function Ug(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Wg=new Set(["html","body","#document"]);function Bg(e){return Wg.has(kg(e))}function qg(e){return Dg(e).getComputedStyle(e)}function Gg(e){return Ag(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vg(e){if("html"===kg(e))return e;const t=e.assignedSlot||e.parentNode||zg(e)&&e.host||Mg(e);return zg(t)?t.host:t}function Zg(e){const t=Vg(e);return Bg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tg(t)&&_g(t)?t:Zg(t)}function Kg(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Zg(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),a=Dg(i);if(r){const e=Yg(a);return t.concat(a,a.visualViewport||[],_g(i)?i:[],e&&n?Kg(e):[])}return t.concat(i,Kg(i,[],n))}function Yg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xg(e){const t=qg(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=Tg(e),r=i?e.offsetWidth:n,a=i?e.offsetHeight:o,s=Qm(n)!==r||Qm(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function Qg(e){return Ag(e)?e:e.contextElement}function Jg(e){const t=Qg(e);if(!Tg(t))return eg(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=Xg(t);let a=(r?Qm(n.width):n.width)/o,s=(r?Qm(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const ep=eg(0);function tp(e){const t=Dg(e);return Ug()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ep}function np(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=Qg(e);let a=eg(1);t&&(o?Ag(o)&&(a=Jg(o)):a=Jg(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Dg(e))&&t}(r,n,o)?tp(r):eg(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,d=i.width/a.x,u=i.height/a.y;if(r){const e=Dg(r),t=o&&Ag(o)?Dg(o):o;let n=e,i=Yg(n);for(;i&&o&&t!==n;){const e=Jg(i),t=i.getBoundingClientRect(),o=qg(i),r=t.left+(i.clientLeft+parseFloat(o.paddingLeft))*e.x,a=t.top+(i.clientTop+parseFloat(o.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=r,c+=a,n=Dg(i),i=Yg(n)}}return wg({width:d,height:u,x:l,y:c})}function op(e,t){const n=Gg(e).scrollLeft;return t?t.left+n:np(Mg(e)).left+n}function ip(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-op(e,n),y:n.top+t.scrollTop}}const rp=new Set(["absolute","fixed"]);function ap(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Dg(e),o=Mg(e),i=n.visualViewport;let r=o.clientWidth,a=o.clientHeight,s=0,l=0;if(i){r=i.width,a=i.height;const e=Ug();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}const c=op(o);if(c<=0){const e=o.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,a=Math.abs(o.clientWidth-t.clientWidth-i);a<=25&&(r-=a)}else c<=25&&(r+=c);return{width:r,height:a,x:s,y:l}}(e,n);else if("document"===t)o=function(e){const t=Mg(e),n=Gg(e),o=e.ownerDocument.body,i=Xm(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=Xm(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+op(e);const s=-n.scrollTop;return"rtl"===qg(o).direction&&(a+=Xm(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(Mg(e));else if(Ag(t))o=function(e,t){const n=np(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=Tg(e)?Jg(e):eg(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:i*r.x,y:o*r.y}}(t,n);else{const n=tp(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wg(o)}function sp(e,t){const n=Vg(e);return!(n===t||!Ag(n)||Bg(n))&&("fixed"===qg(n).position||sp(n,t))}function lp(e,t,n){const o=Tg(t),i=Mg(t),r="fixed"===n,a=np(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=eg(0);function c(){l.x=op(i)}if(o||!o&&!r)if(("body"!==kg(t)||_g(i))&&(s=Gg(t)),o){const e=np(t,!0,r,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&c();r&&!o&&i&&c();const d=!i||o||r?eg(0):ip(i,s);return{x:a.left+s.scrollLeft-l.x-d.x,y:a.top+s.scrollTop-l.y-d.y,width:a.width,height:a.height}}function cp(e){return"static"===qg(e).position}function dp(e,t){if(!Tg(e)||"fixed"===qg(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Mg(e)===n&&(n=n.ownerDocument.body),n}function up(e,t){const n=Dg(e);if(Lg(e))return n;if(!Tg(e)){let t=Vg(e);for(;t&&!Bg(t);){if(Ag(t)&&!cp(t))return t;t=Vg(t)}return n}let o=dp(e,t);for(;o&&Ng(o)&&cp(o);)o=dp(o,t);return o&&Bg(o)&&cp(o)&&!Hg(o)?n:o||function(e){let t=Vg(e);for(;Tg(t)&&!Bg(t);){if(Hg(t))return t;if(Lg(t))return null;t=Vg(t)}return null}(e)||n}const hp={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,a=Mg(o),s=!!t&&Lg(t.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=eg(1);const d=eg(0),u=Tg(o);if((u||!u&&!r)&&(("body"!==kg(o)||_g(a))&&(l=Gg(o)),Tg(o))){const e=np(o);c=Jg(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const h=!a||u||r?eg(0):ip(a,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+h.x,y:n.y*c.y-l.scrollTop*c.y+d.y+h.y}},getDocumentElement:Mg,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?Lg(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Kg(e,[],!1).filter(e=>Ag(e)&&"body"!==kg(e)),i=null;const r="fixed"===qg(e).position;let a=r?Vg(e):e;for(;Ag(a)&&!Bg(a);){const t=qg(a),n=Hg(a);n||"fixed"!==t.position||(i=null),(r?!n&&!i:!n&&"static"===t.position&&i&&rp.has(i.position)||_g(a)&&!n&&sp(e,a))?o=o.filter(e=>e!==a):i=t,a=Vg(a)}return t.set(e,o),o}(t,this._c):[].concat(n),o],a=r[0],s=r.reduce((e,n)=>{const o=ap(t,n,i);return e.top=Xm(o.top,e.top),e.right=Ym(o.right,e.right),e.bottom=Ym(o.bottom,e.bottom),e.left=Xm(o.left,e.left),e},ap(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:up,getElementRects:async function(e){const t=this.getOffsetParent||up,n=this.getDimensions,o=await n(e.floating);return{reference:lp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Xg(e);return{width:t,height:n}},getScale:Jg,isElement:Ag,isRTL:function(e){return"rtl"===qg(e).direction}};function mp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gp(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=o,c=Qg(e),d=i||r?[...c?Kg(c):[],...Kg(t)]:[];d.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)});const u=c&&s?function(e,t){let n,o=null;const i=Mg(e);function r(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),r();const c=e.getBoundingClientRect(),{left:d,top:u,width:h,height:m}=c;if(s||t(),!h||!m)return;const g={rootMargin:-Jm(u)+"px "+-Jm(i.clientWidth-(d+h))+"px "+-Jm(i.clientHeight-(u+m))+"px "+-Jm(d)+"px",threshold:Xm(0,Ym(1,l))||1};let p=!0;function v(t){const o=t[0].intersectionRatio;if(o!==l){if(!p)return a();o?a(!1,o):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==o||mp(c,e.getBoundingClientRect())||a(),p=!1}try{o=new IntersectionObserver(v,{...g,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(v,g)}o.observe(e)}(!0),r}(c,n):null;let h,m=-1,g=null;a&&(g=new ResizeObserver(e=>{let[o]=e;o&&o.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=g)||e.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let p=l?np(e):null;return l&&function t(){const o=np(e);p&&!mp(p,o)&&n();p=o,h=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{i&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=g)||e.disconnect(),g=null,l&&cancelAnimationFrame(h)}}const pp=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:o,elements:i}=e,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),a=rg(n),s=ag(n),l="y"===dg(n),c=Ig.has(a)?-1:1,d=r&&l?-1:1,u=ig(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof g&&(m="end"===s?-1*g:g),l?{x:m*d,y:h*c}:{x:h*c,y:m*d}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:a}}}}},vp=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ig(e,t),c={x:n,y:o},d=await Cg(t,l),u=dg(rg(i)),h=sg(u);let m=c[h],g=c[u];if(r){const e="y"===h?"bottom":"right";m=og(m+d["y"===h?"top":"left"],m,m-d[e])}if(a){const e="y"===u?"bottom":"right";g=og(g+d["y"===u?"top":"left"],g,g-d[e])}const p=s.fn({...t,[h]:m,[u]:g});return{...p,data:{x:p.x-n,y:p.y-o,enabled:{[h]:r,[u]:a}}}}}},fp=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:r,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...v}=ig(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const f=rg(i),y=dg(s),b=rg(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=h||(b||!p?[yg(s)]:function(e){const t=yg(e);return[hg(e),t,hg(t)]}(s)),C="none"!==g;!h&&C&&x.push(...fg(s,p,g,w));const I=[s,...x],S=await Cg(t,v),k=[];let D=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&k.push(S[f]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=ag(e),i=ug(e),r=lg(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=yg(a)),[a,yg(a)]}(i,a,w);k.push(S[e[0]],S[e[1]])}if(D=[...D,{placement:i,overflows:k}],!k.every(e=>e<=0)){var M,P;const e=((null==(M=r.flip)?void 0:M.index)||0)+1,t=I[e];if(t){if(!("alignment"===u&&y!==dg(t))||D.every(e=>dg(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:D},reset:{placement:t}}}let n=null==(P=D.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(m){case"bestFit":{var A;const e=null==(A=D.filter(e=>{if(C){const t=dg(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:A[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},yp=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=ig(e,t)||{};if(null==c)return{};const u=bg(d),h={x:n,y:o},m=ug(i),g=lg(m),p=await a.getDimensions(c),v="y"===m,f=v?"top":"left",y=v?"bottom":"right",b=v?"clientHeight":"clientWidth",w=r.reference[g]+r.reference[m]-h[m]-r.floating[g],x=h[m]-r.reference[m],C=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let I=C?C[b]:0;I&&await(null==a.isElement?void 0:a.isElement(C))||(I=s.floating[b]||r.floating[g]);const S=w/2-x/2,k=I/2-p[g]/2-1,D=Ym(u[f],k),M=Ym(u[y],k),P=D,A=I-p[g]-M,T=I/2-p[g]/2+S,z=og(P,T,A),E=!l.arrow&&null!=ag(i)&&T!==z&&r.reference[g]/2-(T<P?D:M)-p[g]/2<0,_=E?T<P?T-P:T-A:0;return{[m]:h[m]+_,data:{[m]:z,centerOffset:T-z-_,...E&&{alignmentOffset:_}},reset:E}}}),bp=(e,t,n)=>{const o=new Map,i={platform:hp,...n},r={...i.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:a}=n,s=r.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=xg(c,o,l),h=o,m={},g=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:v,y:f,data:y,reset:b}=await p({x:d,y:u,initialPlacement:o,placement:h,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=f?f:u,m={...m,[r]:{...m[r],...y}},b&&g<=50&&(g++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:d,y:u}=xg(c,h,l))),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:m}})(e,t,{...i,platform:r})};var wp=function(){function e(){return i(this,e),o(this,e,arguments)}return d(e,B),a(e,[{key:"render",value:function(){return this.props.children}}])}();function xp(e){var t=e.children,n=e.content,o=e.position,i=void 0===o?"top":o,r=e.className,a=void 0===r?"":r,s=e.delay,c=void 0===s?200:s,d=e.style,u=void 0===d?"dark":d,h=e.trigger,m=void 0===h?"hover":h,g=Te(null),p=Te(null),v=Te(null),f=y(De(!1),2),b=f[0],w=f[1],x=Te(null);return Pe(function(){var e;if(null!==(e=g.current)&&void 0!==e&&e.base&&p.current)return gp(g.current.base,p.current,function(){bp(g.current.base,p.current,{placement:i,middleware:[pp(8),fp(),vp({padding:8}),yp({element:v.current,padding:6})]}).then(function(e){var t,n=e.x,o=e.y,i=e.placement,r=e.middlewareData;Object.assign(p.current.style,{left:"".concat(n,"px"),top:"".concat(o,"px")});var a=null!==(t=r.arrow)&&void 0!==t?t:{},s=a.x,c=a.y,d={top:"bottom",bottom:"top",left:"right",right:"left"}[i.split("-")[0]];Object.assign(v.current.style,l({left:null!=s?"".concat(s,"px"):"",top:null!=c?"".concat(c,"px"):"",right:"",bottom:""},d,"-4px"))})})},[i,b]),Pe(function(){var e,t=null===(e=g.current)||void 0===e?void 0:e.base,n=p.current;if(t&&n){var o=function(){x.current&&clearTimeout(x.current)},i=function(){o(),x.current=setTimeout(function(){return w(!0)},c)},r=function(){o(),w(!1)},a=function(){return w(function(e){return!e})};return"hover"===m?(t.addEventListener("mouseenter",i),t.addEventListener("mouseleave",r),n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",r),t.addEventListener("pointerdown",r)):"click"===m&&t.addEventListener("click",a),"none"===m&&(x.current&&clearTimeout(x.current),w(!1)),function(){o(),"hover"===m?(t.removeEventListener("mouseenter",i),t.removeEventListener("mouseleave",r),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",r),t.removeEventListener("pointerdown",r)):"click"===m&&t.removeEventListener("click",a)}}},[m,c]),H(W,null,H("div",{ref:p,role:"tooltip",className:"z-100 pointer-events-none absolute select-none whitespace-nowrap rounded-lg px-3 py-2 text-sm shadow-md transition-opacity duration-150 ".concat("dark"===u?"bg-tooltip-bg text-tooltip-fg":"border-border-subtle bg-bg-elevated text-fg-primary border"," ").concat(b?"opacity-100":"opacity-0"," ").concat(a," "),style:{visibility:b?"visible":"hidden"}},n,H("div",{ref:v,className:"absolute h-2 w-2 rotate-45 bg-inherit ".concat("light"===u?"border-border-subtle border":""," ")})),H(wp,{ref:g},t))}function Cp(e){var t=e.commandId,n=e.documentId,o=e.variant,i=void 0===o?"icon":o,r=e.itemId,a=e.className,s=ta(t,n),l=Tr(n,r||t);if(!s||!s.visible)return null;var c=s.iconProps||{};return H(xp,{content:s.label,position:"bottom",delay:500,trigger:s.active?"none":"hover"},H(Km,{elementRef:l,onClick:function(){s.disabled||s.execute()},active:s.active,disabled:s.disabled,className:a||"p-1","aria-label":s.label},"text"===i?H("span",{className:"text-sm"},s.label):"icon-text"===i?H(W,null,s.icon&&H(Vm,{icon:s.icon,className:"mr-2 h-5 w-5",primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}),H("span",null,s.label)):"tab"===i?H("span",{className:"px-3 py-1"},s.label):s.icon?H(Vm,{icon:s.icon,className:Em("h-5 w-5",c.className),primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}):H("span",null,s.label)))}function Ip(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.className,r=void 0===i?"":i;if(!o)return null;var a="secondary"===t.position.slot,s=function(e){switch(e){case"top":return"border-b border-border-default bg-bg-surface px-4 py-2";case"bottom":return"border-t border-border-default bg-bg-surface px-4 py-2";case"left":return"border-r border-border-default bg-bg-surface px-2 py-3 flex-col";case"right":return"border-l border-border-default bg-bg-surface px-2 py-3 flex-col"}}(t.position.placement);return H("div",m({className:Em("flex items-center gap-2",s,a?"bg-bg-surface-alt":"",r)},mr(t)),t.items.map(function(e){return H(Sp,{key:e.id,item:e,documentId:n})}))}function Sp(e){var t=e.item,n=e.documentId;switch(t.type){case"command-button":return H(kp,{item:t,documentId:n});case"tab-group":return H(Dp,{item:t,documentId:n});case"divider":return H(Ap,{item:t});case"spacer":return H(Tp,{item:t});case"group":return H(zp,{item:t,documentId:n});case"custom":return H(Ep,{item:t,documentId:n});default:return console.warn("Unknown toolbar item type:",t),null}}function kp(e){var t=e.item,n=e.documentId;return H("div",m({},mr(t)),H(Cp,{commandId:t.commandId,documentId:n,itemId:t.id,variant:t.variant}))}function Dp(e){var t=e.item,n=e.documentId;return H("div",m(m({className:"flex items-center gap-2"},mr(t)),{},{role:"tablist"}),t.tabs.map(function(e){return H(Mp,{key:e.id,tab:e,documentId:n})}))}function Mp(e){var t=e.tab,n=e.documentId,o=ta(t.commandId,n),i=Tr(n,t.id);if(!o||!o.visible)return null;return H("div",m({},mr(t)),H(Rm,{anchorRef:i,active:o.active,onClick:function(){o.disabled||o.execute()},disabled:o.disabled},"text"===t.variant&&o.label,"icon"===t.variant&&o.icon&&H(Pp,{icon:o.icon,iconProps:o.iconProps}),"icon-text"===t.variant&&H(W,null,o.icon&&H(Pp,{icon:o.icon,iconProps:o.iconProps}),o.label)))}function Pp(e){var t=e.icon,n=e.iconProps;return H(Vm,{icon:t,className:"h-5 w-5",primaryColor:null==n?void 0:n.primaryColor,secondaryColor:null==n?void 0:n.secondaryColor})}function Ap(e){var t=e.item;return H("div",m({},mr(t)),H("div",{className:"vertical"===t.orientation?"bg-border-default h-6 w-px":"bg-border-default h-px w-6","aria-hidden":"true"}))}function Tp(e){var t=e.item;return H("div",m(m({className:t.flex?"flex-1":"w-4"},mr(t)),{},{"aria-hidden":"true"}))}function zp(e){var t=e.item,n=e.documentId,o=t.gap?"gap-".concat(t.gap):"gap-2",i=function(e){switch(e){case"start":default:return"justify-start";case"center":return"justify-center";case"end":return"justify-end"}}(t.alignment);return H("div",m({className:Em("flex items-center",o,i)},mr(t)),t.items.map(function(e){return H(Sp,{key:e.id,item:e,documentId:n})}))}function Ep(e){var t=e.item,n=e.documentId,o=_r().renderCustomComponent;return H("div",m({},mr(t)),o(t.componentId,n,t.props))}function _p(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Rp(e,t){this.props=e,this.context=t}(Rp.prototype=new B).isPureReactComponent=!0,Rp.prototype.shouldComponentUpdate=function(e,t){return _p(this.props,e)||_p(this.state,t)};var Np=S.__b;S.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Np&&Np(e)};var Op=S.__e;S.__e=function(e,t,n,o){if(e.then)for(var i,r=t;r=r.__;)if((i=r.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);Op(e,t,n,o)};var Lp=S.unmount;function $p(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=function(e,t){for(var n in t)e[n]=t[n];return e}({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return $p(e,t,n)})),e}function Fp(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Fp(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function jp(){this.__u=0,this.o=null,this.__b=null}function Hp(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Up(){this.i=null,this.l=null}S.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Lp&&Lp(e)},(jp.prototype=new B).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var i=Hp(o.__v),r=!1,a=function(){r||(r=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Fp(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(a,a)},jp.prototype.componentWillUnmount=function(){this.o=[]},jp.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=$p(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&H(W,null,e.fallback);return i&&(i.__u&=-33),[H(W,null,t.__a?null:e.children),i]};var Wp=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Bp(e){return this.getChildContext=function(){return e.context},e.children}function qp(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){de(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}de(H(Bp,{context:t.context},e.__v),t.v)}function Gp(e,t){var n=H(qp,{__v:e,h:t});return n.containerInfo=t,n}(Up.prototype=new B).__a=function(e){var t=this,n=Hp(t.__v),o=t.l.get(e);return o[0]++,function(i){var r=function(){t.props.revealOrder?(o.push(i),Wp(t,e,o)):i()};n?n(r):r()}},Up.prototype.render=function(e){this.i=null,this.l=new Map;var t=X(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Up.prototype.componentDidUpdate=Up.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Wp(e,n,t)})};var Vp="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Zp=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Kp=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Yp=/[A-Z0-9]/g,Xp="undefined"!=typeof document,Qp=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};B.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(B.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Jp=S.event;function ev(){}function tv(){return this.cancelBubble}function nv(){return this.defaultPrevented}S.event=function(e){return Jp&&(e=Jp(e)),e.persist=ev,e.isPropagationStopped=tv,e.isDefaultPrevented=nv,e.nativeEvent=e};var ov={enumerable:!1,configurable:!0,get:function(){return this.class}},iv=S.vnode;S.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},i=-1===n.indexOf("-");for(var r in t){var a=t[r];if(!("value"===r&&"defaultValue"in t&&null==a||Xp&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===a?a="":"translate"===s&&"no"===a?a=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||Qp(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":Kp.test(r)&&(r=s):s=r="oninput":i&&Zp.test(r)?r=r.replace(Yp,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===s&&o[r=s]&&(r="oninputCapture"),o[r]=a}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=X(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=X(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",ov)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Vp,iv&&iv(e)};var rv=S.__r;S.__r=function(e){rv&&rv(e),e.__c};var av=S.diffed;S.diffed=function(e){av&&av(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};function sv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=Dr().getContainer,a=De(function(){var e=r();return!!e&&e.clientWidth<768}),s=y(a,2),l=s[0],c=s[1];Pe(function(){var e=r();if(e){var t=new ResizeObserver(function(){var t=e.clientWidth;c(t<768)});return t.observe(e),function(){return t.disconnect()}}},[r]);var d=t.position,u=t.content,h=t.width,m=_r().renderCustomComponent,g=r();if(l&&g)return Gp(H(lv,{schema:t,documentId:n,isOpen:o,onClose:i,renderCustomComponent:m,content:u,rootElement:g}),g);if(!o)return null;var p=function(e){switch(e){case"left":return"border-r";case"right":return"border-l";case"top":return"border-b";case"bottom":return"border-t"}}(d.placement),v=h?{width:h}:void 0;return H("div",{className:"".concat(p," border-border-default bg-bg-surface flex flex-col shadow-lg"),style:v,"data-sidebar-id":t.id},H("div",{className:"min-h-0 flex-1"},"tabs"===u.type&&H(cv,{content:u,documentId:n,renderCustomComponent:m}),"component"===u.type&&H(W,null,m(u.componentId,n,{}))))}function lv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.renderCustomComponent,a=e.content,s=e.rootElement,l=y(De("closed"),2),c=l[0],d=l[1],u=y(De(!1),2),h=u[0],m=u[1],g=y(De(0),2),p=g[0],v=g[1],f=y(De(!1),2),b=f[0],w=f[1],x=Te(null),C=Te({y:0,height:0,time:0,state:"half"}),I=Te({y:0,time:0});Pe(function(){if(!o){d("closed");var e=setTimeout(function(){w(!1)},300);return function(){return clearTimeout(e)}}w(!0),requestAnimationFrame(function(){requestAnimationFrame(function(){d("half")})})},[o]);var S=function(e){switch(e){case"closed":return 0;case"half":return 50;case"full":return 100}},k=Ee(function(e){if(x.current){var t,n=s.clientHeight,o=x.current.offsetHeight/n*100;t=o>=75?"full":o<=25?"closed":"half",C.current={y:e,height:o,time:Date.now(),state:t},I.current={y:e,time:Date.now()},v(0),t!==c&&d(t),m(!0)}},[s,c]),D=Ee(function(e){if(h){var t=s.clientHeight,n=(C.current.y-e)/t*100,o=Math.max(0,Math.min(100,C.current.height+n));I.current={y:e,time:Date.now()};var i=S(C.current.state);v(o-i)}},[h,s]),M=Ee(function(){if(h){if(Math.abs(C.current.y-I.current.y)<5)return m(!1),void v(0);var e=S(C.current.state)+p,t=Date.now()-I.current.time,n=I.current.y-C.current.y,o=function(e,t){return Math.abs(t)>.5?t>0?e>50?"half":"closed":e<50?"half":"full":e>=75?"full":e<=25?"closed":"half"}(e,t>0?n/t:0);"closed"===o?(d("closed"),m(!1),v(0),i()):(m(!1),v(0),d(o))}},[h,p,i]),P=Ee(function(e){k(e.touches[0].clientY)},[k]),A=Ee(function(e){h&&(e.cancelable&&e.preventDefault(),D(e.touches[0].clientY))},[h,D]),T=Ee(function(){M()},[M]),z=Ee(function(e){e.preventDefault(),k(e.clientY)},[k]);if(Pe(function(){if(h){var e=function(e){D(e.clientY)},t=function(){M()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[h,D,M]),!b)return null;var E=S(h?C.current.state:c),_=h?Math.max(0,Math.min(100,E+p)):E,R=.3*Math.min(_/50,1);return H(W,null,H("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(0===_?"pointer-events-none":""),style:{opacity:R},onClick:i}),H("div",{ref:x,className:"bg-bg-surface absolute inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl shadow-2xl ".concat(h?"":"transition-[height] duration-300 ease-out"),style:{height:"".concat(_,"%")},"data-sidebar-id":t.id},H("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:P,onTouchMove:A,onTouchEnd:T,onMouseDown:z},H("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),H("div",{className:"min-h-0 flex-1 overflow-hidden"},"tabs"===a.type&&H(cv,{content:a,documentId:n,renderCustomComponent:r}),"component"===a.type&&H(W,null,r(a.componentId,n,{})))))}function cv(e){var t,n=e.content,o=e.documentId,i=e.renderCustomComponent,r=y(De((null===(t=n.tabs[0])||void 0===t?void 0:t.id)||""),2),a=r[0],s=r[1];return H("div",{className:"flex h-full flex-1 flex-col"},H("div",{role:"tablist",className:"bg-bg-surface mx-4 my-4 flex flex-shrink-0 overflow-hidden"},n.tabs.map(function(e,t,n){var o=a===e.id,i=0===t,r=t===n.length-1;return H("button",{key:e.id,role:"tab","aria-selected":o,tabIndex:o?0:-1,onClick:function(){return s(e.id)},className:"relative flex h-7 flex-1 cursor-pointer items-center justify-center border outline-none transition-colors ".concat(i?"rounded-l-md":""," ").concat(r?"rounded-r-md":""," ").concat(r?"":"border-r-0"," ").concat(o?"border-accent bg-accent text-fg-on-accent":"border-border-default text-fg-secondary hover:bg-interactive-hover")},e.icon&&H(Vm,{icon:e.icon,className:"h-5 w-5"}))})),H("div",{className:"min-h-0 flex-1 overflow-auto"},n.tabs.filter(function(e){return e.id===a}).map(function(e){return H(W,{key:e.id},i(e.componentId,o,{}))})))}function dv(e){var t=e.schema,n=e.documentId,o=e.anchorEl,i=e.onClose,r=Dr().getContainer,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:768,n=y(De(function(){var n=e();return!!n&&n.clientWidth<t}),2),o=n[0],i=n[1];return Pe(function(){var n=e();if(n){var o=new ResizeObserver(function(){i(n.clientWidth<t)});return o.observe(n),function(){return o.disconnect()}}},[e,t]),o}(r,768),s=r(),l=(()=>{const{provides:e}=Ir();return(null==e?void 0:e.getSchema())??null})(),c=y(De([{menuId:t.id,schema:t,title:void 0}]),2),d=c[0],u=c[1];Pe(function(){u([{menuId:t.id,schema:t,title:void 0}])},[t]);var h=d[d.length-1],m=Ee(function(e,t){if(l){var n=l.menus[e];n?u(function(o){return[].concat(b(o),[{menuId:e,schema:n,title:t}])}):console.warn("Submenu schema not found: ".concat(e))}},[l]),g=Ee(function(){d.length>1&&u(function(e){return e.slice(0,-1)})},[d.length]);return h?a&&s?Gp(H(uv,{currentMenu:h,menuStack:d,documentId:n,onClose:i,onNavigateBack:g,onNavigateToSubmenu:m,container:s}),s):H(hv,{currentMenu:h,documentId:n,anchorEl:o,onClose:i,onNavigateToSubmenu:m}):null}function uv(e){var t=e.currentMenu,n=e.menuStack,o=e.documentId,i=e.onClose,r=e.onNavigateBack,a=e.onNavigateToSubmenu,s=e.container,l=y(De(!1),2),c=l[0],d=l[1],u=y(De(!1),2),h=u[0],g=u[1],p=y(De(0),2),v=p[0],f=p[1],b=Te(null),w=Te(null),x=Te({isDragging:!1,startY:0,currentY:0,startTime:0,sheetHeight:0});Pe(function(){d(!0),requestAnimationFrame(function(){requestAnimationFrame(function(){g(!0)})})},[]);var C=y(De(null),2),I=C[0],S=C[1];Pe(function(){if(w.current){var e=(n.length>1?60:0)+w.current.scrollHeight+24,t=.8*s.clientHeight;S(Math.min(e,t))}},[t,n.length,s]);var k=Ee(function(){g(!1),setTimeout(function(){d(!1),i()},300)},[i]),D=Ee(function(e){b.current&&(x.current={isDragging:!0,startY:e,currentY:e,startTime:Date.now(),sheetHeight:b.current.offsetHeight})},[]),M=Ee(function(e){if(x.current.isDragging){var t=e-x.current.startY,n=Math.max(0,t);x.current.currentY=e,f(n)}},[]),P=Ee(function(){if(x.current.isDragging){var e=x.current,t=e.startY,n=e.currentY,o=e.startTime,i=e.sheetHeight,r=Math.abs(t-n);if(x.current.isDragging=!1,r<5)f(0);else{var a=n-t,s=a/i*100,l=Date.now()-o;s>30||(l>0?a/l:0)>.5?k():f(0)}}},[k]),A=Ee(function(e){D(e.touches[0].clientY)},[D]),T=Ee(function(e){x.current.isDragging&&e.cancelable&&e.preventDefault(),M(e.touches[0].clientY)},[M]),z=Ee(function(){P()},[P]),E=Ee(function(e){e.preventDefault(),D(e.clientY)},[D]);if(Pe(function(){if(x.current.isDragging){var e=function(e){return M(e.clientY)},t=function(){return P()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[M,P]),Pe(function(){var e=function(e){"Escape"===e.key&&k()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[k]),!c)return null;var _=h?v:I||400;return H(W,null,H("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(h?"opacity-100":"opacity-0"),onClick:k}),H("div",m({ref:b,className:"bg-bg-surface absolute inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl shadow-2xl ".concat(x.current.isDragging?"":"transition-transform duration-300 ease-out"),style:{maxHeight:"80%",transform:"translateY(".concat(_,"px)")}},mr(t.schema)),H("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:A,onTouchMove:T,onTouchEnd:z,onMouseDown:E},H("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),n.length>1&&H("div",{className:"border-border-subtle flex items-center gap-3 border-b px-4 pb-3"},H("button",{onClick:r,className:"hover:bg-interactive-hover rounded-full p-1"},H(Om,{className:"h-5 w-5"})),H("h3",{className:"text-fg-primary font-semibold"},t.title||"Menu")),H("div",{ref:w,className:"flex-1 overflow-y-auto py-2"},t.schema.items.map(function(e){return H(mv,{key:e.id,item:e,documentId:o,onClose:k,isMobile:!0,onNavigateToSubmenu:a})}))))}function hv(e){var t=e.currentMenu,n=e.documentId,o=e.anchorEl,i=e.onClose,r=e.onNavigateToSubmenu,a=Te(null),s=y(De(null),2),l=s[0],c=s[1];Pe(function(){if(o){var e=function(){var e,t=o.getBoundingClientRect(),n=(null===(e=a.current)||void 0===e?void 0:e.offsetWidth)||200,i=t.bottom+4,r=t.left;r+n>window.innerWidth&&(r=window.innerWidth-n-8),r<8&&(r=8),c({top:i,left:r})};return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),function(){window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}},[o]),Pe(function(){var e=function(e){if(a.current){var t=e.composedPath(),n=t.includes(a.current),r=o&&t.includes(o);n||r||i()}},t=setTimeout(function(){document.addEventListener("mousedown",e)},0);return function(){clearTimeout(t),document.removeEventListener("mousedown",e)}},[i,o]),Pe(function(){var e=function(e){"Escape"===e.key&&i()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[i]);var d=l?{position:"fixed",top:"".concat(l.top,"px"),left:"".concat(l.left,"px"),zIndex:1e3}:{display:"none"};return H("div",m(m({ref:a},mr(t.schema)),{},{className:"border-border-default bg-bg-elevated min-w-[200px] rounded-lg border py-2 shadow-lg",style:d}),t.schema.items.map(function(e){return H(mv,{key:e.id,item:e,documentId:n,onClose:i,isMobile:!1,onNavigateToSubmenu:r})}))}function mv(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu;switch(t.type){case"command":return H(gv,{item:t,documentId:n,onClose:o,isMobile:i});case"submenu":return H(pv,{item:t,documentId:n,isMobile:i,onNavigateToSubmenu:r});case"divider":return H("div",m({},mr(t)),H("hr",{className:"border-border-subtle my-2"}));case"section":return H(vv,{item:t,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r});default:return null}}function gv(e){var t,n,o=e.item,i=e.documentId,r=e.onClose,a=e.isMobile,s=ta(o.commandId,i);if(!s||!s.visible)return null;var l,c,d=function(){s.disabled||(s.execute(),r())};return a?H("button",m(m({},mr(o)),{},{onClick:d,disabled:s.disabled,className:"active:bg-interactive-active flex w-full items-center gap-3 px-4 py-3 text-left text-base transition-colors ".concat(s.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"," ").concat(s.active?"bg-interactive-selected text-accent":"text-fg-secondary"),role:"menuitem"}),s.icon&&H(Vm,{icon:s.icon,className:"h-5 w-5",primaryColor:null===(l=s.iconProps)||void 0===l?void 0:l.primaryColor,secondaryColor:null===(c=s.iconProps)||void 0===c?void 0:c.secondaryColor}),H("span",{className:"flex-1"},s.label)):H("button",m(m({},mr(o)),{},{onClick:d,disabled:s.disabled,className:"flex w-full items-center justify-between gap-2 px-4 py-1 text-left ".concat(s.disabled?"pointer-events-none cursor-not-allowed opacity-50":"cursor-pointer"," ").concat(s.active&&!s.disabled?"bg-accent text-fg-on-accent":"text-fg-muted hover:bg-accent hover:text-fg-on-accent"),role:"menuitem"}),H("div",{className:"flex items-center gap-2"},H("div",{className:"flex h-6 w-6 items-center justify-center"},s.icon&&H(Vm,{icon:s.icon,className:"h-6 w-6",primaryColor:null===(t=s.iconProps)||void 0===t?void 0:t.primaryColor,secondaryColor:null===(n=s.iconProps)||void 0===n?void 0:n.secondaryColor})),H("span",{className:"text-sm"},s.label)))}function pv(e){var t=e.item,n=e.documentId,o=e.isMobile,i=e.onNavigateToSubmenu,r=ma(n).translate,a=t.labelKey?r(t.labelKey):t.label||"",s=function(){return i(t.menuId,a)};return o?H("button",m(m({},mr(t)),{},{onClick:s,className:"text-fg-secondary active:bg-interactive-active flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left text-base transition-colors",role:"menuitem"}),H("span",{className:"flex-1"},a),H(Nm,{className:"h-4 w-4"})):H("button",m(m({},mr(t)),{},{onClick:s,className:"text-fg-muted hover:bg-accent hover:text-fg-on-accent flex w-full cursor-pointer items-center justify-between gap-2 px-4 py-1 text-left",role:"menuitem"}),H("span",{className:"text-sm"},a),H(Nm,{className:"h-6 w-6"}))}function vv(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu,a=ma(n).translate,s=t.labelKey?a(t.labelKey):t.label||"";return H("div",m({},mr(t)),H("div",{className:"text-fg-secondary px-4 py-3 text-xs font-medium uppercase"},s),t.items.map(function(e){return H(mv,{key:e.id,item:e,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r})}))}function fv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,a=t.content,s=_r().renderCustomComponent;return"component"!==a.type?(console.warn("SchemaModal only supports component content type, got: ".concat(a.type)),null):H(W,null,s(a.componentId,n,{isOpen:o,onClose:i,onExited:r}))}function yv(e){var t=e.documentId;e.onClose;var n=oi(t),o=n.state,i=n.provides;return H("div",{className:"flex h-full flex-1 flex-col"},H("div",{className:"flex-1 overflow-hidden"},H(kl,{documentId:t,style:{width:"100%",height:"100%"}},function(e){return H("div",{key:e.pageIndex,style:{position:"absolute",width:"100%",height:e.wrapperHeight,top:e.top,display:"flex",flexDirection:"column",alignItems:"center",cursor:"pointer"},onClick:function(){var t;null==i||null===(t=i.scrollToPage)||void 0===t||t.call(i,{pageNumber:e.pageIndex+1})}},H("div",{style:{width:e.width,height:e.height,border:"2px solid ".concat(o.currentPage===e.pageIndex+1?"var(--ep-accent-primary)":"var(--ep-border-default)"),borderRadius:"4px",overflow:"hidden",boxShadow:o.currentPage===e.pageIndex+1?"0 0 0 2px var(--ep-interactive-focus-ring)":"none"}},H(Dl,{documentId:t,meta:e,style:{width:"100%",height:"100%"}})),H("div",{style:{height:e.labelHeight,display:"flex",alignItems:"center",justifyContent:"center",marginTop:"4px"}},H("span",{className:"text-fg-secondary text-xs"},e.pageIndex+1)))})))}function bv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,n=y(De(e),2),o=n[0],i=n[1];return Pe(function(){var n=window.setTimeout(function(){return i(e)},t);return function(){return clearTimeout(n)}},[e,t]),o}var wv=function(e){var t=e.label,n=e.checked,o=e.onChange;return H("label",{className:"text-fg-secondary inline-flex cursor-pointer select-none items-center gap-2 text-xs font-medium"},H("input",{type:"checkbox",checked:n,onChange:function(e){return o(e.target.checked)},className:"border-border-default bg-bg-input checked:border-accent checked:bg-accent peer h-4 w-4 shrink-0 appearance-none rounded-[3px] border transition-all"}),H("svg",{viewBox:"0 0 24 24",className:"/* fine-tune centering */ text-fg-on-accent pointer-events-none absolute h-3.5 w-3.5 translate-x-[1px] translate-y-[1px] opacity-0 peer-checked:opacity-100",fill:"none",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"},H("polyline",{points:"20 6 9 17 4 12"})),t)},xv=function(e){var t=e.hit,n=e.onClick,o=e.active,i=Te(null);return Pe(function(){o&&i.current&&i.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[o]),H("button",{ref:i,onClick:n,className:"w-full rounded border p-2 text-left text-sm transition-colors ".concat(o?"border-accent bg-accent-light text-fg-primary":"border-border-subtle bg-bg-surface text-fg-secondary hover:bg-interactive-hover")},H("span",null,t.context.truncatedLeft&&"… ",t.context.before,H("span",{className:"text-accent font-bold"},t.context.match),t.context.after,t.context.truncatedRight&&" …"))};function Cv(e){var t=e.documentId;e.onClose;var n=(e=>{const{provides:t}=ds(),[n,o]=De(os),i=ze(()=>null==t?void 0:t.forDocument(e),[t,e]);return Pe(()=>{if(i)return o(i.getState()),i.onStateChange(e=>o(e));o(os)},[i]),{state:n,provides:i??null}})(t),o=n.state,i=n.provides,r=ni().provides,a=ma(t).translate,s=Te(null),l=y(De(""),2),c=l[0],d=l[1];Pe(function(){},[]),Pe(function(){o.query&&!c&&d(o.query)},[o.query]),Pe(function(){void 0!==o.activeResultIndex&&o.activeResultIndex>=0&&!o.loading&&m(o.activeResultIndex)});var u=bv(c,300);Pe(function(){u!==o.query&&(null==i||i.searchAllPages(u))},[u,i,o.query]);var h=function(e,t){t?null==i||i.setFlags([].concat(b(o.flags),[e])):null==i||i.setFlags(o.flags.filter(function(t){return t!==e}))},m=function(e){var n,i=o.results[e];if(i){var a=i.rects.reduce(function(e,t){return{x:Math.min(e.x,t.origin.x),y:Math.min(e.y,t.origin.y)}},{x:1/0,y:1/0});null==r||null===(n=r.forDocument(t))||void 0===n||n.scrollToPage({pageNumber:i.pageIndex+1,pageCoordinates:a,alignX:50,alignY:25})}},g=function(e){var t={};return e.forEach(function(e,n){t[e.pageIndex]||(t[e.pageIndex]=[]),t[e.pageIndex].push({hit:e,index:n})}),t}(o.results);return H("div",{className:"bg-bg-surface flex h-full flex-col"},H("div",{className:"p-4"},H("div",{className:"relative"},H("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2"},H($m,{className:"text-fg-muted h-4 w-4"})),H("input",{ref:s,type:"text",placeholder:a("search.placeholder"),value:c,onInput:function(e){var t=e.target;d(t.value)},className:"border-border-default bg-bg-input focus:border-accent focus:ring-accent w-full rounded-md border py-1 pl-8 pr-9 text-sm focus:outline-none focus:ring-1"}),c&&H("div",{className:"absolute inset-y-0 right-0 flex cursor-pointer items-center pr-3",onClick:function(){d(""),s.current&&s.current.focus()}},H(Fm,{className:"text-fg-muted hover:text-fg-secondary h-4 w-4"}))),H("div",{className:"mt-3 flex flex-col gap-2"},H(wv,{label:a("search.caseSensitive"),checked:o.flags.includes(jt.MatchCase),onChange:function(e){return h(jt.MatchCase,e)}}),H(wv,{label:a("search.wholeWord"),checked:o.flags.includes(jt.MatchWholeWord),onChange:function(e){return h(jt.MatchWholeWord,e)}})),H("hr",{className:"border-border-subtle mb-2 mt-5"}),o.active&&H("div",{className:"flex h-[32px] flex-row items-center justify-between"},H("div",{className:"text-fg-muted text-xs"},a("search.resultsFound",{params:{count:o.total}})),o.total>1&&H("div",{className:"flex flex-row"},H(Km,{onClick:function(){null==i||i.previousResult()}},H(Om,{className:"h-4 w-4"})),H(Km,{onClick:function(){null==i||i.nextResult()}},H(Nm,{className:"h-4 w-4"}))))),H("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4"},Object.entries(g).map(function(e){var t=y(e,2),n=t[0],r=t[1];return H("div",{key:n,className:"mt-2 first:mt-0"},H("div",{className:"bg-bg-surface/80 text-fg-muted py-2 text-xs backdrop-blur"},a("search.page",{params:{page:Number(n)+1}})),H("div",{className:"flex flex-col gap-2"},r.map(function(e){var t=e.hit,n=e.index;return H(xv,{key:n,hit:t,active:n===o.activeResultIndex,onClick:function(){null==i||i.goToResult(n)}})})))}),H("div",null)))}function Iv(e){var t=e.documentId,n=vo(lu.id).provides,o=ni().provides,i=ma(t).translate,r=yo(t),a=y(De([]),2),s=a[0],l=a[1],c=y(De(new Set),2),d=c[0],u=c[1];Pe(function(){if(n&&null!=r&&r.document){var e=n.getBookmarks();return e.wait(function(e){var t=e.bookmarks;l(t);var n=t.map(function(e,t){return"bookmark-".concat(t)});u(new Set(n))},xn),function(){e.abort({code:Ut.Cancelled,message:"Bookmark task cancelled"})}}},[n,null==r?void 0:r.document]);var h=function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a="bookmark-".concat(t),s=e.children&&e.children.length>0,l=d.has(a);return H("div",{key:a,className:"select-none"},H("div",{className:"hover:bg-interactive-hover flex cursor-pointer items-center gap-1 px-2 py-1",style:{paddingLeft:"".concat(16*i+8,"px")},onClick:function(){return function(e){if(o&&e.target&&"action"===e.target.type){var t=e.target.action;if(1===t.type&&t.destination){var n=t.destination;if(n.zoom.mode===bt.XYZ){var i,a=null==r||null===(i=r.document)||void 0===i?void 0:i.pages.find(function(e){return e.index===n.pageIndex});if(!a)return;o.scrollToPage({pageNumber:n.pageIndex+1,pageCoordinates:n.zoom.params?{x:n.zoom.params.x,y:a.size.height-n.zoom.params.y}:void 0,behavior:"smooth"})}else n.zoom.mode===bt.FitPage&&o.scrollToPage({pageNumber:n.pageIndex+1,behavior:"smooth"})}}}(e)}},s&&H("button",{onClick:function(e){e.stopPropagation(),function(e){u(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}(a)},className:"flex h-4 w-4 items-center justify-center"},H(l?Lm:Nm,{className:"h-3 w-3"})),!s&&H("div",{className:"w-4"}),H("span",{className:"text-fg-secondary text-sm"},e.title)),s&&l&&H("div",null,null===(n=e.children)||void 0===n?void 0:n.map(function(e,t){return h(e,t,i+1)})))};return null!=r&&r.document?0===s.length?H("div",{className:"flex h-full items-center justify-center p-6"},H("div",{className:"text-fg-muted text-center"},H("div",{className:"text-sm"},i("outline.noOutline")),H("div",{className:"mt-1 text-xs"},i("outline.noBookmarks")))):H("div",{className:"bg-bg-surface flex h-full flex-col"},H("div",{className:"flex-1 overflow-y-auto"},H("div",{className:"outline-tree"},s.map(function(e,t){return h(e,t)})))):H("div",{className:"text-fg-secondary flex h-full flex-col gap-3 p-4 text-sm"},H("div",{className:"text-fg-primary font-medium"},i("outline.title")),H("p",null,i("outline.loading")))}function Sv(e){var t=e.size,n=void 0===t?"md":t,o=e.text,i=e.className,r={sm:"w-6 h-6",md:"w-10 h-10",lg:"w-16 h-16"};return H("div",{className:"flex flex-col items-center justify-center gap-3 ".concat(void 0===i?"":i)},H("div",{className:"relative"},H("div",{className:"".concat(r[n]," border-border-default animate-spin rounded-full border-4")}),H("div",{className:"".concat(r[n]," border-r-accent border-t-accent absolute left-0 top-0 animate-spin rounded-full border-4 border-transparent")})),o&&H("p",{className:"".concat({sm:"text-sm",md:"text-base",lg:"text-lg"}[n]," text-fg-secondary animate-pulse font-medium")},o))}function kv(e){var t=e.size,n=void 0===t?"md":t,o=e.className,i=void 0===o?"":o;return H("div",{className:"".concat({sm:"w-4 h-4 border-2",md:"w-6 h-6 border-2",lg:"w-8 h-8 border-3"}[n]," border-border-default border-t-accent animate-spin rounded-full ").concat(i)})}var Dv,Mv=function(){var e=function(e){const{provides:t}=pd(),[n,o]=De(hd);return Pe(()=>{if(t)return t.forDocument(e).onStateChange(e=>{o(e)})},[t]),{provides:(null==t?void 0:t.forDocument(e))??null,state:n}}().provides,t=y(De({show:!1,mode:null,isAnimating:!1}),2),n=t[0],o=t[1];Pe(function(){if(e)return e.onModeChange(function(e){var t=e.activeMode;if("marqueeZoom"===t||"marqueeCapture"===t){o({show:!0,mode:t,isAnimating:!0});var n=setTimeout(function(){o(function(e){return m(m({},e),{},{show:!1})})},3e3);return function(){return clearTimeout(n)}}o({show:!1,mode:null,isAnimating:!1})})},[e]);if(!n.show&&!n.isAnimating)return null;var i="marqueeZoom"===n.mode?"Drag to select area to zoom":"Drag to select area to capture",r="marqueeZoom"===n.mode?"rgba(33,150,243,0.8)":"rgba(76,175,80,0.8)";return H("div",{className:"hint-overlay ".concat(n.show?"hint-show":"hint-hide"),onAnimationEnd:function(){n.show||o(function(e){return m(m({},e),{},{isAnimating:!1,mode:null})})},style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"20px"}},H("div",{className:"hint-text",style:{background:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 20px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",textAlign:"center",maxWidth:"250px"}},i),H("div",{className:"drag-demo",style:{position:"relative",width:"150px",height:"100px"}},H("div",{style:{position:"absolute",top:"20px",left:"20px",width:"110px",height:"60px",border:"2px dashed ".concat(r),borderRadius:"4px",opacity:.6}}),H("div",{className:"animated-rect",style:{position:"absolute",top:"20px",left:"20px",border:"2px solid ".concat(r),backgroundColor:"".concat(r.replace("0.8","0.15")),borderRadius:"4px"}}),H("div",{className:"cursor-demo",style:{position:"absolute",width:"20px",height:"20px"}},H("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},H("path",{d:"M3.5 2.5L16.5 10L10 11.5L7.5 16.5L3.5 2.5Z",fill:"rgba(0,0,0,0.3)",transform:"translate(1,1)"}),H("path",{d:"M3 2L16 10L10 11.5L7.5 16L3 2Z",fill:"white",stroke:"black",strokeWidth:"1"}),H("path",{d:"M4 3.5L13.5 9.5L9.5 10.5L7.5 14L4 3.5Z",fill:"rgba(255,255,255,0.8)"})))),H("style",{jsx:!0},"\n .hint-overlay {\n animation-duration: 0.3s;\n animation-fill-mode: both;\n }\n\n .hint-show {\n animation-name: hintFadeIn;\n }\n\n .hint-hide {\n animation-name: hintFadeOut;\n }\n\n @keyframes hintFadeIn {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes hintFadeOut {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-10px);\n }\n }\n\n .animated-rect {\n animation: rectGrow 2s ease-in-out infinite;\n }\n\n @keyframes rectGrow {\n 0% {\n width: 0;\n height: 0;\n }\n 50% {\n width: 110px;\n height: 60px;\n }\n 100% {\n width: 110px;\n height: 60px;\n opacity: 0.7;\n }\n }\n\n .cursor-demo {\n animation: cursorMove 2s ease-in-out infinite;\n }\n\n @keyframes cursorMove {\n 0% {\n top: 20px;\n left: 20px;\n }\n 50% {\n top: 50px;\n left: 80px;\n }\n 100% {\n top: 80px;\n left: 130px;\n }\n }\n\n .hint-text {\n animation: textPulse 0.6s ease-in-out;\n }\n\n @keyframes textPulse {\n 0% {\n transform: scale(0.9);\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n }\n }\n "))},Pv=function(e){var t=e.placeholder,n=e.onSubmit,o=e.inputRef,i=e.isFocused,r=y(De(""),2),a=r[0],s=r[1];return H("form",{className:"border-border-subtle mt-4 flex items-end space-x-2 border-t pt-4",onClick:function(e){return e.stopPropagation()},onSubmit:function(e){null==e||e.preventDefault(),a.trim()&&(n(a),s(""))}},H("input",{ref:o,type:"text",placeholder:t,value:a,onInput:function(e){return s(e.currentTarget.value)},className:"bg-bg-input text-fg-primary placeholder-fg-muted w-full rounded-lg border px-3 py-2 text-sm transition-colors focus:border-transparent focus:outline-none focus:ring-2 ".concat(i?"border-accent focus:ring-accent":"border-border-default focus:ring-accent")}),H("button",{type:"submit",disabled:!a.trim(),className:"bg-accent text-fg-on-accent hover:bg-accent-hover disabled:bg-interactive-disabled rounded-lg p-2 transition-colors disabled:cursor-not-allowed"},H("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},H("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"}))))},Av=["bg-red-500","bg-blue-500","bg-green-500","bg-yellow-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-teal-500"],Tv=function(e){if(!e)return Av[0];var t=e.length>0?e.charCodeAt(0)%Av.length:0;return Av[t]},zv=function(e){var t=e.name,n=e.className,o=void 0===n?"":n;return H("div",{className:"flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium text-white ".concat(Tv(t)," ").concat(o)},function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase().slice(0,2):"G"}(t))},Ev=function(e){var t,n,o=e.onEdit,i=e.onDelete,r=e.onClose,a=e.documentId,s=Te(null),l=ma(a).translate;Pe(function(){var e=function(e){t.current&&!t.current.contains(e.target)&&n()};return document.addEventListener("click",e),function(){document.removeEventListener("click",e)}},[t=s,n=r]);return H("div",{ref:s,className:"bg-bg-elevated ring-border-default absolute right-0 top-6 z-10 w-32 rounded-md shadow-lg ring-1"},H("div",{className:"py-1"},H("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),o(),r()},className:"text-fg-secondary hover:bg-interactive-hover block w-full px-4 py-2 text-left text-sm"},l("comments.edit")),H("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),i(),r()},className:"text-state-error hover:bg-interactive-hover block w-full px-4 py-2 text-left text-sm"},l("comments.delete"))))},_v=function(e){var t=e.initialText,n=e.onSave,o=e.onCancel,i=e.autoFocus,r=void 0!==i&&i,a=e.documentId,s=y(De(t),2),l=s[0],c=s[1],d=Te(null),u=ma(a).translate;Pe(function(){r&&d.current&&(d.current.focus(),d.current.setSelectionRange(l.length,l.length))},[r,l.length]);return H("div",{className:"flex-1 space-y-2"},H("textarea",{ref:d,value:l,onInput:function(e){return c(e.currentTarget.value)},className:"border-border-default bg-bg-input text-fg-primary focus:border-accent focus:ring-accent w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1",rows:3}),H("div",{className:"flex flex-wrap gap-2"},H("button",{onClick:function(e){e.stopPropagation(),n(l)},className:"bg-accent text-fg-on-accent hover:bg-accent-hover whitespace-nowrap rounded-md px-3 py-1 text-sm"},u("comments.save")),H("button",{onClick:function(e){e.stopPropagation(),o()},className:"bg-interactive-hover text-fg-secondary hover:bg-border-default whitespace-nowrap rounded-md px-3 py-1 text-sm"},u("comments.cancel"))))},Rv=function(e){if(!e)return"(no date)";try{return(e instanceof Date?e:new Date(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch(t){return"string"==typeof e?e:"(no date)"}},Nv=function(e){var t=e.annotation,n=e.onSave,o=e.onDelete,i=e.isReply,r=void 0!==i&&i,a=e.documentId,s=y(De(!1),2),l=s[0],c=s[1],d=y(De(!1),2),u=d[0],h=d[1],m=t.author||"Guest";return u?H("div",{className:"flex w-full items-start space-x-3",onClick:function(e){return e.stopPropagation()}},r&&H(zv,{name:m,className:"h-8 w-8"}),H(_v,{initialText:t.contents||"",onSave:function(e){n(e),h(!1)},onCancel:function(){h(!1)},autoFocus:!0,documentId:a})):H("div",{className:"flex items-start space-x-3"},r&&H(zv,{name:m,className:"h-8 w-8"}),H("div",{className:"min-w-0 flex-1"},r&&H("div",{className:"flex items-center justify-between"},H("div",{className:"leading-none"},H("h5",{className:"text-fg-primary text-sm font-medium"},m),H("span",{className:"text-fg-muted text-xs"},Rv(t.modified||t.created))),H("div",{className:"relative"},H("button",{onClick:function(e){e.stopPropagation(),c(!0)},className:"text-fg-muted hover:bg-interactive-hover rounded-md p-1"},H("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},H("path",{d:"M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"}))),l&&H(Ev,{onEdit:function(){return h(!0)},onDelete:o,onClose:function(){return c(!1)},documentId:a}))),H("p",{className:"text-fg-primary mt-2 text-sm"},t.contents)))},Ov=(l(l(l(l(l(l(l(l(l(l(Dv={},Mt.HIGHLIGHT,{label:"Highlight",icon:"highlight",iconProps:function(e){return{primaryColor:e.color||"#ffff00"}}}),Mt.CIRCLE,{label:"Circle",icon:"circle",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),Mt.SQUARE,{label:"Square",icon:"square",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),Mt.LINE,{label:"Line",icon:"line",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.UNDERLINE,{label:"Underline",icon:"underline",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Mt.SQUIGGLY,{label:"Squiggly",icon:"squiggly",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Mt.STRIKEOUT,{label:"Strikethrough",icon:"strikethrough",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Mt.INK,{label:"Ink",icon:"pencilMarker",iconProps:function(e){return{primaryColor:e.color||"#000000"}}}),Mt.FREETEXT,{label:"Text",icon:"text",iconProps:function(e){return{primaryColor:e.fontColor||"#000000"}}}),Mt.POLYGON,{label:"Polygon",icon:"polygon",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),l(l(Dv,Mt.POLYLINE,{label:"Polyline",icon:"zigzag",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),Mt.STAMP,{label:"Stamp",icon:"deviceFloppy",iconProps:function(){return{primaryColor:"#dc2626"}}})),Lv=function(e){var t=e.text,n=e.maxWords,o=void 0===n?16:n,i=e.className,r=void 0===i?"":i,a=e.documentId,s=y(De(!1),2),l=s[0],c=s[1],d=ma(a).translate,u=t.split(" ");return u.length>o?H("div",{className:r},l?t:u.slice(0,o).join(" ")+"..."," ",H("button",{onClick:function(e){e.stopPropagation(),c(!l)},className:"text-accent hover:text-accent-hover text-sm font-medium focus:outline-none"},d(l?"comments.showLess":"comments.showMore"))):H("div",{className:r},t)},$v=function(e){var t=e.annotation,n=e.config,o=e.className,i=void 0===o?"":o,r=n.iconProps(t.object);return H("div",{className:"bg-bg-surface-alt flex items-center justify-center rounded-full ".concat(i),title:n.label},H(Vm,m({icon:n.icon},r)))},Fv=function(e){var t,n=e.entry,o=e.isSelected,i=e.onSelect,r=e.onUpdate,a=e.onDelete,s=e.onReply,l=e.documentId,c=n.annotation,d=n.replies,u=y(De(!1),2),h=u[0],m=u[1],g=y(De(!1),2),p=g[0],v=g[1],f=ma(l).translate,b=function(e){return lc(e)?Ov[e.object.type]:null}(c),w=!!c.object.contents,x=d.length>0,C=!w&&!x,I=Te(null),S=c.object.author||"Guest";if(Pe(function(){var e;o&&(null===(e=I.current)||void 0===e||e.focus({preventScroll:!0}))},[o,n]),!b)return null;return H("div",{onClick:i,className:"bg-bg-surface cursor-pointer rounded-lg border shadow-sm transition-all hover:shadow-md ".concat(o?"border-accent ring-interactive-focus-ring ring-2":"border-border-subtle")},H("div",{className:"p-4"},H("div",{className:"flex items-start space-x-3"},H($v,{annotation:c,config:b,className:"h-8 w-8"}),H("div",{className:"min-w-0 flex-1"},H("div",{className:"flex items-center justify-between"},H("div",{className:"leading-none"},H("h4",{className:"text-fg-primary text-sm font-medium"},S),H("span",{className:"text-fg-disabled text-xs"},Rv(c.object.modified||c.object.created))),H("div",{className:"relative"},H("button",{onClick:function(e){e.stopPropagation(),m(!0)},className:"text-fg-disabled hover:bg-interactive-hover hover:text-fg-secondary rounded-md p-1"},H("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},H("path",{d:"M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"}))),h&&H(Ev,{onEdit:function(){return v(!0)},onDelete:function(){return a(c)},onClose:function(){return m(!1)},documentId:l}))),(null===(t=c.object.custom)||void 0===t?void 0:t.text)&&H(Lv,{text:c.object.custom.text,maxWords:14,className:"text-fg-muted mt-2 text-sm",documentId:l}),H("div",{className:"mt-2"},p?H(_v,{initialText:c.object.contents||"",onSave:function(e){r(c.object.id,e),v(!1)},onCancel:function(){v(!1)},autoFocus:!0,documentId:l}):w?H("p",{className:"text-fg-primary text-sm"},c.object.contents):null))),x&&H("div",{className:"border-border-subtle mt-4 space-y-4 border-t pt-4"},d.map(function(e){return H(Nv,{key:e.object.id,annotation:e.object,onSave:function(t){return r(e.object.id,t)},onDelete:function(){return a(e)},isReply:!0,documentId:l})})),!p&&H(Pv,{inputRef:I,isFocused:o,placeholder:f(C?"comments.addComment":"comments.addReply"),onSubmit:function(e){C?r(c.object.id,e):s(c.object.id,e)}})))},jv=function(e){var t=e.documentId,n=ma(t).translate;return H("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},H(Vm,{icon:"comment",className:"h-18 w-18 text-fg-muted"}),H("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("comments.emptyState")))},Hv=function(e){var t=e.documentId,n=Sd().provides,o=kd(t).state,i=ni().provides,r=ma(t).translate,a=Te({}),l=Te(null),c=o.selectedUid?dc(o,o.selectedUid):null,d=(e=>{const t={};for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&sc(n)){const e=n.object.inReplyToId;e&&(t[e]||(t[e]=[])).push(n)}}const n={};for(const[o,i]of Object.entries(e.pages)){const r=Number(o),a=[];for(const n of i){const o=e.byUid[n];o&&lc(o)&&a.push({page:r,annotation:o,replies:t[o.object.id]??[]})}a.length>0&&(n[r]=a)}return n})(o);Pe(function(){if(c&&l.current){var e=a.current[c.object.id];if(e&&l.current){var t=l.current,n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.top-n.top+t.scrollTop-t.clientHeight/2+o.height/2;t.scrollTo({top:i,behavior:"smooth"})}}},[c]);var u=function(e,t){var o=p(e);o&&(null==n||n.updateAnnotation(o.object.pageIndex,e,{contents:t,modified:new Date}))},h=function(e){null==n||n.deleteAnnotation(e.object.pageIndex,e.object.id)},m=function(e,t){var o=p(e);o&&(null==n||n.createAnnotation(o.object.pageIndex,{id:bn(),rect:{origin:{x:o.object.rect.origin.x,y:o.object.rect.origin.y},size:{width:24,height:24}},pageIndex:o.object.pageIndex,created:new Date,modified:new Date,type:Mt.TEXT,contents:t,inReplyToId:o.object.id,flags:["noRotate","noZoom","print"],icon:At.Comment}))},g=Object.keys(d).map(Number).sort(function(e,t){return e-t}),p=function(e){var t,n=s(g);try{for(n.s();!(t=n.n()).done;){var o,i=t.value,r=s(d[i]);try{for(r.s();!(o=r.n()).done;){var a=o.value;if(a.annotation.object.id===e)return a.annotation;var l=a.replies.find(function(t){return t.object.id===e});if(l)return l}}catch(e){r.e(e)}finally{r.f()}}}catch(e){n.e(e)}finally{n.f()}};return 0===g.length?H(jv,{documentId:t}):H("div",{ref:l,className:"h-full overflow-y-auto"},H("div",{className:"space-y-6 p-3"},g.map(function(e){return H("div",{key:e,className:"space-y-3"},H("div",{className:"bg-bg-surface sticky top-0 z-10 px-1"},H("div",{className:"border-border-subtle border-b py-2"},H("h3",{className:"text-md text-fg-primary font-semibold"},r("comments.page",{params:{page:e+1}})),H("p",{className:"text-fg-muted text-sm"},1===d[e].length?r("comments.commentCount",{params:{count:1}}):r("comments.commentCountPlural",{params:{count:d[e].length}})))),H("div",{className:"space-y-3 px-1"},d[e].map(function(e){return H("div",{key:e.annotation.object.id,ref:function(t){t&&(a.current[e.annotation.object.id]=t)}},H(Fv,{entry:e,isSelected:(null==c?void 0:c.object.id)===e.annotation.object.id,onSelect:function(){return t=e.annotation,null==n||n.selectAnnotation(t.object.pageIndex,t.object.id),void(null==i||i.scrollToPage({pageNumber:t.object.pageIndex+1,pageCoordinates:{x:t.object.rect.origin.x,y:t.object.rect.origin.y},alignX:50,alignY:25,behavior:"smooth"}));var t},onUpdate:u,onDelete:h,onReply:m,documentId:t}))})))})))};function Uv(e){var t=e.documentId,n=(e=>{const{provides:t}=Ma(),[n,o]=De(Ca);return Pe(()=>{if(!t)return;const n=t.forDocument(e);return o(n.getState()),n.onStateChange(e=>{o(e)})},[t,e]),{state:n,provides:(null==t?void 0:t.forDocument(e))??null}})(t),o=n.state,i=n.provides,r=y(De(""),2),a=r[0],s=r[1];if(!i)return null;var l=Math.round(100*o.currentZoomLevel);Pe(function(){s(l.toString())},[l]);return H("div",{className:"relative"},H("div",{className:"bg-interactive-hover flex items-center rounded"},H("form",{onSubmit:function(e){e.preventDefault();var t=e.target,n=new FormData(t),o=parseFloat(n.get("zoom")||a);!isNaN(o)&&o>0&&i.requestZoom(o/100)},className:"block"},H("input",{name:"zoom",type:"text",inputMode:"numeric",pattern:"\\d*",className:"h-6 w-8 border-0 bg-transparent p-0 text-right text-sm outline-none focus:outline-none","aria-label":"Set zoom",autoFocus:!1,value:a,onInput:function(e){var t=e.target.value.replace(/[^0-9]/g,"");s(t)},onBlur:function(){(!a||parseFloat(a)<=0)&&s(l.toString())}}),H("span",{className:"text-sm"},"%")),H(Cp,{commandId:"zoom:toggle-menu",documentId:t,itemId:"zoom-menu-button"}),H(Cp,{commandId:"zoom:out",documentId:t}),H(Cp,{commandId:"zoom:in",documentId:t})))}var Wv,Bv=["position"],qv=function(){var e=y(De(!1),2),t=e[0],n=e[1],o=Te(null),i=Te(null);return Pe(function(){if(t){var e=function(e){o.current&&!o.current.contains(e.target)&&n(!1)};return document.addEventListener("click",e),function(){return document.removeEventListener("click",e)}}},[t]),Pe(function(){t&&i.current&&i.current.scrollIntoView({block:"center",inline:"start"})},[t]),{open:t,setOpen:n,rootRef:o,selectedItemRef:i}},Gv=function(e){var t=e.value,n=e.onChange,o=e.options,i=e.getOptionKey,r=e.renderValue,a=e.renderOption,s=e.triggerClass,l=void 0===s?"px-3 py-2":s,c=qv(),d=c.open,u=c.setOpen,h=c.rootRef,m=c.selectedItemRef;return H("div",{ref:h,class:"relative inline-block w-full"},H("button",{type:"button",class:"border-border-default bg-bg-input flex w-full items-center justify-between gap-2 rounded border ".concat(l),onClick:function(){return u(function(e){return!e})}},r(t),H("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},H("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.24a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z",clipRule:"evenodd"}))),d&&H("div",{class:"border-border-default bg-bg-elevated absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded border p-1 shadow-lg"},o.map(function(e){var o=i(e)===i(t);return H("button",{ref:o?m:null,key:i(e),class:"hover:bg-interactive-hover block w-full rounded text-left ".concat(o?"bg-interactive-hover":""),onClick:function(){n(e),u(!1)}},a(e,o))})))},Vv=function(e){var t=e.children,n=e.className;return H("label",{class:"text-fg-primary mb-2 block text-sm font-medium ".concat(void 0===n?"":n)},t)},Zv=function(e){var t=e.children,n=e.className;return H("span",{class:"text-fg-muted text-xs ".concat(void 0===n?"":n)},t)},Kv=function(e){var t=e.children,n=e.className;return H("section",{class:"mb-6 ".concat(void 0===n?"":n)},t)},Yv=function(e){var t=e.value,n=e.min,o=void 0===n?0:n,i=e.max,r=void 0===i?1:i,a=e.step,s=void 0===a?.1:a,l=e.onChange;return H("input",{type:"range",class:"range-sm bg-border-subtle mb-2 h-1 w-full cursor-pointer appearance-none rounded-lg",value:t,min:o,max:r,step:s,onInput:function(e){return l(parseFloat(e.target.value))}})},Xv=function(e){var t=e.color,n=e.active,o=e.onSelect,i=function(e){return"transparent"===e||/^rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*0\s*\)$/i.test(e)||/^#([0-9a-f]{8})$/i.test(e)&&"00"===e.slice(-2).toLowerCase()||/^#([0-9a-f]{4})$/i.test(e)&&"0"===e.slice(-1).toLowerCase()}(t)?{backgroundColor:"#fff",backgroundImage:"linear-gradient(45deg, transparent 40%, red 40%, red 60%, transparent 60%)",backgroundSize:"100% 100%"}:{backgroundColor:t};return H("button",{title:t,class:"border-border-strong h-5 w-5 rounded-full border ".concat(n?"outline-accent outline outline-2 outline-offset-2":""),style:i,onClick:function(){return o(t)}})},Qv=[{id:_t.SOLID},{id:_t.DASHED,dash:[6,2]},{id:_t.DASHED,dash:[8,4]},{id:_t.DASHED,dash:[3,3]},{id:_t.DASHED,dash:[1,2]},{id:_t.DASHED,dash:[4,2,1,2]},{id:_t.DASHED,dash:[8,4,1,4]}],Jv=function(e){return H("svg",{width:"80",height:"8",viewBox:"0 0 80 8"},H("line",{x1:"0",y1:"4",x2:"80",y2:"4",style:{strokeDasharray:null==e?void 0:e.join(" "),stroke:"currentColor",strokeWidth:"2"}}))},ef=function(e){return H(Gv,m(m({},e),{},{options:Qv,getOptionKey:function(e){var t;return e.id+((null===(t=e.dash)||void 0===t?void 0:t.join("-"))||"")},renderValue:function(e){return Jv(e.dash)},renderOption:function(e){return H("div",{class:"px-1 py-2"},Jv(e.dash))}}))},tf=[Tt.None,Tt.Square,Tt.Circle,Tt.Diamond,Tt.OpenArrow,Tt.ClosedArrow,Tt.ROpenArrow,Tt.RClosedArrow,Tt.Butt,Tt.Slash],nf=function(e){var t,n=e.ending,o=e.position,i=l(l(l(l(l(l(l(l(l({},Tt.Square,H("path",{d:"M68 -4 L76 -4 L76 4 L68 4 Z"})),Tt.Circle,H("circle",{cx:"72",cy:"0",r:"4"})),Tt.Diamond,H("path",{d:"M72 -5 L77 0 L72 5 L67 0 Z"})),Tt.OpenArrow,H("path",{d:"M67 -5 L77 0 L67 5",fill:"none"})),Tt.ClosedArrow,H("path",{d:"M67 -5 L77 0 L67 5 Z"})),Tt.ROpenArrow,H("path",{d:"M77 -5 L67 0 L77 5",fill:"none"})),Tt.RClosedArrow,H("path",{d:"M77 -5 L67 0 L77 5 Z"})),Tt.Butt,H("path",{d:"M72 -5 L72 5",fill:"none"})),Tt.Slash,H("path",{d:"M67 -5 L77 5",fill:"none"})),r=l(l(l(l(l(l(l(l(l({},Tt.Square,68),Tt.Circle,68),Tt.Diamond,67),Tt.OpenArrow,76),Tt.ClosedArrow,67),Tt.ROpenArrow,67),Tt.RClosedArrow,67),Tt.Butt,72),Tt.Slash,72),a=i[n];return H("svg",{width:"80",height:"20",viewBox:"0 0 80 20",class:"text-fg-primary"},H("g",{transform:"start"===o?"rotate(180 40 10)":""},H("line",{x1:"4",y1:"10",x2:null!==(t=r[n])&&void 0!==t?t:77,y2:"10",stroke:"currentColor","stroke-width":"1.5"}),a&&H("g",{transform:"translate(0, 10)",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5"},a)))},of=function(e){var t=e.position,n=g(e,Bv);return H(Gv,m(m({},n),{},{options:tf,getOptionKey:function(e){return e},triggerClass:"px-3 py-1",renderValue:function(e){return H(nf,{ending:e,position:t})},renderOption:function(e){return H("div",{class:"px-1 py-1"},H(nf,{ending:e,position:t}))}}))},rf=function(e){return H(Gv,m(m({},e),{},{options:dn,getOptionKey:function(e){return e},triggerClass:"px-2 py-1 text-sm",renderValue:function(e){return H("span",null,un(e))},renderOption:function(e){return H("div",{class:"px-2 py-1"},un(e))}}))},af=function(e){var t=e.value,n=e.onChange,o=e.options,i=void 0===o?[8,9,10,11,12,14,16,18,24,36,48,72]:o,r=qv(),a=r.open,s=r.setOpen,l=r.rootRef,c=r.selectedItemRef;return H("div",{ref:l,class:"relative w-full"},H("input",{type:"number",min:"1",class:"border-border-default bg-bg-input w-full rounded border px-2 py-1 pr-7 text-sm",value:t,onInput:function(e){var t=parseInt(e.target.value,10);Number.isFinite(t)&&t>0&&n(t)},onClick:function(){return s(!0)}}),H("button",{type:"button",class:"absolute inset-y-0 right-1 flex items-center",onClick:function(){return s(function(e){return!e})},tabIndex:-1},H("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},H("path",{"fill-rule":"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.24a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z","clip-rule":"evenodd"}))),a&&H("div",{class:"border-border-default bg-bg-elevated absolute z-10 mt-1 max-h-48 w-full overflow-y-auto rounded border shadow-lg"},i.map(function(e){var o=e===t;return H("button",{ref:o?c:null,key:e,class:"hover:bg-interactive-hover block w-full px-2 py-1 text-left text-sm ".concat(o?"bg-interactive-hover":""),onClick:function(){n(e),s(!1)}},e)})))},sf=(l(l(l(l(l(l(l(l(l(l(Wv={},St.Normal,"blendMode.normal"),St.Multiply,"blendMode.multiply"),St.Screen,"blendMode.screen"),St.Overlay,"blendMode.overlay"),St.Darken,"blendMode.darken"),St.Lighten,"blendMode.lighten"),St.ColorDodge,"blendMode.colorDodge"),St.ColorBurn,"blendMode.colorBurn"),St.HardLight,"blendMode.hardLight"),St.SoftLight,"blendMode.softLight"),l(l(l(l(l(l(Wv,St.Difference,"blendMode.difference"),St.Exclusion,"blendMode.exclusion"),St.Hue,"blendMode.hue"),St.Saturation,"blendMode.saturation"),St.Color,"blendMode.color"),St.Luminosity,"blendMode.luminosity")),lf=function(e){var t,n,o,i,r=e.documentId,a=e.selected,s=e.activeTool,l=e.colorPresets,c=Sd().provides,d=ma(r).translate;if(!c)return null;var u=null==a?void 0:a.object,h=null==s?void 0:s.defaults,m=!!u,g=m?u.color:null!==(t=null==h?void 0:h.color)&&void 0!==t?t:"#FFFF00",p=m?u.opacity:null!==(n=null==h?void 0:h.opacity)&&void 0!==n?n:1,v=m?null!==(o=u.blendMode)&&void 0!==o?o:St.Normal:null!==(i=null==h?void 0:h.blendMode)&&void 0!==i?i:St.Normal,f=y(De(g),2),b=f[0],w=f[1],x=y(De(p),2),C=x[0],I=x[1],S=y(De(v),2),k=S[0],D=S[1];Pe(function(){return w(g)},[g]),Pe(function(){return I(p)},[p]),Pe(function(){return D(v)},[v]);var M=bv(C,300);Pe(function(){return A({opacity:M})},[M]);var P=function(e){w(e),A({color:e})};function A(e){c&&(m?c.updateAnnotation(u.pageIndex,u.id,e):s&&c.setToolDefaults(s.id,e))}return H(W,null,H(Kv,null,H(Vv,{className:"mb-3"},d("annotation.color")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},l.map(function(e){return H(Xv,{key:e,color:e,active:e===b,onSelect:P})}))),H(Kv,null,H(Vv,null,d("annotation.opacity")),H(Yv,{value:C,min:.1,max:1,step:.05,onChange:I}),H(Zv,null,Math.round(100*C),"%")),H(Kv,null,H(Vv,null,d("annotation.blendMode")),H("select",{class:"border-border-default bg-bg-input text-fg-primary w-full rounded border px-2 py-1 text-sm",value:k,onChange:function(e){return t=parseInt(e.target.value,10),D(n=t),void A({blendMode:n});var t,n}},pn.map(function(e){return H("option",{key:e,value:e},d(sf[e]))}))))},cf=function(e){var t,n,o,i,r,a=e.documentId,s=e.selected,l=e.activeTool,c=e.colorPresets,d=Sd().provides,u=ma(a).translate;if(!d)return null;var h=null==s?void 0:s.object,m=null==l?void 0:l.defaults,g=!!h,p=g?h.color:null!==(t=null==m?void 0:m.color)&&void 0!==t?t:"#000000",v=g?h.strokeColor:null!==(n=null==m?void 0:m.strokeColor)&&void 0!==n?n:"#000000",f=g?h.opacity:null!==(o=null==m?void 0:m.opacity)&&void 0!==o?o:1,b=g?h.strokeWidth:null!==(i=null==m?void 0:m.strokeWidth)&&void 0!==i?i:2,w=g?{id:h.strokeStyle,dash:h.strokeDashArray}:{id:null!==(r=null==m?void 0:m.strokeStyle)&&void 0!==r?r:_t.SOLID,dash:null==m?void 0:m.strokeDashArray},x=y(De(p),2),C=x[0],I=x[1],S=y(De(v),2),k=S[0],D=S[1],M=y(De(f),2),P=M[0],A=M[1],T=y(De(b),2),z=T[0],E=T[1],_=y(De(w),2),R=_[0],N=_[1];Pe(function(){return I(p)},[p]),Pe(function(){return D(v)},[v]),Pe(function(){return A(f)},[f]),Pe(function(){return E(b)},[b]),Pe(function(){return N(w)},[w]);var O=bv(P,300),L=bv(z,300);Pe(function(){return j({opacity:O})},[O]),Pe(function(){return j({strokeWidth:L})},[L]);var $=function(e){I(e),j({color:e})},F=function(e){D(e),j({strokeColor:e})};function j(e){d&&(g?d.updateAnnotation(h.pageIndex,h.id,e):l&&d.setToolDefaults(l.id,e))}return H(W,null,H(Kv,null,H(Vv,{className:"mb-3"},u("annotation.fillColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return H(Xv,{key:e,color:e,active:e===C,onSelect:$})}),H(Xv,{color:"transparent",active:"transparent"===C,onSelect:$}))),H(Kv,null,H(Vv,null,u("annotation.opacity")),H(Yv,{value:P,min:.1,max:1,step:.05,onChange:A}),H(Zv,null,Math.round(100*P),"%")),H(Kv,null,H(Vv,{className:"mb-3"},u("annotation.strokeColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return H(Xv,{key:e,color:e,active:e===k,onSelect:F})}))),H(Kv,null,H(Vv,{className:"mb-3"},u("annotation.borderStyle")),H(ef,{value:R,onChange:function(e){N(e),j({strokeStyle:e.id,strokeDashArray:e.dash})}})),H(Kv,null,H(Vv,null,u("annotation.strokeWidth")),H(Yv,{value:z,min:1,max:30,step:1,onChange:E}),H(Zv,null,z,"px")))},df=function(e){var t,n,o,i,r,a,s,l=e.documentId,c=e.selected,d=e.activeTool,u=e.colorPresets,h=Sd().provides,m=ma(l).translate;if(!h)return null;var g=null==c?void 0:c.object,p=null==d?void 0:d.defaults,v=!!g,f=v?g.color:null!==(t=null==p?void 0:p.color)&&void 0!==t?t:"#000000",b=v?g.strokeColor:null!==(n=null==p?void 0:p.strokeColor)&&void 0!==n?n:"#000000",w=v?g.opacity:null!==(o=null==p?void 0:p.opacity)&&void 0!==o?o:1,x=v?g.strokeWidth:null!==(i=null==p?void 0:p.strokeWidth)&&void 0!==i?i:2,C=v?null!==(r=g.lineEndings)&&void 0!==r?r:{start:Tt.None,end:Tt.None}:null!==(a=null==p?void 0:p.lineEndings)&&void 0!==a?a:{start:Tt.None,end:Tt.None},I=v?{id:g.strokeStyle,dash:g.strokeDashArray}:{id:null!==(s=null==p?void 0:p.strokeStyle)&&void 0!==s?s:_t.SOLID,dash:null==p?void 0:p.strokeDashArray},S=y(De(f),2),k=S[0],D=S[1],M=y(De(b),2),P=M[0],A=M[1],T=y(De(w),2),z=T[0],E=T[1],_=y(De(x),2),R=_[0],N=_[1],O=y(De(I),2),L=O[0],$=O[1],F=y(De(C.start),2),j=F[0],U=F[1],B=y(De(C.end),2),q=B[0],G=B[1];Pe(function(){return D(f)},[f]),Pe(function(){return A(b)},[b]),Pe(function(){return E(w)},[w]),Pe(function(){return N(x)},[x]),Pe(function(){return $(I)},[I]),Pe(function(){return U(C.start)},[C.start]),Pe(function(){return G(C.end)},[C.end]);var V=bv(z,300),Z=bv(R,300);Pe(function(){return X({opacity:V})},[V]),Pe(function(){return X({strokeWidth:Z})},[Z]);var K=function(e){D(e),X({color:e})},Y=function(e){A(e),X({strokeColor:e})};function X(e){h&&(v?h.updateAnnotation(g.pageIndex,g.id,e):d&&h.setToolDefaults(d.id,e))}return H(W,null,H(Kv,null,H(Vv,{className:"mb-3"},m("annotation.strokeColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return H(Xv,{key:e,color:e,active:e===P,onSelect:Y})}),H(Xv,{color:"transparent",active:"transparent"===P,onSelect:Y}))),H(Kv,null,H(Vv,null,m("annotation.opacity")),H(Yv,{value:z,min:.1,max:1,step:.05,onChange:E}),H(Zv,null,Math.round(100*z),"%")),H(Kv,null,H(Vv,{className:"mb-3"},m("annotation.borderStyle")),H(ef,{value:L,onChange:function(e){$(e),X({strokeStyle:e.id,strokeDashArray:e.dash})}})),H(Kv,null,H(Vv,null,m("annotation.strokeWidth")),H(Yv,{value:R,min:1,max:10,step:1,onChange:N}),H(Zv,null,R)),H(Kv,null,H("div",{class:"grid grid-cols-2 gap-4"},H("div",null,H(Vv,{className:"mb-3"},m("annotation.lineStart")),H(of,{value:j,onChange:function(e){U(e),X({lineEndings:{start:e,end:q}})},position:"start"})),H("div",null,H(Vv,{className:"mb-3"},m("annotation.lineEnd")),H(of,{value:q,onChange:function(e){G(e),X({lineEndings:{start:j,end:e}})},position:"end"})))),H(Kv,null,H(Vv,{className:"mb-3"},m("annotation.fillColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return H(Xv,{key:e,color:e,active:e===k,onSelect:K})}),H(Xv,{color:"transparent",active:"transparent"===k,onSelect:K}))))};function uf(e){var t=e.active,n=void 0!==t&&t,o=e.disabled,i=void 0!==o&&o,r=e.onClick,a=e.title,s=e.children,l=e.className,c=void 0===l?"":l;return H("button",{type:"button",title:a,disabled:i,onClick:r,className:"h-9 w-9 rounded border px-2 py-1 text-sm transition-colors ".concat(n?"border-accent bg-accent text-fg-on-accent":"border-border-default bg-bg-input text-fg-primary hover:bg-interactive-hover"," disabled:cursor-not-allowed disabled:opacity-40 ").concat(c)},s)}var hf,mf=(l(l(l(l(l(l(l(l(l(l(hf={},Mt.INK,{component:function(e){var t,n,o,i,r,a,s=e.documentId,l=e.selected,c=e.activeTool,d=e.colorPresets,u=Sd().provides,h=ma(s).translate;if(!u)return null;var m=null==l?void 0:l.object,g=null==c?void 0:c.defaults,p=null!==(t=null!==(n=null==m?void 0:m.color)&&void 0!==n?n:null==g?void 0:g.color)&&void 0!==t?t:"#000000",v=null!==(o=null!==(i=null==m?void 0:m.opacity)&&void 0!==i?i:null==g?void 0:g.opacity)&&void 0!==o?o:1,f=null!==(r=null!==(a=null==m?void 0:m.strokeWidth)&&void 0!==a?a:null==g?void 0:g.strokeWidth)&&void 0!==r?r:2,b=y(De(p),2),w=b[0],x=b[1],C=y(De(v),2),I=C[0],S=C[1],k=y(De(f),2),D=k[0],M=k[1];Pe(function(){return x(p)},[p]),Pe(function(){return S(v)},[v]),Pe(function(){return M(f)},[f]);var P=bv(I,300),A=bv(D,300);Pe(function(){return z({opacity:P})},[P]),Pe(function(){return z({strokeWidth:A})},[A]);var T=function(e){x(e),z({color:e})};function z(e){u&&(m?u.updateAnnotation(m.pageIndex,m.id,e):c&&u.setToolDefaults(c.id,e))}return H(W,null,H(Kv,null,H(Vv,{className:"mb-3"},h("annotation.color")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},d.map(function(e){return H(Xv,{key:e,color:e,active:e===w,onSelect:T})}))),H(Kv,null,H(Vv,null,h("annotation.opacity")),H(Yv,{value:I,min:.1,max:1,step:.05,onChange:S}),H(Zv,null,Math.round(100*I),"%")),H(Kv,null,H(Vv,null,h("annotation.strokeWidth")),H(Yv,{value:D,min:1,max:30,step:1,onChange:M}),H(Zv,null,D,"px")))},titleKey:"annotation.ink"}),Mt.POLYGON,{component:function(e){var t,n,o,i,r,a=e.documentId,s=e.selected,l=e.activeTool,c=e.colorPresets,d=Sd().provides,u=ma(a).translate;if(!d)return null;var h=null==s?void 0:s.object,m=null==l?void 0:l.defaults,g=!!h,p=g?h.color:null!==(t=null==m?void 0:m.color)&&void 0!==t?t:"#000000",v=g?h.strokeColor:null!==(n=null==m?void 0:m.strokeColor)&&void 0!==n?n:"#000000",f=g?h.opacity:null!==(o=null==m?void 0:m.opacity)&&void 0!==o?o:1,b=g?h.strokeWidth:null!==(i=null==m?void 0:m.strokeWidth)&&void 0!==i?i:2,w=g?{id:h.strokeStyle,dash:h.strokeDashArray}:{id:null!==(r=null==m?void 0:m.strokeStyle)&&void 0!==r?r:_t.SOLID,dash:null==m?void 0:m.strokeDashArray},x=y(De(p),2),C=x[0],I=x[1],S=y(De(v),2),k=S[0],D=S[1],M=y(De(f),2),P=M[0],A=M[1],T=y(De(b),2),z=T[0],E=T[1],_=y(De(w),2),R=_[0],N=_[1];Pe(function(){return I(p)},[p]),Pe(function(){return D(v)},[v]),Pe(function(){return A(f)},[f]),Pe(function(){return E(b)},[b]),Pe(function(){return N(w)},[w]);var O=bv(P,300),L=bv(z,300);Pe(function(){return j({opacity:O})},[O]),Pe(function(){return j({strokeWidth:L})},[L]);var $=function(e){I(e),j({color:e})},F=function(e){D(e),j({strokeColor:e})};function j(e){d&&(g?d.updateAnnotation(h.pageIndex,h.id,e):l&&d.setToolDefaults(l.id,e))}return H(W,null,H(Kv,null,H(Vv,{className:"mb-3"},u("annotation.strokeColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return H(Xv,{key:e,color:e,active:e===k,onSelect:F})}),H(Xv,{color:"transparent",active:"transparent"===k,onSelect:F}))),H(Kv,null,H(Vv,null,u("annotation.opacity")),H(Yv,{value:P,min:.1,max:1,step:.05,onChange:A}),H(Zv,null,Math.round(100*P),"%")),H(Kv,null,H(Vv,{className:"mb-3"},u("annotation.borderStyle")),H(ef,{value:R,onChange:function(e){N(e),j({strokeStyle:e.id,strokeDashArray:e.dash})}})),H(Kv,null,H(Vv,null,u("annotation.strokeWidth")),H(Yv,{value:z,min:1,max:10,step:1,onChange:E}),H(Zv,null,z)),H(Kv,null,H(Vv,{className:"mb-3"},u("annotation.fillColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},c.map(function(e){return H(Xv,{key:e,color:e,active:e===C,onSelect:$})}),H(Xv,{color:"transparent",active:"transparent"===C,onSelect:$}))))},titleKey:"annotation.polygon"}),Mt.SQUARE,{component:cf,titleKey:"annotation.square"}),Mt.CIRCLE,{component:cf,titleKey:"annotation.circle"}),Mt.LINE,{component:df,titleKey:function(e){var t;return"lineArrow"===(null===(t=e.activeTool)||void 0===t?void 0:t.id)?"annotation.arrow":"annotation.line"}}),Mt.POLYLINE,{component:df,titleKey:"annotation.polyline"}),Mt.HIGHLIGHT,{component:lf,titleKey:"annotation.highlight"}),Mt.UNDERLINE,{component:lf,titleKey:"annotation.underline"}),Mt.STRIKEOUT,{component:lf,titleKey:"annotation.strikeout"}),Mt.SQUIGGLY,{component:lf,titleKey:"annotation.squiggly"}),l(l(hf,Mt.FREETEXT,{component:function(e){var t,n,o,i,r,a,s,l=e.documentId,c=e.selected,d=e.activeTool,u=e.colorPresets,h=Sd().provides,m=ma(l).translate;if(!h)return null;var g=null==c?void 0:c.object,p=null==d?void 0:d.defaults,v=!!g,f=v?g.fontFamily:null!==(t=null==p?void 0:p.fontFamily)&&void 0!==t?t:xt.Helvetica,b=an(f).family,w=sn(f),x=ln(f),C=v?g.fontColor:null!==(n=null==p?void 0:p.fontColor)&&void 0!==n?n:"#000000",I=v?g.opacity:null!==(o=null==p?void 0:p.opacity)&&void 0!==o?o:1,S=v?g.backgroundColor:null!==(i=null==p?void 0:p.backgroundColor)&&void 0!==i?i:"#000000",k=v?g.fontSize:null!==(r=null==p?void 0:p.fontSize)&&void 0!==r?r:12,D=v?g.textAlign:null!==(a=null==p?void 0:p.textAlign)&&void 0!==a?a:Ct.Left,M=v?g.verticalAlign:null!==(s=null==p?void 0:p.verticalAlign)&&void 0!==s?s:It.Top,P=y(De(b),2),A=P[0],T=P[1],z=y(De(k),2),E=z[0],_=z[1],R=y(De(w),2),N=R[0],O=R[1],L=y(De(x),2),$=L[0],F=L[1],j=y(De(D),2),U=j[0],B=j[1],q=y(De(M),2),G=q[0],V=q[1],Z=y(De(C),2),K=Z[0],Y=Z[1],X=y(De(I),2),Q=X[0],J=X[1],ee=y(De(S),2),te=ee[0],ne=ee[1];function oe(e){h&&(v?h.updateAnnotation(g.pageIndex,g.id,e):d&&h.setToolDefaults(d.id,e))}Pe(function(){T(b),O(w),F(x)},[b,w,x]),Pe(function(){return Y(C)},[C]),Pe(function(){return J(I)},[I]),Pe(function(){return ne(S)},[S]),Pe(function(){return _(k)},[k]),Pe(function(){return B(D)},[D]),Pe(function(){return V(M)},[M]);var ie=bv(Q,300),re=bv(te,300);Pe(function(){return oe({opacity:ie})},[ie]),Pe(function(){return oe({backgroundColor:re})},[re]);var ae=function(e){Y(e),oe({fontColor:e})},se=function(e){ne(e),oe({backgroundColor:e})},le=function(e,t,n){oe({fontFamily:cn(e,{bold:t,italic:n})})},ce=function(e){B(e),oe({textAlign:e})},de=function(e){V(e),oe({verticalAlign:e})};return H(W,null,H(Kv,null,H(Vv,null,m("annotation.font")),H("div",{class:"mb-3 flex gap-2"},H(rf,{value:A,onChange:function(e){var t=sn(cn(e,{bold:!0,italic:!1})),n=ln(cn(e,{bold:!1,italic:!0})),o=!!t&&N,i=!!n&&$;T(e),O(o),F(i),le(e,o,i)}}),H("div",{class:"w-36"},H(af,{value:E,onChange:function(e){!Number.isFinite(e)||e<=0||(_(e),oe({fontSize:e}))}}))),H("div",{class:"flex gap-2"},H(uf,{title:"Bold",active:N,disabled:!sn(cn(A,{bold:!0,italic:!1})),onClick:function(){if(sn(cn(A,{bold:!0,italic:!1}))){var e=!N;O(e),le(A,e,$)}},className:"font-bold"},H(Vm,{icon:"bold",size:18})),H(uf,{title:"Italic",active:$,disabled:!ln(cn(A,{bold:!1,italic:!0})),onClick:function(){if(ln(cn(A,{bold:!1,italic:!0}))){var e=!$;F(e),le(A,N,e)}},className:"italic"},H(Vm,{icon:"italic",size:18})))),H(Kv,null,H(Vv,null,m("annotation.textAlign")),H("div",{class:"flex gap-2"},H(uf,{title:"Align left",active:U===Ct.Left,onClick:function(){return ce(Ct.Left)}},H(Vm,{icon:"alignLeft",size:18})),H(uf,{title:"Align center",active:U===Ct.Center,onClick:function(){return ce(Ct.Center)}},H(Vm,{icon:"alignCenter",size:18})),H(uf,{title:"Align right",active:U===Ct.Right,onClick:function(){return ce(Ct.Right)}},H(Vm,{icon:"alignRight",size:18})))),H(Kv,null,H(Vv,null,m("annotation.verticalAlign")),H("div",{class:"flex gap-2"},H(uf,{title:"Align top",active:G===It.Top,onClick:function(){return de(It.Top)}},H(Vm,{icon:"alignTop",size:18})),H(uf,{title:"Align middle",active:G===It.Middle,onClick:function(){return de(It.Middle)}},H(Vm,{icon:"alignMiddle",size:18})),H(uf,{title:"Align bottom",active:G===It.Bottom,onClick:function(){return de(It.Bottom)}},H(Vm,{icon:"alignBottom",size:18})))),H(Kv,null,H(Vv,{className:"mb-3"},m("annotation.fontColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return H(Xv,{key:e,color:e,active:e===K,onSelect:ae})}))),H(Kv,null,H(Vv,{className:"mb-3"},m("annotation.backgroundColor")),H("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4"},u.map(function(e){return H(Xv,{key:e,color:e,active:e===te,onSelect:se})}),H(Xv,{color:"transparent",active:"transparent"===te,onSelect:se}))),H(Kv,null,H(Vv,null,m("annotation.opacity")),H(Yv,{value:Q,min:.1,max:1,step:.05,onChange:J}),H(Zv,null,Math.round(100*Q),"%")))},titleKey:"annotation.freeText"}),Mt.STAMP,{component:function(e){var t=e.documentId;return H("div",{className:"text-fg-muted text-sm"},(0,ma(t).translate)("annotation.noStylesStamp"))},titleKey:"annotation.stamp"})),gf=function(e){var t=e.documentId,n=ma(t).translate;return H("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},H(Vm,{icon:"palette",className:"h-18 w-18 text-fg-muted"}),H("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("annotation.selectAnnotation")))};function pf(e){var t,n=e.documentId,o=Sd().provides,i=kd(n),r=i.provides,a=i.state,s=ma(n).translate;if(!o||!r)return null;var l=null!==(t=null==o?void 0:o.getColorPresets())&&void 0!==t?t:[],c=null,d=null,u=a.selectedUid?dc(a,a.selectedUid):null;if(u)c=r.findToolForAnnotation(u.object),d=u.object.type;else if(a.activeToolId){var h,g,p;d=null!==(g=null===(p=c=null!==(h=r.getActiveTool())&&void 0!==h?h:null)||void 0===p?void 0:p.defaults.type)&&void 0!==g?g:null}if(null===d)return We(gf,{documentId:n});var v=mf[d];if(!v)return We(gf,{documentId:n});var f=v.component,y=v.titleKey,b={documentId:n,selected:u,activeTool:c,colorPresets:l},w="function"==typeof y?y(b):y,x=w?s(w):"",C=x?s(u?"annotation.styles":"annotation.defaults",{params:{type:x}}):"";return We("div",{class:"h-full overflow-y-auto p-4",children:[C&&We("h2",{class:"text-md mb-4 font-medium",children:C}),We(f,m({},b))]})}function vf(e){var t=e.schema,n=e.documentId,o=e.props,i=o.menuWrapperProps,r=o.rect,a=o.placement,s={position:"absolute",pointerEvents:"auto",cursor:"default",left:"50%",transform:"translateX(-50%)"};return null!=a&&a.suggestTop?s.top=-48:s.top=r.size.height+8,H("div",m(m({},i),mr(t)),H("div",{style:s,className:"border-border-subtle bg-bg-elevated rounded-lg border shadow-lg"},H("div",{className:"flex items-center gap-1 p-1"},t.items.map(function(e){return H(ff,{key:e.id,item:e,documentId:n,props:o})}))))}function ff(e){var t,n=e.item,o=e.documentId,i=e.props;switch(n.type){case"command-button":return H("div",m({},mr(n)),H(Cp,{commandId:n.commandId,documentId:o,variant:n.variant}));case"divider":return H("div",m({},mr(n)),H("div",{className:"bg-border-default h-6 w-px","aria-hidden":"true"}));case"group":return H("div",m({className:"flex items-center gap-".concat(null!==(t=n.gap)&&void 0!==t?t:1)},mr(n)),n.items.map(function(e){return H(ff,{key:e.id,item:e,documentId:o,props:i})}));default:return null}}function yf(e){var t,n,o=e.schema,i=e.documentId,r=e.className,a=o.content,s=o.position,l=_r().renderCustomComponent,c=(t=s.anchor,(n={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"})[t]||n["bottom-center"]),d=function(e){if(e){var t={};return e.top&&(t.top=e.top),e.right&&(t.right=e.right),e.bottom&&(t.bottom=e.bottom),e.left&&(t.left=e.left),Object.keys(t).length>0?t:void 0}}(s.offset);return H("div",{className:"absolute ".concat(c," ").concat(r||""),style:d,"data-overlay-id":o.id},l(a.componentId,i,{}))}function bf(e){var t=e.open,n=e.title,o=e.children,i=e.onClose,r=e.onExited,a=e.className,s=e.showCloseButton,l=void 0===s||s;e.maxWidth;var c=Te(null),d=y(De(t),2),u=d[0],h=d[1],m=y(De(!1),2),g=m[0],p=m[1];Pe(function(){if(t)h(!0),requestAnimationFrame(function(){p(!0)});else if(u){p(!1);var e=setTimeout(function(){h(!1),null==r||r()},200);return function(){return clearTimeout(e)}}},[t,u,r]),Pe(function(){if(t){var e=function(e){"Escape"===e.key&&(null==i||i())};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}}},[t,i]);return Pe(function(){return document.body.style.overflow=u?"hidden":"",function(){document.body.style.overflow=""}},[u]),u?We("div",{ref:c,className:"fixed inset-0 z-50 transition-opacity duration-200 md:flex md:items-center md:justify-center ".concat(g&&t?"bg-bg-overlay":"bg-transparent"),onClick:function(e){e.target===c.current&&(null==i||i())},children:We("div",{className:"bg-bg-surface md:border-border-subtle relative flex h-full w-full flex-col transition-all duration-200 md:h-auto md:w-[28rem] md:max-w-[90vw] md:rounded-lg md:border md:shadow-lg ".concat(g&&t?"scale-100 opacity-100":"scale-95 opacity-0"," ").concat(a),onClick:function(e){return e.stopPropagation()},children:[(n||l)&&We("div",{className:"border-border-subtle flex flex-shrink-0 items-center justify-between border-b px-6 py-4",children:[n&&We("h2",{className:"text-fg-primary text-lg font-semibold",children:n}),l&&We(Km,{onClick:i,className:"hover:bg-interactive-hover p-1",children:We(Vm,{icon:"x",className:"h-5 w-5"})})]}),We("div",{className:"flex-1 overflow-y-auto px-6 py-4 md:max-h-[80vh] md:flex-none",children:o})]})}):null}function wf(e){var t=e.documentId,n=e.isOpen,o=e.onClose,i=e.onExited,r=ni().provides,a=Kd().provides,s=y(De("all"),2),l=s[0],c=s[1],d=y(De(""),2),u=d[0],h=d[1],m=y(De(!0),2),g=m[0],p=m[1],v=y(De(!1),2),f=v[0],b=v[1],w=y(De(""),2),x=w[0],C=w[1],I=null==r?void 0:r.forDocument(t).getMetrics(),S=(null==I?void 0:I.currentPage)||1,k=(null==r?void 0:r.forDocument(t).getTotalPages())||0;Pe(function(){n&&(c("all"),h(""),p(!0),b(!1),C(""))},[n]);var D=("custom"!==l||u.trim().length>0)&&!f;return H(bf,{open:null!=n&&n,title:"Print Settings",onClose:o,onExited:i,maxWidth:"32rem"},H("div",{className:"space-y-6"},H("div",null,H("label",{className:"text-fg-secondary mb-3 block text-sm font-medium"},"Pages to print"),H("div",{className:"space-y-2"},H("label",{className:"flex items-center"},H("input",{type:"radio",name:"pageRange",value:"all",checked:"all"===l,onChange:function(){return c("all")},disabled:f,className:"accent-accent mr-2"}),H("span",{className:"text-fg-primary text-sm"},"All pages")),H("label",{className:"flex items-center"},H("input",{type:"radio",name:"pageRange",value:"current",checked:"current"===l,onChange:function(){return c("current")},disabled:f,className:"accent-accent mr-2"}),H("span",{className:"text-fg-primary text-sm"},"Current page (",S,")")),H("label",{className:"flex items-start"},H("input",{type:"radio",name:"pageRange",value:"custom",checked:"custom"===l,onChange:function(){return c("custom")},disabled:f,className:"accent-accent mr-2 mt-0.5"}),H("div",{className:"flex-1"},H("span",{className:"text-fg-primary mb-1 block text-sm"},"Specify pages"),H("input",{type:"text",placeholder:"e.g., 1-3, 5, 8-10",value:u,onInput:function(e){return h(e.target.value)},disabled:"custom"!==l||f,className:"w-full rounded-md border px-3 py-1 text-sm ".concat("custom"!==l||f?"bg-interactive-disabled text-fg-muted":"border-border-default bg-bg-input text-fg-primary focus:border-accent focus:ring-accent"," focus:outline-none focus:ring-1")}),"custom"===l&&u.trim()&&k>0&&H("p",{className:"text-fg-muted mt-1 text-xs"},"Total pages in document: ",k))))),H("div",null,H("label",{className:"flex items-center"},H("input",{type:"checkbox",checked:g,onChange:function(e){return p(e.target.checked)},disabled:f,className:"accent-accent mr-2"}),H("span",{className:"text-fg-secondary text-sm font-medium"},"Include annotations"))),f&&H("div",{className:"bg-state-info-light flex items-center space-x-3 rounded-md p-3"},H(kv,{className:"text-accent"}),H("span",{className:"text-accent text-sm"},x)),H("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},H(Km,{onClick:o,disabled:f,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},"Cancel"),H(Km,{onClick:function(){var e;"current"===l?e=String(S):"custom"===l&&(e=u.trim()||void 0);var n={includeAnnotations:g,pageRange:e};try{b(!0),C("Preparing document...");var i=null==a?void 0:a.forDocument(t).print(n);i&&(i.onProgress(function(e){C(e.message)}),i.wait(function(){b(!1),C(""),null==o||o()},function(e){console.error("Print failed:",e),b(!1),C("")}))}catch(e){console.error("Print failed:",e),b(!1),C("")}},disabled:!D,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover flex items-center space-x-2 rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},f&&H(kv,{size:"sm"}),H("span",null,f?"Printing...":"Print")))))}function xf(e){var t=e.documentId,n=Fo().provides,o=oi(t),i=o.provides,r=o.state,a=r.currentPage,s=r.totalPages,l=y(De(!1),2),c=l[0],d=l[1],u=y(De(!1),2),h=u[0],m=u[1],g=Te(null),p=y(De(a.toString()),2),v=p[0],f=p[1],b=Te(null);Pe(function(){f(a.toString())},[a]);var w=Ee(function(){g.current&&clearTimeout(g.current),g.current=setTimeout(function(){h||d(!1)},4e3)},[h]);Pe(function(){if(n)return n.onScrollActivity(function(e){e.documentId===t&&(d(!0),w())})},[n,t,w]),Pe(function(){return function(){g.current&&clearTimeout(g.current)}},[]);return s<=1?null:H("div",{onMouseEnter:function(){m(!0),d(!0),g.current&&clearTimeout(g.current)},onMouseLeave:function(){m(!1),w()},className:"pointer-events-auto"},H("div",{className:"border-border-default bg-bg-surface flex items-center gap-1 rounded-lg border p-1 shadow-lg transition-opacity duration-300 ".concat(c?"opacity-100":"opacity-0")},H(Cp,{commandId:"scroll:previous-page",documentId:t,variant:"icon"}),H("div",{className:"flex items-center gap-1 px-1"},H("input",{ref:b,type:"text",inputMode:"numeric",pattern:"[0-9]*",value:v,onChange:function(e){var t=e.target.value.replace(/[^0-9]/g,"");f(t)},onFocus:function(){setTimeout(function(){var e;return null===(e=b.current)||void 0===e?void 0:e.select()},0)},onBlur:function(){var e,t=parseInt(v,10);!isNaN(t)&&t>=1&&t<=s?null==i||null===(e=i.scrollToPage)||void 0===e||e.call(i,{pageNumber:t}):f(a.toString())},onKeyDown:function(e){"Enter"===e.key?e.target.blur():"Escape"===e.key&&(f(a.toString()),e.target.blur())},className:"border-border-default bg-bg-input text-fg-primary focus:border-accent focus:ring-accent h-7 w-10 rounded border px-1 text-center text-sm focus:outline-none focus:ring-1"}),H("span",{className:"text-fg-secondary text-sm"}," ",s)),H(Cp,{commandId:"scroll:next-page",documentId:t,variant:"icon"})))}var Cf={colors:{background:{app:"#f3f4f6",surface:"#ffffff",surfaceAlt:"#f1f3f5",elevated:"#ffffff",overlay:"rgba(0, 0, 0, 0.5)",input:"#ffffff"},foreground:{primary:"#111827",secondary:"#374151",muted:"#6b7280",disabled:"#9ca3af",onAccent:"#ffffff"},border:{default:"#d1d5db",subtle:"#e5e7eb",strong:"#9ca3af"},accent:{primary:"#3b82f6",primaryHover:"#2563eb",primaryActive:"#1d4ed8",primaryLight:"#eff6ff",primaryForeground:"#ffffff"},interactive:{hover:"#f3f4f6",active:"#e5e7eb",selected:"#eff6ff",focus:"#3b82f6",focusRing:"#bfdbfe"},state:{error:"#ef4444",errorLight:"#fef2f2",warning:"#f59e0b",warningLight:"#fffbeb",success:"#22c55e",successLight:"#f0fdf4",info:"#3b82f6",infoLight:"#eff6ff"},tooltip:{background:"#111827",foreground:"#ffffff"},scrollbar:{track:"#f3f4f6",thumb:"#d1d5db",thumbHover:"#9ca3af"}}},If={colors:{background:{app:"#111827",surface:"#1f2937",surfaceAlt:"#374151",elevated:"#1f2937",overlay:"rgba(0, 0, 0, 0.7)",input:"#374151"},foreground:{primary:"#f9fafb",secondary:"#e5e7eb",muted:"#9ca3af",disabled:"#6b7280",onAccent:"#111827"},border:{default:"#4b5563",subtle:"#374151",strong:"#6b7280"},accent:{primary:"#60a5fa",primaryHover:"#3b82f6",primaryActive:"#2563eb",primaryLight:"#1e3a5f",primaryForeground:"#111827"},interactive:{hover:"#374151",active:"#4b5563",selected:"#1e3a5f",focus:"#60a5fa",focusRing:"#1e40af"},state:{error:"#f87171",errorLight:"#7f1d1d",warning:"#fbbf24",warningLight:"#78350f",success:"#4ade80",successLight:"#14532d",info:"#60a5fa",infoLight:"#1e3a5f"},tooltip:{background:"#f9fafb",foreground:"#111827"},scrollbar:{track:"#1f2937",thumb:"#4b5563",thumbHover:"#6b7280"}}};function Sf(e,t){var n=m({},e);for(var o in t){var i=t[o];i&&"object"===x(i)&&!Array.isArray(i)?n[o]=Sf(e[o]||{},i):void 0!==i&&(n[o]=i)}return n}function kf(e,t){return{colors:Sf(e.colors,t)}}function Df(e){return"system"===e?"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Mf(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Pf(e){return":host {\n".concat(function(e){var t=[];return function e(n,o){for(var i=0,r=Object.entries(n);i<r.length;i++){var a=y(r[i],2),s=a[0],l=a[1];l&&"object"===x(l)?e(l,"".concat(o,"-").concat(Mf(s))):void 0!==l&&t.push(" --ep".concat(o,"-").concat(Mf(s),": ").concat(l,";"))}}(e.colors,""),t.join("\n")}(e),"\n}")}function Af(e){var t=e.documentStates,n=e.activeDocumentId,o=e.visibility,i=void 0===o?"multiple":o,r=e.allowOpenFile,a=void 0===r||r,s=qr().provides,l=Ee(function(e){null==s||s.setActiveDocument(e)},[s]),c=Ee(function(e){null==s||s.closeDocument(e)},[s]),d=Ee(function(){null==s||s.openFileDialog()},[s]);return"always"===i||"multiple"===i&&t.length>1?H("div",{className:"bg-bg-surface-alt flex items-end pr-2 pt-2"},H("div",{className:"flex flex-1 items-end overflow-x-auto pl-4"},t.map(function(e){var t,o,i=n===e.id;return H("div",{key:e.id,onClick:function(){return l(e.id)},role:"tab",tabIndex:0,"aria-selected":i,onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l(e.id))},className:"group relative flex min-w-[120px] max-w-[240px] cursor-pointer items-center gap-2 rounded-t-lg px-4 py-2 text-sm font-medium transition-all ".concat(i?"bg-bg-surface text-fg-primary z-10":"bg-bg-surface-alt text-fg-secondary hover:bg-interactive-hover hover:text-fg-primary")},H("span",{className:"min-w-0 flex-1 truncate"},null!==(t=e.name)&&void 0!==t?t:"Document ".concat(e.id.slice(0,8))),i&&H("button",{onClick:function(t){t.stopPropagation(),c(e.id)},"aria-label":"Close ".concat(null!==(o=e.name)&&void 0!==o?o:"document"),className:"hover:bg-interactive-hover flex-shrink-0 cursor-pointer rounded-full p-1 transition-all ".concat(i?"opacity-100":"opacity-0 group-hover:opacity-100")},H(Vm,{icon:"x",size:14})))}),a&&H("button",{onClick:d,className:"text-fg-secondary hover:bg-interactive-hover hover:text-fg-primary mb-1.5 ml-1 flex-shrink-0 cursor-pointer rounded p-1.5 transition-colors","aria-label":"Open File",title:"Open File"},H(Vm,{icon:"plus",size:14})))):null}function Tf(){var e=qr().provides,t=ma().translate;return H("div",{className:"bg-bg-app flex h-full w-full items-center justify-center"},H("div",{className:"flex max-w-sm flex-col items-center text-center"},H("div",{className:"bg-accent-light mb-6 rounded-full p-5"},H(Vm,{icon:"file",size:48,className:"text-accent"})),H("h2",{className:"text-fg-primary mb-2 text-xl font-semibold"},t("emptyState.title")),H("p",{className:"text-fg-secondary mb-6 text-sm leading-relaxed"},t("emptyState.description"),H("br",null),t("emptyState.descriptionMulti")),H("button",{onClick:function(){null==e||e.openFileDialog()},className:"bg-accent hover:bg-accent-hover text-accent-fg inline-flex cursor-pointer items-center gap-2 rounded-md px-5 py-2.5 text-sm font-medium shadow-sm transition-all"},H(Vm,{icon:"plus",size:16}),t("emptyState.openButton")),H("p",{className:"text-fg-muted mt-4 text-xs"},t("emptyState.supportedFormats"))))}function zf(e){var t=e.documentState,o=qr().provides,i=ma().translate,r=y(De(""),2),a=r[0],s=r[1],l=y(De(!1),2),c=l[0],d=l[1];if(!t)return null;var u=t.name,h=t.errorCode,m=t.passwordProvided,g=h===Ut.Password,v=g&&!m,f=g&&m;if(!g)return H("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},H("div",{className:"bg-bg-surface border-border-default flex max-w-sm flex-col items-center rounded-xl border p-6 text-center shadow-lg"},H("div",{className:"bg-state-error-light mb-4 rounded-full p-4"},H(Vm,{icon:"alertTriangle",size:28,className:"text-state-error"})),H("h3",{className:"text-fg-primary text-lg font-semibold"},i("documentError.title")),H("p",{className:"text-fg-secondary mt-2 text-sm"},t.error||i("documentError.unknown")),h&&H("p",{className:"text-fg-muted mt-1 text-xs"},i("documentError.errorCode",{params:{code:String(h)}})),H("button",{onClick:function(){return null==o?void 0:o.closeDocument(t.id)},className:"bg-accent hover:bg-accent-hover text-accent-fg mt-5 w-full cursor-pointer rounded-md px-4 py-2.5 text-sm font-medium transition-colors"},i("documentError.close"))));var b=function(){var e=n(p().m(function e(){return p().w(function(e){for(;;)switch(e.n){case 0:if(o&&a.trim()){e.n=1;break}return e.a(2);case 1:d(!0),o.retryDocument(t.id,{password:a}).wait(function(){s(""),d(!1)},function(e){console.error("Retry failed:",e),d(!1)});case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return H("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},H("div",{className:"bg-bg-surface border-border-default w-full max-w-sm rounded-xl border p-6 shadow-lg"},H("div",{className:"flex flex-col items-center text-center"},H("div",{className:"bg-accent-light mb-4 rounded-full p-4"},H(Vm,{icon:"lock",size:28,className:"text-accent"})),H("h3",{className:"text-fg-primary text-lg font-semibold"},i("passwordPrompt.title")),u&&H("p",{className:"text-fg-muted mt-1 text-sm"},u)),H("p",{className:"text-fg-secondary mt-4 text-center text-sm"},v&&i("passwordPrompt.required"),f&&i("passwordPrompt.incorrect")),H("div",{className:"mt-5"},H("label",{className:"text-fg-primary mb-1.5 block text-sm font-medium"},i("passwordPrompt.label")),H("input",{type:"password",value:a,onInput:function(e){return s(e.target.value)},onKeyDown:function(e){return"Enter"===e.key&&!c&&a.trim()&&b()},disabled:c,placeholder:i("passwordPrompt.placeholder"),className:"bg-bg-input border-border-default focus:border-accent focus:ring-accent text-fg-primary placeholder:text-fg-muted block w-full rounded-md border px-3 py-2.5 text-sm focus:outline-none focus:ring-1 disabled:opacity-50",autoFocus:!0})),f&&H("div",{className:"bg-state-error-light border-state-error mt-3 flex items-center gap-2 rounded-md border p-3"},H(Vm,{icon:"alertTriangle",size:16,className:"text-state-error flex-shrink-0"}),H("p",{className:"text-state-error text-sm"},i("passwordPrompt.incorrectWarning"))),H("div",{className:"mt-6 flex gap-3"},H("button",{onClick:function(){return null==o?void 0:o.closeDocument(t.id)},disabled:c,className:"border-border-default text-fg-secondary hover:bg-interactive-hover flex-1 cursor-pointer rounded-md border px-4 py-2.5 text-sm font-medium transition-colors disabled:opacity-50"},i("passwordPrompt.cancel")),H("button",{onClick:b,disabled:c||!a.trim(),className:"bg-accent hover:bg-accent-hover text-accent-fg flex-1 cursor-pointer rounded-md px-4 py-2.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50"},i(c?"passwordPrompt.opening":"passwordPrompt.open")))))}function Ef(e){var t=e.documentId,n=e.className,o=ta("mode:view",t),i=ta("mode:annotate",t),r=ta("mode:shapes",t),a=ta("mode:redact",t),s=ta("tabs:overflow-menu",t),l=ze(function(){return[o,i,r,a].find(function(e){return null==e?void 0:e.active})||o},[o,i,r,a]),c=Ee(function(e){e.preventDefault(),e.stopPropagation(),s&&!s.disabled&&s.execute()},[s]);if(!s||!s.visible)return null;var d=s.active;return H("div",{style:{maxWidth:"100px",width:"100px"},className:n},H(Km,{className:"bg-bg-surface col-start-1 row-start-1 !w-full appearance-none rounded-md py-1.5 pl-3 pr-2 text-[13px] ".concat(d?"bg-interactive-selected ring-accent border-none shadow ring":"border-border-default outline-border-default hover:bg-interactive-hover hover:ring-accent outline outline-1 -outline-offset-1 hover:ring"," flex flex-row items-center justify-between gap-2"),onClick:c,disabled:s.disabled,style:{height:34}},H("span",{className:"min-w-0 flex-1 truncate text-left ".concat(d?"text-accent":"text-fg-primary")},null==l?void 0:l.label),H(Vm,{icon:"chevronDown",className:"h-4 w-4 ".concat(d?"text-accent":"text-fg-secondary")})))}var _f={documentManager:{},commands:{commands:{"zoom:in":{id:"zoom:in",labelKey:"zoom.in",icon:"zoomIn",shortcuts:["Ctrl+=","Meta+=","Ctrl+NumpadAdd","Meta+NumpadAdd"],categories:["zoom","zoom-in"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).zoomIn()}},"zoom:out":{id:"zoom:out",labelKey:"zoom.out",icon:"zoomOut",shortcuts:["Ctrl+-","Meta+-","Ctrl+NumpadSubtract","Meta+NumpadSubtract"],categories:["zoom","zoom-out"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).zoomOut()}},"zoom:fit-page":{id:"zoom:fit-page",labelKey:"zoom.fitPage",icon:"fitToPage",shortcuts:["Ctrl+0","Meta+0"],categories:["zoom","zoom-fit-page"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(ga.FitPage)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)===ga.FitPage}},"zoom:fit-width":{id:"zoom:fit-width",labelKey:"zoom.fitWidth",icon:"fitToWidth",shortcuts:["Ctrl+1","Meta+1"],categories:["zoom","zoom-fit-width"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(ga.FitWidth)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)===ga.FitWidth}},"zoom:marquee":{id:"zoom:marquee",labelKey:"zoom.marquee",icon:"zoomInArea",shortcuts:["Ctrl+M","Meta+M"],categories:["zoom","zoom-marquee"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).toggleMarqueeZoom()},active:function(e){var t,n,o=e.state,i=e.documentId;return null!==(t=null===(n=o.plugins.zoom)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.isMarqueeZoomActive)&&void 0!==t&&t}},"zoom:25":{id:"zoom:25",label:"25%",categories:["zoom","zoom-level","zoom-level-25"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(.25)},active:function(e){var t,n=e.state,o=e.documentId;return.25===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:50":{id:"zoom:50",label:"50%",categories:["zoom","zoom-level","zoom-level-50"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(.5)},active:function(e){var t,n=e.state,o=e.documentId;return.5===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:100":{id:"zoom:100",label:"100%",categories:["zoom","zoom-level","zoom-level-100"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(1)},active:function(e){var t,n=e.state,o=e.documentId;return 1===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:125":{id:"zoom:125",label:"125%",categories:["zoom","zoom-level","zoom-level-125"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(1.25)},active:function(e){var t,n=e.state,o=e.documentId;return 1.25===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:150":{id:"zoom:150",label:"150%",categories:["zoom","zoom-level","zoom-level-150"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(1.5)},active:function(e){var t,n=e.state,o=e.documentId;return 1.5===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:200":{id:"zoom:200",label:"200%",categories:["zoom","zoom-level","zoom-level-200"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(2)},active:function(e){var t,n=e.state,o=e.documentId;return 2===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:400":{id:"zoom:400",label:"400%",categories:["zoom","zoom-level","zoom-level-400"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(4)},active:function(e){var t,n=e.state,o=e.documentId;return 4===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:800":{id:"zoom:800",label:"800%",categories:["zoom","zoom-level","zoom-level-800"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(8)},active:function(e){var t,n=e.state,o=e.documentId;return 8===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:1600":{id:"zoom:1600",label:"1600%",categories:["zoom","zoom-level","zoom-level-1600"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("zoom"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).requestZoom(16)},active:function(e){var t,n=e.state,o=e.documentId;return 16===(null===(t=n.plugins.zoom)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.zoomLevel)}},"zoom:toggle-menu":{id:"zoom:toggle-menu",labelKey:"zoom.menu",icon:"chevronDown",iconProps:{className:"h-3.5 w-3.5"},categories:["zoom","zoom-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).toggleMenu("zoom-menu","zoom:toggle-menu","zoom-menu-button")},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["zoom-menu"])}},"zoom:toggle-menu-mobile":{id:"zoom:toggle-menu-mobile",labelKey:"zoom.menu",icon:"zoomIn",categories:["zoom","zoom-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).toggleMenu("zoom-menu","zoom:toggle-menu-mobile","zoom-menu-button")},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["zoom-menu"])}},"pan:toggle":{id:"pan:toggle",labelKey:"pan.toggle",icon:"hand",shortcuts:["h"],categories:["tools","pan"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("pan"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).togglePan()},active:function(e){var t,n,o=e.state,i=e.documentId;return null!==(t=null===(n=o.plugins.pan)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.isPanMode)&&void 0!==t&&t}},"pointer:toggle":{id:"pointer:toggle",labelKey:"pointer.toggle",icon:"pointer",shortcuts:["p"],categories:["tools","pointer"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("interaction-manager"))||void 0===t?void 0:t.provides();i&&i.forDocument(o).activate("pointerMode")},active:function(e){var t,n=e.state,o=e.documentId;return"pointerMode"===(null===(t=n.plugins["interaction-manager"])||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.activeMode)}},"left-action-menu:overflow-menu":{id:"left-action-menu:overflow-menu",labelKey:"menu.moreOptions",icon:"dots",categories:["ui","ui-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.toggleMenu("left-action-menu","left-action-menu:overflow-menu","overflow-left-action-menu-button",o)},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["left-action-menu"])}},"capture:screenshot":{id:"capture:screenshot",labelKey:"capture.screenshot",icon:"screenshot",shortcuts:["Ctrl+Shift+S","Meta+Shift+S"],categories:["tools","capture","capture-screenshot"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("capture"))||void 0===t?void 0:t.provides();if(i){var r=i.forDocument(o);r.isMarqueeCaptureActive()?r.disableMarqueeCapture():r.enableMarqueeCapture()}},active:function(e){var t,n=e.state,o=e.documentId;return"marqueeCapture"===(null===(t=n.plugins["interaction-manager"].documents[o])||void 0===t?void 0:t.activeMode)}},"document:menu":{id:"document:menu",labelKey:"document.menu",icon:"menu",categories:["document","document-menu"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleMenu("document-menu","document:menu","document-menu-button")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["document-menu"])}},"document:open":{id:"document:open",labelKey:"document.open",icon:"fileImport",shortcuts:["Ctrl+O","Meta+O"],categories:["document","document-open"],action:function(e){var t,n=null===(t=e.registry.getPlugin("document-manager"))||void 0===t?void 0:t.provides();null==n||n.openFileDialog()}},"document:close":{id:"document:close",labelKey:"document.close",icon:"x",shortcuts:["Ctrl+W","Meta+W"],categories:["document","document-close"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("document-manager"))||void 0===t?void 0:t.provides();null==i||i.closeDocument(o)}},"document:print":{id:"document:print",labelKey:"document.print",icon:"print",shortcuts:["Ctrl+P","Meta+P"],categories:["document","document-print"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).openModal("print-modal")}}},"document:export":{id:"document:export",labelKey:"document.export",icon:"download",categories:["document","document-export"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("export"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).download()}},"document:fullscreen":{id:"document:fullscreen",labelKey:"document.fullscreen",icon:"fullscreen",shortcuts:["F11"],categories:["document","document-fullscreen"],action:function(e){var t,n=null===(t=e.registry.getPlugin("fullscreen"))||void 0===t?void 0:t.provides();n&&(n.isFullscreen()?n.exitFullscreen():n.enableFullscreen())},active:function(e){var t,n;return null!==(t=null===(n=e.state.plugins.fullscreen)||void 0===n?void 0:n.isFullscreen)&&void 0!==t&&t}},"panel:toggle-sidebar":{id:"panel:toggle-sidebar",labelKey:"panel.sidebar",icon:"sidebar",categories:["panel","panel-sidebar"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("left","main","sidebar-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"left","main","sidebar-panel")}},"panel:toggle-search":{id:"panel:toggle-search",labelKey:"panel.search",icon:"search",shortcuts:["Ctrl+F","Meta+F"],categories:["panel","panel-search"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("right","main","search-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"right","main","search-panel")}},"panel:toggle-comment":{id:"panel:toggle-comment",labelKey:"panel.comment",icon:"comment",categories:["panel","panel-comment"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("right","main","comment-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"right","main","comment-panel")}},"panel:toggle-annotation-style":{id:"panel:toggle-annotation-style",labelKey:"panel.annotationStyle",icon:"palette",categories:["panel","panel-annotation-style"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("left","main","annotation-panel")}},active:function(e){var t=e.state,n=e.documentId;return xr(t.plugins,n,"left","main","annotation-panel")}},"page:settings":{id:"page:settings",labelKey:"page.settings",icon:"viewSettings",categories:["page","page-settings"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(fi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleMenu("page-settings-menu","page:settings","page-settings-button")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["page-settings-menu"])}},"spread:none":{id:"spread:none",labelKey:"page.single",icon:"singlePage",categories:["page","spread","spread-none"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("spread"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setSpreadMode(ri.None)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.spread)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.spreadMode)===ri.None}},"spread:odd":{id:"spread:odd",labelKey:"page.twoOdd",icon:"doublePage",categories:["page","spread","spread-odd"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("spread"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setSpreadMode(ri.Odd)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.spread)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.spreadMode)===ri.Odd}},"spread:even":{id:"spread:even",labelKey:"page.twoEven",icon:"book2",categories:["page","spread","spread-even"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("spread"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setSpreadMode(ri.Even)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.spread)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.spreadMode)===ri.Even}},"rotate:clockwise":{id:"rotate:clockwise",labelKey:"rotate.clockwise",icon:"rotateClockwise",shortcuts:["Ctrl+]","Meta+]"],categories:["page","rotate","rotate-clockwise"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("rotate"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).rotateForward()}},"rotate:counter-clockwise":{id:"rotate:counter-clockwise",labelKey:"rotate.counterClockwise",icon:"rotateCounterClockwise",shortcuts:["Ctrl+[","Meta+["],categories:["page","rotate","rotate-counter-clockwise"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("rotate"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).rotateBackward()}},"scroll:vertical":{id:"scroll:vertical",labelKey:"page.vertical",icon:"vertical",categories:["page","scroll","scroll-vertical"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setScrollStrategy(Uo.Vertical)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.strategy)===Uo.Vertical}},"scroll:horizontal":{id:"scroll:horizontal",labelKey:"page.horizontal",icon:"horizontal",categories:["page","scroll","scroll-horizontal"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).setScrollStrategy(Uo.Horizontal)},active:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.strategy)===Uo.Horizontal}},"scroll:next-page":{id:"scroll:next-page",labelKey:"page.next",icon:"chevronRight",categories:["page","navigation","navigation-next"],shortcuts:["Ctrl+]","Meta+]","ArrowRight"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).scrollToNextPage()},disabled:function(e){var t,n,o=e.state,i=e.documentId;return(null===(t=o.plugins.scroll)||void 0===t||null===(t=t.documents[i])||void 0===t?void 0:t.currentPage)>=(null===(n=o.plugins.scroll)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.totalPages)}},"scroll:previous-page":{id:"scroll:previous-page",labelKey:"page.previous",icon:"chevronLeft",categories:["page","navigation","navigation-previous"],shortcuts:["Ctrl+[","Meta+[","ArrowLeft"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).scrollToPreviousPage()},disabled:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.currentPage)<=1}},"mode:view":{id:"mode:view",labelKey:"mode.view",categories:["mode","mode-view"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin("ui"))||void 0===t?void 0:t.provides(),a=null===(n=o.getPlugin("interaction-manager"))||void 0===n?void 0:n.provides();if(r&&a){var s=a.forDocument(i);s&&(s.activate("pointerMode"),r.forDocument(i).closeToolbarSlot("top","secondary"))}},active:function(e){var t=e.state,n=e.documentId;return!wr(t.plugins,n,"top","secondary")}},"mode:annotate":{id:"mode:annotate",labelKey:"mode.annotate",categories:["mode","mode-annotate","annotation"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","annotation-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return wr(t.plugins,n,"top","secondary","annotation-toolbar")}},"mode:shapes":{id:"mode:shapes",labelKey:"mode.shapes",categories:["mode","mode-shapes","annotation"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","shapes-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return wr(t.plugins,n,"top","secondary","shapes-toolbar")}},"mode:redact":{id:"mode:redact",labelKey:"mode.redact",categories:["mode","mode-redact","redaction"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","redaction-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return wr(t.plugins,n,"top","secondary","redaction-toolbar")}},"tabs:overflow-menu":{id:"tabs:overflow-menu",labelKey:"tabs.overflowMenu",icon:"dots",categories:["ui","ui-menu"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.toggleMenu("mode-tabs-overflow-menu","tabs:overflow-menu","overflow-tabs-button",o)},active:function(e){var t,n=e.state,o=e.documentId;return void 0!==(null===(t=n.plugins.ui)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.openMenus["mode-tabs-overflow-menu"])}},"annotation:add-highlight":{id:"annotation:add-highlight",labelKey:"annotation.highlight",icon:"highlight",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"highlight"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-highlight"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin(Ml))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(hs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&a&&c){var d=null==a?void 0:a.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=a.getTool("highlight");if(h&&Uc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=s(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=bn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.HIGHLIGHT,blendMode:St.Multiply,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},xn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("highlight"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"highlight"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("highlight")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"highlight"===(null==i?void 0:i.activeToolId)}},"annotation:add-underline":{id:"annotation:add-underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"underline"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-underline"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin(Ml))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(hs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&a&&c){var d=null==a?void 0:a.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=a.getTool("underline");if(h&&Bc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=s(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=bn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.UNDERLINE,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},xn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("underline"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"underline"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("underline")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"underline"===(null==i?void 0:i.activeToolId)}},"annotation:add-strikeout":{id:"annotation:add-strikeout",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"strikeout"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-strikeout"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin(Ml))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(hs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&a&&c){var d=null==a?void 0:a.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=a.getTool("strikeout");if(h&&qc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=s(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=bn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.STRIKEOUT,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},xn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("strikeout"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"strikeout"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("strikeout")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"strikeout"===(null==i?void 0:i.activeToolId)}},"annotation:add-squiggly":{id:"annotation:add-squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"squiggly"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-markup","annotation-squiggly"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin(Ml))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(hs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&a&&c){var d=null==a?void 0:a.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var h=a.getTool("squiggly");if(h&&Wc(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var v,f=s(g);try{var y=function(){var e=v.value;p.wait(function(t){var n=bn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:Mt.SQUIGGLY,color:m.color,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},xn)};for(f.s();!(v=f.n()).done;)y()}catch(e){f.e(e)}finally{f.f()}u.clear(),d.setActiveTool("squiggly"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"squiggly"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("squiggly")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"squiggly"===(null==i?void 0:i.activeToolId)}},"annotation:add-ink":{id:"annotation:add-ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"ink"))||void 0===t?void 0:t.color}},categories:["annotation","annotation-ink"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("ink"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("ink"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"ink"===(null==i?void 0:i.activeToolId)}},"annotation:add-text":{id:"annotation:add-text",labelKey:"annotation.text",icon:"text",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"freeText"))||void 0===t?void 0:t.fontColor}},categories:["annotation","annotation-text"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("freeText"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("freeText"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"freeText"===(null==i?void 0:i.activeToolId)}},"annotation:add-stamp":{id:"annotation:add-stamp",labelKey:"annotation.stamp",icon:"photo",categories:["annotation","annotation-stamp"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("stamp"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("stamp"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"stamp"===(null==i?void 0:i.activeToolId)}},"annotation:add-rectangle":{id:"annotation:add-rectangle",labelKey:"annotation.rectangle",icon:"square",iconProps:function(e){var t,n,o=e.state;return{primaryColor:null===(t=hc(o.plugins.annotation,"square"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=hc(o.plugins.annotation,"square"))||void 0===n?void 0:n.color}},categories:["annotation","annotation-shape","annotation-rectangle"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("square"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("square"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"square"===(null==i?void 0:i.activeToolId)}},"annotation:add-circle":{id:"annotation:add-circle",labelKey:"annotation.circle",icon:"circle",iconProps:function(e){var t,n,o=e.state;return{primaryColor:null===(t=hc(o.plugins.annotation,"circle"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=hc(o.plugins.annotation,"circle"))||void 0===n?void 0:n.color}},categories:["annotation","annotation-shape","annotation-circle"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("circle"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("circle"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"circle"===(null==i?void 0:i.activeToolId)}},"annotation:add-line":{id:"annotation:add-line",labelKey:"annotation.line",icon:"line",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"line"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-shape","annotation-line"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("line"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("line"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"line"===(null==i?void 0:i.activeToolId)}},"annotation:add-arrow":{id:"annotation:add-arrow",labelKey:"annotation.arrow",icon:"lineArrow",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"line"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-shape","annotation-arrow"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("lineArrow"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("lineArrow"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"lineArrow"===(null==i?void 0:i.activeToolId)}},"annotation:add-polygon":{id:"annotation:add-polygon",labelKey:"annotation.polygon",icon:"polygon",iconProps:function(e){var t,n,o=e.state;return{primaryColor:null===(t=hc(o.plugins.annotation,"polygon"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=hc(o.plugins.annotation,"polygon"))||void 0===n?void 0:n.color}},categories:["annotation","annotation-shape","annotation-polygon"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("polygon"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("polygon"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"polygon"===(null==i?void 0:i.activeToolId)}},"annotation:add-polyline":{id:"annotation:add-polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){var t;return{primaryColor:null===(t=hc(e.state.plugins.annotation,"polyline"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-shape","annotation-polyline"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Ml))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("polyline"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("polyline"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Ml])||void 0===t?void 0:t.documents[o];return"polyline"===(null==i?void 0:i.activeToolId)}},"annotation:delete-selected":{id:"annotation:delete-selected",labelKey:"annotation.deleteSelected",icon:"trash",categories:["annotation","annotation-delete"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Ml))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o);if(r){var a=r.getSelectedAnnotation();a&&r.deleteAnnotation(a.object.pageIndex,a.object.id)}}},"annotation:overflow-tools":{id:"annotation:overflow-tools",labelKey:"annotation.moreTools",icon:"dots",categories:["annotation","annotation-overflow"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();if(i){var r=i.forDocument(o);r&&r.toggleMenu("annotation-tools-menu","annotation:overflow-tools","overflow-annotation-tools")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["annotation-tools-menu"])}},"annotation:overflow-shapes":{id:"annotation:overflow-shapes",labelKey:"annotation.moreTools",icon:"dots",categories:["annotation","annotation-shape","annotation-overflow"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();if(i){var r=i.forDocument(o);r&&r.toggleMenu("shapes-tools-menu","annotation:overflow-shapes","overflow-shapes-tools")}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins.ui)||void 0===t?void 0:t.documents[o];return void 0!==(null==i?void 0:i.openMenus["shapes-tools-menu"])}},"redaction:redact-area":{id:"redaction:redact-area",labelKey:"redaction.area",icon:"redactArea",categories:["redaction","redaction-area"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).toggleMarqueeRedact()},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[sh])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===Uu.MarqueeRedact}},"redaction:redact-text":{id:"redaction:redact-text",labelKey:"redaction.text",icon:"redact",categories:["redaction","redaction-text"],action:function(e){var t,n,o,i,r=e.registry,a=e.documentId,s=null===(t=r.getPlugin("redaction"))||void 0===t?void 0:t.provides(),l=null===(n=r.getPlugin(hs))||void 0===n?void 0:n.provides(),c=null===(o=r.getPlugin("ui"))||void 0===o?void 0:o.provides();if(s&&l&&c){var d=s.forDocument(a),u=null==l?void 0:l.forDocument(a);(null!==(i=null==u?void 0:u.getFormattedSelection())&&void 0!==i?i:[]).length>0?(d.queueCurrentSelectionAsPending(),c.setActiveToolbar("top","secondary","redaction-toolbar",a)):d.toggleRedactSelection()}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[sh])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===Uu.RedactSelection}},"redaction:apply-all":{id:"redaction:apply-all",labelKey:"redaction.applyAll",icon:"check",categories:["redaction","redaction-apply"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).commitAllPending()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[sh])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)}},"redaction:clear-all":{id:"redaction:clear-all",labelKey:"redaction.clearAll",icon:"x",categories:["redaction","redaction-clear"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).clearPending()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[sh])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)}},"redaction:delete-selected":{id:"redaction:delete-selected",labelKey:"redaction.deleteSelected",icon:"trash",categories:["redaction","redaction-delete"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o).getSelectedPending();r&&(null==i||i.forDocument(o).removePending(r.page,r.id))}},"redaction:commit-selected":{id:"redaction:commit-selected",labelKey:"redaction.commitSelected",icon:"check",categories:["redaction","redaction-commit"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("redaction"))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o).getSelectedPending();r&&(null==i||i.forDocument(o).commitPending(r.page,r.id))}},"selection:copy":{id:"selection:copy",labelKey:"selection.copy",icon:"copy",categories:["selection","selection-copy"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin("selection"),i=null==o?void 0:o.provides().forDocument(n);null==i||i.copyToClipboard(),null==i||i.clear()}},"history:undo":{id:"history:undo",labelKey:"history.undo",icon:"arrowBackUp",shortcuts:["Ctrl+Z","Meta+Z"],categories:["history","history-undo"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Eu))||void 0===t?void 0:t.provides();i&&i.forDocument(o).undo()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Eu])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canUndo)}},"history:redo":{id:"history:redo",labelKey:"history.redo",icon:"arrowForwardUp",shortcuts:["Ctrl+Y","Meta+Shift+Z"],categories:["history","history-redo"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Eu))||void 0===t?void 0:t.provides();i&&i.forDocument(o).redo()},disabled:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Eu])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canRedo)}}}},i18n:{defaultLocale:"en",locales:[{code:"en",name:"English",translations:{search:{placeholder:"Search",caseSensitive:"Case sensitive",wholeWord:"Whole word",resultsFound:"{count} results found",page:"Page {page}"},zoom:{in:"Zoom In",out:"Zoom Out",fitWidth:"Fit to Width",fitPage:"Fit to Page",marquee:"Marquee Zoom",menu:"Zoom Menu",level:"Zoom Level ({level}%)"},pan:{toggle:"Toggle Pan Mode"},pointer:{toggle:"Toggle Pointer Mode"},capture:{screenshot:"Screenshot"},document:{menu:"Document Menu",open:"Open",close:"Close",print:"Print",export:"Export",fullscreen:"Fullscreen",loading:"Loading document..."},emptyState:{title:"No Documents Open",description:"Open a PDF document to get started.",descriptionMulti:"You can view multiple documents using tabs.",openButton:"Open Document",supportedFormats:"Supported format: PDF"},passwordPrompt:{title:"Password Required",required:"This document is password protected. Please enter the password to open it.",incorrect:"The password you entered was incorrect. Please try again.",incorrectWarning:"Incorrect password. Please check and try again.",label:"Password",placeholder:"Enter document password",open:"Open",opening:"Opening...",cancel:"Cancel",close:"Close"},documentError:{title:"Error loading document",unknown:"An unknown error occurred",errorCode:"Error Code: {code}",close:"Close Document"},panel:{sidebar:"Sidebar",search:"Search",comment:"Comment",thumbnails:"Thumbnails",outline:"Outline",annotationStyle:"Annotation Style"},menu:{viewControls:"View Controls",zoomControls:"Zoom Controls",moreOptions:"More Options"},outline:{title:"Outline",loading:"Loading outline...",noOutline:"No outline available",noBookmarks:"This document doesn't contain bookmarks"},page:{settings:"Page Settings",single:"Single Page",twoOdd:"Two Page (Odd)",twoEven:"Two Page (Even)",vertical:"Vertical",horizontal:"Horizontal",spreadMode:"Spread Mode",scrollLayout:"Scroll Layout",rotation:"Page Rotation",next:"Next Page",previous:"Previous Page"},rotate:{clockwise:"Rotate Clockwise",counterClockwise:"Rotate Counter-Clockwise"},selection:{copy:"Copy Selection"},mode:{view:"View",annotate:"Annotate",shapes:"Shapes",redact:"Redact"},annotation:{text:"Text",highlight:"Highlight",strikeout:"Strikethrough",underline:"Underline",squiggly:"Squiggly",rectangle:"Rectangle",circle:"Circle",line:"Line",arrow:"Arrow",polygon:"Polygon",polyline:"Polyline",ink:"Ink",stamp:"Stamp",freeText:"Free Text",square:"Square",styles:"{type} Styles",defaults:"{type} Defaults",color:"Color",opacity:"Opacity",blendMode:"Blend mode",strokeWidth:"Stroke width",strokeColor:"Stroke color",borderStyle:"Border style",fillColor:"Fill color",fontSize:"Font size",fontFamily:"Font",textAlign:"Text alignment",verticalAlign:"Vertical alignment",lineEnding:"Line ending",lineStart:"Line start",lineEnd:"Line end",font:"Font",fontColor:"Font color",backgroundColor:"Background color",noStyles:"There are no styles for this annotation.",noStylesStamp:"There are no styles for stamps.",selectAnnotation:"Select an annotation to see styles",deleteSelected:"Delete selected annotation",moreTools:"More Tools"},redaction:{area:"Redact Area",text:"Redact Text",applyAll:"Apply All",clearAll:"Clear All"},history:{undo:"Undo",redo:"Redo"},comments:{page:"Page {page}",commentCount:"{count} comment",commentCountPlural:"{count} comments",addComment:"Add comment...",addReply:"Add reply...",save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",showMore:"more",showLess:"less",emptyState:"Add annotations to be able to comment on them."},blendMode:{normal:"Normal",multiply:"Multiply",screen:"Screen",overlay:"Overlay",darken:"Darken",lighten:"Lighten",colorDodge:"Color Dodge",colorBurn:"Color Burn",hardLight:"Hard Light",softLight:"Soft Light",difference:"Difference",exclusion:"Exclusion",hue:"Hue",saturation:"Saturation",color:"Color",luminosity:"Luminosity"}}},{code:"nl",name:"Nederlands",translations:{search:{placeholder:"Zoeken",caseSensitive:"Hoofdlettergevoelig",wholeWord:"Heel woord",resultsFound:"{count} resultaten gevonden",page:"Pagina {page}"},zoom:{in:"Inzoomen",out:"Uitzoomen",fitWidth:"Aanbreedte aanpassen",fitPage:"Aan pagina aanpassen",marquee:"Lijstzoom",menu:"Zoommenu",level:"Zoomniveau ({level}%)"},pan:{toggle:"Pan-modus wisselen"},pointer:{toggle:"Aanwijzermodus wisselen"},capture:{screenshot:"Schermafbeelding"},document:{menu:"Documentmenu",open:"Openen",close:"Sluiten",print:"Afdrukken",export:"Exporteren",fullscreen:"Volledig scherm",loading:"Document laden..."},emptyState:{title:"Geen documenten geopend",description:"Open een PDF-document om te beginnen.",descriptionMulti:"U kunt meerdere documenten bekijken met tabs.",openButton:"Document openen",supportedFormats:"Ondersteund formaat: PDF"},passwordPrompt:{title:"Wachtwoord vereist",required:"Dit document is beveiligd met een wachtwoord. Voer het wachtwoord in om te openen.",incorrect:"Het ingevoerde wachtwoord was onjuist. Probeer het opnieuw.",incorrectWarning:"Onjuist wachtwoord. Controleer en probeer opnieuw.",label:"Wachtwoord",placeholder:"Voer documentwachtwoord in",open:"Openen",opening:"Openen...",cancel:"Annuleren",close:"Sluiten"},documentError:{title:"Fout bij laden van document",unknown:"Er is een onbekende fout opgetreden",errorCode:"Foutcode: {code}",close:"Document sluiten"},panel:{sidebar:"Zijbalk",search:"Zoeken",comment:"Opmerking",thumbnails:"Miniaturen",outline:"Overzicht",annotationStyle:"Annotatiestijl"},menu:{viewControls:"Weergave-instellingen",zoomControls:"Zoom-instellingen",moreOptions:"Meer opties"},outline:{title:"Overzicht",loading:"Overzicht laden...",noOutline:"Geen overzicht beschikbaar",noBookmarks:"Dit document bevat geen bladwijzers"},page:{settings:"Pagina-instellingen",single:"Enkele pagina",twoOdd:"Twee pagina's (Oneven)",twoEven:"Twee pagina's (Even)",vertical:"Verticaal",horizontal:"Horizontaal",spreadMode:"Spreidingsmodus",scrollLayout:"Scrollindeling",rotation:"Paginarotatie",next:"Volgende pagina",previous:"Vorige pagina"},rotate:{clockwise:"Met de klok mee draaien",counterClockwise:"Tegen de klok in draaien"},selection:{copy:"Selectie kopiëren"},mode:{view:"Weergave",annotate:"Annoteren",shapes:"Vormen",redact:"Redigeren"},annotation:{text:"Tekst",highlight:"Markeren",strikeout:"Doorhalen",underline:"Onderstrepen",squiggly:"Golflijn",rectangle:"Rechthoek",circle:"Cirkel",line:"Lijn",arrow:"Pijl",polygon:"Veelhoek",polyline:"Polylijn",ink:"Inkt",stamp:"Stempel",freeText:"Vrije tekst",square:"Vierkant",styles:"{type} stijlen",defaults:"{type} standaardwaarden",color:"Kleur",opacity:"Dekking",blendMode:"Overvloeimodus",strokeWidth:"Lijndikte",strokeColor:"Lijnkleur",borderStyle:"Randstijl",fillColor:"Vulkleur",fontSize:"Lettergrootte",fontFamily:"Lettertype",textAlign:"Tekstuitlijning",verticalAlign:"Verticale uitlijning",lineEnding:"Lijneinde",lineStart:"Lijnbegin",lineEnd:"Lijneinde",font:"Lettertype",fontColor:"Tekstkleur",backgroundColor:"Achtergrondkleur",noStyles:"Er zijn geen stijlen voor deze annotatie.",noStylesStamp:"Er zijn geen stijlen voor stempels.",selectAnnotation:"Selecteer een annotatie om stijlen te zien",deleteSelected:"Geselecteerde annotatie verwijderen",moreTools:"Meer gereedschappen"},redaction:{area:"Gebied redigeren",text:"Tekst redigeren",applyAll:"Alles toepassen",clearAll:"Alles wissen"},history:{undo:"Ongedaan maken",redo:"Opnieuw doen"},comments:{page:"Pagina {page}",commentCount:"{count} opmerking",commentCountPlural:"{count} opmerkingen",addComment:"Opmerking toevoegen...",addReply:"Antwoord toevoegen...",save:"Opslaan",cancel:"Annuleren",edit:"Bewerken",delete:"Verwijderen",showMore:"meer",showLess:"minder",emptyState:"Voeg annotaties toe om erop te kunnen reageren."},blendMode:{normal:"Normaal",multiply:"Vermenigvuldigen",screen:"Bleken",overlay:"Bedekken",darken:"Donkerder",lighten:"Lichter",colorDodge:"Kleur tegenhouden",colorBurn:"Kleur doordrukken",hardLight:"Hard licht",softLight:"Zacht licht",difference:"Verschil",exclusion:"Uitsluiting",hue:"Kleurtoon",saturation:"Verzadiging",color:"Kleur",luminosity:"Helderheid"}}},{code:"de",name:"Deutsch",translations:{search:{placeholder:"Suchen",caseSensitive:"Groß-/Kleinschreibung",wholeWord:"Ganzes Wort",resultsFound:"{count} Ergebnisse gefunden",page:"Seite {page}"},zoom:{in:"Vergrößern",out:"Verkleinern",fitWidth:"An Breite anpassen",fitPage:"An Seite anpassen",marquee:"Laufrahmen-Zoom",menu:"Zoom-Menü",level:"Zoomstufe ({level}%)"},pan:{toggle:"Verschieben-Modus umschalten"},pointer:{toggle:"Zeiger-Modus umschalten"},capture:{screenshot:"Screenshot"},document:{menu:"Dokument-Menü",open:"Öffnen",close:"Schließen",print:"Drucken",export:"Exportieren",fullscreen:"Vollbild",loading:"Dokument wird geladen..."},emptyState:{title:"Keine Dokumente geöffnet",description:"Öffnen Sie ein PDF-Dokument, um zu beginnen.",descriptionMulti:"Sie können mehrere Dokumente mit Tabs anzeigen.",openButton:"Dokument öffnen",supportedFormats:"Unterstütztes Format: PDF"},passwordPrompt:{title:"Passwort erforderlich",required:"Dieses Dokument ist passwortgeschützt. Bitte geben Sie das Passwort ein.",incorrect:"Das eingegebene Passwort war falsch. Bitte versuchen Sie es erneut.",incorrectWarning:"Falsches Passwort. Bitte überprüfen und erneut versuchen.",label:"Passwort",placeholder:"Dokumentpasswort eingeben",open:"Öffnen",opening:"Öffnen...",cancel:"Abbrechen",close:"Schließen"},documentError:{title:"Fehler beim Laden des Dokuments",unknown:"Ein unbekannter Fehler ist aufgetreten",errorCode:"Fehlercode: {code}",close:"Dokument schließen"},panel:{sidebar:"Seitenleiste",search:"Suchen",comment:"Kommentar",thumbnails:"Miniaturansichten",outline:"Gliederung",annotationStyle:"Anmerkungsstil"},menu:{viewControls:"Ansichtseinstellungen",zoomControls:"Zoom-Einstellungen",moreOptions:"Weitere Optionen"},outline:{title:"Gliederung",loading:"Gliederung wird geladen...",noOutline:"Keine Gliederung verfügbar",noBookmarks:"Dieses Dokument enthält keine Lesezeichen"},page:{settings:"Seiteneinstellungen",single:"Einzelseite",twoOdd:"Zwei Seiten (Ungerade)",twoEven:"Zwei Seiten (Gerade)",vertical:"Vertikal",horizontal:"Horizontal",spreadMode:"Doppelseiten-Modus",scrollLayout:"Scroll-Layout",rotation:"Seitendrehung",next:"Nächste Seite",previous:"Vorherige Seite"},rotate:{clockwise:"Im Uhrzeigersinn drehen",counterClockwise:"Gegen den Uhrzeigersinn drehen"},selection:{copy:"Auswahl kopieren"},mode:{view:"Ansicht",annotate:"Annotieren",shapes:"Formen",redact:"Schwärzen"},annotation:{text:"Text",highlight:"Markieren",strikeout:"Durchstreichen",underline:"Unterstreichen",squiggly:"Wellenlinie",rectangle:"Rechteck",circle:"Kreis",line:"Linie",arrow:"Pfeil",polygon:"Polygon",polyline:"Polylinie",ink:"Freihand",stamp:"Stempel",freeText:"Freitext",square:"Quadrat",styles:"{type}-Stile",defaults:"{type}-Standardwerte",color:"Farbe",opacity:"Deckkraft",blendMode:"Mischmodus",strokeWidth:"Strichstärke",strokeColor:"Strichfarbe",borderStyle:"Rahmenstil",fillColor:"Füllfarbe",fontSize:"Schriftgröße",fontFamily:"Schriftart",textAlign:"Textausrichtung",verticalAlign:"Vertikale Ausrichtung",lineEnding:"Linienende",lineStart:"Linienanfang",lineEnd:"Linienende",font:"Schriftart",fontColor:"Schriftfarbe",backgroundColor:"Hintergrundfarbe",noStyles:"Für diese Anmerkung gibt es keine Stile.",noStylesStamp:"Für Stempel gibt es keine Stile.",selectAnnotation:"Wählen Sie eine Anmerkung aus, um Stile anzuzeigen",deleteSelected:"Ausgewählte Anmerkung löschen",moreTools:"Weitere Werkzeuge"},redaction:{area:"Bereich schwärzen",text:"Text schwärzen",applyAll:"Alle anwenden",clearAll:"Alle löschen"},history:{undo:"Rückgängig",redo:"Wiederholen"},comments:{page:"Seite {page}",commentCount:"{count} Kommentar",commentCountPlural:"{count} Kommentare",addComment:"Kommentar hinzufügen...",addReply:"Antwort hinzufügen...",save:"Speichern",cancel:"Abbrechen",edit:"Bearbeiten",delete:"Löschen",showMore:"mehr",showLess:"weniger",emptyState:"Fügen Sie Anmerkungen hinzu, um sie kommentieren zu können."},blendMode:{normal:"Normal",multiply:"Multiplizieren",screen:"Negativ multiplizieren",overlay:"Ineinanderkopieren",darken:"Abdunkeln",lighten:"Aufhellen",colorDodge:"Farbig abwedeln",colorBurn:"Farbig nachbelichten",hardLight:"Hartes Licht",softLight:"Weiches Licht",difference:"Differenz",exclusion:"Ausschluss",hue:"Farbton",saturation:"Sättigung",color:"Farbe",luminosity:"Luminanz"}}},{code:"fr",name:"Français",translations:{search:{placeholder:"Rechercher",caseSensitive:"Respecter la casse",wholeWord:"Mot entier",resultsFound:"{count} résultats trouvés",page:"Page {page}"},zoom:{in:"Zoom avant",out:"Zoom arrière",fitWidth:"Ajuster à la largeur",fitPage:"Ajuster à la page",marquee:"Zoom de sélection",menu:"Menu Zoom",level:"Niveau de zoom ({level}%)"},pan:{toggle:"Basculer le mode déplacement"},pointer:{toggle:"Basculer le mode pointeur"},capture:{screenshot:"Capture d'écran"},document:{menu:"Menu Document",open:"Ouvrir",close:"Fermer",print:"Imprimer",export:"Exporter",fullscreen:"Plein écran",loading:"Chargement du document..."},emptyState:{title:"Aucun document ouvert",description:"Ouvrez un document PDF pour commencer.",descriptionMulti:"Vous pouvez afficher plusieurs documents avec des onglets.",openButton:"Ouvrir un document",supportedFormats:"Format pris en charge : PDF"},passwordPrompt:{title:"Mot de passe requis",required:"Ce document est protégé par mot de passe. Veuillez entrer le mot de passe.",incorrect:"Le mot de passe saisi est incorrect. Veuillez réessayer.",incorrectWarning:"Mot de passe incorrect. Veuillez vérifier et réessayer.",label:"Mot de passe",placeholder:"Entrer le mot de passe du document",open:"Ouvrir",opening:"Ouverture...",cancel:"Annuler",close:"Fermer"},documentError:{title:"Erreur lors du chargement du document",unknown:"Une erreur inconnue est survenue",errorCode:"Code erreur : {code}",close:"Fermer le document"},panel:{sidebar:"Barre latérale",search:"Rechercher",comment:"Commentaire",thumbnails:"Miniatures",outline:"Plan",annotationStyle:"Style d'annotation"},menu:{viewControls:"Contrôles d'affichage",zoomControls:"Contrôles de zoom",moreOptions:"Plus d'options"},outline:{title:"Plan",loading:"Chargement du plan...",noOutline:"Aucun plan disponible",noBookmarks:"Ce document ne contient pas de signets"},page:{settings:"Paramètres de page",single:"Page unique",twoOdd:"Deux pages (Impair)",twoEven:"Deux pages (Pair)",vertical:"Vertical",horizontal:"Horizontal",spreadMode:"Mode double page",scrollLayout:"Disposition de défilement",rotation:"Rotation de page",next:"Page suivante",previous:"Page précédente"},rotate:{clockwise:"Tourner dans le sens horaire",counterClockwise:"Tourner dans le sens antihoraire"},selection:{copy:"Copier la sélection"},mode:{view:"Affichage",annotate:"Annoter",shapes:"Formes",redact:"Caviarder"},annotation:{text:"Texte",highlight:"Surligner",strikeout:"Barrer",underline:"Souligner",squiggly:"Ondulé",rectangle:"Rectangle",circle:"Cercle",line:"Ligne",arrow:"Flèche",polygon:"Polygone",polyline:"Polyligne",ink:"Encre",stamp:"Tampon",freeText:"Texte libre",square:"Carré",styles:"Styles de {type}",defaults:"Valeurs par défaut de {type}",color:"Couleur",opacity:"Opacité",blendMode:"Mode de fusion",strokeWidth:"Épaisseur du trait",strokeColor:"Couleur du trait",borderStyle:"Style de bordure",fillColor:"Couleur de remplissage",fontSize:"Taille de police",fontFamily:"Police",textAlign:"Alignement du texte",verticalAlign:"Alignement vertical",lineEnding:"Fin de ligne",lineStart:"Début de ligne",lineEnd:"Fin de ligne",font:"Police",fontColor:"Couleur du texte",backgroundColor:"Couleur de fond",noStyles:"Il n'y a pas de styles pour cette annotation.",noStylesStamp:"Il n'y a pas de styles pour les tampons.",selectAnnotation:"Sélectionnez une annotation pour voir les styles",deleteSelected:"Supprimer l'annotation sélectionnée",moreTools:"Plus d'outils"},redaction:{area:"Caviarder la zone",text:"Caviarder le texte",applyAll:"Tout appliquer",clearAll:"Tout effacer"},history:{undo:"Annuler",redo:"Refaire"},comments:{page:"Page {page}",commentCount:"{count} commentaire",commentCountPlural:"{count} commentaires",addComment:"Ajouter un commentaire...",addReply:"Ajouter une réponse...",save:"Enregistrer",cancel:"Annuler",edit:"Modifier",delete:"Supprimer",showMore:"plus",showLess:"moins",emptyState:"Ajoutez des annotations pour pouvoir les commenter."},blendMode:{normal:"Normal",multiply:"Produit",screen:"Superposition",overlay:"Incrustation",darken:"Obscurcir",lighten:"Éclaircir",colorDodge:"Densité couleur -",colorBurn:"Densité couleur +",hardLight:"Lumière crue",softLight:"Lumière tamisée",difference:"Différence",exclusion:"Exclusion",hue:"Teinte",saturation:"Saturation",color:"Couleur",luminosity:"Luminosité"}}},{code:"es",name:"Español",translations:{search:{placeholder:"Buscar",caseSensitive:"Distinguir mayúsculas",wholeWord:"Palabra completa",resultsFound:"{count} resultados encontrados",page:"Página {page}"},zoom:{in:"Acercar",out:"Alejar",fitWidth:"Ajustar al ancho",fitPage:"Ajustar a la página",marquee:"Zoom de selección",menu:"Menú de zoom",level:"Nivel de zoom ({level}%)"},pan:{toggle:"Alternar modo desplazamiento"},pointer:{toggle:"Alternar modo puntero"},capture:{screenshot:"Captura de pantalla"},document:{menu:"Menú del documento",open:"Abrir",close:"Cerrar",print:"Imprimir",export:"Exportar",fullscreen:"Pantalla completa",loading:"Cargando documento..."},emptyState:{title:"No hay documentos abiertos",description:"Abra un documento PDF para comenzar.",descriptionMulti:"Puede ver varios documentos usando pestañas.",openButton:"Abrir documento",supportedFormats:"Formato compatible: PDF"},passwordPrompt:{title:"Contraseña requerida",required:"Este documento está protegido con contraseña. Por favor, ingrese la contraseña para abrirlo.",incorrect:"La contraseña ingresada es incorrecta. Por favor, inténtelo de nuevo.",incorrectWarning:"Contraseña incorrecta. Por favor, verifique e inténtelo de nuevo.",label:"Contraseña",placeholder:"Ingrese la contraseña del documento",open:"Abrir",opening:"Abriendo...",cancel:"Cancelar",close:"Cerrar"},documentError:{title:"Error al cargar el documento",unknown:"Ha ocurrido un error desconocido",errorCode:"Código de error: {code}",close:"Cerrar documento"},panel:{sidebar:"Barra lateral",search:"Buscar",comment:"Comentario",thumbnails:"Miniaturas",outline:"Esquema",annotationStyle:"Estilo de anotación"},menu:{viewControls:"Controles de vista",zoomControls:"Controles de zoom",moreOptions:"Más opciones"},outline:{title:"Esquema",loading:"Cargando esquema...",noOutline:"No hay esquema disponible",noBookmarks:"Este documento no contiene marcadores"},page:{settings:"Configuración de página",single:"Página única",twoOdd:"Dos páginas (Impar)",twoEven:"Dos páginas (Par)",vertical:"Vertical",horizontal:"Horizontal",spreadMode:"Modo de doble página",scrollLayout:"Diseño de desplazamiento",rotation:"Rotación de página",next:"Página siguiente",previous:"Página anterior"},rotate:{clockwise:"Rotar en sentido horario",counterClockwise:"Rotar en sentido antihorario"},selection:{copy:"Copiar selección"},mode:{view:"Ver",annotate:"Anotar",shapes:"Formas",redact:"Redactar"},annotation:{text:"Texto",highlight:"Resaltar",strikeout:"Tachar",underline:"Subrayar",squiggly:"Ondulado",rectangle:"Rectángulo",circle:"Círculo",line:"Línea",arrow:"Flecha",polygon:"Polígono",polyline:"Polilínea",ink:"Tinta",stamp:"Sello",freeText:"Texto libre",square:"Cuadrado",styles:"Estilos de {type}",defaults:"Valores predeterminados de {type}",color:"Color",opacity:"Opacidad",blendMode:"Modo de fusión",strokeWidth:"Grosor del trazo",strokeColor:"Color del trazo",borderStyle:"Estilo del borde",fillColor:"Color de relleno",fontSize:"Tamaño de fuente",fontFamily:"Fuente",textAlign:"Alineación del texto",verticalAlign:"Alineación vertical",lineEnding:"Final de línea",lineStart:"Inicio de línea",lineEnd:"Final de línea",font:"Fuente",fontColor:"Color de fuente",backgroundColor:"Color de fondo",noStyles:"No hay estilos para esta anotación.",noStylesStamp:"No hay estilos para los sellos.",selectAnnotation:"Seleccione una anotación para ver los estilos",deleteSelected:"Eliminar anotación seleccionada",moreTools:"Más herramientas"},redaction:{area:"Redactar área",text:"Redactar texto",applyAll:"Aplicar todo",clearAll:"Borrar todo"},history:{undo:"Deshacer",redo:"Rehacer"},comments:{page:"Página {page}",commentCount:"{count} comentario",commentCountPlural:"{count} comentarios",addComment:"Añadir comentario...",addReply:"Añadir respuesta...",save:"Guardar",cancel:"Cancelar",edit:"Editar",delete:"Eliminar",showMore:"más",showLess:"menos",emptyState:"Añada anotaciones para poder comentarlas."},blendMode:{normal:"Normal",multiply:"Multiplicar",screen:"Trama",overlay:"Superponer",darken:"Oscurecer",lighten:"Aclarar",colorDodge:"Sobreexponer color",colorBurn:"Subexponer color",hardLight:"Luz fuerte",softLight:"Luz suave",difference:"Diferencia",exclusion:"Exclusión",hue:"Tono",saturation:"Saturación",color:"Color",luminosity:"Luminosidad"}}}],paramResolvers:{"zoom.level":function(e){var t,n,o=e.state,i=e.documentId,r=i&&null!==(t=null===(n=o.plugins[va])||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.currentZoomLevel)&&void 0!==t?t:1;return{level:Math.round(100*r)}}}},ui:{schema:{id:"pdf-viewer-ui",version:"1.0.0",toolbars:{"main-toolbar":{id:"main-toolbar",position:{placement:"top",slot:"main",order:0},permanent:!0,responsive:{localeOverrides:{groups:[{id:"germanic-languages",locales:["de","nl"],breakpoints:{md:{replaceShow:["view-mode","annotate-mode","zoom-toolbar","pan-button","pointer-button","divider-3","overflow-tabs-button"]}}}]},breakpoints:{xxxs:{maxWidth:400,hide:["annotate-mode","view-mode","shapes-mode","redact-mode","zoom-toolbar","pan-button","pointer-button","divider-3","page-settings-button","zoom-menu-button","divider-2","overflow-tabs-button"],show:["mode-select-button"]},xxs:{minWidth:400,show:["page-settings-button","zoom-menu-button","divider-2"],hide:["overflow-left-action-menu-button"]},xs:{minWidth:500,maxWidth:640,show:["pan-button","pointer-button","divider-3"]},sm:{minWidth:640,maxWidth:768,hide:["shapes-mode","redact-mode","zoom-toolbar","mode-select-button"],show:["view-mode","annotate-mode","overflow-tabs-button","pan-button","pointer-button","divider-3"]},md:{minWidth:768,show:["view-mode","annotate-mode","shapes-mode","zoom-toolbar","pan-button","pointer-button","divider-3","overflow-tabs-button"],hide:["zoom-menu-button","mode-select-button"]},lg:{minWidth:1024,show:["shapes-mode","redact-mode"],hide:["overflow-tabs-button"]}}},items:[{type:"group",id:"left-group",alignment:"start",gap:2,items:[{type:"command-button",id:"document-menu-button",commandId:"document:menu",variant:"icon",categories:["document","document-menu"]},{type:"divider",id:"divider-1",orientation:"vertical"},{type:"command-button",id:"sidebar-button",commandId:"panel:toggle-sidebar",variant:"icon",categories:["panel","panel-sidebar"]},{type:"command-button",id:"overflow-left-action-menu-button",commandId:"left-action-menu:overflow-menu",variant:"icon",categories:["ui","ui-menu"]},{type:"command-button",id:"page-settings-button",commandId:"page:settings",variant:"icon",categories:["page","page-settings"]}]},{type:"divider",id:"divider-2",orientation:"vertical"},{type:"group",id:"center-group",alignment:"center",gap:2,items:[{type:"command-button",id:"zoom-menu-button",commandId:"zoom:toggle-menu-mobile",variant:"icon",categories:["zoom","zoom-menu"]},{type:"custom",id:"zoom-toolbar",componentId:"zoom-toolbar",categories:["zoom"]},{type:"divider",id:"divider-3",orientation:"vertical",visibilityDependsOn:{itemIds:["zoom-toolbar","zoom-menu-button"]}},{type:"command-button",id:"pan-button",commandId:"pan:toggle",variant:"icon",categories:["tools","pan"]},{type:"command-button",id:"pointer-button",commandId:"pointer:toggle",variant:"icon",categories:["tools","pointer"]}]},{type:"spacer",id:"spacer-1",flex:!0},{type:"custom",id:"mode-select-button",componentId:"mode-select-button",categories:["mode"],visibilityDependsOn:{menuId:"mode-tabs-overflow-menu"}},{type:"tab-group",id:"mode-tabs",tabs:[{id:"view-mode",commandId:"mode:view",variant:"text",categories:["mode","mode-view"],visibilityDependsOn:{itemIds:["annotate-mode","shapes-mode","redact-mode"]}},{id:"annotate-mode",commandId:"mode:annotate",variant:"text",categories:["mode","mode-annotate","annotation"]},{id:"shapes-mode",commandId:"mode:shapes",variant:"text",categories:["mode","mode-shapes","annotation"]},{id:"redact-mode",commandId:"mode:redact",variant:"text",categories:["mode","mode-redact","redaction"]},{id:"overflow-tabs-button",commandId:"tabs:overflow-menu",variant:"icon",categories:["ui","ui-menu"],visibilityDependsOn:{menuId:"mode-tabs-overflow-menu"}}]},{type:"spacer",id:"spacer-2",flex:!0},{type:"group",id:"right-group",alignment:"end",gap:2,items:[{type:"command-button",id:"search-button",commandId:"panel:toggle-search",variant:"icon",categories:["panel","panel-search"]},{type:"command-button",id:"comment-button",commandId:"panel:toggle-comment",variant:"icon",categories:["panel","panel-comment"]}]}]},"annotation-toolbar":{id:"annotation-toolbar",position:{placement:"top",slot:"secondary",order:0},responsive:{breakpoints:{sm:{maxWidth:640,hide:["add-text","add-stamp"],show:["overflow-annotation-tools"]},md:{minWidth:640,hide:["overflow-annotation-tools"],show:["add-text","add-stamp"]}}},permanent:!1,categories:["annotation"],items:[{type:"spacer",id:"spacer-3",flex:!0},{type:"group",id:"annotation-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"add-highlight",commandId:"annotation:add-highlight",variant:"icon",categories:["annotation","annotation-markup","annotation-highlight"]},{type:"command-button",id:"add-strikeout",commandId:"annotation:add-strikeout",variant:"icon",categories:["annotation","annotation-markup","annotation-strikeout"]},{type:"command-button",id:"add-underline",commandId:"annotation:add-underline",variant:"icon",categories:["annotation","annotation-markup","annotation-underline"]},{type:"command-button",id:"add-ink",commandId:"annotation:add-ink",variant:"icon",categories:["annotation","annotation-ink"]},{type:"command-button",id:"add-text",commandId:"annotation:add-text",variant:"icon",categories:["annotation","annotation-text"]},{type:"command-button",id:"add-stamp",commandId:"annotation:add-stamp",variant:"icon",categories:["annotation","annotation-stamp"]},{type:"command-button",id:"overflow-annotation-tools",commandId:"annotation:overflow-tools",variant:"icon",categories:["annotation","annotation-overflow"]},{type:"divider",id:"annotation-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"annotation-tools-divider-2",orientation:"vertical",visibilityDependsOn:{itemIds:["toggle-annotation-style"]}},{type:"command-button",id:"undo-button",commandId:"history:undo",variant:"icon",categories:["history","history-undo"]},{type:"command-button",id:"redo-button",commandId:"history:redo",variant:"icon",categories:["history","history-redo"]}]},{type:"spacer",id:"spacer-4",flex:!0}]},"shapes-toolbar":{id:"shapes-toolbar",position:{placement:"top",slot:"secondary",order:0},responsive:{breakpoints:{sm:{maxWidth:640,hide:["add-polygon","add-polyline"],show:["overflow-shapes-tools"]},md:{minWidth:640,hide:["overflow-shapes-tools"],show:["add-polygon","add-polyline"]}}},permanent:!1,categories:["annotation","annotation-shape"],items:[{type:"spacer",id:"spacer-5",flex:!0},{type:"group",id:"shapes-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"add-rectangle",commandId:"annotation:add-rectangle",variant:"icon",categories:["annotation","annotation-shape","annotation-rectangle"]},{type:"command-button",id:"add-circle",commandId:"annotation:add-circle",variant:"icon",categories:["annotation","annotation-shape","annotation-circle"]},{type:"command-button",id:"add-line",commandId:"annotation:add-line",variant:"icon",categories:["annotation","annotation-shape","annotation-line"]},{type:"command-button",id:"add-arrow",commandId:"annotation:add-arrow",variant:"icon",categories:["annotation","annotation-shape","annotation-arrow"]},{type:"command-button",id:"add-polygon",commandId:"annotation:add-polygon",variant:"icon",categories:["annotation","annotation-shape","annotation-polygon"]},{type:"command-button",id:"add-polyline",commandId:"annotation:add-polyline",variant:"icon",categories:["annotation","annotation-shape","annotation-polyline"]},{type:"command-button",id:"overflow-shapes-tools",commandId:"annotation:overflow-shapes",variant:"icon",categories:["annotation","annotation-shape","annotation-overflow"]},{type:"divider",id:"shapes-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"shapes-tools-divider-2",orientation:"vertical",visibilityDependsOn:{itemIds:["toggle-annotation-style"]}},{type:"command-button",id:"undo-button",commandId:"history:undo",variant:"icon",categories:["history","history-undo"]},{type:"command-button",id:"redo-button",commandId:"history:redo",variant:"icon",categories:["history","history-redo"]}]},{type:"spacer",id:"spacer-6",flex:!0}]},"redaction-toolbar":{id:"redaction-toolbar",position:{placement:"top",slot:"secondary",order:0},permanent:!1,categories:["redaction"],items:[{type:"spacer",id:"spacer-7",flex:!0},{type:"group",id:"redaction-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"redact-text",commandId:"redaction:redact-text",variant:"icon",categories:["redaction","redaction-text"]},{type:"command-button",id:"redact-area",commandId:"redaction:redact-area",variant:"icon",categories:["redaction","redaction-area"]},{type:"divider",id:"divider-5",orientation:"vertical"},{type:"command-button",id:"apply-redactions",commandId:"redaction:apply-all",variant:"icon",categories:["redaction","redaction-apply"]},{type:"command-button",id:"clear-redactions",commandId:"redaction:clear-all",variant:"icon",categories:["redaction","redaction-clear"]}]},{type:"spacer",id:"spacer-8",flex:!0}]}},menus:{"left-action-menu":{id:"left-action-menu",categories:["ui"],items:[{type:"submenu",id:"page-settings-submenu",labelKey:"menu.viewControls",label:"View Controls",icon:"viewSettings",menuId:"page-settings-menu",categories:["page"]},{type:"submenu",id:"zoom-submenu",labelKey:"menu.zoomControls",label:"Zoom Controls",icon:"zoomIn",menuId:"zoom-menu",categories:["zoom"]},{type:"divider",id:"divider-15"},{type:"command",id:"pan-button-menu",commandId:"pan:toggle",categories:["tools","pan"]},{type:"command",id:"pointer-button-menu",commandId:"pointer:toggle",categories:["tools","pointer"]}]},"mode-tabs-overflow-menu":{id:"mode-tabs-overflow-menu",items:[{type:"command",id:"mode:view",commandId:"mode:view",categories:["mode","mode-view"]},{type:"command",id:"mode:annotate",commandId:"mode:annotate",categories:["mode","mode-annotate","annotation"]},{type:"command",id:"mode:shapes",commandId:"mode:shapes",categories:["mode","mode-shapes","annotation"]},{type:"command",id:"mode:redact",commandId:"mode:redact",categories:["mode","mode-redact","redaction"]}],responsive:{breakpoints:{xs:{maxWidth:640,show:["mode:view","mode:annotate","mode:shapes","mode:redact"]},sm:{minWidth:640,maxWidth:768,hide:["mode:view","mode:annotate"]},md:{minWidth:768,hide:["mode:view","mode:annotate","mode:shapes"]}},localeOverrides:{groups:[{id:"germanic-languages",locales:["de","nl"],breakpoints:{md:{replaceHide:["mode:view","mode:annotate"]}}}]}}},"zoom-levels-menu":{id:"zoom-levels-menu",categories:["zoom","zoom-level"],items:[{type:"command",id:"zoom:25",commandId:"zoom:25",categories:["zoom","zoom-level","zoom-level-25"]},{type:"command",id:"zoom:50",commandId:"zoom:50",categories:["zoom","zoom-level","zoom-level-50"]},{type:"command",id:"zoom:100",commandId:"zoom:100",categories:["zoom","zoom-level","zoom-level-100"]},{type:"command",id:"zoom:125",commandId:"zoom:125",categories:["zoom","zoom-level","zoom-level-125"]},{type:"command",id:"zoom:150",commandId:"zoom:150",categories:["zoom","zoom-level","zoom-level-150"]},{type:"command",id:"zoom:200",commandId:"zoom:200",categories:["zoom","zoom-level","zoom-level-200"]},{type:"command",id:"zoom:400",commandId:"zoom:400",categories:["zoom","zoom-level","zoom-level-400"]},{type:"command",id:"zoom:800",commandId:"zoom:800",categories:["zoom","zoom-level","zoom-level-800"]},{type:"command",id:"zoom:1600",commandId:"zoom:1600",categories:["zoom","zoom-level","zoom-level-1600"]}]},"zoom-menu":{id:"zoom-menu",categories:["zoom"],items:[{type:"submenu",id:"zoom-levels-submenu",labelKey:"zoom.level",label:"Zoom Levels",menuId:"zoom-levels-menu",categories:["zoom","zoom-level"]},{type:"divider",id:"divider-zoom-in-out"},{type:"command",id:"zoom:in",commandId:"zoom:in",categories:["zoom","zoom-in"]},{type:"command",id:"zoom:out",commandId:"zoom:out",categories:["zoom","zoom-out"]},{type:"divider",id:"divider-8"},{type:"command",id:"zoom:fit-page",commandId:"zoom:fit-page",categories:["zoom","zoom-fit-page"]},{type:"command",id:"zoom:fit-width",commandId:"zoom:fit-width",categories:["zoom","zoom-fit-width"]},{type:"divider",id:"divider-9"},{type:"command",id:"zoom:marquee",commandId:"zoom:marquee",categories:["zoom","zoom-marquee"]}],responsive:{breakpoints:{xs:{maxWidth:640,show:["zoom-levels-submenu","divider-zoom-in-out"]},md:{minWidth:768,hide:["zoom-levels-submenu","divider-zoom-in-out"]}}}},"document-menu":{id:"document-menu",categories:["document"],items:[{type:"command",id:"document:open",commandId:"document:open",categories:["document","document-open"]},{type:"command",id:"document:close",commandId:"document:close",categories:["document","document-close"]},{type:"divider",id:"divider-10"},{type:"command",id:"document:print",commandId:"document:print",categories:["document","document-print"]},{type:"command",id:"document:export",commandId:"document:export",categories:["document","document-export"]},{type:"divider",id:"divider-11",visibilityDependsOn:{itemIds:["document:export","document:print"]}},{type:"command",id:"document:fullscreen",commandId:"document:fullscreen",categories:["document","document-fullscreen"]}]},"annotation-tools-menu":{id:"annotation-tools-menu",categories:["annotation"],items:[{type:"command",id:"annotation:add-text",commandId:"annotation:add-text",categories:["annotation","annotation-text"]},{type:"command",id:"annotation:add-stamp",commandId:"annotation:add-stamp",categories:["annotation","annotation-stamp"]}]},"shapes-tools-menu":{id:"shapes-tools-menu",categories:["annotation","annotation-shape"],items:[{type:"command",id:"annotation:add-polygon",commandId:"annotation:add-polygon",categories:["annotation","annotation-shape","annotation-polygon"]},{type:"command",id:"annotation:add-polyline",commandId:"annotation:add-polyline",categories:["annotation","annotation-shape","annotation-polyline"]}]},"page-settings-menu":{id:"page-settings-menu",categories:["page"],items:[{type:"section",id:"spread-mode-section",labelKey:"page.spreadMode",label:"Spread Mode",categories:["page","spread"],items:[{type:"command",id:"spread:none",commandId:"spread:none",categories:["page","spread","spread-none"]},{type:"command",id:"spread:odd",commandId:"spread:odd",categories:["page","spread","spread-odd"]},{type:"command",id:"spread:even",commandId:"spread:even",categories:["page","spread","spread-even"]}]},{type:"divider",id:"divider-13"},{type:"section",id:"scroll-layout-section",labelKey:"page.scrollLayout",label:"Scroll Layout",categories:["page","scroll"],items:[{type:"command",id:"scroll:vertical",commandId:"scroll:vertical",categories:["page","scroll","scroll-vertical"]},{type:"command",id:"scroll:horizontal",commandId:"scroll:horizontal",categories:["page","scroll","scroll-horizontal"]}]},{type:"divider",id:"divider-14"},{type:"section",id:"page-rotation-section",labelKey:"page.rotation",label:"Page Rotation",categories:["page","rotate"],items:[{type:"command",id:"rotate:clockwise",commandId:"rotate:clockwise",categories:["page","rotate","rotate-clockwise"]},{type:"command",id:"rotate:counter-clockwise",commandId:"rotate:counter-clockwise",categories:["page","rotate","rotate-counter-clockwise"]}]},{type:"divider",id:"divider-15"},{type:"command",id:"document:fullscreen",commandId:"document:fullscreen",categories:["document","document-fullscreen"]}]}},sidebars:{"sidebar-panel":{id:"sidebar-panel",position:{placement:"left",slot:"main",order:0},content:{type:"tabs",tabs:[{id:"thumbnails",labelKey:"panel.thumbnails",label:"Thumbnails",icon:"squares",componentId:"thumbnails-sidebar"},{id:"outline",labelKey:"panel.outline",label:"Outline",icon:"listTree",componentId:"outline-sidebar"}]},width:"250px",collapsible:!0,defaultOpen:!1},"annotation-panel":{id:"annotation-panel",position:{placement:"left",slot:"main",order:0},content:{type:"component",componentId:"annotation-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"search-panel":{id:"search-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"search-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"comment-panel":{id:"comment-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"comment-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1}},modals:{"print-modal":{id:"print-modal",content:{type:"component",componentId:"print-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0}},overlays:{"page-controls":{id:"page-controls",position:{anchor:"bottom-center",offset:{bottom:"1.5rem"}},content:{type:"component",componentId:"page-controls"},defaultEnabled:!0}},selectionMenus:{annotation:{id:"annotation",categories:["annotation"],items:[{type:"command-button",id:"delete-annotation",commandId:"annotation:delete-selected",variant:"icon",categories:["annotation","annotation-delete"]},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"command-button",id:"comment-button",commandId:"panel:toggle-comment",variant:"icon",categories:["panel","panel-comment"]}]},redaction:{id:"redaction",categories:["redaction"],items:[{type:"command-button",id:"delete-redaction",commandId:"redaction:delete-selected",variant:"icon",categories:["redaction","redaction-delete"]},{type:"command-button",id:"commit-redaction",commandId:"redaction:commit-selected",variant:"icon",categories:["redaction","redaction-commit"]}]},selection:{id:"selection",visibilityDependsOn:{itemIds:["copy-selection","add-highlight","add-strikeout","add-underline","add-squiggly","redact-text"]},items:[{type:"command-button",id:"copy-selection",commandId:"selection:copy",variant:"icon",categories:["selection","selection-copy"]},{type:"command-button",id:"add-highlight",commandId:"annotation:add-highlight",variant:"icon",categories:["annotation","annotation-markup","annotation-highlight"]},{type:"command-button",id:"add-strikeout",commandId:"annotation:add-strikeout",variant:"icon",categories:["annotation","annotation-markup","annotation-strikeout"]},{type:"command-button",id:"add-underline",commandId:"annotation:add-underline",variant:"icon",categories:["annotation","annotation-markup","annotation-underline"]},{type:"command-button",id:"add-squiggly",commandId:"annotation:add-squiggly",variant:"icon",categories:["annotation","annotation-markup","annotation-squiggly"]},{type:"command-button",id:"redact-text",commandId:"redaction:redact-text",variant:"icon",categories:["redaction","redaction-text"]}]}}}},viewport:{viewportGap:10},scroll:{defaultStrategy:Uo.Vertical},zoom:{defaultZoomLevel:ga.FitPage},spread:{defaultSpreadMode:ri.None},rotation:{defaultRotation:Be.Degree0},pan:{},render:{defaultImageType:"image/png"},tiling:{tileSize:768,overlapPx:2.5,extraRings:0},thumbnails:{width:150,gap:10,buffer:3,labelHeight:30},annotations:{},search:{},selection:{},bookmarks:{},attachments:{},capture:{scale:2,imageType:"image/png"},redaction:{drawBlackBoxes:!0},print:{},export:{defaultFileName:"document.pdf"},fullscreen:{},history:{},interactionManager:{}};function Rf(e){var t=e.documentId,n=e.tabBarVisibility,o=void 0===n?"multiple":n,i=function(e){const t=Or(),{provides:n}=Ir(),o=null==n?void 0:n.getSchema(),i=Sr(e);return{renderToolbar:(r,a)=>{if(!o||!n||!i)return null;const s=`${r}-${a}`,l=i.activeToolbars[s];if(!l)return null;const c=o.toolbars[l.toolbarId];if(!c)return console.warn(`Toolbar "${l.toolbarId}" not found in schema`),null;const d=c.permanent?void 0:()=>{n.forDocument(e).closeToolbarSlot(r,a)};return We(t.toolbar,{schema:c,documentId:e,isOpen:l.isOpen,onClose:d},l.toolbarId)},renderSidebar:(r,a)=>{var s;if(!o||!n||!i)return null;const l=`${r}-${a}`,c=i.activeSidebars[l];if(!c)return null;const d=null==(s=o.sidebars)?void 0:s[c.sidebarId];return d?We(t.sidebar,{schema:d,documentId:e,isOpen:c.isOpen,onClose:()=>{n.forDocument(e).closeSidebarSlot(r,a)}},c.sidebarId):(console.warn(`Sidebar "${c.sidebarId}" not found in schema`),null)},renderModal:()=>{var r;if(!o||!n||!(null==i?void 0:i.activeModal))return null;const{modalId:a,isOpen:s}=i.activeModal,l=null==(r=o.modals)?void 0:r[a];if(!l)return console.warn(`Modal "${a}" not found in schema`),null;const c=t.modal;return c?We(c,{schema:l,documentId:e,isOpen:s,onClose:()=>{n.forDocument(e).closeModal()},onExited:()=>{n.forDocument(e).clearModal()}},a):(console.warn("No modal renderer registered"),null)},getActiveToolbars:()=>i?Object.entries(i.activeToolbars).map(([e,t])=>{const[n,o]=e.split("-");return{placement:n,slot:o,toolbarId:t.toolbarId,isOpen:t.isOpen}}):[],getActiveSidebars:()=>i?Object.entries(i.activeSidebars).map(([e,t])=>{const[n,o]=e.split("-");return{placement:n,slot:o,sidebarId:t.sidebarId,isOpen:t.isOpen}}):[],renderOverlays:()=>{if(!(null==o?void 0:o.overlays)||!n)return null;const i=t.overlay;if(!i)return null;const r=Object.values(o.overlays);return 0===r.length?null:We(W,{children:r.map(t=>We(i,{schema:t,documentId:e},t.id))})}}}(t),r=i.renderToolbar,a=i.renderSidebar,s=i.renderModal,l=i.renderOverlays,c=ma(t).translate,d=Lr("selection",t),u=Lr("annotation",t),h=Lr("redaction",t),m=(e=>{const t=fo();return ze(()=>t?e?e.map(e=>t.documents[e]).filter(e=>null!=e):t.documentOrder.map(e=>t.documents[e]).filter(e=>null!=e):[],[t,e])})(),g=(()=>{const e=fo();return ze(()=>{if(!e)return{activeDocumentId:null,activeDocument:null};const t=e.activeDocumentId;return{activeDocumentId:t,activeDocument:t?e.documents[t]??null:null}},[e])})();return H(W,null,H(Af,{documentStates:m,activeDocumentId:g.activeDocumentId,visibility:o}),r("top","main"),r("top","secondary"),H("div",{id:"document-content",className:"bg-bg-surface flex flex-1 overflow-hidden"},a("left","main"),H("div",{className:"flex-1 overflow-hidden"},H(Br,{documentId:t},function(e){var n=e.documentState,o=e.isLoading,i=e.isError,r=e.isLoaded;return H(W,null,o&&H("div",{className:"flex h-full items-center justify-center"},H(Sv,{size:"lg",text:c("document.loading")})),i&&H(zf,{documentState:n}),r&&H("div",{className:"relative h-full w-full"},H(xd,{documentId:t},H(Ho,{className:"bg-bg-app",documentId:t},H(ii,{documentId:t,renderPage:function(e){var n=e.pageIndex;return H(Wa,{documentId:t,pageIndex:n,style:{backgroundColor:"#fff"}},H(Cd,{documentId:t,pageIndex:n},H(_a,{documentId:t,pageIndex:n,scale:.5,style:{pointerEvents:"none"}}),H(ul,{documentId:t,pageIndex:n,style:{pointerEvents:"none"}}),H(us,{documentId:t,pageIndex:n}),H(Pa,{documentId:t,pageIndex:n}),H(zu,{documentId:t,pageIndex:n}),H(Zs,{documentId:t,pageIndex:n,selectionMenu:d}),H(gh,{documentId:t,pageIndex:n,selectionMenu:h}),H(Bd,{documentId:t,pageIndex:n,selectionMenu:u}),H(Mv,null)))}}))),l()))})),a("right","main")),s())}var Nf=new ut([new lt,new dt]);function Of(e){var t,o=e.config,i=e.onRegistryReady,r=function(e){const{wasmUrl:t=bo,worker:n=!0,logger:o,encoderPoolSize:i}=e??{},[r,a]=De(null),[s,l]=De(!0),[c,d]=De(null),u=Te(null);return Pe(()=>{let e=!1;return(async()=>{try{const{createPdfiumEngine:e}=n?await import("./worker-engine-0d859ee9.js"):await import("./direct-engine-351ee24a.js"),r=await e(t,{logger:o,encoderPoolSize:i});u.current=r,r.initialize().wait(()=>{a(r),l(!1)},e=>{d(new Error(e.reason.message)),l(!1)})}catch(t){e||(d(t),l(!1))}})(),()=>{var t,n;e=!0,null==(n=null==(t=u.current)?void 0:t.closeAllDocuments)||n.call(t).wait(()=>{var e,t;null==(t=null==(e=u.current)?void 0:e.destroy)||t.call(e),u.current=null},xn)}},[t,n,o]),{engine:r,isLoading:s,error:c}}(m(m({},o.wasmUrl&&{wasmUrl:o.wasmUrl}),{},{worker:o.worker,logger:o.log?Nf:void 0})),a=r.engine,s=r.isLoading,l=ze(function(){return{"thumbnails-sidebar":yv,"annotation-sidebar":pf,"zoom-toolbar":Uv,"search-sidebar":Cv,"outline-sidebar":Iv,"comment-sidebar":Hv,"print-modal":wf,"page-controls":xf,"mode-select-button":Ef}},[]),c=ze(function(){return{toolbar:Ip,sidebar:sv,modal:fv,overlay:yf,menu:dv,selectionMenu:vf}},[]);return H(W,null,H("style",null,He),!a||s?H("div",{className:"flex h-full w-full items-center justify-center"},H(Sv,{size:"lg",text:"Initializing PDF engine..."})):H(go,{logger:o.log?Nf:void 0,onInitialized:(t=n(p().m(function e(t){return p().w(function(e){for(;;)switch(e.n){case 0:i&&t&&i(t);case 1:return e.a(2)}},e)})),function(e){return t.apply(this,arguments)}),engine:a,plugins:[Kn(Gr,m(m(m({},_f.documentManager),o.src&&{initialDocuments:[{url:o.src}]}),o.documentManager)),Kn(na,m(m(m({},_f.commands),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.commands)),Kn(ha,m(m({},_f.i18n),o.i18n)),Kn(Cr,m(m(m({},_f.ui),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.ui)),Kn($o,m(m({},_f.viewport),o.viewport)),Kn(ti,m(m({},_f.scroll),o.scroll)),Kn(Da,m(m({},_f.zoom),o.zoom)),Kn(vi,m(m({},_f.spread),o.spread)),Kn(Ua,m(m({},_f.rotation),o.rotation)),Kn(wu,m(m({},_f.pan),o.pan)),Kn(Ea,m(m({},_f.render),o.render)),Kn(ll,m(m({},_f.tiling),o.tiling)),Kn(Il,m(m({},_f.thumbnails),o.thumbnails)),Kn(Gc,m(m({},_f.annotations),o.annotations)),Kn(cs,m(m({},_f.search),o.search)),Kn(Ks,m(m({},_f.selection),o.selection)),Kn(cu,m(m({},_f.bookmarks),o.bookmarks)),Kn(yh,m(m({},_f.attachments),o.attachments)),Kn(Tu,m(m({},_f.capture),o.capture)),Kn(lh,m(m({},_f.redaction),o.redaction)),Kn(Yd,m(m({},_f.print),o.print)),Kn(mu,m(m({},_f.export),o.export)),Kn(iu,m(m({},_f.fullscreen),o.fullscreen)),Kn(Hu,m(m({},_f.history),o.history)),Kn(gd,m(m({},_f.interactionManager),o.interactionManager))]},function(e){var t=e.pluginsReady,n=e.activeDocumentId;return H(W,null,t?H(W,null,n?H(jr,{documentId:n,components:l,renderers:c,className:"relative flex h-full w-full select-none flex-col"},H(Rf,{documentId:n,tabBarVisibility:o.tabBar})):H(Tf,null)):H("div",{className:"flex h-full items-center justify-center"},H(Sv,{size:"lg",text:"Initializing plugins..."})))}))}var Lf="undefined"!=typeof HTMLElement?HTMLElement:a(function e(){i(this,e)}),$f=function(){function e(){var t;return i(this,e),l(t=o(this,e),"_resolveRegistry",null),l(t,"themeStyleEl",null),l(t,"systemPreferenceCleanup",null),l(t,"handleRegistryReady",function(e){t._resolveRegistry&&(t._resolveRegistry(e),t._resolveRegistry=null)}),t.root=t.attachShadow({mode:"open"}),t._registryPromise=new Promise(function(e){t._resolveRegistry=e}),t}return d(e,Lf),a(e,[{key:"connectedCallback",value:function(){this._config||(this._config={src:this.getAttribute("src")||"/demo.pdf",worker:"false"!==this.getAttribute("worker"),theme:this.parseThemeAttribute()}),this.setupTheme(),this.renderViewer()}},{key:"disconnectedCallback",value:function(){var e;null===(e=this.systemPreferenceCleanup)||void 0===e||e.call(this),this.systemPreferenceCleanup=null}},{key:"parseThemeAttribute",value:function(){var e=this.getAttribute("theme");if(e)return["light","dark","system"].includes(e)?{preference:e}:void 0}},{key:"config",get:function(){return this._config},set:function(e){this._config=e,e.icons&&qm(e.icons),this.isConnected&&(this.setupTheme(),this.renderViewer())}},{key:"registry",get:function(){return this._registryPromise}},{key:"themePreference",get:function(){var e;return(null===(e=this._config)||void 0===e||null===(e=e.theme)||void 0===e?void 0:e.preference)||"system"}},{key:"activeColorScheme",get:function(){return Df(this.themePreference)}},{key:"activeTheme",get:function(){return this.resolveActiveTheme()}},{key:"resolveActiveTheme",value:function(){var e,t,n,o=null===(e=this._config)||void 0===e?void 0:e.theme,i=Df((null==o?void 0:o.preference)||"system"),r="dark"===i?If:Cf,a=null==o?void 0:o[i];return n=r,(t=a)?kf(n,t):n}},{key:"setupTheme",value:function(){var e,t,n=this;null===(e=this.systemPreferenceCleanup)||void 0===e||e.call(this),this.systemPreferenceCleanup=null,"system"===((null===(t=this._config)||void 0===t||null===(t=t.theme)||void 0===t?void 0:t.preference)||"system")&&(this.systemPreferenceCleanup=function(e){if("undefined"==typeof window)return function(){};var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(t){return e(t.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}(function(e){n.injectTheme(),n.dispatchEvent(new CustomEvent("themechange",{detail:{preference:"system",colorScheme:e,theme:n.activeTheme},bubbles:!0}))})),this.injectTheme()}},{key:"injectTheme",value:function(){var e=Pf(this.resolveActiveTheme()),t=this.root.querySelector("style[data-embedpdf-theme]");t||((t=document.createElement("style")).setAttribute("data-embedpdf-theme",""),this.root.appendChild(t)),this.themeStyleEl=t,this.themeStyleEl.textContent=e,this.setAttribute("data-color-scheme",this.activeColorScheme)}},{key:"setTheme",value:function(e){this._config&&(this._config.theme="string"==typeof e?m(m({},this._config.theme),{},{preference:e}):m(m({},this._config.theme),e),this.setupTheme(),this.dispatchEvent(new CustomEvent("themechange",{detail:{preference:this.themePreference,colorScheme:this.activeColorScheme,theme:this.activeTheme},bubbles:!0})))}},{key:"registerIcon",value:function(e,t){Bm(e,t)}},{key:"registerIcons",value:function(e){qm(e)}},{key:"renderViewer",value:function(){this._config&&(de(H(Of,{config:this._config,onRegistryReady:this.handleRegistryReady}),this.root),this.injectTheme())}}])}(),Ff=["type","target"],jf="2.0.0-next.3";"undefined"==typeof customElements||customElements.get("embedpdf-container")||customElements.define("embedpdf-container",$f);var Hf={version:jf,init:function(e){if("container"===e.type)return function(e){e.type,e.target;var t=g(e,Ff),n=document.createElement("embedpdf-container");return n.config=t,e.target.appendChild(n),n}(e)}};export{Fs as $,Pt as A,it as B,at as C,bt as D,Dt as E,Vt as F,Ft as G,wn as H,jf as I,$f as J,Hf as K,Uo as L,hi as M,st as N,ri as O,Ut as P,ga as Q,Be as R,Jo as S,pt as T,ja as U,Lo as V,sl as W,Cl as X,jc as Y,ka as Z,ss as _,Wt as a,Au as a0,ah as a1,Uu as a2,pr as a3,da as a4,Qr as a5,Ur as a6,Zd as a7,tu as a8,lu as a9,uu as aa,yu as ab,$u as ac,vh as ad,Ta as ae,cd as af,Cf as ag,If as ah,kf as ai,Bm as aj,qm as ak,Mt as b,Ht as c,yt as d,At as e,_t as f,Et as g,Tt as h,yn as i,kt as j,wt as k,Bt as l,Gt as m,Kt as n,xt as o,Zt as p,Ye as q,Xe as r,vn as s,Rt as t,bn as u,Lt as v,qt as w,$t as x,zt as y,Ve as z};
|