@embedpdf/snippet 2.10.1 → 2.11.1
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-BuzIa755-Di_GbRxj.js +1 -0
- package/dist/components/app.d.ts +3 -0
- package/dist/components/app.d.ts.map +1 -1
- package/dist/components/icons/index.d.ts.map +1 -1
- package/dist/components/icons/rubber-stamp-plus.d.ts +4 -0
- package/dist/components/icons/rubber-stamp-plus.d.ts.map +1 -0
- package/dist/components/icons/rubber-stamp.d.ts +4 -0
- package/dist/components/icons/rubber-stamp.d.ts.map +1 -0
- package/dist/components/icons/signature.d.ts +4 -0
- package/dist/components/icons/signature.d.ts.map +1 -0
- package/dist/components/mode-select-button.d.ts.map +1 -1
- package/dist/components/rubber-stamp-sidebar.d.ts +7 -0
- package/dist/components/rubber-stamp-sidebar.d.ts.map +1 -0
- package/dist/components/signature-sidebar.d.ts +6 -0
- package/dist/components/signature-sidebar.d.ts.map +1 -0
- package/dist/config/commands.d.ts.map +1 -1
- package/dist/config/translations.d.ts.map +1 -1
- package/dist/config/ui-schema.d.ts.map +1 -1
- package/dist/direct-engine-CelZSjqy.js +1 -0
- package/dist/embedpdf-Cu44Cb4b.js +3 -0
- package/dist/embedpdf.js +1 -1
- package/dist/pdfium.wasm +0 -0
- package/dist/ui/schema-sidebar.d.ts +1 -1
- package/dist/ui/schema-sidebar.d.ts.map +1 -1
- package/dist/worker-engine-DuL2NYdC.js +1 -0
- package/package.json +32 -31
- package/dist/browser-BISJ9naB-6Cqwz4V7.js +0 -1
- package/dist/direct-engine-BXXPY_J7.js +0 -1
- package/dist/embedpdf-DPfvqdy9.js +0 -3
- package/dist/worker-engine-B9za95Tx.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=l(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,d()?Reflect.construct(t,n||[],l(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,n){return t&&function(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,b(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=x(e))||t){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 s(e,t,n){return(t=b(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function c(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 d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function u(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(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 g(){
|
|
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 p(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]())):(p(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,p(e,i,"GeneratorFunction")),e.prototype=Object.create(u),e}return l.prototype=c,p(u,"constructor",c),p(c,"constructor",l),l.displayName="GeneratorFunction",p(c,i,"GeneratorFunction"),p(u),p(u,i,"Generator"),p(u,o,function(){return this}),p(u,"toString",function(){return"[object Generator]"}),(g=function(){return{w:r,m:h}})()}function p(e,t,n,o){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,n,o){function r(t,n){p(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))},p(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 v(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);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)||x(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 y(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)||x(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 b(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);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 w(e){return w="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},w(e)}function x(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 k,C,I,S,A,M,D,P,T,R,z,E,O={},N=[],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 $(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function j(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?k.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?++I:i,__i:-1,__u:0};return null==i&&null!=C.vnode&&C.vnode(r),r}function B(e){return e.children}function W(e,t){this.props=e,this.context=t}function H(e,t){if(null==t)return e.__?H(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?H(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 q(e){(!e.__d&&(e.__d=!0)&&S.push(e)&&!V.__r++||A!=C.debounceRendering)&&((A=C.debounceRendering)||M)(V)}function V(){for(var e,t,n,o,i,r,a,s=1;S.length;)S.length>s&&S.sort(D),e=S.shift(),s=S.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,C.vnode&&C.vnode(n),te(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[i]:null,r,null==i?H(o):i,!!(32&o.__u),a),n.__v=o.__v,n.__.__k[n.__i]=n,oe(r,n,a),o.__e=o.__=null,n.__e!=i&&G(n)));V.__r=0}function K(e,t,n,o,i,r,a,s,l,c,d){var u,h,m,g,p,f,v,y=o&&o.__k||N,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?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[r]=U(null,a,null,null,null):_(a)?a=e.__k[r]=U(B,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?a=e.__k[r]=U(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,l=r+h,a.__=e,a.__b=e.__b+1,s=null,-1!=(c=a.__i=Y(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=H(s)),se(s,s));return o}(n,t,y,l,b),u=0;u<b;u++)null!=(m=n.__k[u])&&(h=-1==m.__i?O:y[m.__i]||O,m.__i=u,f=te(e,m,h,i,r,a,s,l,c,d),g=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&ae(h.ref,null,m),d.push(m.ref,m.__c||g,m)),null==p&&null!=g&&(p=g),(v=!!(4&m.__u))||h.__k===m.__k?l=Z(m,l,e,v):"function"==typeof m.type&&void 0!==f?l=f:g&&(l=g.nextSibling),m.__u&=-7);return n.__e=p,l}function Z(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=Z(i[r],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=H(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 Y(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==s||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 Q(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 J(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||Q(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Q(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(P,"$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=T,e.addEventListener(t,r?z:R,r)):e.removeEventListener(t,r?z:R,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 ee(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=T++;else if(t.t<n.u)return;return n(C.event?C.event(t):t)}}}function te(e,t,n,o,i,r,a,s,l,c){var d,u,h,m,g,p,f,v,y,b,w,x,k,I,S,A,M,D=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),r=[s=t.__e=n.__e]),(d=C.__b)&&d(t);e:if("function"==typeof D)try{if(v=t.props,y="prototype"in D&&D.prototype.render,b=(d=D.contextType)&&o[d.__c],w=d?b?b.props.value:d.__:o,n.__c?f=(u=t.__c=n.__c).__=u.__E:(y?t.__c=u=new D(v,w):(t.__c=u=new W(v,w),u.constructor=D,u.render=le),b&&b.sub(u),u.state||(u.state={}),u.__n=o,h=u.__d=!0,u.__h=[],u._sb=[]),y&&null==u.__s&&(u.__s=u.state),y&&null!=D.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=F({},u.__s)),F(u.__s,D.getDerivedStateFromProps(v,u.__s))),m=u.props,g=u.state,u.__v=t,h)y&&null==D.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),y&&null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(y&&null==D.getDerivedStateFromProps&&v!==m&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(v,w),t.__v==n.__v||!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(v,u.__s,w)){for(t.__v!=n.__v&&(u.props=v,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(v,u.__s,w),y&&null!=u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(m,g,p)})}if(u.context=w,u.props=v,u.__P=e,u.__e=!1,k=C.__r,I=0,y){for(u.state=u.__s,u.__d=!1,k&&k(t),d=u.render(u.props,u.state,u.context),S=0;S<u._sb.length;S++)u.__h.push(u._sb[S]);u._sb=[]}else do{u.__d=!1,k&&k(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)),A=d,null!=d&&d.type===B&&null==d.key&&(A=ie(d.props.children)),s=K(e,_(A)?A:[A],t,n,o,i,r,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),f&&(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--;)$(r[M]);ne(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ne(t);C.__e(e,t,n)}else null==r&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=re(n.__e,t,n,o,i,r,a,l,c);return(d=C.diffed)&&d(t),128&t.__u?void 0:s}function ne(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ne)}function oe(e,t,n){for(var o=0;o<n.length;o++)ae(n[o],n[++o],n[++o]);C.__c&&C.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){C.__e(e,t.__v)}})}function ie(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:_(e)?e.map(ie):F({},e)}function re(e,t,n,o,i,r,a,s,l){var c,d,u,h,m,g,p,f=n.props||O,v=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(v);e=document.createElementNS(i,y,v.is&&v),s&&(C.__m&&C.__m(t,r),s=!1),r=null}if(null==y)f===v||s&&e.data==v||(e.data=v);else{if(r=r&&k.call(e.childNodes),!s&&null!=r)for(f={},c=0;c<e.attributes.length;c++)f[(m=e.attributes[c]).name]=m.value;for(c in f)if(m=f[c],"children"==c);else if("dangerouslySetInnerHTML"==c)u=m;else if(!(c in v)){if("value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v)continue;J(e,c,null,m,i)}for(c in v)m=v[c],"children"==c?h=m:"dangerouslySetInnerHTML"==c?d=m:"value"==c?g=m:"checked"==c?p=m:s&&"function"!=typeof m||f[c]===m||J(e,c,m,f[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&&H(n,0),s,l),null!=r)for(c=r.length;c--;)$(r[c]);s||(c="value","progress"==y&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[c]||"progress"==y&&!g||"option"==y&&g!=f[c])&&J(e,c,g,f[c],i),c="checked",null!=p&&p!=e[c]&&J(e,c,p,f[c],i))}return e}function ae(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){C.__e(e,n)}}function se(e,t,n){var o,i;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ae(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){C.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&se(o[i],t,n||"function"!=typeof e.type);n||$(e.__e),e.__c=e.__=e.__e=void 0}function le(e,t,n){return this.constructor(e,n)}function ce(e,t,n){var o,i,r;t==document&&(t=document.documentElement),C.__&&C.__(e,t),o=!1?null:t.__k,i=[],r=[],te(t,e=t.__k=j(B,null,[e]),o||O,O,t.namespaceURI,o?null:t.firstChild?k.call(t.childNodes):null,i,o?o.__e:t.firstChild,false,r),oe(i,e,r)}function de(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,q(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"+E++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}k=N.slice,C={__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}},I=0,W.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),q(this))},W.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),q(this))},W.prototype.render=B,S=[],M="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,D=function(e,t){return e.__v.__b-t.__v.__b},V.__r=0,P=/(PointerCapture)$|Capture$/i,T=0,R=ee(!1),z=ee(!0),E=0;var ue,he,me,ge,pe=0,fe=[],ve=C,ye=ve.__b,be=ve.__r,we=ve.diffed,xe=ve.__c,ke=ve.unmount,Ce=ve.__;function Ie(e,t){ve.__h&&ve.__h(he,e,pe||t),pe=0;var n=he.__H||(he.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Se(e){return pe=1,Ae($e,e)}function Ae(e,t,n){var o=Ie(ue++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):$e(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=he,!he.__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};he.__f=!0;var r=he.shouldComponentUpdate,a=he.componentWillUpdate;he.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)},he.shouldComponentUpdate=i}return o.__N||o.__}function Me(e,t){var n=Ie(ue++,3);!ve.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,he.__H.__h.push(n))}function De(e,t){var n=Ie(ue++,4);!ve.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,he.__h.push(n))}function Pe(e){return pe=5,Te(function(){return{current:e}},[])}function Te(e,t){var n=Ie(ue++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Re(e,t){return pe=8,Te(function(){return e},t)}function ze(e){var t=he.context[e.__c],n=Ie(ue++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(he)),t.props.value):e.__}function Ee(){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=[],ve.__e(t,e.__v)}}ve.__b=function(e){he=null,ye&&ye(e)},ve.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ce&&Ce(e,t)},ve.__r=function(e){be&&be(e),ue=0;var t=(he=e.__c).__H;t&&(me===he?(t.__h=[],he.__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=[],ue=0)),me=he},ve.diffed=function(e){we&&we(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==fe.push(t)&&ge===ve.requestAnimationFrame||((ge=ve.requestAnimationFrame)||Ne)(Ee)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),me=he=null},ve.__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=[],ve.__e(n,e.__v)}}),xe&&xe(e,t)},ve.unmount=function(e){ke&&ke(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&&ve.__e(t,n.__v))};var Oe="function"==typeof requestAnimationFrame;function Ne(e){var t,n=function(){clearTimeout(o),Oe&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Oe&&(t=requestAnimationFrame(n))}function Le(e){var t=he,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),he=t}function _e(e){var t=he;e.__c=e.__(),he=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function $e(e,t){return"function"==typeof t?t(e):t}var je='/*! tailwindcss v4.1.18 | 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-red-600: oklch(57.7% 0.245 27.325);\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-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-300: oklch(87.2% 0.01 258.338);\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-warning: var(--ep-state-warning);\n --color-state-warning-light: var(--ep-state-warning-light);\n --color-state-success: var(--ep-state-success);\n --color-state-success-light: var(--ep-state-success-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 .invisible {\n visibility: hidden;\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-2 {\n right: calc(var(--spacing) * 2);\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-3 {\n z-index: 3;\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-1 {\n margin-top: calc(var(--spacing) * -1);\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-1 {\n margin-right: calc(var(--spacing) * -1);\n }\n .mr-1\\.5 {\n margin-right: calc(var(--spacing) * 1.5);\n }\n .mr-2 {\n margin-right: calc(var(--spacing) * 2);\n }\n .mr-3 {\n margin-right: calc(var(--spacing) * 3);\n }\n .mr-4 {\n margin-right: calc(var(--spacing) * 4);\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 .ml-2 {\n margin-left: calc(var(--spacing) * 2);\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-\\[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 .rotate-180 {\n rotate: 180deg;\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-1 {\n grid-template-columns: repeat(1, minmax(0, 1fr));\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-5 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 5) * 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-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-accent\\/10 {\n background-color: var(--color-accent);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-accent) 10%, transparent);\n }\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-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 {\n background-color: var(--color-state-error);\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-state-success-light {\n background-color: var(--color-state-success-light);\n }\n .bg-state-warning-light {\n background-color: var(--color-state-warning-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-3 {\n padding-top: calc(var(--spacing) * 3);\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-6 {\n padding-right: calc(var(--spacing) * 6);\n }\n .pr-7 {\n padding-right: calc(var(--spacing) * 7);\n }\n .pr-9 {\n padding-right: calc(var(--spacing) * 9);\n }\n .pr-10 {\n padding-right: calc(var(--spacing) * 10);\n }\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n .pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\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-6 {\n padding-left: calc(var(--spacing) * 6);\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-red-600 {\n color: var(--color-red-600);\n }\n .text-state-error {\n color: var(--color-state-error);\n }\n .text-state-success {\n color: var(--color-state-success);\n }\n .text-state-warning {\n color: var(--color-state-warning);\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-accent {\n &:hover {\n @media (hover: hover) {\n border-color: var(--color-accent);\n }\n }\n }\n .hover\\:border-state-error {\n &:hover {\n @media (hover: hover) {\n border-color: var(--color-state-error);\n }\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-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-bg-surface {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-bg-surface);\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-interactive-hover {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-interactive-hover);\n }\n }\n }\n .hover\\:bg-state-error-light {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-state-error-light);\n }\n }\n }\n .hover\\:bg-state-error\\/90 {\n &:hover {\n @media (hover: hover) {\n background-color: var(--color-state-error);\n @supports (color: color-mix(in lab, red, red)) {\n background-color: color-mix(in oklab, var(--color-state-error) 90%, transparent);\n }\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-state-error {\n &:focus {\n border-color: var(--color-state-error);\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 .sm\\:grid-cols-2 {\n @media (width >= 40rem) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\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\\:w-\\[32rem\\] {\n @media (width >= 48rem) {\n width: 32rem;\n }\n }\n .md\\:w-\\[36rem\\] {\n @media (width >= 48rem) {\n width: 36rem;\n }\n }\n .md\\:w-\\[48rem\\] {\n @media (width >= 48rem) {\n width: 48rem;\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 Be(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 C.vnode&&C.vnode(c),c}var We=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(We||{});function He(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 qe(e){return{origin:He(e.origin),size:Ge(e.size)}}function Ve(e){const{width:t,height:n}=e;return{width:n,height:t}}function Ke(e,t,n){return{width:(e=t%2==0?e:Ve(e)).width*n,height:e.height*n}}function Ze(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 Ye(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 Qe(e,t){return{x:e.x*t,y:e.y*t}}function Je(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 et(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 tt(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=Ve(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=Ve(t.size)}return{origin:{x:o,y:i},size:{width:r.width,height:r.height}}}function nt(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 ot(e,t,n,o){return nt(tt(e,t,n),o)}const it={origin:{x:0,y:0},size:{width:0,height:0}};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){const t=e%360;return t<0?t+360:t}function st(e){return{x:e.origin.x+e.size.width/2,y:e.origin.y+e.size.height/2}}function lt(e,t,n){const o=n*Math.PI/180,i=Math.cos(o),r=Math.sin(o),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*i-s*r,y:t.y+a*r+s*i}}function ct(e,t,n){return e.map(e=>lt(e,t,n))}function dt(e,t,n){return Je(ct([{x:e.origin.x,y:e.origin.y},{x:e.origin.x+e.size.width,y:e.origin.y},{x:e.origin.x+e.size.width,y:e.origin.y+e.size.height},{x:e.origin.x,y:e.origin.y+e.size.height}],n,t))}function ut(e,t){return dt(e,t,st(e))}function ht(e,t,n){const o=n*Math.PI/180,i=Math.cos(o),r=Math.sin(o),a=1-i,s=r,l=-r,c=1-i,d=a*c-s*l,u=st(e);if(Math.abs(d)<1e-10)return u;const h=st(t),m=h.x-(i*u.x-r*u.y),g=h.y-(r*u.x+i*u.y);return{x:(c*m-s*g)/d,y:(-l*m+a*g)/d}}function mt(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 gt{isEnabled(){return!1}debug(){}info(){}warn(){}error(){}perf(){}}class pt{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 ft{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 vt{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 yt{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 bt=(e=>(e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected",e[e.Aborted=3]="Aborted",e))(bt||{});class wt extends Error{constructor(e){super(`Task aborted: ${JSON.stringify(e)}`),this.name="TaskAbortedError",this.reason=e}}class xt extends Error{constructor(e){super(`Task rejected: ${JSON.stringify(e)}`),this.name="TaskRejectedError",this.reason=e}}class kt{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 wt(e.reason)):t(new xt(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 kt;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 kt;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 kt;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=kt.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 Ct=Object.freeze(["","","","\ufeff","",""]),It=new RegExp(`[${Ct.join("")}]`,"g");function St(e){return e.replace(It,"")}var At=(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))(At||{}),Mt=(e=>(e[e.NotSet=0]="NotSet",e[e.True=1]="True",e[e.False=2]="False",e[e.Unknown=3]="Unknown",e))(Mt||{}),Dt=(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))(Dt||{}),Pt=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(Pt||{}),Tt=(e=>(e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom",e))(Tt||{}),Rt=(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))(Rt||{}),zt=(e=>(e[e.Contain=0]="Contain",e[e.Cover=1]="Cover",e[e.Stretch=2]="Stretch",e))(zt||{}),Et=(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))(Et||{});const Ot=1,Nt=2,Lt=4;var _t=(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))(_t||{}),Ft=(e=>(e[e.Normal=0]="Normal",e[e.Rollover=1]="Rollover",e[e.Down=2]="Down",e))(Ft||{}),$t=(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))($t||{}),jt=(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))(jt||{}),Ut=(e=>(e[e.Unknown=0]="Unknown",e[e.Reply=1]="Reply",e[e.Group=2]="Group",e))(Ut||{}),Bt=(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))(Bt||{}),Wt=(e=>(e[e.Color=0]="Color",e[e.InteriorColor=1]="InteriorColor",e[e.OverlayColor=2]="OverlayColor",e))(Wt||{}),Ht=(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))(Ht||{}),Gt=(e=>(e[e.NONE=0]="NONE",e[e.READONLY=1]="READONLY",e[e.REQUIRED=2]="REQUIRED",e[e.NOEXPORT=4]="NOEXPORT",e[e.TEXT_MULTIPLINE=4096]="TEXT_MULTIPLINE",e[e.TEXT_PASSWORD=8192]="TEXT_PASSWORD",e[e.TEXT_FILESELECT=1048576]="TEXT_FILESELECT",e[e.TEXT_DONOTSPELLCHECK=4194304]="TEXT_DONOTSPELLCHECK",e[e.TEXT_DONOTSCROLL=8388608]="TEXT_DONOTSCROLL",e[e.TEXT_COMB=16777216]="TEXT_COMB",e[e.TEXT_RICHTEXT=33554432]="TEXT_RICHTEXT",e[e.BUTTON_NOTOGGLETOOFF=16384]="BUTTON_NOTOGGLETOOFF",e[e.BUTTON_RADIO=32768]="BUTTON_RADIO",e[e.BUTTON_PUSHBUTTON=65536]="BUTTON_PUSHBUTTON",e[e.BUTTON_RADIOSINUNISON=33554432]="BUTTON_RADIOSINUNISON",e[e.CHOICE_COMBO=131072]="CHOICE_COMBO",e[e.CHOICE_EDIT=262144]="CHOICE_EDIT",e[e.CHOICE_SORT=524288]="CHOICE_SORT",e[e.CHOICE_MULTL_SELECT=2097152]="CHOICE_MULTL_SELECT",e[e.CHOICE_DONOTSPELLCHECK=4194304]="CHOICE_DONOTSPELLCHECK",e[e.CHOICE_COMMITONSELCHANGE=67108864]="CHOICE_COMMITONSELCHANGE",e))(Gt||{}),qt=(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))(qt||{});const Vt=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView"}),Kt=Object.entries(Vt).reduce((e,[t,n])=>(e[n]=Number(t),e),{});function Zt(e){return Object.keys(Vt).filter(t=>0!==(e&t)).map(e=>Vt[e])}function Xt(e){return e.reduce((e,t)=>e|Kt[t],0)}function Yt(e){return null!=e.exportValue&&e.field.value===e.exportValue}var Qt=(e=>(e[e.KEY_STROKE=12]="KEY_STROKE",e[e.FORMAT=13]="FORMAT",e[e.VALIDATE=14]="VALIDATE",e[e.CALCULATE=15]="CALCULATE",e))(Qt||{}),Jt=(e=>(e.Keystroke="keystroke",e.Format="format",e.Validate="validate",e.Calculate="calculate",e))(Jt||{}),en=(e=>(e.DocumentNamed="document_named",e.WidgetKeystroke="widget_keystroke",e.WidgetFormat="widget_format",e.WidgetValidate="widget_validate",e.WidgetCalculate="widget_calculate",e))(en||{}),tn=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))(tn||{}),nn=(e=>(e[e.None=0]="None",e[e.MatchCase=1]="MatchCase",e[e.MatchWholeWord=2]="MatchWholeWord",e[e.MatchConsecutive=4]="MatchConsecutive",e))(nn||{}),on=(e=>(e[e.Print=4]="Print",e[e.ModifyContents=8]="ModifyContents",e[e.CopyContents=16]="CopyContents",e[e.ModifyAnnotations=32]="ModifyAnnotations",e[e.FillForms=256]="FillForms",e[e.ExtractForAccessibility=512]="ExtractForAccessibility",e[e.AssembleDocument=1024]="AssembleDocument",e[e.PrintHighQuality=2048]="PrintHighQuality",e[e.AllowAll=3900]="AllowAll",e))(on||{});class rn extends Error{constructor(e,t){const n=e.map(e=>on[e]).join(", ");super(`Permission denied. Required: ${n}`),this.requiredFlags=e,this.currentPermissions=t,this.name="PermissionDeniedError"}}var an=(e=>(e[e.Display=0]="Display",e[e.Print=1]="Print",e))(an||{}),sn=(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))(sn||{});class ln{static create(){return new kt}static resolve(e){const t=new kt;return t.resolve(e),t}static reject(e){const t=new kt;return t.reject(e),t}static abort(e){const t=new kt;return t.reject(e),t}}function cn(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 dn(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 un(e){return(e=>Math.max(0,Math.min(255,e)))(e)/255}function hn(e){return((e,t=255)=>Math.max(0,Math.min(t,e)))(Math.round(255*e))}function mn(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 gn(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 pn=Object.freeze([{id:Pt.Left,label:"Left",css:"left"},{id:Pt.Center,label:"Center",css:"center"},{id:Pt.Right,label:"Right",css:"right"}]),fn=pn.reduce((e,t)=>(e[t.id]=t,e),{});function vn(e){return function(e){return fn[e]??fn[Pt.Left]}(e).css}pn.reduce((e,t)=>(e[t.css]=t.id,e),{}),pn.map(e=>({value:e.id,label:e.label}));var yn=(e=>(e.Courier="Courier",e.Helvetica="Helvetica",e.Times="Times",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats",e.Unknown="Unknown",e))(yn||{});const bn=Dt.Helvetica,wn={id:Dt.Helvetica,family:"Helvetica",bold:!1,italic:!1,label:"Helvetica",css:"Helvetica, Arial, sans-serif"},xn=Object.freeze([{id:Dt.Courier,family:"Courier",bold:!1,italic:!1,label:"Courier",css:"Courier, monospace"},{id:Dt.Courier_Bold,family:"Courier",bold:!0,italic:!1,label:"Courier Bold",css:"Courier, monospace"},{id:Dt.Courier_BoldOblique,family:"Courier",bold:!0,italic:!0,label:"Courier Bold Oblique",css:"Courier, monospace"},{id:Dt.Courier_Oblique,family:"Courier",bold:!1,italic:!0,label:"Courier Oblique",css:"Courier, monospace"},wn,{id:Dt.Helvetica_Bold,family:"Helvetica",bold:!0,italic:!1,label:"Helvetica Bold",css:"Helvetica, Arial, sans-serif"},{id:Dt.Helvetica_BoldOblique,family:"Helvetica",bold:!0,italic:!0,label:"Helvetica Bold Oblique",css:"Helvetica, Arial, sans-serif"},{id:Dt.Helvetica_Oblique,family:"Helvetica",bold:!1,italic:!0,label:"Helvetica Oblique",css:"Helvetica, Arial, sans-serif"},{id:Dt.Times_Roman,family:"Times",bold:!1,italic:!1,label:"Times Roman",css:'"Times New Roman", Times, serif'},{id:Dt.Times_Bold,family:"Times",bold:!0,italic:!1,label:"Times Bold",css:'"Times New Roman", Times, serif'},{id:Dt.Times_BoldItalic,family:"Times",bold:!0,italic:!0,label:"Times Bold Italic",css:'"Times New Roman", Times, serif'},{id:Dt.Times_Italic,family:"Times",bold:!1,italic:!0,label:"Times Italic",css:'"Times New Roman", Times, serif'},{id:Dt.Symbol,family:"Symbol",bold:!1,italic:!1,label:"Symbol",css:"Symbol, serif"},{id:Dt.ZapfDingbats,family:"ZapfDingbats",bold:!1,italic:!1,label:"Zapf Dingbats",css:"ZapfDingbats, serif"}]),kn=xn.reduce((e,t)=>(e[t.id]=t,e),{}),Cn=new Map;for(const e of xn)Cn.set(`${e.family}_${e.bold}_${e.italic}`,e.id);function In(e){return kn[e]??wn}function Sn(e){return In(e).family}function An(e){return In(e).bold}function Mn(e){return In(e).italic}function Dn(e,{bold:t,italic:n}){return Cn.get(`${e}_${t}_${n}`)??bn}function Pn(e){const t=In(e);return{fontFamily:t.css,fontWeight:t.bold?"bold":"normal",fontStyle:t.italic?"italic":"normal"}}Object.values(yn).filter(e=>"Unknown"!==e).map(e=>({value:e,label:e}));const Tn=[...new Set(xn.map(e=>e.family))];function Rn(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 zn=Object.freeze([{id:Rt.Normal,label:"Normal",css:"normal"},{id:Rt.Multiply,label:"Multiply",css:"multiply"},{id:Rt.Screen,label:"Screen",css:"screen"},{id:Rt.Overlay,label:"Overlay",css:"overlay"},{id:Rt.Darken,label:"Darken",css:"darken"},{id:Rt.Lighten,label:"Lighten",css:"lighten"},{id:Rt.ColorDodge,label:"Color Dodge",css:"color-dodge"},{id:Rt.ColorBurn,label:"Color Burn",css:"color-burn"},{id:Rt.HardLight,label:"Hard Light",css:"hard-light"},{id:Rt.SoftLight,label:"Soft Light",css:"soft-light"},{id:Rt.Difference,label:"Difference",css:"difference"},{id:Rt.Exclusion,label:"Exclusion",css:"exclusion"},{id:Rt.Hue,label:"Hue",css:"hue"},{id:Rt.Saturation,label:"Saturation",css:"saturation"},{id:Rt.Color,label:"Color",css:"color"},{id:Rt.Luminosity,label:"Luminosity",css:"luminosity"}]),En=zn.reduce((e,t)=>(e[t.id]=t,e),{});function On(e){return function(e){return En[e]??En[Rt.Normal]}(e).css}zn.reduce((e,t)=>(e[t.css]=t.id,e),{}),zn.map(e=>({value:e.id,label:e.label}));const Nn=zn.map(e=>e.id);function Ln(e){if(e instanceof gt)return{type:"noop"};if(e instanceof pt)return{type:"console"};if(e instanceof vt)return{type:"perf"};if(e instanceof ft){const t=e;return{type:"level",config:{level:t.level,logger:Ln(t.logger)}}}if(e instanceof yt){return{type:"all",config:{loggers:e.loggers.map(Ln)}}}return{type:"noop"}}const _n=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Fn(e){return _n.test(e)}function $n(){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 jn extends kt{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!==bt.Pending)return this.state.stage===bt.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!==bt.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===bt.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 jn({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 jn({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 jn(t);return e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}static first(e){let t=!1;const n=new jn({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}}class Un{constructor(e){this.parentTask=e,this.activeChild=null,this.disposed=!1;const t=e.abort.bind(e);e.abort=e=>{var n;this.disposed=!0,null==(n=this.activeChild)||n.abort(e),t(e)}}run(e){return new Promise((t,n)=>{if(this.disposed||this.parentTask.state.stage!==bt.Pending)return void n(new wt("Sequence aborted"));const o=e();this.activeChild=o,o.wait(e=>{this.activeChild=null,t(e)},e=>{this.activeChild=null,"abort"===e.type?n(new wt(e.reason)):n(new xt(e.reason))})})}runWithProgress(e,t){return new Promise((n,o)=>{if(this.disposed||this.parentTask.state.stage!==bt.Pending)return void o(new wt("Sequence aborted"));const i=e();this.activeChild=i,i.onProgress(e=>{this.parentTask.progress(t(e))}),i.wait(e=>{this.activeChild=null,n(e)},e=>{this.activeChild=null,"abort"===e.type?o(new wt(e.reason)):o(new xt(e.reason))})})}execute(e,t){e().catch(e=>{e instanceof wt||(e instanceof xt?this.parentTask.reject(e.reason):this.parentTask.reject(t(e)))})}}function Bn(){}class Wn{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 Hn extends Error{constructor(e){super(e),this.name="PluginRegistrationError"}}class Gn extends Error{constructor(e){super(e),this.name="PluginNotFoundError"}}class qn extends Error{constructor(e){super(e),this.name="CircularDependencyError"}}class Vn extends Error{constructor(e){super(e),this.name="PluginConfigurationError"}}class Kn{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 Zn="START_LOADING_DOCUMENT",Xn="UPDATE_DOCUMENT_LOADING_PROGRESS",Yn="SET_DOCUMENT_LOADED",Qn="SET_DOCUMENT_ERROR",Jn="RETRY_LOADING_DOCUMENT",eo="CLOSE_DOCUMENT",to="SET_ACTIVE_DOCUMENT",no="REORDER_DOCUMENTS",oo="MOVE_DOCUMENT",io="UPDATE_DOCUMENT_SECURITY",ro="REFRESH_PAGES",ao="SET_SCALE",so="SET_ROTATION",lo=[Zn,Xn,Yn,eo,to,Qn,Jn,"REFRESH_DOCUMENT",ro,"SET_PAGES",ao,so,"SET_DEFAULT_SCALE","SET_DEFAULT_ROTATION",no,oo,io],co=(e,t,n,o,i,r,a)=>({type:Zn,payload:{documentId:e,name:t,scale:n,rotation:o,passwordProvided:i,autoActivate:r,permissions:a}}),uo=(e,t)=>({type:eo,payload:{documentId:e,nextActiveDocumentId:t}}),ho=(e,t)=>({type:ro,payload:{documentId:e,pageIndexes:t}}),mo=(e,t)=>({type:so,payload:{rotation:e,documentId:t}});class go{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 Kn(this,e)}isCoreAction(e){return lo.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}}}on.Print,on.ModifyContents,on.CopyContents,on.ModifyAnnotations,on.FillForms,on.ExtractForAccessibility,on.AssembleDocument,on.PrintHighQuality;const po=[on.Print,on.ModifyContents,on.CopyContents,on.ModifyAnnotations,on.FillForms,on.ExtractForAccessibility,on.AssembleDocument,on.PrintHighQuality],fo={[on.Print]:"print",[on.ModifyContents]:"modifyContents",[on.CopyContents]:"copyContents",[on.ModifyAnnotations]:"modifyAnnotations",[on.FillForms]:"fillForms",[on.ExtractForAccessibility]:"extractForAccessibility",[on.AssembleDocument]:"assembleDocument",[on.PrintHighQuality]:"printHighQuality"};function vo(e,t){if(!e)return;if(t in e)return e[t];const n=fo[t];return n&&n in e?e[n]:void 0}function yo(e,t,n){var o;const i=e.documents[t],r=null==i?void 0:i.permissions,a=e.globalPermissions,s=(null==(o=null==i?void 0:i.document)?void 0:o.permissions)??on.AllowAll,l=vo(null==r?void 0:r.overrides,n);if(void 0!==l)return l;const c=vo(null==a?void 0:a.overrides,n);if(void 0!==c)return c;return!((null==r?void 0:r.enforceDocumentPermissions)??(null==a?void 0:a.enforceDocumentPermissions)??!0)||0!==(s&n)}function bo(e,t){return po.reduce((n,o)=>yo(e,t,o)?n|o:n,0)}function wo(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 xo=(e,t)=>{switch(t.type){case Zn:{const{documentId:n,name:o,scale:i,rotation:r,passwordProvided:a,autoActivate:s=!0,permissions:l}=t.payload,c={id:n,name:o,status:"loading",loadingProgress:0,error:null,document:null,scale:i??e.defaultScale,rotation:r??e.defaultRotation,passwordProvided:a??!1,pageRefreshVersions:{},permissions:l,loadStartedAt:Date.now()};return{...e,documents:{...e.documents,[n]:c},documentOrder:[...e.documentOrder,n],activeDocumentId:s||!e.activeDocumentId?n:e.activeDocumentId}}case Xn:{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 Yn:{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 Qn:{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 Jn:{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 eo:{const{documentId:n,nextActiveDocumentId:o}=t.payload,{[n]:i,...r}=e.documents;return{...e,documents:r,documentOrder:e.documentOrder.filter(e=>e!==n),activeDocumentId:wo(e,n,o)}}case oo:{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 no:return{...e,documentOrder:t.payload};case to:return{...e,activeDocumentId:t.payload};case ao:{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 so:{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 ro:{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}}}}case io:{const{documentId:n,permissions:o,isOwnerUnlocked:i}=t.payload,r=e.documents[n];return(null==r?void 0:r.document)?{...e,documents:{...e.documents,[n]:{...r,document:{...r.document,permissions:o,isOwnerUnlocked:i}}}}:e}default:return e}};class ko{constructor(e,t){this.plugins=new Map,this.manifests=new Map,this.capabilities=new Map,this.status=new Map,this.configurations=new Map,this.initPromise=null,this.pendingRegistrations=[],this.processingRegistrations=[],this.initialized=!1,this.isInitializing=!1,this.pluginsReadyPromise=null,this.destroyed=!1,this.resolver=new Wn,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)??We.Degree0,globalPermissions:null==e?void 0:e.permissions}))(t),this.store=new go(xo,this.initialCoreState),this.logger=(null==t?void 0:t.logger)??new gt}getLogger(){return this.logger}registerPlugin(e,t){if(this.initialized&&!this.isInitializing)throw new Hn("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 Hn("Registry has been destroyed");return this.initPromise||(this.initPromise=(async()=>{if(this.initialized)throw new Hn("Registry is already initialized");this.isInitializing=!0;try{if(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 Wn}this.initialized=!0}catch(e){if(e instanceof Error)throw new qn(`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 Hn(`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 Hn(`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 Gn(`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 Vn(`Missing required configuration keys for plugin ${e}: ${o.join(", ")}`)}async updatePluginConfig(e,t){const n=this.getPlugin(e);if(!n)throw new Gn(`Plugin ${e} not found`);const o=this.manifests.get(e),i=this.configurations.get(e);if(!o||!i)throw new Gn(`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 Gn(`Plugin ${e} is not registered`);const n=this.manifests.get(e);if(!n)throw new Gn(`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 Hn(`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 Gn(`Plugin ${e} not found`);return t}validatePlugin(e){if(!e.id)throw new Hn("Plugin must have an id")}validateManifest(e){if(!e.id)throw new Hn("Manifest must have an id");if(!e.name)throw new Hn("Manifest must have a name");if(!e.version)throw new Hn("Manifest must have a version");if(!Array.isArray(e.provides))throw new Hn("Manifest must have a provides array");if(!Array.isArray(e.requires))throw new Hn("Manifest must have a requires array");if(!Array.isArray(e.optional))throw new Hn("Manifest must have an optional array")}isDestroyed(){return this.destroyed}async destroy(){var e;if(this.destroyed)throw new Hn("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 Co(e,t){return{package:e,config:t}}function Io(e){return"autoMountElements"in e&&"function"==typeof e.autoMountElements}class So{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(Zn,e=>{this.onDocumentLoadingStarted(e.payload.documentId)}),this.unsubscribeFromSetDocumentLoaded=this.coreStore.onAction(Yn,e=>{this.onDocumentLoaded(e.payload.documentId)}),this.unsubscribeFromCloseDocument=this.coreStore.onAction(eo,e=>{this.onDocumentClosed(e.payload.documentId)}),this.unsubscribeFromSetScale=this.coreStore.onAction(ao,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onScaleChanged(n,e.payload.scale)}),this.unsubscribeFromSetRotation=this.coreStore.onAction(so,(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}getDocumentPermissions(e){const t=e??this.coreState.core.activeDocumentId;return t?bo(this.coreState.core,t):on.AllowAll}checkPermission(e,...t){const n=e??this.coreState.core.activeDocumentId;return!n||t.every(e=>yo(this.coreState.core,n,e))}requirePermission(e,...t){const n=e??this.coreState.core.activeDocumentId;if(!n)return;const o=[];for(const e of t)yo(this.coreState.core,n,e)||o.push(e);if(o.length>0){const e=bo(this.coreState.core,n);throw new rn(o,e)}}}class Ao{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 Mo{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 Ao(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 Do(e){return"keyExtractor"in e}function Po(e,t,n){return e<t?t:e>n?n:e}function To(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`${Eo(e)}__${Eo(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]&&To(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(!To(e[i],t[i],n))return!1}return!0}(e,t,n)}return!1}let Ro=0;const zo=new WeakMap;function Eo(e){return zo.has(e)||zo.set(e,++Ro),zo.get(e)}function Oo(){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 No(e,t=To){const n=new Set,o=new Map;let i=e;const r=(e,t)=>{let r=e,a=()=>{};if(t){if(Do(t)){const n=new Mo(e,t);r=n.handle,a=()=>n.destroy()}else{const n=new Ao(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=To)=>(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)??To,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(Do(o)){const t=new Mo(e,o);c=t.handle,d=()=>t.destroy()}else{const t=new Ao(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(Do(t)){const i=new Mo(e,t);n=i.handle,o=()=>i.destroy()}else{const i=new Ao(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 _o{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 Fo(e){return new _o(e)}const $o=de({registry:null,coreState:null,isInitializing:!0,pluginsReady:!1,activeDocumentId:null,activeDocument:null,documents:{},documentStates:[]});function jo({plugins:e,children:t}){const{utilities:n,wrappers:o}=Te(()=>{const t=[],n=[];for(const o of e){const e=o.package;if(Io(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]),i=Be(B,{children:[t,n.map((e,t)=>Be(e,{},`utility-${t}`))]});return Be(B,{children:o.reduce((e,t)=>Be(t,{children:e}),i)})}function Uo({engine:e,config:t,logger:n,onInitialized:o,plugins:i,children:r,autoMountDomElements:a=!0}){const[s,l]=Se(null),[c,d]=Se(null),[u,h]=Se(!0),[m,g]=Se(!1),p=Pe(o);Me(()=>{p.current=o},[o]),Me(()=>{const o={...t,logger:(null==t?void 0:t.logger)??n},r=new ko(e,o);r.registerPluginBatch(i);let a;return(async()=>{var e;if(await r.initialize(),r.isDestroyed())return;const t=r.getStore();d(t.getState().core);const n=t.subscribe((e,n,o)=>{t.isCoreAction(e)&&n.core!==o.core&&d(n.core)});if(await(null==(e=p.current)?void 0:e.call(p,r)),!r.isDestroyed())return r.pluginsReady().then(()=>{r.isDestroyed()||g(!0)}),l(r),h(!1),n;n()})().then(e=>{a=e}).catch(console.error),()=>{null==a||a(),r.destroy(),l(null),d(null),h(!0),g(!1)}},[e,i]);const f=Te(()=>{const e=(null==c?void 0:c.activeDocumentId)??null,t=(null==c?void 0:c.documents)??{},n=(null==c?void 0:c.documentOrder)??[],o=e&&t[e]?t[e]:null,i=n.map(e=>t[e]).filter(e=>null!=e);return{registry:s,coreState:c,isInitializing:u,pluginsReady:m,activeDocumentId:e,activeDocument:o,documents:t,documentStates:i}},[s,c,u,m]),v="function"==typeof r?r(f):r;return Be($o.Provider,{value:f,children:m&&a?Be(jo,{plugins:i,children:v}):v})}function Bo(e){const{registry:t}=function(){const e=ze($o);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 Wo(e){const{plugin:t,isLoading:n,ready:o}=Bo(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 Ho(){const{coreState:e}=ze($o);return e}function Go(e){const t=Ho();return Te(()=>t&&e?t.documents[e]??null:null,[t,e])}on.Print,on.ModifyContents,on.CopyContents,on.ModifyAnnotations,on.FillForms,on.ExtractForAccessibility,on.AssembleDocument,on.PrintHighQuality;const qo=[on.Print,on.ModifyContents,on.CopyContents,on.ModifyAnnotations,on.FillForms,on.ExtractForAccessibility,on.AssembleDocument,on.PrintHighQuality],Vo={[on.Print]:"print",[on.ModifyContents]:"modifyContents",[on.CopyContents]:"copyContents",[on.ModifyAnnotations]:"modifyAnnotations",[on.FillForms]:"fillForms",[on.ExtractForAccessibility]:"extractForAccessibility",[on.AssembleDocument]:"assembleDocument",[on.PrintHighQuality]:"printHighQuality"};function Ko(e,t){if(!e)return;if(t in e)return e[t];const n=Vo[t];return n&&n in e?e[n]:void 0}function Zo(e,t,n){var o;const i=e.documents[t],r=null==i?void 0:i.permissions,a=e.globalPermissions,s=(null==(o=null==i?void 0:i.document)?void 0:o.permissions)??on.AllowAll,l=Ko(null==r?void 0:r.overrides,n);if(void 0!==l)return l;const c=Ko(null==a?void 0:a.overrides,n);if(void 0!==c)return c;return!((null==r?void 0:r.enforceDocumentPermissions)??(null==a?void 0:a.enforceDocumentPermissions)??!0)||0!==(s&n)}function Xo(e){const t=Ho();return Te(()=>{var n,o;if(!t)return{permissions:on.AllowAll,pdfPermissions:on.AllowAll,hasPermission:()=>!0,hasAllPermissions:()=>!0,canPrint:!0,canModifyContents:!0,canCopyContents:!0,canModifyAnnotations:!0,canFillForms:!0,canExtractForAccessibility:!0,canAssembleDocument:!0,canPrintHighQuality:!0};const i=function(e,t){return qo.reduce((n,o)=>Zo(e,t,o)?n|o:n,0)}(t,e),r=n=>Zo(t,e,n);return{permissions:i,pdfPermissions:(null==(o=null==(n=t.documents[e])?void 0:n.document)?void 0:o.permissions)??on.AllowAll,hasPermission:r,hasAllPermissions:(...n)=>n.every(n=>Zo(t,e,n)),canPrint:r(on.Print),canModifyContents:r(on.ModifyContents),canCopyContents:r(on.CopyContents),canModifyAnnotations:r(on.ModifyAnnotations),canFillForms:r(on.FillForms),canExtractForAccessibility:r(on.ExtractForAccessibility),canAssembleDocument:r(on.AssembleDocument),canPrintHighQuality:r(on.PrintHighQuality)}},[t,e])}const Yo="https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.10.1/dist/pdfium.wasm";de(void 0);const Qo="viewport",Jo={id:Qo,name:"Viewport Plugin",version:"1.0.0",provides:["viewport"],requires:[],optional:[],defaultConfig:{viewportGap:10,scrollEndDelay:300}},ei="INIT_VIEWPORT_STATE",ti="CLEANUP_VIEWPORT_STATE",ni="REGISTER_VIEWPORT",oi="UNREGISTER_VIEWPORT",ii="SET_VIEWPORT_METRICS",ri="SET_VIEWPORT_SCROLL_METRICS",ai="SET_VIEWPORT_GAP",si="SET_SCROLL_ACTIVITY",li="SET_SMOOTH_SCROLL_ACTIVITY",ci="ADD_VIEWPORT_GATE",di="REMOVE_VIEWPORT_GATE";function ui(e,t){return{type:li,payload:{documentId:e,isSmoothScrolling:t}}}const hi={viewportMetrics:{width:0,height:0,scrollTop:0,scrollLeft:0,clientWidth:0,clientHeight:0,scrollWidth:0,scrollHeight:0,clientLeft:0,clientTop:0,relativePosition:{x:0,y:0}},isScrolling:!1,isSmoothScrolling:!1,gates:new Set},mi={viewportGap:0,documents:{},activeViewports:new Set,activeDocumentId:null},gi=class extends So{constructor(e,t,n){var o;super(e,t),this.id=e,this.viewportResize$=No(),this.viewportMetrics$=No(),this.scrollMetrics$=No(),this.scrollActivity$=No(),this.gateState$=No(),this.scrollRequests$=new Map,n.viewportGap&&this.dispatch((o=n.viewportGap,{type:ai,payload:o})),this.scrollEndDelay=n.scrollEndDelay||100}onDocumentLoadingStarted(e){this.dispatch(function(e){return{type:ei,payload:{documentId:e}}}(e)),this.scrollRequests$.set(e,Oo()),this.logger.debug("ViewportPlugin","DocumentOpened",`Initialized viewport state for document: ${e}`)}onDocumentClosed(e){var t;this.dispatch(function(e){return{type:ti,payload:{documentId:e}}}(e)),null==(t=this.scrollRequests$.get(e))||t.clear(),this.scrollRequests$.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),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),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:ni,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:oi,payload:{documentId:e}}}(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:ii,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:ri,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)}gate(e,t){const n=this.state.documents[t];n?n.gates.has(e)||(this.dispatch(function(e,t){return{type:ci,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:di,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)}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(ui(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:si,payload:{documentId:e,isScrolling:t}}}(e,!1),this.scrollEndDelay),this.debouncedDispatch(ui(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(),super.destroy()}};gi.id="viewport";let pi=gi;const fi={manifest:Jo,create:(e,t)=>new pi(Qo,e,t),reducer:(e=mi,t)=>{switch(t.type){case ei:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...hi,gates:new Set}}}}case ti:{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 ni:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.add(n),{...e,activeViewports:o,activeDocumentId:e.activeDocumentId??n}}case oi:{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 ai:return{...e,viewportGap:t.payload};case ii:{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,clientLeft:o.clientLeft,clientTop:o.clientTop,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 ri:{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 si:{const{documentId:n,isScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isScrolling:o}}}:e}case li:{const{documentId:n,isSmoothScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isSmoothScrolling:o}}}:e}case ci:{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 di:{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:mi},vi=de(null),yi=()=>Wo(pi.id);function bi(e){const{plugin:t}=Bo(pi.id),n=Pe(null);return De(()=>{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)}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,clientLeft:o.clientLeft,clientTop:o.clientTop})});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),r.disconnect(),o.removeEventListener("scroll",i),a()}},[t,e]),n}function wi({children:e,documentId:t,...n}){const[o,i]=Se(0),r=bi(t),{provides:a}=yi(),s=(e=>{const{provides:t}=yi(),[n,o]=Se((null==t?void 0:t.isGated(e))??!1);return Me(()=>{if(t)return o(t.isGated(e)),t.onGateChange(t=>{t.documentId===e&&o(t.isGated)})},[t,e]),n})(t);Me(()=>{a&&i(a.getViewportGap())},[a]);const{style:l,...c}=n;return Be(vi.Provider,{value:r,children:Be("div",{...c,ref:r,style:{width:"100%",height:"100%",overflow:"auto",..."object"==typeof l?l:{},padding:`${o}px`},children:!s&&e})})}var xi=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(xi||{});class ki{constructor(e){this.pageGap=e.pageGap??20,this.viewportGap=e.viewportGap??20,this.bufferSize=e.bufferSize??2}getCenteringOffsetX(e,t){return!t||e.width>=t.width?0:(t.width-e.width)/2}getCenteringOffsetY(e,t){return 0}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+this.getItemSizeAlongScrollAxis(t[a]))*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.getTotalContentSize(t),a=this.calculatePageVisibility(i,e,n,r),s=a.map(e=>e.pageNumber),l=t.slice(o.start,o.end+1).flatMap(e=>e.index),c=this.determineCurrentPage(a),d=t[o.start],u=t[o.end],h=d?d.offset*n:0,m=t[t.length-1],g=u?(m.offset+this.getItemSizeAlongScrollAxis(m))*n-(u.offset+this.getItemSizeAlongScrollAxis(u))*n:0;return{currentPage:c,visiblePages:s,pageVisibilityMetrics:a,renderedPageIndexes:l,scrollOffset:{x:e.scrollLeft,y:e.scrollTop},startSpacing:h,endSpacing:g}}calculatePageVisibility(e,t,n,o){const i=[];return e.forEach(e=>{const r=this.getCenteringOffsetX(e,o),a=this.getCenteringOffsetY(e,o);e.pageLayouts.forEach(o=>{const s=(e.x+r)*n,l=(e.y+a)*n,c=s+o.x*n,d=l+o.y*n,u=o.rotatedWidth*n,h=o.rotatedHeight*n,m=t.scrollLeft,g=t.scrollTop,p=m+t.clientWidth,f=g+t.clientHeight,v=Math.max(c,m),y=Math.max(d,g),b=Math.min(c+u,p),w=Math.min(d+h,f);if(v<b&&y<w){const e=b-v,t=w-y,r=u*h,a=e*t;i.push({pageNumber:o.pageNumber,viewportX:v-m,viewportY:y-g,visiblePercentage:a/r*100,original:{pageX:(v-c)/n,pageY:(y-d)/n,visibleWidth:e/n,visibleHeight:t/n,scale:1},scaled:{pageX:v-c,pageY:y-d,visibleWidth:e,visibleHeight:t,scale:n}})}})}),i}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;const r=this.getCenteringOffsetX(o,n),a=this.getCenteringOffsetY(o,n);return{origin:{x:o.x+i.x+r,y:o.y+i.y+a},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=Qe(a.origin,n);if(i){const e=function(e,t,n,o){return Qe(Ye(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=Qe(a.origin,n),l=ot({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 Ci extends ki{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,elevated:!1};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}getItemSizeAlongScrollAxis(e){return e.height}}class Ii extends ki{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,elevated:!1};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}getItemSizeAlongScrollAxis(e){return e.width}getCenteringOffsetX(e,t){return 0}getCenteringOffsetY(e,t){return!t||e.height>=t.height?0:(t.height-e.height)/2}}const Si="INIT_SCROLL_STATE",Ai="CLEANUP_SCROLL_STATE",Mi="UPDATE_DOCUMENT_SCROLL_STATE",Di="SET_SCROLL_STRATEGY";function Pi(e,t){return{type:Mi,payload:{documentId:e,state:t}}}const Ti={isChanging:!1,targetPage:1,fromPage:1,startTime:0},Ri=class extends So{constructor(e,t,n){var o,i,r;super(e,t),this.id=e,this.config=n,this.elevatedPages=new Map,this.strategies=new Map,this.layoutReady=new Set,this.initialLayoutFired=new Set,this.scrollerLayoutEmitters=new Map,this.pageChange$=No(),this.scroll$=No(),this.layoutChange$=No(),this.pageChangeState$=No(),this.layoutReady$=No(),this.state$=No(),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)});const a=null==(r=this.registry.getPlugin("interaction-manager"))?void 0:r.provides();a&&a.onPageActivityChange(e=>{let t=this.elevatedPages.get(e.documentId);e.hasActivity?(t||(t=new Set,this.elevatedPages.set(e.documentId,t)),t.add(e.pageIndex)):null==t||t.delete(e.pageIndex),this.pushScrollerLayout(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:Si,payload:{documentId:e,state:t}}}(e,n));const o=this.createStrategy(n.strategy);this.strategies.set(e,o),this.scrollerLayoutEmitters.set(e,No())}onDocumentLoaded(e){var t;const n=this.getCoreDocument(e);n&&(this.dispatch(Pi(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),this.elevatedPages.delete(e);const t=this.scrollerLayoutEmitters.get(e);t&&(t.clear(),this.scrollerLayoutEmitters.delete(e)),this.dispatch(function(e){return{type:Ai,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,r=this.elevatedPages.get(e),{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,elevated:(null==r?void 0:r.has(e.pageIndex))??!1}))}))};var o,i,r}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===xi.Horizontal?new Ii(t):new Ci(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:Ti}}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(Pi(e,{pageChangeState:i,currentPage:t})),this.pageChange$.emit({documentId:e,pageNumber:t,totalPages:o.totalPages}),"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(Pi(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);if(!n)return;const o=n.pageChangeState.isChanging,i=o&&t.currentPage!==n.currentPage?{...t,currentPage:n.currentPage}:t;this.dispatch(Pi(e,i)),this.scroll$.emit({documentId:e,metrics:i}),o||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(Pi(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=>{const t=((e.rotation??0)+i.rotation)%4;return{...e,rotatedSize:Ke(e.size,t,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){var n;const o=t??this.getActiveDocumentId(),i=this.getDocumentStateOrThrow(o),r=this.getStrategy(o),a=this.getCoreDocumentOrThrow(o),{pageNumber:s,behavior:l="smooth",pageCoordinates:c,alignX:d,alignY:u}=e;this.startPageChange(o,s,l);const h=null==(n=a.document)?void 0:n.pages[s-1],m=(((null==h?void 0:h.rotation)??0)+a.rotation)%4,g=r.getScrollPositionForPage(s,i.virtualItems,a.scale,m,c);if(g){this.viewport.forDocument(o).scrollTo({...g,behavior:l,alignX:d,alignY:u})}else this.completePageChange(o)}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){var r;const a=i??this.getActiveDocumentId(),s=this.getDocumentStateOrThrow(a),l=this.getStrategy(a),c=this.getCoreDocumentOrThrow(a);let d=o;if(void 0===d){const t=null==(r=c.document)?void 0:r.pages[e];d=(((null==t?void 0:t.rotation)??0)+c.rotation)%4}return l.getRectPositionForPage(e+1,s.virtualItems,n??c.scale,d,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:Di,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(),this.elevatedPages.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()}};Ri.id="scroll";let zi=Ri;const Ei="scroll",Oi={manifest:{id:Ei,name:"Scroll Plugin",version:"1.0.0",provides:["scroll"],requires:["viewport"],optional:["spread","interaction-manager"],defaultConfig:{defaultPageGap:10,defaultBufferSize:4,defaultStrategy:xi.Vertical}},create:(e,t)=>new zi(Ei,e,t),reducer:(e,t)=>{switch(t.type){case Si:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case Ai:{const{[t.payload]:n,...o}=e.documents;return{...e,documents:o}}case Mi:{const{documentId:n,state:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,...o}}}:e}case Di:{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??xi.Vertical,defaultPageGap:t.defaultPageGap??10,defaultBufferSize:t.defaultBufferSize??2,documents:{}}))(0,t)},Ni=()=>Wo(zi.id),Li=e=>{const{provides:t}=Ni(),[n,o]=Se(1),[i,r]=Se(1);return Me(()=>{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 _i({documentId:e,renderPage:t,...n}){const{plugin:o}=Bo(zi.id),[i,r]=Se({layout:null,docId:null});Me(()=>{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 De(()=>{o&&e&&a&&o.setLayoutReady(e)},[o,e,a]),a?Be("div",{...n,style:{width:`${a.totalWidth}px`,height:`${a.totalHeight}px`,position:"relative",boxSizing:"border-box",margin:"0 auto",...a.strategy===xi.Horizontal&&{display:"flex",flexDirection:"row"}},children:[Be("div",{style:{...a.strategy===xi.Horizontal?{width:a.startSpacing,height:"100%",flexShrink:0}:{height:a.startSpacing,width:"100%"}}}),Be("div",{style:{gap:a.pageGap,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",...a.strategy===xi.Horizontal?{flexDirection:"row",minHeight:"100%"}:{flexDirection:"column",minWidth:"fit-content"}},children:a.items.map(e=>Be("div",{style:{display:"flex",justifyContent:"center",gap:a.pageGap},children:e.pageLayouts.map(e=>Be("div",{style:{width:`${e.rotatedWidth}px`,height:`${e.rotatedHeight}px`,position:"relative",zIndex:e.elevated?1:void 0},children:t({...e})},e.pageNumber))},e.pageNumbers[0]))}),Be("div",{style:{...a.strategy===xi.Horizontal?{width:a.endSpacing,height:"100%",flexShrink:0}:{height:a.endSpacing,width:"100%"}}})]}):null}var Fi=(e=>(e.None="none",e.Odd="odd",e.Even="even",e))(Fi||{});const $i="SPREAD/INIT_STATE",ji="SPREAD/CLEANUP_STATE",Ui="SPREAD/SET_SPREAD_MODE",Bi="SPREAD/SET_PAGE_GROUPING";function Wi(e,t){return{type:Bi,payload:{documentId:e,grouping:t}}}const Hi=class extends So{constructor(e,t,n){var o;super(e,t),this.spreadEmitter$=No(),this.defaultSpreadMode=n.defaultSpreadMode??Fi.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:$i,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(Wi(e,t))}null==(t=this.viewport)||t.releaseGate("spread",e)}onDocumentClosed(e){this.dispatch(function(e){return{type:ji,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:Ui,payload:{documentId:e,spreadMode:t}}}(n,e));const t=this.calculatePageGrouping(n,i.document.pages.length);this.dispatch(Wi(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 Fi.None:return Array.from({length:t},(e,t)=>[t]);case Fi.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 Fi.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)??Fi.None} -> ${i.spreadMode}`)}}async initialize(e){this.logger.info("SpreadPlugin","Initialize","Spread plugin initialized")}async destroy(){this.spreadEmitter$.clear(),super.destroy()}};Hi.id="spread";let Gi=Hi;const qi="spread",Vi={id:qi,name:"Spread Plugin",version:"1.0.0",provides:["spread"],requires:[],optional:["viewport"],defaultConfig:{}};Fi.None;const Ki={documents:{},activeDocumentId:null},Zi={manifest:Vi,create:(e,t)=>new Gi(qi,e,t),reducer:(e=Ki,t)=>{switch(t.type){case $i:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case ji:{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 Ui:{const{documentId:n,spreadMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,spreadMode:o}}}:e}case Bi:{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:Ki},Xi="ui",Yi={id:Xi,name:"UI Plugin",version:"1.0.0",provides:["ui"],requires:[],optional:["i18n"],defaultConfig:{schema:{id:"empty",version:"1.0.0",toolbars:{},menus:{},sidebars:{},modals:{},selectionMenus:{}}}},Qi="UI/INIT_STATE",Ji="UI/CLEANUP_STATE",er="UI/SET_ACTIVE_TOOLBAR",tr="UI/CLOSE_TOOLBAR_SLOT",nr="UI/SET_ACTIVE_SIDEBAR",or="UI/CLOSE_SIDEBAR_SLOT",ir="UI/SET_SIDEBAR_TAB",rr="UI/OPEN_MODAL",ar="UI/CLOSE_MODAL",sr="UI/CLEAR_MODAL",lr="UI/OPEN_MENU",cr="UI/CLOSE_MENU",dr="UI/CLOSE_ALL_MENUS",ur="UI/SET_OVERLAY_ENABLED",hr="UI/SET_DISABLED_CATEGORIES",mr="UI/SET_HIDDEN_ITEMS",gr=(e,t,n,o,i)=>({type:nr,payload:{documentId:e,placement:t,slot:n,sidebarId:o,activeTab:i}}),pr=(e,t,n)=>({type:or,payload:{documentId:e,placement:t,slot:n}}),fr=(e,t)=>({type:lr,payload:{documentId:e,menuState:t}}),vr=(e,t)=>({type:cr,payload:{documentId:e,menuId:t}}),yr=(e,t,n)=>({type:ur,payload:{documentId:e,overlayId:t,enabled:n}}),br=e=>({type:hr,payload:{categories:e}}),wr=e=>({type:mr,payload:{hiddenItems:e}});function xr(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 kr(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 Cr(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 Ir(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 Sr="data-epdf",Ar="data-epdf-s",Mr="data-epdf-i",Dr="data-epdf-cat",Pr="data-epdf-dis",Tr="data-epdf-hid",Rr={ROOT:`[${Sr}]`,STYLES:`[${Ar}]`,ITEM:e=>`[${Mr}="${e}"]`,CATEGORIES:e=>`[${Dr}~="${e}"]`,DISABLED_CATEGORY:e=>`[${Pr}~="${e}"]`,HIDDEN_ITEM:e=>`[${Tr}~="${e}"]`},zr={useContainerQueries:!0};function Er(e,t={}){const n={...zr,...t.config},o=t.locale,i=Nr(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=Rr.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(`${Rr.ROOT}[${Pr}~="${e}"] [${Dr}~="${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=Vr(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 Or(e,t){const n=new Set(t),o=[];return e.forEach((e,t)=>{e.some(e=>n.has(e))&&o.push(t)}),o}function Nr(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))Lr(s,l,n,o,i,r,a,t);for(const[r,s]of Object.entries(e.toolbars))jr(r,s,n,o,i,a,t);for(const[t,r]of Object.entries(e.sidebars))Wr(t,r,n,o,i);for(const[r,s]of Object.entries(e.selectionMenus||{}))Hr(r,s,n,o,i,a,t);return{categories:n,itemCategories:o,dependencies:i,menuBreakpoints:r,responsiveItems:a}}function Lr(e,t,n,o,i,r,a,s){qr(e,t.categories,t.visibilityDependsOn,n,o,i),_r(t.items,n,o,i);const l=Ir(t,s);l&&l.items.forEach((e,t)=>{a.set(t,e)});const c=function(e,t,n){var o;const i=[],r=Ir(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=$r(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;Fr(e.items,t,n,o),i.push({visibleItemIds:n,visibleCategories:o})}return i}(t,o,s);r.set(e,c)}function _r(e,t,n,o){for(const i of e)qr(i.id,i.categories,i.visibilityDependsOn,t,n,o),"section"===i.type&&_r(i.items,t,n,o)}function Fr(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&&Fr(i.items,t,n,o)}}function $r(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 jr(e,t,n,o,i,r,a){qr(e,t.categories,t.visibilityDependsOn,n,o,i);const s=Ir(t,a);s&&s.items.forEach((e,t)=>{r.set(t,e)}),Ur(t.items,n,o,i)}function Ur(e,t,n,o){for(const i of e)qr(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&Ur(i.items,t,n,o),"tab-group"===i.type&&i.tabs&&Br(i.tabs,t,n,o)}function Br(e,t,n,o){for(const i of e)qr(i.id,i.categories,i.visibilityDependsOn,t,n,o)}function Wr(e,t,n,o,i){if(qr(e,t.categories,t.visibilityDependsOn,n,o,i),"tabs"===t.content.type)for(const e of t.content.tabs)qr(e.id,e.categories,e.visibilityDependsOn,n,o,i)}function Hr(e,t,n,o,i,r,a){if(qr(e,t.categories,t.visibilityDependsOn,n,o,i),t.responsive){const e=Ir(t,a);e&&e.items.forEach((e,t)=>{r.set(t,e)})}Gr(t.items,n,o,i)}function Gr(e,t,n,o){for(const i of e)qr(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&Gr(i.items,t,n,o)}function qr(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 Vr(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=>Rr.HIDDEN_ITEM(e)).join(""),i=`${Rr.ROOT}${o} ${Rr.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=>Rr.HIDDEN_ITEM(e)).join("");r.push(`${Rr.ROOT}${t} ${Rr.ITEM(e.itemId)} {\n display: none !important;\n}`)}return r}function Kr(e,t){var n;return{[Mr]:e.id,[Dr]:(null==(n=e.categories)?void 0:n.join(" "))||void 0,...t}}const Zr=class extends So{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$=No(),this.stylesheetInvalidated$=Oo(),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.overlayChanged$=Lo((e,t)=>({documentId:e,...t}),{cache:!1}),this.schema=n.schema,this.stylesheetConfig=n.stylesheetConfig||{},this.itemCategories=Nr(this.schema).itemCategories,null==(o=n.disabledCategories)?void 0:o.length){this.dispatch(br(n.disabledCategories));const e=Or(this.itemCategories,n.disabledCategories);this.dispatch(wr(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.overlayChanged$.clear(),this.stylesheetInvalidated$.clear(),super.destroy()}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:Qi,payload:{documentId:e,schema:t}}))(e,this.schema))}onDocumentClosed(e){this.dispatch((e=>({type:Ji,payload:{documentId:e}}))(e)),this.toolbarChanged$.clearScope(e),this.sidebarChanged$.clearScope(e),this.modalChanged$.clearScope(e),this.menuChanged$.clearScope(e),this.overlayChanged$.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=Er(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(br(n));const o=Or(this.itemCategories,n);this.dispatch(wr(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(br(n));const o=Or(this.itemCategories,n);this.dispatch(wr(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(br(e));const t=Or(this.itemCategories,e);this.dispatch(wr(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,n)=>this.openModalForDocument(e,t,n),openMenu:(e,t,n,o)=>this.openMenuForDocument(e,t,n,o),toggleMenu:(e,t,n,o)=>this.toggleMenuForDocument(e,t,n,o),enableOverlay:(e,t)=>this.enableOverlayForDocument(e,t),disableOverlay:(e,t)=>this.disableOverlayForDocument(e,t),toggleOverlay:(e,t)=>this.toggleOverlayForDocument(e,t),forDocument:e=>this.createUIScope(e),getSchema:()=>this.schema,mergeSchema:e=>{var t,n;this.schema=(t=this.schema,n=e,{...t,...n,toolbars:xr(t.toolbars,n.toolbars),menus:kr(t.menus,n.menus),sidebars:Cr(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,onOverlayChanged:this.overlayChanged$.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,n)=>this.openModalForDocument(t,n,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),enableOverlay:t=>this.enableOverlayForDocument(t,e),disableOverlay:t=>this.disableOverlayForDocument(t,e),toggleOverlay:t=>this.toggleOverlayForDocument(t,e),isOverlayEnabled:t=>this.isOverlayEnabledForDocument(t,e),getEnabledOverlays:()=>this.getEnabledOverlaysForDocument(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),onOverlayChanged:this.overlayChanged$.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:er,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:tr,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(gr(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(pr(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(pr(r,e,t)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:""})):(this.dispatch(gr(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:ir,payload:{documentId:e,sidebarId:t,tabId:n}}))(o,e,t))}getSidebarTabForDocument(e,t){return this.getDocumentStateOrThrow(t).sidebarTabs[e]??null}openModalForDocument(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:rr,payload:{documentId:e,modalId:t,props:n}}))(o,e,t)),this.modalChanged$.emit(o,{modalId:e,isOpen:!0})}closeModalForDocument(e){const t=e??this.getActiveDocumentId(),n=this.getDocumentStateOrThrow(t).activeModal;this.dispatch((e=>({type:ar,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:sr,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(fr(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(vr(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(vr(i,e)),this.menuChanged$.emit(i,{menuId:e,isOpen:!1})):(this.dispatch(fr(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:dr,payload:{documentId:e}}))(t))}isMenuOpenForDocument(e,t){return!!this.getDocumentStateOrThrow(t).openMenus[e]}getOpenMenusForDocument(e){return Object.values(this.getDocumentStateOrThrow(e).openMenus)}enableOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(yr(n,e,!0)),this.overlayChanged$.emit(n,{overlayId:e,isEnabled:!0})}disableOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(yr(n,e,!1)),this.overlayChanged$.emit(n,{overlayId:e,isEnabled:!1})}toggleOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.isOverlayEnabledForDocument(e,n)?this.disableOverlayForDocument(e,n):this.enableOverlayForDocument(e,n)}isOverlayEnabledForDocument(e,t){return this.getDocumentStateOrThrow(t).enabledOverlays[e]??!0}getEnabledOverlaysForDocument(e){const t=this.getDocumentStateOrThrow(e).enabledOverlays;return Object.entries(t).filter(([,e])=>e).map(([e])=>e)}};Zr.id="ui";let Xr=Zr;const Yr={activeToolbars:{},activeSidebars:{},activeModal:null,openMenus:{},sidebarTabs:{},enabledOverlays:{}},Qr={documents:{},disabledCategories:[],hiddenItems:[]};function Jr(e,t){const n=function(e){return e.ui??null}(e);return(null==n?void 0:n.documents[t])??null}function ea(e,t){return`${e}-${t}`}function ta(e,t,n,o,i){const r=function(e,t,n,o){const i=Jr(e,t);return i?i.activeToolbars[ea(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.toolbarId===i)}function na(e,t,n,o,i){const r=function(e,t,n,o){const i=Jr(e,t);return i?i.activeSidebars[ea(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.sidebarId===i)}const oa={manifest:Yi,create:(e,t)=>new Xr(Xi,e,t),reducer:(e=Qr,t)=>{var n;switch(t.type){case Qi:{const{documentId:n,schema:o}=t.payload,i={};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}}});const r={};return o.overlays&&Object.values(o.overlays).forEach(e=>{r[e.id]=e.defaultEnabled??!0}),{...e,documents:{...e.documents,[n]:{...Yr,activeToolbars:i,enabledOverlays:r}}}}case Ji:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case er:{const{documentId:n,placement:o,slot:i,toolbarId:r}=t.payload,a=e.documents[n]||Yr,s=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...a,activeToolbars:{...a.activeToolbars,[s]:{toolbarId:r,isOpen:!0}}}}}}case tr:{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 nr:{const{documentId:n,placement:o,slot:i,sidebarId:r,activeTab:a}=t.payload,s=e.documents[n]||Yr,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 or:{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 ir:{const{documentId:n,sidebarId:o,tabId:i}=t.payload,r=e.documents[n]||Yr;return{...e,documents:{...e.documents,[n]:{...r,sidebarTabs:{...r.sidebarTabs,[o]:i}}}}}case rr:{const{documentId:n,modalId:o,props:i}=t.payload,r=e.documents[n]||Yr;return{...e,documents:{...e.documents,[n]:{...r,activeModal:{modalId:o,isOpen:!0,props:i},openMenus:{}}}}}case ar:{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 sr:{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 lr:{const{documentId:n,menuState:o}=t.payload,i=e.documents[n]||Yr;return{...e,documents:{...e.documents,[n]:{...i,openMenus:{[o.menuId]:o}}}}}case cr:{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 dr:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,openMenus:{}}}}:e}case ur:{const{documentId:n,overlayId:o,enabled:i}=t.payload,r=e.documents[n]||Yr;return{...e,documents:{...e.documents,[n]:{...r,enabledOverlays:{...r.enabledOverlays,[o]:i}}}}}case hr:return{...e,disabledCategories:t.payload.categories};case mr:return{...e,hiddenItems:t.payload.hiddenItems};default:return e}},initialState:Qr},ia=()=>Wo(Xr.id),ra=e=>{const{provides:t}=ia(),[n,o]=Se(null);return Me(()=>{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())),l=n.onOverlayChanged(()=>o(n.getState()));return()=>{i(),r(),a(),s(),l()}},[t,e]),n},aa=de(null);function sa(){const e=ze(aa);if(!e)throw new Error("useUIContainer must be used within a UIProvider");return e}const la=de(null);function ca({children:e}){const t=Pe(new Map),n={register:Re((e,n,o)=>{const i=`${e}:${n}`;t.current.set(i,o)},[]),unregister:Re((e,n)=>{const o=`${e}:${n}`;t.current.delete(o)},[]),getAnchor:Re((e,n)=>{const o=`${e}:${n}`;return t.current.get(o)||null},[])};return Be(la.Provider,{value:n,children:e})}function da(){const e=ze(la);if(!e)throw new Error("useAnchorRegistry must be used within UIProvider");return e}function ua(e,t){const n=da(),o=Pe(null),i=Pe(e),r=Pe(t);return i.current=e,r.current=t,Re(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 ha=de(null);function ma({children:e,initialComponents:t={}}){const n=Pe(new Map(Object.entries(t))),o={register:Re((e,t)=>{n.current.set(e,t)},[]),unregister:Re(e=>{n.current.delete(e)},[]),get:Re(e=>n.current.get(e),[]),has:Re(e=>n.current.has(e),[]),getRegisteredIds:Re(()=>Array.from(n.current.keys()),[])};return Be(ha.Provider,{value:o,children:e})}function ga(){const e=function(){const e=ze(ha);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?Be(i,{documentId:n,...o||{}}):(console.error(`Component "${t}" not found in registry`),null)}}}const pa=de(null);function fa({children:e,renderers:t}){return Be(pa.Provider,{value:t,children:e})}function va(){const e=ze(pa);if(!e)throw new Error("useRenderers must be used within UIProvider");return e}function ya(e,t){var n;const{provides:o}=ia(),i=va(),r=Re(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 Be(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 ba({container:e,documentId:t}){const n=ra(t),{provides:o}=ia(),i=da(),r=va(),[a,s]=Se(null),l=(null==n?void 0:n.openMenus)||{},c=null==o?void 0:o.getSchema();Me(()=>{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 Be(r.menu,{schema:d,documentId:t,anchorEl:a.anchorEl,onClose:()=>{a&&(null==o||o.forDocument(t).closeMenu(a.menuId))},container:e})}function wa({children:e,style:t,...n}){const{plugin:o}=Bo(Xr.id),{provides:i}=ia(),[r,a]=Se([]),[s,l]=Se([]),c=Pe(null),d=Pe(null),u=Pe(null),h=Pe(null),m=Te(()=>({containerRef:h,getContainer:()=>h.current}),[]),g=Re(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(Rr.STYLES);if(n)return c.current=n,void(n.textContent=o.getStylesheet());const i=o.getStylesheet(),r=document.createElement("style");r.setAttribute(Ar,""),r.textContent=i,t instanceof ShadowRoot?t.insertBefore(r,t.firstChild):t.appendChild(r),c.current=r}},[o]);Me(()=>()=>{var e;(null==(e=c.current)?void 0:e.parentNode)&&!u.current&&c.current.remove(),c.current=null,d.current=null},[]),Me(()=>{if(o)return o.onStylesheetInvalidated(()=>{c.current&&(c.current.textContent=o.getStylesheet())})},[o]),Me(()=>{if(i)return a(i.getDisabledCategories()),l(i.getHiddenItems()),i.onCategoryChanged(({disabledCategories:e,hiddenItems:t})=>{a(e),l(t)})},[i]);const p=Te(()=>r.length>0?r.join(" "):void 0,[r]),f=Te(()=>s.length>0?s.join(" "):void 0,[s]),v=Te(()=>{const e={containerType:"inline-size"};return t&&"object"==typeof t?{...e,...t}:e},[t]),y={[Sr]:"",[Pr]:p,[Tr]:f};return Be(aa.Provider,{value:m,children:Be("div",{ref:g,...y,...n,style:v,children:e})})}function xa({children:e,documentId:t,components:n={},renderers:o,menuContainer:i,...r}){return Be(ca,{children:Be(ma,{initialComponents:n,children:Be(fa,{renderers:o,children:Be(wa,{...r,children:[e,Be(ba,{documentId:t,container:i})]})})})})}const ka=class extends So{constructor(e,t,n){super(e,t),this.id=e,this.documentOpened$=No(),this.documentClosed$=No(),this.activeDocumentChanged$=No(),this.documentError$=No(),this.documentOrderChanged$=No(),this.openFileRequest$=Oo(),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:to,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:oo,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:no,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),setDocumentEncryption:(e,t)=>this.setDocumentEncryption(e,t),unlockOwnerPermissions:(e,t)=>this.unlockOwnerPermissions(e,t),removeEncryption:e=>this.removeEncryption(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 kt,n=e.documentId||this.generateDocumentId(),o=this.checkDocumentLimit();if(o)return t.reject(o),t;const i=e.name??this.extractNameFromUrl(e.url);this.loadOptions.set(n,e),this.dispatchCoreAction(co(n,i,e.scale,e.rotation,!!e.password,e.autoActivate,e.permissions)),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,normalizeRotation:!0});return t.resolve({documentId:n,task:a}),this.handleLoadTask(n,a,"OpenDocumentUrl"),t}openDocumentBuffer(e){const t=new kt,n=this.checkDocumentLimit();if(n)return t.reject(n),t;const o=e.documentId||this.generateDocumentId();this.loadOptions.set(o,e),this.dispatchCoreAction(co(o,e.name,e.scale,e.rotation,!!e.password,e.autoActivate,e.permissions)),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,normalizeRotation:!0});return t.resolve({documentId:o,task:r}),this.handleLoadTask(o,r,"OpenDocumentBuffer"),t}retryDocument(e,t){const n=new kt,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:Jn,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 kt;return this.openFileRequest$.emit({task:t,options:e}),t}closeDocument(e){const t=new kt,n=this.coreState.core.documents[e];return n?("loaded"===n.status&&n.document?this.engine.closeDocument(n.document).wait(()=>{this.dispatchCoreAction(uo(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(uo(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`),kt.all(t)}setDocumentEncryption(e,t){const n=new kt,o=this.coreState.core.documents[e];if(!(null==o?void 0:o.document))return n.reject({code:sn.DocNotOpen,message:`Document ${e} is not open`}),n;this.logger.info("DocumentManagerPlugin","SetDocumentEncryption",`Setting encryption on document ${e}`,{hasUserPassword:!!t.userPassword,allowedFlags:t.allowedFlags});return this.engine.setDocumentEncryption(o.document,t.userPassword??"",t.ownerPassword,t.allowedFlags).wait(t=>{t&&this.logger.info("DocumentManagerPlugin","SetDocumentEncryption",`Encryption set successfully on document ${e}`),n.resolve(t)},t=>{this.logger.error("DocumentManagerPlugin","SetDocumentEncryption",`Failed to set encryption on document ${e}`,t),n.fail(t)}),n}unlockOwnerPermissions(e,t){const n=new kt,o=this.coreState.core.documents[e];if(!(null==o?void 0:o.document))return n.reject({code:sn.DocNotOpen,message:`Document ${e} is not open`}),n;const i=o.document;this.logger.info("DocumentManagerPlugin","UnlockOwnerPermissions",`Attempting to unlock owner permissions on document ${e}`);return this.engine.unlockOwnerPermissions(i,t).wait(t=>{if(t){this.logger.info("DocumentManagerPlugin","UnlockOwnerPermissions",`Owner permissions unlocked on document ${e}`);const t=4294967295;this.dispatchCoreAction(((e,t,n)=>({type:io,payload:{documentId:e,permissions:t,isOwnerUnlocked:n}}))(e,t,!0))}n.resolve(t)},t=>{this.logger.error("DocumentManagerPlugin","UnlockOwnerPermissions",`Failed to unlock owner permissions on document ${e}`,t),n.fail(t)}),n}removeEncryption(e){const t=new kt,n=this.coreState.core.documents[e];if(!(null==n?void 0:n.document))return t.reject({code:sn.DocNotOpen,message:`Document ${e} is not open`}),t;this.logger.info("DocumentManagerPlugin","RemoveEncryption",`Marking document ${e} for encryption removal on save`);return this.engine.removeEncryption(n.document).wait(n=>{n&&this.logger.info("DocumentManagerPlugin","RemoveEncryption",`Document ${e} marked for encryption removal`),t.resolve(n)},n=>{this.logger.error("DocumentManagerPlugin","RemoveEncryption",`Failed to mark document ${e} for encryption removal`,n),t.fail(n)}),t}checkDocumentLimit(){return this.maxDocuments&&Object.keys(this.coreState.core.documents).length>=this.maxDocuments?{code:sn.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:sn.Unknown,message:`Document ${e} is already loaded successfully`}}:"error"!==t.status?{valid:!1,error:{code:sn.Unknown,message:`Document ${e} is not in error state (current state: ${t.status})`}}:this.loadOptions.has(e)?{valid:!0}:{valid:!1,error:{code:sn.Unknown,message:`No retry information available for document ${e}`}}:{valid:!1,error:{code:sn.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,normalizeRotation:!0})}handleLoadTask(e,t,n){t.wait(t=>{this.dispatchCoreAction(((e,t)=>({type:Yn,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:Qn,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();if(!n)return;let o=decodeURIComponent(n);return o.toLowerCase().endsWith(".pdf")||(o+=".pdf"),o}catch{return}}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()}};ka.id="document-manager";let Ca=ka;const Ia="document-manager";function Sa({documentId:e,children:t}){const n=Go(e);if(!n)return null;return Be(B,{children:t({documentState:n,isLoading:"loading"===n.status,isError:"error"===n.status,isLoaded:"loaded"===n.status})})}const Aa=()=>Wo(Ca.id);const Ma=Fo({manifest:{id:Ia,name:"Document Manager Plugin",version:"1.0.0",provides:["document-manager"],requires:[],optional:[],defaultConfig:{maxDocuments:10}},create:(e,t)=>new Ca(Ia,e,t),reducer:e=>e,initialState:{}}).addUtility(function(){const{plugin:e}=Bo(Ca.id),{provides:t}=Aa(),n=Pe(null),o=Pe(null),i=Pe(void 0);return Me(()=>{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]),Be("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(),Da="commands",Pa={id:Da,name:"Commands Plugin",version:"1.0.0",provides:["commands"],requires:[],optional:["i18n","ui"],defaultConfig:{commands:{}}},Ta="COMMANDS/SET_DISABLED_CATEGORIES",Ra=e=>({type:Ta,payload:e}),za=class extends So{constructor(e,t,n){var o;super(e,t),this.commands=new Map,this.i18n=null,this.shortcutMap=new Map,this.commandExecuted$=Oo(),this.commandStateChanged$=Oo(),this.shortcutExecuted$=Oo(),this.categoryChanged$=No(),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(Ra(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(Ra(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(Ra(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(Ra(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,logger:this.logger})}}resolveLabel(e,t,n){const o=this.resolveDynamic(e.labelKey,t,n);if(o&&this.i18n){const i=this.resolveDynamic(e.labelParams,t,n);return this.i18n.t(o,{params:i,documentId:n})}return e.label?e.label:e.id}resolveDynamic(e,t,n){if(void 0!==e)return"function"==typeof e?e({registry:this.registry,state:t,documentId:n,logger:this.logger}):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=t.core.documents[e];if(!n||"loaded"!==n.status)return;const o=this.previousStates.get(e)??new Map;this.commands.forEach((t,n)=>{const i=this.resolve(n,e),r=o.get(n);if(!r)return void o.set(n,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),r.icon!==i.icon&&(a.icon=i.icon),To(r.iconProps,i.iconProps)||(a.iconProps=i.iconProps),Object.keys(a).length>0&&(o.set(n,i),this.commandStateChanged$.emit({commandId:n,documentId:e,changes:a}))}),this.previousStates.set(e,o)}};za.id="commands";let Ea=za;const Oa={disabledCategories:[]},Na=()=>Wo(Ea.id),La=(e,t)=>{const{provides:n}=Na(),[o,i]=Se(()=>n?n.resolve(e,t):null);return Me(()=>{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 _a=Fo({manifest:Pa,create:(e,t)=>new Ea(Da,e,t),reducer:(e=Oa,t)=>t.type===Ta?{...e,disabledCategories:t.payload}:e,initialState:Oa}).addUtility(function(){const{provides:e}=Na();return Me(()=>{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)&&"Tab"!==t.key)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");let n=e.key.toLowerCase();return" "===n&&(n="space"),["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(),Fa="i18n",$a={id:Fa,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"}}}]}},ja="I18N/SET_LOCALE",Ua="I18N/REGISTER_LOCALE",Ba=e=>({type:ja,payload:e}),Wa=e=>({type:Ua,payload:e}),Ha=class extends So{constructor(e,t,n){super(e,t),this.locales=new Map,this.paramResolvers=new Map,this.paramsCache=new Map,this.localeChange$=Oo(),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(Wa(e.code))}),n.paramResolvers&&Object.entries(n.paramResolvers).forEach(([e,t])=>{this.paramResolvers.set(e,t)}),this.dispatch(Ba(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});To(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(Ba(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(Wa(e.code)),this.logger.info("I18nPlugin","LocaleRegistered",`Locale registered: ${e.code}`))}};Ha.id="i18n";let Ga=Ha;const qa={currentLocale:"en",availableLocales:[]},Va={manifest:$a,create:(e,t)=>new Ga(Fa,e,t),reducer:(e=qa,t)=>{switch(t.type){case ja:{const n=t.payload;return e.availableLocales.includes(n)?{...e,currentLocale:n}:(console.warn(`I18nPlugin: Locale '${n}' not available`),e)}case Ua:{const n=t.payload;return e.availableLocales.includes(n)?e:{...e,availableLocales:[...e.availableLocales,n]}}default:return e}},initialState:qa},Ka=e=>{const{provides:t}=Wo(Ga.id),[,n]=Ae(e=>e+1,0),o=Re((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 Me(()=>{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 Za=(e=>(e.Automatic="automatic",e.FitPage="fit-page",e.FitWidth="fit-width",e))(Za||{}),Xa=(e=>(e[e.Center=0]="Center",e[e.Top=1]="Top",e))(Xa||{});const Ya="zoom",Qa={id:Ya,name:"Zoom Plugin",version:"1.0.0",provides:["zoom"],requires:["viewport","scroll"],optional:["interaction-manager","spread"],defaultConfig:{defaultZoomLevel:Za.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:Za.FitPage},{name:"Fit Width",value:Za.FitWidth},{name:"Automatic",value:Za.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}]}},Ja="ZOOM/INIT_STATE",es="ZOOM/CLEANUP_STATE",ts="ZOOM/SET_ZOOM_LEVEL",ns="ZOOM/SET_MARQUEE_ZOOM_ACTIVE";const os={zoomLevel:Za.Automatic,currentZoomLevel:1,isMarqueeZoomActive:!1},is={documents:{},activeDocumentId:null};const rs=class extends So{constructor(e,t,n){var o,i,r;super(e,t),this.zoom$=Oo(),this.state$=No(),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,Xa.Top),{mode:"debounce",wait:150,keyExtractor:e=>e.documentId}),null==(o=this.spread)||o.onSpreadChange(e=>{this.recalcAuto(e.documentId,Xa.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:ns,payload:{documentId:o,isActive:t}}))})}onDocumentLoadingStarted(e){this.viewport.gate("zoom",e);const t={...os,zoomLevel:this.defaultZoomLevel};this.dispatch(function(e,t){return{type:Ja,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("ZoomPlugin","DocumentOpened",`Initialized zoom state for document: ${e}`)}onDocumentLoaded(e){this.recalcAuto(e,Xa.Top)}onDocumentClosed(e){this.dispatch(function(e){return{type:es,payload:e}}(e)),this.logger.debug("ZoomPlugin","DocumentClosed",`Cleaned up zoom state for document: ${e}`)}onRotationChanged(e){this.recalcAuto(e,Xa.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=Xa.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=Po(u+t,this.minZoom,this.maxZoom),m=Math.floor(1e3*h)/1e3,g=n??{vx:c.clientWidth/2,vy:o===Xa.Top?0:c.clientHeight/2},{desiredScrollLeft:p,desiredScrollTop:f}=this.computeScrollForZoomChange(a,c,d,m,g,i);isNaN(p)||isNaN(f)||this.viewportPlugin.setViewportScrollMetrics(a,{scrollLeft:p,scrollTop:f}),this.dispatch(function(e,t,n){return{type:ts,payload:{documentId:e,zoomLevel:t,currentZoomLevel:n}}}(a,"number"==typeof e?m:e,m)),this.dispatchCoreAction(((e,t)=>({type:ao,payload:{scale:e,documentId:t}}))(m,a)),this.viewport.isGated(a)&&this.viewport.releaseGate("zoom",a),l.scrollTo({x:p,y:f,behavior:"instant"});const v={documentId:a,oldZoom:d,newZoom:m,level:e,center:g,desiredScrollLeft:p,desiredScrollTop:f,viewport:c};this.zoom$.emit(v)}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 Za.FitWidth:return s/c;case Za.FitPage:return Math.min(s/c,l/d);case Za.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),f=h(u,c,o),v=(t.scrollLeft+i.vx-s-m)/n*o+s+p,y=(t.scrollTop+i.vy-s-g)/n*o+s+f,b="center"===r?v-t.clientWidth/2:v-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=tt({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,f=u.y+h.y,v=p+m.origin.x+m.size.width/2,y=f+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),k=a+w+v*s-r.scrollLeft,C=a+x+y*s-r.scrollTop;this.handleRequest({level:g,center:{vx:k,vy:C},align:"center"},e)}recalcAuto(e,t){const n=this.getDocumentState(e);n&&(n.zoomLevel!==Za.Automatic&&n.zoomLevel!==Za.FitPage&&n.zoomLevel!==Za.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(Po(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=Po(e.x,0,t.width),o=Po(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()}};rs.id="zoom";let as=rs;const ss={manifest:Qa,create:(e,t)=>new as(Ya,e,t),reducer:(e=is,t)=>{switch(t.type){case Ja:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case es:{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 ts:{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 ns:{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:is},ls=()=>Wo(as.id);function cs(e){const[t,n]=[e[0],e[1]],o=n.clientX-t.clientX,i=n.clientY-t.clientY;return Math.hypot(o,i)}function ds(e,t={}){const{provides:n}=Wo("viewport"),{provides:o}=ls(),i=ze(vi),r=Pe(null);return De(()=>{const a=r.current,s=null==i?void 0:i.current;if(a&&s&&o)return function({element:e,container:t,documentId:n,zoomProvides:o,viewportGap:i=0,options:r={}}){const{enablePinch:a=!0,enableWheel:s=!0}=r;if("undefined"==typeof window)return()=>{};const l=o.forDocument(n),c=()=>l.getState();let d=0,u=1,h=!1,m=0,g=null,p=1,f=0,v=0,y=0,b=0,w=0,x=0,k=0,C=0,I=0,S=0,A=0,M=0,D=0;const P=(e,t,n)=>Math.min(Math.max(e,t),n),T=()=>{const n=t.clientWidth-2*i,o=e.offsetWidth,r=o<n?(n-o)/2:0;e.style.marginLeft=`${r}px`},R=e=>{const t=f*e,n=v*e;let o=I*(1-e);const i=C-t/2-y,r=S-D*e-y,a=Math.max(0,t-k),s=.3*k,l=Math.min(1,a/s);let c=i+(r-i)*l;return n>x-2*M&&(o=P(b+o,x-M-n,M)-b),t>w-2*M&&(c=P(y+c,w-M-t,M)-y),{tx:c,ty:o,blend:l,finalWidth:t}},z=t=>{u=t;const{tx:n,ty:o}=R(t);e.style.transformOrigin="0 0",e.style.transform=`translate(${n}px, ${o}px) scale(${t})`},E=()=>{e.style.transform="none",e.style.transformOrigin="0 0",u=1},O=()=>{const{tx:e,finalWidth:t}=R(u),n=(u-1)*d;let o,i=A;if(t<=k)o=C;else{const t=1-u;o=Math.abs(t)>.001?y+e/t:S}l.requestZoomBy(n,{vx:o,vy:i}),E(),d=0},N=(n,o)=>{const r=t.getBoundingClientRect(),a=e.getBoundingClientRect();M=i,f=a.width,v=a.height,y=a.left-r.left,b=a.top-r.top,w=r.width,x=r.height,k=t.clientWidth,C=t.clientLeft+k/2;const s=n-a.left;I=o-a.top,S=n-r.left,A=o-r.top,D=f<k?S*f/k:s},L=e=>{if(2!==e.touches.length)return;h=!0,d=c().currentZoomLevel,m=cs(e.touches);const t=function(e){const[t,n]=[e[0],e[1]];return{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}(e.touches);N(t.x,t.y),e.preventDefault()},_=e=>{if(!h||2!==e.touches.length)return;const t=cs(e.touches);z(t/m),e.preventDefault()},F=e=>{h&&(e.touches.length>=2||(h=!1,O()))},$=e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),null===g?(d=c().currentZoomLevel,p=1,N(e.clientX,e.clientY)):clearTimeout(g);const t=1-.01*e.deltaY;p*=t,p=Math.max(.1,Math.min(10,p)),z(p),g=setTimeout(()=>{g=null,O(),p=1},150)},j=l.onStateChange(()=>T()),U=new ResizeObserver(()=>T());return U.observe(e),U.observe(t),T(),a&&(t.addEventListener("touchstart",L,{passive:!1}),t.addEventListener("touchmove",_,{passive:!1}),t.addEventListener("touchend",F),t.addEventListener("touchcancel",F)),s&&t.addEventListener("wheel",$,{passive:!1}),()=>{a&&(t.removeEventListener("touchstart",L),t.removeEventListener("touchmove",_),t.removeEventListener("touchend",F),t.removeEventListener("touchcancel",F)),s&&t.removeEventListener("wheel",$),g&&clearTimeout(g),j(),U.disconnect(),E(),e.style.marginLeft=""}}({element:a,container:s,documentId:e,zoomProvides:o,viewportGap:(null==n?void 0:n.getViewportGap())||0,options:t})},[n,o,e,i,t.enablePinch,t.enableWheel]),{elementRef:r}}function us({children:e,documentId:t,style:n,enablePinch:o=!0,enableWheel:i=!0,...r}){const a=Te(()=>({enablePinch:o,enableWheel:i}),[o,i]),{elementRef:s}=ds(t,a);return Be("div",{ref:s,...r,style:{...n,display:"inline-block",overflow:"visible",boxSizing:"border-box"},children:e})}const hs=({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}=ls(),s=Go(e),[l,c]=Se(null),d=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Me(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?Be("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},ms=class extends So{constructor(e,t,n){super(e,t),this.config=n}buildCapability(){return{renderPage:e=>this.renderPage(e),renderPageRect:e=>this.renderPageRect(e),renderPageRaw:e=>this.renderPageRaw(e),renderPageRectRaw:e=>this.renderPageRectRaw(e),forDocument:e=>this.createRenderScope(e)}}createRenderScope(e){return{renderPage:t=>this.renderPage(t,e),renderPageRect:t=>this.renderPageRect(t,e),renderPageRaw:t=>this.renderPageRaw(t,e),renderPageRectRaw:t=>this.renderPageRectRaw(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)}renderPageRaw({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};return this.engine.renderPageRaw(i.document,r,a)}renderPageRectRaw({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};return this.engine.renderPageRectRaw(r.document,a,t,s)}async initialize(e){this.logger.info("RenderPlugin","Initialize","Render plugin initialized")}async destroy(){super.destroy()}};ms.id="render";let gs=ms;const ps="render",fs={manifest:{id:ps,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new gs(ps,e,t),reducer:()=>{},initialState:{}};function vs({documentId:e,pageIndex:t,scale:n,dpr:o,style:i,...r}){const{provides:a}=Wo(gs.id),s=Go(e),[l,c]=Se(null),d=Pe(null),u=Te(()=>s&&s.pageRefreshVersions[t]||0,[s,t]),h=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),m=Te(()=>void 0!==o?o:window.devicePixelRatio,[o]);Me(()=>{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},Bn),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):n.abort({code:sn.Cancelled,message:"canceled render task"})}},[e,t,h,m,a,u]);return Be(B,{children:l&&Be("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...r,style:{width:"100%",height:"100%",...i||{}}})})}const ys="rotate",bs={id:ys,name:"Rotate Plugin",version:"1.0.0",provides:["rotate"],requires:[],optional:[],defaultConfig:{}};const ws="ROTATE/INIT_STATE",xs="ROTATE/CLEANUP_STATE",ks="ROTATE/SET_ROTATION";const Cs=class extends So{constructor(e,t,n){super(e,t),this.rotate$=No(),this.defaultRotation=n.defaultRotation??0}onDocumentLoadingStarted(e){const t={rotation:this.defaultRotation};this.dispatch(function(e,t){return{type:ws,payload:{documentId:e,state:t}}}(e,t)),this.dispatchCoreAction(mo(this.defaultRotation,e)),this.logger.debug("RotatePlugin","DocumentOpened",`Initialized rotation state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:xs,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:ks,payload:{documentId:e,rotation:t}}}(n,e)),this.dispatchCoreAction(mo(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()}};Cs.id="rotate";let Is=Cs;const Ss={documents:{},activeDocumentId:null},As={manifest:bs,create:(e,t)=>new Is(ys,e,t),reducer:(e=Ss,t)=>{switch(t.type){case ws:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case xs:{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 ks:{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:Ss};function Ms({children:e,documentId:t,pageIndex:n,rotation:o,scale:i,style:r,...a}){var s,l,c,d;const{plugin:u}=Bo(Is.id),h=Go(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,f=(null==m?void 0:m.rotation)??0,v=(null==h?void 0:h.rotation)??0,y=void 0!==o?o:(f+v)%4,b=i??(null==h?void 0:h.scale)??1,w=(null==u?void 0:u.getMatrixAsString({width:g*b,height:p*b,rotation:y}))??"matrix(1, 0, 0, 1, 0, 0)";return m?Be("div",{...a,style:{position:"absolute",transformOrigin:"0 0",transform:w,...r},children:e}):null}const Ds="SEARCH/INIT_STATE",Ps="SEARCH/CLEANUP_STATE",Ts="SEARCH/START_SEARCH_SESSION",Rs="SEARCH/STOP_SEARCH_SESSION",zs="SEARCH/SET_SEARCH_FLAGS",Es="SEARCH/SET_SHOW_ALL_RESULTS",Os="SEARCH/START_SEARCH",Ns="SEARCH/SET_SEARCH_RESULTS",Ls="SEARCH/APPEND_SEARCH_RESULTS",_s="SEARCH/SET_ACTIVE_RESULT_INDEX";function Fs(e,t){return{type:Es,payload:{documentId:e,showAll:t}}}function $s(e,t,n,o){return{type:Ns,payload:{documentId:e,results:t,total:n,activeResultIndex:o}}}function js(e,t){return{type:_s,payload:{documentId:e,index:t}}}const Us={flags:[],results:[],total:0,activeResultIndex:-1,showAllResults:!0,query:"",loading:!1,active:!1},Bs={documents:{}},Ws=(e,t,n)=>{const o=e.documents[t]||Us;return{...e,documents:{...e.documents,[t]:{...o,...n}}}},Hs=class extends So{constructor(e,t,n){super(e,t),this.searchStop$=No(),this.searchStart$=No(),this.searchResult$=No(),this.searchActiveResultChange$=No(),this.searchResultState$=No(),this.searchState$=No(),this.currentTask=new Map,this.pluginConfig=n}onDocumentLoadingStarted(e){const t={...Us,flags:this.pluginConfig.flags||[],showAllResults:this.pluginConfig.showAllResults??!0};this.dispatch(function(e,t){return{type:Ds,payload:{documentId:e,state:t}}}(e,t))}onDocumentClosed(e){this.stopSearchSession(e),this.dispatch(function(e){return{type:Ps,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(Fs(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(Fs(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:zs,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:Ts,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:sn.Cancelled,message:"search stopped"})}catch{}this.currentTask.delete(e)}this.dispatch(function(e){return{type:Rs,payload:{documentId:e}}}(e)),this.notifySearchStop(e)}searchAllPages(e,t,n=!1){var o;const i=this.state.documents[t];if(!i)return ln.reject({code:sn.NotFound,message:"Search state not initialized"});const r=this.getCoreDocument(t);if(!(null==r?void 0:r.document))return ln.reject({code:sn.NotFound,message:"Document not loaded"});const a=e.trim();if(i.query===a&&!n)return ln.resolve({results:i.results,total:i.total});const s=this.currentTask.get(t);if(s){try{null==(o=s.abort)||o.call(s,{code:sn.Cancelled,message:"new search"})}catch{}this.currentTask.delete(t)}if(this.dispatch(function(e,t){return{type:Os,payload:{documentId:e,query:t}}}(t,a)),!a)return this.dispatch($s(t,[],0,-1)),ln.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:Ls,payload:{documentId:e,results:t}}}(t,e.results)),-1===this.state.documents[t].activeResultIndex&&(this.dispatch(js(t,0)),this.notifyActiveResultChange(t,0)))}),l.wait(e=>{this.currentTask.delete(t);const n=e.total>0?0:-1;this.dispatch($s(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)!==sn.Cancelled&&(console.error("Error during search:",e),this.dispatch($s(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(js(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()}};Hs.id="search";let Gs=Hs;const qs="search",Vs={manifest:{id:qs,name:"Search Plugin",version:"1.0.0",provides:["search"],requires:[],optional:[],defaultConfig:{flags:[]}},create:(e,t)=>new Gs(qs,e,t),reducer:(e=Bs,t)=>{switch(t.type){case Ds:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case Ps:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Ts:return Ws(e,t.payload.documentId,{active:!0});case Rs:return Ws(e,t.payload.documentId,{results:[],total:0,activeResultIndex:-1,query:"",loading:!1,active:!1});case zs:return Ws(e,t.payload.documentId,{flags:t.payload.flags});case Es:return Ws(e,t.payload.documentId,{showAllResults:t.payload.showAll});case Os:return Ws(e,t.payload.documentId,{loading:!0,query:t.payload.query,results:[],total:0,activeResultIndex:-1});case Ls:{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 Ws(e,n,{results:r,total:r.length,activeResultIndex:a,loading:!0})}case Ns:{const{documentId:n,results:o,total:i,activeResultIndex:r}=t.payload;return Ws(e,n,{results:o,total:i,activeResultIndex:r,loading:!1})}case _s:return Ws(e,t.payload.documentId,{activeResultIndex:t.payload.index});default:return e}},initialState:Bs},Ks=()=>Wo(Gs.id);function Zs({documentId:e,pageIndex:t,scale:n,style:o,highlightColor:i="#FFFF00",activeHighlightColor:r="#FFBF00",...a}){const{provides:s}=Ks(),[l,c]=Se(null),d=Go(e),u=Te(()=>null==s?void 0:s.forDocument(e),[s,e]),h=Te(()=>void 0!==n?n:(null==d?void 0:d.scale)??1,[n,null==d?void 0:d.scale]);if(Me(()=>{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 Be("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)=>Be("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 Xs="selection",Ys={id:Xs,name:"Selection Plugin",version:"1.0.0",provides:["selection"],requires:["interaction-manager"],optional:["viewport","scroll"],defaultConfig:{menuHeight:40}},Qs="SELECTION/INIT_STATE",Js="SELECTION/CLEANUP_STATE",el="SELECTION/CACHE_PAGE_GEOMETRY",tl="SELECTION/SET_SELECTION",nl="SELECTION/START_SELECTION",ol="SELECTION/END_SELECTION",il="SELECTION/CLEAR_SELECTION",rl="SELECTION/SET_RECTS",al="SELECTION/SET_SLICES",sl="SELECTION/EVICT_PAGE_GEOMETRY",ll=(e,t)=>({type:tl,payload:{documentId:e,selection:t}}),cl=e=>({type:nl,payload:{documentId:e}}),dl=e=>({type:ol,payload:{documentId:e}}),ul=(e,t)=>({type:rl,payload:{documentId:e,rects:t}}),hl=(e,t)=>({type:al,payload:{documentId:e,slices:t}}),ml={geometry:{},rects:{},slices:{},selection:null,active:!1,selecting:!1},gl={documents:{}},pl=(e,t,n)=>({...e,documents:{...e.documents,[t]:n}});function fl(e,t){return e.rects[t]??[]}function vl(e,t){return rt(fl(e,t))}function yl(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 bl(e,t){const n=e.rects[t]||[];if(0===n.length)return null;const o=vl(e,t);return o?{pageIndex:t,rect:o,segmentRects:n}:null}function wl(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=vl(e,o);i&&t.push({pageIndex:o,rect:i,segmentRects:n})}return t}function xl(e,t,n=1.5){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=>{const n=e.tightX??e.x,o=e.tightY??e.y,i=e.tightWidth??e.width,r=e.tightHeight??e.height;return t.x>=n&&t.x<=n+i&&t.y>=o&&t.y<=o+r});if(-1!==e)return n.charStart+e}if(n<=0)return-1;const o=function(e,t){let n=0,o=0;for(const t of e.runs)for(const e of t.glyphs)2!==e.flags&&(n+=e.height,o++);return 0===o?0:n/o*t}(e,n),i=o/2;let r=-1,a=1/0;for(const n of e.runs)if(!(t.y<n.rect.y-i||t.y>n.rect.y+n.rect.height+i||t.x<n.rect.x-i||t.x>n.rect.x+n.rect.width+i))for(let e=0;e<n.glyphs.length;e++){const o=n.glyphs[e];if(2===o.flags)continue;const s=o.tightX??o.x,l=o.tightY??o.y,c=o.tightWidth??o.width,d=o.tightHeight??o.height,u=s-i,h=s+c+i,m=l-i,g=l+d+i;if(t.x<u||t.x>h||t.y<m||t.y>g)continue;const p=Math.min(Math.abs(t.x-s),Math.abs(t.x-(s+c)))+Math.min(Math.abs(t.y-l),Math.abs(t.y-(l+d)));p<a&&(a=p,r=n.charStart+e)}return r}function kl(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 Cl(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,m=0,g=-1/0;const p=()=>{l!==1/0&&h>0&&i.push({rect:{origin:{x:l,y:d},size:{width:c-l,height:u-d}},charCount:h,fontSize:o.fontSize}),l=1/0,c=-1/0,d=1/0,u=-1/0,h=0,m=0,g=-1/0};for(let e=a;e<=s;e++){const t=o.glyphs[e];if(2!==t.flags){if(h>0&&g>-1/0){const e=Math.abs(t.x-g),n=m/h;n>0&&e>2.5*n&&p()}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++,m+=t.width,g=t.x+t.width}}p()}return o?function(e){const t=[];let n=null,o=null;for(const i of e)n&&o?Ml(n,i)?o=Il(o,i.rect):(t.push(o),o=i.rect):o=i.rect,n=i;o&&!Sl(o)&&t.push(o);return t}(i):i.map(e=>e.rect)}function Il(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 Sl(e){return e.size.width<=0||e.size.height<=0}function Al(e,t){if(Sl(e)||Sl(t))return 0;const n=Il(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 Ml(e,t){if(null!=e.fontSize&&null!=t.fontSize&&e.fontSize>0&&t.fontSize>0){if(Math.max(e.fontSize,t.fontSize)/Math.min(e.fontSize,t.fontSize)>1.5)return!1}const n=e.rect,o=t.rect;if(Al(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}function Dl(e,t){for(let n=0;n<e.runs.length;n++){const o=e.runs[n],i=t-o.charStart;if(i>=0&&i<o.glyphs.length)return{runIdx:n,localIdx:i}}return null}function Pl(e){return 1===e||2===e}function Tl(e){return 0===e.rect.width&&0===e.rect.height}function Rl(e,t,n,o){const i=Math.max(t,o)-Math.min(e,n),r=Math.max(0,Math.min(t,o)-Math.max(e,n));return 0!==i&&r/i>=.5}const zl=class extends So{constructor(e,t,n){var o,i,r;super(e,t),this.enabledModesPerDoc=new Map,this.selecting=new Map,this.anchor=new Map,this.hasTextAnchor=new Map,this.marqueePage=new Map,this.pageCallbacks=new Map,this.geoAccessOrder=new Map,this.menuPlacement$=Lo((e,t)=>({documentId:e,placement:t})),this.selChange$=Lo((e,t)=>({documentId:e,selection:t,modeId:this.interactionManagerCapability.forDocument(e).getActiveMode()})),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,modeId:t.modeId}),{cache:!1}),this.endSelection$=Lo((e,t)=>({documentId:e,modeId:t.modeId}),{cache:!1}),this.marqueeChange$=Lo((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}),{cache:!1}),this.marqueeEnd$=Lo((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}),{cache:!1}),this.emptySpaceClick$=Lo((e,t)=>({documentId:e,pageIndex:t.pageIndex,modeId:t.modeId}),{cache:!1}),this.viewportCapability=null,this.scrollCapability=null,this.config=n,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(ro,e=>{const{documentId:t,pageIndexes:n}=e.payload,o=n.map(e=>this.getNewPageGeometryAndCache(t,e));kt.all(o).wait(()=>{n.forEach(e=>{this.notifyPage(t,e)})},Bn)}),null==(r=this.viewportCapability)||r.onViewportChange(e=>{this.recalculateMenuPlacement(e.documentId)},{mode:"throttle",wait:100})}onDocumentLoadingStarted(e){var t;this.dispatch(((e,t)=>({type:Qs,payload:{documentId:e,state:t}}))(e,ml));const n=!1!==(null==(t=this.config.marquee)?void 0:t.enabled);this.enabledModesPerDoc.set(e,new Map([["pointerMode",{enableSelection:!0,showSelectionRects:!0,enableMarquee:n,showMarqueeRects:!0}]])),this.pageCallbacks.set(e,new Map),this.geoAccessOrder.set(e,[]),this.selecting.set(e,!1),this.anchor.set(e,void 0),this.hasTextAnchor.set(e,!1)}onDocumentClosed(e){this.dispatch((e=>({type:Js,payload:e}))(e)),this.enabledModesPerDoc.delete(e),this.pageCallbacks.delete(e),this.geoAccessOrder.delete(e),this.selecting.delete(e),this.hasTextAnchor.delete(e),this.anchor.delete(e),this.marqueePage.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),this.marqueeChange$.clearScope(e),this.marqueeEnd$.clearScope(e),this.emptySpaceClick$.clearScope(e)}async initialize(){}async destroy(){this.selChange$.clear(),this.textRetrieved$.clear(),this.copyToClipboard$.clear(),this.beginSelection$.clear(),this.endSelection$.clear(),this.menuPlacement$.clear(),this.marqueeChange$.clear(),this.marqueeEnd$.clear(),this.emptySpaceClick$.clear(),super.destroy()}buildCapability(){const e=e=>e??this.getActiveDocumentId();return{getFormattedSelection:t=>wl(this.getDocumentState(e(t))),getFormattedSelectionForPage:(t,n)=>bl(this.getDocumentState(e(n)),t),getHighlightRectsForPage:(t,n)=>fl(this.getDocumentState(e(n)),t),getHighlightRects:t=>this.getDocumentState(e(t)).rects,getBoundingRectForPage:(t,n)=>vl(this.getDocumentState(e(n)),t),getBoundingRects:t=>yl(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,o)=>{var i;return null==(i=this.enabledModesPerDoc.get(e(o)))?void 0:i.set(t,{...n})},isEnabledForMode:(t,n)=>{var o;return(null==(o=this.enabledModesPerDoc.get(e(n)))?void 0:o.has(t))??!1},setMarqueeEnabled:(t,n)=>this.setMarqueeEnabled(e(n),t),isMarqueeEnabled:t=>this.isMarqueeEnabled(e(t)),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,onMarqueeChange:this.marqueeChange$.onGlobal,onMarqueeEnd:this.marqueeEnd$.onGlobal,onEmptySpaceClick:this.emptySpaceClick$.onGlobal}}createSelectionScope(e){return{getFormattedSelection:()=>wl(this.getDocumentState(e)),getFormattedSelectionForPage:t=>bl(this.getDocumentState(e),t),getHighlightRectsForPage:t=>fl(this.getDocumentState(e),t),getHighlightRects:()=>this.getDocumentState(e).rects,getBoundingRectForPage:t=>vl(this.getDocumentState(e),t),getBoundingRects:()=>yl(this.getDocumentState(e)),getSelectedText:()=>this.getSelectedText(e),clear:()=>this.clearSelection(e),copyToClipboard:()=>this.copyToClipboard(e),getState:()=>this.getDocumentState(e),setMarqueeEnabled:t=>this.setMarqueeEnabled(e,t),isMarqueeEnabled:()=>this.isMarqueeEnabled(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),onMarqueeChange:this.marqueeChange$.forScope(e),onMarqueeEnd:this.marqueeEnd$.forScope(e),onEmptySpaceClick:this.emptySpaceClick$.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:fl(r,o),boundingRect:vl(r,o)}),a.wait(e=>{const t=this.getDocumentState(n),i=t.selection;if(!i||o<i.start.page||o>i.end.page)return;const r=kl(i,e,o);if(!r)return;const a=Cl(e,r.from,r.to);this.dispatch(ul(n,{...t.rects,[o]:a})),this.dispatch(hl(n,{...t.slices,[o]:{start:r.from,count:r.to-r.from+1}})),this.notifyPage(n,o)},Bn);const c=function(e){const t=e.minDragDistance??3,n=e.toleranceFactor??1.5;let o=null,i=null,r=!1,a=0;function s(){var t;o=null,i=null,r=!1,null==(t=e.setHasTextAnchor)||t.call(e,!1)}return{onPointerDown:(t,s,l)=>{var c,d;if(s.target===s.currentTarget&&(null==(c=e.onEmptySpaceClick)||c.call(e,l)),!e.isEnabled(l))return;const u=Date.now();(0===a||u-a>=500)&&e.onClear(l);const h=e.getGeometry();if(!h)return;const m=xl(h,t,n);-1!==m&&(o=m,i=t,r=!1,null==(d=e.setHasTextAnchor)||d.call(e,!0))},onPointerMove:(a,s,l)=>{if(!e.isEnabled(l))return;const c=e.getGeometry();if(!c)return;const d=xl(c,a,n);if(e.setCursor(-1!==d?"text":null),null!==o&&i&&!r){const n=a.x-i.x,s=a.y-i.y;return void(Math.sqrt(n*n+s*s)>=t&&(r=!0,e.onBegin(o,l),-1!==d&&e.onUpdate(d,l)))}e.isSelecting()&&-1!==d&&e.onUpdate(d,l)},onPointerUp:(t,n,o)=>{e.isEnabled(o)?(r&&e.onEnd(o),s()):s()},onDoubleClick:(t,o,i)=>{var r;if(!e.isEnabled(i))return;const s=e.getGeometry();if(!s)return;const l=xl(s,t,n);-1!==l&&(a=Date.now(),null==(r=e.onWordSelect)||r.call(e,l,i))},onClick:(t,o,i)=>{var r;if(!e.isEnabled(i))return;if(0===a)return;if(Date.now()-a>500)return void(a=0);a=0;const s=e.getGeometry();if(!s)return;const l=xl(s,t,n);-1!==l&&(null==(r=e.onLineSelect)||r.call(e,l,i))},onHandlerActiveEnd:t=>{s(),e.isEnabled(t)&&e.onClear(t)}}}({getGeometry:()=>this.getDocumentState(n).geometry[o],isEnabled:e=>{const t=null==l?void 0:l.get(e);return!!t&&!1!==t.enableSelection},onBegin:(e,t)=>this.beginSelection(n,o,e,t),onUpdate:(e,t)=>this.updateSelection(n,o,e,t),onEnd:e=>this.endSelection(n,e),onClear:e=>this.clearSelection(n,e),isSelecting:()=>this.selecting.get(n)??!1,setCursor:e=>e?s.setCursor("selection-text",e,10):s.removeCursor("selection-text"),onEmptySpaceClick:e=>this.emptySpaceClick$.emit(n,{pageIndex:o,modeId:e}),onWordSelect:(e,t)=>this.selectWord(n,o,e,t),onLineSelect:(e,t)=>this.selectLine(n,o,e,t),setHasTextAnchor:e=>this.hasTextAnchor.set(n,e),minDragDistance:this.config.minSelectionDragDistance,toleranceFactor:this.config.toleranceFactor}),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:sn.Cancelled,message:"Cleanup"})}}registerMarqueeOnPage(e){var t;const{documentId:n,pageIndex:o,scale:i,onRectChange:r}=e;if(!this.state.documents[n])return this.logger.warn("SelectionPlugin","RegisterMarqueeFailed",`Cannot register marquee on page ${o} for document ${n}: document state not initialized.`),()=>{};const a=this.coreState.core.documents[n];if(!a||!a.document)return this.logger.warn("SelectionPlugin","DocumentNotFound",`Cannot register marquee on page ${o}: document not found`),()=>{};const s=a.document.pages[o];if(!s)return this.logger.warn("SelectionPlugin","PageNotFound",`Cannot register marquee on page ${o}: page not found`),()=>{};const l=s.size,c=(null==(t=this.config.marquee)?void 0:t.minDragPx)??5,d=()=>{var e;const t=this.interactionManagerCapability.forDocument(n).getActiveMode(),o=null==(e=this.enabledModesPerDoc.get(n))?void 0:e.get(t);return!1!==(null==o?void 0:o.showMarqueeRects)},u=function(e){const{pageSize:t,scale:n,minDragPx:o=5}=e;let i=null,r=null;return{onPointerDown:(t,n,o)=>{var a,s;e.isEnabled(o)&&((null==(a=e.isTextSelecting)?void 0:a.call(e))||(i=t,r={origin:{x:t.x,y:t.y},size:{width:0,height:0}},e.onBegin(t,o),null==(s=n.setPointerCapture)||s.call(n)))},onPointerMove:(n,o,a)=>{if(!i||!e.isEnabled(a))return;const s=Po(n.x,0,t.width),l=Po(n.y,0,t.height);r={origin:{x:Math.min(i.x,s),y:Math.min(i.y,l)},size:{width:Math.abs(s-i.x),height:Math.abs(l-i.y)}},e.onChange(r,a)},onPointerUp:(t,a,s)=>{var l;e.isEnabled(s)&&(r&&i&&(Math.max(r.size.width,r.size.height)*n>o?e.onEnd(r,s):e.onCancel(s)),i=null,r=null,null==(l=a.releasePointerCapture)||l.call(a))},onPointerCancel:(t,n,o)=>{var a;e.isEnabled(o)&&(i=null,r=null,e.onCancel(o),null==(a=n.releasePointerCapture)||a.call(n))}}}({pageSize:l,scale:i,minDragPx:c,isEnabled:e=>{var t;const o=null==(t=this.enabledModesPerDoc.get(n))?void 0:t.get(e);return!0===(null==o?void 0:o.enableMarquee)},isTextSelecting:()=>(this.selecting.get(n)??!1)||(this.hasTextAnchor.get(n)??!1),onBegin:(e,t)=>this.beginMarquee(n,o,e,t),onChange:(e,t)=>{this.updateMarquee(n,o,e,t),r(d()?e:null)},onEnd:(e,t)=>{this.endMarquee(n,o,e,t),r(null)},onCancel:e=>{this.cancelMarquee(n,e),r(null)}});return this.interactionManagerCapability.registerAlways({scope:{type:"page",documentId:n,pageIndex:o},handlers:u})}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}}emitMenuPlacement(e,t){this.menuPlacement$.emit(e,t),t?this.interactionManagerCapability.claimPageActivity(e,"selection-menu",t.pageIndex):this.interactionManagerCapability.releasePageActivity(e,"selection-menu")}recalculateMenuPlacement(e){const t=this.state.documents[e];if(!t)return;if(t.selecting||null===t.selection)return void this.emitMenuPlacement(e,null);const n=yl(t);if(0===n.length)return void this.emitMenuPlacement(e,null);const o=n[n.length-1];if(!this.viewportCapability||!this.scrollCapability)return void this.emitMenuPlacement(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.emitMenuPlacement(e,{...a,suggestTop:!1,isVisible:!0}):s&&s.isTopVisible?this.emitMenuPlacement(e,{...s,suggestTop:!0,isVisible:!0}):a&&a.isBottomVisible?this.emitMenuPlacement(e,{...a,suggestTop:!1,isVisible:!0}):this.emitMenuPlacement(e,null)}notifyPage(e,t){var n,o;const i=null==(n=this.pageCallbacks.get(e))?void 0:n.get(t);if(i){const n=this.getDocumentState(e),r=this.interactionManagerCapability.forDocument(e).getActiveMode(),a=null==(o=this.enabledModesPerDoc.get(e))?void 0:o.get(r);i(a&&!1!==(a.showSelectionRects??a.showRects)?{rects:fl(n,t),boundingRect:vl(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 ln.reject({code:sn.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:el,payload:{documentId:e,page:t,geo:n}}))(e,t,n)),this.touchGeometry(e,t)},Bn),i}getOrLoadGeometry(e,t){const n=this.getDocumentState(e).geometry[t];return n?(this.touchGeometry(e,t),ln.resolve(n)):this.getNewPageGeometryAndCache(e,t)}touchGeometry(e,t){const n=this.geoAccessOrder.get(e);if(!n)return;const o=n.indexOf(t);o>-1&&n.splice(o,1),n.push(t),this.evictGeometryIfNeeded(e)}evictGeometryIfNeeded(e){const t=this.config.maxCachedGeometries??50,n=this.geoAccessOrder.get(e);if(!n||n.length<=t)return;const o=this.pageCallbacks.get(e),i=[];for(;n.length-i.length>t;){const e=n.find(e=>!i.includes(e)&&!(null==o?void 0:o.has(e)));if(void 0===e)break;i.push(e)}if(0!==i.length){for(const e of i){const t=n.indexOf(e);t>-1&&n.splice(t,1)}this.dispatch(((e,t)=>({type:sl,payload:{documentId:e,pages:t}}))(e,i))}}beginSelection(e,t,n,o){this.selecting.set(e,!0),this.anchor.set(e,{page:t,index:n}),this.dispatch(cl(e)),this.beginSelection$.emit(e,{page:t,index:n,modeId:o}),this.recalculateMenuPlacement(e)}endSelection(e,t){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch(dl(e)),this.endSelection$.emit(e,{modeId:t}),this.recalculateMenuPlacement(e)}clearSelection(e,t){this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch((e=>({type:il,payload:{documentId:e}}))(e)),this.selChange$.emit(e,null),this.emitMenuPlacement(e,null),this.notifyAllPages(e)}selectWord(e,t,n,o){const i=this.getDocumentState(e).geometry[t];if(!i)return;const r=function(e,t){if(!Dl(e,t))return null;const n=function(e){if(0===e.runs.length)return 0;const t=e.runs[e.runs.length-1];return t.charStart+t.glyphs.length}(e);if(0===n)return null;let o=t;for(;o>0;){const t=Dl(e,o-1);if(!t)break;if(Pl(e.runs[t.runIdx].glyphs[t.localIdx].flags))break;o--}let i=t;for(;i<n-1;){const t=Dl(e,i+1);if(!t)break;if(Pl(e.runs[t.runIdx].glyphs[t.localIdx].flags))break;i++}return{from:o,to:i}}(i,n);r&&this.applyInstantSelection(e,t,r.from,r.to,o)}selectLine(e,t,n,o){const i=this.getDocumentState(e).geometry[t];if(!i)return;const r=function(e,t){const n=Dl(e,t);if(!n)return null;const o=e.runs[n.runIdx],i=o.rect.y,r=o.rect.y+o.rect.height;let a=o.charStart,s=o.charStart+o.glyphs.length-1;for(let t=n.runIdx-1;t>=0;t--){const n=e.runs[t];if(!Tl(n)){if(!Rl(n.rect.y,n.rect.y+n.rect.height,i,r))break;a=n.charStart}}for(let t=n.runIdx+1;t<e.runs.length;t++){const n=e.runs[t];if(!Tl(n)){if(!Rl(n.rect.y,n.rect.y+n.rect.height,i,r))break;s=n.charStart+n.glyphs.length-1}}return{from:a,to:s}}(i,n);r&&this.applyInstantSelection(e,t,r.from,r.to,o)}applyInstantSelection(e,t,n,o,i){const r={start:{page:t,index:n},end:{page:t,index:o}};this.selecting.set(e,!1),this.anchor.set(e,void 0),this.dispatch(cl(e)),this.dispatch(ll(e,r)),this.updateRectsAndSlices(e,r),this.dispatch(dl(e)),this.selChange$.emit(e,r),this.beginSelection$.emit(e,{page:t,index:n,modeId:i}),this.endSelection$.emit(e,{modeId:i});for(let t=r.start.page;t<=r.end.page;t++)this.notifyPage(e,t);this.recalculateMenuPlacement(e)}updateSelection(e,t,n,o){if(!this.selecting.get(e)||!this.anchor.get(e))return;const i=this.anchor.get(e),r=t>i.page||t===i.page&&n>=i.index,a={start:r?i:{page:t,index:n},end:r?{page:t,index:n}:i};this.dispatch(ll(e,a)),this.updateRectsAndSlices(e,a),this.selChange$.emit(e,a);for(let t=a.start.page;t<=a.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=kl(t,r,e);a&&(o[e]=Cl(r,a.from,a.to),i[e]={start:a.from,count:a.to-a.from+1})}this.dispatch(ul(e,o)),this.dispatch(hl(e,i))}getSelectedText(e){if(!this.checkPermission(e,on.CopyContents))return this.logger.debug("SelectionPlugin","GetSelectedText",`Cannot get selected text: document ${e} lacks CopyContents permission`),ln.reject({code:sn.Security,message:"Document lacks CopyContents permission"});const t=this.getCoreDocument(e),n=this.getDocumentState(e);if(!(null==t?void 0:t.document)||!n.selection)return ln.reject({code:sn.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 ln.resolve([]);const r=this.engine.getTextSlices(t.document,i);return r.wait(t=>{this.textRetrieved$.emit(e,t)},Bn),r}copyToClipboard(e){if(!this.checkPermission(e,on.CopyContents))return void this.logger.debug("SelectionPlugin","CopyToClipboard",`Cannot copy to clipboard: document ${e} lacks CopyContents permission`);this.getSelectedText(e).wait(t=>{this.copyToClipboard$.emit(e,t.join("\n"))},Bn)}beginMarquee(e,t,n,o){this.marqueePage.set(e,t)}updateMarquee(e,t,n,o){this.marqueeChange$.emit(e,{pageIndex:t,rect:n,modeId:o})}endMarquee(e,t,n,o){this.marqueeEnd$.emit(e,{pageIndex:t,rect:n,modeId:o}),this.marqueeChange$.emit(e,{pageIndex:t,rect:null,modeId:o}),this.marqueePage.delete(e)}cancelMarquee(e,t){const n=this.marqueePage.get(e);void 0!==n&&(this.marqueeChange$.emit(e,{pageIndex:n,rect:null,modeId:t}),this.marqueePage.delete(e))}setMarqueeEnabled(e,t){const n=this.enabledModesPerDoc.get(e);if(!n)return;const o=n.get("pointerMode");o?o.enableMarquee=t:t&&n.set("pointerMode",{enableMarquee:!0})}isMarqueeEnabled(e){var t;const n=null==(t=this.enabledModesPerDoc.get(e))?void 0:t.get("pointerMode");return!1!==(null==n?void 0:n.enableMarquee)}};zl.id="selection";let El=zl;const Ol={manifest:Ys,create:(e,t)=>new El(Xs,e,t),reducer:(e=gl,t)=>{switch(t.type){case Qs:{const{documentId:n,state:o}=t.payload;return pl(e,n,o)}case Js:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case el:{const{documentId:n,page:o,geo:i}=t.payload,r=e.documents[n];return r?pl(e,n,{...r,geometry:{...r.geometry,[o]:i}}):e}case tl:{const{documentId:n,selection:o}=t.payload,i=e.documents[n];return i?pl(e,n,{...i,selection:o,active:!0}):e}case nl:{const{documentId:n}=t.payload,o=e.documents[n];return o?pl(e,n,{...o,selecting:!0,selection:null,rects:{}}):e}case ol:{const{documentId:n}=t.payload,o=e.documents[n];return o?pl(e,n,{...o,selecting:!1}):e}case il:{const{documentId:n}=t.payload,o=e.documents[n];return o?pl(e,n,{...o,selecting:!1,selection:null,rects:{},active:!1}):e}case rl:{const{documentId:n,rects:o}=t.payload,i=e.documents[n];return i?pl(e,n,{...i,rects:o}):e}case al:{const{documentId:n,slices:o}=t.payload,i=e.documents[n];return i?pl(e,n,{...i,slices:o}):e}case sl:{const{documentId:n,pages:o}=t.payload,i=e.documents[n];if(!i)return e;const r={...i.geometry},a={...i.rects},s={...i.slices};for(const e of o)delete r[e],delete a[e],delete s[e];return pl(e,n,{...i,geometry:r,rects:a,slices:s})}case"SELECTION/RESET":{const{documentId:n}=t.payload;return e.documents[n]?pl(e,n,ml):e}default:return e}},initialState:gl};function Nl(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}}}const Ll="onDblClick";function _l({children:e,...t}){const{rect:n,rotation:o}=t,{matrix:i,width:r,height:a}=Nl(n,o),s=Pe(null);Me(()=>{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,passive:!0}),()=>{e.removeEventListener("pointerdown",t,{capture:!0}),e.removeEventListener("touchstart",n,{capture:!0})}},[]);return Be(B,{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}}})})}function Fl(e,t,n,o=!1){if(!t)return e;let{origin:{x:i,y:r},size:{width:a,height:s}}=e;const l=t.minWidth??1,c=t.minHeight??1,d=t.maxWidth,u=t.maxHeight;if(n&&a>0&&s>0){const e=a/s;a<l&&(a=l,s=a/e),s<c&&(s=c,a=s*e),void 0!==d&&a>d&&(a=d,s=a/e),void 0!==u&&s>u&&(s=u,a=s*e)}else a=Math.max(l,a),s=Math.max(c,s),void 0!==d&&(a=Math.min(d,a)),void 0!==u&&(s=Math.min(u,s));return t.boundingBox&&!o&&(i=Math.max(0,Math.min(i,t.boundingBox.width-a)),r=Math.max(0,Math.min(r,t.boundingBox.height-s))),{origin:{x:i,y:r},size:{width:a,height:s}}}function $l(e,t,n){const o=1e-6,i=ut(e,t);return i.origin.x>=-o&&i.origin.y>=-o&&i.origin.x+i.size.width<=n.width+o&&i.origin.y+i.size.height<=n.height+o}function jl(e,t,n,o,i){const{startRect:r,maintainAspectRatio:a=!1,annotationRotation:s=0,constraints:l}=n,c=function(e){return{x:e.includes("e")?"left":e.includes("w")?"right":"center",y:e.includes("s")?"top":e.includes("n")?"bottom":"center"}}(t),d=r.size.width/r.size.height||1;let u=function(e,t,n){let o=e.origin.x,i=e.origin.y,r=e.size.width,a=e.size.height;return"left"===n.x?r+=t.x:"right"===n.x&&(o+=t.x,r-=t.x),"top"===n.y?a+=t.y:"bottom"===n.y&&(i+=t.y,a-=t.y),{origin:{x:o,y:i},size:{width:r,height:a}}}(r,e,c);if(a&&(u=function(e,t,n,o){let{x:i,y:r}=e.origin,{width:a,height:s}=e.size;if("center"===n.x||"center"===n.y)"center"===n.y?(s=a/o,r=t.origin.y+(t.size.height-s)/2):(a=s*o,i=t.origin.x+(t.size.width-a)/2);else{const e=Math.abs(a-t.size.width),n=Math.abs(s-t.size.height),i=e+n;if(0===i)a=t.size.width,s=t.size.height;else{const t=e/i,r=n/i,l=a/o;a=t*a+r*(s*o),s=t*l+r*s}}return"right"===n.x&&(i=t.origin.x+t.size.width-a),"bottom"===n.y&&(r=t.origin.y+t.size.height-s),{origin:{x:i,y:r},size:{width:a,height:s}}}(u,r,c,d)),o&&(u=function(e,t,n,o,i){if(!o)return e;let{x:r,y:a}=e.origin,{width:s,height:l}=e.size;s=Math.max(1,s),l=Math.max(1,l);const c="left"===n.x?t.origin.x:t.origin.x+t.size.width,d="top"===n.y?t.origin.y:t.origin.y+t.size.height,u="left"===n.x?o.width-c:"right"===n.x?c:2*Math.min(t.origin.x,o.width-t.origin.x-t.size.width)+t.size.width,h="top"===n.y?o.height-d:"bottom"===n.y?d:2*Math.min(t.origin.y,o.height-t.origin.y-t.size.height)+t.size.height;if(i){const e=s>u?u/s:1,t=l>h?h/l:1,n=Math.min(e,t);n<1&&(s*=n,l*=n)}else s=Math.min(s,u),l=Math.min(l,h);return r="left"===n.x?c:"right"===n.x?c-s:t.origin.x+(t.size.width-s)/2,a="top"===n.y?d:"bottom"===n.y?d-l:t.origin.y+(t.size.height-l)/2,r=Math.max(0,Math.min(r,o.width-s)),a=Math.max(0,Math.min(a,o.height-l)),{origin:{x:r,y:a},size:{width:s,height:l}}}(u,r,c,null==l?void 0:l.boundingBox,a)),u=Fl(u,l,a,i),i&&(u=function(e,t,n){let o,i;return o="left"===n.x?t.origin.x:"right"===n.x?t.origin.x+t.size.width-e.size.width:t.origin.x+(t.size.width-e.size.width)/2,i="top"===n.y?t.origin.y:"bottom"===n.y?t.origin.y+t.size.height-e.size.height:t.origin.y+(t.size.height-e.size.height)/2,{origin:{x:o,y:i},size:e.size}}(u,r,c)),0!==s){const e=function(e,t){return{x:"left"===t.x?e.origin.x:"right"===t.x?e.origin.x+e.size.width:e.origin.x+e.size.width/2,y:"top"===t.y?e.origin.y:"bottom"===t.y?e.origin.y+e.size.height:e.origin.y+e.size.height/2}}(r,c),t={x:r.origin.x+r.size.width/2,y:r.origin.y+r.size.height/2},n={x:u.origin.x+u.size.width/2,y:u.origin.y+u.size.height/2},o=lt(e,t,s),i=lt(e,n,s);u={origin:{x:u.origin.x+(o.x-i.x),y:u.origin.y+(o.y-i.y)},size:u.size}}return u}const Ul={n:0,ne:45,e:90,se:135,s:180,sw:225,w:270,nw:315},Bl=["ns-resize","nesw-resize","ew-resize","nwse-resize","ns-resize","nesw-resize","ew-resize","nwse-resize"];function Wl(e,t,n=0){const o=((Ul[e]+90*t+n)%360+360)%360,i=Math.round(o/45)%8;return Bl[i]}function Hl(e,t,n){const o=-e/2;return"center"===n?o:"outside"===n?o-t:o+t}class Gl{constructor(e,t){this.config=e,this.onUpdate=t,this.state="idle",this.startPoint=null,this.startElement=null,this.startRotationElement=null,this.gestureRotationCenter=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[],this.currentVertices=[],this.rotationCenter=null,this.centerScreen=null,this.initialRotation=0,this.lastComputedRotation=0,this.rotationDelta=0,this.rotationSnappedAngle=null,this.currentVertices=e.vertices||[]}updateConfig(e){this.config={...this.config,...e},"vertex-editing"!==this.state&&(this.currentVertices=e.vertices||[])}startDrag(e,t){this.state="dragging",this.startPoint={x:e,y:t},this.startElement={...this.config.element},this.startRotationElement=this.config.rotationElement?{...this.config.rotationElement}:null,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.gestureRotationCenter=this.config.rotationCenter??{x:this.config.element.origin.x+this.config.element.size.width/2,y:this.config.element.origin.y+this.config.element.size.height/2},this.onUpdate({state:"start",transformData:{type:"vertex-edit",changes:{vertices:this.startVertices},metadata:{vertexIndex:e}}}))}startRotation(e,t,n=0,o){this.state="rotating",this.startPoint={x:e,y:t},this.startElement={...this.config.element},this.rotationCenter=this.config.rotationCenter??{x:this.config.element.origin.x+this.config.element.size.width/2,y:this.config.element.origin.y+this.config.element.size.height/2};const{scale:i=1}=this.config,r=this.config.rotationElement??this.config.element,a=r.size.width*i,s=r.size.height*i,l=o??Math.max(a,s)/2+35,c=(n+90*(this.config.pageRotation??0))*Math.PI/180;this.centerScreen={x:e-l*Math.sin(c),y:t+l*Math.cos(c)},this.initialRotation=n,this.lastComputedRotation=n,this.rotationDelta=0,this.rotationSnappedAngle=null,this.onUpdate({state:"start",transformData:{type:"rotate",changes:{rotation:n},metadata:{rotationAngle:n,rotationDelta:0,rotationCenter:this.rotationCenter,isSnapped:!1}}})}move(e,t,n,o){if("idle"!==this.state&&this.startPoint)if(void 0===n||0!==n){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=function(e,t,n){const{annotationRotation:o=0,constraints:i}=n,r=null==i?void 0:i.boundingBox;if(0!==o&&r){const i=jl(e,t,n,!1,!0);if($l(i,o,r))return i;let a=jl({x:0,y:0},t,n,!1,!0),s=0,l=1;for(let i=0;i<20;i+=1){const i=(s+l)/2,c=jl({x:e.x*i,y:e.y*i},t,n,!1,!0);$l(c,o,r)?(a=c,s=i):l=i}return a}return jl(e,t,n,!0,!1)}(this.calculateLocalDelta(e,t),this.activeHandle,{startRect:this.startElement,maintainAspectRatio:this.config.maintainAspectRatio||!!o,annotationRotation:this.config.annotationRotation,constraints:this.config.constraints});this.currentPosition=n,this.onUpdate({state:"move",transformData:{type:"resize",changes:{rect:n},metadata:{handle:this.activeHandle,maintainAspectRatio:this.config.maintainAspectRatio||!!o}}})}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}}})}else if("rotating"===this.state&&this.rotationCenter){const n=this.calculateAngleFromMouse(e,t),o=this.applyRotationSnapping(n),i=at(o.angle),r=i-this.lastComputedRotation,a=r>180?r-360:r<-180?r+360:r;this.rotationDelta+=a,this.lastComputedRotation=i,this.rotationSnappedAngle=o.isSnapped?i:null,this.onUpdate({state:"move",transformData:{type:"rotate",changes:{rotation:i},metadata:{rotationAngle:i,rotationDelta:this.rotationDelta,rotationCenter:this.rotationCenter,isSnapped:o.isSnapped,snappedAngle:this.rotationSnappedAngle??void 0,cursorPosition:{clientX:e,clientY:t}}}})}}else this.end()}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 if("rotating"===e)this.onUpdate({state:"end",transformData:{type:"rotate",changes:{rotation:this.lastComputedRotation},metadata:{rotationAngle:this.lastComputedRotation,rotationDelta:this.rotationDelta,rotationCenter:this.rotationCenter||void 0,isSnapped:null!==this.rotationSnappedAngle,snappedAngle:this.rotationSnappedAngle??void 0}}});else{const n=this.currentPosition||this.config.element;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}}}):"rotating"===this.state?this.onUpdate({state:"end",transformData:{type:"rotate",changes:{rotation:this.initialRotation},metadata:{rotationAngle:this.initialRotation,rotationDelta:0,rotationCenter:this.rotationCenter||void 0,isSnapped:!1}}}):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.startRotationElement=null,this.gestureRotationCenter=null,this.activeHandle=null,this.currentPosition=null,this.activeVertexIndex=null,this.startVertices=[],this.rotationCenter=null,this.centerScreen=null,this.initialRotation=0,this.lastComputedRotation=0,this.rotationDelta=0,this.rotationSnappedAngle=null}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}}calculateLocalDelta(e,t){const n=this.calculateDelta(e,t),{annotationRotation:o=0}=this.config;if(0===o)return n;const i=o*Math.PI/180,r=Math.cos(i),a=Math.sin(i);return{x:r*n.x+a*n.y,y:-a*n.x+r*n.y}}clampPoint(e){var t;const n=null==(t=this.config.constraints)?void 0:t.boundingBox;if(!n)return e;const{annotationRotation:o=0}=this.config;if(0===o)return{x:Math.max(0,Math.min(e.x,n.width)),y:Math.max(0,Math.min(e.y,n.height))};const i=this.gestureRotationCenter??this.config.rotationCenter??{x:this.config.element.origin.x+this.config.element.size.width/2,y:this.config.element.origin.y+this.config.element.size.height/2},r=lt(e,i,o),a=Math.max(0,Math.min(r.x,n.width)),s=Math.max(0,Math.min(r.y,n.height));return a===r.x&&s===r.y?e:lt({x:a,y:s},i,-o)}calculateVertexPosition(e,t){if(null===this.activeVertexIndex)return this.startVertices;const n=this.calculateLocalDelta(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}},{annotationRotation:n=0,constraints:o}=this.config,i=null==o?void 0:o.boundingBox;if(0!==n&&i){let e,o,r,a;if(this.startRotationElement)e=this.startRotationElement.size.width,o=this.startRotationElement.size.height,r=this.startRotationElement.origin.x-this.startElement.origin.x,a=this.startRotationElement.origin.y-this.startElement.origin.y;else{const i=Math.abs(n*Math.PI/180),s=Math.abs(Math.cos(i)),l=Math.abs(Math.sin(i)),c=t.size.width,d=t.size.height;e=c*s+d*l,o=c*l+d*s,r=(c-e)/2,a=(d-o)/2}let{x:s,y:l}=t.origin;return s=Math.max(-r,Math.min(s,i.width-e-r)),l=Math.max(-a,Math.min(l,i.height-o-a)),{origin:{x:s,y:l},size:t.size}}return Fl(t,o,this.config.maintainAspectRatio??!1)}calculateAngleFromMouse(e,t){if(!this.centerScreen)return this.initialRotation;const n=e-this.centerScreen.x,o=t-this.centerScreen.y;if(Math.sqrt(n*n+o*o)<10)return this.lastComputedRotation;const i=90*(this.config.pageRotation??0),r=Math.atan2(o,n)*(180/Math.PI)+90-i;return at(Math.round(r))}applyRotationSnapping(e){const t=this.config.rotationSnapAngles??[0,90,180,270],n=this.config.rotationSnapThreshold??4,o=at(e);for(const e of t){const t=at(e),i=Math.abs(o-t);if(Math.min(i,360-i)<=n)return{angle:t,isSnapped:!0,snapTarget:t}}return{angle:o,isSnapped:!1}}}function ql(e){var t,n,o,i,r,a;const{controller:s,resizeUI:l,vertexUI:c,rotationUI:d,includeVertices:u=!1,includeRotation:h=!1,currentRotation:m=0,handleAttrs:g,vertexAttrs:p,rotationAttrs:f}=e,{dragProps:v,createResizeProps:y,createVertexProps:b,createRotationProps:w}=function(e){const{onUpdate:t,enabled:n=!0,...o}=e,i=Pe(null),r=Pe(t),a=Pe(null),s=Pe(null);Me(()=>{r.current=t},[t]),Me(()=>{i.current?i.current.updateConfig(o):i.current=new Gl(o,e=>{var t;return null==(t=r.current)?void 0:t.call(r,e)})},[o.element,o.rotationCenter,o.rotationElement,o.constraints,o.maintainAspectRatio,o.pageRotation,o.annotationRotation,o.scale,o.vertices]);const l=Re(e=>{var t,n;const o=a.current,i=s.current,r=e??o;if(i&&null!==r)try{(null==(t=i.hasPointerCapture)?void 0:t.call(i,r))&&(null==(n=i.releasePointerCapture)||n.call(i,r))}catch{}a.current=null,s.current=null},[]),c=Re(e=>{var t;null!==a.current&&a.current!==e.pointerId&&(null==(t=i.current)||t.end(),l(a.current));const n=e.currentTarget;a.current=e.pointerId,s.current=n;try{n.setPointerCapture(e.pointerId)}catch{}},[l]);Me(()=>{const e=globalThis,t=e=>{var t;const n=a.current;null!==n&&e.pointerId===n&&(null==(t=i.current)||t.end(),l(e.pointerId))},n=()=>{var e;null!==a.current&&(null==(e=i.current)||e.end(),l())};return e.addEventListener("pointerup",t,!0),e.addEventListener("pointercancel",t,!0),e.addEventListener("blur",n,!0),()=>{e.removeEventListener("pointerup",t,!0),e.removeEventListener("pointercancel",t,!0),e.removeEventListener("blur",n,!0)}},[l]),Me(()=>()=>{var e;null!==a.current&&(null==(e=i.current)||e.end(),l())},[l]);const d=Re(e=>{var t;n&&(e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.startDrag(e.clientX,e.clientY),c(e))},[n,c]),u=Re(e=>{var t;e.preventDefault(),e.stopPropagation();const n=a.current;null!==n&&e.pointerId!==n||(null==(t=i.current)||t.move(e.clientX,e.clientY,e.buttons,e.shiftKey),a.current===e.pointerId&&0===e.buttons&&l(e.pointerId))},[l]),h=Re(e=>{var t;e.preventDefault(),e.stopPropagation();const n=a.current;null!==n&&e.pointerId!==n||(null==(t=i.current)||t.end(),l(e.pointerId))},[l]),m=Re(e=>{var t;const n=a.current;null!==n&&e.pointerId===n&&(null==(t=i.current)||t.end(),l(e.pointerId))},[l]),g=Re(e=>({onPointerDown:t=>{var o;n&&(t.preventDefault(),t.stopPropagation(),null==(o=i.current)||o.startResize(e,t.clientX,t.clientY),c(t))},onPointerMove:u,onPointerUp:h,onPointerCancel:h,onLostPointerCapture:m}),[n,u,h,m,c]),p=Re(e=>({onPointerDown:t=>{var o;n&&(t.preventDefault(),t.stopPropagation(),null==(o=i.current)||o.startVertexEdit(e,t.clientX,t.clientY),c(t))},onPointerMove:u,onPointerUp:h,onPointerCancel:h,onLostPointerCapture:m}),[n,u,h,m,c]),f=Re((e=0,t)=>({onPointerDown:o=>{var r;if(!n)return;o.preventDefault(),o.stopPropagation();const a=o.currentTarget.getBoundingClientRect(),s=a.left+a.width/2,l=a.top+a.height/2;null==(r=i.current)||r.startRotation(s,l,e,t),c(o)},onPointerMove:u,onPointerUp:h,onPointerCancel:h,onLostPointerCapture:m}),[n,u,h,m,c]);return{dragProps:n?{onPointerDown:d,onPointerMove:u,onPointerUp:h,onPointerCancel:h,onLostPointerCapture:m}:{},createResizeProps:g,createVertexProps:p,createRotationProps:f}}(s),x=Te(()=>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.annotationRotation??0,d=e=>({[e]:Hl(n,o,i)+"px"});return[["nw",{...d("top"),...d("left")}],["ne",{...d("top"),...d("right")}],["sw",{...d("bottom"),...d("left")}],["se",{...d("bottom"),...d("right")}],...r?[["n",{...d("top"),left:`calc(50% - ${n/2}px)`}],["s",{...d("bottom"),left:`calc(50% - ${n/2}px)`}],["w",{...d("left"),top:`calc(50% - ${n/2}px)`}],["e",{...d("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?Wl(e,l,c):"default",pointerEvents:"auto",touchAction:"none",...t},attrs:{"data-epdf-handle":e}}))}(s,l).map(e=>{var t;return{key:null==(t=e.attrs)?void 0:t["data-epdf-handle"],style:e.style,...y(e.handle),...e.attrs??{},...(null==g?void 0:g(e.handle))??{}}}),[s.element.origin.x,s.element.origin.y,s.element.size.width,s.element.size.height,s.scale,s.pageRotation,s.annotationRotation,s.maintainAspectRatio,null==l?void 0:l.handleSize,null==l?void 0:l.spacing,null==l?void 0:l.offsetMode,null==l?void 0:l.includeSides,null==l?void 0:l.zIndex,null==l?void 0:l.rotationAwareCursor,y,g]),k=Te(()=>{if(!u)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,pointerEvents:"auto",touchAction:"none"},attrs:{"data-epdf-vertex":t}}))}(s,c,s.vertices);return e.map((e,t)=>({key:t,style:e.style,...b(t),...e.attrs??{},...(null==p?void 0:p(t))??{}}))},[u,s.element.origin.x,s.element.origin.y,s.element.size.width,s.element.size.height,s.scale,s.vertices,null==c?void 0:c.vertexSize,null==c?void 0:c.zIndex,b,p]);return{dragProps:v,resize:x,vertices:k,rotation:Te(()=>{if(!h)return null;const e=function(e,t={},n=0){const{handleSize:o=16,zIndex:i=5,showConnector:r=!0,connectorWidth:a=1}=t,s=e.scale??1,l=e.element,c=e.rotationElement??l,d=e.rotationCenter??{x:l.origin.x+l.size.width/2,y:l.origin.y+l.size.height/2};c.size.width,c.size.height;const u=(d.x-c.origin.x)*s,h=(d.y-c.origin.y)*s,m=n*Math.PI/180,g=t.margin??35,p=l.size.height*s/2+g;return{handleStyle:{position:"absolute",left:u+p*Math.sin(m)-o/2+"px",top:h-p*Math.cos(m)-o/2+"px",width:o+"px",height:o+"px",borderRadius:"50%",cursor:"grab",zIndex:i,pointerEvents:"auto",touchAction:"none"},connectorStyle:r?{position:"absolute",left:u-a/2+"px",top:h-p+"px",width:a+"px",height:p+"px",transformOrigin:"center bottom",transform:`rotate(${n}deg)`,zIndex:i-1,pointerEvents:"none"}:{},radius:p,attrs:{"data-epdf-rotation-handle":!0}}}(s,d,m);return{handle:{style:e.handleStyle,...w(m,e.radius),...e.attrs??{},...(null==f?void 0:f())??{}},connector:{style:e.connectorStyle,"data-epdf-rotation-connector":!0}}},[h,s.element.origin.x,s.element.origin.y,s.element.size.width,s.element.size.height,null==(t=s.rotationCenter)?void 0:t.x,null==(n=s.rotationCenter)?void 0:n.y,null==(o=s.rotationElement)?void 0:o.origin.x,null==(i=s.rotationElement)?void 0:i.origin.y,null==(r=s.rotationElement)?void 0:r.size.width,null==(a=s.rotationElement)?void 0:a.size.height,s.scale,m,null==d?void 0:d.handleSize,null==d?void 0:d.margin,null==d?void 0:d.zIndex,null==d?void 0:d.showConnector,null==d?void 0:d.connectorWidth,w,f])}}const Vl=()=>Wo(El.id),Kl=()=>Bo(El.id);function Zl({documentId:e,pageIndex:t,scale:n,rotation:o,background:i="rgba(33,150,243)",selectionMenu:r}){var a,s;const{plugin:l}=Kl(),c=Go(e),d=null==(s=null==(a=null==c?void 0:c.document)?void 0:a.pages)?void 0:s[t],[u,h]=Se([]),[m,g]=Se(null),[p,f]=Se(null);Me(()=>{if(l&&e)return l.registerSelectionOnPage({documentId:e,pageIndex:t,onRectsChange:({rects:e,boundingRect:t})=>{h(e),g(t)}})},[l,e,t]),Me(()=>{if(l&&e)return l.onMenuPlacement(e,e=>{f(e)})},[l,e]);const v=Te(()=>void 0!==n?n:(null==c?void 0:c.scale)??1,[n,null==c?void 0:c.scale]),y=Te(()=>{if(void 0!==o)return o;return(((null==d?void 0:d.rotation)??0)+((null==c?void 0:c.rotation)??0))%4},[o,null==d?void 0:d.rotation,null==c?void 0:c.rotation]),b=r&&p&&p.pageIndex===t&&p.isVisible;return m?Be(B,{children:[Be("div",{style:{position:"absolute",left:m.origin.x*v,top:m.origin.y*v,width:m.size.width*v,height:m.size.height*v,mixBlendMode:"multiply",isolation:"isolate",pointerEvents:"none"},children:u.map((e,t)=>Be("div",{style:{position:"absolute",left:(e.origin.x-m.origin.x)*v,top:(e.origin.y-m.origin.y)*v,width:e.size.width*v,height:e.size.height*v,background:i}},t))}),b&&Be(_l,{rect:{origin:{x:p.rect.origin.x*v,y:p.rect.origin.y*v},size:{width:p.rect.size.width*v,height:p.rect.size.height*v}},rotation:y,children:e=>r({...e,context:{type:"selection",pageIndex:t},selected:!0,placement:p})})]}):null}const Xl=({documentId:e,pageIndex:t,scale:n,className:o,background:i,borderColor:r,borderStyle:a="dashed",stroke:s,fill:l})=>{const{plugin:c}=Kl(),d=Go(e),[u,h]=Se(null),m=r??s??"rgba(0,122,204,0.8)",g=i??l??"rgba(0,122,204,0.15)",p=Te(()=>void 0!==n?n:(null==d?void 0:d.scale)??1,[n,null==d?void 0:d.scale]);return Me(()=>{if(c&&e)return c.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:p,onRectChange:h})},[c,e,t,p]),u?Be("div",{style:{position:"absolute",pointerEvents:"none",left:u.origin.x*p,top:u.origin.y*p,width:u.size.width*p,height:u.size.height*p,border:`1px ${a} ${m}`,background:g,boxSizing:"border-box",zIndex:1e3},className:o}):null};function Yl({documentId:e,pageIndex:t,scale:n,rotation:o,background:i,textStyle:r,marqueeStyle:a,marqueeClassName:s,selectionMenu:l}){return Be(B,{children:[Be(Zl,{documentId:e,pageIndex:t,scale:n,rotation:o,background:(null==r?void 0:r.background)??i,selectionMenu:l}),Be(Xl,{documentId:e,pageIndex:t,scale:n,background:null==a?void 0:a.background,borderColor:null==a?void 0:a.borderColor,borderStyle:null==a?void 0:a.borderStyle,className:s})]})}const Ql=Fo(Ol).addUtility(function(){const{provides:e}=Vl();return Me(()=>{if(e)return e.onCopyToClipboard(({text:e})=>{navigator.clipboard.writeText(e)})},[e]),null}).build(),Jl="tiling",ec={id:Jl,name:"Tiling Plugin",version:"1.0.0",provides:["tiling"],requires:["render","scroll","viewport"],optional:[],defaultConfig:{tileSize:768,overlapPx:2.5,extraRings:0}},tc="TILING/INIT_STATE",nc="TILING/CLEANUP_STATE",oc="TILING/UPDATE_VISIBLE_TILES",ic="TILING/MARK_TILE_STATUS",rc=(e,t)=>({type:oc,payload:{documentId:e,tiles:t}}),ac=(e,t,n,o)=>({type:ic,payload:{documentId:e,pageIndex:t,tileId:n,status:o}}),sc={visibleTiles:{}};function lc({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 nt(tt(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),f=Math.floor((l-1)/c),v=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(f,Math.floor((g-1)/c)+n),x=[];for(let t=v;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 cc=class extends So{constructor(e,t,n){super(e,t),this.tileRendering$=No(),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(ro,e=>this.recalculateTiles(e.payload))}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:tc,payload:{documentId:e,state:t}}))(e,sc))}onDocumentClosed(e){this.dispatch((e=>({type:nc,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;for(const e of n){const t=a.pageVisibilityMetrics.find(t=>t.pageNumber===e+1);if(!t)continue;const n=o.document.pages[e];if(!n)continue;const i=((n.rotation??0)+o.rotation)%4;s[e]=lc({page:n,metric:t,scale:c,rotation:i,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(rc(t,s))}async initialize(){}calculateVisibleTiles(e,t){const n=this.getCoreDocument(e);if(!n||!n.document)return;const o=n.scale,i={};for(const e of t.pageVisibilityMetrics){const t=e.pageNumber-1,r=n.document.pages[t];if(!r)continue;const a=lc({page:r,metric:e,scale:o,rotation:((r.rotation??0)+n.rotation)%4,tileSize:this.config.tileSize,overlapPx:this.config.overlapPx,extraRings:this.config.extraRings});i[t]=a}this.dispatch(rc(e,i))}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(ac(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(ac(n,e.pageIndex,e.tile.id,"ready"))},Bn),o}};cc.id="tiling";let dc=cc;const uc={manifest:ec,create:(e,t)=>new dc(Jl,e,t),reducer:(e,t)=>((e,t)=>{var n,o;switch(t.type){case tc:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case nc:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case oc:{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 ic:{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:{}}},hc=()=>Wo(dc.id);function mc({documentId:e,pageIndex:t,tile:n,dpr:o,scale:i}){const{provides:r}=hc(),a=Te(()=>null==r?void 0:r.forDocument(e),[r,e]),[s,l]=Se(),c=Pe(null),d=i/n.srcScale;Me(()=>{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)},Bn),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):e.abort({code:sn.Cancelled,message:"canceled render task"})}},[a,t,n.id]);return s?Be("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 gc({documentId:e,pageIndex:t,scale:n,style:o,...i}){const{provides:r}=hc(),a=Go(e),[s,l]=Se([]);Me(()=>{if(r)return r.onTileRendering(n=>{n.documentId===e&&l(n.tiles[t]??[])})},[r,e,t]);const c=Te(()=>void 0!==n?n:(null==a?void 0:a.scale)??1,[n,null==a?void 0:a.scale]);return Be("div",{style:{...o},...i,children:null==s?void 0:s.map(n=>Be(mc,{documentId:e,pageIndex:t,tile:n,dpr:window.devicePixelRatio,scale:c},n.id))})}const pc="thumbnail",fc={id:pc,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}},vc="THUMBNAIL/INIT_STATE",yc="THUMBNAIL/CLEANUP_STATE",bc="THUMBNAIL/SET_WINDOW_STATE",wc="THUMBNAIL/UPDATE_VIEWPORT_METRICS";function xc(e,t){return{type:vc,payload:{documentId:e,state:t}}}const kc={thumbs:[],window:null,viewportH:0,scrollY:0},Cc={documents:{},activeDocumentId:null},Ic=class extends So{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(ro,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(xc(e,{...kc})),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:yc,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.rotation%2==1,n=t?e.size.height:e.size.width,a=(t?e.size.width:e.size.height)/n,c=Math.round(s*a),d=r+c+r+o,u={pageIndex:e.index,width:s,height:c,wrapperHeight:d,top:l,labelHeight:o,padding:r};return l+=d+i,u}),d={start:-1,end:-1,items:[],totalHeight:l-i+a},u=this.getDocumentState(e);u&&(this.dispatch(xc(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:wc,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:bc,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,rotation:a.rotation}});return i.set(e,d),d.wait(Bn,()=>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()}};Ic.id="thumbnail";let Sc=Ic;const Ac={manifest:fc,create:(e,t)=>new Sc(pc,e,t),reducer:(e=Cc,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 yc:{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 bc:{const{documentId:n,window:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,window:o}}}:e}case wc:{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:Cc},Mc=()=>Bo(Sc.id);function Dc({documentId:e,style:t,children:n,...o}){const{plugin:i}=Mc(),r=Pe(null),[a,s]=Se({window:null,docId:null}),l=a.docId===e?a.window:null;Me(()=>{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]),Me(()=>{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]),Me(()=>{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]),Me(()=>{const t=r.current;if(!t||!i)return;i.provides().forDocument(e).updateWindow(t.scrollTop,t.clientHeight)},[l,i,e]),Me(()=>{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 Be("div",{ref:r,style:{overflowY:"auto",position:"relative",paddingTop:c,paddingBottom:c,height:"100%",...t},...o,children:Be("div",{style:{height:(null==l?void 0:l.totalHeight)??0,position:"relative"},children:null==l?void 0:l.items.map(e=>n(e))})})}function Pc({documentId:e,meta:t,style:n,...o}){const{provides:i}=Wo(Sc.id),{plugin:r}=Mc(),[a,s]=Se(),l=Pe(null),[c,d]=Se(0);Me(()=>{if(!r)return;return r.provides().forDocument(e).onRefreshPages(e=>{e.includes(t.pageIndex)&&d(e=>e+1)})},[r,e,t.pageIndex]),Me(()=>{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)},Bn),()=>{l.current?(URL.revokeObjectURL(l.current),l.current=null):null==o||o.abort({code:sn.Cancelled,message:"canceled render task"})}},[i,e,t.pageIndex,c]);return a?Be("img",{src:a,onLoad:()=>{l.current&&(URL.revokeObjectURL(l.current),l.current=null)},style:n,...o}):null}const Tc="annotation",Rc={id:Tc,name:"Annotation Plugin",version:"1.0.0",provides:["annotation"],requires:["interaction-manager","selection"],optional:["history","scroll"],defaultConfig:{autoCommit:!0,annotationAuthor:"Guest",deactivateToolAfterCreate:!1,selectAfterCreate:!0,autoOpenLinks:!0}},zc="ANNOTATION/INIT_STATE",Ec="ANNOTATION/CLEANUP_STATE",Oc="ANNOTATION/SET_ANNOTATIONS",Nc="ANNOTATION/SELECT_ANNOTATION",Lc="ANNOTATION/DESELECT_ANNOTATION",_c="ANNOTATION/ADD_TO_SELECTION",Fc="ANNOTATION/REMOVE_FROM_SELECTION",$c="ANNOTATION/SET_SELECTION",jc="ANNOTATION/SET_ACTIVE_TOOL_ID",Uc="ANNOTATION/CREATE_ANNOTATION",Bc="ANNOTATION/PATCH_ANNOTATION",Wc="ANNOTATION/MOVE_ANNOTATION",Hc="ANNOTATION/DELETE_ANNOTATION",Gc="ANNOTATION/COMMIT",qc="ANNOTATION/PURGE_ANNOTATION",Vc="ANNOTATION/SET_LOCKED",Kc="ANNOTATION/SYNC_OBJECT",Zc="ANNOTATION/ADD_COLOR_PRESET",Xc="ANNOTATION/SET_TOOL_DEFAULTS",Yc="ANNOTATION/ADD_TOOL";const Qc=e=>({type:Lc,payload:{documentId:e}}),Jc=(e,t,n)=>({type:_c,payload:{documentId:e,pageIndex:t,id:n}}),ed=(e,t)=>({type:Fc,payload:{documentId:e,id:t}}),td=(e,t)=>({type:$c,payload:{documentId:e,ids:t}}),nd=(e,t)=>({type:jc,payload:{documentId:e,toolId:t}}),od=(e,t,n)=>({type:Uc,payload:{documentId:e,pageIndex:t,annotation:n}}),id=(e,t,n,o)=>({type:Bc,payload:{documentId:e,pageIndex:t,id:n,patch:o}}),rd=(e,t,n,o)=>({type:Wc,payload:{documentId:e,pageIndex:t,id:n,patch:o}}),ad=(e,t,n)=>({type:Hc,payload:{documentId:e,pageIndex:t,id:n}}),sd=(e,t,n)=>({type:qc,payload:{documentId:e,pageIndex:t,uid:n}});var ld=(e=>(e.None="none",e.All="all",e.Include="include",e.Exclude="exclude",e))(ld||{});function cd(e){return function(e){return e.object.type===_t.HIGHLIGHT}(e)||function(e){return e.object.type===_t.UNDERLINE}(e)||function(e){return e.object.type===_t.STRIKEOUT}(e)||function(e){return e.object.type===_t.SQUIGGLY}(e)}function dd(e){return e.object.type===_t.TEXT}function ud(e){return dd(e)&&!e.object.inReplyToId||cd(e)||function(e){return e.object.type===_t.INK}(e)||function(e){return e.object.type===_t.SQUARE}(e)||function(e){return e.object.type===_t.CIRCLE}(e)||function(e){return e.object.type===_t.POLYGON}(e)||function(e){return e.object.type===_t.LINE}(e)||function(e){return e.object.type===_t.POLYLINE}(e)||function(e){return e.object.type===_t.FREETEXT}(e)||function(e){return e.object.type===_t.STAMP}(e)||function(e){return e.object.type===_t.REDACT}(e)||function(e){return e.object.type===_t.CARET}(e)}function hd(e){return ud(e)||function(e){return e.object.type===_t.WIDGET}(e)}function md(e){return(null==e?void 0:e.categories)??[]}function gd(e,t){switch(t.type){case ld.None:return!1;case ld.All:return!0;case ld.Include:return 0!==e.length&&e.some(e=>t.categories.includes(e));case ld.Exclude:return 0===e.length||!e.some(e=>t.categories.includes(e))}}function pd(e){var t;return(null==(t=e.flags)?void 0:t.includes("locked"))??!1}const fd=(e,t)=>(e.pages[t]??[]).map(t=>e.byUid[t]),vd=e=>e.selectedUids.map(t=>e.byUid[t]).filter(e=>void 0!==e),yd=e=>e.selectedUids;function bd(e,t){const n=e.tools.find(e=>e.id===t);return null==n?void 0:n.defaults}const wd=(e,t)=>((e,t,n)=>{const o=[];for(const i of Object.values(e.pages))for(const r of i){const i=e.byUid[r];i&&"inReplyToId"in i.object&&i.object.inReplyToId===t&&n.includes(i.object.type)&&o.push(i)}return o})(e,t,[_t.LINK]),xd=(e,t)=>{const n=e.byUid[t];if(n)return n.object.inReplyToId&&n.object.replyType===Ut.Group?n.object.inReplyToId:t},kd=(e,t)=>{const n=xd(e,t);if(!n)return[];const o=[],i=e.byUid[n];i&&i.object.type!==_t.LINK&&o.push(i);for(const t of Object.values(e.pages))for(const i of t){const t=e.byUid[i];t&&t.object.inReplyToId===n&&t.object.replyType===Ut.Group&&t.object.type!==_t.LINK&&o.push(t)}return o},Cd=(e,t)=>{const n=e.byUid[t];if(!n)return!1;if(n.object.type===_t.LINK)return!1;if(n.object.inReplyToId&&n.object.replyType===Ut.Group)return!0;for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&n.object.inReplyToId===t&&n.object.replyType===Ut.Group&&n.object.type!==_t.LINK)return!0}return!1};function Id(e){let t=e;return[()=>t,e=>{t=e}]}const Sd={annotationType:_t.INK,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=Id([]),[s,l]=Id(!1),c={current:null},d=e=>({x:Po(e.x,0,i.width),y:Po(e.y,0,i.height)}),u=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,strokeColor:e.defaults.strokeColor??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=et(Je(n),t.strokeWidth/2);return{type:_t.INK,bounds:o,data:{...t,rect:o,inkList:e,blendMode:t.blendMode}}};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:(i,s)=>{var d;l(!1),null==(d=s.releasePointerCapture)||d.call(s);const m=o(),g=null==m?void 0:m.behavior;if(null==g?void 0:g.smartLineRecognition){const e=g.smartLineThreshold??.15,t=r(),o=t[t.length-1];if(o&&o.points.length>1&&function(e,t){if(e.length<3)return!0;const n=e[0],o=e[e.length-1],i=Math.hypot(o.x-n.x,o.y-n.y);if(i<5)return!1;const r=e.reduce((e,t)=>{const r=Math.abs((o.x-n.x)*(n.y-t.y)-(n.x-t.x)*(o.y-n.y))/i;return Math.max(e,r)},0);return r/i<t}(o.points,e)){const e=o.points[0],i=o.points[o.points.length-1],r=i.x-e.x,s=i.y-e.y,l=Math.atan2(Math.abs(s),Math.abs(r))*(180/Math.PI),c=g.snapAngleDeg??15;if(l<=c){const t=o.points.reduce((e,t)=>e+t.y,0)/o.points.length;o.points=[{x:e.x,y:t},{x:i.x,y:t}]}else if(l>=90-c){const t=o.points.reduce((e,t)=>e+t.x,0)/o.points.length;o.points=[{x:t,y:e.y},{x:t,y:i.y}]}a([...t]),n(h())}}const p=(null==g?void 0:g.commitDelay)??800;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=et(Je(i),n.strokeWidth/2);t({...n,inkList:o,rect:r,type:_t.INK,pageIndex:e.pageIndex,id:$n(),created:new Date})}a([]),n(null)},p)},onPointerCancel:(e,t)=>{var o;a([]),l(!1),n(null),c.current&&clearTimeout(c.current),null==(o=t.releasePointerCapture)||o.call(t)}}}};function Ad(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 Md(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 Dd=Ad(!1),Pd=Ad(!0),Td={[jt.OpenArrow]:Dd,[jt.ClosedArrow]:Pd,[jt.ROpenArrow]:{...Dd,getRotation:e=>e+Math.PI},[jt.RClosedArrow]:{...Pd,getRotation:e=>e+Math.PI},[jt.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},[jt.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},[jt.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},[jt.Butt]:Md(6,e=>e+Math.PI/2),[jt.Slash]:Md(18,e=>e+Math.PI/1.5)};function Rd(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=Td[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 et(Je(o),t/2+1.2*t)}function zd(e,t){if(!e.unrotatedRect)return{rect:t};const n=st(t);return{rect:dt(t,e.rotation??0,n),unrotatedRect:t}}function Ed(e){return e.unrotatedRect?ht(e.unrotatedRect,e.rect,e.rotation??0):st(e.rect)}function Od(e,t,n){const o=Ed(e),i=e.unrotatedRect??e.rect,r=t.origin.x-i.origin.x,a=t.origin.y-i.origin.y;return{rect:dt(t,n,{x:o.x+r,y:o.y+a}),unrotatedRect:t}}function Nd(e,t,n){if(!e.unrotatedRect)return t;const o=e.rotation??0;if(Math.abs(o%360)<1e-8)return t;const i=Ed(e),r=st(n),a=o*Math.PI/180,s=Math.cos(a),l=Math.sin(a),c=i.x-r.x,d=i.y-r.y,u=(1-s)*c+l*d,h=-l*c+(1-s)*d;return Math.abs(u)<1e-8&&Math.abs(h)<1e-8?t:t.map(e=>({x:e.x+u,y:e.y+h}))}class Ld{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 _d=new Ld;function Fd(e,t){var n;if(void 0===(null==(n=t.metadata)?void 0:n.rotationAngle))return null;const o=t.metadata.rotationAngle,i=t.changes.unrotatedRect??e.unrotatedRect??e.rect;return{...Od(e,{origin:{...i.origin},size:{...i.size}},o),rotation:o}}function $d(e,t){return{rotation:t,...Od(e,e.unrotatedRect??e.rect,t)}}function jd(e,t){const n=t.origin.x-e.rect.origin.x,o=t.origin.y-e.rect.origin.y,i={rect:t};return e.unrotatedRect&&(i.unrotatedRect={origin:{x:e.unrotatedRect.origin.x+n,y:e.unrotatedRect.origin.y+o},size:{...e.unrotatedRect.size}}),{dx:n,dy:o,rects:i}}function Ud(e,t,n){const o=e.unrotatedRect??e.rect;let i=t.size.width/o.size.width,r=t.size.height/o.size.height;if((t.size.width<10||t.size.height<10)&&(i=Math.max(i,10/o.size.width),r=Math.max(r,10/o.size.height),t={origin:t.origin,size:{width:o.size.width*i,height:o.size.height*r}}),null==n?void 0:n.maintainAspectRatio){const e=Math.min(i,r);i=e,r=e,t={origin:t.origin,size:{width:o.size.width*e,height:o.size.height*e}}}return{scaleX:i,scaleY:r,oldRect:o,resolvedRect:t,rects:e.unrotatedRect?{unrotatedRect:t,rect:ut(t,e.rotation??0)}:{rect:t}}}function Bd(e,t){const n=e.unrotatedRect??e.rect,o=t.unrotatedRect??n;return{dx:o.origin.x-n.origin.x,dy:o.origin.y-n.origin.y}}function Wd(e,t,n){if(0===t||void 0!==e.rotation)return e;const o=(4-t)%4*90;let i=e;if(n&&(1===t||3===t)){const t=e.rect,n=t.origin.x+t.size.width/2,o=t.origin.y+t.size.height/2;i={...e,rect:{origin:{x:n-t.size.height/2,y:o-t.size.width/2},size:{width:t.size.height,height:t.size.width}}}}const{rotation:r,rect:a,unrotatedRect:s}=$d(i,o);return{...i,rotation:r,rect:a,unrotatedRect:s}}function Hd(e,t){const n=Po(e.rect.origin.x,0,t.width-e.rect.size.width),o=Po(e.rect.origin.y,0,t.height-e.rect.size.height),i=n-e.rect.origin.x,r=o-e.rect.origin.y;return 0===i&&0===r?e:{...e,rect:{origin:{x:n,y:o},size:e.rect.size},...e.unrotatedRect?{unrotatedRect:{origin:{x:e.unrotatedRect.origin.x+i,y:e.unrotatedRect.origin.y+r},size:e.unrotatedRect.size}}:{}}}const Gd=Object.freeze(Object.defineProperty({__proto__:null,LINE_ENDING_HANDLERS:Td,PatchRegistry:Ld,applyInsertUpright:Wd,calculateAABBFromVertices:function(e,t=0){if(0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};const n=Je(e);return t>0?et(n,t):n},calculateRotatedRectAABB:ut,calculateRotatedRectAABBAroundPoint:dt,clampAnnotationToPage:Hd,compensateRotatedVertexEdit:Nd,createEnding:function(e,t,n,o,i){if(!e)return null;const r=Td[e];if(!r)return null;const a=r.getRotation(n);return{d:r.getSvgPath(t),transform:`translate(${o} ${i}) rotate(${s=a,180*s/Math.PI})`,filled:r.filled};var s},getRectCenter:st,lineRectWithEndings:Rd,patchRegistry:_d,resolveAnnotationRotationCenter:Ed,resolveRotateRects:Od,resolveVertexEditRects:zd,rotatePointAroundCenter:lt,rotateVertices:ct},Symbol.toStringTag,{value:"Module"})),qd={annotationType:_t.TEXT,create(e){const{onCommit:t,getTool:n,pageSize:o}=e;return{onPointerDown:i=>{const r=n();if(!r)return;const a={origin:{x:i.x-12,y:i.y-12},size:{width:24,height:24}};let s={...r.defaults,rect:a,type:_t.TEXT,icon:r.defaults.icon??$t.Comment,contents:r.defaults.contents??"",flags:r.defaults.flags??["print","noRotate","noZoom"],pageIndex:e.pageIndex,id:$n(),created:new Date};s=Hd(s,o),t(s)}}}};function Vd({threshold:e=5,getTool:t,onClickDetected:n}){const[o,i]=Id(null),[r,a]=Id(!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 Kd={annotationType:_t.FREETEXT,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i,pageIndex:r,pageRotation:a}=e,[s,l]=Id(null),c=e=>({x:Po(e.x,0,i.width),y:Po(e.y,0,i.height)}),d=()=>{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??Dt.Helvetica,color:e.defaults.color??e.defaults.backgroundColor??"transparent",textAlign:e.defaults.textAlign??Pt.Left,verticalAlign:e.defaults.verticalAlign??Tt.Top,contents:e.defaults.contents??"Insert text here",flags:e.defaults.flags??["print"]}:null},u=Vd({threshold:5,getTool:o,onClickDetected:(e,n)=>{var o;const s=d();if(!s)return;const l=n.clickBehavior;if(!(null==l?void 0:l.enabled))return;const{width:c,height:u}=l.defaultSize,h={origin:{x:e.x-c/2,y:e.y-u/2},size:{width:c,height:u}},m=l.defaultContent??s.contents;let g={...s,contents:m,type:_t.FREETEXT,rect:h,pageIndex:r,id:$n(),created:new Date};(null==(o=n.behavior)?void 0:o.insertUpright)&&(g=Wd(g,a,!1)),g=Hd(g,i),t(g)}}),h=e=>{const t=s();if(!t)return null;const n=d();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:_t.FREETEXT,bounds:o,data:{...n,rect:o}}};return{onPointerDown:(e,t)=>{var o;const i=c(e);l(i),u.onStart(i),n(h(i)),null==(o=t.setPointerCapture)||o.call(t)},onPointerMove:e=>{const t=c(e);u.onMove(t),s()&&u.hasMoved()&&n(h(t))},onPointerUp:(i,r)=>{var h,m;const g=s();if(!g)return;const p=d();if(!p)return;const f=c(i);if(u.hasMoved()){const n={origin:{x:Math.min(g.x,f.x),y:Math.min(g.y,f.y)},size:{width:Math.abs(g.x-f.x),height:Math.abs(g.y-f.y)}},i=o();let r={...p,type:_t.FREETEXT,rect:n,pageIndex:e.pageIndex,id:$n(),created:new Date};(null==(h=null==i?void 0:i.behavior)?void 0:h.insertUpright)&&(r=Wd(r,a,!0)),t(r)}else u.onEnd(f);l(null),n(null),u.reset(),null==(m=r.releasePointerCapture)||m.call(r)},onPointerLeave:(e,t)=>{var o;l(null),n(null),u.reset(),null==(o=t.releasePointerCapture)||o.call(t)},onPointerCancel:(e,t)=>{var o;l(null),n(null),u.reset(),null==(o=t.releasePointerCapture)||o.call(t)}}}},Zd={annotationType:_t.LINE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:jt.None,end:jt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeStyle:e.defaults.strokeStyle??Ht.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],strokeColor:e.defaults.strokeColor??"#000000",flags:e.defaults.flags??["print"]}:null},d=Vd({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}),f=Rd([g,p],i.strokeWidth,i.lineEndings);n({...i,rect:f,linePoints:{start:g,end:p},pageIndex:t,id:$n(),created:new Date,type:_t.LINE})}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=Rd([t,e],n.strokeWidth,n.lineEndings);return{type:_t.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=Rd([u,h],e.strokeWidth,e.lineEndings);n({...e,rect:o,linePoints:{start:u,end:h},pageIndex:t,id:$n(),flags:["print"],created:new Date,type:_t.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)}}}},Xd={annotationType:_t.POLYLINE,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=Id([]),[s,l]=Id(null),c=e=>({x:Po(e.x,0,i.width),y:Po(e.y,0,i.height)}),d=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:jt.None,end:jt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??Ht.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=Rd(o,n.strokeWidth,n.lineEndings);return{type:_t.POLYLINE,bounds:i,data:{...n,rect:i,vertices:o,currentVertex:t}}};return{onClick:(e,t)=>{if(t.metaKey||t.ctrlKey)return;const o=c(e),i=r(),s=i[i.length-1];s&&Math.abs(s.x-o.x)<1&&Math.abs(s.y-o.y)<1||(a([...i,o]),l(o),n(u()))},onDoubleClick:()=>{(()=>{const o=r();if(o.length<2)return;const i=d();if(!i)return;const s=Rd(o,i.strokeWidth,i.lineEndings),c={...i,vertices:o,rect:s,type:_t.POLYLINE,pageIndex:e.pageIndex,id:$n(),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)}}}};function Yd(e,t,n,o){const i=o*Math.PI/180,r=Math.abs(Math.cos(i)),a=Math.abs(Math.sin(i)),s=r*r-a*a,l=e.size.width,c=e.size.height;let d,u;if(Math.abs(s)>1e-6)d=(r*l-a*c)/s,u=(r*c-a*l)/s,d=Math.max(d,1),u=Math.max(u,1);else{const e=t.size.width*t.size.height,o=l*c,i=e>0?Math.sqrt(o/e):1;d=n.size.width*i,u=n.size.height*i}return{origin:{x:e.origin.x+l/2-d/2,y:e.origin.y+c/2-u/2},size:{width:d,height:u}}}const Qd=Math.PI,Jd=Math.PI/2,eu=34*Math.PI/180,tu=30*Math.PI/180,nu=12*Math.PI/180;class ou{constructor(){this.parts=[],this.bbox={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},this.started=!1}moveTo(e,t){const n=-t;this.updateBBox(e,n),this.parts.push(`M ${iu(e)} ${iu(n)}`),this.started=!0}curveTo(e,t,n,o,i,r){const a=-t,s=-o,l=-r;this.updateBBox(e,a),this.updateBBox(n,s),this.updateBBox(i,l),this.parts.push(`C ${iu(e)} ${iu(a)}, ${iu(n)} ${iu(s)}, ${iu(i)} ${iu(l)}`)}close(){this.started&&this.parts.push("Z")}build(e){const t=e>0?e/2:0;return{path:this.parts.join(" "),bbox:{minX:this.bbox.minX-t,minY:this.bbox.minY-t,maxX:this.bbox.maxX+t,maxY:this.bbox.maxY+t}}}updateBBox(e,t){e<this.bbox.minX&&(this.bbox.minX=e),t<this.bbox.minY&&(this.bbox.minY=t),e>this.bbox.maxX&&(this.bbox.maxX=e),t>this.bbox.maxY&&(this.bbox.maxY=t)}}function iu(e){return Number(e.toFixed(4)).toString()}function ru(e,t){const n=t.x-e.x,o=t.y-e.y;return Math.sqrt(n*n+o*o)}function au(e,t){return 0===t?0:e/t}function su(e,t){return 0===t?0:e/t}function lu(e,t,n,o,i,r,a,s){const l=Math.cos(e),c=Math.sin(e),d=Math.cos(t),u=Math.sin(t),h=Math.sin((t-e)/2);if(0===h)return void(s&&a.moveTo(n+i*l,o+r*c));const m=4/3*(1-Math.cos((t-e)/2))/h,g=n+i*(l-m*c),p=o+r*(c+m*l),f=n+i*(d+m*u),v=o+r*(u-m*d),y=n+i*d,b=o+r*u;s&&a.moveTo(n+i*l,o+r*c),a.curveTo(g,p,f,v,y,b)}function cu(e,t,n,o,i,r){const a=Math.cos(e),s=Math.sin(e),l=Math.cos(t),c=Math.sin(t),d=Math.sin((t-e)/2);if(0===d)return[];const u=4/3*(1-Math.cos((t-e)/2))/d;return[{x:n+i*(a-u*s),y:o+r*(s+u*a)},{x:n+i*(l+u*c),y:o+r*(c-u*l)},{x:n+i*l,y:o+r*c}]}function du(e,t,n,o,i,r,a,s){const l=Jd;let c=t-e;for(;c<0;)c+=2*Math.PI;const d=c;let u=0;for(s&&a.moveTo(i+n*Math.cos(e),r+o*Math.sin(e));c>l;)lu(e+u,e+u+l,i,r,n,o,a,!1),u+=l,c-=l;c>0&&lu(e+u,e+d,i,r,n,o,a,!1)}function uu(e,t,n,o,i,r,a,s,l){let c=e+Qd+a;const d=e+Qd+a-22*Math.PI/180;lu(c,d,o,i,n,n,s,l),c=d;du(c,t-r,n,n,o,i,s,!1)}function hu(e,t,n,o,i,r){const a=e+Qd;lu(a+n,a+n-tu,o,i,t,t,r,!1),lu(a+n-tu,a+Jd,o,i,t,t,r,!1),lu(a+Jd,a+Qd-eu,o,i,t,t,r,!1)}function mu(e,t){const n=[],o=e+Qd;return n.push(...cu(o+eu,o+nu,0,0,t,t)),n.push(...cu(o+nu,o+Jd,0,0,t,t)),n.push(...cu(o+Jd,o+Qd-eu,0,0,t,t)),n}function gu(e,t,n,o){for(let i=0;i+2<e.length;i+=3){const r=e[i],a=e[i+1],s=e[i+2];o.curveTo(r.x+t,r.y+n,a.x+t,a.y+n,s.x+t,s.y+n)}}function pu(e,t,n){if(0===n)return{n:-1,adjustedRadius:e};const o=n-2*t*e;if(o<=0)return{n:0,adjustedRadius:e};const i=2*t*e,r=Math.max(1,Math.ceil(o/i));return{n:r,adjustedRadius:o/(2*r*t)}}function fu(e,t,n,o,i){let r=function(e){if(e.length<=2)return e;const t=[e[0]];for(let n=1;n<e.length;n++){const o=t[t.length-1],i=e[n];(Math.abs(i.x-o.x)>=.5||Math.abs(i.y-o.y)>=.5)&&t.push(i)}return t}(e);var a;(function(e){let t=0;const n=e.length;for(let o=0;o<n;o++){const i=(o+1)%n;t+=e[o].x*e[i].y-e[o].y*e[i].x}return t})(a=r)<0&&a.reverse();const s=r.length;if(s<2)return;if(n<=0){i.moveTo(r[0].x,r[0].y);for(let e=1;e<s;e++)i.curveTo(r[e].x,r[e].y,r[e].x,r[e].y,r[e].x,r[e].y);return}let l=t?vu(n,o):yu(n,o);l<.5&&(l=.5);const c=Math.cos(eu),d=[];for(let e=0;e+1<s;e++){const t=ru(r[e],r[e+1]);t<=0||t>=2*c*l?d.push(eu):d.push(Math.acos(Math.min(1,t/(2*l))))}let u=0,h=!1;for(let e=0;e+1<s;e++){const t=r[e],n=r[e+1],o=ru(t,n);if(0===o)continue;const a=pu(l,c,o);if(a.n<0){h||(i.moveTo(t.x,t.y),h=!0);continue}const m=Math.max(.5,a.adjustedRadius),g=2*c*m,p=c*l+c*m;let f=Math.atan2(n.y-t.y,n.x-t.x);if(0===e){const e=r[s-2];u=Math.atan2(t.y-e.y,t.x-e.x)}const v=au(n.x-t.x,o),y=su(n.y-t.y,o);let b=t.x,w=t.y;const x=d[e],k=d[0===e?s-2:e-1]??eu;if(uu(u,f,l,t.x,t.y,x,k,i,!h),h=!0,0===a.n)b+=o*v,w+=o*y;else{b+=p*v,w+=p*y;let e=a.n;a.n>=1&&(hu(f,m,eu,b,w,i),b+=g*v,w+=g*y,e=a.n-1);const t=mu(f,m);for(let n=0;n<e;n++)gu(t,b,w,i),b+=g*v,w+=g*y}u=f}}function vu(e,t){return 4.75*e+.5*t}function yu(e,t){return 4*e+.5*t}function bu(e,t,n,o,i,r,a){if(i<=0){const i=Math.abs(n-e)/2,r=Math.abs(o-t)/2,s=(e+n)/2,l=(t+o)/2;return void du(0,2*Math.PI,i,r,s,l,a,!0)}const s=n-e,l=o-t;let c=vu(i,r);const d=.5*c;if(s<d&&l<d){const i=Math.abs(n-e)/2,r=Math.abs(o-t)/2,s=(e+n)/2,l=(t+o)/2;return void du(0,2*Math.PI,i,r,s,l,a,!0)}if(s<5&&l>20||s>20&&l<5)return void fu([{x:e,y:t},{x:n,y:t},{x:n,y:o},{x:e,y:o},{x:e,y:t}],!0,i,r,a);const u=Math.sin(nu)*c-1.5;let h=e,m=n,g=t,p=o;if(s>2*u)h+=u,m-=u;else{const t=(e+n)/2;h=t-.1,m=t+.1}if(l>2*u)g+=u,p-=u;else{const e=(o+t)/2;p=e+.1,g=e-.1}const f=function(e,t,n,o){const i=(e+n)/2,r=(t+o)/2,a=(n-e)/2,s=(o-t)/2;if(a<=0||s<=0)return[];const l=Math.max(32,Math.ceil(2*Math.max(a,s))),c=[];for(let e=0;e<=l;e++){const t=2*Math.PI*e/l;c.push({x:i+a*Math.cos(t),y:r+s*Math.sin(t)})}return c}(h,g,m,p),v=f.length;if(v<2)return;let y=0;for(let e=1;e<v;e++)y+=ru(f[e-1],f[e]);const b=Math.cos(eu);let w=2*b*c,x=Math.ceil(y/w);if(x<2){const i=Math.abs(n-e)/2,r=Math.abs(o-t)/2,s=(e+n)/2,l=(t+o)/2;return void du(0,2*Math.PI,i,r,s,l,a,!0)}if(w=y/x,c=w/(2*b),c<.5)c=.5,w=2*b*c;else if(c<3){const i=Math.abs(n-e)/2,r=Math.abs(o-t)/2,s=(e+n)/2,l=(t+o)/2;return void du(0,2*Math.PI,i,r,s,l,a,!0)}const k=[];let C=0;const I=.1*r;for(let e=0;e+1<v;e++){const t=f[e],n=f[e+1],o=n.x-t.x,i=n.y-t.y,r=ru(t,n);if(0===r)continue;let a=r+C;if(a>=w-I||e===v-2){const e=au(o,r),n=su(i,r);let s=w-C;for(;a>=w-I;)k.push({x:t.x+s*e,y:t.y+s*n}),a-=w,s+=w;C=Math.max(0,a)}else C+=r}const S=k.length;let A=0,M=0;for(let e=0;e<S;e++){const t=(e+1)%S,n=k[e],o=k[t];if(0===e){const e=k[S-1];A=Math.atan2(n.y-e.y,n.x-e.x),M=wu(e,n,c,w)}const i=Math.atan2(o.y-n.y,o.x-n.x),r=wu(n,o,c,w);uu(A,i,c,n.x,n.y,r,M,a,0===e),A=i,M=r}}function wu(e,t,n,o){const i=ru(e,t);if(0===i)return eu;const r=(o/2+(i-o)/2)/n;return r<-1||r>1?0:Math.acos(r)}function xu(e,t,n){return(n?vu(e,t):yu(e,t))+t/2}const ku={annotationType:_t.POLYGON,create(e){const{onCommit:t,onPreview:n,getTool:o,scale:i,pageSize:r}=e,[a,s]=Id([]),[l,c]=Id(null),d=e=>({x:Po(e.x,0,r.width),y:Po(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??Ht.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=i.cloudyBorderIntensity??0,l=r>0?xu(r,i.strokeWidth,!1):i.strokeWidth/2,d=et(Je(o),l),h={...i,vertices:o,rect:d,type:_t.POLYGON,pageIndex:e.pageIndex,id:$n(),created:new Date,...r>0&&{rectangleDifferences:{left:l,top:l,right:l,bottom:l}}};t(h),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=n.cloudyBorderIntensity??0,i=o>0?xu(o,n.strokeWidth,!1):n.strokeWidth/2,r=et(Je([...e,t]),i);return{type:_t.POLYGON,bounds:r,data:{...n,rect:r,vertices:e,currentVertex:t}}};return{onClick:(e,t)=>{if(t.metaKey||t.ctrlKey)return;const o=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})(o)&&a().length>=3)return void h();const r=a(),l=r[r.length-1];l&&Math.abs(l.x-o.x)<1&&Math.abs(l.y-o.y)<1||(s([...r,o]),c(o),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)}}}},Cu={annotationType:_t.SQUARE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(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??Ht.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1}:null},d=Vd({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=Po(e.x-d,0,r.width-s),m=Po(e.y-u,0,r.height-l),g=i.strokeWidth,p=i.cloudyBorderIntensity??0,f=p>0?xu(p,g,!1):g/2,v={origin:{x:h-f,y:m-f},size:{width:s+2*f,height:l+2*f}},y={...i,type:_t.SQUARE,created:new Date,id:$n(),pageIndex:t,rect:v,...p>0&&{rectangleDifferences:{left:f,top:f,right:f,bottom:f}}};n(y)}}),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=s.cloudyBorderIntensity??0,u=d>0?xu(d,l,!1):l/2,h={origin:{x:n-u,y:o-u},size:{width:i+2*u,height:r+2*u}};return{type:_t.SQUARE,bounds:h,data:{rect:h,...s,...d>0&&{rectangleDifferences:{left:u,top:u,right:u,bottom:u}}}}};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.cloudyBorderIntensity??0,r=i>0?xu(i,e.strokeWidth,!1):void 0,a={...e,type:_t.SQUARE,created:new Date,id:$n(),pageIndex:t,rect:o.data.rect,...void 0!==r&&{rectangleDifferences:{left:r,top:r,right:r,bottom:r}}};n(a)}}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)}}}},Iu={annotationType:_t.STAMP,create(e){const{services:t,onCommit:n,getTool:o,pageSize:i,pageRotation:r}=e;return{onPointerDown:a=>{const s=o();if(!s)return;const{imageSrc:l,imageSize:c}=s.defaults,d=(t,o,l)=>{var c;const d={origin:{x:a.x-o/2,y:a.y-l/2},size:{width:o,height:l}};let u={...s.defaults,rect:d,type:_t.STAMP,icon:s.defaults.icon??$t.Draft,subject:s.defaults.subject??"Stamp",flags:s.defaults.flags??["print"],pageIndex:e.pageIndex,id:$n(),created:new Date};(null==(c=s.behavior)?void 0:c.insertUpright)&&(u=Wd(u,r,!1)),u=Hd(u,i),n(u,{imageData:t})};l?t.processImage({source:l,maxWidth:i.width,maxHeight:i.height,onComplete:e=>d(e.imageData,(null==c?void 0:c.width)??e.width,(null==c?void 0:c.height)??e.height)}):t.requestFile({accept:"image/png,image/jpeg",onFile:e=>{t.processImage({source:e,maxWidth:i.width,maxHeight:i.height,onComplete:e=>d(e.imageData,e.width,e.height)})}})}}}},Su={annotationType:_t.CIRCLE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(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??Ht.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},d=Vd({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=Po(e.x-d,0,r.width-s),m=Po(e.y-u,0,r.height-l),g=i.strokeWidth,p=i.cloudyBorderIntensity??0,f=p>0?xu(p,g,!0):g/2,v={origin:{x:h-f,y:m-f},size:{width:s+2*f,height:l+2*f}},y={...i,type:_t.CIRCLE,created:new Date,id:$n(),pageIndex:t,rect:v,...p>0&&{rectangleDifferences:{left:f,top:f,right:f,bottom:f}}};n(y)}}),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=s.cloudyBorderIntensity??0,u=d>0?xu(d,l,!0):l/2,h={origin:{x:n-u,y:o-u},size:{width:i+2*u,height:r+2*u}};return{type:_t.CIRCLE,bounds:h,data:{rect:h,...s,...d>0&&{rectangleDifferences:{left:u,top:u,right:u,bottom:u}}}}};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.cloudyBorderIntensity??0,r=i>0?xu(i,e.strokeWidth,!0):void 0,a={...e,type:_t.CIRCLE,flags:["print"],created:new Date,id:$n(),pageIndex:t,rect:o.data.rect,...void 0!==r&&{rectangleDifferences:{left:r,top:r,right:r,bottom:r}}};n(a)}}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)}}}},Au={annotationType:_t.LINK,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(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??"#0000FF",strokeStyle:e.defaults.strokeStyle??Ht.UNDERLINE,strokeDashArray:e.defaults.strokeDashArray??[]}:null},d=Vd({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={origin:{x:Po(e.x-d,0,r.width-s),y:Po(e.y-u,0,r.height-l)},size:{width:s,height:l}},m={...i,type:_t.LINK,target:void 0,created:new Date,id:$n(),pageIndex:t,rect:h};n(m)}}),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={origin:{x:n,y:o},size:{width:i,height:r}};return{type:_t.LINK,bounds:l,data:{rect:l,strokeColor:s.strokeColor,strokeWidth:s.strokeWidth,strokeStyle:s.strokeStyle,strokeDashArray:s.strokeDashArray}}};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;const h=c();if(!h)return;const m=l(e);if(d.hasMoved()){const e=u(m);if(e){const o={...h,type:_t.LINK,target:void 0,created:new Date,id:$n(),pageIndex:t,rect:e.data.rect};n(o)}}else d.onEnd(m);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)}}}},Mu={toolId:"__textMarkup__",handle(e,t,n){const o=e.getTool();if(o)for(const i of t){const t=$n();n().then(n=>{var r;e.createAnnotation(i.pageIndex,{...o.defaults,rect:i.rect,segmentRects:i.segmentRects,pageIndex:i.pageIndex,created:new Date,id:t,...null!=n&&{custom:{text:n}}}),(null==(r=o.behavior)?void 0:r.selectAfterCreate)&&e.selectAnnotation(i.pageIndex,t)})}}};function Du(e){const t=e.size.height,n=t/2,o=n;return{origin:{x:e.origin.x+e.size.width-o/2,y:e.origin.y+t/2},size:{width:o,height:n}}}const Pu={toolId:"insertText",handle(e,t,n){const o=e.getTool();if(!o)return;const i=()=>({strokeColor:o.defaults.strokeColor??"#E44234",opacity:o.defaults.opacity??1,flags:o.defaults.flags??["print"]});for(const r of t){const t=r.segmentRects[r.segmentRects.length-1];if(!t)continue;const a=Du(t),s=$n(),l=i();n().then(t=>{var n;e.createAnnotation(r.pageIndex,{type:_t.CARET,id:s,pageIndex:r.pageIndex,rect:a,strokeColor:l.strokeColor,opacity:l.opacity,intent:"Insert",rectangleDifferences:{left:.5,top:.5,right:.5,bottom:.5},created:new Date,flags:l.flags,...null!=t&&{custom:{text:t}}}),(null==(n=o.behavior)?void 0:n.selectAfterCreate)&&e.selectAnnotation(r.pageIndex,s)})}}},Tu={toolId:"replaceText",handle(e,t,n){const o=e.getTool();if(!o)return;const i=()=>({strokeColor:o.defaults.strokeColor??"#E44234",opacity:o.defaults.opacity??1,flags:o.defaults.flags??["print"]});for(const r of t){const t=r.segmentRects[r.segmentRects.length-1];if(!t)continue;const a=Du(t),s=$n(),l=$n(),c=i();n().then(t=>{var n;e.createAnnotation(r.pageIndex,{type:_t.CARET,id:s,pageIndex:r.pageIndex,rect:a,strokeColor:c.strokeColor,opacity:c.opacity,intent:"Replace",rectangleDifferences:{left:.5,top:.5,right:.5,bottom:.5},created:new Date,flags:c.flags}),e.createAnnotation(r.pageIndex,{type:_t.STRIKEOUT,id:l,pageIndex:r.pageIndex,rect:r.rect,segmentRects:r.segmentRects,strokeColor:c.strokeColor,opacity:c.opacity,intent:"StrikeOutTextEdit",inReplyToId:s,replyType:Ut.Group,created:new Date,flags:c.flags,...null!=t&&{custom:{text:t}}}),(null==(n=o.behavior)?void 0:n.selectAfterCreate)&&e.selectAnnotation(r.pageIndex,s)})}}},Ru=(e,t)=>{switch(t.type){case"vertex-edit":default:return t.changes;case"move":{if(!t.changes.rect)return t.changes;const{dx:n,dy:o,rects:i}=jd(e,t.changes.rect);return{...i,inkList:e.inkList.map(e=>({points:e.points.map(e=>({x:e.x+n,y:e.y+o}))}))}}case"resize":{if(!t.changes.rect)return t.changes;const{scaleX:n,scaleY:o,oldRect:i,resolvedRect:r,rects:a}=Ud(e,t.changes.rect,t.metadata),s=(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)}}),l=.001,c=Math.abs(n-1)>l,d=Math.abs(o-1)>l,u=c&&!d?n:!c&&d?o:Math.min(n,o),h=Math.max(1,e.strokeWidth*u),m=Math.max(1,Math.min(r.size.width,r.size.height)),g=Math.min(h,m),p=Number(g.toFixed(1)),f=s(i,e.strokeWidth/2),v=s(r,p/2),y=v.size.width/Math.max(f.size.width,1e-6),b=v.size.height/Math.max(f.size.height,1e-6);return{...a,inkList:e.inkList.map(e=>({points:e.points.map(e=>({x:v.origin.x+(e.x-f.origin.x)*y,y:v.origin.y+(e.y-f.origin.y)*b}))})),strokeWidth:p}}case"rotate":{const n=Fd(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Bd(e,n);return{...n,inkList:e.inkList.map(e=>({points:e.points.map(e=>({x:e.x+o,y:e.y+i}))}))}}case"property-update":{if(!(void 0!==t.changes.strokeWidth||void 0!==t.changes.rotation))return t.changes;const n={...e,...t.changes},o=n.inkList.flatMap(e=>e.points),i=et(Je(o),n.strokeWidth/2),r=t.changes.rotation??e.rotation??0;return e.unrotatedRect||void 0!==t.changes.rotation?{...t.changes,unrotatedRect:i,rect:dt(i,r,Ed(e))}:{...t.changes,rect:i}}}},zu=(e,t)=>{switch(t.type){case"vertex-edit":if(t.changes.linePoints){const{start:n,end:o}=t.changes.linePoints,i=[n,o],r=Nd(e,i,Rd(i,e.strokeWidth,e.lineEndings));return{...zd(e,Rd(r,e.strokeWidth,e.lineEndings)),linePoints:{start:r[0],end:r[1]}}}return t.changes;case"move":{if(!t.changes.rect)return t.changes;const{dx:n,dy:o,rects:i}=jd(e,t.changes.rect);return{...i,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}}}}case"resize":{if(!t.changes.rect)return t.changes;const{scaleX:n,scaleY:o,oldRect:i,resolvedRect:r,rects:a}=Ud(e,t.changes.rect,t.metadata);return{...a,linePoints:{start:{x:r.origin.x+(e.linePoints.start.x-i.origin.x)*n,y:r.origin.y+(e.linePoints.start.y-i.origin.y)*o},end:{x:r.origin.x+(e.linePoints.end.x-i.origin.x)*n,y:r.origin.y+(e.linePoints.end.y-i.origin.y)*o}}}}case"rotate":{const n=Fd(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Bd(e,n);return{...n,linePoints:{start:{x:e.linePoints.start.x+o,y:e.linePoints.start.y+i},end:{x:e.linePoints.end.x+o,y:e.linePoints.end.y+i}}}}case"property-update":{if(!(void 0!==t.changes.strokeWidth||void 0!==t.changes.lineEndings||void 0!==t.changes.rotation))return t.changes;const n={...e,...t.changes},o=Rd([n.linePoints.start,n.linePoints.end],n.strokeWidth,n.lineEndings),i=t.changes.rotation??e.rotation??0;return e.unrotatedRect||void 0!==t.changes.rotation?{...t.changes,unrotatedRect:o,rect:dt(o,i,Ed(e))}:{...t.changes,rect:o}}default:return t.changes}};function Eu(e,t){return(e??0)>0?xu(e,t,!1):t/2}const Ou=[{id:"highlight",name:"Highlight",labelKey:"annotation.highlight",categories:["annotation","markup"],matchScore:e=>e.type===_t.HIGHLIGHT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isRotatable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.HIGHLIGHT,strokeColor:"#FFCD45",color:"#FFCD45",opacity:1,blendMode:Rt.Multiply}},{id:"underline",name:"Underline",labelKey:"annotation.underline",categories:["annotation","markup"],matchScore:e=>e.type===_t.UNDERLINE?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isRotatable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.UNDERLINE,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"strikeout",name:"Strikeout",labelKey:"annotation.strikeout",categories:["annotation","markup"],matchScore:e=>e.type===_t.STRIKEOUT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isRotatable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.STRIKEOUT,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"squiggly",name:"Squiggly",labelKey:"annotation.squiggly",categories:["annotation","markup"],matchScore:e=>e.type===_t.SQUIGGLY?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isRotatable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.SQUIGGLY,strokeColor:"#E44234",color:"#E44234",opacity:1}}],Nu=[{id:"insertText",name:"Insert Text",labelKey:"annotation.insertText",categories:["annotation","markup"],matchScore:e=>{var t;return e.type!==_t.CARET?0:(null==(t=e.intent)?void 0:t.includes("Insert"))?2:1},interaction:{exclusive:!1,textSelection:!0,showSelectionRects:!0,isDraggable:!1,isResizable:!1,isRotatable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.CARET,strokeColor:"#E44234",opacity:1,intent:"Insert"},selectionHandler:Pu}],Lu=[{id:"replaceText",name:"Replace Text",labelKey:"annotation.replaceText",categories:["annotation","markup"],matchScore:e=>{var t,n;return e.type===_t.STRIKEOUT&&(null==(t=e.intent)?void 0:t.includes("StrikeOutTextEdit"))||e.type===_t.CARET&&(null==(n=e.intent)?void 0:n.includes("Replace"))?2:0},interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isRotatable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.STRIKEOUT,strokeColor:"#E44234",opacity:1,intent:"StrikeOutTextEdit"},selectionHandler:Tu}],_u=[{id:"ink",name:"Pen",labelKey:"annotation.ink",categories:["annotation","markup"],matchScore:e=>e.type===_t.INK&&"InkHighlight"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1},defaults:{type:_t.INK,strokeColor:"#E44234",color:"#E44234",opacity:1,strokeWidth:6},behavior:{commitDelay:800},transform:Ru,pointerHandler:Sd},{id:"inkHighlighter",name:"Ink Highlighter",labelKey:"annotation.inkHighlighter",categories:["annotation","markup"],matchScore:e=>e.type===_t.INK&&"InkHighlight"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.INK,intent:"InkHighlight",strokeColor:"#FFCD45",color:"#FFCD45",opacity:1,strokeWidth:14,blendMode:Rt.Multiply},behavior:{commitDelay:800,smartLineRecognition:!0,smartLineThreshold:.15},transform:Ru,pointerHandler:Sd}],Fu=[{id:"circle",name:"Circle",labelKey:"annotation.circle",categories:["annotation","shape"],matchScore:e=>e.type===_t.CIRCLE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.CIRCLE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:Ht.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}},transform:(e,t)=>{switch(t.type){case"move":return t.changes.rect?jd(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?Ud(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Fd(e,t)??t.changes;case"property-update":{let n=t.changes;const o=void 0!==t.changes.cloudyBorderIntensity,i=void 0!==t.changes.strokeWidth,r=(e.cloudyBorderIntensity??0)>0;if(o||i&&r){const o={...e,...t.changes},i=o.cloudyBorderIntensity??0;if(i>0){const e=xu(i,o.strokeWidth,!0);n={...n,rectangleDifferences:{left:e,top:e,right:e,bottom:e}}}else n={...n,rectangleDifferences:void 0}}return void 0!==t.changes.rotation&&(n={...n,...$d(e,t.changes.rotation)}),n}default:return t.changes}},pointerHandler:Su}],$u=[{id:"square",name:"Square",labelKey:"annotation.square",categories:["annotation","shape"],matchScore:e=>e.type===_t.SQUARE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.SQUARE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",strokeStyle:Ht.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}},transform:(e,t)=>{switch(t.type){case"move":return t.changes.rect?jd(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?Ud(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Fd(e,t)??t.changes;case"property-update":{let n=t.changes;const o=void 0!==t.changes.cloudyBorderIntensity,i=void 0!==t.changes.strokeWidth,r=(e.cloudyBorderIntensity??0)>0;if(o||i&&r){const o={...e,...t.changes},i=o.cloudyBorderIntensity??0;if(i>0){const e=xu(i,o.strokeWidth,!1);n={...n,rectangleDifferences:{left:e,top:e,right:e,bottom:e}}}else n={...n,rectangleDifferences:void 0}}return void 0!==t.changes.rotation&&(n={...n,...$d(e,t.changes.rotation)}),n}default:return t.changes}},pointerHandler:Cu}],ju=[{id:"line",name:"Line",labelKey:"annotation.line",categories:["annotation","shape"],matchScore:e=>e.type===_t.LINE&&"LineArrow"!==e.intent?5:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.LINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0},transform:zu,pointerHandler:Zd},{id:"lineArrow",name:"Arrow",labelKey:"annotation.arrow",categories:["annotation","shape"],matchScore:e=>e.type===_t.LINE&&"LineArrow"===e.intent?10:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.LINE,intent:"LineArrow",color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234",lineEndings:{start:jt.None,end:jt.OpenArrow}},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0},transform:zu,pointerHandler:Zd}],Uu=[{id:"polyline",name:"Polyline",labelKey:"annotation.polyline",categories:["annotation","shape"],matchScore:e=>e.type===_t.POLYLINE?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.POLYLINE,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"},transform:(e,t)=>{switch(t.type){case"vertex-edit":if(t.changes.vertices&&t.changes.vertices.length){const n=t.changes.vertices,o=Nd(e,n,Rd(n,e.strokeWidth,e.lineEndings));return{...zd(e,Rd(o,e.strokeWidth,e.lineEndings)),vertices:o}}return t.changes;case"move":{if(!t.changes.rect)return t.changes;const{dx:n,dy:o,rects:i}=jd(e,t.changes.rect);return{...i,vertices:e.vertices.map(e=>({x:e.x+n,y:e.y+o}))}}case"resize":{if(!t.changes.rect)return t.changes;const{scaleX:n,scaleY:o,oldRect:i,resolvedRect:r,rects:a}=Ud(e,t.changes.rect,t.metadata);return{...a,vertices:e.vertices.map(e=>({x:r.origin.x+(e.x-i.origin.x)*n,y:r.origin.y+(e.y-i.origin.y)*o}))}}case"rotate":{const n=Fd(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Bd(e,n);return{...n,vertices:e.vertices.map(e=>({x:e.x+o,y:e.y+i}))}}case"property-update":{if(!(void 0!==t.changes.strokeWidth||void 0!==t.changes.lineEndings||void 0!==t.changes.rotation))return t.changes;const n={...e,...t.changes},o=Rd(n.vertices,n.strokeWidth,n.lineEndings),i=t.changes.rotation??e.rotation??0;return e.unrotatedRect||void 0!==t.changes.rotation?{...t.changes,unrotatedRect:o,rect:dt(o,i,Ed(e))}:{...t.changes,rect:o}}default:return t.changes}},pointerHandler:Xd}],Bu=[{id:"polygon",name:"Polygon",labelKey:"annotation.polygon",categories:["annotation","shape"],matchScore:e=>e.type===_t.POLYGON?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,lockAspectRatio:!1,isGroupResizable:!0,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.POLYGON,color:"transparent",opacity:1,strokeWidth:6,strokeColor:"#E44234"},transform:(e,t)=>{switch(t.type){case"vertex-edit":if(t.changes.vertices&&t.changes.vertices.length){const n=Eu(e.cloudyBorderIntensity,e.strokeWidth),o=t.changes.vertices,i=Nd(e,o,et(Je(o),n));return{...zd(e,et(Je(i),n)),vertices:i}}return t.changes;case"move":{if(!t.changes.rect)return t.changes;const{dx:n,dy:o,rects:i}=jd(e,t.changes.rect);return{...i,vertices:e.vertices.map(e=>({x:e.x+n,y:e.y+o}))}}case"resize":{if(!t.changes.rect)return t.changes;const{scaleX:n,scaleY:o,oldRect:i,resolvedRect:r,rects:a}=Ud(e,t.changes.rect,t.metadata);return{...a,vertices:e.vertices.map(e=>({x:r.origin.x+(e.x-i.origin.x)*n,y:r.origin.y+(e.y-i.origin.y)*o}))}}case"rotate":{const n=Fd(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Bd(e,n);return{...n,vertices:e.vertices.map(e=>({x:e.x+o,y:e.y+i}))}}case"property-update":{const n=void 0!==t.changes.cloudyBorderIntensity;if(!(void 0!==t.changes.strokeWidth||void 0!==t.changes.rotation||n))return t.changes;const o={...e,...t.changes},i=Eu(o.cloudyBorderIntensity,o.strokeWidth),r=et(Je(o.vertices),i);let a=t.changes;const s=(e.cloudyBorderIntensity??0)>0;if(n||void 0!==t.changes.strokeWidth&&s){const e=o.cloudyBorderIntensity??0;if(e>0){const t=xu(e,o.strokeWidth,!1);a={...a,rectangleDifferences:{left:t,top:t,right:t,bottom:t}}}else a={...a,rectangleDifferences:void 0}}const l=t.changes.rotation??e.rotation??0;return e.unrotatedRect||void 0!==t.changes.rotation?{...a,unrotatedRect:r,rect:dt(r,l,Ed(e))}:{...a,rect:r}}default:return t.changes}},pointerHandler:ku}],Wu=[{id:"textComment",name:"Comment",labelKey:"annotation.text",categories:["annotation","markup"],matchScore:e=>e.type!==_t.TEXT||e.inReplyToId?0:1,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!1,isRotatable:!1},defaults:{type:_t.TEXT,strokeColor:"#FFCD45",opacity:1},behavior:{selectAfterCreate:!0},pointerHandler:qd}],Hu=[{id:"freeText",name:"Free Text",labelKey:"annotation.freeText",categories:["annotation","markup"],matchScore:e=>e.type===_t.FREETEXT?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,lockAspectRatio:!1,lockGroupAspectRatio:e=>{const t=((e.rotation??0)%90+90)%90;return t>=6&&t<=84}},defaults:{type:_t.FREETEXT,contents:"Insert text",fontSize:14,fontColor:"#E44234",fontFamily:Dt.Helvetica,textAlign:Pt.Left,verticalAlign:Tt.Top,color:"transparent",backgroundColor:"transparent",opacity:1},clickBehavior:{enabled:!0,defaultSize:{width:100,height:20},defaultContent:"Insert text"},behavior:{insertUpright:!0,editAfterCreate:!0,selectAfterCreate:!0},transform:(e,t)=>{switch(t.type){case"move":return t.changes.rect?jd(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?Ud(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Fd(e,t)??t.changes;case"property-update":return void 0!==t.changes.rotation?{...t.changes,...$d(e,t.changes.rotation)}:t.changes;default:return t.changes}},pointerHandler:Kd}],Gu=[{id:"stamp",name:"Image",labelKey:"annotation.stamp",categories:["annotation","markup"],matchScore:e=>e.type===_t.STAMP?1:0,interaction:{exclusive:!1,cursor:"copy",isDraggable:!0,isResizable:!0,lockAspectRatio:!0,lockGroupAspectRatio:!0},defaults:{type:_t.STAMP},behavior:{insertUpright:!0,useAppearanceStream:!1},transform:(e,t)=>{switch(t.type){case"move":return t.changes.rect?jd(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?Ud(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Fd(e,t)??t.changes;case"property-update":return void 0!==t.changes.rotation?{...t.changes,...$d(e,t.changes.rotation)}:t.changes;default:return t.changes}},pointerHandler:Iu}],qu=[{id:"link",name:"Link",labelKey:"annotation.link",categories:["annotation","markup"],matchScore:e=>e.type===_t.LINK?1:0,interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,isRotatable:!1},defaults:{type:_t.LINK,strokeColor:"#0000FF",strokeWidth:2,strokeStyle:Ht.UNDERLINE},clickBehavior:{enabled:!0,defaultSize:{width:100,height:20}},pointerHandler:Au}],Vu=[...Ou,...Nu,...Lu,..._u,...Fu,...$u,...ju,...Uu,...Bu,...Wu,...Hu,...Gu,...qu],Ku=["#E44234","#FF8D00","#FFCD45","#5CC96E","#25D2D1","#597CE2","#C544CE","#7D2E25","#000000","#FFFFFF"],Zu=e=>1===e.length?e[0]:null,Xu=e=>({pages:{},byUid:{},selectedUids:[],selectedUid:null,activeToolId:null,hasPendingChanges:!1,locked:(null==e?void 0:e.locked)??{type:ld.None}}),Yu=(e,t,n)=>{const o=e.byUid[t];return o?{...e,byUid:{...e.byUid,[t]:{...o,commitState:"synced"===o.commitState||"moved"===o.commitState?"dirty":o.commitState,object:{...o.object,...n},dictMode:!0}},hasPendingChanges:!0}:e},Qu=(e,t,n)=>{const o=e.byUid[t];return o?{...e,byUid:{...e.byUid,[t]:{...o,commitState:"synced"===o.commitState?"moved":o.commitState,object:{...o.object,...n}}},hasPendingChanges:!0}:e},Ju=class e extends So{constructor(e,t,n){var o,i,r,a;super(e,t),this.ANNOTATION_HISTORY_TOPIC="annotations",this.state$=Lo((e,t)=>({documentId:e,state:t})),this.pendingContexts=new Map,this.isInitialLoadComplete=new Map,this.importQueue=new Map,this.commitInProgress=new Map,this.activeTool$=Lo((e,t)=>({documentId:e,tool:t})),this.events$=Lo((e,t)=>t,{cache:!1}),this.toolsChange$=No(),this.appearanceCache=new Map,this.unifiedDragStates=new Map,this.unifiedDrag$=No(),this.unifiedResizeStates=new Map,this.unifiedResize$=No(),this.unifiedRotateStates=new Map,this.unifiedRotate$=No(),this.navigate$=Lo((e,t)=>t,{cache:!1}),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.scroll=(null==(r=t.getPlugin("scroll"))?void 0:r.provides())??null,this.interactionManager=(null==(a=t.getPlugin("interaction-manager"))?void 0:a.provides())??null}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:zc,payload:{documentId:e,state:t}}}(e,Xu(this.config))),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,{showSelectionRects:e.interaction.showSelectionRects??!1,enableSelection:!0,enableMarquee:!1})}onDocumentClosed(e){this.dispatch(function(e){return{type:Ec,payload:e}}(e)),this.pendingContexts.delete(e),this.isInitialLoadComplete.delete(e),this.importQueue.delete(e),this.appearanceCache.delete(e),this.state$.clearScope(e),this.activeTool$.clearScope(e),this.events$.clearScope(e),this.navigate$.clearScope(e),this.logger.debug("AnnotationPlugin","DocumentClosed",`Cleaned up annotation state for document: ${e}`)}async initialize(){var e,t,n;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(nd(e.documentId,o))}),null==(t=this.selection)||t.onMarqueeEnd(({documentId:e,pageIndex:t,rect:n,modeId:o})=>{if("pointerMode"!==o)return;const i=this.state.documents[e];if(!i)return;const r=(i.pages[t]??[]).map(e=>i.byUid[e]).filter(e=>void 0!==e).filter(e=>hd(e)).filter(e=>function(e,t){return!(e.origin.x+e.size.width<t.origin.x||t.origin.x+t.size.width<e.origin.x||e.origin.y+e.size.height<t.origin.y||t.origin.y+t.size.height<e.origin.y)}(n,e.object.rect)).filter(t=>!this.isAnnotationLocked(t.object,e)).map(e=>e.object.id);if(r.length>0){const t=new Set;for(const n of r)if(this.isInGroupMethod(n,e)){const o=this.getGroupMembersMethod(n,e);for(const e of o)t.add(e.object.id)}else t.add(n);this.setSelectionMethod([...t],e)}}),null==(n=this.selection)||n.onEndSelection(({documentId:e})=>{var t,n,o,i;if(!this.checkPermission(e,on.ModifyAnnotations))return;const r=this.getActiveTool(e);if(!r||!r.interaction.textSelection)return;const a=null==(t=this.selection)?void 0:t.getFormattedSelection(),s=null==(n=this.selection)?void 0:n.getSelectedText();if(!a||!s)return;const l={toolId:r.id,documentId:e,getTool:()=>this.getActiveTool(e)??null,createAnnotation:(t,n)=>this.createAnnotation(t,n,void 0,e),selectAnnotation:(t,n)=>this.selectAnnotation(t,n,e)};(r.selectionHandler??Mu).handle(l,a,()=>new Promise(e=>{s.wait(t=>e(t.join("\n")),()=>e(void 0))})),(null==(o=r.behavior)?void 0:o.deactivateToolAfterCreate)&&this.setActiveTool(null,e),null==(i=this.selection)||i.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(),getSelectedAnnotations:()=>this.getSelectedAnnotationsMethod(),getSelectedAnnotationIds:()=>this.getSelectedAnnotationIdsMethod(),getAnnotationById:e=>this.getAnnotationById(e),selectAnnotation:(e,t)=>this.selectAnnotation(e,t),toggleSelection:(e,t)=>this.toggleSelectionMethod(e,t),addToSelection:(e,t)=>this.addToSelectionMethod(e,t),removeFromSelection:e=>this.removeFromSelectionMethod(e),setSelection:e=>this.setSelectionMethod(e),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),updateAnnotations:e=>this.updateAnnotationsMethod(e),moveAnnotation:(e,t,n,o,i)=>this.moveAnnotationMethod(e,t,n,o,i),deleteAnnotation:(e,t)=>this.deleteAnnotation(e,t),deleteAnnotations:(e,t)=>this.deleteAnnotationsMethod(e,t),purgeAnnotation:(e,t,n)=>this.purgeAnnotationMethod(e,t,n),renderAnnotation:e=>this.renderAnnotation(e),getPageAppearances:(e,t,n)=>this.getPageAppearances(e,t,n),invalidatePageAppearances:(e,t)=>this.invalidatePageAppearances(e,t),commit:()=>this.commit(),getAttachedLinks:(e,t)=>this.getAttachedLinksMethod(e,t),hasAttachedLinks:(e,t)=>this.hasAttachedLinksMethod(e,t),deleteAttachedLinks:(e,t)=>this.deleteAttachedLinksMethod(e,t),groupAnnotations:e=>this.groupAnnotationsMethod(e),ungroupAnnotations:(e,t)=>this.ungroupAnnotationsMethod(e,t),getGroupMembers:(e,t)=>this.getGroupMembersMethod(e,t),isInGroup:(e,t)=>this.isInGroupMethod(e,t),setLocked:(e,t)=>this.setLocked(e,t),getLocked:e=>this.getLocked(e),isAnnotationLocked:(e,t)=>this.isAnnotationLocked(e,t),isCategoryLocked:(e,t)=>this.isCategoryLockedMethod(e,t),isToolLocked:(e,t)=>this.isToolLockedMethod(e,t),syncAnnotationObject:(e,t,n)=>this.syncAnnotationObject(e,t,n),navigateTarget:(e,t)=>this.navigateTargetMethod(e,t),forDocument:e=>this.createAnnotationScope(e),getTools:()=>this.state.tools,getTool:e=>this.getTool(e),addTool:e=>{this.dispatch((e=>({type:Yc,payload:e}))(e)),this.registerInteractionForTool(e)},findToolForAnnotation:e=>this.findToolForAnnotation(e),setToolDefaults:(e,t)=>this.dispatch(((e,t)=>({type:Xc,payload:{toolId:e,patch:t}}))(e,t)),getColorPresets:()=>[...this.state.colorPresets],addColorPreset:e=>this.dispatch((e=>({type:Zc,payload:e}))(e)),transformAnnotation:(e,t)=>this.transformAnnotation(e,t),onStateChange:this.state$.onGlobal,onActiveToolChange:this.activeTool$.onGlobal,onAnnotationEvent:this.events$.onGlobal,onToolsChange:this.toolsChange$.on,onNavigate:this.navigate$.onGlobal}}createAnnotationScope(e){return{getState:()=>this.getDocumentState(e),getPageAnnotations:t=>this.getPageAnnotations(t,e),getSelectedAnnotation:()=>this.getSelectedAnnotation(e),getSelectedAnnotations:()=>this.getSelectedAnnotationsMethod(e),getSelectedAnnotationIds:()=>this.getSelectedAnnotationIdsMethod(e),getAnnotationById:t=>this.getAnnotationById(t,e),selectAnnotation:(t,n)=>this.selectAnnotation(t,n,e),toggleSelection:(t,n)=>this.toggleSelectionMethod(t,n,e),addToSelection:(t,n)=>this.addToSelectionMethod(t,n,e),removeFromSelection:t=>this.removeFromSelectionMethod(t,e),setSelection:t=>this.setSelectionMethod(t,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),updateAnnotations:t=>this.updateAnnotationsMethod(t,e),moveAnnotation:(t,n,o,i)=>this.moveAnnotationMethod(t,n,o,i,e),deleteAnnotation:(t,n)=>this.deleteAnnotation(t,n,e),deleteAnnotations:t=>this.deleteAnnotationsMethod(t,e),purgeAnnotation:(t,n)=>this.purgeAnnotationMethod(t,n,e),renderAnnotation:t=>this.renderAnnotation(t,e),getPageAppearances:(t,n)=>this.getPageAppearances(t,n,e),invalidatePageAppearances:t=>this.invalidatePageAppearances(t,e),commit:()=>this.commit(e),getAttachedLinks:t=>this.getAttachedLinksMethod(t,e),hasAttachedLinks:t=>this.hasAttachedLinksMethod(t,e),deleteAttachedLinks:t=>this.deleteAttachedLinksMethod(t,e),groupAnnotations:()=>this.groupAnnotationsMethod(e),ungroupAnnotations:t=>this.ungroupAnnotationsMethod(t,e),getGroupMembers:t=>this.getGroupMembersMethod(t,e),isInGroup:t=>this.isInGroupMethod(t,e),getGroupingAction:()=>this.getGroupingActionMethod(e),setLocked:t=>this.setLocked(t,e),getLocked:()=>this.getLocked(e),isAnnotationLocked:t=>this.isAnnotationLocked(t,e),isCategoryLocked:t=>this.isCategoryLockedMethod(t,e),isToolLocked:t=>this.isToolLockedMethod(t,e),syncAnnotationObject:(t,n)=>this.syncAnnotationObject(t,n,e),navigateTarget:t=>this.navigateTargetMethod(t,e),onStateChange:this.state$.forScope(e),onAnnotationEvent:this.events$.forScope(e),onActiveToolChange:this.activeTool$.forScope(e),onNavigate:this.navigate$.forScope(e)}}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.state$.emit(n,i),o&&o.activeToolId!==i.activeToolId&&this.activeTool$.emit(n,this.getActiveTool(n)),(null==o?void 0:o.selectedUids)!==i.selectedUids&&this.updateAnnotationSelectionActivity(n,i))}if(e.tools!==t.tools){for(const e in t.documents)this.activeTool$.emit(e,this.getActiveTool(e));this.toolsChange$.emit({tools:t.tools})}}transformAnnotation(e,t){const n={type:t.type,changes:t.changes,metadata:t.metadata},o=this.findToolForAnnotation(e);return(null==o?void 0:o.transform)?o.transform(e,n):n.changes}registerPageHandlers(t,n,o,i){var r,a;const s=this.getCoreDocument(t),l=null==(r=null==s?void 0:s.document)?void 0:r.pages[n];if(!l)return()=>{};if(!this.interactionManager)return()=>{};const c=[],d=((l.rotation??0)+((null==s?void 0:s.rotation)??0))%4;for(const r of this.state.tools){const s=r.pointerHandler??((null==(a=r.defaults)?void 0:a.type)?e.defaultHandlerFactories.get(r.defaults.type):void 0);if(!s)continue;const u={pageIndex:n,pageSize:l.size,pageRotation:d,scale:o,services:i.services,onPreview:e=>i.onPreview(r.id,e),onCommit:(e,o)=>{var i,a,s;const l=(null==(i=r.behavior)?void 0:i.editAfterCreate)??!1;this.createAnnotation(n,e,o,t,{editAfterCreate:l}),(null==(a=r.behavior)?void 0:a.deactivateToolAfterCreate)&&this.setActiveTool(null,t),((null==(s=r.behavior)?void 0:s.selectAfterCreate)||l)&&this.selectAnnotation(n,e.id,t)},getTool:()=>this.state.tools.find(e=>e.id===r.id)},h=this.interactionManager.registerHandlers({documentId:t,modeId:r.interaction.mode??r.id,handlers:s.create(u),pageIndex:n});c.push(h)}return()=>c.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:Oc,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(e,{type:"loaded",documentId:e,total:Object.values(t).reduce((e,t)=>e+t.length,0)})},Bn)}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 ln.reject({code:sn.NotFound,message:"Document not found"});const a=r.pages.find(e=>e.index===n);return a?this.engine.getPageAnnotations(r,a):ln.reject({code:sn.NotFound,message:"Page not found"})}getSelectedAnnotation(e){return(e=>e.selectedUids.length>0?e.byUid[e.selectedUids[0]]??null:null)(this.getDocumentState(e))}getAnnotationById(e,t){return((e,t)=>e.byUid[t]??null)(this.getDocumentState(t),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 ln.reject({code:sn.NotFound,message:"Document not found"});const s=a.pages.find(t=>t.index===e);return s?this.engine.renderPageAnnotation(a,s,t,n):ln.reject({code:sn.NotFound,message:"Page not found"})}getPageAppearances(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getCoreDocument(o),r=null==i?void 0:i.document;if(!r)return ln.reject({code:sn.NotFound,message:"Document not found"});const a=r.pages.find(t=>t.index===e);if(!a)return ln.reject({code:sn.NotFound,message:"Page not found"});let s=this.appearanceCache.get(o);s||(s=new Map,this.appearanceCache.set(o,s));const l=s.get(e);if(l&&!t){const e=new kt;return e.resolve(l),e}const c=this.engine.renderPageAnnotations(r,a,t),d=new kt;return c.wait(t=>{s.set(e,t),d.resolve(t)},e=>{d.fail(e)}),d}invalidatePageAppearances(e,t){const n=t??this.getActiveDocumentId(),o=this.appearanceCache.get(n);o&&o.delete(e)}invalidateAnnotationAppearance(e,t,n){const o=n??this.getActiveDocumentId(),i=this.appearanceCache.get(o);if(!i)return;const r=i.get(t);r&&delete r[e]}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(od(e,r,t)),i&&n.set(a,i)}!1!==this.config.autoCommit&&this.commit(e)}}createAnnotation(e,t,n,o,i){const r=o??this.getActiveDocumentId();if(!this.checkPermission(r,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","CreateAnnotation",`Cannot create annotation: document ${r} lacks ModifyAnnotations permission`);const a=t.id,s=this.pendingContexts.get(r);if(!s)return;const l={...t,author:t.author??this.config.annotationAuthor},c=null==i?void 0:i.editAfterCreate,d=()=>{this.dispatch(od(r,e,l)),n&&s.set(a,n),this.events$.emit(r,{type:"create",documentId:r,annotation:l,pageIndex:e,ctx:n,committed:!1,editAfterCreate:c})};if(!this.history)return d(),void(this.config.autoCommit&&this.commit(r));const u={execute:d,undo:()=>{s.delete(a),this.dispatch(Qc(r)),this.dispatch(ad(r,e,a)),this.events$.emit(r,{type:"delete",documentId:r,annotation:l,pageIndex:e,committed:!1})},metadata:{annotationIds:[a]}};this.history.forDocument(r).register(u,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();if(!this.checkPermission(i,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","UpdateAnnotation",`Cannot update annotation: document ${i} lacks ModifyAnnotations permission`);const r=this.getDocumentState(i).byUid[t].object,a=this.buildPatch(r,{...n,author:n.author??this.config.annotationAuthor}),s=()=>{this.dispatch(id(i,e,t,a)),this.events$.emit(i,{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(id(i,e,t,l)),this.events$.emit(i,{type:"update",documentId:i,annotation:r,pageIndex:e,patch:l,committed:!1})},metadata:{annotationIds:[t]}};this.history.forDocument(i).register(c,this.ANNOTATION_HISTORY_TOPIC)}deleteAnnotation(e,t,n){var o;const i=n??this.getActiveDocumentId();if(!this.checkPermission(i,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","DeleteAnnotation",`Cannot delete annotation: document ${i} lacks ModifyAnnotations permission`);const r=this.getDocumentState(i),a=null==(o=r.byUid[t])?void 0:o.object;if(!a)return;const s=((e,t)=>{const n=[];for(const o of Object.values(e.pages))for(const i of o){const o=e.byUid[i];o&&"inReplyToId"in o.object&&o.object.inReplyToId===t&&n.push({id:o.object.id,pageIndex:o.object.pageIndex})}return n})(r,t),l=s.map(e=>{var t;return null==(t=r.byUid[e.id])?void 0:t.object}).filter(e=>void 0!==e),c=()=>{var n;for(const e of s){const t=null==(n=r.byUid[e.id])?void 0:n.object;t&&(this.dispatch(ad(i,e.pageIndex,e.id)),this.events$.emit(i,{type:"delete",documentId:i,annotation:t,pageIndex:e.pageIndex,committed:!1}))}this.dispatch(Qc(i)),this.dispatch(ad(i,e,t)),this.events$.emit(i,{type:"delete",documentId:i,annotation:a,pageIndex:e,committed:!1})};if(!this.history)return c(),void(!1!==this.config.autoCommit&&this.commit(i));const d={execute:c,undo:()=>{this.dispatch(od(i,e,a)),this.events$.emit(i,{type:"create",documentId:i,annotation:a,pageIndex:e,committed:!1});for(const e of l)this.dispatch(od(i,e.pageIndex,e)),this.events$.emit(i,{type:"create",documentId:i,annotation:e,pageIndex:e.pageIndex,committed:!1})},metadata:{annotationIds:[t,...s.map(e=>e.id)]}};this.history.forDocument(i).register(d,this.ANNOTATION_HISTORY_TOPIC)}deleteAnnotationsMethod(e,t){for(const{pageIndex:n,id:o}of e)this.deleteAnnotation(n,o,t)}purgeAnnotationMethod(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(sd(o,e,t))}selectAnnotation(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getAnnotationById(t,o);if(!i||!this.isAnnotationLocked(i.object,o))if(this.isInGroupMethod(t,o)){const e=this.getGroupMembersMethod(t,o).map(e=>e.object.id);this.dispatch(td(o,e))}else this.dispatch(((e,t,n)=>({type:Nc,payload:{documentId:e,pageIndex:t,id:n}}))(o,e,t))}deselectAnnotation(e){const t=e??this.getActiveDocumentId();this.dispatch(Qc(t))}updateAnnotationSelectionActivity(e,t){var n,o;if(0===t.selectedUids.length)return void(null==(n=this.interactionManager)||n.releasePageActivity(e,"annotation-selection"));const i=t.selectedUids[0],r=t.byUid[i];r&&(null==(o=this.interactionManager)||o.claimPageActivity(e,"annotation-selection",r.object.pageIndex))}getSelectedAnnotationsMethod(e){return vd(this.getDocumentState(e))}getSelectedAnnotationIdsMethod(e){return yd(this.getDocumentState(e))}toggleSelectionMethod(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getAnnotationById(t,o);if(i&&this.isAnnotationLocked(i.object,o))return;const r=this.getDocumentState(o);if(r.selectedUids.includes(t))this.dispatch(ed(o,t));else if(this.isInGroupMethod(t,o)){const e=this.getGroupMembersMethod(t,o);for(const t of e)r.selectedUids.includes(t.object.id)||this.dispatch(Jc(o,t.object.pageIndex,t.object.id))}else this.dispatch(Jc(o,e,t))}addToSelectionMethod(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getAnnotationById(t,o);i&&this.isAnnotationLocked(i.object,o)||this.dispatch(Jc(o,e,t))}removeFromSelectionMethod(e,t){const n=t??this.getActiveDocumentId();this.dispatch(ed(n,e))}setSelectionMethod(e,t){const n=t??this.getActiveDocumentId(),o=this.getDocumentState(n),i=e.filter(e=>{const t=o.byUid[e];return!t||!this.isAnnotationLocked(t.object,n)});this.dispatch(td(n,i))}getAttachedLinksMethod(e,t){return wd(this.getDocumentState(t),e)}hasAttachedLinksMethod(e,t){return this.getAttachedLinksMethod(e,t).length>0}deleteAttachedLinksMethod(e,t){const n=this.getAttachedLinksMethod(e,t);for(const e of n)this.deleteAnnotation(e.object.pageIndex,e.object.id,t)}groupAnnotationsMethod(e){const t=e??this.getActiveDocumentId();if(!this.checkPermission(t,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","GroupAnnotations",`Cannot group annotations: document ${t} lacks ModifyAnnotations permission`);const n=this.getSelectedAnnotationsMethod(t);if(n.length<2)return void this.logger.debug("AnnotationPlugin","GroupAnnotations","Need at least 2 annotations to group");const o=n[0],i=n.slice(1).map(e=>({pageIndex:e.object.pageIndex,id:e.object.id,patch:{inReplyToId:o.object.id,replyType:Ut.Group}}));this.updateAnnotationsMethod(i,t)}ungroupAnnotationsMethod(e,t){const n=t??this.getActiveDocumentId();if(!this.checkPermission(n,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","UngroupAnnotations",`Cannot ungroup annotations: document ${n} lacks ModifyAnnotations permission`);const o=this.getGroupMembersMethod(e,n).filter(e=>e.object.inReplyToId&&e.object.replyType===Ut.Group).map(e=>({pageIndex:e.object.pageIndex,id:e.object.id,patch:{inReplyToId:void 0,replyType:void 0}}));o.length>0&&this.updateAnnotationsMethod(o,n)}getGroupMembersMethod(e,t){return kd(this.getDocumentState(t),e)}isInGroupMethod(e,t){return Cd(this.getDocumentState(t),e)}getGroupingActionMethod(e){return(e=>{const t=vd(e);if(0===t.length)return"disabled";const n=t[0].object.id;if(Cd(e,n)){const o=kd(e,n),i=new Set(o.map(e=>e.object.id));if(t.every(e=>i.has(e.object.id)))return"ungroup"}return t.length>=2?"group":"disabled"})(this.getDocumentState(e))}computeCombinedConstraints(e){let t=1/0,n=1/0,o=1/0,i=1/0;for(const r of e){const e=r.rect.origin.y,a=r.pageSize.height-(r.rect.origin.y+r.rect.size.height),s=r.rect.origin.x,l=r.pageSize.width-(r.rect.origin.x+r.rect.size.width);t=Math.min(t,e),n=Math.min(n,a),o=Math.min(o,s),i=Math.min(i,l)}return isFinite(t)||(t=0),isFinite(n)||(n=0),isFinite(o)||(o=0),isFinite(i)||(i=0),{maxUp:t,maxDown:n,maxLeft:o,maxRight:i}}clampDelta(e,t){return{x:Math.max(-t.maxLeft,Math.min(t.maxRight,e.x)),y:Math.max(-t.maxUp,Math.min(t.maxDown,e.y))}}startDrag(e,t){const{annotationIds:n,pageSize:o}=t,i=[];for(const t of n){const n=this.getAttachedLinksMethod(t,e);for(const e of n)i.includes(e.object.id)||i.push(e.object.id)}const r=[...n,...i],a=new Map,s=[];for(const t of r){const n=this.getAnnotationById(t,e);n&&(a.set(t,{...n.object.rect}),s.push({id:t,rect:n.object.rect,pageIndex:n.object.pageIndex,pageSize:o}))}const l={documentId:e,isDragging:!0,primaryIds:n,attachedLinkIds:i,allParticipantIds:r,originalRects:a,delta:{x:0,y:0},combinedConstraints:this.computeCombinedConstraints(s)};this.unifiedDragStates.set(e,l),this.unifiedDrag$.emit({documentId:e,type:"start",state:l,previewPatches:{}})}computeDragPreviewPatches(e,t){const n={};for(const o of e.allParticipantIds){const i=this.getAnnotationById(o,t);if(!i)continue;const r=e.originalRects.get(o);if(!r)continue;const a={...r,origin:{x:r.origin.x+e.delta.x,y:r.origin.y+e.delta.y}};n[o]=this.transformAnnotation(i.object,{type:"move",changes:{rect:a}})}return n}updateDrag(e,t){const n=this.unifiedDragStates.get(e);if(!(null==n?void 0:n.isDragging))return{x:0,y:0};const o=this.clampDelta(t,n.combinedConstraints),i={...n,delta:o};this.unifiedDragStates.set(e,i);const r=this.computeDragPreviewPatches(i,e);return this.unifiedDrag$.emit({documentId:e,type:"update",state:i,previewPatches:r}),o}commitDrag(e){const t=this.unifiedDragStates.get(e);if(!t)return;const n=t.delta;if(0!==n.x||0!==n.y){const o=[];for(const i of t.allParticipantIds){const r=this.getAnnotationById(i,e);if(!r)continue;const a=t.originalRects.get(i)??r.object.rect,s={...a,origin:{x:a.origin.x+n.x,y:a.origin.y+n.y}},l=this.transformAnnotation(r.object,{type:"move",changes:{rect:s}});o.push({pageIndex:r.object.pageIndex,id:i,patch:l})}o.length>0&&this.moveAnnotationsMethod(o,e)}const o=this.computeDragPreviewPatches(t,e);this.unifiedDrag$.emit({documentId:e,type:"end",state:{...t,isDragging:!1},previewPatches:o}),this.unifiedDragStates.delete(e)}cancelDrag(e){const t=this.unifiedDragStates.get(e);t&&(this.unifiedDrag$.emit({documentId:e,type:"cancel",state:{...t,isDragging:!1,delta:{x:0,y:0}},previewPatches:{}}),this.unifiedDragStates.delete(e))}getDragState(e){return this.unifiedDragStates.get(e)??null}get onDragChange(){return this.unifiedDrag$.on}computeUnifiedGroupBoundingBox(e){if(0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};let t=1/0,n=1/0,o=-1/0,i=-1/0;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}}}computeUnifiedRelativePositions(e,t){return e.map(e=>({id:e.id,originalRect:e.rect,originalUnrotatedRect:e.unrotatedRect,pageIndex:e.pageIndex,isAttachedLink:e.isAttachedLink,parentId:e.parentId,relativeX:t.size.width>0?(e.rect.origin.x-t.origin.x)/t.size.width:0,relativeY:t.size.height>0?(e.rect.origin.y-t.origin.y)/t.size.height:0,relativeWidth:t.size.width>0?e.rect.size.width/t.size.width:1,relativeHeight:t.size.height>0?e.rect.size.height/t.size.height:1}))}computeUnifiedResizedRects(e,t,n=10){const o=new Map;for(const i of e){const e=Math.max(n,i.relativeWidth*t.size.width),r=Math.max(n,i.relativeHeight*t.size.height);o.set(i.id,{origin:{x:t.origin.x+i.relativeX*t.size.width,y:t.origin.y+i.relativeY*t.size.height},size:{width:e,height:r}})}return o}computeResizePreviewPatches(e,t){const n={},o=this.unifiedResizeStates.get(t),i=o?new Map(o.participatingAnnotations.map(e=>[e.id,e])):void 0;for(const[r,a]of e){const e=this.getAnnotationById(r,t);if(!e)continue;let s=a;const l=null==i?void 0:i.get(r);(null==o?void 0:o.isGroupResize)&&(null==l?void 0:l.originalUnrotatedRect)&&(s=Yd(a,l.originalRect,l.originalUnrotatedRect,e.object.rotation??0)),n[r]=this.transformAnnotation(e.object,{type:"resize",changes:{rect:s}})}return n}startResize(e,t){const{annotationIds:n,pageSize:o,resizeHandle:i}=t,r=[],a=[];for(const t of n){const n=this.getAnnotationById(t,e);if(n){a.push({id:t,rect:n.object.rect,unrotatedRect:n.object.unrotatedRect?this.cloneRect(n.object.unrotatedRect):void 0,pageIndex:n.object.pageIndex,isAttachedLink:!1});const o=this.getAttachedLinksMethod(t,e);for(const e of o)r.includes(e.object.id)||(r.push(e.object.id),a.push({id:e.object.id,rect:e.object.rect,unrotatedRect:e.object.unrotatedRect?this.cloneRect(e.object.unrotatedRect):void 0,pageIndex:e.object.pageIndex,isAttachedLink:!0,parentId:t}))}}const s=[...n,...r],l=a.map(e=>e.rect),c=this.computeUnifiedGroupBoundingBox(l),d=this.computeUnifiedRelativePositions(a,c),u=this.computeUnifiedResizedRects(d,c),h={documentId:e,isResizing:!0,isGroupResize:n.length>1,primaryIds:n,attachedLinkIds:r,allParticipantIds:s,originalGroupBox:c,currentGroupBox:c,participatingAnnotations:d,resizeHandle:i,computedRects:u};this.unifiedResizeStates.set(e,h);const m=this.computeResizePreviewPatches(u,e);this.unifiedResize$.emit({documentId:e,type:"start",state:h,computedRects:Object.fromEntries(u),previewPatches:m})}updateResize(e,t){const n=this.unifiedResizeStates.get(e);if(!(null==n?void 0:n.isResizing))return{};const o=this.computeUnifiedResizedRects(n.participatingAnnotations,t),i={...n,currentGroupBox:t,computedRects:o};this.unifiedResizeStates.set(e,i);const r=Object.fromEntries(o),a=this.computeResizePreviewPatches(o,e);return this.unifiedResize$.emit({documentId:e,type:"update",state:i,computedRects:r,previewPatches:a}),r}commitResize(e){const t=this.unifiedResizeStates.get(e);if(!t)return;const n=this.computeUnifiedResizedRects(t.participatingAnnotations,t.currentGroupBox),o=[],i=new Map(t.participatingAnnotations.map(e=>[e.id,e]));for(const[r,a]of n){const n=this.getAnnotationById(r,e);if(!n)continue;let s=a;const l=i.get(r);t.isGroupResize&&(null==l?void 0:l.originalUnrotatedRect)&&(s=Yd(a,l.originalRect,l.originalUnrotatedRect,n.object.rotation??0));const c=this.transformAnnotation(n.object,{type:"resize",changes:{rect:s}});o.push({pageIndex:n.object.pageIndex,id:r,patch:c})}o.length>0&&this.updateAnnotationsMethod(o,e);const r=this.computeResizePreviewPatches(n,e);this.unifiedResize$.emit({documentId:e,type:"end",state:{...t,isResizing:!1},computedRects:Object.fromEntries(n),previewPatches:r}),this.unifiedResizeStates.delete(e)}cancelResize(e){const t=this.unifiedResizeStates.get(e);if(!t)return;const n=this.computeUnifiedResizedRects(t.participatingAnnotations,t.originalGroupBox);this.unifiedResize$.emit({documentId:e,type:"cancel",state:{...t,isResizing:!1,currentGroupBox:t.originalGroupBox},computedRects:Object.fromEntries(n),previewPatches:{}}),this.unifiedResizeStates.delete(e)}getResizeState(e){return this.unifiedResizeStates.get(e)??null}get onResizeChange(){return this.unifiedResize$.on}cloneRect(e){return{origin:{x:e.origin.x,y:e.origin.y},size:{width:e.size.width,height:e.size.height}}}translateRect(e,t){return{origin:{x:e.origin.x+t.x,y:e.origin.y+t.y},size:{...e.size}}}normalizeAngle(e){const t=e%360;return t<0?t+360:t}normalizeDelta(e){return(e+540)%360-180}buildRotationParticipants(e,t){const n=[],o=[];for(const i of e){const e=this.getAnnotationById(i,t);if(!e)continue;n.push({id:i,rect:this.cloneRect(e.object.rect),pageIndex:e.object.pageIndex,rotation:e.object.rotation??0,unrotatedRect:e.object.unrotatedRect?this.cloneRect(e.object.unrotatedRect):void 0,isAttachedLink:!1});const r=this.getAttachedLinksMethod(i,t);for(const e of r)o.includes(e.object.id)||(o.push(e.object.id),n.push({id:e.object.id,rect:this.cloneRect(e.object.rect),pageIndex:e.object.pageIndex,rotation:e.object.rotation??0,unrotatedRect:e.object.unrotatedRect?this.cloneRect(e.object.unrotatedRect):void 0,isAttachedLink:!0,parentId:i}))}return{participants:n,attachedLinkIds:o}}computeRotatePreviewPatches(e,t){const n={};for(const o of e.participants){const i=this.getAnnotationById(o.id,t);if(!i)continue;const r=Ed({rect:o.rect,unrotatedRect:o.unrotatedRect,rotation:o.rotation}),a=lt(r,e.rotationCenter,e.delta),s={x:a.x-r.x,y:a.y-r.y},l=this.normalizeAngle(o.rotation+e.delta),c=this.transformAnnotation(i.object,{type:"rotate",changes:{rotation:l,unrotatedRect:this.translateRect(o.unrotatedRect??o.rect,s)},metadata:{rotationAngle:l,rotationDelta:e.delta,rotationCenter:e.rotationCenter}});c.rect||0===s.x&&0===s.y||(c.rect={origin:{x:i.object.rect.origin.x+s.x,y:i.object.rect.origin.y+s.y},size:{...i.object.rect.size}}),n[o.id]=c}return n}startRotation(e,t){const{annotationIds:n,cursorAngle:o,rotationCenter:i}=t,{participants:r,attachedLinkIds:a}=this.buildRotationParticipants(n,e);if(0===r.length)return;const s=r.map(e=>e.rect),l=this.computeUnifiedGroupBoundingBox(s),c=i??{x:l.origin.x+l.size.width/2,y:l.origin.y+l.size.height/2},d={documentId:e,isRotating:!0,primaryIds:n,attachedLinkIds:a,allParticipantIds:r.map(e=>e.id),rotationCenter:c,cursorStartAngle:o,currentAngle:o,delta:0,participants:r};this.unifiedRotateStates.set(e,d);const u=this.computeRotatePreviewPatches(d,e);this.unifiedRotate$.emit({documentId:e,type:"start",state:d,previewPatches:u})}updateRotation(e,t,n){const o=this.unifiedRotateStates.get(e);if(!(null==o?void 0:o.isRotating))return;const i=void 0!==n?n:this.normalizeDelta(t-o.cursorStartAngle),r={...o,currentAngle:t,delta:i};this.unifiedRotateStates.set(e,r);const a=this.computeRotatePreviewPatches(r,e);this.unifiedRotate$.emit({documentId:e,type:"update",state:r,previewPatches:a})}commitRotation(e){const t=this.unifiedRotateStates.get(e);if(!t)return;const n=this.computeRotatePreviewPatches(t,e),o=[];for(const[t,i]of Object.entries(n)){const n=this.getAnnotationById(t,e);n&&o.push({pageIndex:n.object.pageIndex,id:t,patch:i})}o.length>0&&this.updateAnnotationsMethod(o,e),this.unifiedRotate$.emit({documentId:e,type:"end",state:{...t,isRotating:!1},previewPatches:n}),this.unifiedRotateStates.delete(e)}cancelRotation(e){const t=this.unifiedRotateStates.get(e);t&&(this.unifiedRotate$.emit({documentId:e,type:"cancel",state:{...t,isRotating:!1,delta:0,currentAngle:t.cursorStartAngle},previewPatches:{}}),this.unifiedRotateStates.delete(e))}getRotateState(e){return this.unifiedRotateStates.get(e)??null}get onRotateChange(){return this.unifiedRotate$.on}updateAnnotationsMethod(e,t){const n=t??this.getActiveDocumentId();if(!this.checkPermission(n,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","UpdateAnnotations",`Cannot update annotations: document ${n} lacks ModifyAnnotations permission`);const o=this.getDocumentState(n),i=e.map(({pageIndex:e,id:t,patch:n})=>{var i;const r=null==(i=o.byUid[t])?void 0:i.object;if(!r)return null;return{pageIndex:e,id:t,patch:this.buildPatch(r,{...n,author:n.author??this.config.annotationAuthor}),originalObject:r}}).filter(e=>null!==e);if(0===i.length)return;const r=()=>{for(const{pageIndex:e,id:t,patch:o,originalObject:r}of i)this.dispatch(id(n,e,t,o)),this.events$.emit(n,{type:"update",documentId:n,annotation:r,pageIndex:e,patch:o,committed:!1})};if(!this.history)return r(),void(!1!==this.config.autoCommit&&this.commit(n));const a=i.map(({pageIndex:e,id:t,patch:n,originalObject:o})=>({pageIndex:e,id:t,originalPatch:Object.fromEntries(Object.keys(n).map(e=>[e,o[e]])),originalObject:o})),s={execute:r,undo:()=>{for(const{pageIndex:e,id:t,originalPatch:o,originalObject:i}of a)this.dispatch(id(n,e,t,o)),this.events$.emit(n,{type:"update",documentId:n,annotation:i,pageIndex:e,patch:o,committed:!1})},metadata:{annotationIds:i.map(e=>e.id)}};this.history.forDocument(n).register(s,this.ANNOTATION_HISTORY_TOPIC)}moveAnnotationsMethod(e,t){const n=t??this.getActiveDocumentId();if(!this.checkPermission(n,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","MoveAnnotations",`Cannot move annotations: document ${n} lacks ModifyAnnotations permission`);const o=this.getDocumentState(n),i=e.map(({pageIndex:e,id:t,patch:n})=>{var i;const r=null==(i=o.byUid[t])?void 0:i.object;return r?{pageIndex:e,id:t,patch:n,originalObject:r}:null}).filter(e=>null!==e);if(0===i.length)return;const r=()=>{for(const{pageIndex:e,id:t,patch:o,originalObject:r}of i)this.dispatch(rd(n,e,t,o)),this.events$.emit(n,{type:"update",documentId:n,annotation:r,pageIndex:e,patch:o,committed:!1})};if(!this.history)return r(),void(!1!==this.config.autoCommit&&this.commit(n));const a=i.map(({pageIndex:e,id:t,patch:n,originalObject:o})=>({pageIndex:e,id:t,originalPatch:Object.fromEntries(Object.keys(n).map(e=>[e,o[e]])),originalObject:o})),s={execute:r,undo:()=>{for(const{pageIndex:e,id:t,originalPatch:o,originalObject:i}of a)this.dispatch(rd(n,e,t,o)),this.events$.emit(n,{type:"update",documentId:n,annotation:i,pageIndex:e,patch:o,committed:!1})},metadata:{annotationIds:i.map(e=>e.id)}};this.history.forDocument(n).register(s,this.ANNOTATION_HISTORY_TOPIC)}moveAnnotationMethod(e,t,n,o="delta",i){const r=i??this.getActiveDocumentId(),a=this.getAnnotationById(t,r);if(!a)return;const s=a.object.rect,l={...s,origin:"absolute"===o?{x:n.x,y:n.y}:{x:s.origin.x+n.x,y:s.origin.y+n.y}},c=this.transformAnnotation(a.object,{type:"move",changes:{rect:l}});this.moveAnnotationsMethod([{pageIndex:e,id:t,patch:c}],r)}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();if(null!==e&&!this.checkPermission(i,on.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","SetActiveTool",`Cannot activate tool: document ${i} lacks ModifyAnnotations permission`);const r=this.getDocumentState(i);if(e===r.activeToolId)return;this.dispatch(nd(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}setLocked(e,t){const n=t??this.getActiveDocumentId();this.dispatch(((e,t)=>({type:Vc,payload:{documentId:e,mode:t}}))(n,e));const o=this.getDocumentState(n),i=o.selectedUids.filter(e=>{const t=o.byUid[e];return!!t&&this.isAnnotationLocked(t.object,n)});if(i.length>0){const e=o.selectedUids.filter(e=>!i.includes(e));this.dispatch(td(n,e))}}getLocked(e){return this.getDocumentState(e).locked}isAnnotationLocked(e,t){if(pd(e))return!0;return gd(md(this.findToolForAnnotation(e)),this.getLocked(t))}isCategoryLockedMethod(e,t){return gd([e],this.getLocked(t))}isToolLockedMethod(e,t){const n=this.getTool(e);if(!n)return!1;return gd(md(n),this.getLocked(t))}syncAnnotationObject(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(((e,t,n)=>({type:Kc,payload:{documentId:e,id:t,patch:n}}))(o,e,t))}navigateTargetMethod(e,t){var n;const o=t??this.getActiveDocumentId(),i=t=>(this.navigate$.emit(o,{documentId:o,result:t,target:e}),ln.resolve(t));let r;if("destination"===e.type)r=e.destination;else if("action"===e.type){const t=e.action;if(t.type!==Et.Goto&&t.type!==Et.RemoteGoto)return t.type===Et.URI?i({outcome:"uri",uri:t.uri}):i({outcome:"unsupported"});r=t.destination}if(!r)return i({outcome:"unsupported"});if(!this.scroll)return i({outcome:"destination",destination:r});const a=this.scroll.forDocument(o);if(r.zoom.mode===At.XYZ){const e=this.getCoreDocument(o),t=null==(n=null==e?void 0:e.document)?void 0:n.pages.find(e=>e.index===r.pageIndex);a.scrollToPage({pageNumber:r.pageIndex+1,pageCoordinates:t&&r.zoom.params?{x:r.zoom.params.x,y:t.size.height-r.zoom.params.y}:void 0,behavior:"smooth"})}else a.scrollToPage({pageNumber:r.pageIndex+1,behavior:"smooth"});return i({outcome:"navigated"})}collectPendingChanges(e,t){const n=this.getDocumentState(e),o=this.pendingContexts.get(e),i={creations:[],updates:[],deletions:[],committedUids:[],isEmpty:!0};for(const[e,r]of Object.entries(n.byUid)){if("synced"===r.commitState)continue;const n=t.pages.find(e=>e.index===r.object.pageIndex);if(n)switch(i.committedUids.push(e),i.isEmpty=!1,r.commitState){case"new":i.creations.push({uid:e,ta:r,ctx:null==o?void 0:o.get(r.object.id)});break;case"moved":i.updates.push({uid:e,ta:r,moved:!0});break;case"dirty":i.updates.push({uid:e,ta:r});break;case"deleted":i.deletions.push({uid:e,ta:r})}}return i}executeCommitBatch(e,t,n){const o=new kt,i=this.pendingContexts.get(e),r=[];for(const{uid:e,ta:o,ctx:i}of n.creations){const n=t.pages.find(e=>e.index===o.object.pageIndex);if(!n)continue;const a=this.engine.createPageAnnotation(t,n,o.object,i);r.push({type:"create",task:a,ta:o,uid:e,ctx:i})}for(const{uid:e,ta:o,moved:i}of n.updates){const n=t.pages.find(e=>e.index===o.object.pageIndex);if(!n)continue;const a=i?this.engine.updatePageAnnotation(t,n,o.object,{regenerateAppearance:!1}):this.engine.updatePageAnnotation(t,n,o.object);r.push({type:"update",task:a,ta:o,uid:e,moved:i})}for(const{uid:o,ta:i}of n.deletions){const n=t.pages.find(e=>e.index===i.object.pageIndex);if(n)if(i.object.id){const e=new kt;this.engine.removePageAnnotation(t,n,i.object).wait(()=>e.resolve(!0),e.fail),r.push({type:"delete",task:e,ta:i,uid:o})}else this.dispatch(sd(e,i.object.pageIndex,o))}const a=r.map(e=>e.task);return kt.allSettled(a).wait(()=>{this.emitCommitEvents(e,r,i);for(const t of r)"update"===t.type&&t.moved||"create"!==t.type&&"update"!==t.type&&"delete"!==t.type||this.invalidateAnnotationAppearance(t.ta.object.id,t.ta.object.pageIndex,e);var t,a;this.dispatch((t=e,a=n.committedUids,{type:Gc,payload:{documentId:t,committedUids:a}})),o.resolve(!0)},e=>o.fail(e)),o}emitCommitEvents(e,t,n){for(const o of t)if(o.task.state.stage===bt.Resolved)switch(o.type){case"create":this.events$.emit(e,{type:"create",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,ctx:o.ctx,committed:!0}),null==n||n.delete(o.ta.object.id);break;case"update":this.events$.emit(e,{type:"update",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,patch:o.ta.object,committed:!0});break;case"delete":this.dispatch(sd(e,o.ta.object.pageIndex,o.uid)),this.events$.emit(e,{type:"delete",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,committed:!0})}}acquireCommitLock(e){return!this.commitInProgress.get(e)&&(this.commitInProgress.set(e,!0),!0)}releaseCommitLock(e){this.commitInProgress.set(e,!1)}commit(e){const t=e??this.getActiveDocumentId();if(!this.getDocumentState(t).hasPendingChanges)return ln.resolve(!0);if(!this.acquireCommitLock(t))return ln.resolve(!0);const n=this.getCoreDocument(t),o=null==n?void 0:n.document;if(!o)return this.releaseCommitLock(t),ln.reject({code:sn.NotFound,message:"Document not found"});const i=this.collectPendingChanges(t,o);if(i.isEmpty)return this.releaseCommitLock(t),ln.resolve(!0);const r=new kt;return this.executeCommitBatch(t,o,i).wait(()=>{this.releaseCommitLock(t);this.getDocumentState(t).hasPendingChanges?this.commit(t).wait(e=>r.resolve(e),e=>r.fail(e)):r.resolve(!0)},e=>{this.releaseCommitLock(t),r.fail(e)}),r}};Ju.id="annotation",Ju.defaultHandlerFactories=new Map([[_t.CIRCLE,Su],[_t.SQUARE,Cu],[_t.STAMP,Iu],[_t.POLYGON,ku],[_t.POLYLINE,Xd],[_t.LINE,Zd],[_t.INK,Sd],[_t.FREETEXT,Kd],[_t.TEXT,qd],[_t.LINK,Au]]);let eh=Ju;function th(e,t,n){return void 0===e?n:"function"==typeof e?e(t):e}function nh(e){return t=>(null==t?void 0:t.id)===e}const oh=nh("highlight"),ih=nh("squiggly"),rh=nh("underline"),ah=nh("strikeout"),sh={manifest:Rc,create:(e,t)=>new eh(Tc,e,t),reducer:(e,t)=>{switch(t.type){case zc:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Ec:{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 Oc:{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 Nc:{const{documentId:n,id:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUids:[o],selectedUid:o}}}:e}case Lc:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selectedUids:[],selectedUid:null}}}:e}case _c:{const{documentId:n,id:o}=t.payload,i=e.documents[n];if(!i)return e;if(i.selectedUids.includes(o))return e;const r=[...i.selectedUids,o];return{...e,documents:{...e.documents,[n]:{...i,selectedUids:r,selectedUid:Zu(r)}}}}case Fc:{const{documentId:n,id:o}=t.payload,i=e.documents[n];if(!i)return e;const r=i.selectedUids.filter(e=>e!==o);return{...e,documents:{...e.documents,[n]:{...i,selectedUids:r,selectedUid:Zu(r)}}}}case $c:{const{documentId:n,ids:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUids:o,selectedUid:Zu(o)}}}:e}case jc:{const{documentId:n,toolId:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeToolId:o}}}:e}case Uc:{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,dictMode:!0}},hasPendingChanges:!0}}}}case Hc:{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 Bc:{const{documentId:n,id:o,patch:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:Yu(r,o,i)}}:e}case Wc:{const{documentId:n,id:o,patch:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:Qu(r,o,i)}}:e}case Gc:{const{documentId:n,committedUids:o}=t.payload,i=e.documents[n];if(!i)return e;const r=new Set(o),a={};let s=!1;for(const[e,t]of Object.entries(i.byUid))r.has(e)?a[e]={...t,commitState:"dirty"===t.commitState||"new"===t.commitState||"moved"===t.commitState?"synced":t.commitState}:(a[e]=t,"new"!==t.commitState&&"dirty"!==t.commitState&&"moved"!==t.commitState&&"deleted"!==t.commitState||(s=!0));return{...e,documents:{...e.documents,[n]:{...i,byUid:a,hasPendingChanges:s}}}}case qc:{const{documentId:n,pageIndex:o,uid:i}=t.payload,r=e.documents[n];if(!r||!r.byUid[i])return e;const{[i]:a,...s}=r.byUid;return{...e,documents:{...e.documents,[n]:{...r,pages:{...r.pages,[o]:(r.pages[o]??[]).filter(e=>e!==i)},byUid:s}}}}case Vc:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,locked:o}}}:e}case Kc:{const{documentId:n,id:o,patch:i}=t.payload,r=e.documents[n];if(!r)return e;const a=r.byUid[o];return a?{...e,documents:{...e.documents,[n]:{...r,byUid:{...r.byUid,[o]:{...a,object:{...a.object,...i}}}}}}:e}case Yc:{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 Xc:{const{toolId:n,patch:o}=t.payload;return{...e,tools:e.tools.map(e=>e.id===n?{...e,defaults:{...e.defaults,...o}}:e)}}case Zc:return e.colorPresets.includes(t.payload)?e:{...e,colorPresets:[...e.colorPresets,t.payload]};default:return e}},initialState:(e,t)=>(e=>{const t=new Map;Vu.forEach(e=>t.set(e.id,e));const n=new Map(t);(e.tools||[]).forEach(e=>{const o=t.get(e.id);o?n.set(e.id,{...o,...e,defaults:{...o.defaults,...e.defaults},interaction:{...o.interaction,...e.interaction},behavior:{...o.behavior,...e.behavior},...o.clickBehavior||e.clickBehavior?{clickBehavior:{...o.clickBehavior,...e.clickBehavior}}:{}}):n.set(e.id,e)});const o=Array.from(n.values()).map(t=>{var n,o,i;return{...t,behavior:{...t.behavior,deactivateToolAfterCreate:(null==(n=t.behavior)?void 0:n.deactivateToolAfterCreate)??e.deactivateToolAfterCreate??!1,selectAfterCreate:(null==(o=t.behavior)?void 0:o.selectAfterCreate)??e.selectAfterCreate??!0,editAfterCreate:(null==(i=t.behavior)?void 0:i.editAfterCreate)??e.editAfterCreate??!1}}});return{documents:{},activeDocumentId:null,tools:o,colorPresets:e.colorPresets??Ku}})(t)};function lh(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 ch(e,t){this.props=e,this.context=t}(ch.prototype=new W).isPureReactComponent=!0,ch.prototype.shouldComponentUpdate=function(e,t){return lh(this.props,e)||lh(this.state,t)};var dh=C.__b;C.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),dh&&dh(e)};var uh=C.__e;C.__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);uh(e,t,n,o)};var hh=C.unmount;function mh(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 mh(e,t,n)})),e}function gh(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return gh(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 ph(){this.__u=0,this.o=null,this.__b=null}function fh(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function vh(){this.i=null,this.l=null}C.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),hh&&hh(e)},(ph.prototype=new W).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var i=fh(o.__v),r=!1,a=function(){r||o.__z||(r=!0,n.__R=null,i?i(l):l())};n.__R=a;var s=n.__P;n.__P=null;var l=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=gh(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=s,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(a,a)},ph.prototype.componentWillUnmount=function(){this.o=[]},ph.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]=mh(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&j(B,null,e.fallback);return i&&(i.__u&=-33),[j(B,null,t.__a?null:e.children),i]};var yh=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 bh(e){return this.getChildContext=function(){return e.context},e.children}function wh(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){ce(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},namespaceURI:n.namespaceURI,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)}}}ce(j(bh,{context:t.context},e.__v),t.v)}function xh(e,t){var n=j(wh,{__v:e,h:t});return n.containerInfo=t,n}(vh.prototype=new W).__a=function(e){var t=this,n=fh(t.__v),o=t.l.get(e);return o[0]++,function(i){var r=function(){t.props.revealOrder?(o.push(i),yh(t,e,o)):i()};n?n(r):r()}},vh.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},vh.prototype.componentDidUpdate=vh.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){yh(e,n,t)})};var kh="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Ch=/^(?: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]/,Ih=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Sh=/[A-Z0-9]/g,Ah="undefined"!=typeof document,Mh=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};W.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(W.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Dh=C.event;function Ph(){}function Th(){return this.cancelBubble}function Rh(){return this.defaultPrevented}C.event=function(e){return Dh&&(e=Dh(e)),e.persist=Ph,e.isPropagationStopped=Th,e.isDefaultPrevented=Rh,e.nativeEvent=e};var zh={enumerable:!1,configurable:!0,get:function(){return this.class}},Eh=C.vnode;C.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||Ah&&"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||Mh(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":Ih.test(r)&&(r=s):s=r="oninput":i&&Ch.test(r)?r=r.replace(Sh,"-$&").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",zh)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=kh,Eh&&Eh(e)};var Oh=C.__r;C.__r=function(e){Oh&&Oh(e),e.__c};var Nh=C.diffed;C.diffed=function(e){Nh&&Nh(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)};const Lh="INTERACTION/INIT_STATE",_h="INTERACTION/CLEANUP_STATE",Fh="INTERACTION/ACTIVATE_MODE",$h="INTERACTION/PAUSE",jh="INTERACTION/RESUME",Uh="INTERACTION/SET_CURSOR",Bh="INTERACTION/SET_DEFAULT_MODE",Wh="INTERACTION/SET_EXCLUSION_RULES",Hh="INTERACTION/ADD_EXCLUSION_CLASS",Gh="INTERACTION/REMOVE_EXCLUSION_CLASS",qh="INTERACTION/ADD_EXCLUSION_ATTRIBUTE",Vh="INTERACTION/REMOVE_EXCLUSION_ATTRIBUTE";function Kh(e){return{type:Bh,payload:{mode:e}}}function Zh(e){return{type:Wh,payload:{rules:e}}}const Xh="pointerMode",Yh=class extends So{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.pageActivities=new Map,this.onModeChange$=Oo(),this.onHandlerChange$=Oo(),this.onCursorChange$=Oo(),this.onStateChange$=No(),this.onPageActivityChange$=Oo(),this.registerMode({id:Xh,scope:"page",exclusive:!1,cursor:"auto"}),this.dispatch(Kh(Xh)),n.exclusionRules&&this.dispatch(Zh(n.exclusionRules))}onDocumentLoadingStarted(e){const t={activeMode:this.state.defaultMode,cursor:"auto",paused:!1};this.dispatch(function(e,t){return{type:Lh,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),this.pageActivities.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){const t=this.pageActivities.get(e);if(t){const n=new Set(t.values());t.clear();for(const t of n)this.onPageActivityChange$.emit({documentId:e,pageIndex:t,hasActivity:!1})}this.cursorClaims.delete(e),this.buckets.delete(e),this.alwaysGlobal.delete(e),this.alwaysPage.delete(e),this.pageActivities.delete(e),this.dispatch(function(e){return{type:_h,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(Zh(e)),addExclusionClass:e=>this.dispatch(function(e){return{type:Hh,payload:{className:e}}}(e)),removeExclusionClass:e=>this.dispatch(function(e){return{type:Gh,payload:{className:e}}}(e)),addExclusionAttribute:e=>this.dispatch(function(e){return{type:qh,payload:{attribute:e}}}(e)),removeExclusionAttribute:e=>this.dispatch(function(e){return{type:Vh,payload:{attribute:e}}}(e)),claimPageActivity:(e,t,n)=>this.claimPageActivity(e,t,n),releasePageActivity:(e,t)=>this.releasePageActivity(e,t),hasPageActivity:(e,t)=>this.hasPageActivity(e,t),onModeChange:this.onModeChange$.on,onCursorChange:this.onCursorChange$.on,onHandlerChange:this.onHandlerChange$.on,onStateChange:this.onStateChange$.on,onPageActivityChange:this.onPageActivityChange$.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),claimPageActivity:(t,n)=>this.claimPageActivity(e,t,n),releasePageActivity:t=>this.releasePageActivity(e,t),hasPageActivity:t=>this.hasPageActivity(e,t),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)}),onPageActivityChange:t=>this.onPageActivityChange$.on(n=>{n.documentId===e&&t({pageIndex:n.pageIndex,hasActivity:n.hasActivity})})}}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:Fh,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.getActiveDocumentIdOrNull();t&&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(Kh(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:$h,payload:e}}(t))}resume(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:jh,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){if(n.isImmediatePropagationStopped())break;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:Uh,payload:{documentId:e,cursor:t}}}(e,i.cursor)),this.onCursorChange$.emit({documentId:e,cursor:i.cursor}))}claimPageActivity(e,t,n){let o=this.pageActivities.get(e);o||(o=new Map,this.pageActivities.set(e,o));const i=o.get(t);i!==n&&(o.set(t,n),void 0===i||this.pageHasAnyTopic(e,i)||this.onPageActivityChange$.emit({documentId:e,pageIndex:i,hasActivity:!1}),1===this.countTopicsOnPage(e,n)&&this.onPageActivityChange$.emit({documentId:e,pageIndex:n,hasActivity:!0}))}releasePageActivity(e,t){const n=this.pageActivities.get(e);if(!n)return;const o=n.get(t);void 0!==o&&(n.delete(t),this.pageHasAnyTopic(e,o)||this.onPageActivityChange$.emit({documentId:e,pageIndex:o,hasActivity:!1}))}hasPageActivity(e,t){return this.pageHasAnyTopic(e,t)}pageHasAnyTopic(e,t){const n=this.pageActivities.get(e);if(!n)return!1;for(const e of n.values())if(e===t)return!0;return!1}countTopicsOnPage(e,t){const n=this.pageActivities.get(e);if(!n)return 0;let o=0;for(const e of n.values())e===t&&o++;return o}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.pageActivities.clear(),this.onModeChange$.clear(),this.onCursorChange$.clear(),this.onHandlerChange$.clear(),this.onStateChange$.clear(),this.onPageActivityChange$.clear(),await super.destroy()}};Yh.id="interaction-manager";let Qh=Yh;const Jh="interaction-manager",em={defaultMode:"pointerMode",exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]},documents:{},activeDocumentId:null},tm={manifest:{id:Jh,name:"Interaction Manager Plugin",version:"1.0.0",provides:["interaction-manager"],requires:[],optional:[],defaultConfig:{exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]}}},create:(e,t)=>new Qh(Jh,e,t),reducer:(e=em,t)=>{switch(t.type){case Lh:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case _h:{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 Fh:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeMode:o}}}:e}case Uh:{const{documentId:n,cursor:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,cursor:o}}}:e}case $h:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!0}}}:e}case jh:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!1}}}:e}case Bh:return{...e,defaultMode:t.payload.mode};case Wh:return{...e,exclusionRules:t.payload.rules};case Hh:return{...e,exclusionRules:{...e.exclusionRules,classes:[...e.exclusionRules.classes||[],t.payload.className].filter((e,t,n)=>n.indexOf(e)===t)}};case Gh:return{...e,exclusionRules:{...e.exclusionRules,classes:(e.exclusionRules.classes||[]).filter(e=>e!==t.payload.className)}};case qh:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:[...e.exclusionRules.dataAttributes||[],t.payload.attribute].filter((e,t,n)=>n.indexOf(e)===t)}};case Vh:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:(e.exclusionRules.dataAttributes||[]).filter(e=>e!==t.payload.attribute)}};default:return e}},initialState:em},nm=()=>Wo(Qh.id);const om={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"},im=["pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mousecancel","click","dblclick"],rm="undefined"!=typeof PointerEvent?im:[...im,"touchstart","touchend","touchmove","touchcancel"];function am(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function sm(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=>{rm.forEach(t=>{const o=s[t]??(s[t]=v);var i;n.addEventListener(t,o,(i=e,t.startsWith("touch")?{passive:!i}:{passive:!1}))})},d=()=>{rm.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)}),f=(e,t)=>{if(o)return o(e,t);const n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}};function v(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=om[t.type];if(!s||!(null==r?void 0:r[s]))return;let c,d;am(t)&&l&&("touchmove"===t.type||"touchcancel"===t.type)&&t.preventDefault();let u=!1;if(am(t)){const e="touchend"===t.type||"touchcancel"===t.type?t.changedTouches[0]:t.touches[0];if(!e)return;c=f(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:()=>{},stopImmediatePropagation:()=>{u=!0},isImmediatePropagationStopped:()=>u}}else{const e=t;c=f(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)},stopImmediatePropagation:()=>{u=!0},isImmediatePropagationStopped:()=>u}}null==(o=r[s])||o.call(r,c,d,i.getActiveMode())}return()=>{d(),u(),p(),h()}}const lm=({children:e,documentId:t,style:n,...o})=>{const i=Pe(null),{provides:r}=nm();return Me(()=>{if(r&&i.current)return sm(r,{type:"global",documentId:t},i.current)},[r,t]),Be("div",{ref:i,style:{width:"100%",height:"100%",...n},...o,children:e})},cm=({documentId:e,pageIndex:t,children:n,rotation:o,scale:i,convertEventToPoint:r,style:a,...s})=>{var l,c;const d=Pe(null),{provides:u}=nm(),h=function(e){const{provides:t}=nm(),[n,o]=Se(()=>{if(!t)return!1;const n=t.forDocument(e).getActiveInteractionMode();return"page"===(null==n?void 0:n.scope)&&!!n.exclusive});return Me(()=>{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=Go(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},f=(null==g?void 0:g.rotation)??0,v=(null==m?void 0:m.rotation)??0,y=void 0!==o?o:(f+v)%4,b=i??(null==m?void 0:m.scale)??1,w=Ke(p,0,b),x=Re((e,t)=>{const n=t.getBoundingClientRect(),o={x:e.clientX-n.left,y:e.clientY-n.top};return function(e,t,n,o){return Qe(Ye(e,t,(4-n)%4),1/o)}(Ke({width:w.width,height:w.height},y,1),o,y,b)},[p,y,b]);return Me(()=>{if(u&&d.current)return sm(u,{type:"page",documentId:e,pageIndex:t},d.current,r||x)},[u,e,t,r,x]),Be("div",{ref:d,style:{position:"relative",width:w.width,height:w.height,...a},...s,children:[n,h&&Be("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}})]})},dm={},um=de(null),hm=de([]);function mm(e){const t=ze(um),n=Pe(e);Me(()=>{if(t)return t(n.current)},[t])}function gm(){return ze(hm)}const pm=()=>Bo(eh.id),fm=()=>Wo(eh.id),vm=e=>{var t;const{provides:n}=fm(),[o,i]=Se((null==(t=null==n?void 0:n.forDocument(e))?void 0:t.getState())??Xu());return Me(()=>{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}};let ym;function bm(){return void 0===ym&&(ym=function(){try{const e=navigator;return/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1}catch{return!1}}()),ym}function wm(e,t){const n=bm();return Te(()=>{const o=n&&t&&e>0&&e<16,i=o?e/16:1;return{needsComp:o,adjustedFontPx:o?16:e,scaleComp:i,wrapperStyle:o?{width:100/i+"%",height:100/i+"%",transform:`scale(${i})`,transformOrigin:"top left"}:void 0}},[n,t,e])}function xm({appearance:e,style:t}){const[n,o]=Se(null),i=Pe(null);Me(()=>{const t=URL.createObjectURL(e.data);return o(t),i.current=t,()=>{i.current&&(URL.revokeObjectURL(i.current),i.current=null)}},[e.data]);return n?Be("img",{src:n,onLoad:()=>{i.current&&(URL.revokeObjectURL(i.current),i.current=null)},style:{position:"absolute",width:"100%",height:"100%",display:"block",pointerEvents:"none",userSelect:"none",...t}}):null}function km({scale:e,documentId:t,pageIndex:n,rotation:o,pageWidth:i,pageHeight:r,trackedAnnotation:a,children:s,isSelected:l,isEditing:c=!1,isMultiSelected:d=!1,isDraggable:u,isResizable:h,isRotatable:m=!0,lockAspectRatio:g=!1,style:p={},blendMode:f,vertexConfig:v,selectionMenu:y,outlineOffset:b=1,onDoubleClick:w,onSelect:x,appearance:k,zIndex:C=1,resizeUI:I,vertexUI:S,rotationUI:A,selectionOutlineColor:M,selectionOutline:D,customAnnotationRenderer:P,groupSelectionMenu:T,groupSelectionOutline:R,annotationRenderers:z,...E}){var O,N,L;const[_,F]=Se(a.object),[$,j]=Se(null),[U,W]=Se(null),[H,G]=Se(!1),[q,V]=Se(!1),{provides:K}=fm(),{plugin:Z}=pm(),{canModifyAnnotations:X}=Xo(t),Y=Pe(null),Q=X&&u&&!d,J=X&&h&&!d,ee=X&&m&&!d,te=Te(()=>K?K.forDocument(t):null,[K,t]),ne=_?{...a.object,..._}:a.object,oe=a.object.flags??[],ie=oe.includes("noZoom"),re=oe.includes("noRotate"),ae=ie?1:e,se=re?0:o,le=(null==I?void 0:I.color)??"#007ACC",ce=(null==S?void 0:S.color)??"#007ACC",de=(null==A?void 0:A.color)??"white",ue=(null==A?void 0:A.connectorColor)??"#007ACC",he=(null==I?void 0:I.size)??12,me=(null==S?void 0:S.size)??12,ge=(null==A?void 0:A.size)??32,pe=null==A?void 0:A.margin,fe=(null==A?void 0:A.iconColor)??"#007ACC",ve=(null==A?void 0:A.showConnector)??!1,ye=(null==(O=null==A?void 0:A.border)?void 0:O.color)??"#007ACC",be=(null==(N=null==A?void 0:A.border)?void 0:N.width)??1,we=(null==(L=null==A?void 0:A.border)?void 0:L.style)??"solid",xe=(null==D?void 0:D.color)??M??"#007ACC",ke=(null==D?void 0:D.style)??"solid",Ce=(null==D?void 0:D.width)??1,Ie=(null==D?void 0:D.offset)??b??1,Ae=$??ne.rotation??0,De=$??ne.rotation??0,ze=Number.isFinite(De)?Math.round(10*De)/10:0,Ee=null!==$,Oe=Pe(null),Ne=Re(e=>{var o;if(!(null==(o=e.transformData)?void 0:o.type)||d||!Z)return;const{type:s,changes:l,metadata:c}=e.transformData,u=a.object.id,h={width:i,height:r};if("start"===e.state&&(Oe.current=a.object.unrotatedRect??a.object.rect,Y.current=a.object,"resize"!==s&&"vertex-edit"!==s||V(!0),"move"===s?Z.startDrag(t,{annotationIds:[u],pageSize:h}):"resize"===s&&Z.startResize(t,{annotationIds:[u],pageSize:h,resizeHandle:(null==c?void 0:c.handle)??"se"})),l.rect&&Oe.current)if("move"===s){const e={x:l.rect.origin.x-Oe.current.origin.x,y:l.rect.origin.y-Oe.current.origin.y};Z.updateDrag(t,e)}else"resize"===s&&Z.updateResize(t,l.rect);if("vertex-edit"===s&&l.vertices&&v){const t=Y.current??a.object,o=v.transformAnnotation(t,l.vertices),i=null==K?void 0:K.transformAnnotation(t,{type:s,changes:o,metadata:c});i&&(F(e=>({...e,...i})),"end"===e.state&&(null==te||te.updateAnnotation(n,u,i)))}if("rotate"===s){const n=(null==c?void 0:c.rotationAngle)??Ae,o=null==c?void 0:c.cursorPosition;return o&&W({x:o.clientX,y:o.clientY}),void("start"===e.state?(j(n),Z.startRotation(t,{annotationIds:[u],cursorAngle:n,rotationCenter:null==c?void 0:c.rotationCenter})):"move"===e.state?(j(n),Z.updateRotation(t,n,null==c?void 0:c.rotationDelta)):"end"===e.state&&(j(null),W(null),Z.commitRotation(t)))}"end"===e.state&&(Oe.current=null,Y.current=null,V(!1),"move"===s?Z.commitDrag(t):"resize"===s&&Z.commitResize(t))},[Z,t,a.object,i,r,n,d,v,K,te,Ae]),Le=ne.unrotatedRect,_e=Le??ne.rect,Fe=Le&&0!==Ae?ht(_e,ne.rect,Ae):void 0,$e=_e,{dragProps:je,vertices:Ue,resize:We,rotation:He}=ql({controller:{element:$e,vertices:null==v?void 0:v.extractVertices(ne),constraints:{minWidth:10,minHeight:10,boundingBox:{width:i,height:r}},maintainAspectRatio:g,pageRotation:o,annotationRotation:Ae,rotationCenter:Fe,rotationElement:ne.rect,scale:e,enabled:l&&!d,onUpdate:Ne},resizeUI:{handleSize:he,spacing:Ie,offsetMode:"outside",includeSides:!g,zIndex:C+1},vertexUI:{vertexSize:me,zIndex:C+2},rotationUI:{handleSize:ge,margin:pe,zIndex:C+3,showConnector:ve},includeVertices:!!v,includeRotation:ee,currentRotation:Ae}),Ge=function(e,{delay:t=300,tolerancePx:n=18}={}){const o=Pe({t:0,x:0,y:0}),i=Re(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=Re(t=>{null==e||e(t)},[e]);return e?{[Ll]:r,onPointerUpCapture:i}:{}}(Te(()=>{if(X&&w)return w},[X,w]));Me(()=>{F(a.object)},[a.object]),Me(()=>{if(!Z)return;const e=a.object.id,n=n=>{var o;if(n.documentId!==t)return;"end"!==n.type&&"cancel"!==n.type||j(null);const i=null==(o=n.previewPatches)?void 0:o[e];"update"===n.type&&i?F(e=>({...e,...i})):"cancel"===n.type&&F(a.object)},o=[Z.onDragChange(n),Z.onResizeChange(n),Z.onRotateChange(n)];return()=>o.forEach(e=>e())},[Z,t,a.object]);const qe=l&&!d,Ve=ne.rect.size.width*ae,Ke=ne.rect.size.height*ae,Ze=_e.size.width*ae,Xe=_e.size.height*ae,Ye=Boolean(Le)&&0!==Ae,Qe=Ye?(_e.origin.x-ne.rect.origin.x)*ae:(Ve-Ze)/2,Je=Ye?(_e.origin.y-ne.rect.origin.y)*ae:(Ke-Xe)/2,et=Ye&&Fe?`${(Fe.x-_e.origin.x)*ae}px ${(Fe.y-_e.origin.y)*ae}px`:"center center",tt=Fe?(Fe.x-ne.rect.origin.x)*ae:Ve/2,nt=Fe?(Fe.y-ne.rect.origin.y)*ae:Ke/2,ot=Math.max(300,Math.max(Ve,Ke)+80),it=re?Nl({size:{width:Ve,height:Ke}},o):null,rt=Te(()=>Le?{...ne,rect:Le}:ne,[ne,Le]),at=!(!(null==k?void 0:k.normal)||q||c||a.dictMode),st={position:"absolute",left:ne.rect.origin.x*e,top:ne.rect.origin.y*e,width:it?it.width:Ve,height:it?it.height:Ke,pointerEvents:"none",zIndex:C,...it&&{transform:it.matrix,transformOrigin:"0 0"}},lt={position:"absolute",left:Qe,top:Je,width:Ze,height:Xe,transform:0!==Ae?`rotate(${Ae}deg)`:void 0,transformOrigin:et};return Be("div",{"data-no-interaction":!0,children:[Be("div",{style:{...st,...f&&{mixBlendMode:f},...p},children:Be("div",{style:{...lt,pointerEvents:c?"auto":"none"},children:[(()=>{const t="function"==typeof s?s(rt,{appearanceActive:at}):s;return(null==P?void 0:P({annotation:rt,children:t,isSelected:l,scale:e,rotation:o,pageWidth:i,pageHeight:r,pageIndex:n,onSelect:x}))??t})(),(null==k?void 0:k.normal)&&Be(xm,{appearance:k.normal,style:{display:at?"block":"none"}})]})}),Be("div",{style:st,...E,children:[Ee&&Be(B,{children:[Be("div",{style:{position:"absolute",left:tt-ot/2,top:nt,width:ot,height:1,backgroundColor:ue,opacity:.35,pointerEvents:"none"}}),Be("div",{style:{position:"absolute",left:tt,top:nt-ot/2,width:1,height:ot,backgroundColor:ue,opacity:.35,pointerEvents:"none"}}),Be("div",{style:{position:"absolute",left:tt-ot/2,top:nt,width:ot,height:1,transformOrigin:"center center",transform:`rotate(${Ae}deg)`,backgroundColor:ue,opacity:.8,pointerEvents:"none"}})]}),l&&ee&&He&&((null==A?void 0:A.component)?Be("div",{onPointerEnter:()=>G(!0),onPointerLeave:()=>{G(!1),W(null)},onPointerMove:e=>{Ee||W({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:A.component({...He.handle,backgroundColor:de,iconColor:fe,connectorStyle:{...He.connector.style,backgroundColor:ue,opacity:Ee?0:1},showConnector:ve,opacity:Ee?0:1,border:{color:ye,width:be,style:we}})}):Be("div",{onPointerEnter:()=>G(!0),onPointerLeave:()=>{G(!1),W(null)},onPointerMove:e=>{Ee||W({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:[ve&&Be("div",{style:{...He.connector.style,backgroundColor:ue,opacity:Ee?0:1}}),Be("div",{...He.handle,style:{...He.handle.style,backgroundColor:de,border:`${be}px ${we} ${ye}`,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",opacity:Ee?0:1},children:Be("svg",{width:Math.round(.6*ge),height:Math.round(.6*ge),viewBox:"0 0 24 24",fill:"none",stroke:fe,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Be("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),Be("path",{d:"M21 3v5h-5"})]})})]})),Be("div",{...Q&&l?je:{},...Ge,style:{...lt,outline:qe?`${Ce}px ${ke} ${xe}`:"none",outlineOffset:qe?`${Ie}px`:"0px",pointerEvents:!l||d||c?"none":"auto",touchAction:"none",cursor:l&&Q?"move":"default"},children:[l&&J&&!Ee&&We.map(({key:e,...t})=>(null==I?void 0:I.component)?I.component({key:e,...t,backgroundColor:le}):Be("div",{...t,style:{...t.style,backgroundColor:le}},e)),l&&X&&!d&&!Ee&&Ue.map(({key:e,...t})=>(null==S?void 0:S.component)?S.component({key:e,...t,backgroundColor:ce}):Be("div",{...t,style:{...t.style,backgroundColor:ce}},e))]})]}),y&&!d&&!Ee&&Be(_l,{rect:{origin:{x:ne.rect.origin.x*e,y:ne.rect.origin.y*e},size:{width:ne.rect.size.width*ae,height:ne.rect.size.height*ae}},rotation:o,children:e=>{const t=((Ae+90*se)%360+360)%360;return y({...e,context:{type:"annotation",annotation:a,pageIndex:n},selected:l,placement:{suggestTop:ee&&t>90&&t<270}})}}),(Ee||H)&&U&&xh(Be("div",{style:{position:"fixed",left:U.x+16,top:U.y-16,background:"rgba(0,0,0,0.8)",color:"#fff",padding:"4px 8px",borderRadius:4,fontSize:12,fontFamily:"monospace",pointerEvents:"none",zIndex:1e4,whiteSpace:"nowrap"},children:[ze.toFixed(0),"°"]}),document.body)]})}function Cm(e,t,n,o,i){switch(i){case 1:return{x:t,y:o-e};case 2:return{x:n-e,y:o-t};case 3:return{x:n-t,y:e};default:return{x:e,y:t}}}function Im(e,t,n){const o=e.object.flags??[],i=o.includes("noZoom"),r=o.includes("noRotate"),a=e.object.rect.origin.x*t,s=e.object.rect.origin.y*t,l=e.object.rect.size.width*(i?1:t),c=e.object.rect.size.height*(i?1:t);if(!r||0===n)return{left:a,top:s,right:a+l,bottom:s+c};const d=[Cm(0,0,l,c,n),Cm(l,0,l,c,n),Cm(0,c,l,c,n),Cm(l,c,l,c,n)];let u=1/0,h=1/0,m=-1/0,g=-1/0;for(const e of d)e.x<u&&(u=e.x),e.y<h&&(h=e.y),e.x>m&&(m=e.x),e.y>g&&(g=e.y);return{left:a+u,top:s+h,right:a+m,bottom:s+g}}function Sm({documentId:e,pageIndex:t,scale:n,rotation:o,pageWidth:i,pageHeight:r,selectedAnnotations:a,isDraggable:s,isResizable:l,isRotatable:c=!0,lockAspectRatio:d=!1,resizeUI:u,rotationUI:h,selectionOutlineColor:m,outlineOffset:g,selectionOutline:p,zIndex:f=2,groupSelectionMenu:v}){var y,b,w;const{plugin:x}=pm(),{canModifyAnnotations:k}=Xo(e),C=Pe(null),I=Pe(!1),S=Pe(!1),[A,M]=Se(null),[D,P]=Se(null),[T,R]=Se(!1),z=k&&s,E=k&&l,O=k&&c,N=Te(()=>function(e){return rt(e)??it}(a.map(e=>e.object.rect)),[a]),[L,_]=Se(N);Me(()=>{I.current||S.current||_(N)},[N]),Me(()=>{if(!x)return;return x.onRotateChange(t=>{t.documentId===e&&("end"!==t.type&&"cancel"!==t.type||M(null))})},[x,e]);const F=Re(t=>{var n,o,s,l,d,u;if(!(null==(n=t.transformData)?void 0:n.type))return;if(!x)return;const h=t.transformData.type,m="move"===h,g="resize"===h;if(m&&!z)return;if("start"===t.state&&(C.current=N,m?(I.current=!0,x.startDrag(e,{annotationIds:a.map(e=>e.object.id),pageSize:{width:i,height:r}})):g&&(S.current=!0,x.startResize(e,{annotationIds:a.map(e=>e.object.id),pageSize:{width:i,height:r},resizeHandle:(null==(o=t.transformData.metadata)?void 0:o.handle)??"se"}))),"rotate"===h){if(!c)return;const n=a.map(e=>e.object.id),o=(null==(s=t.transformData.metadata)?void 0:s.rotationAngle)??0,i=null==(l=t.transformData.metadata)?void 0:l.cursorPosition;return i&&P({x:i.clientX,y:i.clientY}),void("start"===t.state?(M(o),x.startRotation(e,{annotationIds:n,cursorAngle:o,rotationCenter:null==(d=t.transformData.metadata)?void 0:d.rotationCenter})):"move"===t.state?(M(o),x.updateRotation(e,o,null==(u=t.transformData.metadata)?void 0:u.rotationDelta)):"end"===t.state&&(M(null),P(null),x.commitRotation(e)))}const p=C.current??N;if(m&&t.transformData.changes.rect){const n=t.transformData.changes.rect,o={x:n.origin.x-p.origin.x,y:n.origin.y-p.origin.y},i=x.updateDrag(e,o);_({...p,origin:{x:p.origin.x+i.x,y:p.origin.y+i.y}})}else if(g&&t.transformData.changes.rect){const n=t.transformData.changes.rect;x.updateResize(e,n),_(n)}"end"===t.state&&(C.current=null,m&&I.current?(I.current=!1,x.commitDrag(e)):g&&S.current&&(S.current=!1,x.commitResize(e)))},[x,e,i,r,N,z,a,c]),$=A??0,j=null!==A,U=Number.isFinite($)?Math.round(10*$)/10:0,W=(null==u?void 0:u.color)??"#007ACC",H=(null==u?void 0:u.size)??12,G=(null==h?void 0:h.color)??"white",q=(null==h?void 0:h.connectorColor)??"#007ACC",V=(null==h?void 0:h.size)??32,K=null==h?void 0:h.margin,Z=(null==h?void 0:h.iconColor)??"#007ACC",X=(null==h?void 0:h.showConnector)??!1,Y=(null==(y=null==h?void 0:h.border)?void 0:y.color)??"#007ACC",Q=(null==(b=null==h?void 0:h.border)?void 0:b.width)??1,J=(null==(w=null==h?void 0:h.border)?void 0:w.style)??"solid",ee=(null==p?void 0:p.color)??m??"#007ACC",te=(null==p?void 0:p.style)??"dashed",ne=(null==p?void 0:p.width)??2,oe=(null==p?void 0:p.offset)??g??2,{dragProps:ie,resize:re,rotation:ae}=ql({controller:{element:L,constraints:{minWidth:20,minHeight:20,boundingBox:{width:i,height:r}},maintainAspectRatio:d,pageRotation:o,scale:n,enabled:!0,onUpdate:F},resizeUI:{handleSize:H,spacing:oe,offsetMode:"outside",includeSides:!d,zIndex:f+1},vertexUI:{vertexSize:0,zIndex:f},rotationUI:{handleSize:V,margin:K,zIndex:f+2,showConnector:X},includeVertices:!1,includeRotation:O,currentRotation:A??0});if(a.length<2)return null;let se=1/0,le=1/0,ce=-1/0,de=-1/0;for(const e of a){const t=Im(e,n,o);se=Math.min(se,t.left),le=Math.min(le,t.top),ce=Math.max(ce,t.right),de=Math.max(de,t.bottom)}const ue=se-N.origin.x*n,he=le-N.origin.y*n,me=ce-(N.origin.x+N.size.width)*n,ge=de-(N.origin.y+N.size.height)*n,pe=L.origin.x*n+ue,fe=L.origin.y*n+he,ve=L.size.width*n+(me-ue),ye=L.size.height*n+(ge-he),be=ve/2,we=ye/2,xe=Math.max(300,Math.max(ve,ye)+80);return Be("div",{"data-group-selection-box":!0,"data-no-interaction":!0,children:[Be("div",{style:{position:"absolute",left:pe,top:fe,width:ve,height:ye,pointerEvents:"none",zIndex:f},children:[j&&Be(B,{children:[Be("div",{style:{position:"absolute",left:be-xe/2,top:we,width:xe,height:1,backgroundColor:W,opacity:.35,pointerEvents:"none"}}),Be("div",{style:{position:"absolute",left:be,top:we-xe/2,width:1,height:xe,backgroundColor:W,opacity:.35,pointerEvents:"none"}}),Be("div",{style:{position:"absolute",left:be-xe/2,top:we,width:xe,height:1,transformOrigin:"center center",transform:`rotate(${$}deg)`,backgroundColor:W,opacity:.8,pointerEvents:"none"}})]}),O&&ae&&((null==h?void 0:h.component)?Be("div",{onPointerEnter:()=>R(!0),onPointerLeave:()=>{R(!1),P(null)},onPointerMove:e=>{j||P({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:h.component({...ae.handle,backgroundColor:G,iconColor:Z,connectorStyle:{...ae.connector.style,backgroundColor:q,opacity:j?0:1},showConnector:X,opacity:j?0:1,border:{color:Y,width:Q,style:J}})}):Be("div",{onPointerEnter:()=>R(!0),onPointerLeave:()=>{R(!1),P(null)},onPointerMove:e=>{j||P({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:[X&&Be("div",{style:{...ae.connector.style,backgroundColor:q,opacity:j?0:1}}),Be("div",{...ae.handle,style:{...ae.handle.style,backgroundColor:G,border:`${Q}px ${J} ${Y}`,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",opacity:j?0:1},children:Be("svg",{width:Math.round(.6*V),height:Math.round(.6*V),viewBox:"0 0 24 24",fill:"none",stroke:Z,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Be("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),Be("path",{d:"M21 3v5h-5"})]})})]})),Be("div",{...z?ie:{onPointerDown:e=>e.stopPropagation()},style:{position:"absolute",left:0,top:0,width:ve,height:ye,outline:j?"none":`${ne}px ${te} ${ee}`,outlineOffset:oe-1,cursor:z?"move":"default",touchAction:"none",pointerEvents:"auto"},children:E&&!j&&re.map(({key:e,...t})=>(null==u?void 0:u.component)?u.component({key:e,...t,backgroundColor:W}):Be("div",{...t,style:{...t.style,backgroundColor:W}},e))})]}),(j||T)&&D&&xh(Be("div",{style:{position:"fixed",left:D.x+16,top:D.y-16,background:"rgba(0,0,0,0.8)",color:"#fff",padding:"4px 8px",borderRadius:4,fontSize:12,fontFamily:"monospace",pointerEvents:"none",zIndex:1e4,whiteSpace:"nowrap"},children:[U.toFixed(0),"°"]}),document.body),v&&!j&&Be(_l,{rect:{origin:{x:pe,y:fe},size:{width:ve,height:ye}},rotation:o,children:e=>{const n=(($+90*o)%360+360)%360;return v({...e,context:{type:"group",annotations:a,pageIndex:t},selected:!0,placement:{suggestTop:O&&n>90&&n<270}})}})]})}function Am(e){return{id:e.id,matches:t=>e.matches(t),render:t=>e.render(t),renderPreview:e.renderPreview?t=>e.renderPreview(t):void 0,vertexConfig:e.vertexConfig,zIndex:e.zIndex,defaultBlendMode:e.defaultBlendMode,containerStyle:e.containerStyle,interactionDefaults:e.interactionDefaults,useAppearanceStream:e.useAppearanceStream,isDraggable:e.isDraggable,onDoubleClick:e.onDoubleClick,selectOverride:e.selectOverride,hideSelectionMenu:e.hideSelectionMenu,hiddenWhenLocked:e.hiddenWhenLocked,renderLocked:e.renderLocked?t=>e.renderLocked(t):void 0}}function Mm({isSelected:e,strokeColor:t,opacity:n=1,strokeWidth:o,inkList:i,rect:r,scale:a,onClick:s,appearanceActive:l=!1}){const c=t??"#000000",d=Te(()=>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]),u=r.size.width*a,h=r.size.height*a,m=Math.max(o,20/a);return Be("svg",{style:{position:"absolute",width:u,height:h,pointerEvents:"none",zIndex:2,overflow:"visible"},width:u,height:h,viewBox:`0 0 ${r.size.width} ${r.size.height}`,children:[d.map((t,n)=>Be("path",{d:t,fill:"none",stroke:"transparent",strokeWidth:m,onPointerDown:s,style:{cursor:e?"move":s?"pointer":"default",pointerEvents:s?e?"none":"visibleStroke":"none",strokeLinecap:"round",strokeLinejoin:"round"}},`hit-${n}`)),!l&&d.map((e,t)=>Be("path",{d:e,fill:"none",opacity:n,style:{pointerEvents:"none",stroke:c,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}},`vis-${t}`))]})}function Dm({isSelected:e,color:t="#000000",strokeColor:n,opacity:o=1,strokeWidth:i,strokeStyle:r=Ht.SOLID,strokeDashArray:a,rect:s,scale:l,onClick:c,appearanceActive:d=!1,cloudyBorderIntensity:u,rectangleDifferences:h}){const m=(u??0)>0,{width:g,height:p,x:f,y:v}=Te(()=>{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]),y=Te(()=>m?function(e,t,n,o){const i=new ou;let r=0,a=0,s=e.width,l=e.height;return t?(r+=t.left,a+=t.top,s-=t.right,l-=t.bottom):(r+=o/2,a+=o/2,s-=o/2,l-=o/2),fu([{x:r,y:-a},{x:s,y:-a},{x:s,y:-l},{x:r,y:-l},{x:r,y:-a}],!1,n,o,i),i.close(),i.build(o)}({width:s.size.width,height:s.size.height},h,u,i):null,[m,s,h,u,i]),b=s.size.width*l,w=s.size.height*l,x=Math.max(i,20/l);return Be("svg",{style:{position:"absolute",width:b,height:w,pointerEvents:"none",zIndex:2},width:b,height:w,viewBox:`0 0 ${s.size.width} ${s.size.height}`,overflow:"visible",children:[m&&y?Be("path",{d:y.path,fill:"transparent",stroke:"transparent",strokeWidth:x,onPointerDown:c,style:{cursor:e?"move":c?"pointer":"default",pointerEvents:c?e?"none":"transparent"===t?"visibleStroke":"visible":"none"}}):Be("rect",{x:f,y:v,width:g,height:p,fill:"transparent",stroke:"transparent",strokeWidth:x,onPointerDown:c,style:{cursor:e?"move":c?"pointer":"default",pointerEvents:c?e?"none":"transparent"===t?"visibleStroke":"visible":"none"}}),!d&&(m&&y?Be("path",{d:y.path,fill:t,opacity:o,style:{pointerEvents:"none",stroke:n??t,strokeWidth:i,strokeLinejoin:"round"}}):Be("rect",{x:f,y:v,width:g,height:p,fill:t,opacity:o,style:{pointerEvents:"none",stroke:n??t,strokeWidth:i,...r===Ht.DASHED&&{strokeDasharray:null==a?void 0:a.join(",")}}}))]})}function Pm({color:e="#000000",strokeColor:t,opacity:n=1,strokeWidth:o,strokeStyle:i=Ht.SOLID,strokeDashArray:r,rect:a,scale:s,onClick:l,isSelected:c,appearanceActive:d=!1,cloudyBorderIntensity:u,rectangleDifferences:h}){const m=(u??0)>0,{width:g,height:p,cx:f,cy:v,rx:y,ry:b}=Te(()=>{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]),w=Te(()=>m?function(e,t,n,o){const i=new ou;let r=0,a=0,s=e.width,l=e.height;return t&&(r+=t.left,a+=t.top,s-=t.right,l-=t.bottom),bu(r,-l,s,-a,n,o,i),i.close(),i.build(o)}({width:a.size.width,height:a.size.height},h,u,o):null,[m,a,h,u,o]),x=g*s,k=p*s,C=Math.max(o,20/s);return Be("svg",{style:{position:"absolute",width:x,height:k,pointerEvents:"none",zIndex:2},width:x,height:k,viewBox:`0 0 ${g} ${p}`,overflow:"visible",children:[m&&w?Be("path",{d:w.path,fill:"transparent",stroke:"transparent",strokeWidth:C,onPointerDown:l,style:{cursor:c?"move":l?"pointer":"default",pointerEvents:l?c?"none":"transparent"===e?"visibleStroke":"visible":"none"}}):Be("ellipse",{cx:f,cy:v,rx:y,ry:b,fill:"transparent",stroke:"transparent",strokeWidth:C,onPointerDown:l,style:{cursor:c?"move":l?"pointer":"default",pointerEvents:l?c?"none":"transparent"===e?"visibleStroke":"visible":"none"}}),!d&&(m&&w?Be("path",{d:w.path,fill:e,opacity:n,style:{pointerEvents:"none",stroke:t??e,strokeWidth:o,strokeLinejoin:"round"}}):Be("ellipse",{cx:f,cy:v,rx:y,ry:b,fill:e,opacity:n,style:{pointerEvents:"none",stroke:t??e,strokeWidth:o,...i===Ht.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}))]})}function Tm({color:e="transparent",opacity:t=1,strokeWidth:n,strokeColor:o="#000000",strokeStyle:i=Ht.SOLID,strokeDashArray:r,rect:a,linePoints:s,lineEndings:l,scale:c,onClick:d,isSelected:u,appearanceActive:h=!1}){const{x1:m,y1:g,x2:p,y2:f}=Te(()=>({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=Te(()=>{const e=Math.atan2(f-g,p-m);return{start:Gd.createEnding(null==l?void 0:l.start,n,e+Math.PI,m,g),end:Gd.createEnding(null==l?void 0:l.end,n,e,p,f)}},[l,n,m,g,p,f]),y=a.size.width*c,b=a.size.height*c,w=Math.max(n,20/c);return Be("svg",{style:{position:"absolute",width:y,height:b,pointerEvents:"none",zIndex:2,overflow:"visible"},width:y,height:b,viewBox:`0 0 ${a.size.width} ${a.size.height}`,children:[Be("line",{x1:m,y1:g,x2:p,y2:f,stroke:"transparent",strokeWidth:w,onPointerDown:d,style:{cursor:u?"move":d?"pointer":"default",pointerEvents:d?u?"none":"visibleStroke":"none",strokeLinecap:"butt"}}),v.start&&Be("path",{d:v.start.d,transform:v.start.transform,fill:"transparent",stroke:"transparent",strokeWidth:w,onPointerDown:d,style:{cursor:u?"move":d?"pointer":"default",pointerEvents:d?u?"none":v.start.filled?"visible":"visibleStroke":"none",strokeLinecap:"butt"}}),v.end&&Be("path",{d:v.end.d,transform:v.end.transform,fill:"transparent",stroke:"transparent",strokeWidth:w,onPointerDown:d,style:{cursor:u?"move":d?"pointer":"default",pointerEvents:d?u?"none":v.end.filled?"visible":"visibleStroke":"none",strokeLinecap:"butt"}}),!h&&Be(B,{children:[Be("line",{x1:m,y1:g,x2:p,y2:f,opacity:t,style:{pointerEvents:"none",stroke:o,strokeWidth:n,strokeLinecap:"butt",...i===Ht.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}),v.start&&Be("path",{d:v.start.d,transform:v.start.transform,stroke:o,fill:v.start.filled?e:"none",style:{pointerEvents:"none",strokeWidth:n,strokeLinecap:"butt",...i===Ht.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}),v.end&&Be("path",{d:v.end.d,transform:v.end.transform,stroke:o,fill:v.end.filled?e:"none",style:{pointerEvents:"none",strokeWidth:n,strokeLinecap:"butt",...i===Ht.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}})]})]})}function Rm({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,strokeStyle:a=Ht.SOLID,strokeDashArray:s,scale:l,isSelected:c,onClick:d,lineEndings:u,appearanceActive:h=!1}){const m=Te(()=>t.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[t,e]),g=Te(()=>{if(!m.length)return"";const[e,...t]=m;return`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("").trim()},[m]),p=Te(()=>{if(m.length<2)return{start:null,end:null};const e=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),t=e(m[0],m[1]),n=e(m[m.length-2],m[m.length-1]);return{start:Gd.createEnding(null==u?void 0:u.start,r,t+Math.PI,m[0].x,m[0].y),end:Gd.createEnding(null==u?void 0:u.end,r,n,m[m.length-1].x,m[m.length-1].y)}},[m,u,r]),f=e.size.width*l,v=e.size.height*l,y=Math.max(r,20/l);return Be("svg",{style:{position:"absolute",width:f,height:v,pointerEvents:"none",zIndex:2,overflow:"visible"},width:f,height:v,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[Be("path",{d:g,fill:"none",stroke:"transparent",strokeWidth:y,onPointerDown:d,style:{cursor:c?"move":d?"pointer":"default",pointerEvents:d?c?"none":"visibleStroke":"none",strokeLinecap:"butt",strokeLinejoin:"miter"}}),p.start&&Be("path",{d:p.start.d,transform:p.start.transform,fill:"transparent",stroke:"transparent",strokeWidth:y,onPointerDown:d,style:{cursor:c?"move":d?"pointer":"default",pointerEvents:d?c?"none":p.start.filled?"visible":"visibleStroke":"none",strokeLinecap:"butt"}}),p.end&&Be("path",{d:p.end.d,transform:p.end.transform,fill:"transparent",stroke:"transparent",strokeWidth:y,onPointerDown:d,style:{cursor:c?"move":d?"pointer":"default",pointerEvents:d?c?"none":p.end.filled?"visible":"visibleStroke":"none",strokeLinecap:"butt"}}),!h&&Be(B,{children:[Be("path",{d:g,opacity:i,style:{fill:"none",stroke:o??n,strokeWidth:r,pointerEvents:"none",strokeLinecap:"butt",strokeLinejoin:"miter",...a===Ht.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),p.start&&Be("path",{d:p.start.d,transform:p.start.transform,stroke:o,fill:p.start.filled?n:"none",style:{pointerEvents:"none",strokeWidth:r,strokeLinecap:"butt",...a===Ht.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),p.end&&Be("path",{d:p.end.d,transform:p.end.transform,stroke:o,fill:p.end.filled?n:"none",style:{pointerEvents:"none",strokeWidth:r,strokeLinecap:"butt",...a===Ht.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}})]})]})}function zm({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,strokeStyle:a=Ht.SOLID,strokeDashArray:s,scale:l,isSelected:c,onClick:d,currentVertex:u,handleSize:h=14,appearanceActive:m=!1,cloudyBorderIntensity:g}){const p=(g??0)>0,f=u?[...t,u]:t,v=Te(()=>f.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[f,e]),y=Te(()=>{if(!v.length)return"";const[e,...t]=v,n=!!u;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()},[v,u]),b=Te(()=>!p||f.length<3?null:function(e,t,n,o){const i=new ou;if(e.length<3)return i.build(o);const r=e.map(e=>({x:e.x-t.x,y:-(e.y-t.y)})),a=r[0],s=r[r.length-1];return a.x===s.x&&a.y===s.y||r.push({x:a.x,y:a.y}),fu(r,!1,n,o,i),i.close(),i.build(o)}(f,e.origin,g,r),[p,f,e.origin,g,r]),w=u&&t.length>0,x=e.size.width*l,k=e.size.height*l,C=Math.max(r,20/l);return Be("svg",{style:{position:"absolute",width:x,height:k,pointerEvents:"none",zIndex:2,overflow:"visible"},width:x,height:k,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[Be("path",{d:p&&b?b.path:y,fill:"transparent",stroke:"transparent",strokeWidth:C,onPointerDown:d,style:{cursor:c?"move":d?"pointer":"default",pointerEvents:d?c?"none":"transparent"===n?"visibleStroke":"visible":"none",strokeLinecap:"butt",strokeLinejoin:"miter"}}),!m&&Be(B,{children:p&&b?Be("path",{d:b.path,opacity:i,style:{fill:n,stroke:o??n,strokeWidth:r,pointerEvents:"none",strokeLinejoin:"round"}}):Be(B,{children:[Be("path",{d:y,opacity:i,style:{fill:u?"none":n,stroke:o??n,strokeWidth:r,pointerEvents:"none",strokeLinecap:"butt",strokeLinejoin:"miter",...a===Ht.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),w&&t.length>1&&Be("path",{d:`M ${v[v.length-1].x} ${v[v.length-1].y} L ${v[0].x} ${v[0].y}`,fill:"none",style:{stroke:o,strokeWidth:r,strokeDasharray:"4,4",opacity:.7,pointerEvents:"none"}}),w&&t.length>=2&&Be("rect",{x:v[0].x-h/l/2,y:v[0].y-h/l/2,width:h/l,height:h/l,fill:o,opacity:.4,stroke:o,strokeWidth:r/2,style:{pointerEvents:"none"}})]})})]})}function Em({isSelected:e,color:t="#facc15",opacity:n=1,onClick:o,appearanceActive:i=!1}){const r=function(e){try{const{red:t,green:n,blue:o}=dn(e);return(.299*t+.587*n+.114*o)/255<.45?"#fff":"#000"}catch{return"#000"}}(t);return Be("div",{style:{position:"absolute",inset:0,zIndex:2,pointerEvents:o?e?"none":"auto":"none",cursor:e?"move":o?"pointer":"default"},onPointerDown:o,children:!i&&Be("svg",{style:{position:"absolute",inset:0,pointerEvents:"none"},viewBox:"0 0 20 20",width:"100%",height:"100%",children:[Be("path",{d:"M 0.5 15.5 L 0.5 0.5 L 19.5 0.5 L 19.5 15.5 L 8.5 15.5 L 6.5 19.5 L 4.5 15.5 Z",fill:t,opacity:n,stroke:r,strokeWidth:"1",strokeLinejoin:"miter"}),Be("line",{x1:"2.5",y1:"4.25",x2:"17.5",y2:"4.25",stroke:r,strokeWidth:"1"}),Be("line",{x1:"2.5",y1:"8",x2:"17.5",y2:"8",stroke:r,strokeWidth:"1"}),Be("line",{x1:"2.5",y1:"11.75",x2:"17.5",y2:"11.75",stroke:r,strokeWidth:"1"})]})})}function Om({documentId:e,isSelected:t,isEditing:n,annotation:o,pageIndex:i,scale:r,onClick:a,appearanceActive:s=!1}){const l=Pe(null),c=Pe(!1),{provides:d}=fm(),u=(null==d?void 0:d.forDocument(e))??null,{adjustedFontPx:h,wrapperStyle:m}=wm(o.object.fontSize*r,n);Me(()=>{var e;if(n&&l.current){c.current=!0;const t=l.current;t.focus();const n=null==u?void 0:u.findToolForAnnotation(o.object),i=null!=(null==(e=null==n?void 0:n.defaults)?void 0:e.contents)&&o.object.contents===n.defaults.contents,r=window.getSelection();if(r){const e=document.createRange();e.selectNodeContents(t),i||e.collapse(!1),r.removeAllRanges(),r.addRange(e)}}},[n]);return Be("div",{style:{position:"absolute",width:o.object.rect.size.width*r,height:o.object.rect.size.height*r,cursor:t&&!n?"move":"default",pointerEvents:a?t&&!n?"none":"auto":"none",zIndex:2,opacity:s?0:1},onPointerDown:a,children:Be("span",{ref:l,onBlur:()=>{c.current&&(c.current=!1,u&&l.current&&u.updateAnnotation(i,o.object.id,{contents:l.current.innerText.replace(/\u00A0/g," ")}))},tabIndex:0,style:{color:o.object.fontColor,fontSize:h,...Pn(o.object.fontFamily),textAlign:vn(o.object.textAlign),flexDirection:"column",justifyContent:o.object.verticalAlign===Tt.Top?"flex-start":o.object.verticalAlign===Tt.Middle?"center":"flex-end",display:"flex",backgroundColor:o.object.color??o.object.backgroundColor,opacity:o.object.opacity,width:"100%",height:"100%",lineHeight:"1.18",overflow:"hidden",cursor:n?"text":a?"pointer":"default",outline:"none",...m},contentEditable:n,...dm,children:o.object.contents})})}function Nm({documentId:e,pageIndex:t,annotation:n,scaleFactor:o=1,unrotated:i,style:r,...a}){const{provides:s}=fm(),[l,c]=Se(null),d=Pe(null),{width:u,height:h}=n.rect.size;Me(()=>{if(s){const r=s.forDocument(e).renderAnnotation({pageIndex:t,annotation:n,options:{scaleFactor:o,dpr:window.devicePixelRatio,unrotated:i}});return r.wait(e=>{const t=URL.createObjectURL(e);c(t),d.current=t},Bn),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):r.abort({code:sn.Cancelled,message:"canceled render task"})}}},[t,o,i,s,e,n.id,u,h]);return Be(B,{children:l&&Be("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...a,style:{width:"100%",height:"100%",display:"block",...r||{}}})})}function Lm({isSelected:e,annotation:t,documentId:n,pageIndex:o,scale:i,onClick:r}){const a=!!t.object.rotation&&!!t.object.unrotatedRect;return Be("div",{style:{position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:r?e?"none":"auto":"none",cursor:r?"pointer":"default"},onPointerDown:r,children:Be(Nm,{documentId:n,pageIndex:o,annotation:{...t.object,id:t.object.id},scaleFactor:i,unrotated:a})})}function _m({isSelected:e,strokeColor:t="#0000FF",strokeWidth:n=2,strokeStyle:o=Ht.UNDERLINE,strokeDashArray:i,rect:r,scale:a,onClick:s,hasIRT:l=!1}){const{width:c,height:d}=Te(()=>({width:r.size.width,height:r.size.height}),[r]),u=c*a,h=d*a,m=Te(()=>{if(o===Ht.DASHED)return(null==i?void 0:i.join(","))??`${3*n},${n}`},[o,i,n]),g=o===Ht.UNDERLINE;return Be("svg",{style:{position:"absolute",width:u,height:h,pointerEvents:"none",zIndex:2},width:u,height:h,viewBox:`0 0 ${c} ${d}`,children:[Be("rect",{x:0,y:0,width:c,height:d,fill:"transparent",onPointerDown:l?void 0:s,style:{cursor:l||!s?"default":e?"move":"pointer",pointerEvents:l||!s||e?"none":"visible"}}),g?Be("line",{x1:1,y1:d-1,x2:c-1,y2:d-1,stroke:t,strokeWidth:n,strokeDasharray:m,style:{pointerEvents:"none"}}):Be("rect",{x:n/2,y:n/2,width:Math.max(c-n,0),height:Math.max(d-n,0),fill:"transparent",stroke:t,strokeWidth:n,strokeDasharray:m,style:{pointerEvents:"none"}})]})}function Fm({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a,appearanceActive:s=!1}){const l=e??"#FFFF00";return Be(B,{children:n.map((e,n)=>Be("div",{onPointerDown: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:s?"transparent":l,opacity:s?void 0:t,pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:void 0,...a}},n))})}function $m({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a,appearanceActive:s=!1}){const l=e??"#FFFF00",c=2*i;return Be(B,{children:n.map((e,n)=>Be("div",{onPointerDown: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:!s&&Be("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:c,background:l,opacity:t,pointerEvents:"none"}})},n))})}function jm({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a,appearanceActive:s=!1}){const l=e??"#FFFF00",c=2*i;return Be(B,{children:n.map((e,n)=>Be("div",{onPointerDown: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:!s&&Be("div",{style:{position:"absolute",left:0,top:"50%",width:"100%",height:c,background:l,opacity:t,transform:"translateY(-50%)",pointerEvents:"none"}})},n))})}function Um({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a,appearanceActive:s=!1}){const l=2*i,c=6*i,d=`url("data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${c}" height="${2*l}" viewBox="0 0 ${c} ${2*l}">\n <path d="M0 ${l} Q ${c/4} 0 ${c/2} ${l} T ${c} ${l}"\n fill="none" stroke="${e??"#FFFF00"}" stroke-width="${l}" stroke-linecap="round"/>\n </svg>`)}")`;return Be(B,{children:n.map((e,n)=>Be("div",{onPointerDown: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:!s&&Be("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:2*l,backgroundImage:d,backgroundRepeat:"repeat-x",backgroundSize:`${c}px ${2*l}px`,opacity:t,pointerEvents:"none"}})},n))})}function Bm({isSelected:e,strokeColor:t="#000000",opacity:n=1,rect:o,scale:i,onClick:r,appearanceActive:a=!1}){const{width:s,height:l,path:c}=Te(()=>{const e=o.size.width,t=o.size.height,n=e/2;return{width:e,height:t,path:[`M 0 ${t}`,`C ${.27*e} ${t} ${n} ${t-.44*t} ${n} 0`,`C ${n} ${t-.44*t} ${e-.27*e} ${t} ${e} ${t}`,"Z"].join(" ")}},[o]),d=s*i,u=l*i;return Be("svg",{style:{position:"absolute",width:d,height:u,pointerEvents:"none",zIndex:2},width:d,height:u,viewBox:`0 0 ${s} ${l}`,overflow:"visible",children:[Be("path",{d:c,fill:"transparent",stroke:"transparent",strokeWidth:4,onPointerDown:r,style:{cursor:e?"move":r?"pointer":"default",pointerEvents:r?e?"none":"visible":"none"}}),!a&&Be("path",{d:c,fill:t,stroke:t,strokeWidth:.5,opacity:n,fillRule:"evenodd",style:{pointerEvents:"none"}})]})}function Wm({annotation:e,documentId:t}){const{provides:n}=fm();return Be("div",{onClick:Re(()=>{const o=e.object.target;o&&n&&n.forDocument(t).navigateTarget(o)},[e.object.target,n,t]),style:{width:"100%",height:"100%",cursor:"pointer",pointerEvents:"auto"}})}const Hm=[Am({id:"ink",matches:e=>e.type===_t.INK,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(Mm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i}),interactionDefaults:{isDraggable:!0,isResizable:!0,isRotatable:!0}}),Am({id:"square",matches:e=>e.type===_t.SQUARE,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(Dm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i}),interactionDefaults:{isDraggable:!0,isResizable:!0,isRotatable:!0}}),Am({id:"circle",matches:e=>e.type===_t.CIRCLE,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(Pm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i}),interactionDefaults:{isDraggable:!0,isResizable:!0,isRotatable:!0}}),Am({id:"line",matches:e=>e.type===_t.LINE,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(B,{children:Be(Tm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i})}),vertexConfig:{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})},interactionDefaults:{isDraggable:!0,isResizable:!1,isRotatable:!0}}),Am({id:"polyline",matches:e=>e.type===_t.POLYLINE,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(B,{children:Be(Rm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i})}),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},interactionDefaults:{isDraggable:!0,isResizable:!1,isRotatable:!0}}),Am({id:"polygon",matches:e=>e.type===_t.POLYGON,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(B,{children:Be(zm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i})}),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},interactionDefaults:{isDraggable:!0,isResizable:!1,isRotatable:!0}}),Am({id:"highlight",matches:e=>e.type===_t.HIGHLIGHT,render:({currentObject:e,scale:t,onClick:n,appearanceActive:o})=>Be(Fm,{...e,scale:t,onClick:n,appearanceActive:o}),zIndex:0,interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},defaultBlendMode:Rt.Multiply}),Am({id:"underline",matches:e=>e.type===_t.UNDERLINE,render:({currentObject:e,scale:t,onClick:n,appearanceActive:o})=>Be($m,{...e,scale:t,onClick:n,appearanceActive:o}),zIndex:0,interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1}}),Am({id:"strikeout",matches:e=>e.type===_t.STRIKEOUT,render:({currentObject:e,scale:t,onClick:n,appearanceActive:o})=>Be(jm,{...e,scale:t,onClick:n,appearanceActive:o}),zIndex:0,interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1}}),Am({id:"squiggly",matches:e=>e.type===_t.SQUIGGLY,render:({currentObject:e,scale:t,onClick:n,appearanceActive:o})=>Be(Um,{...e,scale:t,onClick:n,appearanceActive:o}),zIndex:0,interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1}}),Am({id:"text",matches:e=>e.type===_t.TEXT&&!e.inReplyToId,render:({currentObject:e,isSelected:t,onClick:n,appearanceActive:o})=>Be(Em,{isSelected:t,color:e.strokeColor??e.color,opacity:e.opacity,onClick:n,appearanceActive:o}),interactionDefaults:{isDraggable:!0,isResizable:!1,isRotatable:!1}}),Am({id:"caret",matches:e=>e.type===_t.CARET,render:({currentObject:e,isSelected:t,scale:n,onClick:o,appearanceActive:i})=>Be(Bm,{...e,isSelected:t,scale:n,onClick:o,appearanceActive:i}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1}}),Am({id:"freeText",matches:e=>e.type===_t.FREETEXT,render:({annotation:e,currentObject:t,isSelected:n,isEditing:o,scale:i,pageIndex:r,documentId:a,onClick:s,appearanceActive:l})=>Be(Om,{documentId:a,isSelected:n,isEditing:o,annotation:{...e,object:t},pageIndex:r,scale:i,onClick:s,appearanceActive:l}),interactionDefaults:{isDraggable:!0,isResizable:!0,isRotatable:!0},isDraggable:(e,{isEditing:t})=>e&&!t,onDoubleClick:(e,t)=>t(e)}),Am({id:"stamp",matches:e=>e.type===_t.STAMP,render:({annotation:e,isSelected:t,documentId:n,pageIndex:o,scale:i,onClick:r})=>Be(Lm,{isSelected:t,annotation:e,documentId:n,pageIndex:o,scale:i,onClick:r}),useAppearanceStream:!1,interactionDefaults:{isDraggable:!0,isResizable:!0,isRotatable:!0}}),Am({id:"link",matches:e=>e.type===_t.LINK,render:({currentObject:e,isSelected:t,scale:n,onClick:o})=>Be(_m,{...e,isSelected:t,scale:n,onClick:o,hasIRT:!!e.inReplyToId}),renderPreview:({data:e,bounds:t,scale:n})=>Be("div",{style:{position:"absolute",left:0,top:0,width:t.size.width*n,height:t.size.height*n,borderBottom:`${e.strokeWidth*n}px solid ${e.strokeColor}`,backgroundColor:"rgba(0, 0, 255, 0.05)",boxSizing:"border-box"}}),interactionDefaults:{isDraggable:!0,isResizable:!0,isRotatable:!1},useAppearanceStream:!1,selectOverride:(e,t,n)=>{if(e.stopPropagation(),n.clearSelection(),t.object.inReplyToId){const e=n.allAnnotations.find(e=>e.object.id===t.object.inReplyToId);if(e)return void n.selectAnnotation(e.object.pageIndex,e.object.id)}n.selectAnnotation(n.pageIndex,t.object.id)},hideSelectionMenu:e=>!!e.inReplyToId,renderLocked:e=>Be(Wm,{...e})})];function Gm(e){const{documentId:t,pageIndex:n,scale:o,pageWidth:i,pageHeight:r,selectionMenu:a}=e,{provides:s}=fm(),{provides:l}=Vl(),[c,d]=Se([]),{register:u}=function({modeId:e,pageIndex:t,documentId:n}){const{provides:o}=nm();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}),[h,m]=Se([]),[g,p]=Se(null),[f,v]=Se({}),[y,b]=Se({type:ld.None}),w=Pe(o),x=Te(()=>s?s.forDocument(t):null,[s,t]),k=h.length>1;Me(()=>{if(x){const e=x.getState();return d(fd(e,n)),m(yd(e)),b(e.locked),x.onStateChange(e=>{d(fd(e,n)),m(yd(e)),b(e.locked)})}},[x,n]),Me(()=>{if(x)return x.onAnnotationEvent(e=>{"create"===e.type&&e.editAfterCreate&&p(e.annotation.id)})},[x]),Me(()=>{if(!x)return;w.current!==o&&(x.invalidatePageAppearances(n),w.current=o);x.getPageAppearances(n,{scaleFactor:o,dpr:"undefined"!=typeof window?window.devicePixelRatio:1}).wait(e=>v(e),()=>v({}))},[x,n,o]);const C=Te(()=>({onPointerDown:(e,t)=>{t.target===t.currentTarget&&x&&(g&&c.some(e=>e.object.id===g)&&t.stopImmediatePropagation(),x.deselectAnnotation(),p(null))}}),[x,g,c]),I=Re((e,t)=>{if(e.stopPropagation(),x&&l){l.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?x.toggleSelection(n,t.object.id):x.selectAnnotation(n,t.object.id),t.object.id!==g&&p(null)}},[x,l,g,n]);Me(()=>u(C,{documentId:t}),[u,C]);const S=Te(()=>c.filter(e=>h.includes(e.object.id)),[c,h]),A=Te(()=>!(S.length<2)&&S.every(e=>{const t=null==x?void 0:x.findToolForAnnotation(e.object),n=th(null==t?void 0:t.interaction.isGroupDraggable,e.object,!0),o=th(null==t?void 0:t.interaction.isDraggable,e.object,!0);return void 0!==(null==t?void 0:t.interaction.isGroupDraggable)?n:o}),[S,x]),M=Te(()=>!(S.length<2)&&S.every(e=>{const t=null==x?void 0:x.findToolForAnnotation(e.object),n=th(null==t?void 0:t.interaction.isGroupResizable,e.object,!0),o=th(null==t?void 0:t.interaction.isResizable,e.object,!0);return void 0!==(null==t?void 0:t.interaction.isGroupResizable)?n:o}),[S,x]),D=Te(()=>!(S.length<2)&&S.every(e=>{const t=null==x?void 0:x.findToolForAnnotation(e.object),n=th(null==t?void 0:t.interaction.isGroupRotatable,e.object,!0),o=th(null==t?void 0:t.interaction.isRotatable,e.object,!0);return void 0!==(null==t?void 0:t.interaction.isGroupRotatable)?n:o}),[S,x]),P=Te(()=>!(S.length<2)&&S.some(e=>{const t=null==x?void 0:x.findToolForAnnotation(e.object),n=th(null==t?void 0:t.interaction.lockGroupAspectRatio,e.object,!1),o=th(null==t?void 0:t.interaction.lockAspectRatio,e.object,!1);return void 0!==(null==t?void 0:t.interaction.lockGroupAspectRatio)?n:o}),[S,x]),T=Te(()=>{if(!x)return!1;const e=x.getSelectedAnnotations();return e.length>1&&e.every(e=>e.object.pageIndex===n)},[x,n,h]),R=Re(e=>{if(e.dictMode)return null;if(e.object.rotation&&e.object.unrotatedRect)return null;const t=f[e.object.id];return(null==t?void 0:t.normal)?t:null},[f]),z=Te(()=>{const t=e.annotationRenderers??[],n=new Set(t.map(e=>e.id));return[...t,...Hm.filter(e=>!n.has(e.id))]},[e.annotationRenderers]),E=Re(e=>z.find(t=>t.matches(e.object))??null,[z]),O=Te(()=>({defaultSelect:I,selectAnnotation:(e,t)=>null==x?void 0:x.selectAnnotation(e,t),clearSelection:()=>null==l?void 0:l.clear(),allAnnotations:c,pageIndex:n}),[I,x,l,c,n]);return Be(B,{children:[c.map(i=>{var r,s,l;const c=E(i);if(!c)return null;const d=(null==x?void 0:x.findToolForAnnotation(i.object))??null,u=md(d),m=pd(i.object)||gd(u,y);if(m&&c.hiddenWhenLocked)return null;const f=m&&!!c.renderLocked,v=!m&&h.includes(i.object.id),b=!m&&g===i.object.id,w=c.interactionDefaults,C=th(null==d?void 0:d.interaction.isDraggable,i.object,(null==w?void 0:w.isDraggable)??!0),S=!m&&(c.isDraggable?c.isDraggable(C,{isEditing:b}):C),A=(null==(r=null==d?void 0:d.behavior)?void 0:r.useAppearanceStream)??c.useAppearanceStream??!0,M=f?void 0:A?R(i):void 0,D=m?e=>{e.stopPropagation()}:c.selectOverride?e=>c.selectOverride(e,i,O):e=>I(e,i);return Be(km,{trackedAnnotation:i,isSelected:v,isEditing:b,isMultiSelected:!m&&k,isDraggable:S,isResizable:!m&&th(null==d?void 0:d.interaction.isResizable,i.object,(null==w?void 0:w.isResizable)??!1),lockAspectRatio:th(null==d?void 0:d.interaction.lockAspectRatio,i.object,(null==w?void 0:w.lockAspectRatio)??!1),isRotatable:!m&&th(null==d?void 0:d.interaction.isRotatable,i.object,(null==w?void 0:w.isRotatable)??!1),vertexConfig:m?void 0:c.vertexConfig,selectionMenu:m||(null==(s=c.hideSelectionMenu)?void 0:s.call(c,i.object))?void 0:a,onSelect:D,onDoubleClick:m?void 0:c.onDoubleClick?e=>{e.stopPropagation(),c.onDoubleClick(i.object.id,p)}:void 0,zIndex:c.zIndex,blendMode:On(i.object.blendMode??c.defaultBlendMode??Rt.Normal),style:null==(l=c.containerStyle)?void 0:l.call(c,i.object),appearance:M,...e,children:(e,{appearanceActive:r})=>f?c.renderLocked({annotation:i,currentObject:e,isSelected:!1,isEditing:!1,scale:o,pageIndex:n,documentId:t,onClick:void 0,appearanceActive:r}):c.render({annotation:i,currentObject:e,isSelected:v,isEditing:b,scale:o,pageIndex:n,documentId:t,onClick:m?void 0:D,appearanceActive:r})},i.object.id)}),T&&S.length>=2&&Be(Sm,{documentId:t,pageIndex:n,scale:o,rotation:e.rotation,pageWidth:i,pageHeight:r,selectedAnnotations:S,isDraggable:A,isResizable:M,isRotatable:D,lockAspectRatio:P,resizeUI:e.resizeUI,rotationUI:e.rotationUI,selectionOutlineColor:e.selectionOutlineColor,selectionOutline:e.groupSelectionOutline??e.selectionOutline,groupSelectionMenu:e.groupSelectionMenu})]})}function qm({documentId:e,pageIndex:t,scale:n}){var o,i,r,a,s,l,c,d,u,h,m,g;const{provides:p}=Vl(),{provides:f}=fm(),[v,y]=Se([]),[b,w]=Se(null),[x,k]=Se(null);if(Me(()=>{if(p)return p.forDocument(e).onSelectionChange(()=>{y(p.forDocument(e).getHighlightRectsForPage(t)),w(p.forDocument(e).getBoundingRectForPage(t))})},[p,e,t]),Me(()=>{if(f)return k(f.forDocument(e).getActiveTool()),f.forDocument(e).onActiveToolChange(e=>k(e))},[f,e]),!b)return null;if(!x||!x.defaults)return null;switch(x.defaults.type){case _t.UNDERLINE:return Be("div",{style:{mixBlendMode:On((null==(o=x.defaults)?void 0:o.blendMode)??Rt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:Be($m,{strokeColor:null==(i=x.defaults)?void 0:i.strokeColor,opacity:null==(r=x.defaults)?void 0:r.opacity,segmentRects:v,scale:n})});case _t.HIGHLIGHT:return Be("div",{style:{mixBlendMode:On((null==(a=x.defaults)?void 0:a.blendMode)??Rt.Multiply),pointerEvents:"none",position:"absolute",inset:0},children:Be(Fm,{strokeColor:null==(s=x.defaults)?void 0:s.strokeColor,opacity:null==(l=x.defaults)?void 0:l.opacity,segmentRects:v,scale:n})});case _t.STRIKEOUT:return Be("div",{style:{mixBlendMode:On((null==(c=x.defaults)?void 0:c.blendMode)??Rt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:Be(jm,{strokeColor:null==(d=x.defaults)?void 0:d.strokeColor,opacity:null==(u=x.defaults)?void 0:u.opacity,segmentRects:v,scale:n})});case _t.SQUIGGLY:return Be("div",{style:{mixBlendMode:On((null==(h=x.defaults)?void 0:h.blendMode)??Rt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:Be(Um,{strokeColor:null==(m=x.defaults)?void 0:m.strokeColor,opacity:null==(g=x.defaults)?void 0:g.opacity,segmentRects:v,scale:n})});case _t.CARET:default:return null}}function Vm({toolId:e,preview:t,scale:n}){const{bounds:o}=t,i=gm(),r={position:"absolute",left:o.origin.x*n,top:o.origin.y*n,width:o.size.width*n,height:o.size.height*n,pointerEvents:"none",zIndex:10};if(t.type===_t.CIRCLE)return Be("div",{style:r,children:Be(Pm,{isSelected:!1,scale:n,...t.data})});if(t.type===_t.SQUARE)return Be("div",{style:r,children:Be(Dm,{isSelected:!1,scale:n,...t.data})});if(t.type===_t.POLYGON)return Be("div",{style:r,children:Be(zm,{isSelected:!1,scale:n,...t.data})});if(t.type===_t.POLYLINE)return Be("div",{style:r,children:Be(Rm,{isSelected:!1,scale:n,...t.data})});if(t.type===_t.LINE)return Be("div",{style:r,children:Be(Tm,{isSelected:!1,scale:n,...t.data})});if(t.type===_t.INK)return Be("div",{style:{...r,mixBlendMode:On(t.data.blendMode??Rt.Normal)},children:Be(Mm,{isSelected:!1,scale:n,...t.data})});if(t.type===_t.FREETEXT)return Be("div",{style:r,children:Be("div",{style:{width:"100%",height:"100%",border:`1px dashed ${t.data.fontColor||"#000000"}`,backgroundColor:"transparent"}})});const a=i.find(t=>t.id===e&&t.renderPreview);return(null==a?void 0:a.renderPreview)?Be("div",{style:r,children:a.renderPreview({data:t.data,bounds:t.bounds,scale:n})}):null}function Km({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=pm(),[i,r]=Se(new Map),a=Pe(null),s=Pe(null),l=Te(()=>({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 Me(()=>{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]),Be(B,{children:[Be("input",{ref:a,type:"file",style:{display:"none"}}),Be("canvas",{ref:s,style:{display:"none"}}),Array.from(i.entries()).map(([e,t])=>Be(Vm,{toolId:e,preview:t,scale:n},e))]})}function Zm({style:e,documentId:t,pageIndex:n,scale:o,rotation:i,selectionMenu:r,groupSelectionMenu:a,resizeUI:s,vertexUI:l,rotationUI:c,selectionOutlineColor:d,selectionOutline:u,groupSelectionOutline:h,customAnnotationRenderer:m,annotationRenderers:g,...p}){var f,v,y,b;const w=Go(t),x=null==(v=null==(f=null==w?void 0:w.document)?void 0:f.pages)?void 0:v[n],k=(null==(y=null==x?void 0:x.size)?void 0:y.width)??0,C=(null==(b=null==x?void 0:x.size)?void 0:b.height)??0,I=gm(),S=Te(()=>{const e=[...I];for(const t of g??[]){const n=e.findIndex(e=>e.id===t.id);n>=0?e[n]=t:e.push(t)}return e},[I,g]),A=Te(()=>void 0!==o?o:(null==w?void 0:w.scale)??1,[o,null==w?void 0:w.scale]);return Be("div",{style:{...e},...p,children:[Be(Gm,{documentId:t,selectionMenu:r,groupSelectionMenu:a,pageIndex:n,scale:A,rotation:Te(()=>{if(void 0!==i)return i;return(((null==x?void 0:x.rotation)??0)+((null==w?void 0:w.rotation)??0))%4},[i,null==x?void 0:x.rotation,null==w?void 0:w.rotation]),pageWidth:k,pageHeight:C,resizeUI:s,vertexUI:l,rotationUI:c,selectionOutlineColor:d,selectionOutline:u,groupSelectionOutline:h,customAnnotationRenderer:m,annotationRenderers:S}),Be(qm,{documentId:t,pageIndex:n,scale:A}),Be(Km,{documentId:t,pageIndex:n,scale:A})]})}const Xm=Fo(sh).addWrapper(function({children:e}){const[t,n]=Se([]),o=Re(e=>(n(t=>{const n=new Set(e.map(e=>e.id));return[...t.filter(e=>!n.has(e.id)),...e]}),()=>n(t=>t.filter(t=>!e.some(e=>e.id===t.id)))),[]);return Be(um.Provider,{value:o,children:Be(hm.Provider,{value:t,children:e})})}).addUtility(function(){const{plugin:e}=pm(),{provides:t}=fm();return Me(()=>{if(t&&e)return t.onNavigate(t=>{"uri"===t.result.outcome&&!1!==e.config.autoOpenLinks&&window.open(t.result.uri,"_blank","noopener,noreferrer")})},[t,e]),null}).build(),Ym="print",Qm={id:Ym,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{}},Jm=class extends So{constructor(e,t,n){super(e,t),this.printReady$=Oo()}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();if(!this.checkPermission(n,on.Print))return this.logger.debug("PrintPlugin","Print",`Cannot print: document ${n} lacks Print permission`),ln.reject({code:sn.Security,message:"Document lacks Print permission"});const o=e??{},i=new kt;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):ln.reject({code:sn.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()}};Jm.id="print";let eg=Jm;const tg=()=>Wo(eg.id);const ng=Fo({manifest:Qm,create:(e,t)=>new eg(Ym,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{provides:e}=tg(),{plugin:t}=Bo(eg.id),n=Pe(null),o=Pe(null);return Me(()=>{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]),Be("iframe",{ref:n,style:{position:"absolute",display:"none"},title:"Print Document",src:"about:blank"})}).build(),og="fullscreen",ig={id:og,name:"Fullscreen Plugin",version:"1.0.0",provides:["fullscreen"],requires:[],optional:[],defaultConfig:{}},rg="SET_FULLSCREEN";const ag=class extends So{constructor(e,t,n){super(e,t),this.onStateChange$=No(),this.fullscreenRequest$=Oo(),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:rg,payload:e})}async destroy(){this.fullscreenRequest$.clear(),super.destroy()}};ag.id="fullscreen";let sg=ag;const lg=()=>Bo(sg.id);async function cg(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 dg=Fo({manifest:ig,create:(e,t)=>new sg(og,e,t),reducer:(e,t)=>t.type===rg?{...e,isFullscreen:t.payload}:e,initialState:{isFullscreen:!1}}).addWrapper(function({children:e,...t}){const{provides:n}=Wo(sg.id),{plugin:o}=lg(),{plugin:i}=lg(),r=Pe(null);return Me(()=>{if(!n||!o)return;return n.onRequest(async e=>{const t=o.getTargetSelector();await cg(e,r.current,t)})},[n,o]),Me(()=>{if(!i)return;const e=()=>i.setFullscreenState(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[i]),Be("div",{...t,style:{position:"relative",width:"100%",height:"100%",...t.style},ref:r,children:e})}).build(),ug="bookmark",hg={id:ug,name:"Bookmark Plugin",version:"1.0.0",provides:["bookmark"],requires:[],optional:[],defaultConfig:{}},mg=class extends So{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)}};mg.id="bookmark";let gg=mg;const pg={manifest:hg,create:e=>new gg(ug,e),reducer:()=>{},initialState:{}},fg=class extends So{constructor(e,t,n){super(e,t),this.downloadRequest$=Oo(),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):ln.reject({code:sn.DocNotOpen,message:`Document ${t} not found`})}saveAsCopyAndGetBufferAndName(e){const t=new kt,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):ln.reject({code:sn.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()}};fg.id="export";let vg=fg;const yg="export";const bg=Fo({manifest:{id:yg,name:"Export Plugin",version:"1.0.0",provides:["export"],requires:[],optional:[],defaultConfig:{defaultFileName:"document.pdf"}},create:(e,t)=>new vg(yg,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{plugin:e}=Bo(vg.id),t=Pe(null);return Me(()=>{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)},Bn)})},[e]),Be("a",{style:{display:"none"},ref:t})}).build(),wg="PAN/INIT_STATE",xg="PAN/CLEANUP_STATE",kg="PAN/SET_PAN_MODE";const Cg=class extends So{constructor(e,t,n){var o,i,r;super(e,t),this.panMode$=No(),this.documentHandlers=new Map,this.config=n,this.interactionManager=null==(o=t.getPlugin(Qh.id))?void 0:o.provides(),this.viewport=null==(i=t.getPlugin(pi.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:kg,payload:{documentId:e,isPanMode:t}}}(e.documentId,t))}))}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:wg,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:xg,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()}};Cg.id="pan";let Ig=Cg;const Sg={documents:{},activeDocumentId:null},Ag=Fo({manifest:{id:"pan",name:"Pan Plugin",version:"1.0.0",provides:["pan"],requires:["interaction-manager","viewport"],optional:[],defaultConfig:{defaultMode:"mobile"}},create:(e,t)=>new Ig("pan",e,t),reducer:(e=Sg,t)=>{switch(t.type){case wg:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case xg:{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 kg:{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:Sg}).addUtility(()=>{const{provides:e}=Wo(Ig.id),{plugin:t}=Bo(Ig.id);return Me(()=>{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(),Mg="capture",Dg={id:Mg,name:"Capture Plugin",version:"1.0.0",provides:["capture"],requires:["render"],optional:["interaction-manager"],defaultConfig:{scale:1,imageType:"image/png",withAnnotations:!1}};const Pg="CAPTURE/INIT_STATE",Tg="CAPTURE/CLEANUP_STATE",Rg="CAPTURE/SET_MARQUEE_CAPTURE_ACTIVE";const zg={isMarqueeCaptureActive:!1},Eg={documents:{},activeDocumentId:null},Og=class extends So{constructor(e,t,n){var o;super(e,t),this.captureArea$=Oo(),this.state$=No(),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:Rg,payload:{documentId:o,isActive:t}}))}))}onDocumentLoadingStarted(e){const t={...zg};this.dispatch(function(e,t){return{type:Pg,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:Tg,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=Po(e.x,0,t.width),o=Po(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})},Bn)}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()}};Og.id="capture";let Ng=Og;const Lg={manifest:Dg,create:(e,t)=>new Ng(Mg,e,t),reducer:(e=Eg,t)=>{switch(t.type){case Pg:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Tg:{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 Rg:{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:Eg},_g=()=>Wo(Ng.id),Fg=({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}=_g(),s=Go(e),[l,c]=Se(null),d=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Me(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?Be("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},$g="history",jg={id:$g,name:"History Plugin",version:"1.0.0",provides:["history"],requires:[],optional:[],defaultConfig:{}},Ug="HISTORY/INIT_STATE",Bg="HISTORY/CLEANUP_STATE",Wg="HISTORY/SET_DOCUMENT_STATE",Hg=class extends So{constructor(e,t){super(e,t),this.documentHistories=new Map,this.historyChange$=Oo()}async initialize(e){this.logger.info("HistoryPlugin","Initialize","History plugin initialized")}onDocumentLoadingStarted(e){this.dispatch((e=>({type:Ug,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:Bg,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:Wg,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}purgeByMetadata(e,t,n){const o=this.getDocumentHistoryData(n);let i=0;const r=t=>e(t.metadata),a=t?[t]:Array.from(o.topicHistories.keys());for(const e of a){const t=o.topicHistories.get(e);if(!t)continue;const n=[];let a=0;for(let e=0;e<t.commands.length;e++){const o=t.commands[e];r(o)?(e<=t.currentIndex&&a++,i++):n.push(o)}t.commands=n,t.currentIndex=Math.max(-1,t.currentIndex-a)}const s=[];let l=0;for(let e=0;e<o.globalTimeline.length;e++){const n=o.globalTimeline[e];(!t||n.topic===t)&&r(n.command)?e<=o.globalIndex&&l++:s.push(n)}return o.globalTimeline=s,o.globalIndex=Math.max(-1,o.globalIndex-l),i>0&&(this.emitHistoryChange(n,t),this.logger.debug("HistoryPlugin","PurgeByMetadata",`Purged ${i} history entries for document: ${n}${t?`, topic: ${t}`:""}`)),i}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)}),purgeByMetadata:(t,n)=>this.purgeByMetadata(t,n,e)}}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,purgeByMetadata:(e,t)=>{const n=this.getActiveDocumentId();return this.purgeByMetadata(e,t,n)}}}async destroy(){this.historyChange$.clear(),this.documentHistories.clear(),super.destroy()}};Hg.id="history";let Gg=Hg;const qg={global:{canUndo:!1,canRedo:!1},topics:{}},Vg={documents:{},activeDocumentId:null},Kg={manifest:jg,create:e=>new Gg($g,e),reducer:(e=Vg,t)=>{switch(t.type){case Ug:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...qg}}}}case Bg:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case Wg:{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:Vg};var Zg=(e=>(e.Redact="redact",e.MarqueeRedact="marqueeRedact",e.RedactSelection="redactSelection",e))(Zg||{});const Xg="REDACTION/INIT_STATE",Yg="REDACTION/CLEANUP_STATE",Qg="START_REDACTION",Jg="END_REDACTION",ep="ADD_PENDING",tp="REMOVE_PENDING",np="UPDATE_PENDING",op="CLEAR_PENDING",ip="SELECT_PENDING",rp="DESELECT_PENDING";const ap=(e,t)=>({type:ep,payload:{documentId:e,items:t}}),sp=(e,t,n)=>({type:tp,payload:{documentId:e,page:t,id:n}}),lp=e=>({type:op,payload:e}),cp=(e,t,n,o)=>({type:np,payload:{documentId:e,page:t,id:n,patch:o}}),dp=(e,t,n)=>({type:ip,payload:{documentId:e,page:t,id:n}}),up=e=>({type:rp,payload:e}),hp=e=>Object.values(e).reduce((e,t)=>e+t.length,0),mp={isRedacting:!1,activeType:null,pending:{},pendingCount:0,selected:null},gp={documents:{},activeDocumentId:null},pp={id:"redact",name:"Redact",categories:["annotation","redaction"],matchScore:e=>e.type===_t.REDACT?10:0,interaction:{mode:Zg.Redact,exclusive:!1,cursor:"crosshair",textSelection:!0,isDraggable:e=>{var t;return e.type!==_t.REDACT||!(null==(t=e.segmentRects)?void 0:t.length)},isResizable:e=>{var t;return e.type!==_t.REDACT||!(null==(t=e.segmentRects)?void 0:t.length)},isRotatable:!1,lockAspectRatio:!1,isGroupDraggable:!1,isGroupResizable:!1,isGroupRotatable:!1},defaults:{type:_t.REDACT,color:"#000000",overlayColor:"#FFFFFF",strokeColor:"#E44234",opacity:1},behavior:{useAppearanceStream:!1}},fp=[pp],vp=class extends So{constructor(e,t,n){var o,i,r,a;if(super(e,t),this.redactionSelection$=new Map,this.redactionMarquee$=new Map,this.pending$=No(),this.selected$=No(),this.state$=No(),this.events$=No(),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.annotationCapability=null==(r=this.registry.getPlugin("annotation"))?void 0:r.provides(),this.historyCapability=null==(a=this.registry.getPlugin("history"))?void 0:a.provides(),this.config.useAnnotationMode?this.annotationCapability?this.useAnnotationMode=!0:(this.logger.warn("RedactionPlugin","ConfigError","useAnnotationMode is enabled but annotation plugin is not available. Falling back to legacy mode."),this.useAnnotationMode=!1):this.useAnnotationMode=!1,this.useAnnotationMode&&this.annotationCapability)for(const e of fp)this.annotationCapability.addTool(e);this.setupRedactionModes(),!this.useAnnotationMode&&this.annotationCapability&&this.logger.info("RedactionPlugin","LegacyMode","Using legacy redaction mode. Set useAnnotationMode: true in config to use annotation-based redactions."),this.setupModeChangeListener()}setupRedactionModes(){this.interactionManagerCapability&&(this.interactionManagerCapability.registerMode({id:Zg.Redact,scope:"page",exclusive:!1,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:Zg.MarqueeRedact,scope:"page",exclusive:!1,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:Zg.RedactSelection,scope:"page",exclusive:!1}))}setupModeChangeListener(){var e;null==(e=this.interactionManagerCapability)||e.onModeChange(e=>{const t=e.documentId;if(e.activeMode===Zg.Redact||e.activeMode===Zg.MarqueeRedact||e.activeMode===Zg.RedactSelection)this.dispatch(((e,t)=>({type:Qg,payload:{documentId:e,mode:t}}))(t,e.activeMode));else{const e=this.getDocumentState(t);(null==e?void 0:e.isRedacting)&&this.dispatch((e=>({type:Jg,payload:e}))(t))}})}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Xg,payload:{documentId:e,state:t}}}(e,{...mp})),this.redactionSelection$.set(e,No()),this.redactionMarquee$.set(e,No());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;if(!this.checkPermission(e,on.ModifyContents))return;const o=n.getFormattedSelection();if(!o.length)return;const i=n.getSelectedText(),r=this.redactionSelection$.get(e);null==r||r.emit([]),n.clear(),i.wait(t=>{const n=t.join(" ");this.createRedactionsFromSelection(e,o,n)},()=>{this.createRedactionsFromSelection(e,o)})}),r=n.onMarqueeChange(t=>{var n;const o=this.getDocumentState(e);(null==o?void 0:o.isRedacting)&&(null==(n=this.redactionMarquee$.get(e))||n.emit({pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}))}),a=n.onMarqueeEnd(t=>{const n=this.getDocumentState(e);if((null==n?void 0:n.isRedacting)&&this.checkPermission(e,on.ModifyContents))if(this.useAnnotationMode)this.createRedactAnnotationFromArea(e,t.pageIndex,t.rect);else{const n=this.config.drawBlackBoxes?"#000000":"transparent",o={id:$n(),kind:"area",page:t.pageIndex,rect:t.rect,source:"legacy",markColor:"#FF0000",redactionColor:n};this.dispatch(ap(e,[o])),this.selectPending(t.pageIndex,o.id,e)}}),s=n.onEmptySpaceClick(()=>{this.deselectPending(e)});t.push(o,i,r,a,s)}if(this.useAnnotationMode&&this.annotationCapability){const n=this.annotationCapability.forDocument(e),o=n.onAnnotationEvent(t=>{var n;if("loaded"===t.type)return void this.syncFromAnnotationLoad(e);if((null==(n=t.annotation)?void 0:n.type)!==_t.REDACT)return;const o=t.annotation;"create"===t.type?(this.syncFromAnnotationCreate(e,o),this.events$.emit({type:"add",documentId:e,items:[this.annotationToRedactionItem(o)]})):"update"===t.type?(this.logger.debug("RedactionPlugin","AnnotationUpdated",{documentId:e,redactAnno:o,patch:t.patch}),this.syncFromAnnotationUpdate(e,o,t.patch)):"delete"===t.type&&(this.syncFromAnnotationDelete(e,o),this.events$.emit({type:"remove",documentId:e,page:o.pageIndex,id:o.id}))}),i=n.onStateChange(()=>{this.syncSelectionFromAnnotation(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,n,o;null==(t=this.selectionCapability)||t.enableForMode(Zg.Redact,{enableSelection:!0,showSelectionRects:!1,enableMarquee:!0,showMarqueeRects:!1},e),null==(n=this.selectionCapability)||n.enableForMode(Zg.MarqueeRedact,{enableSelection:!1,enableMarquee:!0,showMarqueeRects:!1},e),null==(o=this.selectionCapability)||o.enableForMode(Zg.RedactSelection,{enableSelection:!0,showSelectionRects:!1},e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Yg,payload:e}}(e));const t=this.redactionSelection$.get(e);null==t||t.clear(),this.redactionSelection$.delete(e);const n=this.redactionMarquee$.get(e);null==n||n.clear(),this.redactionMarquee$.delete(e);const o=this.documentUnsubscribers.get(e);o&&(o.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(),enableRedact:()=>this.enableRedact(),toggleRedact:()=>this.toggleRedact(),isRedactActive:()=>this.isRedactActive(),endRedact:()=>this.endRedact(),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),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),enableRedact:()=>this.enableRedact(e),toggleRedact:()=>this.toggleRedact(e),isRedactActive:()=>this.isRedactActive(e),endRedact:()=>this.endRedact(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),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)})}}getPendingFromAnnotations(e){if(!this.annotationCapability)return{};try{const t=this.annotationCapability.forDocument(e).getState(),n={};for(const e of Object.values(t.byUid))if(e.object.type===_t.REDACT){const t=this.annotationToRedactionItem(e.object),o=e.object.pageIndex;(n[o]??(n[o]=[])).push(t)}return n}catch{return{}}}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}isRedactTool(e){return(null==e?void 0:e.id)===pp.id&&e.defaults.type===_t.REDACT}getRedactTool(){var e;const t=null==(e=this.annotationCapability)?void 0:e.getTool("redact");return this.isRedactTool(t)?t:void 0}syncFromAnnotationCreate(e,t){const n=this.annotationToRedactionItem(t);this.dispatch(ap(e,[n]))}syncFromAnnotationUpdate(e,t,n){if(!("rect"in n||"segmentRects"in n||"strokeColor"in n||"color"in n))return;const o={};n.rect&&(o.rect=n.rect),n.segmentRects&&(o.rects=n.segmentRects),n.strokeColor&&(o.markColor=n.strokeColor),n.color&&(o.redactionColor=n.color),this.logger.debug("RedactionPlugin","AnnotationUpdated",{documentId:e,annotation:t,patch:o}),this.dispatch(cp(e,t.pageIndex,t.id,o))}syncFromAnnotationDelete(e,t){this.dispatch(sp(e,t.pageIndex,t.id))}syncFromAnnotationLoad(e){const t=this.getPendingFromAnnotations(e);this.dispatch(lp(e));for(const[,n]of Object.entries(t))n.length>0&&this.dispatch(ap(e,n))}syncSelectionFromAnnotation(e){var t;const n=null==(t=this.annotationCapability)?void 0:t.forDocument(e).getState();if(!n)return;const o=n.selectedUids.map(e=>n.byUid[e]).find(e=>(null==e?void 0:e.object.type)===_t.REDACT);if(o){const t=o.object;this.dispatch(dp(e,t.pageIndex,t.id))}else{const t=this.getDocumentState(e);(null==t?void 0:t.selected)&&this.dispatch(up(e))}}addPendingItems(e,t){const n=t??this.getActiveDocumentId();if(this.checkPermission(n,on.ModifyContents)){if(this.useAnnotationMode){if(!this.annotationCapability)return;const t=this.annotationCapability.forDocument(n);for(const n of e){const e=this.redactionItemToAnnotation(n);t.createAnnotation(n.page,e)}if(e.length>0){const n=e[e.length-1];t.selectAnnotation(n.page,n.id)}}else this.dispatch(ap(n,e));this.events$.emit({type:"add",documentId:n,items:e})}else this.logger.debug("RedactionPlugin","AddPendingItems",`Cannot add redactions: document ${n} lacks ModifyContents permission`)}removePendingItem(e,t,n){var o;const i=n??this.getActiveDocumentId();this.useAnnotationMode?null==(o=this.annotationCapability)||o.forDocument(i).deleteAnnotation(e,t):this.dispatch(sp(i,e,t)),this.events$.emit({type:"remove",documentId:i,page:e,id:t})}clearPendingItems(e){var t;const n=e??this.getActiveDocumentId();if(this.useAnnotationMode){const e=this.getPendingFromAnnotations(n),o=null==(t=this.annotationCapability)?void 0:t.forDocument(n);for(const[t,n]of Object.entries(e)){const e=Number(t);for(const t of n)null==o||o.deleteAnnotation(e,t.id)}}else this.dispatch(lp(n));this.events$.emit({type:"clear",documentId:n})}selectPending(e,t,n){var o,i,r;const a=n??this.getActiveDocumentId();this.useAnnotationMode?null==(o=this.annotationCapability)||o.forDocument(a).selectAnnotation(e,t):(this.dispatch(dp(a,e,t)),null==(i=this.interactionManagerCapability)||i.claimPageActivity(a,"redaction-selection",e)),null==(r=this.selectionCapability)||r.forDocument(a).clear()}getSelectedPending(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.getDocumentState(n))?void 0:t.selected)??null}deselectPending(e){var t,n;const o=e??this.getActiveDocumentId();this.useAnnotationMode?null==(t=this.annotationCapability)||t.forDocument(o).deselectAnnotation():(this.dispatch(up(o)),null==(n=this.interactionManagerCapability)||n.releasePageActivity(o,"redaction-selection"))}enableRedactSelection(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,on.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Zg.RedactSelection):this.logger.debug("RedactionPlugin","EnableRedactSelection",`Cannot enable redact selection: document ${n} lacks ModifyContents permission`)}toggleRedactSelection(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);if((null==o?void 0:o.getActiveMode())===Zg.RedactSelection)null==o||o.activateDefaultMode();else{if(!this.checkPermission(n,on.ModifyContents))return;null==o||o.activate(Zg.RedactSelection)}}isRedactSelectionActive(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode();return o===Zg.Redact||o===Zg.RedactSelection}enableMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,on.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Zg.MarqueeRedact):this.logger.debug("RedactionPlugin","EnableMarqueeRedact",`Cannot enable marquee redact: document ${n} lacks ModifyContents permission`)}toggleMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);if((null==o?void 0:o.getActiveMode())===Zg.MarqueeRedact)null==o||o.activateDefaultMode();else{if(!this.checkPermission(n,on.ModifyContents))return;null==o||o.activate(Zg.MarqueeRedact)}}isMarqueeRedactActive(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode();return o===Zg.Redact||o===Zg.MarqueeRedact}enableRedact(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,on.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Zg.Redact):this.logger.debug("RedactionPlugin","EnableRedact",`Cannot enable redact mode: document ${n} lacks ModifyContents permission`)}toggleRedact(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n);if((null==o?void 0:o.getActiveMode())===Zg.Redact)null==o||o.activateDefaultMode();else{if(!this.checkPermission(n,on.ModifyContents))return;null==o||o.activate(Zg.Redact)}}isRedactActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===Zg.Redact}endRedact(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))??(()=>{})}onRedactionMarqueeChange(e,t){const n=this.redactionMarquee$.get(e);return(null==n?void 0:n.on(t))??(()=>{})}getPreviewStrokeColor(){var e;return this.useAnnotationMode?(null==(e=this.getRedactTool())?void 0:e.defaults.strokeColor)??"#FF0000":"#FF0000"}queueCurrentSelectionAsPending(e){const t=e??this.getActiveDocumentId();if(!this.selectionCapability)return ln.reject({code:sn.NotFound,message:"[RedactionPlugin] selection plugin required"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return ln.reject({code:sn.NotFound,message:"Document not found"});const o=this.selectionCapability.forDocument(t),i=o.getFormattedSelection();if(!i.length)return ln.resolve(!0);const r=o.getSelectedText(),a=this.redactionSelection$.get(t);null==a||a.emit([]),o.clear(),this.useAnnotationMode||this.enableRedactSelection(t);const s=new kt;return r.wait(e=>{const n=e.join(" ");this.createRedactionsFromSelection(t,i,n),s.resolve(!0)},()=>{this.createRedactionsFromSelection(t,i),s.resolve(!0)}),s}commitPendingOne(e,t,n){const o=n??this.getActiveDocumentId();if(!this.checkPermission(o,on.ModifyContents))return this.logger.debug("RedactionPlugin","CommitPendingOne",`Cannot commit redaction: document ${o} lacks ModifyContents permission`),ln.reject({code:sn.Security,message:"Document lacks ModifyContents permission"});const i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))return ln.reject({code:sn.NotFound,message:"Document not found"});const r=i.document.pages[e];if(!r)return ln.reject({code:sn.NotFound,message:"Page not found"});if(this.useAnnotationMode)return this.logger.debug("RedactionPlugin","CommitPendingOne",`Applying redaction in annotation mode: page ${e}, id ${t}`),this.applyRedactionAnnotationMode(o,i.document,r,t);const a=this.getDocumentState(o);if(!a)return ln.reject({code:sn.NotFound,message:"Document state not found"});const s=(a.pending[e]??[]).find(e=>e.id===t);return s?this.commitPendingOneLegacy(o,i.document,r,e,s):(this.logger.debug("RedactionPlugin","CommitPendingOne",`No pending item found for page ${e}, id ${t}`),ln.resolve(!0))}commitPendingOneLegacy(e,t,n,o,i){const r="text"===i.kind?i.rects:[i.rect],a=new kt;return this.engine.redactTextInRects(t,n,r,{drawBlackBoxes:this.config.drawBlackBoxes}).wait(()=>{this.dispatch(sp(e,o,i.id)),this.dispatchCoreAction(ho(e,[o])),this.events$.emit({type:"commit",documentId:e,success:!0}),a.resolve(!0)},t=>{this.events$.emit({type:"commit",documentId:e,success:!1,error:t.reason}),a.reject({code:sn.Unknown,message:"Failed to commit redactions"})}),a}applyRedactionAnnotationMode(e,t,n,o){var i;const r=new kt,a=null==(i=this.annotationCapability)?void 0:i.forDocument(e).getAnnotationById(o);return this.logger.debug("RedactionPlugin","ApplyRedactionAnnotationMode",`Looking for annotation ${o}, found: ${!!a}, type: ${null==a?void 0:a.object.type}`),a&&a.object.type===_t.REDACT?(this.logger.debug("RedactionPlugin","ApplyRedactionAnnotationMode",`Calling engine.applyRedaction for annotation ${o} on page ${n.index}`),this.engine.applyRedaction(t,n,a.object).wait(()=>{var t,i;this.logger.debug("RedactionPlugin","ApplyRedactionAnnotationMode",`Successfully applied redaction ${o} on page ${n.index}`),null==(t=this.annotationCapability)||t.forDocument(e).purgeAnnotation(n.index,o),this.dispatch(sp(e,n.index,o)),null==(i=this.historyCapability)||i.forDocument(e).purgeByMetadata(e=>{var t;return(null==(t=null==e?void 0:e.annotationIds)?void 0:t.includes(o))??!1},"annotations"),this.dispatchCoreAction(ho(e,[n.index])),this.events$.emit({type:"commit",documentId:e,success:!0}),r.resolve(!0)},t=>{var n;this.logger.error("RedactionPlugin","ApplyRedactionAnnotationMode",`Failed to apply redaction ${o}: ${(null==(n=t.reason)?void 0:n.message)??"Unknown error"}`),this.events$.emit({type:"commit",documentId:e,success:!1,error:t.reason}),r.reject({code:sn.Unknown,message:"Failed to apply redaction"})}),r):(this.logger.warn("RedactionPlugin","ApplyRedactionAnnotationMode",`Redaction annotation not found or wrong type: ${o}`),ln.reject({code:sn.NotFound,message:"Redaction annotation not found"}))}commitAllPending(e){const t=e??this.getActiveDocumentId();if(!this.checkPermission(t,on.ModifyContents))return this.logger.debug("RedactionPlugin","CommitAllPending",`Cannot commit redactions: document ${t} lacks ModifyContents permission`),ln.reject({code:sn.Security,message:"Document lacks ModifyContents permission"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return ln.reject({code:sn.NotFound,message:"Document not found"});const o=this.getDocumentState(t);return o?this.useAnnotationMode?this.applyAllRedactionsAnnotationMode(t,n.document):this.commitAllPendingLegacy(t,n.document,o):ln.reject({code:sn.NotFound,message:"Document state not found"})}commitAllPendingLegacy(e,t,n){const o=new Map;for(const[e,t]of Object.entries(n.pending)){const n=Number(e),i=o.get(n)??[];for(const e of t)"text"===e.kind?i.push(...e.rects):i.push(e.rect);o.set(n,i)}const i=Array.from(o.entries()).filter(([e,t])=>t.length>0).map(([e])=>e),r=[];for(const[e,n]of o){const o=t.pages[e];o&&(n.length&&r.push(this.engine.redactTextInRects(t,o,n,{drawBlackBoxes:this.config.drawBlackBoxes})))}const a=new kt;return kt.all(r).wait(()=>{this.dispatch(lp(e)),this.dispatchCoreAction(ho(e,i)),this.events$.emit({type:"commit",documentId:e,success:!0}),a.resolve(!0)},t=>{this.events$.emit({type:"commit",documentId:e,success:!1,error:t.reason}),a.reject({code:sn.Unknown,message:"Failed to commit redactions"})}),a}applyAllRedactionsAnnotationMode(e,t){const n=this.annotationCapability;if(!n)return ln.reject({code:sn.NotFound,message:"Annotation capability not found"});const o=n.forDocument(e).getState(),i=new Map;for(const e of Object.values(o.byUid))if(e.object.type===_t.REDACT){const t=i.get(e.object.pageIndex)??[];t.push(e.object.id),i.set(e.object.pageIndex,t)}const r=Array.from(i.keys());if(0===r.length)return ln.resolve(!0);const a=[];for(const e of r){const n=t.pages[e];n&&a.push(this.engine.applyAllRedactions(t,n))}const s=new kt;return kt.all(a).wait(()=>{var t;const o=n.forDocument(e),a=[];for(const[t,n]of i)for(const i of n)o.purgeAnnotation(t,i),this.dispatch(sp(e,t,i)),a.push(i);a.length>0&&(null==(t=this.historyCapability)||t.forDocument(e).purgeByMetadata(e=>{var t;return(null==(t=null==e?void 0:e.annotationIds)?void 0:t.some(e=>a.includes(e)))??!1},"annotations")),this.dispatchCoreAction(ho(e,r)),this.events$.emit({type:"commit",documentId:e,success:!0}),s.resolve(!0)},t=>{this.events$.emit({type:"commit",documentId:e,success:!1,error:t.reason}),s.reject({code:sn.Unknown,message:"Failed to apply redactions"})}),s}createRedactAnnotationsFromSelection(e,t,n){var o;if(!this.annotationCapability)return[];const i=this.annotationCapability.forDocument(e),r=null==(o=this.getRedactTool())?void 0:o.defaults,a=[];for(const e of t){const o=$n();a.push(o);const s={...r,id:o,type:_t.REDACT,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,...n?{custom:{text:n}}:{},created:new Date};i.createAnnotation(e.pageIndex,s),e===t[t.length-1]&&i.selectAnnotation(e.pageIndex,o)}if(n)for(let o=0;o<a.length;o++){const i=t[o].pageIndex;this.dispatch(cp(e,i,a[o],{text:n}))}return a}createLegacyRedactionsFromSelection(e,t,n){const o=this.config.drawBlackBoxes?"#000000":"transparent",i=t.map(e=>({id:$n(),kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects,source:"legacy",markColor:"#FF0000",redactionColor:o,text:n}));this.dispatch(ap(e,i)),i.length&&this.selectPending(i[i.length-1].page,i[i.length-1].id,e)}createRedactionsFromSelection(e,t,n){this.useAnnotationMode?this.createRedactAnnotationsFromSelection(e,t,n):this.createLegacyRedactionsFromSelection(e,t,n)}createRedactAnnotationFromArea(e,t,n){var o;if(!this.annotationCapability)return;const i=this.annotationCapability.forDocument(e),r=null==(o=this.getRedactTool())?void 0:o.defaults,a=$n(),s={...r,id:a,type:_t.REDACT,pageIndex:t,rect:n,segmentRects:[],created:new Date};i.createAnnotation(t,s),i.selectAnnotation(t,a)}redactionItemToAnnotation(e){var t;return{...(null==(t=this.getRedactTool())?void 0:t.defaults)??{},id:e.id,type:_t.REDACT,pageIndex:e.page,rect:e.rect,segmentRects:"text"===e.kind?e.rects:[],created:new Date}}annotationToRedactionItem(e){var t;const n=e.strokeColor??"#FF0000",o=e.color??"transparent";return e.segmentRects&&e.segmentRects.length>0?{id:e.id,kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects,source:"annotation",markColor:n,redactionColor:o,...(null==(t=e.custom)?void 0:t.text)?{text:e.custom.text}:{}}:{id:e.id,kind:"area",page:e.pageIndex,rect:e.rect,source:"annotation",markColor:n,redactionColor:o}}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.redactionMarquee$.forEach(e=>e.clear()),this.redactionMarquee$.clear(),this.documentUnsubscribers.forEach(e=>{e.forEach(e=>e())}),this.documentUnsubscribers.clear(),await super.destroy()}};vp.id="redaction";let yp=vp;const bp="redaction",wp={manifest:{id:bp,name:"Redaction Plugin",version:"1.0.0",provides:["redaction"],requires:[],optional:["interaction-manager","selection","annotation"],defaultConfig:{drawBlackBoxes:!0}},create:(e,t)=>new yp(bp,e,t),reducer:(e=gp,t)=>{switch(t.type){case Xg:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Yg:{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 ep:{const{documentId:n,items:o}=t.payload,i=e.documents[n];if(!i)return e;const r={...i.pending};for(const e of o){const t=r[e.page]??[];t.some(t=>t.id===e.id)||(r[e.page]=t.concat(e))}return{...e,documents:{...e.documents,[n]:{...i,pending:r,pendingCount:hp(r)}}}}case tp:{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:hp(s),selected:l?r.selected:null}}}}case np:{const{documentId:n,page:o,id:i,patch:r}=t.payload,a=e.documents[n];if(!a)return e;const s=(a.pending[o]??[]).map(e=>e.id===i?{...e,...r}:e);return{...e,documents:{...e.documents,[n]:{...a,pending:{...a.pending,[o]:s}}}}}case op:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null}}}:e}case ip:{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 rp:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selected:null}}}:e}case Qg:{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 Jg:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,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:gp};function xp({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){const[r,a]=Se(!1),{object:s}=e,l=s.segmentRects??[],c=s.rect,d=s.strokeColor??"#FF0000",u=s.color??"#000000",h=s.opacity??1,m=s.fontColor??s.overlayColor??"#FFFFFF",g=s.overlayText,p=s.overlayTextRepeat??!1,f=s.fontSize??12,v=s.fontFamily??Dt.Helvetica,y=s.textAlign??Pt.Center,b=()=>{if(!g)return null;if(!p)return g;return Array(10).fill(g).join(" ")};return Be("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0},children:l.map((e,t)=>Be("div",{onPointerDown:o,style:{position:"absolute",left:(c?e.origin.x-c.origin.x:e.origin.x)*n,top:(c?e.origin.y-c.origin.y:e.origin.y)*n,width:e.size.width*n,height:e.size.height*n,background:r?u:"transparent",border:r?"none":`2px solid ${d}`,opacity:r?h:1,boxSizing:"border-box",pointerEvents:"auto",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:y===Pt.Left?"flex-start":y===Pt.Right?"flex-end":"center",overflow:"hidden",...i},children:r&&g&&Be("span",{style:{color:m,fontSize:Math.min(f*n,e.size.height*n*.8),...Pn(v),textAlign:vn(y),whiteSpace:p?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1},children:b()})},t))})}function kp({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){const[r,a]=Se(!1),{object:s}=e,l=s.strokeColor??"#FF0000",c=s.color??"#000000",d=s.opacity??1,u=s.fontColor??s.overlayColor??"#FFFFFF",h=s.overlayText,m=s.overlayTextRepeat??!1,g=s.fontSize??12,p=s.fontFamily??Dt.Helvetica,f=s.textAlign??Pt.Center;return Be("div",{onPointerDown:t?void 0:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0,background:r?c:"transparent",border:r?"none":`2px solid ${l}`,opacity:r?d:1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:f===Pt.Left?"flex-start":f===Pt.Right?"flex-end":"center",overflow:"hidden",...i},children:r&&h&&Be("span",{style:{color:u,fontSize:g*n,...Pn(p),textAlign:vn(f),whiteSpace:m?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"4px"},children:(()=>{if(!h)return null;if(!m)return h;return Array(10).fill(h).join(" ")})()})})}const Cp=[Am({id:"redactHighlight",matches:e=>{var t;return e.type===_t.REDACT&&"segmentRects"in e&&((null==(t=e.segmentRects)?void 0:t.length)??0)>0},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(xp,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1}),Am({id:"redactArea",matches:e=>{var t;return!(e.type!==_t.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(kp,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),interactionDefaults:{isDraggable:!1,isResizable:!1,isRotatable:!1},useAppearanceStream:!1})];const Ip=()=>Bo(yp.id),Sp=()=>Wo(yp.id),Ap=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i,fill:r="transparent"})=>{const{plugin:a}=Ip(),s=Go(e),[l,c]=Se(null),d=n??(null==s?void 0:s.scale)??1,u=i??(null==a?void 0:a.getPreviewStrokeColor())??"red";return Me(()=>{if(a&&e)return a.onRedactionMarqueeChange(e,e=>{c(e.pageIndex===t?e.rect:null)})},[a,e,t]),l?Be("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 ${u}`,background:r,boxSizing:"border-box"},className:o}):null};function Mp({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:o,rect:i,scale:r,onClick:a,style:s,...l}){return Be(B,{children:o.map((o,c)=>Be("div",{onPointerDown: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 Dp({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=Ip(),[i,r]=Se([]),[a,s]=Se(null),l=(null==o?void 0:o.getPreviewStrokeColor())??"red";return Me(()=>{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?Be("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:Be(Mp,{color:"transparent",opacity:1,rects:i,scale:n,border:`1px solid ${l}`})}):null}function Pp({documentId:e,pageIndex:t,scale:n,bboxStroke:o="rgba(0,0,0,0.8)",rotation:i=We.Degree0,selectionMenu:r}){const{provides:a}=Sp(),[s,l]=Se([]),[c,d]=Se(null);Me(()=>{if(!a)return;const n=a.forDocument(e),o=n.getState();l((o.pending[t]??[]).filter(e=>"legacy"===e.source)),d(o.selected&&o.selected.page===t?o.selected.id:null);const i=n.onPendingChange(e=>{l((e[t]??[]).filter(e=>"legacy"===e.source))}),r=n.onSelectedChange(e=>{d(e&&e.page===t?e.id:null)});return()=>{null==i||i(),null==r||r()}},[a,e,t]);const u=Re((n,o)=>{n.stopPropagation(),a&&a.forDocument(e).selectPending(t,o)},[a,e,t]);return s.length?Be("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:s.map(e=>{if("area"===e.kind){const a=e.rect;return Be(B,{children:[Be("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 ${e.markColor}`,pointerEvents:"auto",cursor:"pointer"},onPointerDown:t=>u(t,e.id)}),r&&Be(_l,{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 Be(B,{children:[Be("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:Be(Mp,{rect:a,rects:e.rects,color:"transparent",border:`1px solid ${e.markColor}`,scale:n,onClick:t=>u(t,e.id)})}),r&&Be(_l,{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 Tp=({documentId:e,pageIndex:t,scale:n,rotation:o,selectionMenu:i})=>{var r,a;const s=Go(e),l=null==(a=null==(r=null==s?void 0:s.document)?void 0:r.pages)?void 0:a[t],c=Te(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Be(B,{children:[Be(Pp,{documentId:e,pageIndex:t,scale:c,rotation:Te(()=>{if(void 0!==o)return o;return(((null==l?void 0:l.rotation)??0)+((null==s?void 0:s.rotation)??0))%4},[o,null==l?void 0:l.rotation,null==s?void 0:s.rotation]),selectionMenu:i}),Be(Ap,{documentId:e,pageIndex:t,scale:c}),Be(Dp,{documentId:e,pageIndex:t,scale:c})]})},Rp=Fo(wp).addUtility(function(){return mm(Cp),null}).build(),zp=class extends So{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):ln.reject({code:sn.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):ln.reject({code:sn.NotFound,message:`Document ${t} not found`})}};zp.id="attachment";let Ep=zp;const Op="attachment",Np={manifest:{id:Op,name:"Attachment Plugin",version:"1.0.0",provides:["attachment"],requires:[],optional:[],defaultConfig:{}},create:e=>new Ep(Op,e),reducer:()=>{},initialState:{}},Lp="form",_p={id:Lp,name:"Form Plugin",version:"1.0.0",provides:["form"],requires:["interaction-manager"],optional:["history","annotation"],defaultConfig:{enabled:!0}},Fp="FORM/INIT_STATE",$p="FORM/CLEANUP_STATE",jp="FORM/SELECT_FIELD",Up="FORM/DESELECT_FIELD";function Bp(e,t){return{type:jp,payload:{documentId:e,annotationId:t}}}const Wp={selectedFieldId:null},Hp={documents:{}},Gp={annotationType:_t.WIDGET,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,fontFamily:e.defaults.fontFamily??Dt.Helvetica,fontSize:e.defaults.fontSize??12,fontColor:e.defaults.fontColor??"#000000",strokeColor:e.defaults.strokeColor??"#000000",color:e.defaults.color??"#FFFFFF",strokeWidth:e.defaults.strokeWidth??1,field:e.defaults.field}:null},d=(e,t)=>({origin:{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},size:{width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}),u=e=>{var n;const o=c(),i=`TextField_${$n().slice(0,8)}`;return{...o,type:_t.WIDGET,id:$n(),pageIndex:t,rect:e,created:new Date,fontFamily:o.fontFamily,fontSize:o.fontSize,fontColor:o.fontColor,strokeColor:o.strokeColor,color:o.color,strokeWidth:o.strokeWidth,field:{type:Bt.TEXTFIELD,flag:(null==(n=o.field)?void 0:n.flag)??Gt.NONE,name:i,alternateName:i,value:""}}},h=Vd({getTool:i,onClickDetected:e=>{if(!c())return;const t=i(),o=null==t?void 0:t.clickBehavior;if(!(null==o?void 0:o.enabled))return;const{width:a,height:s}=o.defaultSize,l=Po(e.x-a/2,0,r.width-a),d=Po(e.y-s/2,0,r.height-s);n(u({origin:{x:l,y:d},size:{width:a,height:s}}))}}),m=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=d(t,e);return{type:_t.WIDGET,bounds:o,data:{rect:o,...n}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),h.onStart(i),o(m(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);h.onMove(t),a()&&h.hasMoved()&&o(m(t))},onPointerUp:(e,t)=>{var i;const r=a();if(!r)return;const c=l(e);if(h.hasMoved()){const e=d(r,c);e.size.width>5&&e.size.height>5&&n(u(e))}else h.onEnd(c);s(null),o(null),h.reset(),null==(i=t.releasePointerCapture)||i.call(t)},onPointerLeave:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},qp={annotationType:_t.WIDGET,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeColor:e.defaults.strokeColor??"#000000",color:e.defaults.color??"#FFFFFF",strokeWidth:e.defaults.strokeWidth??1,field:e.defaults.field}:null},d=(e,t)=>({origin:{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},size:{width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}),u=e=>{var n;const o=c(),i=`Checkbox_${$n().slice(0,8)}`;return{...o,type:_t.WIDGET,id:$n(),pageIndex:t,rect:e,created:new Date,strokeColor:o.strokeColor,color:o.color,strokeWidth:o.strokeWidth,exportValue:"Yes",field:{type:Bt.CHECKBOX,flag:(null==(n=o.field)?void 0:n.flag)??Gt.NONE,name:i,alternateName:i,value:"Off"}}},h=Vd({getTool:i,onClickDetected:e=>{if(!c())return;const t=i(),o=null==t?void 0:t.clickBehavior;if(!(null==o?void 0:o.enabled))return;const{width:a,height:s}=o.defaultSize,l=Po(e.x-a/2,0,r.width-a),d=Po(e.y-s/2,0,r.height-s);n(u({origin:{x:l,y:d},size:{width:a,height:s}}))}}),m=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=d(t,e);return{type:_t.WIDGET,bounds:o,data:{rect:o,...n}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),h.onStart(i),o(m(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);h.onMove(t),a()&&h.hasMoved()&&o(m(t))},onPointerUp:(e,t)=>{var i;const r=a();if(!r)return;const c=l(e);if(h.hasMoved()){const e=d(r,c);e.size.width>5&&e.size.height>5&&n(u(e))}else h.onEnd(c);s(null),o(null),h.reset(),null==(i=t.releasePointerCapture)||i.call(t)},onPointerLeave:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Vp={annotationType:_t.WIDGET,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeColor:e.defaults.strokeColor??"#000000",color:e.defaults.color??"#FFFFFF",strokeWidth:e.defaults.strokeWidth??1,field:e.defaults.field}:null},d=(e,t)=>{const n=t.x-e.x,o=t.y-e.y,i=Math.max(Math.abs(n),Math.abs(o)),r=n<0?-i:i,a=o<0?-i:i;return{origin:{x:Math.min(e.x,e.x+r),y:Math.min(e.y,e.y+a)},size:{width:i,height:i}}},u=e=>{var n;const o=c(),i=`RadioButton_${$n().slice(0,8)}`,r=$n();return{...o,type:_t.WIDGET,id:r,pageIndex:t,rect:e,created:new Date,strokeColor:o.strokeColor,color:o.color,strokeWidth:o.strokeWidth,exportValue:r,field:{type:Bt.RADIOBUTTON,flag:(null==(n=o.field)?void 0:n.flag)??Gt.BUTTON_RADIO|Gt.BUTTON_NOTOGGLETOOFF,name:i,alternateName:i,value:"Off",options:[]}}},h=Vd({getTool:i,onClickDetected:e=>{if(!c())return;const t=i(),o=null==t?void 0:t.clickBehavior;if(!(null==o?void 0:o.enabled))return;const{width:a,height:s}=o.defaultSize,l=Po(e.x-a/2,0,r.width-a),d=Po(e.y-s/2,0,r.height-s);n(u({origin:{x:l,y:d},size:{width:a,height:s}}))}}),m=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=d(t,e);return{type:_t.WIDGET,bounds:o,data:{rect:o,...n}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),h.onStart(i),o(m(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);h.onMove(t),a()&&h.hasMoved()&&o(m(t))},onPointerUp:(e,t)=>{var i;const r=a();if(!r)return;const c=l(e);if(h.hasMoved()){const e=d(r,c);e.size.width>5&&e.size.height>5&&n(u(e))}else h.onEnd(c);s(null),o(null),h.reset(),null==(i=t.releasePointerCapture)||i.call(t)},onPointerLeave:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Kp={annotationType:_t.WIDGET,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,fontFamily:e.defaults.fontFamily??Dt.Helvetica,fontSize:e.defaults.fontSize??12,fontColor:e.defaults.fontColor??"#000000",strokeColor:e.defaults.strokeColor??"#000000",color:e.defaults.color??"#FFFFFF",strokeWidth:e.defaults.strokeWidth??1,field:e.defaults.field}:null},d=(e,t)=>({origin:{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},size:{width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}),u=e=>{var n;const o=c(),i=`Combobox_${$n().slice(0,8)}`;return{...o,type:_t.WIDGET,id:$n(),pageIndex:t,rect:e,created:new Date,fontFamily:o.fontFamily,fontSize:o.fontSize,fontColor:o.fontColor,strokeColor:o.strokeColor,color:o.color,strokeWidth:o.strokeWidth,field:{type:Bt.COMBOBOX,flag:(null==(n=o.field)?void 0:n.flag)??Gt.NONE,name:i,alternateName:i,value:"",options:[{label:"Option 1",isSelected:!0},{label:"Option 2",isSelected:!1},{label:"Option 3",isSelected:!1}]}}},h=Vd({getTool:i,onClickDetected:e=>{if(!c())return;const t=i(),o=null==t?void 0:t.clickBehavior;if(!(null==o?void 0:o.enabled))return;const{width:a,height:s}=o.defaultSize,l=Po(e.x-a/2,0,r.width-a),d=Po(e.y-s/2,0,r.height-s);n(u({origin:{x:l,y:d},size:{width:a,height:s}}))}}),m=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=d(t,e);return{type:_t.WIDGET,bounds:o,data:{rect:o,...n}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),h.onStart(i),o(m(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);h.onMove(t),a()&&h.hasMoved()&&o(m(t))},onPointerUp:(e,t)=>{var i;const r=a();if(!r)return;const c=l(e);if(h.hasMoved()){const e=d(r,c);e.size.width>5&&e.size.height>5&&n(u(e))}else h.onEnd(c);s(null),o(null),h.reset(),null==(i=t.releasePointerCapture)||i.call(t)},onPointerLeave:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Zp={annotationType:_t.WIDGET,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=Id(null),l=e=>({x:Po(e.x,0,r.width),y:Po(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,fontFamily:e.defaults.fontFamily??Dt.Helvetica,fontSize:e.defaults.fontSize??12,fontColor:e.defaults.fontColor??"#000000",strokeColor:e.defaults.strokeColor??"#000000",color:e.defaults.color??"#FFFFFF",strokeWidth:e.defaults.strokeWidth??1,field:e.defaults.field}:null},d=(e,t)=>({origin:{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y)},size:{width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}),u=e=>{var n;const o=c(),i=`Listbox_${$n().slice(0,8)}`;return{...o,type:_t.WIDGET,id:$n(),pageIndex:t,rect:e,created:new Date,fontFamily:o.fontFamily,fontSize:o.fontSize,fontColor:o.fontColor,strokeColor:o.strokeColor,color:o.color,strokeWidth:o.strokeWidth,field:{type:Bt.LISTBOX,flag:(null==(n=o.field)?void 0:n.flag)??Gt.NONE,name:i,alternateName:i,value:"",options:[{label:"Option 1",isSelected:!0},{label:"Option 2",isSelected:!1},{label:"Option 3",isSelected:!1}]}}},h=Vd({getTool:i,onClickDetected:e=>{if(!c())return;const t=i(),o=null==t?void 0:t.clickBehavior;if(!(null==o?void 0:o.enabled))return;const{width:a,height:s}=o.defaultSize,l=Po(e.x-a/2,0,r.width-a),d=Po(e.y-s/2,0,r.height-s);n(u({origin:{x:l,y:d},size:{width:a,height:s}}))}}),m=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=d(t,e);return{type:_t.WIDGET,bounds:o,data:{rect:o,...n}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),h.onStart(i),o(m(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);h.onMove(t),a()&&h.hasMoved()&&o(m(t))},onPointerUp:(e,t)=>{var i;const r=a();if(!r)return;const c=l(e);if(h.hasMoved()){const e=d(r,c);e.size.width>5&&e.size.height>5&&n(u(e))}else h.onEnd(c);s(null),o(null),h.reset(),null==(i=t.releasePointerCapture)||i.call(t)},onPointerLeave:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),h.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Xp={id:"formTextField",name:"Text Field",labelKey:"form.textfield",categories:["annotation","form"],matchScore:e=>{var t;if(e.type!==_t.WIDGET)return 0;return(null==(t=e.field)?void 0:t.type)===Bt.TEXTFIELD?10:0},interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,isRotatable:!1,isGroupDraggable:!0,isGroupResizable:!1,isGroupRotatable:!1},defaults:{type:_t.WIDGET,fontFamily:Dt.Helvetica,fontSize:12,fontColor:"#000000",strokeColor:"#000000",color:"#FFFFFF",strokeWidth:1,field:{flag:Gt.NONE,name:"TextField",alternateName:"TextField",value:"",type:Bt.TEXTFIELD}},behavior:{useAppearanceStream:!1},clickBehavior:{enabled:!0,defaultSize:{width:150,height:24}},pointerHandler:Gp},Yp={id:"formCheckbox",name:"Checkbox",labelKey:"form.checkbox",categories:["annotation","form"],matchScore:e=>{var t;if(e.type!==_t.WIDGET)return 0;return(null==(t=e.field)?void 0:t.type)===Bt.CHECKBOX?10:0},interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,isRotatable:!1,isGroupDraggable:!0,isGroupResizable:!1,isGroupRotatable:!1},defaults:{type:_t.WIDGET,strokeColor:"#000000",color:"#FFFFFF",strokeWidth:1,field:{flag:Gt.NONE,name:"Checkbox",alternateName:"Checkbox",value:"Off",type:Bt.CHECKBOX}},behavior:{useAppearanceStream:!1},clickBehavior:{enabled:!0,defaultSize:{width:20,height:20}},pointerHandler:qp},Qp={id:"formRadioButton",name:"Radio Button",labelKey:"form.radiobutton",categories:["annotation","form"],matchScore:e=>{var t;if(e.type!==_t.WIDGET)return 0;return(null==(t=e.field)?void 0:t.type)===Bt.RADIOBUTTON?10:0},interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,isRotatable:!1,lockAspectRatio:!0,isGroupDraggable:!0,isGroupResizable:!1,isGroupRotatable:!1},defaults:{type:_t.WIDGET,strokeColor:"#000000",color:"#FFFFFF",strokeWidth:1,field:{flag:Gt.BUTTON_RADIO|Gt.BUTTON_NOTOGGLETOOFF,name:"RadioButton",alternateName:"RadioButton",value:"Off",type:Bt.RADIOBUTTON,options:[]}},behavior:{useAppearanceStream:!1},clickBehavior:{enabled:!0,defaultSize:{width:20,height:20}},pointerHandler:Vp},Jp={id:"formCombobox",name:"Combo Box",labelKey:"form.combobox",categories:["annotation","form"],matchScore:e=>{var t;if(e.type!==_t.WIDGET)return 0;return(null==(t=e.field)?void 0:t.type)===Bt.COMBOBOX?10:0},interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,isRotatable:!1,isGroupDraggable:!0,isGroupResizable:!1,isGroupRotatable:!1},defaults:{type:_t.WIDGET,fontFamily:Dt.Helvetica,fontSize:12,fontColor:"#000000",strokeColor:"#000000",color:"#FFFFFF",strokeWidth:1,field:{flag:Gt.NONE,name:"ComboBox",alternateName:"ComboBox",value:"",type:Bt.COMBOBOX,options:[{label:"Option 1",isSelected:!0},{label:"Option 2",isSelected:!1},{label:"Option 3",isSelected:!1}]}},behavior:{useAppearanceStream:!1},clickBehavior:{enabled:!0,defaultSize:{width:200,height:40}},pointerHandler:Kp},ef={id:"formListbox",name:"List Box",labelKey:"form.listbox",categories:["annotation","form"],matchScore:e=>{var t;if(e.type!==_t.WIDGET)return 0;return(null==(t=e.field)?void 0:t.type)===Bt.LISTBOX?10:0},interaction:{exclusive:!1,cursor:"crosshair",isDraggable:!0,isResizable:!0,isRotatable:!1,isGroupDraggable:!0,isGroupResizable:!1,isGroupRotatable:!1},defaults:{type:_t.WIDGET,fontFamily:Dt.Helvetica,fontSize:12,fontColor:"#000000",strokeColor:"#000000",color:"#FFFFFF",strokeWidth:1,field:{flag:Gt.NONE,name:"ListBox",alternateName:"ListBox",value:"",type:Bt.LISTBOX,options:[{label:"Option 1",isSelected:!0},{label:"Option 2",isSelected:!1},{label:"Option 3",isSelected:!1}]}},behavior:{useAppearanceStream:!1},clickBehavior:{enabled:!0,defaultSize:{width:150,height:150}},pointerHandler:Zp},tf=[Xp,Yp,Qp,Jp,ef],nf=class extends So{constructor(e,t,n){var o,i;if(super(e,t),this.FORM_HISTORY_TOPIC="form-fields",this.annotation=null,this.history=null,this.state$=Lo((e,t)=>({documentId:e,state:t})),this.fieldValueChange$=Lo((e,t)=>t,{cache:!1}),this.formReady$=Lo((e,t)=>({documentId:e,fields:t}),{cache:!1}),this.fieldGroupIndex=new Map,this.fieldNameIndex=new Map,this.orderedFieldIndex=new Map,this.propagationInProgress=new Set,this.annotation=(null==(o=t.getPlugin("annotation"))?void 0:o.provides())??null,this.history=(null==(i=t.getPlugin(Gg.id))?void 0:i.provides())??null,this.annotation){for(const e of tf)this.annotation.addTool(e);this.annotation.onAnnotationEvent(e=>this.handleAnnotationEvent(e))}}async initialize(){}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Fp,payload:{documentId:e,state:t}}}(e,{...Wp}))}onDocumentClosed(e){this.dispatch(function(e){return{type:$p,payload:e}}(e)),this.fieldGroupIndex.delete(e),this.fieldNameIndex.delete(e),this.orderedFieldIndex.delete(e),this.state$.clearScope(e),this.fieldValueChange$.clearScope(e),this.formReady$.clearScope(e)}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&this.state$.emit(n,i)}}buildCapability(){return{getPageFormAnnoWidgets:(e,t)=>this.getPageFormAnnoWidgets(e,t),setFormFieldValues:(e,t,n,o)=>this.setFormFieldValues(e,t,n,o),renameField:(e,t,n)=>this.renameFieldMethod(e,t,n),shareField:(e,t,n)=>this.shareFieldMethod(e,t,n),renderWidget:(e,t)=>this.renderWidget(e,t),selectField:(e,t)=>this.selectFieldMethod(e,t),deselectField:e=>this.deselectFieldMethod(e),getSelectedFieldId:e=>this.getSelectedFieldId(e),selectNextField:e=>this.selectNextFieldMethod(e),selectPreviousField:e=>this.selectPreviousFieldMethod(e),activateField:e=>this.activateFieldMethod(e),getState:e=>this.getDocumentState(e),getFieldGroup:(e,t)=>this.getFieldGroup(e,t),getFieldSiblings:(e,t)=>this.getFieldSiblings(e,t),getFormValues:e=>this.getFormValuesMethod(e),getFormFields:e=>this.getFormFieldsMethod(e),setFormValues:(e,t)=>this.setFormValuesMethod(e,t),forDocument:e=>this.createFormScope(e),onStateChange:this.state$.onGlobal,onFieldValueChange:this.fieldValueChange$.onGlobal,onFormReady:this.formReady$.onGlobal}}createFormScope(e){return{getPageFormAnnoWidgets:t=>this.getPageFormAnnoWidgets(t,e),setFormFieldValues:(t,n,o)=>this.setFormFieldValues(t,n,o,e),renameField:(t,n)=>this.renameFieldMethod(t,n,e),shareField:(t,n)=>this.shareFieldMethod(t,n,e),renderWidget:t=>this.renderWidget(t,e),selectField:t=>this.selectFieldMethod(t,e),deselectField:()=>this.deselectFieldMethod(e),getSelectedFieldId:()=>this.getSelectedFieldId(e),selectNextField:()=>this.selectNextFieldMethod(e),selectPreviousField:()=>this.selectPreviousFieldMethod(e),activateField:()=>this.activateFieldMethod(e),getState:()=>this.getDocumentState(e),getFieldGroup:t=>this.getFieldGroup(t,e),getFieldSiblings:t=>this.getFieldSiblings(t,e),getFormValues:()=>this.getFormValuesMethod(e),getFormFields:()=>this.getFormFieldsMethod(e),setFormValues:t=>this.setFormValuesMethod(t,e),onStateChange:this.state$.forScope(e),onFieldValueChange:this.fieldValueChange$.forScope(e),onFormReady:this.formReady$.forScope(e)}}handleAnnotationEvent(e){switch(e.type){case"loaded":this.buildFieldGroupIndex(e.documentId),this.formReady$.emit(e.documentId,this.getFormFieldsMethod(e.documentId));break;case"create":case"delete":if(e.annotation.type!==_t.WIDGET)break;this.buildFieldGroupIndex(e.documentId);break;case"update":{if(!e.committed)break;const t=e.annotation;if(t.type!==_t.WIDGET)break;if(this.propagationInProgress.has(t.id)){this.propagationInProgress.delete(t.id);break}const n=e.patch;this.buildFieldGroupIndex(e.documentId),this.propagateFieldLevelChanges(e.documentId,t,n);break}}}propagateFieldLevelChanges(e,t,n){if(!this.annotation||!n.field)return;const o=n.field,i=this.getFieldSiblings(t.id,e);if(0===i.length)return;const r=[];for(const e of i)this.propagationInProgress.add(e.annotationId),r.push({pageIndex:e.pageIndex,id:e.annotationId,patch:{field:{...o}}});this.annotation.forDocument(e).updateAnnotations(r)}buildFieldGroupIndex(e){if(!this.annotation)return;const t=this.annotation.forDocument(e).getState();if(!t)return;const n=new Map,o=[];for(const[e,i]of Object.entries(t.pages)){const r=Number(e);for(const e of i){const i=t.byUid[e];if(!i||i.object.type!==_t.WIDGET)continue;const a=i.object,s={annotationId:e,pageIndex:r};o.push({entry:s,widget:a});const l=this.getFieldKey(a.field);if(!l)continue;const c=n.get(l)??[];c.push(s),n.set(l,c)}}this.fieldGroupIndex.set(e,n);const i=new Map;for(const{entry:e,widget:t}of o){const n=t.field.name.trim();if(!n)continue;const o=i.get(n)??[];o.push(e),i.set(n,o)}this.fieldNameIndex.set(e,i);const r=o.filter(({widget:e})=>!(e.field.flag&Gt.READONLY));this.orderedFieldIndex.set(e,r.map(({entry:e})=>e))}getDocumentState(e){const t=e??this.getActiveDocumentId();return this.state.documents[t]??{...Wp}}getDocIndex(e){let t=this.fieldGroupIndex.get(e);return t||(t=new Map,this.fieldGroupIndex.set(e,t)),t}getFieldKey(e){if("number"==typeof e.fieldObjectId&&e.fieldObjectId>0)return`field:${e.fieldObjectId}`;const t=e.name.trim();return t?`legacy:${e.type}:${t}`:null}resolveWidgetAnnotation(e,t){if(!this.annotation)return null;const n=this.annotation.forDocument(t).getState(),o=null==n?void 0:n.byUid[e];return o&&o.object.type===_t.WIDGET?o.object:null}getFieldGroup(e,t){const n=t??this.getActiveDocumentId(),o=this.resolveWidgetAnnotation(e,n);if(!o)return[];const i=this.getFieldKey(o.field);return i?this.getDocIndex(n).get(i)??[{annotationId:o.id,pageIndex:o.pageIndex}]:[{annotationId:o.id,pageIndex:o.pageIndex}]}getFieldSiblings(e,t){return this.getFieldGroup(e,t).filter(t=>t.annotationId!==e)}getFormValuesMethod(e){const t=e??this.getActiveDocumentId(),n=this.fieldNameIndex.get(t);if(!n)return{};const o={};for(const[e,i]of n){const n=this.resolveWidgetAnnotation(i[0].annotationId,t);n&&(o[e]=n.field.value)}return o}getFormFieldsMethod(e){const t=e??this.getActiveDocumentId(),n=this.fieldNameIndex.get(t);if(!n)return[];const o=[];for(const[e,i]of n){const n=this.resolveWidgetAnnotation(i[0].annotationId,t);n&&o.push({name:e,type:n.field.type,value:n.field.value,readOnly:!!(n.field.flag&Gt.READONLY),..."options"in n.field&&n.field.options?{options:n.field.options}:{}})}return o}setFormValuesMethod(e,t){const n=t??this.getActiveDocumentId(),o=this.fieldNameIndex.get(n);if(!o)return ln.reject({code:sn.NotFound,message:"no form fields indexed for this document"});const i=Object.entries(e);if(0===i.length)return ln.resolve(!0);const r=new kt;let a=i.length,s=!1;const l=()=>{a--,0!==a||s||r.resolve(!0)};for(const[e,t]of i){const i=o.get(e);if(!i||0===i.length){l();continue}let a=i[0],c=this.resolveWidgetAnnotation(a.annotationId,n);if(c){if(c.field.type===Bt.RADIOBUTTON||c.field.type===Bt.CHECKBOX)for(const e of i){const o=this.resolveWidgetAnnotation(e.annotationId,n);if(o&&o.exportValue===t){c=o,a=e;break}}this.setFormFieldValues(a.pageIndex,c,this.buildImportField(c,t),n).wait(()=>l(),e=>{return t=e.reason,void(s||(s=!0,r.reject(t)));var t})}else l()}return r}buildImportField(e,t){const n=e.field;if((n.type===Bt.COMBOBOX||n.type===Bt.LISTBOX)&&"options"in n)return{...n,value:t,options:n.options.map(e=>({...e,isSelected:e.label===t}))};if(n.type===Bt.CHECKBOX){const o="Off"===t?"Off":e.exportValue??"Yes";return{...n,value:o}}return{...n,value:t}}isToggleField(e){return e.type===Bt.CHECKBOX||e.type===Bt.RADIOBUTTON}shouldRegenerateWidgetAppearances(e){return!this.isToggleField(e)}getFieldBatchTarget(e){const t=[...e.values()];return t.find(e=>this.isToggleField(e.widget.field)&&Yt(e.widget))??t[0]}async readFieldWidgets(e,t,n,o){const i=new Set(t.map(e=>e.pageIndex)),r=new Set(t.map(e=>e.annotationId)),a=new Map;for(const s of i){const i=e.pages.find(e=>e.index===s);if(!i)continue;const l=t.filter(e=>e.pageIndex===s).map(e=>e.annotationId);o&&await n.run(()=>this.engine.regenerateWidgetAppearances(e,i,l));const c=await n.run(()=>this.engine.getPageAnnoWidgets(e,i));for(const e of c)r.has(e.id)&&a.set(e.id,{widget:e,pageIndex:s})}return a}syncFieldBatch(e,t,n={}){if(this.annotation){for(const[o,{widget:i,pageIndex:r}]of t)this.annotation.syncAnnotationObject(o,i,e),this.annotation.invalidatePageAppearances(r,e),n.emitFieldValueChanges&&this.fieldValueChange$.emit(e,{documentId:e,pageIndex:r,annotationId:o,widget:i});this.buildFieldGroupIndex(e)}}resolveWidgetPage(e,t,n){const o=this.resolveWidgetAnnotation(e,t);if(!o)return null;const i=n.pages.find(e=>e.index===o.pageIndex);return i?{widget:o,page:i}:null}getPageFormAnnoWidgets(e,t){const n=this.getCoreDocumentOrThrow(t).document;if(!n)return ln.reject({code:sn.DocNotOpen,message:"document is not open"});const o=n.pages.find(t=>t.index===e);return o?this.engine.getPageAnnoWidgets(n,o):ln.reject({code:sn.NotFound,message:"page does not exist"})}setFormFieldValues(e,t,n,o){const i=o??this.getActiveDocumentId(),r=this.getCoreDocumentOrThrow(i).document;if(!r)return ln.reject({code:sn.DocNotOpen,message:"document is not open"});const a=r.pages.find(t=>t.index===e);if(!a)return ln.reject({code:sn.NotFound,message:"page does not exist"});const s=new kt,l=new Un(s);return l.execute(async()=>{const e=this.getFieldGroup(t.id,i),o=await this.readFieldWidgets(r,e,l,!1);await l.run(()=>this.engine.setFormFieldState(r,a,t,n));const c=await this.readFieldWidgets(r,e,l,this.shouldRegenerateWidgetAppearances(n));let d=!0;const u=async e=>{const t=this.getFieldBatchTarget(e);if(!t)return;const n=r.pages.find(e=>e.index===t.pageIndex);if(n&&(await new Promise(e=>{this.engine.setFormFieldState(r,n,t.widget,t.widget.field).wait(()=>e(),()=>e())}),this.shouldRegenerateWidgetAppearances(t.widget.field)))for(const t of new Set([...e.values()].map(e=>e.pageIndex))){const n=r.pages.find(e=>e.index===t);if(!n)continue;const o=[...e.entries()].filter(([,e])=>e.pageIndex===t).map(([e])=>e);await new Promise(e=>{this.engine.regenerateWidgetAppearances(r,n,o).wait(()=>e(),()=>e())})}},h={execute:()=>{const e=d;d=!1,e?this.syncFieldBatch(i,c,{emitFieldValueChanges:!0}):u(c).then(()=>this.syncFieldBatch(i,c,{emitFieldValueChanges:!0}))},undo:()=>{u(o).then(()=>this.syncFieldBatch(i,o,{emitFieldValueChanges:!0}))}};this.history?this.history.forDocument(i).register(h,this.FORM_HISTORY_TOPIC):h.execute(),s.resolve(!0)},e=>({code:sn.Unknown,message:String(e)})),s}findConflictingFieldGroups(e,t,n){const o=new Map;if(!this.annotation)return o;const i=this.annotation.forDocument(n).getState();if(!i)return o;const r=(()=>{const e=this.resolveWidgetAnnotation(t,n);return e?this.getFieldKey(e.field):null})();for(const[t,n]of Object.entries(i.pages)){const a=Number(t);for(const t of n){const n=i.byUid[t];if(!n||n.object.type!==_t.WIDGET)continue;const s=n.object;if(s.field.name.trim()!==e)continue;const l=this.getFieldKey(s.field);l&&l!==r&&(o.has(l)||o.set(l,{entries:[],widget:s}),o.get(l).entries.push({annotationId:t,pageIndex:a}))}}return o}renameFieldMethod(e,t,n){const o=n??this.getActiveDocumentId(),i=t.trim();if(!i)return ln.reject({code:sn.Unknown,message:"Field name must not be empty."});const r=this.getCoreDocumentOrThrow(o).document;if(!r)return ln.reject({code:sn.DocNotOpen,message:"document is not open"});const a=this.resolveWidgetPage(e,o,r);if(!a)return ln.reject({code:sn.NotFound,message:"widget annotation not found"});if(a.widget.field.name.trim()===i)return ln.resolve({outcome:"no-op"});const s=this.findConflictingFieldGroups(i,e,o);if(s.size>0){if(s.size>1)return ln.reject({code:sn.Unknown,message:"That field name is used by multiple fields. Choose a unique name."});const[,e]=[...s.entries()][0];return e.widget.field.type!==a.widget.field.type?ln.reject({code:sn.Unknown,message:"That field name is already used by a different widget type."}):ln.resolve({outcome:"conflict",targetAnnotationId:e.entries[0].annotationId,fieldName:i})}const l=new kt,c=new Un(l);return c.execute(async()=>{const t=this.getFieldGroup(e,o);await c.run(()=>this.engine.renameWidgetField(r,a.page,a.widget,i));const n=await this.readFieldWidgets(r,t,c,!1);this.syncFieldBatch(o,n),l.resolve({outcome:"renamed"})},e=>({code:sn.Unknown,message:String(e)})),l}shareFieldMethod(e,t,n){const o=n??this.getActiveDocumentId();if(e===t)return ln.resolve(!0);const i=this.getCoreDocumentOrThrow(o).document;if(!i)return ln.reject({code:sn.DocNotOpen,message:"document is not open"});const r=this.resolveWidgetPage(e,o,i),a=this.resolveWidgetPage(t,o,i);if(!r||!a)return ln.reject({code:sn.NotFound,message:"widget annotation not found"});if(r.widget.field.type!==a.widget.field.type)return ln.reject({code:sn.Unknown,message:"cannot share fields with different widget types"});if(r.widget.field.fieldObjectId&&a.widget.field.fieldObjectId&&r.widget.field.fieldObjectId===a.widget.field.fieldObjectId)return ln.resolve(!0);const s=new Map;for(const t of this.getFieldGroup(e,o))s.set(t.annotationId,t);for(const e of this.getFieldGroup(t,o))s.set(e.annotationId,e);const l=[...s.values()],c=new kt,d=new Un(c);return d.execute(async()=>{await d.run(()=>this.engine.shareWidgetField(i,r.page,r.widget,a.page,a.widget));const e=await this.readFieldWidgets(i,l,d,this.shouldRegenerateWidgetAppearances(a.widget.field));this.syncFieldBatch(o,e),c.resolve(!0)},e=>({code:sn.Unknown,message:String(e)})),c}selectFieldMethod(e,t){const n=t??this.getActiveDocumentId();this.dispatch(Bp(n,e))}deselectFieldMethod(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:Up,payload:e}}(t))}getSelectedFieldId(e){return this.getDocumentState(e).selectedFieldId}selectNextFieldMethod(e){const t=e??this.getActiveDocumentId(),n=this.orderedFieldIndex.get(t);if(!n||0===n.length)return;const o=this.getSelectedFieldId(t);let i=0;if(o){const e=n.findIndex(e=>e.annotationId===o);i=e>=0?(e+1)%n.length:0}const r=n[i];this.dispatch(Bp(t,r.annotationId))}selectPreviousFieldMethod(e){const t=e??this.getActiveDocumentId(),n=this.orderedFieldIndex.get(t);if(!n||0===n.length)return;const o=this.getSelectedFieldId(t);let i=n.length-1;if(o){const e=n.findIndex(e=>e.annotationId===o);i=e>=0?(e-1+n.length)%n.length:n.length-1}const r=n[i];this.dispatch(Bp(t,r.annotationId))}activateFieldMethod(e){const t=e??this.getActiveDocumentId(),n=this.getSelectedFieldId(t);if(!n)return;const o=this.resolveWidgetAnnotation(n,t);if(!o)return;const i=o.field;if(i.type===Bt.CHECKBOX){const e=Yt(o)?"Off":o.exportValue??"Yes";this.setFormFieldValues(o.pageIndex,o,{...i,value:e},t)}else i.type===Bt.RADIOBUTTON&&!Yt(o)&&o.exportValue&&this.setFormFieldValues(o.pageIndex,o,{...i,value:o.exportValue},t)}renderWidget(e,t){if(!this.annotation)return ln.reject({code:sn.NotFound,message:"annotation plugin not found"});const n=t??this.getActiveDocumentId();return this.annotation.forDocument(n).renderAnnotation(e)}async destroy(){this.state$.clear(),this.fieldValueChange$.clear(),this.formReady$.clear(),super.destroy()}};nf.id="form";let of=nf;const rf={manifest:_p,create:(e,t)=>new of(Lp,e,t),reducer:(e=Hp,t)=>{switch(t.type){case Fp:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case $p:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case jp:{const{documentId:n,annotationId:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedFieldId:o}}}:e}case Up:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selectedFieldId:null}}}:e}default:return e}},initialState:Hp},af=(e,t,n)=>({selected:e?t.includes(n):void 0});function sf({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){const[r,a]=Se(!1),{object:s}=e,l=s.field,c=l.type===Bt.TEXTFIELD,d=c?l.value:"",u=c&&!!(l.flag&Gt.TEXT_COMB)&&!!l.maxLen,h=c&&!!(l.flag&Gt.TEXT_MULTIPLINE),m=c?l.maxLen:void 0,g=(s.strokeWidth??1)*n,p={fontSize:(s.fontSize??12)*n,...Pn(s.fontFamily),color:s.fontColor??"#000000",lineHeight:1.2};return Be("div",{onPointerDown:t?void 0:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0,background:s.color??"rgba(255, 255, 255, 0.9)",border:`${g}px solid ${s.strokeColor??"rgba(0, 0, 0, 0.2)"}`,outline:r||t?"1px solid rgba(66, 133, 244, 0.5)":"none",outlineOffset:-1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:h?"flex-start":"center",overflow:"hidden",...u?{}:{padding:`${g}px ${g}px`},...i},children:u&&m?Be(lf,{value:d??"",maxLen:m,scale:n,width:s.rect.size.width,fontStyle:p,strokeColor:s.strokeColor??"rgba(0, 0, 0, 0.2)"}):Be("span",{style:{...p,display:"block",width:"100%",whiteSpace:h?"pre-wrap":"nowrap",wordBreak:h?"break-word":"normal",overflowWrap:h?"break-word":"normal",overflow:"hidden",textOverflow:h?"clip":"ellipsis"},children:d})})}function lf({value:e,maxLen:t,scale:n,width:o,fontStyle:i,strokeColor:r}){const a=o*n/t,s=e.split("");return Be("div",{style:{position:"relative",width:"100%",height:"100%"},children:Array.from({length:t}).map((e,n)=>Be("span",{style:{position:"absolute",top:0,left:n*a,width:a,height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderRight:n<t-1?`1px solid ${r}`:"none",boxSizing:"border-box",...i},children:s[n]||""},n))})}function cf({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){const[r,a]=Se(!1),{object:s}=e,l=Yt(s);return Be("div",{onPointerDown:t?void 0:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0,background:s.color??"#FFFFFF",border:`${(s.strokeWidth??1)*n}px solid ${s.strokeColor??"#000000"}`,outline:r||t?"1px solid rgba(66, 133, 244, 0.5)":"none",outlineOffset:-1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:"center",...i},children:l&&Be("svg",{viewBox:"0 0 100 100",style:{width:"100%",height:"100%"},children:Be("path",{d:"M28 48C27.45 50.21 29.45 63.13 30 67C30.55 69.21 34.58 72 39 72C44.52 71.45 76.55 32.55 76 32C77.1 31.45 76 25 76 25C74.34 22.24 68 25.45 68 26C68 26 43.55 53 43 53C41.34 53 40.55 41.1 40 40C33.37 36.69 29.1 45.79 28 48Z",fill:"#000000"})})})}function df({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){const[r,a]=Se(!1),{object:s}=e,l=Yt(s);return Be("div",{onPointerDown:t?void 0:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0,background:s.color??"#FFFFFF",border:`${(s.strokeWidth??1)*n}px solid ${s.strokeColor??"#000000"}`,borderRadius:"50%",outline:r||t?"1px solid rgba(66, 133, 244, 0.5)":"none",outlineOffset:-1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",justifyContent:"center",...i},children:l&&Be("div",{style:{width:"50%",height:"50%",borderRadius:"50%",background:"#000000"}})})}function uf({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){var r;const[a,s]=Se(!1),{object:l}=e,c=l.field,d=(null==(r=(c.type===Bt.COMBOBOX?c.options:[]).find(e=>e.isSelected))?void 0:r.label)??"",u=(l.strokeWidth??1)*n,h=(l.fontSize??12)*n;return Be("div",{onPointerDown:t?void 0:o,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{position:"absolute",inset:0,background:l.color??"#FFFFFF",border:`${u}px solid ${l.strokeColor??"#000000"}`,outline:a||t?"1px solid rgba(66, 133, 244, 0.5)":"none",outlineOffset:-1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",display:"flex",alignItems:"center",overflow:"hidden",...i},children:[Be("span",{style:{flex:1,padding:`0 ${4*n}px`,fontSize:h,...Pn(l.fontFamily),color:l.fontColor??"#000000",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d}),Be("div",{style:{width:13*n,minWidth:13*n,height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderLeft:`1px solid ${l.strokeColor??"#000000"}`},children:Be("svg",{viewBox:"0 0 10 6",style:{width:8*n,height:5*n},fill:"currentColor",children:Be("path",{d:"M0 0 L5 6 L10 0 Z"})})})]})}function hf({annotation:e,isSelected:t,scale:n,onClick:o,style:i}){const[r,a]=Se(!1),{object:s}=e,l=s.field,c=l.type===Bt.LISTBOX?l.options:[],d=(s.strokeWidth??1)*n,u=(s.fontSize??12)*n,h=1.2*u;return Be("div",{onPointerDown:t?void 0:o,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0,background:s.color??"#FFFFFF",border:`${d}px solid ${s.strokeColor??"#000000"}`,outline:r||t?"1px solid rgba(66, 133, 244, 0.5)":"none",outlineOffset:-1,boxSizing:"border-box",pointerEvents:"auto",cursor:t?"move":"pointer",overflow:"hidden",display:"flex",flexDirection:"column",...i},children:c.map((e,t)=>Be("div",{style:{padding:`0 ${4*n}px`,fontSize:u,lineHeight:`${h}px`,...Pn(s.fontFamily),color:e.isSelected?"#FFFFFF":s.fontColor??"#000000",background:e.isSelected?"rgba(0, 51, 113, 1)":"transparent",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label},t))})}const mf=()=>Wo(of.id),gf=e=>{var t;const{provides:n}=mf(),[o,i]=Se((null==(t=null==n?void 0:n.forDocument(e))?void 0:t.getState())??{...Wp});return Me(()=>{if(!n)return;const t=n.forDocument(e);return i(t.getState()),t.onStateChange(e=>{i(e)})},[n,e]),o};function pf(e){const{currentObject:t,scale:n,pageIndex:o}=e,i=t.field,{provides:r}=mf(),[a,s]=Se(0),l=!!(i.flag&Gt.READONLY),c=Te(()=>null==r?void 0:r.forDocument(e.documentId),[r,e.documentId]);Me(()=>{if(c)return c.onFieldValueChange(e=>{e.annotationId===t.id&&s(e=>e+1)})},[c,t.id]);const d=Re(e=>{c&&c.setFormFieldValues(o,t,e)},[c,o,t]);return{annotation:t,field:i,scale:n,pageIndex:o,scope:c,handleChangeField:d,renderKey:a,isReadOnly:l}}function ff({pageIndex:e,annotation:t,scaleFactor:n=1,renderKey:o=0,style:i,...r}){const{provides:a}=mf(),[s,l]=Se(null),c=Pe(null),{width:d,height:u}=t.rect.size;return Me(()=>{if(!a)return;const o=a.renderWidget({pageIndex:e,annotation:t,options:{scaleFactor:n,dpr:window.devicePixelRatio}});return o.wait(e=>{const t=URL.createObjectURL(e);c.current&&URL.revokeObjectURL(c.current),c.current=t,l(t)},Bn),()=>{o.abort({code:sn.Cancelled,message:"canceled render task"})}},[e,n,a,t.id,d,u,o]),Me(()=>()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=null)},[]),Be(B,{children:s&&Be("img",{src:s,...r,style:{width:"100%",height:"100%",display:"block",...i||{}}})})}const vf={position:"absolute",top:0,left:0,padding:0,margin:0,width:"100%",height:"100%",borderRadius:0,outline:"none",boxSizing:"border-box"},yf=vf,bf={...vf,cursor:"inherit"},wf={...vf,resize:"none",lineHeight:1.14},xf={position:"relative",width:"100%",height:"100%",borderRadius:0,boxSizing:"border-box"},kf={position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:0,padding:0,margin:0,border:"none",zIndex:1},Cf={position:"absolute",top:0,height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},If={position:"absolute",top:"15%",height:"70%",width:1,backgroundColor:"black",pointerEvents:"none"};function Sf(e){const{inputRef:t,required:n,disabled:o,password:i,name:r,value:a,maxLen:s,cellWidth:l,chars:c,caretIndex:d,containerStyle:u,cellFontStyle:h,onFocus:m,onChange:g,onBlur:p}=e,[f,v]=Se(!0);Me(()=>{v(!0);const e=setInterval(()=>v(e=>!e),530);return()=>clearInterval(e)},[d]);const y=d<s;return Be("div",{style:u,children:[Be("input",{ref:t,required:n,disabled:o,type:i?"password":"text",name:r,"aria-label":r,value:a,maxLength:s,onFocus:m,onChange:g,onBlur:p,style:kf}),Array.from({length:s}).map((e,t)=>Be("span",{style:{...Cf,...h,left:t*l,width:l},children:c[t]||""},t)),y&&Be("span",{style:{...If,left:d*l+l/2,opacity:f?1:0}})]})}function Af(e){const{annotation:t,isEditable:n,onChangeField:o,onFocus:i,onBlur:r,inputRef:a,scale:s,syncExternalValue:l=!0}=e,c=t.field,{flag:d}=c,u=c.name,h=c.value,[m,g]=Se(h);Me(()=>{l&&g(h)},[h,l]);const p=Re(e=>{const t=e.target.value;g(t),null==o||o({...c,value:t})},[o,c]),f=(t.strokeWidth??0)*s,v=Pn(t.fontFamily),{adjustedFontPx:y,wrapperStyle:b}=wm(t.fontSize*s,!0),w=Te(()=>({backgroundColor:t.color??"transparent",borderStyle:"solid",borderColor:t.strokeColor??"transparent",borderWidth:f,color:t.fontColor,...v,fontSize:y,padding:`${f}px ${f}px`}),[t.color,t.strokeColor,t.fontColor,y,f,v]),x=!n||!!(d&Gt.READONLY),k=!!(d&Gt.REQUIRED),C=!!(d&Gt.TEXT_PASSWORD),I=!!(d&Gt.TEXT_MULTIPLINE),S=!!(d&Gt.TEXT_COMB),A=c.maxLen;if(S&&A){const e=t.rect.size.width*s/A,n=(m||"").split(""),o=Be(Sf,{inputRef:a,required:k,disabled:x,password:C,name:u,value:m,maxLen:A,cellWidth:e,chars:n,caretIndex:n.length,containerStyle:{...xf,backgroundColor:t.color??"transparent",borderStyle:"solid",borderColor:t.strokeColor??"transparent",borderWidth:f},cellFontStyle:{color:t.fontColor,...v,fontSize:y},onFocus:i,onChange:p,onBlur:r});return b?Be("div",{style:b,children:o}):o}const M=I?Be("textarea",{ref:a,required:k,disabled:x,name:u,"aria-label":u,value:m,maxLength:A,onFocus:i,onChange:p,onBlur:r,style:{...wf,...w}}):Be("input",{ref:a,required:k,disabled:x,type:C?"password":"text",name:u,"aria-label":u,value:m,maxLength:A,onFocus:i,onChange:p,onBlur:r,style:{...yf,...w}});return b?Be("div",{style:b,children:M}):M}function Mf(e){const{annotation:t,scale:n,pageIndex:o,scope:i,handleChangeField:r,renderKey:a,isReadOnly:s}=pf(e),l=gf(e.documentId),[c,d]=Se(!1),u=Pe(null),h=l.selectedFieldId===t.id;Me(()=>{h&&u.current&&document.activeElement!==u.current&&u.current.focus()},[h]);const m=Re(()=>{s||(null==i||i.selectField(t.id),d(!0))},[s,i,t.id]),g=Re(()=>{d(!1),(null==i?void 0:i.getSelectedFieldId())===t.id&&(null==i||i.deselectField())},[i,t.id]),p=Re(e=>{u.current=e},[]);return Be("div",{style:{width:"100%",height:"100%",overflow:"hidden",position:"relative",pointerEvents:"auto",outline:"none"},children:[Be(ff,{pageIndex:o,annotation:t,scaleFactor:n,renderKey:a,style:{position:"absolute",inset:0,pointerEvents:"none",visibility:c?"hidden":"visible"}}),Be("div",{style:{position:"absolute",inset:0,zIndex:1,opacity:c?1:0},children:Be(Af,{annotation:t,scale:n,pageIndex:o,isEditable:!0,onChangeField:r,syncExternalValue:!c,onFocus:m,onBlur:g,inputRef:p})})]})}function Df(e){const{annotation:t,field:n,scale:o,pageIndex:i,scope:r,handleChangeField:a,renderKey:s,isReadOnly:l}=pf(e),c=gf(e.documentId),d=Pe(null),u=c.selectedFieldId===t.id;Me(()=>{u&&d.current&&document.activeElement!==d.current&&d.current.focus()},[u]);const h=Re(()=>{if(l)return;const e=Yt(t)?"Off":t.exportValue??"Yes";a({...n,value:e})},[l,t,n,a]),m=Re(()=>{l||(null==r||r.selectField(t.id),h())},[l,r,t.id,h]),g=Re(()=>{l||null==r||r.selectField(t.id)},[l,r,t.id]),p=Re(()=>{(null==r?void 0:r.getSelectedFieldId())===t.id&&(null==r||r.deselectField())},[r,t.id]),f=Re(e=>{" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),h())},[h]);return Be("div",{ref:d,tabIndex:l?-1:0,onClick:m,onFocus:g,onBlur:p,onKeyDown:f,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l?"default":"pointer",pointerEvents:"auto",outline:u?"2px solid rgba(66, 133, 244, 0.8)":"none",outlineOffset:-2},children:Be(ff,{pageIndex:i,annotation:t,scaleFactor:o,renderKey:s,style:{pointerEvents:"none"}})})}function Pf(e){const{annotation:t,field:n,scale:o,pageIndex:i,scope:r,handleChangeField:a,renderKey:s,isReadOnly:l}=pf(e),c=gf(e.documentId),d=Pe(null),u=c.selectedFieldId===t.id;Me(()=>{u&&d.current&&document.activeElement!==d.current&&d.current.focus()},[u]);const h=Re(()=>{l||!Yt(t)&&t.exportValue&&a({...n,value:t.exportValue})},[l,t,n,a]),m=Re(()=>{l||(null==r||r.selectField(t.id),h())},[l,r,t.id,h]),g=Re(()=>{l||null==r||r.selectField(t.id)},[l,r,t.id]),p=Re(()=>{(null==r?void 0:r.getSelectedFieldId())===t.id&&(null==r||r.deselectField())},[r,t.id]),f=Re(e=>{" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),h())},[h]);return Be("div",{ref:d,tabIndex:l?-1:0,onClick:m,onFocus:g,onBlur:p,onKeyDown:f,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l?"default":"pointer",pointerEvents:"auto",outline:u?"2px solid rgba(66, 133, 244, 0.8)":"none",outlineOffset:-2},children:Be(ff,{pageIndex:i,annotation:t,scaleFactor:o,renderKey:s,style:{pointerEvents:"none"}})})}function Tf(e){const{annotation:t,isEditable:n,onChangeField:o,onBlur:i,inputRef:r}=e,a=t.field,{flag:s,options:l}=a,c=a.alternateName||a.name,d=!n||!!(s&Gt.READONLY),u=!!(s&Gt.REQUIRED),h=Re(e=>{const t=e.target,n=l.map((e,n)=>({...e,isSelected:n===t.selectedIndex}));null==o||o({...a,options:n})},[o,a,l]),m=l.filter(e=>e.isSelected).map(e=>e.label);return Be("select",{ref:r,required:u,disabled:d,name:c,"aria-label":c,...(g=!1,p=m,{value:g?void 0:p[0]||""}),onChange:h,onBlur:i,style:{...bf,opacity:0},children:l.map((e,t)=>Be("option",{value:e.label,...af(!1,m,e.label),children:e.label},t))});var g,p}function Rf(e){const{annotation:t,scale:n,pageIndex:o,scope:i,handleChangeField:r,renderKey:a,isReadOnly:s}=pf(e),l=gf(e.documentId),c=Pe(null),d=Pe(null),u=l.selectedFieldId===t.id;Me(()=>{u&&c.current&&!c.current.contains(document.activeElement)&&(d.current??c.current).focus()},[u]);const h=Re(()=>{null==i||i.selectField(t.id)},[i,t.id]),m=Re(()=>{requestAnimationFrame(()=>{var e;(null==(e=c.current)?void 0:e.contains(document.activeElement))||(null==i?void 0:i.getSelectedFieldId())===t.id&&(null==i||i.deselectField())})},[i,t.id]),g=Re(e=>{d.current=e},[]);return Be("div",{ref:c,onFocus:h,onBlur:m,style:{width:"100%",height:"100%",overflow:"hidden",cursor:s?"default":"pointer",pointerEvents:"auto",outline:u?"2px solid rgba(66, 133, 244, 0.8)":"none",outlineOffset:-2},children:[Be(ff,{pageIndex:o,annotation:t,scaleFactor:n,renderKey:a,style:{pointerEvents:"none"}}),Be(Tf,{annotation:t,scale:n,pageIndex:o,isEditable:!0,onChangeField:r,inputRef:g})]})}function zf(e){const{annotation:t,isEditable:n,onChangeField:o,onBlur:i,inputRef:r,scale:a}=e,s=t.field,{flag:l,options:c}=s,d=!n||!!(l&Gt.READONLY),u=!!(l&Gt.CHOICE_MULTL_SELECT),h=(t.strokeWidth??0)*a,m=(t.fontSize??12)*a,g=1.2*m,p=Pn(t.fontFamily),f=Te(()=>({position:"absolute",top:0,left:0,width:"100%",height:"100%",background:t.color??"#FFFFFF",borderStyle:"solid",borderColor:t.strokeColor??"#000000",borderWidth:h,boxSizing:"border-box",overflow:"auto",display:"flex",flexDirection:"column",outline:"none"}),[t.color,t.strokeColor,h]),v=Re(e=>{if(d)return;const t=c.map((t,n)=>({...t,isSelected:u?n===e?!t.isSelected:t.isSelected:n===e}));null==o||o({...s,options:t})},[d,u,c,s,o]);return Be("div",{ref:r,onBlur:i,style:f,children:c.map((e,n)=>Be("div",{onClick:()=>v(n),style:{padding:`0 ${4*a}px`,fontSize:m,lineHeight:`${g}px`,...p,color:e.isSelected?"#FFFFFF":t.fontColor??"#000000",background:e.isSelected?"rgba(0, 51, 113, 1)":"transparent",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",cursor:d?"default":"pointer"},children:e.label},n))})}function Ef(e){const{annotation:t,scale:n,pageIndex:o,scope:i,handleChangeField:r,renderKey:a,isReadOnly:s}=pf(e),l=gf(e.documentId),[c,d]=Se(!1),u=Pe(null),h=l.selectedFieldId===t.id;Me(()=>{h&&u.current&&!u.current.contains(document.activeElement)&&u.current.focus()},[h]);const m=Re(()=>{s||(null==i||i.selectField(t.id),d(!0))},[s,i,t.id]),g=Re(()=>{requestAnimationFrame(()=>{var e;(null==(e=u.current)?void 0:e.contains(document.activeElement))||(d(!1),(null==i?void 0:i.getSelectedFieldId())===t.id&&(null==i||i.deselectField()))})},[i,t.id]);return Be("div",{ref:u,tabIndex:s?-1:0,onFocus:m,onBlur:g,style:{width:"100%",height:"100%",overflow:"hidden",cursor:s?"default":"pointer",pointerEvents:"auto",outline:h&&!c?"2px solid rgba(66, 133, 244, 0.8)":"none",outlineOffset:-2},children:[Be(zf,{annotation:t,scale:n,pageIndex:o,isEditable:!0,onChangeField:r}),!c&&Be(ff,{pageIndex:o,annotation:t,scaleFactor:n,renderKey:a,style:{pointerEvents:"none"}})]})}const Of=[Am({id:"formTextField",matches:e=>{var t;return e.type===_t.WIDGET&&(null==(t=e.field)?void 0:t.type)===Bt.TEXTFIELD},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(sf,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),renderPreview:({bounds:e,scale:t})=>Be("div",{style:{position:"absolute",left:0,top:0,width:e.size.width*t,height:e.size.height*t,border:"1px dashed rgba(66, 133, 244, 0.6)",backgroundColor:"rgba(255, 255, 255, 0.9)",boxSizing:"border-box",display:"flex",alignItems:"center",padding:`0 ${2*t}px`,overflow:"hidden"}}),interactionDefaults:{isDraggable:!1,isResizable:!0,isRotatable:!1},useAppearanceStream:!1,renderLocked:e=>Be(Mf,{...e})}),Am({id:"formCheckbox",matches:e=>{var t;return e.type===_t.WIDGET&&(null==(t=e.field)?void 0:t.type)===Bt.CHECKBOX},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(cf,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),renderPreview:({bounds:e,scale:t})=>Be("div",{style:{position:"absolute",left:0,top:0,width:e.size.width*t,height:e.size.height*t,border:"1px dashed rgba(66, 133, 244, 0.6)",backgroundColor:"rgba(255, 255, 255, 0.9)",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}),interactionDefaults:{isDraggable:!1,isResizable:!0,isRotatable:!1},useAppearanceStream:!1,renderLocked:e=>Be(Df,{...e})}),Am({id:"formRadioButton",matches:e=>{var t;return e.type===_t.WIDGET&&(null==(t=e.field)?void 0:t.type)===Bt.RADIOBUTTON},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(df,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),renderPreview:({bounds:e,scale:t})=>Be("div",{style:{position:"absolute",left:0,top:0,width:e.size.width*t,height:e.size.height*t,border:"1px dashed rgba(66, 133, 244, 0.6)",backgroundColor:"rgba(255, 255, 255, 0.9)",borderRadius:"50%",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}),interactionDefaults:{isDraggable:!1,isResizable:!0,isRotatable:!1},useAppearanceStream:!1,renderLocked:e=>Be(Pf,{...e})}),Am({id:"formCombobox",matches:e=>{var t;return e.type===_t.WIDGET&&(null==(t=e.field)?void 0:t.type)===Bt.COMBOBOX},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(uf,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),renderPreview:({bounds:e,scale:t})=>Be("div",{style:{position:"absolute",left:0,top:0,width:e.size.width*t,height:e.size.height*t,border:"1px dashed rgba(66, 133, 244, 0.6)",backgroundColor:"rgba(255, 255, 255, 0.9)",boxSizing:"border-box",display:"flex",alignItems:"center",padding:`0 ${2*t}px`,overflow:"hidden"}}),interactionDefaults:{isDraggable:!1,isResizable:!0,isRotatable:!1},useAppearanceStream:!1,renderLocked:e=>Be(Rf,{...e})}),Am({id:"formListbox",matches:e=>{var t;return e.type===_t.WIDGET&&(null==(t=e.field)?void 0:t.type)===Bt.LISTBOX},render:({annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i})=>Be(hf,{annotation:e,isSelected:t,scale:n,pageIndex:o,onClick:i}),renderPreview:({bounds:e,scale:t})=>Be("div",{style:{position:"absolute",left:0,top:0,width:e.size.width*t,height:e.size.height*t,border:"1px dashed rgba(66, 133, 244, 0.6)",backgroundColor:"rgba(255, 255, 255, 0.9)",boxSizing:"border-box",display:"flex",flexDirection:"column",overflow:"hidden"}}),interactionDefaults:{isDraggable:!1,isResizable:!0,isRotatable:!1},useAppearanceStream:!1,renderLocked:e=>Be(Ef,{...e})})];const Nf=Fo(rf).addUtility(function(){return mm(Of),null}).build(),Lf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),_f="-",Ff=[],$f=e=>{const t=Bf(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Uf(e);const n=e.split(_f),o=""===n[0]&&n.length>1?1:0;return jf(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||Ff}return n[e]||Ff}}},jf=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const n=jf(e,t+1,i);if(n)return n}const r=n.validators;if(null===r)return;const a=0===t?e.join(_f):e.slice(t).join(_f),s=r.length;for(let e=0;e<s;e++){const t=r[e];if(t.validator(a))return t.classGroupId}},Uf=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})(),Bf=e=>{const{theme:t,classGroups:n}=e;return Wf(n,t)},Wf=(e,t)=>{const n=Lf();for(const o in e){const i=e[o];Hf(i,n,o,t)}return n},Hf=(e,t,n,o)=>{const i=e.length;for(let r=0;r<i;r++){const i=e[r];Gf(i,t,n,o)}},Gf=(e,t,n,o)=>{"string"!=typeof e?"function"!=typeof e?Kf(e,t,n,o):Vf(e,t,n,o):qf(e,t,n)},qf=(e,t,n)=>{(""===e?t:Zf(t,e)).classGroupId=n},Vf=(e,t,n,o)=>{Xf(e)?Hf(e(o),t,n,o):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},Kf=(e,t,n,o)=>{const i=Object.entries(e),r=i.length;for(let e=0;e<r;e++){const[r,a]=i[e];Hf(a,Zf(t,r),n,o)}},Zf=(e,t)=>{let n=e;const o=t.split(_f),i=o.length;for(let e=0;e<i;e++){const t=o[e];let i=n.nextPart.get(t);i||(i=Lf(),n.nextPart.set(t,i)),n=i}return n},Xf=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Yf=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)}}},Qf=[],Jf=(e,t,n,o,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:i}),ev=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 Jf(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)):Jf(Qf,!1,t,void 0,!0)}if(n){const e=o;o=t=>n({className:t,parseClassName:e})}return o},tv=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}},nv=/\s+/,ov=e=>{if("string"==typeof e)return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=ov(e[o]))&&(n&&(n+=" "),n+=t);return n},iv=(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(nv);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 f=0===d.length?"":1===d.length?d[0]:r(d).join(":"),v=u?f+"!":f,y=v+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(v+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:Yf(e.cacheSize),parseClassName:ev(e),sortModifiers:tv(e),...$f(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=ov(t))&&(i&&(i+=" "),i+=n);return i})(...e))},rv=[],av=e=>{const t=t=>t[e]||rv;return t.isThemeGetter=!0,t},sv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cv=/^\d+\/\d+$/,dv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uv=/\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$/,hv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pv=e=>cv.test(e),fv=e=>!!e&&!Number.isNaN(Number(e)),vv=e=>!!e&&Number.isInteger(Number(e)),yv=e=>e.endsWith("%")&&fv(e.slice(0,-1)),bv=e=>dv.test(e),wv=()=>!0,xv=e=>uv.test(e)&&!hv.test(e),kv=()=>!1,Cv=e=>mv.test(e),Iv=e=>gv.test(e),Sv=e=>!Mv(e)&&!Ev(e),Av=e=>jv(e,Hv,kv),Mv=e=>sv.test(e),Dv=e=>jv(e,Gv,xv),Pv=e=>jv(e,qv,fv),Tv=e=>jv(e,Bv,kv),Rv=e=>jv(e,Wv,Iv),zv=e=>jv(e,Kv,Cv),Ev=e=>lv.test(e),Ov=e=>Uv(e,Gv),Nv=e=>Uv(e,Vv),Lv=e=>Uv(e,Bv),_v=e=>Uv(e,Hv),Fv=e=>Uv(e,Wv),$v=e=>Uv(e,Kv,!0),jv=(e,t,n)=>{const o=sv.exec(e);return!!o&&(o[1]?t(o[1]):n(o[2]))},Uv=(e,t,n=!1)=>{const o=lv.exec(e);return!!o&&(o[1]?t(o[1]):n)},Bv=e=>"position"===e||"percentage"===e,Wv=e=>"image"===e||"url"===e,Hv=e=>"length"===e||"size"===e||"bg-size"===e,Gv=e=>"length"===e,qv=e=>"number"===e,Vv=e=>"family-name"===e,Kv=e=>"shadow"===e,Zv=iv(()=>{const e=av("color"),t=av("font"),n=av("text"),o=av("font-weight"),i=av("tracking"),r=av("leading"),a=av("breakpoint"),s=av("container"),l=av("spacing"),c=av("radius"),d=av("shadow"),u=av("inset-shadow"),h=av("text-shadow"),m=av("drop-shadow"),g=av("blur"),p=av("perspective"),f=av("aspect"),v=av("ease"),y=av("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ev,Mv],w=()=>[Ev,Mv,l],x=()=>[pv,"full","auto",...w()],k=()=>[vv,"none","subgrid",Ev,Mv],C=()=>["auto",{span:["full",vv,Ev,Mv]},vv,Ev,Mv],I=()=>[vv,"auto",Ev,Mv],S=()=>["auto","min","max","fr",Ev,Mv],A=()=>["auto",...w()],M=()=>[pv,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],D=()=>[e,Ev,Mv],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Lv,Tv,{position:[Ev,Mv]}],T=()=>["auto","cover","contain",_v,Av,{size:[Ev,Mv]}],R=()=>[yv,Ov,Dv],z=()=>["","none","full",c,Ev,Mv],E=()=>["",fv,Ov,Dv],O=()=>[fv,yv,Lv,Tv],N=()=>["","none",g,Ev,Mv],L=()=>["none",fv,Ev,Mv],_=()=>["none",fv,Ev,Mv],F=()=>[fv,Ev,Mv],$=()=>[pv,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bv],breakpoint:[bv],color:[wv],container:[bv],"drop-shadow":[bv],ease:["in","out","in-out"],font:[Sv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bv],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bv],shadow:[bv],spacing:["px",fv],text:[bv],"text-shadow":[bv],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pv,Mv,Ev,f]}],container:["container"],columns:[{columns:[fv,Mv,Ev,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:[vv,"auto",Ev,Mv]}],basis:[{basis:[pv,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[fv,pv,"auto","initial","none",Mv]}],grow:[{grow:["",fv,Ev,Mv]}],shrink:[{shrink:["",fv,Ev,Mv]}],order:[{order:[vv,"first","last","none",Ev,Mv]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":S()}],"auto-rows":[{"auto-rows":S()}],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:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"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,Ov,Dv]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Ev,Pv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yv,Mv]}],"font-family":[{font:[Nv,Mv,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,Ev,Mv]}],"line-clamp":[{"line-clamp":[fv,"none",Ev,Pv]}],leading:[{leading:[r,...w()]}],"list-image":[{"list-image":["none",Ev,Mv]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ev,Mv]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[fv,"from-font","auto",Ev,Dv]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[fv,"auto",Ev,Mv]}],"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",Ev,Mv]}],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",Ev,Mv]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"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"]},vv,Ev,Mv],radial:["",Ev,Mv],conic:[vv,Ev,Mv]},Fv,Rv]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:E()}],"border-w-x":[{"border-x":E()}],"border-w-y":[{"border-y":E()}],"border-w-s":[{"border-s":E()}],"border-w-e":[{"border-e":E()}],"border-w-t":[{"border-t":E()}],"border-w-r":[{"border-r":E()}],"border-w-b":[{"border-b":E()}],"border-w-l":[{"border-l":E()}],"divide-x":[{"divide-x":E()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":E()}],"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:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[fv,Ev,Mv]}],"outline-w":[{outline:["",fv,Ov,Dv]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,$v,zv]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",u,$v,zv]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:E()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[fv,Dv]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":E()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,$v,zv]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[fv,Ev,Mv]}],"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":[fv]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[Ev,Mv]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"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":[fv]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ev,Mv]}],filter:[{filter:["","none",Ev,Mv]}],blur:[{blur:N()}],brightness:[{brightness:[fv,Ev,Mv]}],contrast:[{contrast:[fv,Ev,Mv]}],"drop-shadow":[{"drop-shadow":["","none",m,$v,zv]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",fv,Ev,Mv]}],"hue-rotate":[{"hue-rotate":[fv,Ev,Mv]}],invert:[{invert:["",fv,Ev,Mv]}],saturate:[{saturate:[fv,Ev,Mv]}],sepia:[{sepia:["",fv,Ev,Mv]}],"backdrop-filter":[{"backdrop-filter":["","none",Ev,Mv]}],"backdrop-blur":[{"backdrop-blur":N()}],"backdrop-brightness":[{"backdrop-brightness":[fv,Ev,Mv]}],"backdrop-contrast":[{"backdrop-contrast":[fv,Ev,Mv]}],"backdrop-grayscale":[{"backdrop-grayscale":["",fv,Ev,Mv]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[fv,Ev,Mv]}],"backdrop-invert":[{"backdrop-invert":["",fv,Ev,Mv]}],"backdrop-opacity":[{"backdrop-opacity":[fv,Ev,Mv]}],"backdrop-saturate":[{"backdrop-saturate":[fv,Ev,Mv]}],"backdrop-sepia":[{"backdrop-sepia":["",fv,Ev,Mv]}],"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",Ev,Mv]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[fv,"initial",Ev,Mv]}],ease:[{ease:["linear","initial",v,Ev,Mv]}],delay:[{delay:[fv,Ev,Mv]}],animate:[{animate:["none",y,Ev,Mv]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Ev,Mv]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:L()}],"rotate-x":[{"rotate-x":L()}],"rotate-y":[{"rotate-y":L()}],"rotate-z":[{"rotate-z":L()}],scale:[{scale:_()}],"scale-x":[{"scale-x":_()}],"scale-y":[{"scale-y":_()}],"scale-z":[{"scale-z":_()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Ev,Mv,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:$()}],"translate-x":[{"translate-x":$()}],"translate-y":[{"translate-y":$()}],"translate-z":[{"translate-z":$()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"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",Ev,Mv]}],"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",Ev,Mv]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[fv,Ov,Dv,Pv]}],stroke:[{stroke:["none",...D()]}],"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 Xv=["children","onClick","active","disabled","className","anchorRef"];function Yv(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=m(e,Xv);return j("button",h({type:"button",ref:c,onClick:n,disabled:a,className:Zv("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 Qv=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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 6l6 6l-6 6"}))},Jv=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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 6l-6 6l6 6"}))},ey=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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 9l6 6l6 -6"}))},ty=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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),j("path",{d:"M21 21l-6 -6"}))},ny=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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M18 6l-12 12"}),j("path",{d:"M6 6l12 12"}))},oy=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,l=void 0===s?"currentColor":s;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 4h10"}),j("path",{d:"M12 4v8"}),j("defs",null,j("clipPath",{id:"stripeClip"},j("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2"}))),j("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2",fill:"none",stroke:a}),j("g",{"clip-path":"url(#stripeClip)",stroke:l},j("path",{d:"M-7 24l12 -12"}),j("path",{d:"M-3 24l12 -12"}),j("path",{d:"M1 24l12 -12"}),j("path",{d:"M5 24l12 -12"}),j("path",{d:"M9 24l12 -12"}),j("path",{d:"M13 24l12 -12"}),j("path",{d:"M17 24l12 -12"}),j("path",{d:"M21 24l12 -12"}),j("path",{d:"M25 24l12 -12"})))},iy=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,l=void 0===s?"currentColor":s;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 20h-1a2 2 0 0 1 -2 -2v-1"}),j("path",{d:"M3 13v-3"}),j("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),j("path",{d:"M10 3h3"}),j("path",{d:"M17 3h1a2 2 0 0 1 2 2v1"}),j("defs",null,j("clipPath",{id:"redactClip"},j("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2"}))),j("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2",fill:"none"}),j("g",{"clip-path":"url(#redactClip)",stroke:l},j("path",{d:"M-2 24l14 -14"}),j("path",{d:"M2 24l14 -14"}),j("path",{d:"M6 24l14 -14"}),j("path",{d:"M10 24l15 -15"}),j("path",{d:"M14 24l15 -15"}),j("path",{d:"M18 24l15 -15"})))};var ry={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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),j("path",{d:"M7 11l5 5l5 -5"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 8l16 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),j("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),j("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 8v-2c0 -.551 .223 -1.05 .584 -1.412"}),j("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),j("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),j("path",{d:"M16 20h2c.545 0 1.04 -.218 1.4 -.572"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M17 9v-4a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M12 10.5v1.5"}),j("path",{d:"M12 16v1.5"}),j("path",{d:"M15.031 12.25l-1.299 .75"}),j("path",{d:"M10.268 15l-1.3 .75"}),j("path",{d:"M15 15.803l-1.285 -.773"}),j("path",{d:"M10.285 12.97l-1.285 -.773"}),j("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"}),j("path",{d:"M9 12h6"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v6"}),j("path",{d:"M10 18h-7"}),j("path",{d:"M21 18h-7"}),j("path",{d:"M6 15l-3 3l3 3"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h6"}),j("path",{d:"M18 14v7"}),j("path",{d:"M18 3v7"}),j("path",{d:"M15 18l3 3l3 -3"}),j("path",{d:"M15 6l3 -3l3 3"}))},chevronRight:Qv,chevronLeft:Jv,chevronDown:ey,search:ty,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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 11v.01"}),j("path",{d:"M8 11v.01"}),j("path",{d:"M16 11v.01"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M10 18v-12a2 2 0 0 1 2 -2h6a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-6a2 2 0 0 1 -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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 7l4 -4l4 4"}),j("path",{d:"M8 17l4 4l4 -4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 8l-4 4l4 4"}),j("path",{d:"M17 8l4 4l-4 4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),j("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),j("path",{d:"M3 6l0 13"}),j("path",{d:"M12 6l0 13"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12z"}),j("path",{d:"M19 16h-12a2 2 0 0 0 -2 2"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 6h11"}),j("path",{d:"M12 12h8"}),j("path",{d:"M15 18h5"}),j("path",{d:"M5 6v.01"}),j("path",{d:"M8 12v.01"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 20h16",stroke:a}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("path",{d:"M8 10h8",stroke:"currentColor"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("rect",{x:"2",y:"6",width:"20",height:"16",rx:"2",fill:a,stroke:"none"}),j("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),j("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}))},x:ny,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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),j("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),j("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 13v4"}),j("path",{d:"M13 15h4"}),j("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),j("path",{d:"M22 22l-3 -3"}),j("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),j("path",{d:"M3 11v-1"}),j("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),j("path",{d:"M10 3h1"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 19a2 2 0 0 1 -2 -2"}),j("path",{d:"M5 13v-2"}),j("path",{d:"M5 7a2 2 0 0 1 2 -2"}),j("path",{d:"M11 5h2"}),j("path",{d:"M17 5a2 2 0 0 1 2 2"}),j("path",{d:"M19 11v2"}),j("path",{d:"M19 17v4"}),j("path",{d:"M21 19h-4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 14l-4 -4l4 -4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 14l4 -4l-4 -4"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 7l16 0"}),j("path",{d:"M10 11l0 6"}),j("path",{d:"M14 11l0 6"}),j("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("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 j("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},j("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"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M20 4l-16 16"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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},j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M14 19v-10.5a3.5 3.5 0 0 1 7 0v10.5"}),j("path",{d:"M14 13h7"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M11 5l6 0"}),j("path",{d:"M7 19l6 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6l16 0"}),j("path",{d:"M4 12l10 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6l16 0"}),j("path",{d:"M8 12l8 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6l16 0"}),j("path",{d:"M10 12l10 0"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M11 13h2"}),j("path",{d:"M9 10h6"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M11 15h2"}),j("path",{d:"M9 12h6"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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"}),j("path",{d:"M11 17h2"}),j("path",{d:"M9 14h6"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M15 8h.01"}),j("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"}),j("path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"}),j("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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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:oy,redactArea:iy,redactCombined: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,l=void 0===s?"currentColor":s;return j("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:a,"stroke-width":i,"stroke-linecap":"round","stroke-linejoin":"round",class:e.className,role:"img","aria-label":e.title},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M6 20h-1a2 2 0 0 1 -2 -2v-1"}),j("path",{d:"M3 13v-3"}),j("path",{d:"M20 13v-3"}),j("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),j("path",{d:"M10 3h3"}),j("path",{d:"M17 3h1a2 2 0 0 1 2 2v1"}),j("path",{d:"M8 8h8"}),j("path",{d:"M12 8v7"}),j("defs",null,j("clipPath",{id:"redactCombinedClip"},j("rect",{x:"10",y:"18",width:"13",height:"6",rx:"2"}))),j("rect",{x:"10",y:"17",width:"13",height:"6",rx:"2",fill:"none"}),j("g",{"clip-path":"url(#redactCombinedClip)",stroke:l},j("path",{d:"M6 19l12 -12"}),j("path",{d:"M6 23l12 -12"}),j("path",{d:"M10 23l12 -12"}),j("path",{d:"M14 27l12 -12"}),j("path",{d:"M14 23l12 -12"})))},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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("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 j("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&&j("title",null,l),j("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),j("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 j("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&&j("title",null,l),j("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),j("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 j("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},j("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),j("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}))},unlock:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("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},j("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),j("path",{d:"M7 11V7a5 5 0 0 1 9.9-1"}))},alertTriangle:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("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},j("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"}),j("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),j("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))},eye:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("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},j("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),j("circle",{cx:"12",cy:"12",r:"3"}))},"eye-off":function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("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},j("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),j("line",{x1:"1",y1:"1",x2:"23",y2:"23"}))},info:function(e){var t=e.size,n=void 0===t?24:t,o=e.className;return j("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},j("circle",{cx:"12",cy:"12",r:"10"}),j("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),j("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"}))},link: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 15l6 -6"}),j("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),j("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}))},linkOff: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 15l3 -3m2 -2l1 -1"}),j("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.072 7.071l-.534 .464"}),j("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}),j("path",{d:"M3 3l18 18"}))},externalLink:function(e){return j("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e.className},j("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),j("path",{d:"M11 13l9 -9"}),j("path",{d:"M15 4h5v5"}))},marqueeSelect: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M17 20h6"}),j("path",{d:"M20 17v6"}),j("path",{d:"M4 13v-2"}),j("path",{d:"M4 6v-1a1 1 0 0 1 1 -1h1"}),j("path",{d:"M6 20h-1a1 1 0 0 1 -1 -1v-1"}),j("path",{d:"M11 4h2"}),j("path",{d:"M11 20h2"}),j("path",{d:"M18 4h1a1 1 0 0 1 1 1v1"}),j("path",{d:"M20 11v2"}))},group: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M17 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M17 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),j("path",{d:"M5 7v10"}),j("path",{d:"M19 7v10"}),j("path",{d:"M7 5h10"}),j("path",{d:"M7 19h10"}),j("path",{d:"M8 8H12.8V11.2H16V16H11.2V12.8H8V8Z"}))},ungroup: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("rect",{x:"4",y:"4",width:"7",height:"7",rx:"1"}),j("rect",{x:"13",y:"13",width:"7",height:"7",rx:"1"}))},redactionSidebar: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 6a2 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"}),j("path",{d:"M15 4v16"}),j("path",{d:"M7 8h5"}),j("path",{d:"M7 11h5"}),j("path",{d:"M7 14h4"}))},freeText: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M4 7v-2h12v2"}),j("path",{d:"M10 5v14"}),j("path",{d:"M12 19h-4"}),j("path",{d:"M15 13v-1h6v1"}),j("path",{d:"M18 12v7"}),j("path",{d:"M17 19h2"}))},insertText: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 7v-2h12v2"}),j("path",{d:"M9 5v14"}),j("path",{d:"M7 19h4"}),j("path",{d:"M18 15l2 2h-5"}),j("path",{d:"M18 19l2 -2"}))},replaceText: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 7v-2h12v2"}),j("path",{d:"M9 5v14"}),j("path",{d:"M7 19h4"}),j("g",{transform:"translate(-1, -3) rotate(180 19 18)"},j("path",{d:"M20 14l2 2h-3"}),j("path",{d:"M20 18l2 -2"}),j("path",{d:"M19 16a3 3 0 1 0 2 5.236"})))},message: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M8 9h8",stroke:"currentColor"}),j("path",{d:"M8 13h6",stroke:"currentColor"}),j("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 -3h12"}))},inkHighlighter: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{stroke:"currentColor",d:"M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),j("path",{stroke:"currentColor",d:"M12.5 5.5l4 4"}),j("path",{stroke:"currentColor",d:"M4.5 13.5l4 4"}),j("path",{stroke:a,fill:a,d:"M21 15v4h-8l4 -4l4 0"}))},formCheckbox: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14"}),j("path",{d:"M9 12l2 2l4 -4"}))},formRadio: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M9 12a2 2 0 1 0 6 0a2 2 0 1 0 -6 0",fill:"currentColor"}),j("path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}))},formSelect: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14"}),j("path",{d:"M9 11l3 3l3 -3"}))},formListbox: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14"}),j("path",{d:"M11 8h6"}),j("path",{d:"M11 12h6"}),j("path",{d:"M11 16h6"}),j("path",{d:"M7 8l0 .01"}),j("path",{d:"M7 12l0 .01"}),j("path",{d:"M7 16l0 .01"}))},formTextfield: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),j("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),j("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),j("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),j("path",{d:"M17 12h.01"}),j("path",{d:"M13 12h.01"}))},widgetEdit: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 j("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},j("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),j("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),j("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415"}),j("path",{d:"M16 5l3 3"}))}},ay=new Map,sy=/^[MmZzLlHhVvCcSsQqTtAa0-9\s,.\-eE]+$/;function ly(e){return sy.test(e.trim())}function cy(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||!ly(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.")}ay.set(e,n)}function dy(e){for(var t=0,n=Object.entries(e);t<n.length;t++){var o=v(n[t],2);cy(o[0],o[1])}}function uy(e,t,n){return e&&"none"!==e?"primary"===e?t:"secondary"===e?n:"currentColor"===e?"currentColor":e:"none"}function hy(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?"currentColor":d,h=e.className,m=ry[n];if(m)return j(m,{size:r,strokeWidth:s,primaryColor:c,secondaryColor:u,className:h,title:o});if(t=n,ay.has(t)){var g=function(e){return ay.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 j("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=uy(e.stroke,r,a),i=uy(e.fill,r,a),s=null!==(n=e.strokeWidth)&&void 0!==n?n:c;return j("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 my=["id","children","onClick","active","disabled","className","tooltip","elementRef"];function gy(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,g=m(e,my);return j("button",h({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},g),n)}const py=Math.min,fy=Math.max,vy=Math.round,yy=Math.floor,by=e=>({x:e,y:e}),wy={left:"right",right:"left",bottom:"top",top:"bottom"},xy={start:"end",end:"start"};function ky(e,t,n){return fy(e,py(t,n))}function Cy(e,t){return"function"==typeof e?e(t):e}function Iy(e){return e.split("-")[0]}function Sy(e){return e.split("-")[1]}function Ay(e){return"x"===e?"y":"x"}function My(e){return"y"===e?"height":"width"}const Dy=new Set(["top","bottom"]);function Py(e){return Dy.has(Iy(e))?"y":"x"}function Ty(e){return Ay(Py(e))}function Ry(e){return e.replace(/start|end/g,e=>xy[e])}const zy=["left","right"],Ey=["right","left"],Oy=["top","bottom"],Ny=["bottom","top"];function Ly(e,t,n,o){const i=Sy(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Ey:zy:t?zy:Ey;case"left":case"right":return t?Oy:Ny;default:return[]}}(Iy(e),"start"===n,o);return i&&(r=r.map(e=>e+"-"+i),t&&(r=r.concat(r.map(Ry)))),r}function _y(e){return e.replace(/left|right|bottom|top/g,e=>wy[e])}function Fy(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 $y(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 jy(e,t,n){let{reference:o,floating:i}=e;const r=Py(t),a=Ty(t),s=My(a),l=Iy(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(Sy(t)){case"start":m[a]-=h*(n&&c?-1:1);break;case"end":m[a]+=h*(n&&c?-1:1)}return m}async function Uy(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}=Cy(t,e),g=Fy(m),p=s[h?"floating"===u?"reference":"floating":u],f=$y(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})),v="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=$y(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(f.top-w.top+g.top)/b.y,bottom:(w.bottom-f.bottom+g.bottom)/b.y,left:(f.left-w.left+g.left)/b.x,right:(w.right-f.right+g.right)/b.x}}const By=new Set(["left","top"]);function Wy(){return"undefined"!=typeof window}function Hy(e){return Vy(e)?(e.nodeName||"").toLowerCase():"#document"}function Gy(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function qy(e){var t;return null==(t=(Vy(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Vy(e){return!!Wy()&&(e instanceof Node||e instanceof Gy(e).Node)}function Ky(e){return!!Wy()&&(e instanceof Element||e instanceof Gy(e).Element)}function Zy(e){return!!Wy()&&(e instanceof HTMLElement||e instanceof Gy(e).HTMLElement)}function Xy(e){return!(!Wy()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Gy(e).ShadowRoot)}const Yy=new Set(["inline","contents"]);function Qy(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=db(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Yy.has(i)}const Jy=new Set(["table","td","th"]);function eb(e){return Jy.has(Hy(e))}const tb=[":popover-open",":modal"];function nb(e){return tb.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const ob=["transform","translate","scale","rotate","perspective"],ib=["transform","translate","scale","rotate","perspective","filter"],rb=["paint","layout","strict","content"];function ab(e){const t=sb(),n=Ky(e)?db(e):e;return ob.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||ib.some(e=>(n.willChange||"").includes(e))||rb.some(e=>(n.contain||"").includes(e))}function sb(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const lb=new Set(["html","body","#document"]);function cb(e){return lb.has(Hy(e))}function db(e){return Gy(e).getComputedStyle(e)}function ub(e){return Ky(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hb(e){if("html"===Hy(e))return e;const t=e.assignedSlot||e.parentNode||Xy(e)&&e.host||qy(e);return Xy(t)?t.host:t}function mb(e){const t=hb(e);return cb(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zy(t)&&Qy(t)?t:mb(t)}function gb(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=mb(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),a=Gy(i);if(r){const e=pb(a);return t.concat(a,a.visualViewport||[],Qy(i)?i:[],e&&n?gb(e):[])}return t.concat(i,gb(i,[],n))}function pb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fb(e){const t=db(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=Zy(e),r=i?e.offsetWidth:n,a=i?e.offsetHeight:o,s=vy(n)!==r||vy(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function vb(e){return Ky(e)?e:e.contextElement}function yb(e){const t=vb(e);if(!Zy(t))return by(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=fb(t);let a=(r?vy(n.width):n.width)/o,s=(r?vy(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const bb=by(0);function wb(e){const t=Gy(e);return sb()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bb}function xb(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=vb(e);let a=by(1);t&&(o?Ky(o)&&(a=yb(o)):a=yb(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Gy(e))&&t}(r,n,o)?wb(r):by(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=Gy(r),t=o&&Ky(o)?Gy(o):o;let n=e,i=pb(n);for(;i&&o&&t!==n;){const e=yb(i),t=i.getBoundingClientRect(),o=db(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=Gy(i),i=pb(n)}}return $y({width:d,height:u,x:l,y:c})}function kb(e,t){const n=ub(e).scrollLeft;return t?t.left+n:xb(qy(e)).left+n}function Cb(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-kb(e,n),y:n.top+t.scrollTop}}const Ib=new Set(["absolute","fixed"]);function Sb(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Gy(e),o=qy(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=sb();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}const c=kb(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=qy(e),n=ub(e),o=e.ownerDocument.body,i=fy(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=fy(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+kb(e);const s=-n.scrollTop;return"rtl"===db(o).direction&&(a+=fy(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(qy(e));else if(Ky(t))o=function(e,t){const n=xb(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=Zy(e)?yb(e):by(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=wb(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return $y(o)}function Ab(e,t){const n=hb(e);return!(n===t||!Ky(n)||cb(n))&&("fixed"===db(n).position||Ab(n,t))}function Mb(e,t,n){const o=Zy(t),i=qy(t),r="fixed"===n,a=xb(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=by(0);function c(){l.x=kb(i)}if(o||!o&&!r)if(("body"!==Hy(t)||Qy(i))&&(s=ub(t)),o){const e=xb(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?by(0):Cb(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 Db(e){return"static"===db(e).position}function Pb(e,t){if(!Zy(e)||"fixed"===db(e).position)return null;if(t)return t(e);let n=e.offsetParent;return qy(e)===n&&(n=n.ownerDocument.body),n}function Tb(e,t){const n=Gy(e);if(nb(e))return n;if(!Zy(e)){let t=hb(e);for(;t&&!cb(t);){if(Ky(t)&&!Db(t))return t;t=hb(t)}return n}let o=Pb(e,t);for(;o&&eb(o)&&Db(o);)o=Pb(o,t);return o&&cb(o)&&Db(o)&&!ab(o)?n:o||function(e){let t=hb(e);for(;Zy(t)&&!cb(t);){if(ab(t))return t;if(nb(t))return null;t=hb(t)}return null}(e)||n}const Rb={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,a=qy(o),s=!!t&&nb(t.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=by(1);const d=by(0),u=Zy(o);if((u||!u&&!r)&&(("body"!==Hy(o)||Qy(a))&&(l=ub(o)),Zy(o))){const e=xb(o);c=yb(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const h=!a||u||r?by(0):Cb(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:qy,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?nb(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=gb(e,[],!1).filter(e=>Ky(e)&&"body"!==Hy(e)),i=null;const r="fixed"===db(e).position;let a=r?hb(e):e;for(;Ky(a)&&!cb(a);){const t=db(a),n=ab(a);n||"fixed"!==t.position||(i=null),(r?!n&&!i:!n&&"static"===t.position&&i&&Ib.has(i.position)||Qy(a)&&!n&&Ab(e,a))?o=o.filter(e=>e!==a):i=t,a=hb(a)}return t.set(e,o),o}(t,this._c):[].concat(n),o],a=r[0],s=r.reduce((e,n)=>{const o=Sb(t,n,i);return e.top=fy(o.top,e.top),e.right=py(o.right,e.right),e.bottom=py(o.bottom,e.bottom),e.left=fy(o.left,e.left),e},Sb(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Tb,getElementRects:async function(e){const t=this.getOffsetParent||Tb,n=this.getDimensions,o=await n(e.floating);return{reference:Mb(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}=fb(e);return{width:t,height:n}},getScale:yb,isElement:Ky,isRTL:function(e){return"rtl"===db(e).direction}};function zb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eb(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=vb(e),d=i||r?[...c?gb(c):[],...gb(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=qy(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:-yy(u)+"px "+-yy(i.clientWidth-(d+h))+"px "+-yy(i.clientHeight-(u+m))+"px "+-yy(d)+"px",threshold:fy(0,py(1,l))||1};let p=!0;function f(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||zb(c,e.getBoundingClientRect())||a(),p=!1}try{o=new IntersectionObserver(f,{...g,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(f,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?xb(e):null;return l&&function t(){const o=xb(e);p&&!zb(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 Ob=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=Iy(n),s=Sy(n),l="y"===Py(n),c=By.has(a)?-1:1,d=r&&l?-1:1,u=Cy(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}}}}},Nb=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i,platform:r}=t,{mainAxis:a=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Cy(e,t),d={x:n,y:o},u=await r.detectOverflow(t,c),h=Py(Iy(i)),m=Ay(h);let g=d[m],p=d[h];if(a){const e="y"===m?"bottom":"right";g=ky(g+u["y"===m?"top":"left"],g,g-u[e])}if(s){const e="y"===h?"bottom":"right";p=ky(p+u["y"===h?"top":"left"],p,p-u[e])}const f=l.fn({...t,[m]:g,[h]:p});return{...f,data:{x:f.x-n,y:f.y-o,enabled:{[m]:a,[h]:s}}}}}},Lb=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,...f}=Cy(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const v=Iy(i),y=Py(s),b=Iy(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=h||(b||!p?[_y(s)]:function(e){const t=_y(e);return[Ry(e),t,Ry(t)]}(s)),k="none"!==g;!h&&k&&x.push(...Ly(s,p,g,w));const C=[s,...x],I=await l.detectOverflow(t,f),S=[];let A=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&S.push(I[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=Sy(e),i=Ty(e),r=My(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=_y(a)),[a,_y(a)]}(i,a,w);S.push(I[e[0]],I[e[1]])}if(A=[...A,{placement:i,overflows:S}],!S.every(e=>e<=0)){var M,D;const e=((null==(M=r.flip)?void 0:M.index)||0)+1,t=C[e];if(t){if(!("alignment"===u&&y!==Py(t))||A.every(e=>Py(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:A},reset:{placement:t}}}let n=null==(D=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:D.placement;if(!n)switch(m){case"bestFit":{var P;const e=null==(P=A.filter(e=>{if(k){const t=Py(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:P[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},_b=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}=Cy(e,t)||{};if(null==c)return{};const u=Fy(d),h={x:n,y:o},m=Ty(i),g=My(m),p=await a.getDimensions(c),f="y"===m,v=f?"top":"left",y=f?"bottom":"right",b=f?"clientHeight":"clientWidth",w=r.reference[g]+r.reference[m]-h[m]-r.floating[g],x=h[m]-r.reference[m],k=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let C=k?k[b]:0;C&&await(null==a.isElement?void 0:a.isElement(k))||(C=s.floating[b]||r.floating[g]);const I=w/2-x/2,S=C/2-p[g]/2-1,A=py(u[v],S),M=py(u[y],S),D=A,P=C-p[g]-M,T=C/2-p[g]/2+I,R=ky(D,T,P),z=!l.arrow&&null!=Sy(i)&&T!==R&&r.reference[g]/2-(T<D?A:M)-p[g]/2<0,E=z?T<D?T-D:T-P:0;return{[m]:h[m]+E,data:{[m]:R,centerOffset:T-R-E,...z&&{alignmentOffset:E}},reset:z}}}),Fb=(e,t,n)=>{const o=new Map,i={platform:Rb,...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}=jy(c,o,l),h=o,m={},g=0;for(let n=0;n<s.length;n++){var p;const{name:r,fn:f}=s[n],{x:v,y:y,data:b,reset:w}=await f({x:d,y:u,initialPlacement:o,placement:h,strategy:i,middlewareData:m,rects:c,platform:{...a,detectOverflow:null!=(p=a.detectOverflow)?p:Uy},elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=y?y:u,m={...m,[r]:{...m[r],...b}},w&&g<=50&&(g++,"object"==typeof w&&(w.placement&&(h=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:i}):w.rects),({x:d,y:u}=jy(c,h,l))),n=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:m}})(e,t,{...i,platform:r})};var $b=function(){function e(){return i(this,e),o(this,e,arguments)}return c(e,W),r(e,[{key:"render",value:function(){return this.props.children}}])}();function jb(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,l=e.delay,c=void 0===l?200:l,d=e.style,u=void 0===d?"dark":d,h=e.trigger,m=void 0===h?"hover":h,g=Pe(null),p=Pe(null),f=Pe(null),y=v(Se(!1),2),b=y[0],w=y[1],x=Pe(null);return Me(function(){var e;if(null!==(e=g.current)&&void 0!==e&&e.base&&p.current)return Eb(g.current.base,p.current,function(){Fb(g.current.base,p.current,{placement:i,middleware:[Ob(8),Lb(),Nb({padding:8}),_b({element:f.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:{},l=a.x,c=a.y,d={top:"bottom",bottom:"top",left:"right",right:"left"}[i.split("-")[0]];Object.assign(f.current.style,s({left:null!=l?"".concat(l,"px"):"",top:null!=c?"".concat(c,"px"):"",right:"",bottom:""},d,"-4px"))})})},[i,b]),Me(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]),j(B,null,j("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,j("div",{ref:f,className:"absolute h-2 w-2 rotate-45 bg-inherit ".concat("light"===u?"border-border-subtle border":""," ")})),j($b,{ref:g},t))}function Ub(e){var t=e.commandId,n=e.documentId,o=e.variant,i=void 0===o?"icon":o,r=e.itemId,a=e.className,s=La(t,n),l=ua(n,r||t);if(!s||!s.visible)return null;var c=s.iconProps||{};return j(jb,{content:s.label,position:"bottom",delay:500,trigger:s.active||s.disabled?"none":"hover"},j(gy,{elementRef:l,onClick:function(){s.disabled||s.execute()},active:s.active,disabled:s.disabled,className:a||"p-1","aria-label":s.label},"text"===i?j("span",{className:"text-sm"},s.label):"icon-text"===i?j("span",{className:"flex items-center whitespace-nowrap"},s.icon&&j(hy,{icon:s.icon,className:"mr-1.5 h-5 w-5 flex-shrink-0",primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}),j("span",null,s.label)):"tab"===i?j("span",{className:"px-3 py-1"},s.label):s.icon?j(hy,{icon:s.icon,className:Zv("h-5 w-5",c.className),primaryColor:c.primaryColor,secondaryColor:c.secondaryColor}):j("span",null,s.label)))}function Bb(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 j("div",h({className:Zv("flex items-center gap-2",s,a?"bg-bg-surface-alt":"",r)},Kr(t)),t.items.map(function(e){return j(Wb,{key:e.id,item:e,documentId:n})}))}function Wb(e){var t=e.item,n=e.documentId;switch(t.type){case"command-button":return j(Hb,{item:t,documentId:n});case"tab-group":return j(Gb,{item:t,documentId:n});case"divider":return j(Kb,{item:t});case"spacer":return j(Zb,{item:t});case"group":return j(Xb,{item:t,documentId:n});case"custom":return j(Yb,{item:t,documentId:n});default:return console.warn("Unknown toolbar item type:",t),null}}function Hb(e){var t=e.item,n=e.documentId;return j("div",h({},Kr(t)),j(Ub,{commandId:t.commandId,documentId:n,itemId:t.id,variant:t.variant}))}function Gb(e){var t=e.item,n=e.documentId;return j("div",h(h({className:"flex items-center gap-2"},Kr(t)),{},{role:"tablist"}),t.tabs.map(function(e){return j(qb,{key:e.id,tab:e,documentId:n})}))}function qb(e){var t=e.tab,n=e.documentId,o=La(t.commandId,n),i=ua(n,t.id);if(!o||!o.visible)return null;return j("div",h({},Kr(t)),j(Yv,{anchorRef:i,active:o.active,onClick:function(){o.disabled||o.execute()},disabled:o.disabled},"text"===t.variant&&o.label,"icon"===t.variant&&o.icon&&j(Vb,{icon:o.icon,iconProps:o.iconProps}),"icon-text"===t.variant&&j(B,null,o.icon&&j(Vb,{icon:o.icon,iconProps:o.iconProps}),o.label)))}function Vb(e){var t=e.icon,n=e.iconProps;return j(hy,{icon:t,className:"h-5 w-5",primaryColor:null==n?void 0:n.primaryColor,secondaryColor:null==n?void 0:n.secondaryColor})}function Kb(e){var t=e.item;return j("div",h({},Kr(t)),j("div",{className:"vertical"===t.orientation?"bg-border-default h-6 w-px":"bg-border-default h-px w-6","aria-hidden":"true"}))}function Zb(e){var t=e.item;return j("div",h(h({className:t.flex?"flex-1":"w-4"},Kr(t)),{},{"aria-hidden":"true"}))}function Xb(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 j("div",h({className:Zv("flex items-center",o,i)},Kr(t)),t.items.map(function(e){return j(Wb,{key:e.id,item:e,documentId:n})}))}function Yb(e){var t=e.item,n=e.documentId,o=ga().renderCustomComponent;return j("div",h({},Kr(t)),o(t.componentId,n,t.props))}function Qb(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=sa().getContainer,a=Se(function(){var e=r();return!!e&&e.clientWidth<768}),s=v(a,2),l=s[0],c=s[1];Me(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=ga().renderCustomComponent,g=r();if(l&&g)return xh(j(Jb,{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),f=h?{width:h}:void 0;return j("div",{className:"".concat(p," border-border-default bg-bg-surface flex flex-col shadow-lg"),style:f,"data-sidebar-id":t.id},j("div",{className:"min-h-0 flex-1"},"tabs"===u.type&&j(ew,{content:u,documentId:n,renderCustomComponent:m}),"component"===u.type&&j(B,null,m(u.componentId,n,{}))))}function Jb(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.renderCustomComponent,a=e.content,s=e.rootElement,l=v(Se("closed"),2),c=l[0],d=l[1],u=v(Se(!1),2),h=u[0],m=u[1],g=v(Se(0),2),p=g[0],f=g[1],y=v(Se(!1),2),b=y[0],w=y[1],x=Pe(null),k=Pe({y:0,height:0,time:0,state:"half"}),C=Pe({y:0,time:0});Me(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 I=function(e){switch(e){case"closed":return 0;case"half":return 50;case"full":return 100}},S=Re(function(e){if(x.current){var t,n=s.clientHeight,o=x.current.offsetHeight/n*100;t=o>=75?"full":o<=25?"closed":"half",k.current={y:e,height:o,time:Date.now(),state:t},C.current={y:e,time:Date.now()},f(0),t!==c&&d(t),m(!0)}},[s,c]),A=Re(function(e){if(h){var t=s.clientHeight,n=(k.current.y-e)/t*100,o=Math.max(0,Math.min(100,k.current.height+n));C.current={y:e,time:Date.now()};var i=I(k.current.state);f(o-i)}},[h,s]),M=Re(function(){if(h){if(Math.abs(k.current.y-C.current.y)<5)return m(!1),void f(0);var e=I(k.current.state)+p,t=Date.now()-C.current.time,n=C.current.y-k.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),f(0),i()):(m(!1),f(0),d(o))}},[h,p,i]),D=Re(function(e){S(e.touches[0].clientY)},[S]),P=Re(function(e){h&&(e.cancelable&&e.preventDefault(),A(e.touches[0].clientY))},[h,A]),T=Re(function(){M()},[M]),R=Re(function(e){e.preventDefault(),S(e.clientY)},[S]);if(Me(function(){if(h){var e=function(e){A(e.clientY)},t=function(){M()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[h,A,M]),!b)return null;var z=I(h?k.current.state:c),E=h?Math.max(0,Math.min(100,z+p)):z,O=.3*Math.min(E/50,1);return j(B,null,j("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(0===E?"pointer-events-none":""),style:{opacity:O},onClick:i}),j("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(E,"%")},"data-sidebar-id":t.id},j("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:D,onTouchMove:P,onTouchEnd:T,onMouseDown:R},j("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),j("div",{className:"min-h-0 flex-1 overflow-hidden"},"tabs"===a.type&&j(ew,{content:a,documentId:n,renderCustomComponent:r}),"component"===a.type&&j(B,null,r(a.componentId,n,{})))))}function ew(e){var t,n=e.content,o=e.documentId,i=e.renderCustomComponent,r=v(Se((null===(t=n.tabs[0])||void 0===t?void 0:t.id)||""),2),a=r[0],s=r[1];return j("div",{className:"flex h-full flex-1 flex-col"},j("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 j("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&&j(hy,{icon:e.icon,className:"h-5 w-5"}))})),j("div",{className:"min-h-0 flex-1 overflow-auto"},n.tabs.filter(function(e){return e.id===a}).map(function(e){return j(B,{key:e.id},i(e.componentId,o,{}))})))}function tw(e){var t=e.schema,n=e.documentId,o=e.anchorEl,i=e.onClose,r=sa().getContainer,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:768,n=v(Se(function(){var n=e();return!!n&&n.clientWidth<t}),2),o=n[0],i=n[1];return Me(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}=ia();return(null==e?void 0:e.getSchema())??null})(),c=v(Se([{menuId:t.id,schema:t,title:void 0}]),2),d=c[0],u=c[1];Me(function(){u([{menuId:t.id,schema:t,title:void 0}])},[t]);var h=d[d.length-1],m=Re(function(e,t){if(l){var n=l.menus[e];n?u(function(o){return[].concat(y(o),[{menuId:e,schema:n,title:t}])}):console.warn("Submenu schema not found: ".concat(e))}},[l]),g=Re(function(){d.length>1&&u(function(e){return e.slice(0,-1)})},[d.length]);return h?a&&s?xh(j(nw,{currentMenu:h,menuStack:d,documentId:n,onClose:i,onNavigateBack:g,onNavigateToSubmenu:m,container:s}),s):j(ow,{currentMenu:h,documentId:n,anchorEl:o,onClose:i,onNavigateToSubmenu:m}):null}function nw(e){var t=e.currentMenu,n=e.menuStack,o=e.documentId,i=e.onClose,r=e.onNavigateBack,a=e.onNavigateToSubmenu,s=e.container,l=v(Se(!1),2),c=l[0],d=l[1],u=v(Se(!1),2),m=u[0],g=u[1],p=v(Se(0),2),f=p[0],y=p[1],b=Pe(null),w=Pe(null),x=Pe({isDragging:!1,startY:0,currentY:0,startTime:0,sheetHeight:0});Me(function(){d(!0),requestAnimationFrame(function(){requestAnimationFrame(function(){g(!0)})})},[]);var k=v(Se(null),2),C=k[0],I=k[1];Me(function(){if(w.current){var e=(n.length>1?60:0)+w.current.scrollHeight+24,t=.8*s.clientHeight;I(Math.min(e,t))}},[t,n.length,s]);var S=Re(function(){g(!1),setTimeout(function(){d(!1),i()},300)},[i]),A=Re(function(e){b.current&&(x.current={isDragging:!0,startY:e,currentY:e,startTime:Date.now(),sheetHeight:b.current.offsetHeight})},[]),M=Re(function(e){if(x.current.isDragging){var t=e-x.current.startY,n=Math.max(0,t);x.current.currentY=e,y(n)}},[]),D=Re(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)y(0);else{var a=n-t,s=a/i*100,l=Date.now()-o;s>30||(l>0?a/l:0)>.5?S():y(0)}}},[S]),P=Re(function(e){A(e.touches[0].clientY)},[A]),T=Re(function(e){x.current.isDragging&&e.cancelable&&e.preventDefault(),M(e.touches[0].clientY)},[M]),R=Re(function(){D()},[D]),z=Re(function(e){e.preventDefault(),A(e.clientY)},[A]);if(Me(function(){if(x.current.isDragging){var e=function(e){return M(e.clientY)},t=function(){return D()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[M,D]),Me(function(){var e=function(e){"Escape"===e.key&&S()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[S]),!c)return null;var E=m?f:C||400;return j(B,null,j("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(m?"opacity-100":"opacity-0"),onClick:S}),j("div",h({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(E,"px)")}},Kr(t.schema)),j("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:P,onTouchMove:T,onTouchEnd:R,onMouseDown:z},j("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),n.length>1&&j("div",{className:"border-border-subtle flex items-center gap-3 border-b px-4 pb-3"},j("button",{onClick:r,className:"hover:bg-interactive-hover rounded-full p-1"},j(Jv,{className:"h-5 w-5"})),j("h3",{className:"text-fg-primary font-semibold"},t.title||"Menu")),j("div",{ref:w,className:"flex-1 overflow-y-auto py-2"},t.schema.items.map(function(e){return j(iw,{key:e.id,item:e,documentId:o,onClose:S,isMobile:!0,onNavigateToSubmenu:a})}))))}function ow(e){var t=e.currentMenu,n=e.documentId,o=e.anchorEl,i=e.onClose,r=e.onNavigateToSubmenu,a=Pe(null),s=v(Se(null),2),l=s[0],c=s[1];Me(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]),Me(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]),Me(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 j("div",h(h({ref:a},Kr(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 j(iw,{key:e.id,item:e,documentId:n,onClose:i,isMobile:!1,onNavigateToSubmenu:r})}))}function iw(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu;switch(t.type){case"command":return j(rw,{item:t,documentId:n,onClose:o,isMobile:i});case"submenu":return j(aw,{item:t,documentId:n,isMobile:i,onNavigateToSubmenu:r});case"divider":return j("div",h({},Kr(t)),j("hr",{className:"border-border-subtle my-2"}));case"section":return j(sw,{item:t,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r});default:return null}}function rw(e){var t,n,o=e.item,i=e.documentId,r=e.onClose,a=e.isMobile,s=La(o.commandId,i);if(!s||!s.visible)return null;var l,c,d=function(){s.disabled||(s.execute(),r())};return a?j("button",h(h({},Kr(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&&j(hy,{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}),j("span",{className:"flex-1"},s.label)):j("button",h(h({},Kr(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"}),j("div",{className:"flex items-center gap-2"},j("div",{className:"flex h-6 w-6 items-center justify-center"},s.icon&&j(hy,{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})),j("span",{className:"text-sm"},s.label)))}function aw(e){var t=e.item,n=e.documentId,o=e.isMobile,i=e.onNavigateToSubmenu,r=Ka(n).translate,a=t.labelKey?r(t.labelKey):t.label||"",s=function(){return i(t.menuId,a)};return o?j("button",h(h({},Kr(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"}),j("span",{className:"flex-1"},a),j(Qv,{className:"h-4 w-4"})):j("button",h(h({},Kr(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"}),j("span",{className:"text-sm"},a),j(Qv,{className:"h-6 w-6"}))}function sw(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu,a=Ka(n).translate,s=t.labelKey?a(t.labelKey):t.label||"";return j("div",h({},Kr(t)),j("div",{className:"text-fg-secondary px-4 py-3 text-xs font-medium uppercase"},s),t.items.map(function(e){return j(iw,{key:e.id,item:e,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r})}))}function lw(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,a=e.modalProps,s=t.content,l=ga().renderCustomComponent;return"component"!==s.type?(console.warn("SchemaModal only supports component content type, got: ".concat(s.type)),null):j(B,null,l(s.componentId,n,h({isOpen:o,onClose:i,onExited:r},a)))}function cw(e){var t=e.documentId;e.onClose;var n=Li(t),o=n.state,i=n.provides;return j("div",{className:"flex h-full flex-1 flex-col"},j("div",{className:"flex-1 overflow-hidden"},j(Dc,{documentId:t,style:{width:"100%",height:"100%"}},function(e){return j("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})}},j("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"}},j(Pc,{documentId:t,meta:e,style:{width:"100%",height:"100%"}})),j("div",{style:{height:e.labelHeight,display:"flex",alignItems:"center",justifyContent:"center",marginTop:"4px"}},j("span",{className:"text-fg-secondary text-xs"},e.pageIndex+1)))})))}function dw(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,n=v(Se(e),2),o=n[0],i=n[1];return Me(function(){var n=window.setTimeout(function(){return i(e)},t);return function(){return clearTimeout(n)}},[e,t]),o}var uw=function(e){var t=e.label,n=e.checked,o=e.onChange,i=e.disabled;return j("label",{className:"text-fg-secondary inline-flex select-none items-center gap-2 text-xs font-medium ".concat(i?"cursor-not-allowed opacity-50":"cursor-pointer")},j("input",{type:"checkbox",checked:n,disabled:i,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 disabled:cursor-not-allowed"}),j("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"},j("polyline",{points:"20 6 9 17 4 12"})),t)},hw=function(e){var t=e.hit,n=e.onClick,o=e.active,i=Pe(null);return Me(function(){o&&i.current&&i.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[o]),j("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")},j("span",null,t.context.truncatedLeft&&"… ",t.context.before,j("span",{className:"text-accent font-bold"},t.context.match),t.context.after,t.context.truncatedRight&&" …"))};function mw(e){var t=e.documentId;e.onClose;var n=(e=>{const{provides:t}=Ks(),[n,o]=Se(Us),i=Te(()=>null==t?void 0:t.forDocument(e),[t,e]);return Me(()=>{if(i)return o(i.getState()),i.onStateChange(e=>o(e));o(Us)},[i]),{state:n,provides:i??null}})(t),o=n.state,i=n.provides,r=Ni().provides,a=Ka(t).translate,s=Pe(null),l=v(Se(""),2),c=l[0],d=l[1];Me(function(){},[]),Me(function(){o.query&&!c&&d(o.query)},[o.query]),Me(function(){void 0!==o.activeResultIndex&&o.activeResultIndex>=0&&m(o.activeResultIndex)},[o.activeResultIndex]);var u=dw(c,300);Me(function(){u!==o.query&&(null==i||i.searchAllPages(u))},[u,i,o.query]);var h=function(e,t){t?null==i||i.setFlags([].concat(y(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 j("div",{className:"bg-bg-surface flex h-full flex-col"},j("div",{className:"p-4"},j("div",{className:"relative"},j("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2"},j(ty,{className:"text-fg-muted h-4 w-4"})),j("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-base focus:outline-none focus:ring-1"}),c&&j("div",{className:"absolute inset-y-0 right-0 flex cursor-pointer items-center pr-3",onClick:function(){d(""),s.current&&s.current.focus()}},j(ny,{className:"text-fg-muted hover:text-fg-secondary h-4 w-4"}))),j("div",{className:"mt-3 flex flex-col gap-2"},j(uw,{label:a("search.caseSensitive"),checked:o.flags.includes(nn.MatchCase),onChange:function(e){return h(nn.MatchCase,e)}}),j(uw,{label:a("search.wholeWord"),checked:o.flags.includes(nn.MatchWholeWord),onChange:function(e){return h(nn.MatchWholeWord,e)}})),j("hr",{className:"border-border-subtle mb-2 mt-5"}),o.active&&j("div",{className:"flex h-[32px] flex-row items-center justify-between"},j("div",{className:"text-fg-muted text-xs"},a("search.resultsFound",{params:{count:o.total}})),o.total>1&&j("div",{className:"flex flex-row"},j(gy,{onClick:function(){null==i||i.previousResult()}},j(Jv,{className:"h-4 w-4"})),j(gy,{onClick:function(){null==i||i.nextResult()}},j(Qv,{className:"h-4 w-4"}))))),j("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=v(e,2),n=t[0],r=t[1];return j("div",{key:n,className:"mt-2 first:mt-0"},j("div",{className:"bg-bg-surface/80 text-fg-muted py-2 text-xs backdrop-blur"},a("search.page",{params:{page:Number(n)+1}})),j("div",{className:"flex flex-col gap-2"},r.map(function(e){var t=e.hit,n=e.index;return j(hw,{key:n,hit:t,active:n===o.activeResultIndex,onClick:function(){null==i||i.goToResult(n)}})})))}),j("div",null)))}function gw(e){var t=e.documentId,n=Wo(gg.id).provides,o=Ni().provides,i=Ka(t).translate,r=Go(t),a=v(Se([]),2),s=a[0],l=a[1],c=v(Se(new Set),2),d=c[0],u=c[1],h=v(Se(!0),2),m=h[0],g=h[1];Me(function(){if(n&&null!=r&&r.document){g(!0);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)),g(!1)},function(){g(!1)}),function(){e.abort({code:sn.Cancelled,message:"Bookmark task cancelled"})}}},[n,null==r?void 0:r.document]);var p=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 j("div",{key:a,className:"select-none"},j("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){var t;if("action"===e.target.type){var n=e.target.action;if(n.type===Et.Goto||n.type===Et.RemoteGoto)t=n.destination;else if(n.type===Et.URI)return void window.open(n.uri,"_blank")}else"destination"===e.target.type&&(t=e.target.destination);if(t)if(t.zoom.mode===At.XYZ){var i,a=null==r||null===(i=r.document)||void 0===i?void 0:i.pages.find(function(e){return e.index===t.pageIndex});if(!a)return;o.scrollToPage({pageNumber:t.pageIndex+1,pageCoordinates:t.zoom.params?{x:t.zoom.params.x,y:a.size.height-t.zoom.params.y}:void 0,behavior:"smooth"})}else o.scrollToPage({pageNumber:t.pageIndex+1,behavior:"smooth"})}}(e)}},s&&j("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"},j(l?ey:Qv,{className:"h-3 w-3"})),!s&&j("div",{className:"w-4"}),j("span",{className:"text-fg-secondary text-sm"},e.title)),s&&l&&j("div",null,null===(n=e.children)||void 0===n?void 0:n.map(function(e,t){return p(e,t,i+1)})))};return null==r||!r.document||m?j("div",{className:"text-fg-secondary flex h-full flex-col gap-3 p-4 text-sm"},j("div",{className:"text-fg-primary font-medium"},i("outline.title")),j("p",null,i("outline.loading"))):0===s.length?j("div",{className:"flex h-full items-center justify-center p-6"},j("div",{className:"text-fg-muted text-center"},j("div",{className:"text-sm"},i("outline.noOutline")),j("div",{className:"mt-1 text-xs"},i("outline.noBookmarks")))):j("div",{className:"bg-bg-surface flex h-full flex-col"},j("div",{className:"flex-1 overflow-y-auto"},j("div",{className:"outline-tree"},s.map(function(e,t){return p(e,t)}))))}function pw(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 j("div",{className:"flex flex-col items-center justify-center gap-3 ".concat(void 0===i?"":i)},j("div",{className:"relative"},j("div",{className:"".concat(r[n]," border-border-default animate-spin rounded-full border-4")}),j("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&&j("p",{className:"".concat({sm:"text-sm",md:"text-base",lg:"text-lg"}[n]," text-fg-secondary animate-pulse font-medium")},o))}function fw(e){var t=e.size,n=void 0===t?"md":t,o=e.className,i=void 0===o?"":o;return j("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 vw,yw=function(e){var t=e.documentId,n=nm().provides,o=v(Se({show:!1,mode:null,isAnimating:!1}),2),i=o[0],r=o[1],a=Ka(t).translate;Me(function(){if(n)return n.onModeChange(function(e){var t=e.activeMode;if("marqueeZoom"===t||"marqueeCapture"===t){r({show:!0,mode:t,isAnimating:!0});var n=setTimeout(function(){r(function(e){return h(h({},e),{},{show:!1})})},3e3);return function(){return clearTimeout(n)}}r({show:!1,mode:null,isAnimating:!1})})},[n]);if(!i.show&&!i.isAnimating)return null;var s="marqueeZoom"===i.mode?a("zoom.dragTip"):a("capture.dragTip"),l="marqueeZoom"===i.mode?"rgba(33,150,243,0.8)":"rgba(76,175,80,0.8)";return j("div",{className:"hint-overlay ".concat(i.show?"hint-show":"hint-hide"),onAnimationEnd:function(){i.show||r(function(e){return h(h({},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"}},j("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"}},s),j("div",{className:"drag-demo",style:{position:"relative",width:"150px",height:"100px"}},j("div",{style:{position:"absolute",top:"20px",left:"20px",width:"110px",height:"60px",border:"2px dashed ".concat(l),borderRadius:"4px",opacity:.6}}),j("div",{className:"animated-rect",style:{position:"absolute",top:"20px",left:"20px",border:"2px solid ".concat(l),backgroundColor:"".concat(l.replace("0.8","0.15")),borderRadius:"4px"}}),j("div",{className:"cursor-demo",style:{position:"absolute",width:"20px",height:"20px"}},j("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},j("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)"}),j("path",{d:"M3 2L16 10L10 11.5L7.5 16L3 2Z",fill:"white",stroke:"black",strokeWidth:"1"}),j("path",{d:"M4 3.5L13.5 9.5L9.5 10.5L7.5 14L4 3.5Z",fill:"rgba(255,255,255,0.8)"})))),j("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 "))},bw=function(e){var t=e.placeholder,n=e.onSubmit,o=e.inputRef,i=e.isFocused,r=v(Se(""),2),a=r[0],s=r[1];return j("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(""))}},j("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-1 text-base transition-colors focus:border-transparent focus:outline-none focus:ring-2 ".concat(i?"border-accent focus:ring-accent":"border-border-default focus:ring-accent")}),j("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"},j("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},j("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"}))))},ww=["bg-red-500","bg-blue-500","bg-green-500","bg-yellow-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-teal-500"],xw=function(e){if(!e)return ww[0];var t=e.length>0?e.charCodeAt(0)%ww.length:0;return ww[t]},kw=function(e){var t=e.name,n=e.className,o=void 0===n?"":n;return j("div",{className:"flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium text-white ".concat(xw(t)," ").concat(o)},function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase().slice(0,2):"G"}(t))},Cw=function(e){var t,n,o=e.onEdit,i=e.onDelete,r=e.onClose,a=e.documentId,s=Pe(null),l=Ka(a).translate;Me(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 j("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"},j("div",{className:"py-1"},j("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")),j("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"))))},Iw=function(e){var t=e.initialText,n=e.onSave,o=e.onCancel,i=e.autoFocus,r=void 0!==i&&i,a=e.documentId,s=v(Se(t),2),l=s[0],c=s[1],d=Pe(null),u=Ka(a).translate;Me(function(){r&&d.current&&(d.current.focus(),d.current.setSelectionRange(l.length,l.length))},[r,l.length]);return j("div",{className:"flex-1 space-y-2"},j("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-base focus:outline-none focus:ring-1",rows:3}),j("div",{className:"flex flex-wrap gap-2"},j("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")),j("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"))))},Sw=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)"}},Aw=function(e){var t=e.annotation,n=e.onSave,o=e.onDelete,i=e.isReply,r=void 0!==i&&i,a=e.documentId,s=e.isReadOnly,l=void 0!==s&&s,c=v(Se(!1),2),d=c[0],u=c[1],h=v(Se(!1),2),m=h[0],g=h[1],p=t.author||"Guest";return m?j("div",{className:"flex w-full items-start space-x-3",onClick:function(e){return e.stopPropagation()}},r&&j(kw,{name:p,className:"h-8 w-8"}),j(Iw,{initialText:t.contents||"",onSave:function(e){n(e),g(!1)},onCancel:function(){g(!1)},autoFocus:!0,documentId:a})):j("div",{className:"flex items-start space-x-3"},r&&j(kw,{name:p,className:"h-8 w-8"}),j("div",{className:"min-w-0 flex-1"},r&&j("div",{className:"flex items-center justify-between"},j("div",{className:"leading-none"},j("h5",{className:"text-fg-primary text-sm font-medium"},p),j("span",{className:"text-fg-muted text-xs"},Sw(t.modified||t.created))),!l&&j("div",{className:"relative"},j("button",{onClick:function(e){e.stopPropagation(),u(!0)},className:"text-fg-muted hover:bg-interactive-hover rounded-md p-1"},j("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},j("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"}))),d&&j(Cw,{onEdit:function(){return g(!0)},onDelete:o,onClose:function(){return u(!1)},documentId:a}))),j("p",{className:"text-fg-primary mt-2 text-sm"},t.contents)))},Mw=(s(s(s(s(s(s(s(s(s(s(vw={},_t.TEXT,{label:"Comment",labelKey:"annotation.comment",icon:"message",iconProps:function(e){return{primaryColor:e.strokeColor||e.color||"#6b7280"}}}),_t.HIGHLIGHT,{label:"Highlight",labelKey:"annotation.highlight",icon:"highlight",iconProps:function(e){return{primaryColor:e.strokeColor||"#ffff00"}}}),_t.CIRCLE,{label:"Circle",labelKey:"annotation.circle",icon:"circle",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),_t.SQUARE,{label:"Square",labelKey:"annotation.square",icon:"square",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),_t.LINE,{label:"Line",labelKey:"annotation.line",icon:"line",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),_t.UNDERLINE,{label:"Underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),_t.SQUIGGLY,{label:"Squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),_t.STRIKEOUT,{label:"Strikethrough",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),_t.INK,{label:"Ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),_t.FREETEXT,{label:"Text",labelKey:"annotation.freeText",icon:"freeText",iconProps:function(e){return{primaryColor:e.fontColor||"#000000"}}}),s(s(s(s(s(vw,_t.POLYGON,{label:"Polygon",labelKey:"annotation.polygon",icon:"polygon",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),_t.POLYLINE,{label:"Polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000"}}}),_t.STAMP,{label:"Stamp",labelKey:"annotation.stamp",icon:"deviceFloppy",iconProps:function(){return{primaryColor:"#dc2626"}}}),_t.CARET,{label:"Caret",labelKey:"annotation.caret",icon:"insertText",iconProps:function(e){return{primaryColor:e.strokeColor||"#E44234"}}}),_t.REDACT,{label:"Redact",labelKey:"annotation.redact",icon:"redact",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color||"#000000"}}})),Dw=function(e){return ud(e)?Mw[e.object.type]:null},Pw=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=v(Se(!1),2),l=s[0],c=s[1],d=Ka(a).translate,u=t.split(" ");return u.length>o?j("div",{className:r},l?t:u.slice(0,o).join(" ")+"..."," ",j("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"))):j("div",{className:r},t)},Tw=function(e){var t=e.annotation,n=e.config,o=e.className,i=void 0===o?"":o,r=e.title,a=n.iconProps(t.object);return j("div",{className:"bg-bg-surface-alt flex items-center justify-center rounded-full ".concat(i),title:r},j(hy,h({icon:n.icon},a)))},Rw=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=e.isReadOnly,d=void 0!==c&&c,u=n.annotation,h=n.replies,m=n.groupMembers,g=v(Se(!1),2),p=g[0],f=g[1],y=v(Se(!1),2),b=y[0],w=y[1],x=v(Se(!1),2),k=x[0],C=x[1],I=Ka(l).translate,S=null!=m&&m.length>0,A=Dw(u),M=!!u.object.contents,D=h.length>0,P=!M&&!D,T=Pe(null),R=Pe(!1),z=u.object.author||"Guest";if(Me(function(){var e;o&&!R.current&&(null===(e=T.current)||void 0===e||e.focus({preventScroll:!0}));R.current=o},[o]),!A)return null;return j("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")},j("div",{className:"p-4"},j("div",{className:"flex items-start space-x-3"},j(Tw,{annotation:u,config:A,title:I(A.labelKey,{fallback:A.label}),className:"h-8 w-8"}),j("div",{className:"min-w-0 flex-1"},j("div",{className:"flex items-center justify-between"},j("div",{className:"leading-none"},j("h4",{className:"text-fg-primary text-sm font-medium"},z),j("span",{className:"text-fg-disabled text-xs"},Sw(u.object.modified||u.object.created))),!d&&j("div",{className:"relative"},j("button",{onClick:function(e){e.stopPropagation(),f(!0)},className:"text-fg-disabled hover:bg-interactive-hover hover:text-fg-secondary rounded-md p-1"},j("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},j("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"}))),p&&j(Cw,{onEdit:function(){return w(!0)},onDelete:function(){return a(u)},onClose:function(){return f(!1)},documentId:l}))),(null===(t=u.object.custom)||void 0===t?void 0:t.text)&&j(Pw,{text:u.object.custom.text,maxWords:14,className:"text-fg-muted mt-2 text-sm",documentId:l}),b?j("div",{className:"mt-2"},j(Iw,{initialText:u.object.contents||"",onSave:function(e){r(u.object.id,e),w(!1)},onCancel:function(){w(!1)},autoFocus:!0,documentId:l})):M?j("p",{className:"text-fg-primary mt-2 text-sm"},u.object.contents):null)),D&&j("div",{className:"border-border-subtle mt-4 space-y-4 border-t pt-4"},h.map(function(e){return j(Aw,{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,isReadOnly:d})})),S&&j("div",{className:"border-border-subtle mt-4 border-t pt-3"},j("button",{onClick:function(e){e.stopPropagation(),C(function(e){return!e})},className:"text-accent hover:text-accent-hover flex w-full items-center justify-center gap-1 text-sm font-medium"},k?I("comments.closeAllAnnotations",{fallback:"Close All Annotations"}):I("comments.showAllAnnotations",{fallback:"Show All Annotations"}),j("svg",{className:"h-4 w-4 transition-transform ".concat(k?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2},j("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))),k&&j("div",{className:"mt-3 space-y-3"},m.map(function(e){var t,n=Dw(e);if(!n)return null;var o=e.object.author||"Guest";return j("div",{key:e.object.id,className:"flex items-start gap-2"},j(Tw,{annotation:e,config:n,title:I(n.labelKey,{fallback:n.label}),className:"h-6 w-6"}),j("div",{className:"min-w-0 flex-1"},j("div",{className:"leading-none"},j("span",{className:"text-fg-primary text-sm font-medium"},o),j("span",{className:"text-fg-disabled ml-2 text-xs"},Sw(e.object.modified||e.object.created)," (".concat(I("comments.page",{params:{page:e.object.pageIndex+1}}),")"))),(null===(t=e.object.custom)||void 0===t?void 0:t.text)&&j(Pw,{text:e.object.custom.text,maxWords:14,className:"text-fg-muted mt-1 text-sm",documentId:l}),e.object.contents&&j("p",{className:"text-fg-primary mt-1 text-sm"},e.object.contents)))}))),!b&&!d&&j(bw,{inputRef:T,isFocused:o,placeholder:I(P?"comments.addComment":"comments.addReply"),onSubmit:function(e){P?r(u.object.id,e):s(u.object.id,e)}})))},zw=function(e){var t=e.documentId,n=Ka(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(hy,{icon:"comment",className:"h-18 w-18 text-fg-muted"}),j("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("comments.emptyState")))},Ew=function(e){var t=e.documentId,n=fm().provides,o=vm(t).state,i=Ni().provides,r=Ka(t).translate,s=Xo(t).canModifyAnnotations,l=Pe({}),c=Pe(null),d=!s,u=vd(o),h=(e=>{const t={};for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&dd(n)){const e=n.object.inReplyToId;e&&(t[e]||(t[e]=[])).push(n)}}const n={},o=new Set;for(const t of Object.values(e.pages))for(const i of t){const t=e.byUid[i];if(t&&t.object.inReplyToId&&t.object.replyType===Ut.Group&&t.object.type!==_t.LINK&&ud(t)){const e=t.object.inReplyToId;(n[e]||(n[e]=[])).push(t),o.add(t.object.id)}}const i={};for(const[r,a]of Object.entries(e.pages)){const s=Number(r),l=[];for(const i of a){const r=e.byUid[i];if(!r||!ud(r))continue;if(o.has(r.object.id))continue;const a=n[r.object.id];l.push({page:s,annotation:r,replies:t[r.object.id]??[],...a&&a.length>0?{groupMembers:a}:{}})}l.length>0&&(i[s]=l)}return i})(o),m=new Set(u.map(function(e){var t;return null!==(t=xd(o,e.object.id))&&void 0!==t?t:e.object.id}));Me(function(){var e=m.values().next().value;if(e&&c.current){var t=l.current[e];if(t){var n=c.current,o=n.getBoundingClientRect(),i=t.getBoundingClientRect(),r=i.top-o.top+n.scrollTop-n.clientHeight/2+i.height/2;n.scrollTo({top:r,behavior:"smooth"})}}},[o.selectedUids]);var g=function(e,t){var o=y(e);o&&(null==n||n.updateAnnotation(o.object.pageIndex,e,{contents:t,modified:new Date}))},p=function(e){null==n||n.deleteAnnotation(e.object.pageIndex,e.object.id)},f=function(e,t){var o=y(e);o&&(null==n||n.createAnnotation(o.object.pageIndex,{id:$n(),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:_t.TEXT,contents:t,inReplyToId:o.object.id,flags:["noRotate","noZoom","print"],icon:$t.Comment}))},v=Object.keys(h).map(Number).sort(function(e,t){return e-t}),y=function(e){var t,n=a(v);try{for(n.s();!(t=n.n()).done;){var o,i=t.value,r=a(h[i]);try{for(r.s();!(o=r.n()).done;){var s=o.value;if(s.annotation.object.id===e)return s.annotation;var l=s.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===v.length?j(zw,{documentId:t}):j("div",{ref:c,className:"h-full overflow-y-auto"},j("div",{className:"space-y-6 p-3"},v.map(function(e){return j("div",{key:e,className:"space-y-3"},j("div",{className:"bg-bg-surface sticky top-0 z-10 px-1"},j("div",{className:"border-border-subtle border-b py-2"},j("h3",{className:"text-md text-fg-primary font-semibold"},r("comments.page",{params:{page:e+1}})),j("p",{className:"text-fg-muted text-sm"},1===h[e].length?r("comments.commentCount",{params:{count:1}}):r("comments.commentCountPlural",{params:{count:h[e].length}})))),j("div",{className:"space-y-3 px-1"},h[e].map(function(e){return j("div",{key:e.annotation.object.id,ref:function(t){t&&(l.current[e.annotation.object.id]=t)}},j(Rw,{entry:e,isSelected:m.has(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:g,onDelete:p,onReply:f,documentId:t,isReadOnly:d}))})))})))};function Ow(e){var t=e.documentId,n=(e=>{const{provides:t}=ls(),[n,o]=Se(os);return Me(()=>{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=v(Se(""),2),a=r[0],s=r[1];if(!i)return null;var l=Math.round(100*o.currentZoomLevel);Me(function(){s(l.toString())},[l]);return j("div",{className:"relative"},j("div",{className:"bg-interactive-hover flex items-center rounded"},j("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"},j("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())}}),j("span",{className:"text-sm"},"%")),j(Ub,{commandId:"zoom:toggle-menu",documentId:t,itemId:"zoom-menu-button"}),j(Ub,{commandId:"zoom:out",documentId:t}),j(Ub,{commandId:"zoom:in",documentId:t})))}var Nw=function(e){var t=e.documentId,n=Ka(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(hy,{icon:"palette",className:"h-18 w-18 text-fg-muted"}),j("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("annotation.selectAnnotation")))},Lw={color:{key:"color",type:"colorWithTransparent",labelKey:"annotation.fillColor"},strokeColor:{key:"strokeColor",type:"colorWithTransparent",labelKey:"annotation.strokeColor"},opacity:{key:"opacity",type:"opacity",labelKey:"annotation.opacity",min:.1,max:1,step:.05,debounce:!0},strokeWidth:{key:"strokeWidth",type:"slider",labelKey:"annotation.strokeWidth",min:1,max:30,step:1,unit:"px",debounce:!0},strokeStyle:{key:"strokeStyle",type:"strokeStyle",labelKey:"annotation.borderStyle"},strokeStyleWithCloudy:{key:"strokeStyle",type:"strokeStyle",labelKey:"annotation.borderStyle",showCloudy:!0},lineEndings:{key:"lineEndings",type:"lineEndings",labelKey:"annotation.lineEndings"},fontFamily:{key:"fontFamily",type:"fontFamily",labelKey:"annotation.fontFamily"},fontSize:{key:"fontSize",type:"fontSize",labelKey:"annotation.fontSize"},fontColor:{key:"fontColor",type:"fontColor",labelKey:"annotation.fontColor"},textAlign:{key:"textAlign",type:"textAlign",labelKey:"annotation.textAlign"},verticalAlign:{key:"verticalAlign",type:"verticalAlign",labelKey:"annotation.verticalAlign"},blendMode:{key:"blendMode",type:"blendMode",labelKey:"annotation.blendMode"},rotation:{key:"rotation",type:"rotation",labelKey:"annotation.rotation",debounce:!0,editOnly:!0},overlayText:{key:"overlayText",type:"text",labelKey:"annotation.overlayText",placeholderKey:"annotation.overlayTextPlaceholder"}},_w={highlight:["strokeColor","opacity","blendMode"],underline:["strokeColor","opacity","blendMode"],strikeout:["strokeColor","opacity","blendMode"],squiggly:["strokeColor","opacity","blendMode"],ink:["strokeColor","opacity","strokeWidth","rotation"],inkHighlighter:["strokeColor","opacity","strokeWidth","blendMode","rotation"],circle:["color","opacity","strokeColor","strokeStyleWithCloudy","strokeWidth","rotation"],square:["color","opacity","strokeColor","strokeStyleWithCloudy","strokeWidth","rotation"],polygon:["strokeColor","opacity","strokeStyleWithCloudy","strokeWidth","color","rotation"],line:["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color","rotation"],lineArrow:["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color","rotation"],polyline:["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color","rotation"],textComment:["strokeColor","opacity"],insertText:["strokeColor","opacity"],replaceText:["strokeColor","opacity"],freeText:["fontFamily","fontSize","fontColor","textAlign","verticalAlign","opacity","color","rotation"],stamp:["rotation"],redact:["strokeColor","color","opacity"],formTextField:["fontSize","fontColor","strokeColor","strokeWidth","color"],formCheckbox:["strokeColor","color","strokeWidth"],formCombobox:["fontSize","fontColor","strokeColor","strokeWidth","color"],formListbox:["fontFamily","fontSize","fontColor","strokeColor","strokeWidth","color"],formRadioButton:["strokeColor","color","strokeWidth"]};var Fw=["position"],$w=function(){var e=v(Se(!1),2),t=e[0],n=e[1],o=Pe(null),i=Pe(null);return Me(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]),Me(function(){t&&i.current&&i.current.scrollIntoView({block:"center",inline:"start"})},[t]),{open:t,setOpen:n,rootRef:o,selectedItemRef:i}},jw=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=$w(),d=c.open,u=c.setOpen,h=c.rootRef,m=c.selectedItemRef;return j("div",{ref:h,class:"relative inline-block w-full"},j("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),j("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},j("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&&j("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 j("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))})))},Uw=function(e){var t=e.children,n=e.className;return j("label",{class:"text-fg-primary mb-2 block text-sm font-medium ".concat(void 0===n?"":n)},t)},Bw=function(e){var t=e.children,n=e.className;return j("span",{class:"text-fg-muted text-xs ".concat(void 0===n?"":n)},t)},Ww=function(e){var t=e.children,n=e.className;return j("section",{class:"mb-6 ".concat(void 0===n?"":n)},t)},Hw=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 j("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))}})},Gw=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 j("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)}})},qw=[{id:Ht.SOLID},{id:Ht.DASHED,dash:[6,2]},{id:Ht.DASHED,dash:[8,4]},{id:Ht.DASHED,dash:[3,3]},{id:Ht.DASHED,dash:[1,2]},{id:Ht.DASHED,dash:[4,2,1,2]},{id:Ht.DASHED,dash:[8,4,1,4]},{id:Ht.SOLID,cloudyIntensity:1},{id:Ht.SOLID,cloudyIntensity:2}],Vw=function(e){var t;if(e.cloudyIntensity){for(var n=1===e.cloudyIntensity?3:5,o=Math.ceil(80/(2*n)),i=80/o,r=n+1,a=2*n+2,s=["M 0 ".concat(r)],l=0;l<o;l++)s.push("A ".concat(n," ").concat(n," 0 0 1 ").concat(i*(l+1)," ").concat(r));return j("svg",{width:"80",height:a,viewBox:"0 0 80 ".concat(a)},j("path",{d:s.join(" "),fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round","stroke-linecap":"round"}))}return j("svg",{width:"80",height:"8",viewBox:"0 0 80 8"},j("line",{x1:"0",y1:"4",x2:"80",y2:"4",style:{strokeDasharray:null===(t=e.dash)||void 0===t?void 0:t.join(" "),stroke:"currentColor",strokeWidth:"2"}}))};function Kw(e){var t;return e.cloudyIntensity?"cloudy-".concat(e.cloudyIntensity):e.id+((null===(t=e.dash)||void 0===t?void 0:t.join("-"))||"")}var Zw,Xw=function(e){var t=e.value,n=e.onChange,o=e.showCloudy?qw:qw.filter(function(e){return!e.cloudyIntensity});return j(jw,{value:t,onChange:n,options:o,getOptionKey:Kw,renderValue:function(e){return Vw(e)},renderOption:function(e){return j("div",{class:"px-1 py-2"},Vw(e))}})},Yw=[jt.None,jt.Square,jt.Circle,jt.Diamond,jt.OpenArrow,jt.ClosedArrow,jt.ROpenArrow,jt.RClosedArrow,jt.Butt,jt.Slash],Qw=function(e){var t,n=e.ending,o=e.position,i=s(s(s(s(s(s(s(s(s({},jt.Square,j("path",{d:"M68 -4 L76 -4 L76 4 L68 4 Z"})),jt.Circle,j("circle",{cx:"72",cy:"0",r:"4"})),jt.Diamond,j("path",{d:"M72 -5 L77 0 L72 5 L67 0 Z"})),jt.OpenArrow,j("path",{d:"M67 -5 L77 0 L67 5",fill:"none"})),jt.ClosedArrow,j("path",{d:"M67 -5 L77 0 L67 5 Z"})),jt.ROpenArrow,j("path",{d:"M77 -5 L67 0 L77 5",fill:"none"})),jt.RClosedArrow,j("path",{d:"M77 -5 L67 0 L77 5 Z"})),jt.Butt,j("path",{d:"M72 -5 L72 5",fill:"none"})),jt.Slash,j("path",{d:"M67 -5 L77 5",fill:"none"})),r=s(s(s(s(s(s(s(s(s({},jt.Square,68),jt.Circle,68),jt.Diamond,67),jt.OpenArrow,76),jt.ClosedArrow,67),jt.ROpenArrow,67),jt.RClosedArrow,67),jt.Butt,72),jt.Slash,72),a=i[n];return j("svg",{width:"80",height:"20",viewBox:"0 0 80 20",class:"text-fg-primary"},j("g",{transform:"start"===o?"rotate(180 40 10)":""},j("line",{x1:"4",y1:"10",x2:null!==(t=r[n])&&void 0!==t?t:77,y2:"10",stroke:"currentColor","stroke-width":"1.5"}),a&&j("g",{transform:"translate(0, 10)",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5"},a)))},Jw=function(e){var t=e.position,n=m(e,Fw);return j(jw,h(h({},n),{},{options:Yw,getOptionKey:function(e){return e},triggerClass:"px-3 py-1",renderValue:function(e){return j(Qw,{ending:e,position:t})},renderOption:function(e){return j("div",{class:"px-1 py-1"},j(Qw,{ending:e,position:t}))}}))},ex=function(e){return j(jw,h(h({},e),{},{options:Tn,getOptionKey:function(e){return e},triggerClass:"px-2 py-1 text-sm",renderValue:function(e){return j("span",null,Rn(e))},renderOption:function(e){return j("div",{class:"px-2 py-1"},Rn(e))}}))},tx=function(e){var t=e.value,n=e.onChange,o=(t%360+360)%360,i=function(e){n(((o+e)%360+360)%360)};return j("div",{class:"flex items-center gap-1"},j("button",{type:"button",title:"-90°",class:"border-border-default bg-bg-input text-fg-primary hover:bg-interactive-hover flex h-8 w-8 shrink-0 items-center justify-center rounded border",onClick:function(){return i(-90)}},j("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},j("path",{d:"M1 4v6h6"}),j("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"}))),j("div",{class:"relative flex-1"},j("input",{type:"number",min:"0",max:"359",class:"border-border-default bg-bg-input text-fg-primary h-8 w-full rounded border px-2 pr-6 text-center text-sm",value:o,onInput:function(e){var t=parseInt(e.target.value,10);Number.isFinite(t)&&n((t%360+360)%360)}}),j("span",{class:"text-fg-muted pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs"},"°")),j("button",{type:"button",title:"+90°",class:"border-border-default bg-bg-input text-fg-primary hover:bg-interactive-hover flex h-8 w-8 shrink-0 items-center justify-center rounded border",onClick:function(){return i(90)}},j("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},j("path",{d:"M23 4v6h-6"}),j("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))))},nx=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=$w(),a=r.open,s=r.setOpen,l=r.rootRef,c=r.selectedItemRef;return j("div",{ref:l,class:"relative w-full"},j("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)}}),j("button",{type:"button",class:"absolute inset-y-0 right-1 flex items-center",onClick:function(){return s(function(e){return!e})},tabIndex:-1},j("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},j("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&&j("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 j("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)})))};function ox(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 j("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)}function ix(e){switch(e.config.type){case"color":return Be(rx,h(h({},e),{},{allowTransparent:!1}));case"colorWithTransparent":return Be(rx,h(h({},e),{},{allowTransparent:!0}));case"opacity":return Be(ax,h({},e));case"slider":return Be(sx,h({},e));case"strokeStyle":return Be(lx,h({},e));case"lineEndings":return Be(cx,h({},e));case"fontFamily":return Be(dx,h({},e));case"fontSize":return Be(ux,h({},e));case"fontColor":return Be(hx,h({},e));case"textAlign":return Be(mx,h({},e));case"verticalAlign":return Be(gx,h({},e));case"blendMode":return Be(fx,h({},e));case"text":return Be(vx,h({},e));case"rotation":return Be(yx,h({},e));default:return null}}function rx(e){var t=e.config,n=e.value,o=e.onChange,i=e.colorPresets,r=e.translate,a=e.allowTransparent,s=v(Se(null!=n?n:"#000000"),2),l=s[0],c=s[1];Me(function(){return c(null!=n?n:"#000000")},[n]);var d=function(e){c(e),o(e)};return Be(Ww,{children:[Be(Uw,{className:"mb-3",children:r(t.labelKey)}),Be("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4",children:[i.map(function(e){return Be(Gw,{color:e,active:e.toLowerCase()===(null==l?void 0:l.toLowerCase()),onSelect:d},e)}),a&&Be(Gw,{color:"transparent",active:"transparent"===l,onSelect:d})]})]})}function ax(e){var t,n,o,i=e.config,r=e.value,a=e.onChange,s=e.translate,l=v(Se(null!=r?r:1),2),c=l[0],d=l[1];Me(function(){return d(null!=r?r:1)},[r]);var u=dw(c,300);return Me(function(){u!==r&&a(u)},[u]),Be(Ww,{children:[Be(Uw,{children:s(i.labelKey)}),Be(Hw,{value:c,min:null!==(t=i.min)&&void 0!==t?t:.1,max:null!==(n=i.max)&&void 0!==n?n:1,step:null!==(o=i.step)&&void 0!==o?o:.05,onChange:d}),Be(Bw,{children:[Math.round(100*c),"%"]})]})}function sx(e){var t,n,o,i,r,a=e.config,s=e.value,l=e.onChange,c=e.translate,d=v(Se(null!==(t=null!=s?s:a.min)&&void 0!==t?t:1),2),u=d[0],h=d[1];Me(function(){var e;return h(null!==(e=null!=s?s:a.min)&&void 0!==e?e:1)},[s]);var m=dw(u,300);return Me(function(){m!==s&&l(m)},[m]),Be(Ww,{children:[Be(Uw,{children:c(a.labelKey)}),Be(Hw,{value:u,min:null!==(n=a.min)&&void 0!==n?n:1,max:null!==(o=a.max)&&void 0!==o?o:30,step:null!==(i=a.step)&&void 0!==i?i:1,onChange:h}),Be(Bw,{children:[u,null!==(r=a.unit)&&void 0!==r?r:""]})]})}function lx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se("object"===w(n)&&null!==n?n:{id:null!=n?n:Ht.SOLID}),2),a=r[0],s=r[1];Me(function(){var e="object"===w(n)&&null!==n?n:{id:null!=n?n:Ht.SOLID};s(e)},[n]);return Be(Ww,{children:[Be(Uw,{className:"mb-3",children:i(t.labelKey)}),Be(Xw,{value:a,onChange:function(e){var t;s(e),o({strokeStyle:e.id,strokeDashArray:e.dash,cloudyBorderIntensity:null!==(t=e.cloudyIntensity)&&void 0!==t?t:0})},showCloudy:t.showCloudy})]})}function cx(e){e.config;var t=e.value,n=e.onChange,o=e.translate,i=null!=t?t:{start:jt.None,end:jt.None},r=v(Se(i.start),2),a=r[0],s=r[1],l=v(Se(i.end),2),c=l[0],d=l[1];Me(function(){s(i.start),d(i.end)},[t]);return Be(Ww,{children:Be("div",{class:"grid grid-cols-2 gap-4",children:[Be("div",{children:[Be(Uw,{className:"mb-3",children:o("annotation.lineStart")}),Be(Jw,{value:a,onChange:function(e){s(e),n({start:e,end:c})},position:"start"})]}),Be("div",{children:[Be(Uw,{className:"mb-3",children:o("annotation.lineEnd")}),Be(Jw,{value:c,onChange:function(e){d(e),n({start:a,end:e})},position:"end"})]})]})})}function dx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=null!=n?n:Dt.Helvetica,a=Sn(r),s=An(r),l=Mn(r),c=v(Se(a),2),d=c[0],u=c[1],h=v(Se(s),2),m=h[0],g=h[1],p=v(Se(l),2),f=p[0],y=p[1];Me(function(){var e=null!=n?n:Dt.Helvetica;u(Sn(e)),g(An(e)),y(Mn(e))},[n]);var b=function(e,t,n){var i=Dn(e,{bold:t,italic:n});o(i)};return Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be("div",{class:"mb-3",children:Be(ex,{value:d,onChange:function(e){var t=An(Dn(e,{bold:!0,italic:!1})),n=Mn(Dn(e,{bold:!1,italic:!0})),o=!!t&&m,i=!!n&&f;u(e),g(o),y(i),b(e,o,i)}})}),Be("div",{class:"flex gap-2",children:[Be(ox,{title:"Bold",active:m,disabled:!An(Dn(d,{bold:!0,italic:!1})),onClick:function(){if(An(Dn(d,{bold:!0,italic:!1}))){var e=!m;g(e),b(d,e,f)}},className:"font-bold",children:Be(hy,{icon:"bold",size:18})}),Be(ox,{title:"Italic",active:f,disabled:!Mn(Dn(d,{bold:!1,italic:!0})),onClick:function(){if(Mn(Dn(d,{bold:!1,italic:!0}))){var e=!f;y(e),b(d,m,e)}},className:"italic",children:Be(hy,{icon:"italic",size:18})})]})]})}function ux(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:12),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:12)},[n]);return Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be(nx,{value:a,onChange:function(e){!Number.isFinite(e)||e<=0||(s(e),o(e))}})]})}function hx(e){var t=e.config,n=e.value,o=e.onChange,i=e.colorPresets,r=e.translate,a=v(Se(null!=n?n:"#000000"),2),s=a[0],l=a[1];Me(function(){return l(null!=n?n:"#000000")},[n]);var c=function(e){l(e),o(e)};return Be(Ww,{children:[Be(Uw,{className:"mb-3",children:r(t.labelKey)}),Be("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4",children:i.map(function(e){return Be(Gw,{color:e,active:e.toLowerCase()===(null==s?void 0:s.toLowerCase()),onSelect:c},e)})})]})}function mx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:Pt.Left),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:Pt.Left)},[n]);var l=function(e){s(e),o(e)};return Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be("div",{class:"flex gap-2",children:[Be(ox,{title:"Align left",active:a===Pt.Left,onClick:function(){return l(Pt.Left)},children:Be(hy,{icon:"alignLeft",size:18})}),Be(ox,{title:"Align center",active:a===Pt.Center,onClick:function(){return l(Pt.Center)},children:Be(hy,{icon:"alignCenter",size:18})}),Be(ox,{title:"Align right",active:a===Pt.Right,onClick:function(){return l(Pt.Right)},children:Be(hy,{icon:"alignRight",size:18})})]})]})}function gx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:Tt.Top),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:Tt.Top)},[n]);var l=function(e){s(e),o(e)};return Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be("div",{class:"flex gap-2",children:[Be(ox,{title:"Align top",active:a===Tt.Top,onClick:function(){return l(Tt.Top)},children:Be(hy,{icon:"alignTop",size:18})}),Be(ox,{title:"Align middle",active:a===Tt.Middle,onClick:function(){return l(Tt.Middle)},children:Be(hy,{icon:"alignMiddle",size:18})}),Be(ox,{title:"Align bottom",active:a===Tt.Bottom,onClick:function(){return l(Tt.Bottom)},children:Be(hy,{icon:"alignBottom",size:18})})]})]})}var px=(s(s(s(s(s(s(s(s(s(s(Zw={},Rt.Normal,"blendMode.normal"),Rt.Multiply,"blendMode.multiply"),Rt.Screen,"blendMode.screen"),Rt.Overlay,"blendMode.overlay"),Rt.Darken,"blendMode.darken"),Rt.Lighten,"blendMode.lighten"),Rt.ColorDodge,"blendMode.colorDodge"),Rt.ColorBurn,"blendMode.colorBurn"),Rt.HardLight,"blendMode.hardLight"),Rt.SoftLight,"blendMode.softLight"),s(s(s(s(s(s(Zw,Rt.Difference,"blendMode.difference"),Rt.Exclusion,"blendMode.exclusion"),Rt.Hue,"blendMode.hue"),Rt.Saturation,"blendMode.saturation"),Rt.Color,"blendMode.color"),Rt.Luminosity,"blendMode.luminosity"));function fx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:Rt.Normal),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:Rt.Normal)},[n]);return Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be("select",{class:"border-border-default bg-bg-input text-fg-primary w-full rounded border px-2 py-1 text-sm",value:a,onChange:function(e){var t=parseInt(e.target.value,10);s(t),o(t)},children:Nn.map(function(e){return Be("option",{value:e,children:i(px[e])},e)})})]})}function vx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:""),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:"")},[n]);var l=dw(a,300);Me(function(){l!==n&&o(l)},[l]);return Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be("input",{type:"text",class:"border-border-default bg-bg-input text-fg-primary w-full rounded border px-2 py-1 text-sm",value:a,onInput:function(e){var t=e.target.value;s(t)},placeholder:t.placeholderKey?i(t.placeholderKey):void 0})]})}function yx(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:0),2),a=r[0],s=r[1];Me(function(){return s(null!=n?n:0)},[n]);var l=dw(a,300);return Me(function(){l!==(null!=n?n:0)&&o(l)},[l]),Be(Ww,{children:[Be(Uw,{children:i(t.labelKey)}),Be(tx,{value:a,onChange:s})]})}function bx(e){var t=e.documentId,n=e.annotations,o=e.activeTool,i=e.colorPresets,r=fm().provides,l=Ka(t).translate;if(!r)return null;var c=n.length>0,d=c?n.map(function(e){var t;return null===(t=r.findToolForAnnotation(e.object))||void 0===t?void 0:t.id}).filter(function(e){return void 0!==e}):o?[o.id]:[];if(0===d.length)return null;var u=function(e){var t;if(0===e.length)return[];for(var n=y(new Set(e)),o=n.map(function(e){var t;return new Set(null!==(t=_w[e])&&void 0!==t?t:[])}),i=o[0],r=1;r<o.length;r++){var s,l=a(i);try{for(l.s();!(s=l.n()).done;){var c=s.value;o[r].has(c)||i.delete(c)}}catch(e){l.e(e)}finally{l.f()}}return(null!==(t=_w[n[0]])&&void 0!==t?t:[]).filter(function(e){return i.has(e)})}(d),m=c?u:u.filter(function(e){var t;return!(null!==(t=Lw[e])&&void 0!==t&&t.editOnly)});if(0===m.length)return null;var g=c?n[0].object:null==o?void 0:o.defaults,p=function(e){r&&(c?r.updateAnnotations(n.map(function(t){return{pageIndex:t.object.pageIndex,id:t.object.id,patch:e}})):o&&r.setToolDefaults(o.id,e))},f=function(e){if(g){var t=Lw[e];if(t){if("strokeStyle"===t.type){var n=g;return h({id:n.strokeStyle,dash:n.strokeDashArray},t.showCloudy&&{cloudyIntensity:n.cloudyBorderIntensity})}return g[t.key]}}};return j(B,null,m.map(function(e){var t=Lw[e];return t?j(ix,{key:e,config:t,value:f(e),onChange:function(t){return function(e,t){var n=Lw[e];if(n)if("strokeStyle"!==n.type||"object"!==w(t))"lineEndings"!==n.type?p(s({},n.key,t)):p({lineEndings:t});else{var o,i={strokeStyle:t.strokeStyle,strokeDashArray:t.strokeDashArray};n.showCloudy&&(i.cloudyBorderIntensity=null!==(o=t.cloudyBorderIntensity)&&void 0!==o?o:0),p(i)}}(e,t)},colorPresets:i,translate:l}):null}))}function wx(e){var t,n,o,i,r,a=e.documentId,s=fm().provides,l=vm(a),c=l.provides,d=l.state,u=Ka(a).translate;if(!s||!c)return null;var h=null!==(t=null==s?void 0:s.getColorPresets())&&void 0!==t?t:[],m=vd(d),g=c.getActiveTool(),p=m.length>0,f=m.length>1,v=p?c.findToolForAnnotation(m[0].object):g,y=u(null!==(n=null==v?void 0:v.labelKey)&&void 0!==n?n:"",{fallback:null!==(o=null==v?void 0:v.name)&&void 0!==o?o:""}),b="";f?b=u("annotation.multiSelect",{params:{count:String(m.length)}}):p&&v?b=u("annotation.styles",{params:{type:y}}):g&&(b=u("annotation.defaults",{params:{type:y}}));var w=null==v?void 0:v.id;return void 0!==w&&(null!==(i=null===(r=_w[w])||void 0===r?void 0:r.length)&&void 0!==i?i:0)>0||p||g?Be("div",{class:"h-full overflow-y-auto p-4",children:[b&&Be("h2",{class:"text-md mb-4 font-medium",children:b}),Be(bx,{documentId:a,annotations:m,activeTool:g,colorPresets:h})]}):Be(Nw,{documentId:a})}var xx=function(e){var t=e.item,n=e.pageNumber,o=e.isSelected,i=e.onSelect,r="text"===t.kind?oy:iy;return j("div",{onClick:i,class:"border-border-subtle hover:bg-interactive-hover flex cursor-pointer items-start gap-3 rounded-lg border p-3 transition-colors ".concat(o?"bg-interactive-selected ring-accent ring-1":"")},j("div",{class:"flex-shrink-0"},j(r,{size:20,primaryColor:t.markColor,secondaryColor:t.redactionColor})),j("div",{class:"min-w-0 flex-1"},j("div",{class:"text-fg-muted text-xs"},"Page ",n),j("div",{class:"text-fg-primary text-sm font-medium"},"text"===t.kind?"Text Redaction":"Area Redaction"),"text"===t.kind&&t.text&&j("div",{class:"text-fg-muted mt-1 truncate text-xs italic"},'"',t.text,'"')))},kx=function(e){var t=e.documentId,n=Ka(t).translate;return j("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},j(hy,{icon:"redact",className:"h-18 w-18 text-fg-muted"}),j("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("redaction.emptyState",{fallback:"No pending redactions"})))};function Cx(e){var t=e.documentId,n=(e=>{const{provides:t}=Sp(),[n,o]=Se(mp),i=Te(()=>t?t.forDocument(e):null,[t,e]);return Me(()=>{if(i){try{o(i.getState())}catch(e){o(mp)}return i.onStateChange(e=>{o(e)})}o(mp)},[i]),{state:n,provides:i}})(t),o=n.state,i=n.provides,r=Xo(t),a=r.canModifyAnnotations,s=r.canModifyContents,l=Ni().provides,c=Ka(t).translate,d=Object.entries(o.pending).flatMap(function(e){var t=v(e,2),n=t[0];return t[1].map(function(e){return{item:e,pageNumber:Number(n)+1}})}).sort(function(e,t){return e.pageNumber-t.pageNumber});return j("div",{class:"flex h-full flex-col"},j("div",{class:"border-border-subtle border-b p-3"},j("h2",{class:"text-fg-primary text-md font-semibold"},c("redaction.panel.title",{fallback:"Redactions"})),d.length>0&&j("p",{class:"text-fg-muted text-sm"},1===d.length?c("redaction.panel.itemCount",{fallback:"1 pending redaction",params:{count:1}}):c("redaction.panel.itemCountPlural",{fallback:"".concat(d.length," pending redactions"),params:{count:d.length}}))),j("div",{class:"flex-1 overflow-y-auto p-3"},0===d.length?j(kx,{documentId:t}):j("div",{class:"space-y-2"},d.map(function(e){var t,n=e.item,r=e.pageNumber;return j(xx,{key:n.id,item:n,pageNumber:r,onSelect:function(){return function(e){null==i||i.selectPending(e.page,e.id),null==l||l.scrollToPage({pageNumber:e.page+1,pageCoordinates:{x:e.rect.origin.x,y:e.rect.origin.y},alignX:50,alignY:25,behavior:"smooth"})}(n)},isSelected:(null===(t=o.selected)||void 0===t?void 0:t.id)===n.id})}))),d.length>0&&j("div",{class:"border-border-subtle flex gap-2 border-t p-3"},j(gy,{onClick:function(){null==i||i.clearPending()},disabled:!a,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover flex-1 rounded-md border px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},c("redaction.panel.clearAll",{fallback:"Clear All"})),j(gy,{onClick:function(){null==i||i.commitAllPending()},disabled:!s,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover flex-1 rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},c("redaction.panel.redactAll",{fallback:"Redact All"}))))}var Ix=s(s(s(s(s({},Bt.TEXTFIELD,"form.textfield"),Bt.CHECKBOX,"form.checkbox"),Bt.RADIOBUTTON,"form.radiobutton"),Bt.COMBOBOX,"form.combobox"),Bt.LISTBOX,"form.listbox"),Sx=s(s(s(s(s({},Bt.TEXTFIELD,"Text Field"),Bt.CHECKBOX,"Checkbox"),Bt.RADIOBUTTON,"Radio Button"),Bt.COMBOBOX,"Dropdown"),Bt.LISTBOX,"List Box"),Ax="border-border-default bg-bg-input text-fg-primary w-full rounded border px-2 py-1.5 text-sm",Mx=function(e){var t,n,o=e.documentId,i=vm(o),r=i.provides,a=i.state,s=mf().provides,l=Ka(o).translate,c=v(Se(null),2),d=c[0],u=c[1];if(!r||!s)return null;var m=vd(a);if(1!==m.length)return null;var g=m[0].object;if(g.type!==_t.WIDGET)return null;var p=g,f=l(null!==(t=Ix[p.field.type])&&void 0!==t?t:"",{fallback:null!==(n=Sx[p.field.type])&&void 0!==n?n:"Widget"}),y=l("annotation.styles",{params:{type:f}}),b=Re(function(e){r.updateAnnotations([{pageIndex:p.pageIndex,id:p.id,patch:e}])},[r,p.pageIndex,p.id]),w=Re(function(e){b({field:h(h({},p.field),e)})},[b,p.field]),x=Re(function(e,t){s.renameField(p.id,e,o).wait(function(e){var n,i;(u(null),"conflict"===e.outcome)&&(null!==(n=null===(i=globalThis.confirm)||void 0===i?void 0:i.call(globalThis,"Share this ".concat(f,' with the existing field "').concat(e.fieldName,'"?')))&&void 0!==n&&n?s.shareField(p.id,e.targetAnnotationId,o).wait(function(){return u(null)},function(e){u(e.reason.message),t.value=p.field.name}):t.value=p.field.name)},function(e){u(e.reason.message),t.value=p.field.name})},[o,f,s,p.field.name,p.id]);return Be("div",{class:"h-full overflow-y-auto p-4",children:[Be("h2",{class:"text-fg-secondary text-md mb-4 font-medium",children:y}),p.field.type===Bt.TEXTFIELD&&Be(Px,{field:p.field,updateField:w,renameField:x,fieldNameError:d,translate:l}),p.field.type===Bt.RADIOBUTTON&&Be(Rx,{field:p.field,updateField:w,renameField:x,fieldNameError:d,translate:l}),p.field.type===Bt.CHECKBOX&&Be(Tx,{field:p.field,updateField:w,renameField:x,fieldNameError:d,translate:l}),(p.field.type===Bt.COMBOBOX||p.field.type===Bt.LISTBOX)&&Be(zx,{field:p.field,updateField:w,renameField:x,fieldNameError:d,translate:l})]})};function Dx(e,t){return Re(function(n,o){var i,r=null!==(i=e.flag)&&void 0!==i?i:Gt.NONE;t({flag:o?r|n:r&~n})},[e.flag,t])}function Px(e){var t,n,o=e.field,i=e.updateField,r=e.renameField,a=e.fieldNameError,s=e.translate,l=Dx(o,i),c=null!==(t=o.maxLen)&&void 0!==t?t:0,d=!!(o.flag&Gt.TEXT_COMB);return Be("div",{class:"space-y-4",children:[Be("div",{children:[Be("label",{class:"text-fg-secondary mb-1 block text-xs font-medium",children:[s("form.fieldName",{fallback:"Field Name"}),"*:"]}),Be("input",{type:"text",class:Ax,value:o.name,onBlur:function(e){return r(e.target.value,e.target)},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}}),a&&Be("p",{class:"mt-1 text-xs text-red-600",children:a})]}),Be("div",{children:[Be("label",{class:"text-fg-secondary mb-1 block text-xs font-medium",children:[s("form.defaultValue",{fallback:"Default Value"}),":"]}),Be("input",{type:"text",class:Ax,value:null!==(n=o.value)&&void 0!==n?n:"",maxLength:c>0?c:void 0,onBlur:function(e){return i({value:e.target.value})},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}})]}),Be("div",{children:[Be("label",{class:"text-fg-secondary mb-1 block text-xs font-medium",children:[s("form.maxLength",{fallback:"Max Length"}),":"]}),Be("input",{type:"number",min:"0",class:Ax,value:c||"",placeholder:"0 (unlimited)",onBlur:function(e){var t=parseInt(e.target.value,10),n=isNaN(t)||t<=0?void 0:t;i({maxLen:n}),!n&&d&&l(Gt.TEXT_COMB,!1)},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}})]}),Be("hr",{class:"border-border-default"}),Be("div",{children:[Be("h3",{class:"text-fg-primary mb-3 text-sm font-medium",children:s("form.properties",{fallback:"Properties"})}),Be("div",{class:"flex flex-col gap-3",children:[Be(uw,{label:s("form.readOnly",{fallback:"Read Only"}),checked:!!(o.flag&Gt.READONLY),onChange:function(e){return l(Gt.READONLY,e)}}),Be(uw,{label:s("form.required",{fallback:"Required"}),checked:!!(o.flag&Gt.REQUIRED),onChange:function(e){return l(Gt.REQUIRED,e)}}),Be(uw,{label:s("form.multiline",{fallback:"Multiline"}),checked:!!(o.flag&Gt.TEXT_MULTIPLINE),onChange:function(e){return l(Gt.TEXT_MULTIPLINE,e)}}),Be(uw,{label:s("form.comb",{fallback:"Comb"}),checked:d,disabled:c<=0,onChange:function(e){return l(Gt.TEXT_COMB,e)}})]})]})]})}function Tx(e){var t=e.field,n=e.updateField,o=e.renameField,i=e.fieldNameError,r=e.translate,a=Dx(t,n);return Be("div",{class:"space-y-4",children:[Be("div",{children:[Be("label",{class:"text-fg-secondary mb-1 block text-xs font-medium",children:[r("form.fieldName",{fallback:"Field Name"}),"*:"]}),Be("input",{type:"text",class:Ax,value:t.name,onBlur:function(e){return o(e.target.value,e.target)},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}}),i&&Be("p",{class:"mt-1 text-xs text-red-600",children:i})]}),Be("hr",{class:"border-border-default"}),Be("div",{children:[Be("h3",{class:"text-fg-primary mb-3 text-sm font-medium",children:r("form.properties",{fallback:"Properties"})}),Be("div",{class:"flex flex-col gap-3",children:[Be(uw,{label:r("form.readOnly",{fallback:"Read Only"}),checked:!!(t.flag&Gt.READONLY),onChange:function(e){return a(Gt.READONLY,e)}}),Be(uw,{label:r("form.required",{fallback:"Required"}),checked:!!(t.flag&Gt.REQUIRED),onChange:function(e){return a(Gt.REQUIRED,e)}})]})]})]})}function Rx(e){var t=e.field,n=e.updateField,o=e.renameField,i=e.fieldNameError,r=e.translate,a=Dx(t,n);return Be("div",{class:"space-y-4",children:[Be("div",{children:[Be("label",{class:"text-fg-secondary mb-1 block text-xs font-medium",children:[r("form.fieldName",{fallback:"Field Name"}),"*:"]}),Be("input",{type:"text",class:Ax,value:t.name,onBlur:function(e){return o(e.target.value,e.target)},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}}),i&&Be("p",{class:"mt-1 text-xs text-red-600",children:i})]}),Be("hr",{class:"border-border-default"}),Be("div",{children:[Be("h3",{class:"text-fg-primary mb-3 text-sm font-medium",children:r("form.properties",{fallback:"Properties"})}),Be("div",{class:"flex flex-col gap-3",children:[Be(uw,{label:r("form.readOnly",{fallback:"Read Only"}),checked:!!(t.flag&Gt.READONLY),onChange:function(e){return a(Gt.READONLY,e)}}),Be(uw,{label:r("form.required",{fallback:"Required"}),checked:!!(t.flag&Gt.REQUIRED),onChange:function(e){return a(Gt.REQUIRED,e)}})]})]})]})}function zx(e){var t=e.field,n=e.updateField,o=e.renameField,i=e.fieldNameError,r=e.translate,a=Dx(t,n),s=t.type===Bt.COMBOBOX||t.type===Bt.LISTBOX?t.options:[],l=Re(function(e){n({options:e})},[n]);return Be("div",{class:"space-y-4",children:[Be("div",{children:[Be("label",{class:"text-fg-secondary mb-1 block text-xs font-medium",children:[r("form.fieldName",{fallback:"Field Name"}),"*:"]}),Be("input",{type:"text",class:Ax,value:t.name,onBlur:function(e){return o(e.target.value,e.target)},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}}),i&&Be("p",{class:"mt-1 text-xs text-red-600",children:i})]}),Be("hr",{class:"border-border-default"}),Be("div",{children:[Be("h3",{class:"text-fg-primary mb-3 text-sm font-medium",children:r("form.options",{fallback:"Options"})}),Be("div",{class:"flex flex-col gap-2",children:[s.map(function(e,t){return Be("div",{class:"flex items-center gap-2",children:[Be("input",{type:"text",class:Ax+" flex-1",value:e.label,onBlur:function(n){var o=n.target.value;if(o!==e.label){var i=s.map(function(e,n){return n===t?h(h({},e),{},{label:o}):e});l(i)}},onKeyDown:function(e){"Enter"===e.key&&e.target.blur()}}),Be("button",{type:"button",class:"text-fg-secondary hover:text-fg-primary shrink-0 text-sm",onClick:function(){var e=s.filter(function(e,n){return n!==t});l(e)},title:r("form.removeOption",{fallback:"Remove"}),children:"✕"})]},t)}),Be("button",{type:"button",class:"text-accent-primary hover:text-accent-primary-hover mt-1 text-left text-sm",onClick:function(){l([].concat(y(s),[{label:"Option ".concat(s.length+1),isSelected:!1}]))},children:["+ ",r("form.addOption",{fallback:"Add Option"})]})]})]}),Be("hr",{class:"border-border-default"}),Be("div",{children:[Be("h3",{class:"text-fg-primary mb-3 text-sm font-medium",children:r("form.properties",{fallback:"Properties"})}),Be("div",{class:"flex flex-col gap-3",children:[Be(uw,{label:r("form.readOnly",{fallback:"Read Only"}),checked:!!(t.flag&Gt.READONLY),onChange:function(e){return a(Gt.READONLY,e)}}),Be(uw,{label:r("form.required",{fallback:"Required"}),checked:!!(t.flag&Gt.REQUIRED),onChange:function(e){return a(Gt.REQUIRED,e)}}),t.type===Bt.LISTBOX&&Be(uw,{label:r("form.multiSelect",{fallback:"Multi Select"}),checked:!!(t.flag&Gt.CHOICE_MULTL_SELECT),onChange:function(e){return a(Gt.CHOICE_MULTL_SELECT,e)}})]})]})]})}function Ex(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=-50:s.top=r.size.height+8,j("div",h(h({},i),Kr(t)),j("div",{style:s,className:"border-border-subtle bg-bg-elevated rounded-lg border shadow-lg"},j("div",{className:"flex items-center gap-1 p-1"},t.items.map(function(e){return j(Nx,{key:e.id,item:e,documentId:n,props:o})}))))}function Ox(e){var t=e.item,n=e.documentId,o=La(t.commandId,n);return null!=o&&o.visible?j("div",h({},Kr(t)),j(Ub,{commandId:t.commandId,documentId:n,variant:t.variant})):null}function Nx(e){var t,n=e.item,o=e.documentId,i=e.props;switch(n.type){case"command-button":return j(Ox,{item:n,documentId:o});case"divider":return j("div",h({},Kr(n)),j("div",{className:"bg-border-default h-6 w-px","aria-hidden":"true"}));case"group":return j("div",h({className:"flex items-center gap-".concat(null!==(t=n.gap)&&void 0!==t?t:1)},Kr(n)),n.items.map(function(e){return j(Nx,{key:e.id,item:e,documentId:o,props:i})}));default:return null}}function Lx(e){var t,n,o=e.schema,i=e.documentId,r=e.className,a=o.content,s=o.position,l=ga().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 j("div",{className:"z-3 absolute ".concat(c," ").concat(r||""),style:d,"data-overlay-id":o.id},l(a.componentId,i))}function _x(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,c=Pe(null),d=v(Se(t),2),u=d[0],h=d[1],m=v(Se(!1),2),g=m[0],p=m[1];Me(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]),Me(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 Me(function(){return document.body.style.overflow=u?"hidden":"",function(){document.body.style.overflow=""}},[u]),u?Be("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:Be("div",{className:Zv("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",g&&t?"scale-100 opacity-100":"scale-95 opacity-0",a),onClick:function(e){return e.stopPropagation()},children:[(n||l)&&Be("div",{className:"border-border-subtle flex flex-shrink-0 items-center justify-between border-b px-6 py-4",children:[n&&Be("h2",{className:"text-fg-primary text-lg font-semibold",children:n}),l&&Be(gy,{onClick:i,className:"hover:bg-interactive-hover p-1",children:Be(hy,{icon:"x",className:"h-5 w-5"})})]}),Be("div",{className:"flex-1 overflow-y-auto px-6 py-4 md:max-h-[80vh] md:flex-none",children:o})]})}):null}function Fx(e){var t=e.documentId,n=e.isOpen,o=e.onClose,i=e.onExited,r=Ni().provides,a=tg().provides,s=Ka(t).translate,l=v(Se("all"),2),c=l[0],d=l[1],u=v(Se(""),2),h=u[0],m=u[1],g=v(Se(!0),2),p=g[0],f=g[1],y=v(Se(!1),2),b=y[0],w=y[1],x=v(Se(""),2),k=x[0],C=x[1],I=null==r?void 0:r.forDocument(t).getMetrics(),S=(null==I?void 0:I.currentPage)||1,A=(null==r?void 0:r.forDocument(t).getTotalPages())||0;Me(function(){n&&(d("all"),m(""),f(!0),w(!1),C(""))},[n]);var M=("custom"!==c||h.trim().length>0)&&!b;return j(_x,{open:null!=n&&n,title:s("print.title"),onClose:o,onExited:i,className:"md:w-[32rem]"},j("div",{className:"space-y-6"},j("div",null,j("label",{className:"text-fg-secondary mb-3 block text-sm font-medium"},s("print.pages")),j("div",{className:"space-y-2"},j("label",{className:"flex items-center"},j("input",{type:"radio",name:"pageRange",value:"all",checked:"all"===c,onChange:function(){return d("all")},disabled:b,className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},s("print.all"))),j("label",{className:"flex items-center"},j("input",{type:"radio",name:"pageRange",value:"current",checked:"current"===c,onChange:function(){return d("current")},disabled:b,className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},s("print.current",{params:{currentPage:S}}))),j("label",{className:"flex items-start"},j("input",{type:"radio",name:"pageRange",value:"custom",checked:"custom"===c,onChange:function(){return d("custom")},disabled:b,className:"accent-accent mr-2 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary mb-1 block text-sm"},s("print.specify")),j("input",{type:"text",placeholder:s("print.specifyEG"),value:h,onInput:function(e){return m(e.target.value)},disabled:"custom"!==c||b,className:"w-full rounded-md border px-3 py-1 text-base ".concat("custom"!==c||b?"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"===c&&h.trim()&&A>0&&j("p",{className:"text-fg-muted mt-1 text-xs"},s("print.current",{params:{totalPages:A}})))))),j("div",null,j("label",{className:"flex items-center"},j("input",{type:"checkbox",checked:p,onChange:function(e){return f(e.target.checked)},disabled:b,className:"accent-accent mr-2"}),j("span",{className:"text-fg-secondary text-sm font-medium"},s("print.annotation")))),b&&j("div",{className:"bg-state-info-light flex items-center space-x-3 rounded-md p-3"},j(fw,{className:"text-accent"}),j("span",{className:"text-accent text-sm"},k)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(gy,{onClick:o,disabled:b,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"},s("print.cancel")),j(gy,{onClick:function(){var e;"current"===c?e=String(S):"custom"===c&&(e=h.trim()||void 0);var n={includeAnnotations:p,pageRange:e};try{w(!0),C(s("print.loading"));var i=null==a?void 0:a.forDocument(t).print(n);i&&(i.onProgress(function(e){C(e.message)}),i.wait(function(){w(!1),C(""),null==o||o()},function(e){console.error("Print failed:",e),w(!1),C("")}))}catch(e){console.error("Print failed:",e),w(!1),C("")}},disabled:!M,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"},b&&j(fw,{size:"sm"}),j("span",null,s(b?"print.printing":"print.print"))))))}function $x(e){var t,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,s=e.source,l=Ni().provides,c=fm().provides,d=Vl().provides,u=Ka(n).translate,h=v(Se("url"),2),m=h[0],g=h[1],p=v(Se(""),2),f=p[0],y=p[1],b=v(Se(1),2),w=b[0],x=b[1],k=(null==l?void 0:l.forDocument(n).getTotalPages())||1,C=null==c?void 0:c.forDocument(n),I=null==d?void 0:d.forDocument(n),S=null==C?void 0:C.getSelectedAnnotation(),A=null!==(t=null==I?void 0:I.getFormattedSelection())&&void 0!==t?t:[];Me(function(){o&&(g("url"),y(""),x(1))},[o]);var M="page"===m||f.trim().length>0;return j(_x,{open:null!=o&&o,title:u("link.title")||"Insert Link or Page",onClose:i,onExited:r,className:"md:w-[28rem]"},j("form",{onSubmit:function(e){e.preventDefault(),function(){var e;if("url"===m){if(!f.trim())return;e={type:"action",action:{type:Et.URI,uri:f.trim()}}}else e={type:"destination",destination:{pageIndex:w-1,zoom:{mode:At.FitPage},view:[]}};var t=function(){if(!S)return!1;var t,n="segmentRects"in S.object?S.object.segmentRects:[S.object.rect],o=a(null!=n?n:[]);try{for(o.s();!(t=o.n()).done;){var i=t.value;null==C||C.createAnnotation(S.object.pageIndex,{id:$n(),type:_t.LINK,pageIndex:S.object.pageIndex,rect:i,inReplyToId:S.object.id,replyType:Ut.Group,target:e,strokeStyle:Ht.UNDERLINE,strokeColor:"#0000FF",strokeWidth:2})}}catch(e){o.e(e)}finally{o.f()}return!0},n=function(){if(0===A.length)return!1;var t,n=null==I?void 0:I.getSelectedText(),o=a(A);try{var i=function(){var o=t.value;null==n||n.wait(function(t){var n,i=$n();null==C||C.createAnnotation(o.pageIndex,{id:i,created:new Date,flags:["print"],type:_t.HIGHLIGHT,blendMode:Rt.Multiply,pageIndex:o.pageIndex,rect:o.rect,segmentRects:o.segmentRects,strokeColor:"#FFFFFF",opacity:0,custom:{text:t.join("\n")}});var r,s=a(null!==(n=o.segmentRects)&&void 0!==n?n:[o.rect]);try{for(s.s();!(r=s.n()).done;){var l=r.value;null==C||C.createAnnotation(o.pageIndex,{id:$n(),type:_t.LINK,pageIndex:o.pageIndex,rect:l,inReplyToId:i,replyType:Ut.Group,target:e,strokeStyle:Ht.UNDERLINE,strokeColor:"#0000FF",strokeWidth:2})}}catch(e){s.e(e)}finally{s.f()}null==C||C.selectAnnotation(o.pageIndex,i)},Bn)};for(o.s();!(t=o.n()).done;)i()}catch(e){o.e(e)}finally{o.f()}return null==I||I.clear(),!0};"annotation"===s?t():"selection"===s?n():t()||n(),null==i||i()}()},className:"space-y-6"},j("div",{className:"border-border-subtle flex border-b"},j(Yv,{active:"url"===m,onClick:function(){return g("url")}},u("link.url")||"URL"),j(Yv,{active:"page"===m,onClick:function(){return g("page")}},u("link.page")||"Page")),j("div",{className:"bg-bg-muted rounded-lg"},"url"===m?j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},u("link.enterUrl")||"Enter URL"),j("input",{type:"url",value:f,onInput:function(e){return y(e.target.value)},placeholder:"https://example.com",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-base focus:outline-none focus:ring-1",autoFocus:!0})):j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},u("link.enterPage")||"Enter Page Number"),j("input",{type:"number",min:1,max:k,value:w,onInput:function(e){var t=parseInt(e.target.value,10);isNaN(t)||x(Math.max(1,Math.min(k,t)))},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-base focus:outline-none focus:ring-1",autoFocus:!0}),j("p",{className:"text-fg-muted mt-1 text-xs"},u("link.pageRange",{params:{totalPages:k}})||"Page 1 to ".concat(k)))),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(gy,{type:"button",onClick:i,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm"},u("common.cancel")||"Cancel"),j(gy,{type:"submit",disabled:!M,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},u("link.link")||"Link"))))}function jx(e){var t=e.documentId,n=yi().provides,o=Li(t),i=o.provides,r=o.state,a=r.currentPage,s=r.totalPages,l=v(Se(!1),2),c=l[0],d=l[1],u=v(Se(!1),2),h=u[0],m=u[1],g=Pe(null),p=v(Se(a.toString()),2),f=p[0],y=p[1],b=Pe(null);Me(function(){y(a.toString())},[a]);var w=Re(function(){g.current&&clearTimeout(g.current),g.current=setTimeout(function(){h||d(!1)},4e3)},[h]);Me(function(){if(n)return n.onScrollActivity(function(e){e.documentId===t&&(d(!0),w())})},[n,t,w]),Me(function(){return function(){g.current&&clearTimeout(g.current)}},[]);return s<=1?null:j("div",{onMouseEnter:function(){m(!0),d(!0),g.current&&clearTimeout(g.current)},onMouseLeave:function(){m(!1),w()},className:"pointer-events-auto"},j("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")},j(Ub,{commandId:"scroll:previous-page",documentId:t,variant:"icon"}),j("div",{className:"flex items-center gap-1 px-1"},j("input",{ref:b,type:"text",inputMode:"numeric",pattern:"[0-9]*",value:f,onChange:function(e){var t=e.target.value.replace(/[^0-9]/g,"");y(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(f,10);!isNaN(t)&&t>=1&&t<=s?null==i||null===(e=i.scrollToPage)||void 0===e||e.call(i,{pageNumber:t}):y(a.toString())},onKeyDown:function(e){"Enter"===e.key?e.target.blur():"Escape"===e.key&&(y(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-base focus:outline-none focus:ring-1"}),j("span",{className:"text-fg-secondary text-sm"}," ",s)),j(Ub,{commandId:"scroll:next-page",documentId:t,variant:"icon"})))}var Ux=function(e,t,n){return!function(e,t,n){return yo(e.core,t,n)}(e,t,n)},Bx={"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(Za.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)===Za.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(Za.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)===Za.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();if(i){var r=i.forDocument(o);"pointerMode"===r.getActiveMode()?r.activateDefaultMode():r.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(Xi);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(Xi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).openModal("print-modal")}},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.Print)}},"document:protect":{id:"document:protect",labelKey:"document.protect",icon:"lock",categories:["document","document-protect"],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).openModal("protect-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:capture":{id:"document:capture",labelKey:"capture.screenshot",icon:"screenshot",categories:["document","document-capture"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("capture"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).toggleMarqueeCapture()},active:function(e){var t,n=e.state,o=e.documentId;return"marqueeCapture"===(null===(t=n.plugins["interaction-manager"])||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.activeMode)}},"document:fullscreen":{id:"document:fullscreen",labelKey:"document.fullscreen",icon:function(e){var t;return null!==(t=e.state.plugins.fullscreen)&&void 0!==t&&t.isFullscreen?"fullscreenExit":"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(Xi);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 na(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(Xi);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 na(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(Xi);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 na(t.plugins,n,"right","main","comment-panel")}},"panel:toggle-redaction":{id:"panel:toggle-redaction",labelKey:"panel.redaction",icon:"redactionSidebar",categories:["panel","panel-redaction","redaction"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(Xi);if(o&&o.provides){var i=o.provides();if(i)i.forDocument(n).toggleSidebar("right","main","redaction-panel")}},active:function(e){var t=e.state,n=e.documentId;return na(t.plugins,n,"right","main","redaction-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(Xi);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 na(t.plugins,n,"left","main","annotation-panel")},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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(Xi);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(Fi.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)===Fi.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(Fi.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)===Fi.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(Fi.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)===Fi.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(xi.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)===xi.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(xi.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)===xi.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,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin("ui"))||void 0===t?void 0:t.provides(),s=null===(n=i.getPlugin("interaction-manager"))||void 0===n?void 0:n.provides();if(a&&s){var l=s.forDocument(r);l&&(l.activateDefaultMode(),a.forDocument(r).closeToolbarSlot("top","secondary"),null===(o=i.getPlugin(Tc))||void 0===o||o.provides().forDocument(r).setLocked({type:ld.Include,categories:["form"]}))}},active:function(e){var t=e.state,n=e.documentId;return!ta(t.plugins,n,"top","secondary")}},"mode:annotate":{id:"mode:annotate",labelKey:"mode.annotate",categories:["mode","mode-annotate","annotation"],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();r&&(r.setActiveToolbar("top","secondary","annotation-toolbar",i),null===(n=o.getPlugin(Tc))||void 0===n||n.provides().forDocument(i).setLocked({type:ld.Include,categories:["form"]}))},active:function(e){var t=e.state,n=e.documentId;return ta(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,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin("ui"))||void 0===t?void 0:t.provides();r&&(r.setActiveToolbar("top","secondary","shapes-toolbar",i),null===(n=o.getPlugin(Tc))||void 0===n||n.provides().forDocument(i).setLocked({type:ld.Include,categories:["form"]}))},active:function(e){var t=e.state,n=e.documentId;return ta(t.plugins,n,"top","secondary","shapes-toolbar")}},"mode:form":{id:"mode:form",labelKey:"mode.form",categories:["mode","mode-form","form"],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();r&&(r.setActiveToolbar("top","secondary","form-toolbar",i),null===(n=o.getPlugin(Tc))||void 0===n||n.provides().forDocument(i).setLocked({type:ld.None}))},active:function(e){var t=e.state,n=e.documentId;return ta(t.plugins,n,"top","secondary","form-toolbar")}},"form:add-textfield":{id:"form:add-textfield",labelKey:"form.textfield",icon:"formTextfield",categories:["form","form-textfield"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("formTextField"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("formTextField"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"formTextField"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"form:add-checkbox":{id:"form:add-checkbox",labelKey:"form.checkbox",icon:"formCheckbox",categories:["form","form-checkbox"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("formCheckbox"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("formCheckbox"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"formCheckbox"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"form:add-radio":{id:"form:add-radio",labelKey:"form.radio",icon:"formRadio",categories:["form","form-radio"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("formRadioButton"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("formRadioButton"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"formRadioButton"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"form:add-select":{id:"form:add-select",labelKey:"form.select",icon:"formSelect",categories:["form","form-select"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("formCombobox"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("formCombobox"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"formCombobox"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"form:add-listbox":{id:"form:add-listbox",labelKey:"form.listbox",icon:"formListbox",categories:["form","form-listbox"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("formListbox"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("formListbox"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"formListbox"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"form:toggle-fill-mode":{id:"form:toggle-fill-mode",labelKey:"form.toggleFillMode",icon:"widgetEdit",categories:["form","form-fill-mode"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o);i&&(i.isCategoryLocked("form")?i.setLocked({type:ld.None}):i.setLocked({type:ld.Include,categories:["form"]}))},active:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(i);return!(null===(n=null==r?void 0:r.isCategoryLocked("form"))||void 0===n||n)}},"mode:redact":{id:"mode:redact",labelKey:"mode.redact",categories:["mode","mode-redact","redaction"],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();r&&(r.setActiveToolbar("top","secondary","redaction-toolbar",i),null===(n=o.getPlugin(Tc))||void 0===n||n.provides().forDocument(i).setLocked({type:ld.Include,categories:["form"]}))},active:function(e){var t=e.state,n=e.documentId;return ta(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=bd(e.state.plugins.annotation,"highlight"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-highlight"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Xs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var m=s.getTool("highlight");if(m&&oh(m)){var g=m.defaults,p=u.getFormattedSelection(),f=u.getSelectedText();if(p.length>0){d.setLocked({type:ld.Exclude,categories:["markup","shape"]});var v,y=a(p);try{var b=function(){var e=v.value,t=$n(),n=function(n){d.createAnnotation(e.pageIndex,h({id:t,created:new Date,flags:["print"],type:_t.HIGHLIGHT,blendMode:Rt.Multiply,strokeColor:g.strokeColor,opacity:g.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects},null!=n&&{custom:{text:n}})),d.selectAnnotation(e.pageIndex,t)};f.wait(function(e){return n(e.join("\n"))},function(){return n()})};for(y.s();!(v=y.n()).done;)b()}catch(e){y.e(e)}finally{y.f()}u.clear(),d.setActiveTool("highlight"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var w;"highlight"===(null===(w=d.getActiveTool())||void 0===w?void 0:w.id)?d.setActiveTool(null):d.setActiveTool("highlight")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"highlight"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-underline":{id:"annotation:add-underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"underline"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-underline"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Xs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var m=s.getTool("underline");if(m&&rh(m)){var g=m.defaults,p=u.getFormattedSelection(),f=u.getSelectedText();if(p.length>0){d.setLocked({type:ld.Exclude,categories:["markup","shape"]});var v,y=a(p);try{var b=function(){var e=v.value,t=$n(),n=function(n){d.createAnnotation(e.pageIndex,h({id:t,created:new Date,flags:["print"],type:_t.UNDERLINE,strokeColor:g.strokeColor,opacity:g.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects},null!=n&&{custom:{text:n}})),d.selectAnnotation(e.pageIndex,t)};f.wait(function(e){return n(e.join("\n"))},function(){return n()})};for(y.s();!(v=y.n()).done;)b()}catch(e){y.e(e)}finally{y.f()}u.clear(),d.setActiveTool("underline"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var w;"underline"===(null===(w=d.getActiveTool())||void 0===w?void 0:w.id)?d.setActiveTool(null):d.setActiveTool("underline")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"underline"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-strikeout":{id:"annotation:add-strikeout",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"strikeout"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-strikeout"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Xs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var m=s.getTool("strikeout");if(m&&ah(m)){var g=m.defaults,p=u.getFormattedSelection(),f=u.getSelectedText();if(p.length>0){d.setLocked({type:ld.Exclude,categories:["markup","shape"]});var v,y=a(p);try{var b=function(){var e=v.value,t=$n(),n=function(n){d.createAnnotation(e.pageIndex,h({id:t,created:new Date,flags:["print"],type:_t.STRIKEOUT,strokeColor:g.strokeColor,opacity:g.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects},null!=n&&{custom:{text:n}})),d.selectAnnotation(e.pageIndex,t)};f.wait(function(e){return n(e.join("\n"))},function(){return n()})};for(y.s();!(v=y.n()).done;)b()}catch(e){y.e(e)}finally{y.f()}u.clear(),d.setActiveTool("strikeout"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var w;"strikeout"===(null===(w=d.getActiveTool())||void 0===w?void 0:w.id)?d.setActiveTool(null):d.setActiveTool("strikeout")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"strikeout"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-squiggly":{id:"annotation:add-squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"squiggly"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-squiggly"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,s=null===(t=i.getPlugin(Tc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Xs))||void 0===n?void 0:n.provides(),c=null===(o=i.getPlugin("ui"))||void 0===o?void 0:o.provides();if(l&&s&&c){var d=null==s?void 0:s.forDocument(r),u=null==l?void 0:l.forDocument(r);if(d&&u){var m=s.getTool("squiggly");if(m&&ih(m)){var g=m.defaults,p=u.getFormattedSelection(),f=u.getSelectedText();if(p.length>0){d.setLocked({type:ld.Exclude,categories:["markup","shape"]});var v,y=a(p);try{var b=function(){var e=v.value,t=$n(),n=function(n){d.createAnnotation(e.pageIndex,h({id:t,created:new Date,flags:["print"],type:_t.SQUIGGLY,strokeColor:g.strokeColor,opacity:g.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects},null!=n&&{custom:{text:n}})),d.selectAnnotation(e.pageIndex,t)};f.wait(function(e){return n(e.join("\n"))},function(){return n()})};for(y.s();!(v=y.n()).done;)b()}catch(e){y.e(e)}finally{y.f()}u.clear(),d.setActiveTool("squiggly"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var w;"squiggly"===(null===(w=d.getActiveTool())||void 0===w?void 0:w.id)?d.setActiveTool(null):d.setActiveTool("squiggly")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"squiggly"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-insert-text":{id:"annotation:add-insert-text",labelKey:"annotation.insertText",icon:"insertText",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"insertText"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-insert-text"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("insertText"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("insertText"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"insertText"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-replace-text":{id:"annotation:add-replace-text",labelKey:"annotation.replaceText",icon:"replaceText",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"replaceText"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-markup","annotation-replace-text"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("replaceText"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("replaceText"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"replaceText"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-ink":{id:"annotation:add-ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){var t;return{primaryColor:null===(t=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"ink"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-ink-highlighter":{id:"annotation:add-ink-highlighter",labelKey:"annotation.inkHighlighter",icon:"inkHighlighter",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"inkHighlighter"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-ink"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("inkHighlighter"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("inkHighlighter"))},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[Tc])||void 0===t?void 0:t.documents[o];return"inkHighlighter"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-text":{id:"annotation:add-text",labelKey:"annotation.text",icon:"freeText",iconProps:function(e){var t;return{primaryColor:null===(t=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"freeText"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-comment":{id:"annotation:add-comment",labelKey:"annotation.comment",icon:"message",iconProps:function(e){var t;return{primaryColor:null===(t=bd(e.state.plugins.annotation,"textComment"))||void 0===t?void 0:t.strokeColor}},categories:["annotation","annotation-comment-tool"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null==r?void 0:r.forDocument(i);a&&("textComment"===(null===(n=a.getActiveTool())||void 0===n?void 0:n.id)?a.setActiveTool(null):a.setActiveTool("textComment"))},active:function(e){var t,n=e.state,o=e.documentId;return"textComment"===(null===(t=n.plugins[Tc])||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"stamp"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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=bd(o.plugins.annotation,"square"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"square"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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=bd(o.plugins.annotation,"circle"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"circle"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-line":{id:"annotation:add-line",labelKey:"annotation.line",icon:"line",iconProps:function(e){var t;return{primaryColor:null===(t=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"line"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-arrow":{id:"annotation:add-arrow",labelKey:"annotation.arrow",icon:"lineArrow",iconProps:function(e){var t;return{primaryColor:null===(t=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"lineArrow"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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=bd(o.plugins.annotation,"polygon"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"polygon"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-polyline":{id:"annotation:add-polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){var t;return{primaryColor:null===(t=bd(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(Tc))||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[Tc])||void 0===t?void 0:t.documents[o];return"polyline"===(null==i?void 0:i.activeToolId)},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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(Tc))||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)}},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:delete-all-selected":{id:"annotation:delete-all-selected",labelKey:"annotation.deleteAllSelected",icon:"trash",categories:["annotation","annotation-delete","annotation-group"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides(),r=null==i?void 0:i.forDocument(o);if(r){var a=r.getSelectedAnnotations();0!==a.length&&(r.deleteAnnotations(a.map(function(e){return{pageIndex:e.object.pageIndex,id:e.object.id}})),r.deselectAnnotation())}},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:toggle-group":{id:"annotation:toggle-group",labelKey:function(e){var t,n=e.registry,o=e.documentId;return"ungroup"===(null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o).getGroupingAction())?"annotation.ungroup":"annotation.group"},icon:function(e){var t,n=e.registry,o=e.documentId;return"ungroup"===(null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o).getGroupingAction())?"ungroup":"group"},categories:["annotation","annotation-group"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o);if(i){var r=i.getGroupingAction();if("ungroup"===r){var a=i.getSelectedAnnotations();a.length>0&&i.ungroupAnnotations(a[0].object.id)}else"group"===r&&i.groupAnnotations()}},disabled:function(e){var t,n=e.registry,o=e.state,i=e.documentId;return!!Ux(o,i,on.ModifyAnnotations)||"disabled"===(null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(i).getGroupingAction())}},"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"])},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"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"])},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:add-link":{id:"annotation:add-link",labelKey:"annotation.addLink",icon:"link",categories:["annotation","annotation-link"],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).openModal("link-modal",{source:"selection"})},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:toggle-annotation-style":{id:"annotation:toggle-annotation-style",labelKey:"annotation.style",icon:"palette",categories:["annotation","annotation-style"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(Xi);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 na(t.plugins,n,"left","main","annotation-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==_t.LINK},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:toggle-link":{id:"annotation:toggle-link",labelKey:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o);if(!i)return"annotation.addLink";var r=i.getSelectedAnnotation();return r&&i.hasAttachedLinks(r.object.id)?"annotation.removeLink":"annotation.addLink"},icon:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o);if(!i)return"link";var r=i.getSelectedAnnotation();return r&&i.hasAttachedLinks(r.object.id)?"linkOff":"link"},categories:["annotation","annotation-link"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null===(n=o.getPlugin("ui"))||void 0===n?void 0:n.provides();if(r&&a){var s=r.forDocument(i),l=s.getSelectedAnnotation();l&&(s.hasAttachedLinks(l.object.id)?s.deleteAttachedLinks(l.object.id):a.forDocument(i).openModal("link-modal",{source:"annotation"}))}},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==_t.LINK&&r.object.type!==_t.REDACT&&r.object.type!==_t.WIDGET},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyAnnotations)}},"annotation:toggle-widget-edit":{id:"annotation:toggle-widget-edit",labelKey:"annotation.widgetEdit",icon:"widgetEdit",categories:["annotation","annotation-widget-edit"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),a=null===(n=o.getPlugin("ui"))||void 0===n?void 0:n.provides();r&&a&&(r.forDocument(i).getSelectedAnnotation()&&a.forDocument(i).toggleSidebar("right","main","widget-edit-panel"))},active:function(e){var t=e.state,n=e.documentId;return na(t.plugins,n,"right","main","widget-edit-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type===_t.WIDGET}},"annotation:toggle-comment":{id:"annotation:toggle-comment",labelKey:"annotation.comment",icon:"comment",categories:["annotation","annotation-comment"],action:function(e){var t=e.registry,n=e.documentId,o=t.getPlugin(Xi);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 na(t.plugins,n,"right","main","comment-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==_t.LINK&&r.object.type!==_t.WIDGET}},"annotation:goto-link":{id:"annotation:goto-link",labelKey:"annotation.gotoLink",icon:"externalLink",categories:["annotation","annotation-link"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides();if(r){var a=r.forDocument(i),s=a.getSelectedAnnotation();if(s){var l=null;if(function(e){return e.object.type===_t.LINK}(s))l=s.object;else{var c=a.getAttachedLinks(s.object.id);c.length>0&&(l=c[0].object)}null!==(n=l)&&void 0!==n&&n.target&&a.navigateTarget(l.target)}}},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides();if(!i)return!1;var r=i.forDocument(o),a=null==r?void 0:r.getSelectedAnnotation();return!!a&&(a.object.type===_t.LINK||r.hasAttachedLinks(a.object.id))}},"redaction:redact":{id:"redaction:redact",labelKey:"redaction.redact",icon:"redactArea",categories:["redaction","redaction-combined"],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).toggleRedact()},active:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin("redaction"))||void 0===t?void 0:t.provides();return null!==(n=null==r?void 0:r.forDocument(i).isRedactActive())&&void 0!==n&&n},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyContents)}},"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,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin("redaction"))||void 0===t?void 0:t.provides();return null!==(n=null==r?void 0:r.forDocument(i).isMarqueeRedactActive())&&void 0!==n&&n},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyContents)}},"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(Xs))||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,u=s.forDocument(a),h=null==l?void 0:l.forDocument(a);if((null!==(i=null==h?void 0:h.getFormattedSelection())&&void 0!==i?i:[]).length>0)null===(d=r.getPlugin(Tc))||void 0===d||d.provides().forDocument(a).setLocked({type:ld.Exclude,categories:["redaction"]}),u.queueCurrentSelectionAsPending(),c.setActiveToolbar("top","secondary","redaction-toolbar",a);else u.toggleRedactSelection()}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[bp])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===Zg.RedactSelection},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyContents)}},"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[bp])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)||Ux(n,o,on.ModifyContents)}},"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[bp])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)||Ux(n,o,on.ModifyContents)}},"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))}},"annotation:apply-redaction":{id:"annotation:apply-redaction",labelKey:"redaction.apply",icon:"check",categories:["annotation","annotation-redaction","redaction"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=e.logger;r.debug("Command","ApplyRedaction","Starting for document: ".concat(i));var a=null===(t=o.getPlugin(Tc))||void 0===t?void 0:t.provides(),s=null===(n=o.getPlugin(bp))||void 0===n?void 0:n.provides();if(a&&s){var l=a.forDocument(i).getSelectedAnnotation();r.debug("Command","ApplyRedaction","Selected annotation: ".concat(l?JSON.stringify({id:l.object.id,type:l.object.type,pageIndex:l.object.pageIndex}):"none")),l&&l.object.type===_t.REDACT?(r.debug("Command","ApplyRedaction","Calling commitPending for page ".concat(l.object.pageIndex,", id ").concat(l.object.id)),s.forDocument(i).commitPending(l.object.pageIndex,l.object.id),r.debug("Command","ApplyRedaction","commitPending called successfully")):r.warn("Command","ApplyRedaction","No valid redaction selected - selected: ".concat(!!l,", type: ").concat(null==l?void 0:l.object.type))}else r.warn("Command","ApplyRedaction","Missing plugins - annotation: ".concat(!!a,", redaction: ").concat(!!s))},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(Tc))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return(null==r?void 0:r.object.type)===_t.REDACT},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.ModifyContents)}},"selection:copy-to-clipboard":{id:"selection:copy-to-clipboard",labelKey:"selection.copyToClipboard",icon:"copy",shortcuts:["Ctrl+C","Meta+C"],categories:["selection","selection-copy-to-clipboard"],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()},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.CopyContents)}},"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()},disabled:function(e){var t=e.state,n=e.documentId;return Ux(t,n,on.CopyContents)}},"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($g))||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[$g])||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($g))||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[$g])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canRedo)}}},Wx={"zoom.level":function(e){var t,n,o=e.state,i=e.documentId,r=i&&null!==(t=null===(n=o.plugins[Ya])||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)}}},Hx={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"}}},Gx={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 qx(e,t){var n=h({},e);for(var o in t){var i=t[o];i&&"object"===w(i)&&!Array.isArray(i)?n[o]=qx(e[o]||{},i):void 0!==i&&(n[o]=i)}return n}function Vx(e,t){return{colors:qx(e.colors,t)}}function Kx(e){return"system"===e?"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Zx(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Xx(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=v(r[i],2),s=a[0],l=a[1];l&&"object"===w(l)?e(l,"".concat(o,"-").concat(Zx(s))):void 0!==l&&t.push(" --ep".concat(o,"-").concat(Zx(s),": ").concat(l,";"))}}(e.colors,""),t.join("\n")}(e),"\n}")}function Yx(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=Aa().provides,l=Re(function(e){null==s||s.setActiveDocument(e)},[s]),c=Re(function(e){null==s||s.closeDocument(e)},[s]),d=Re(function(){null==s||s.openFileDialog()},[s]);return"always"===i||"multiple"===i&&t.length>1?j("div",{className:"bg-bg-surface-alt flex items-end pr-2 pt-2"},j("div",{className:"flex flex-1 items-end overflow-x-auto pl-4"},t.map(function(e){var t,o,i=n===e.id;return j("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")},j("span",{className:"min-w-0 flex-1 truncate"},null!==(t=e.name)&&void 0!==t?t:"Document ".concat(e.id.slice(0,8))),i&&j("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")},j(hy,{icon:"x",size:14})))}),a&&j("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"},j(hy,{icon:"plus",size:14})))):null}function Qx(){var e=Aa().provides,t=Ka().translate;return j("div",{className:"bg-bg-app flex h-full w-full items-center justify-center"},j("div",{className:"flex max-w-sm flex-col items-center text-center"},j("div",{className:"bg-accent-light mb-6 rounded-full p-5"},j(hy,{icon:"file",size:48,className:"text-accent"})),j("h2",{className:"text-fg-primary mb-2 text-xl font-semibold"},t("emptyState.title")),j("p",{className:"text-fg-secondary mb-6 text-sm leading-relaxed"},t("emptyState.description"),j("br",null),t("emptyState.descriptionMulti")),j("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"},j(hy,{icon:"plus",size:16}),t("emptyState.openButton")),j("p",{className:"text-fg-muted mt-4 text-xs"},t("emptyState.supportedFormats"))))}function Jx(e){var t=e.documentState,o=Aa().provides,i=Ka().translate,r=v(Se(""),2),a=r[0],s=r[1],l=v(Se(!1),2),c=l[0],d=l[1];if(!t)return null;var u=t.name,h=t.errorCode,m=t.passwordProvided,p=h===sn.Password,f=p&&!m,y=p&&m;if(!p)return j("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},j("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"},j("div",{className:"bg-state-error-light mb-4 rounded-full p-4"},j(hy,{icon:"alertTriangle",size:28,className:"text-state-error"})),j("h3",{className:"text-fg-primary text-lg font-semibold"},i("documentError.title")),j("p",{className:"text-fg-secondary mt-2 text-sm"},t.error||i("documentError.unknown")),h&&j("p",{className:"text-fg-muted mt-1 text-xs"},i("documentError.errorCode",{params:{code:String(h)}})),j("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(g().m(function e(){return g().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 j("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},j("div",{className:"bg-bg-surface border-border-default w-full max-w-sm rounded-xl border p-6 shadow-lg"},j("div",{className:"flex flex-col items-center text-center"},j("div",{className:"bg-accent-light mb-4 rounded-full p-4"},j(hy,{icon:"lock",size:28,className:"text-accent"})),j("h3",{className:"text-fg-primary text-lg font-semibold"},i("passwordPrompt.title")),u&&j("p",{className:"text-fg-muted mt-1 text-sm"},u)),j("p",{className:"text-fg-secondary mt-4 text-center text-sm"},f&&i("passwordPrompt.required"),y&&i("passwordPrompt.incorrect")),j("div",{className:"mt-5"},j("label",{className:"text-fg-primary mb-1.5 block text-sm font-medium"},i("passwordPrompt.label")),j("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})),y&&j("div",{className:"bg-state-error-light border-state-error mt-3 flex items-center gap-2 rounded-md border p-3"},j(hy,{icon:"alertTriangle",size:16,className:"text-state-error flex-shrink-0"}),j("p",{className:"text-state-error text-sm"},i("passwordPrompt.incorrectWarning"))),j("div",{className:"mt-6 flex gap-3"},j("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")),j("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 ek(e){var t=e.documentId,n=e.className,o=La("mode:view",t),i=La("mode:annotate",t),r=La("mode:shapes",t),a=La("mode:redact",t),s=La("mode:form",t),l=La("tabs:overflow-menu",t),c=Te(function(){return[o,i,r,s,a].find(function(e){return null==e?void 0:e.active})||o},[o,i,r,s,a]),d=Re(function(e){e.preventDefault(),e.stopPropagation(),l&&!l.disabled&&l.execute()},[l]);if(!l||!l.visible)return null;var u=l.active;return j("div",{style:{maxWidth:"100px",width:"100px"},className:n},j(gy,{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(u?"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:d,disabled:l.disabled,style:{height:34}},j("span",{className:"min-w-0 flex-1 truncate text-left ".concat(u?"text-accent":"text-fg-primary")},null==c?void 0:c.label),j(hy,{icon:"chevronDown",className:"h-4 w-4 ".concat(u?"text-accent":"text-fg-secondary")})))}function tk(e){var t=e.documentId,n=_g().provides,o=v(Se(!1),2),i=o[0],r=o[1],a=v(Se(null),2),s=a[0],l=a[1],c=v(Se(null),2),d=c[0],u=c[1],h=v(Se(null),2),m=h[0],g=h[1],p=Pe(null),f=Pe(null),y=Ka(t).translate,b=function(){p.current&&(URL.revokeObjectURL(p.current),p.current=null),m&&(URL.revokeObjectURL(m),g(null)),r(!1),l(null),u(null)};Me(function(){if(n)return n.onCaptureArea(function(e){var t=e.pageIndex,n=e.rect,o=e.blob;l({pageIndex:t,rect:n,blob:o});var i=URL.createObjectURL(o);p.current=i,u(i),r(!0)})},[n]);return j(B,null,j(_x,{open:i,onClose:b,title:y("capture.title"),className:"md:w-[48rem]"},j("div",{className:"space-y-6"},j("div",{className:"flex justify-center"},d&&j("img",{src:d,onLoad:function(){p.current&&(URL.revokeObjectURL(p.current),p.current=null)},alt:"Captured PDF area",style:{maxWidth:"100%",maxHeight:"400px",border:"1px solid #e5e7eb",borderRadius:"4px",display:"block"}})),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(gy,{onClick:b,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"},y("capture.cancel")),j(gy,{onClick:function(){if(s&&f.current){var e=URL.createObjectURL(s.blob);g(e),f.current.href=e,f.current.download="pdf-capture-page-".concat(s.pageIndex+1,".png"),f.current.click(),b()}},disabled:!s,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"},y("capture.download"))))),j("a",{ref:f,style:{display:"none"},href:"",download:""}))}var nk=[{flag:on.Print,labelKey:"protect.permissions.print"},{flag:on.PrintHighQuality,labelKey:"protect.permissions.printHighQuality"},{flag:on.CopyContents,labelKey:"protect.permissions.copy"},{flag:on.ExtractForAccessibility,labelKey:"protect.permissions.accessibility"},{flag:on.ModifyContents,labelKey:"protect.permissions.modify"},{flag:on.ModifyAnnotations,labelKey:"protect.permissions.annotations"},{flag:on.FillForms,labelKey:"protect.permissions.fillForms"},{flag:on.AssembleDocument,labelKey:"protect.permissions.assemble"}];function ok(e){var t=e.permissions,n=e.translate,o=e.label;return j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},null!=o?o:n("security.viewPermissions.restrictedActions")),j("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2"},nk.map(function(e){var o,i=(o=e.flag,0!==(t&o));return j("div",{key:e.flag,className:"flex items-center rounded-md p-2 ".concat(i?"text-fg-primary":"text-fg-muted")},j(hy,{icon:i?"check":"x",className:"mr-2 h-4 w-4 flex-shrink-0 ".concat(i?"text-state-success":"text-state-error")}),j("span",{className:"text-sm"},n(e.labelKey)))})))}function ik(e){var t,n,o,i=e.documentId,r=e.isOpen,s=e.onClose,l=e.onExited,c=Ka(i).translate,d=Aa().provides,u=Go(i),h=null==u?void 0:u.document,m=null!==(t=null==h?void 0:h.isEncrypted)&&void 0!==t&&t,g=null!==(n=null==h?void 0:h.isOwnerUnlocked)&&void 0!==n&&n,p=null!==(o=null==h?void 0:h.permissions)&&void 0!==o?o:0,f=v(Se("edit-protection"),2),y=f[0],b=f[1],w=v(Se(""),2),x=w[0],k=w[1],C=v(Se(!1),2),I=C[0],S=C[1],A=v(Se(!1),2),M=A[0],D=A[1],P=v(Se(null),2),T=P[0],R=P[1],z=v(Se(!1),2),E=z[0],O=z[1],N=v(Se(""),2),L=N[0],_=N[1],F=v(Se(""),2),$=F[0],U=F[1],B=v(Se(!1),2),W=B[0],H=B[1],G=v(Se(!1),2),q=G[0],V=G[1],K=v(Se(""),2),Z=K[0],X=K[1],Y=v(Se(""),2),Q=Y[0],J=Y[1],ee=v(Se(!1),2),te=ee[0],ne=ee[1],oe=Se(new Set(nk.map(function(e){return e.flag}))),ie=v(oe,2),re=ie[0],ae=ie[1],se=v(Se(!1),2),le=se[0],ce=se[1],de=v(Se(null),2),ue=de[0],he=de[1];Me(function(){r&&(k(""),S(!1),D(!1),R(null),O(!1),_(""),U(""),H(!1),V(!1),X(""),J(""),ne(!1),ae(new Set(nk.map(function(e){return e.flag}))),ce(!1),he(null),b(m&&!g?"unlock":m&&g?"choose-action":"edit-protection"))},[r,m,g]);var me=L===$,ge=Z===Q,pe=!E||L.length>0&&me,fe=!q||Z.length>0&&ge,ve=(E||q)&&pe&&fe&&!le,ye=function(){d&&x&&(D(!0),R(null),d.unlockOwnerPermissions(i,x).wait(function(e){D(!1),e?b("choose-action"):R(c("security.unlock.invalidPassword"))},function(e){var t,n;D(!1),R(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:c("security.unlock.failed"))}))},be=function(){if(ve&&d){var e=0;if(q){var t,n=a(re);try{for(n.s();!(t=n.n()).done;){e|=t.value}}catch(e){n.e(e)}finally{n.f()}}else e=on.AllowAll;var o=E?L:"",r=q?Z:E?L:"";ce(!0),he(null),d.setDocumentEncryption(i,{userPassword:o,ownerPassword:r,allowedFlags:e}).wait(function(e){ce(!1),e?null==s||s():he(c("protect.applyFailed"))},function(e){var t,n;ce(!1),he(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:c("protect.applyFailed"))})}},we=function(){d&&(ce(!0),he(null),d.removeEncryption(i).wait(function(e){ce(!1),e?null==s||s():he(c("protect.removeFailed"))},function(e){var t,n;ce(!1),he(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:c("protect.removeFailed"))}))},xe=function(){return j("div",{className:"space-y-6"},j("div",{className:"bg-bg-subtle rounded-lg"},j("label",{className:"flex cursor-pointer items-start"},j("input",{type:"checkbox",checked:E,onChange:function(e){return O(e.target.checked)},className:"accent-accent mr-3 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary block font-medium"},c("protect.openPassword.title")),j("span",{className:"text-fg-muted text-sm"},c("protect.openPassword.description")))),E&&j("div",{className:"mt-4 space-y-3 pl-6"},j("div",null,j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.openPassword.label")),j("div",{className:"relative"},j("input",{type:W?"text":"password",value:L,onInput:function(e){return _(e.target.value)},placeholder:c("protect.openPassword.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1"}),j("button",{type:"button",onClick:function(){return H(!W)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(hy,{icon:W?"eye-off":"eye",className:"h-4 w-4"})))),j("div",null,j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.openPassword.confirm")),j("input",{type:W?"text":"password",value:$,onInput:function(e){return U(e.target.value)},placeholder:c("protect.openPassword.confirmPlaceholder"),className:"border-border-default bg-bg-input text-fg-primary focus:ring-accent w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 ".concat($&&!me?"border-state-error focus:border-state-error":"focus:border-accent")}),$&&!me&&j("p",{className:"text-state-error mt-1 text-xs"},c("protect.passwordMismatch"))))),j("div",{className:"bg-bg-subtle rounded-lg"},j("label",{className:"flex cursor-pointer items-start"},j("input",{type:"checkbox",checked:q,onChange:function(e){return V(e.target.checked)},className:"accent-accent mr-3 mt-0.5"}),j("div",{className:"flex-1"},j("span",{className:"text-fg-primary block font-medium"},c("protect.permissions.title")),j("span",{className:"text-fg-muted text-sm"},c("protect.permissions.description")))),q&&j("div",{className:"mt-4 space-y-4 pl-6"},j("div",{className:"border-border-subtle border-b pb-4"},j("div",null,j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.ownerPassword.label")),j("div",{className:"relative"},j("input",{type:te?"text":"password",value:Z,onInput:function(e){return X(e.target.value)},placeholder:c("protect.ownerPassword.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1"}),j("button",{type:"button",onClick:function(){return ne(!te)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(hy,{icon:te?"eye-off":"eye",className:"h-4 w-4"})))),j("div",{className:"mt-3"},j("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.ownerPassword.confirm")),j("input",{type:te?"text":"password",value:Q,onInput:function(e){return J(e.target.value)},placeholder:c("protect.ownerPassword.confirmPlaceholder"),className:"border-border-default bg-bg-input text-fg-primary focus:ring-accent w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1 ".concat(Q&&!ge?"border-state-error focus:border-state-error":"focus:border-accent")}),Q&&!ge&&j("p",{className:"text-state-error mt-1 text-xs"},c("protect.passwordMismatch")))),j("div",null,j("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},c("protect.permissions.allowedActions")),j("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2"},nk.map(function(e){return j("label",{key:e.flag,className:"hover:bg-bg-surface flex cursor-pointer items-center rounded-md p-2 transition-colors"},j("input",{type:"checkbox",checked:re.has(e.flag),onChange:function(){return t=e.flag,void ae(function(e){var n=new Set(e);return n.has(t)?n.delete(t):(n.add(t),t===on.PrintHighQuality&&n.add(on.Print)),n});var t},className:"accent-accent mr-2"}),j("span",{className:"text-fg-primary text-sm"},c(e.labelKey)))}))))),E&&q&&j("div",{className:"bg-state-info-light flex items-start space-x-2 rounded-md p-3"},j(hy,{icon:"info",className:"text-accent mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-fg-secondary text-sm"},c("protect.bothPasswordsNote"))),!E&&!q&&!ue&&j("div",{className:"bg-state-warning-light flex items-start space-x-2 rounded-md p-3"},j(hy,{icon:"alertTriangle",className:"text-state-warning mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-fg-secondary text-sm"},c("protect.noProtectionSelected"))),ue&&j("div",{className:"bg-state-error-light flex items-start space-x-2 rounded-md p-3"},j(hy,{icon:"alertTriangle",className:"text-state-error mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-state-error text-sm"},ue)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},m&&g&&j(gy,{onClick:function(){return b("choose-action")},disabled:le,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"},c("common.back")),j(gy,{onClick:be,disabled:!ve,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"},le&&j(fw,{size:"sm"}),j("span",null,c(le?"protect.applying":"protect.apply")))))};return j(_x,{open:null!=r&&r,title:function(){switch(y){case"unlock":return c("protect.encrypted.title");case"choose-action":return c("protect.modifyProtection.title");case"remove-protection":return c("protect.removeProtection.title");default:return c("protect.title")}}(),onClose:s,onExited:l,className:"md:w-[36rem]"},function(){switch(y){case"unlock":return j("div",{className:"space-y-5"},j("p",{className:"text-fg-secondary text-sm"},c("protect.encrypted.description")),j("div",null,j("label",{className:"text-fg-primary mb-2 block text-sm font-medium"},c("protect.encrypted.enterOwnerPassword")),j("div",{className:"relative"},j("input",{type:I?"text":"password",value:x,onInput:function(e){return k(e.target.value)},placeholder:c("protect.ownerPassword.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1",onKeyDown:function(e){"Enter"===e.key&&x&&ye()}}),j("button",{type:"button",onClick:function(){return S(!I)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(hy,{icon:I?"eye-off":"eye",className:"h-4 w-4"}))),T&&j("p",{className:"text-state-error mt-2 text-xs"},T)),j(ok,{permissions:p,translate:c}),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(gy,{onClick:ye,disabled:!x||M,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"},M&&j(fw,{size:"sm"}),j("span",null,c("protect.encrypted.unlockAndEdit")))));case"choose-action":return j("div",{className:"space-y-5"},j("p",{className:"text-fg-secondary text-sm"},c("protect.modifyProtection.description")),j("div",{className:"space-y-3"},j("button",{type:"button",onClick:function(){return b("edit-protection")},className:"border-border-default hover:border-accent hover:bg-bg-subtle flex w-full items-center rounded-lg border p-4 text-left transition-colors"},j("div",{className:"bg-accent/10 mr-4 rounded-full p-2"},j(hy,{icon:"lock",size:20,className:"text-accent"})),j("div",null,j("span",{className:"text-fg-primary block font-medium"},c("protect.modifyProtection.changeOption")),j("span",{className:"text-fg-muted text-sm"},c("protect.modifyProtection.changeDescription")))),j("button",{type:"button",onClick:function(){return b("remove-protection")},className:"border-border-default hover:border-state-error hover:bg-state-error-light flex w-full items-center rounded-lg border p-4 text-left transition-colors"},j("div",{className:"bg-state-error-light mr-4 rounded-full p-2"},j(hy,{icon:"unlock",size:20,className:"text-state-error"})),j("div",null,j("span",{className:"text-fg-primary block font-medium"},c("protect.modifyProtection.removeOption")),j("span",{className:"text-fg-muted text-sm"},c("protect.modifyProtection.removeDescription"))))),j("div",{className:"border-border-subtle flex justify-end border-t pt-4"},j(gy,{onClick:s,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm"},c("protect.cancel"))));case"remove-protection":return j("div",{className:"space-y-5"},j("div",{className:"bg-state-warning-light flex items-start space-x-3 rounded-lg p-4"},j(hy,{icon:"alertTriangle",className:"text-state-warning mt-0.5 h-5 w-5 flex-shrink-0"}),j("div",null,j("p",{className:"text-fg-primary font-medium"},c("protect.removeProtection.warning")),j("p",{className:"text-fg-secondary mt-1 text-sm"},c("protect.removeProtection.description")))),ue&&j("div",{className:"bg-state-error-light flex items-start space-x-2 rounded-md p-3"},j(hy,{icon:"alertTriangle",className:"text-state-error mt-0.5 h-4 w-4 flex-shrink-0"}),j("p",{className:"text-state-error text-sm"},ue)),j("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},j(gy,{onClick:function(){return b("choose-action")},disabled:le,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"},c("common.back")),j(gy,{onClick:we,disabled:le,className:"bg-state-error text-fg-on-accent hover:bg-state-error/90 flex items-center space-x-2 rounded-md border border-transparent px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},le&&j(fw,{size:"sm"}),j("span",null,c("protect.removeProtection.confirm")))));default:return xe()}}())}function rk(e){var t,n,o,i=e.documentId,r=Ka(i).translate,a=ia().provides,s=Go(i),l=null==s?void 0:s.document,c=null!==(t=null==l?void 0:l.isEncrypted)&&void 0!==t&&t,d=null!==(n=null==l?void 0:l.isOwnerUnlocked)&&void 0!==n&&n,u=((null!==(o=null==l?void 0:l.permissions)&&void 0!==o?o:on.AllowAll)&on.AllowAll)!==on.AllowAll,h=c&&!d&&u,m=Re(function(){null==a||a.forDocument(i).disableOverlay("unlock-owner-overlay")},[i,a]),g=Re(function(){null==a||a.forDocument(i).disableOverlay("unlock-owner-overlay"),null==a||a.forDocument(i).openModal("view-permissions-modal")},[i,a]);return h?j("div",{className:""},j("div",{className:"bg-bg-surface border-border-default flex max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg"},j("div",{className:"bg-accent/10 flex-shrink-0 rounded-full p-2"},j(hy,{icon:"lock",size:20,className:"text-accent"})),j("div",{className:"min-w-0 flex-1"},j("h3",{className:"text-fg-primary text-sm font-semibold"},r("security.protected.title")),j("p",{className:"text-fg-secondary mt-1 text-xs leading-relaxed"},r("security.protected.description")),j("button",{type:"button",onClick:g,className:"text-accent hover:text-accent-hover mt-2 text-xs font-medium"},r("security.protected.viewPermissions"))),j("button",{type:"button",onClick:m,className:"text-fg-muted hover:text-fg-secondary -mr-1 -mt-1 flex-shrink-0 p-1","aria-label":r("common.close")},j(hy,{icon:"x",size:16})))):null}function ak(e){var t,n,o=e.documentId,i=e.isOpen,r=e.onClose,a=e.onExited,s=Ka(o).translate,l=Go(o),c=Aa().provides,d=v(Se(""),2),u=d[0],h=d[1],m=v(Se(!1),2),g=m[0],p=m[1],f=v(Se(!1),2),y=f[0],b=f[1],w=v(Se(null),2),x=w[0],k=w[1],C=null==l?void 0:l.document,I=null!==(t=null==C?void 0:C.permissions)&&void 0!==t?t:0,S=null!==(n=null==C?void 0:C.isOwnerUnlocked)&&void 0!==n&&n;Me(function(){i&&(h(""),p(!1),b(!1),k(null))},[i]);var A=function(){c&&u&&(b(!0),k(null),c.unlockOwnerPermissions(o,u).wait(function(e){b(!1),e?h(""):k(s("security.unlock.invalidPassword"))},function(e){var t,n;b(!1),k(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:s("security.unlock.failed"))}))};return j(_x,{open:null!=i&&i,title:s("security.viewPermissions.title"),onClose:r,onExited:a,className:"md:w-[32rem]"},j("div",{className:"space-y-5"},j("p",{className:"text-fg-secondary text-sm"},s("security.viewPermissions.description")),!S&&j("div",null,j("label",{className:"text-fg-primary mb-2 block text-sm font-medium"},s("security.unlock.label")),j("div",{className:"relative"},j("input",{type:g?"text":"password",value:u,onInput:function(e){return h(e.target.value)},placeholder:s("security.unlock.placeholder"),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 pr-10 text-sm focus:outline-none focus:ring-1",onKeyDown:function(e){"Enter"===e.key&&u&&A()}}),j("button",{type:"button",onClick:function(){return p(!g)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},j(hy,{icon:g?"eye-off":"eye",className:"h-4 w-4"}))),x&&j("p",{className:"text-state-error mt-2 text-xs"},x),j(gy,{onClick:A,disabled:!u||y,className:"bg-accent text-fg-on-accent hover:!bg-accent-hover mt-3 flex items-center space-x-2 rounded-md px-4 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50"},y&&j(fw,{size:"sm"}),j("span",null,s("security.unlock.button")))),S&&j("div",{className:"bg-state-success-light flex items-center space-x-2 rounded-md p-3"},j(hy,{icon:"check",className:"text-state-success h-4 w-4 flex-shrink-0"}),j("p",{className:"text-fg-secondary text-sm"},s("security.unlock.success"))),j(ok,{permissions:I,translate:s}),j("div",{className:"border-border-subtle flex justify-end border-t pt-4"},j(gy,{onClick:r,className:"border-border-default bg-bg-surface text-fg-secondary hover:bg-interactive-hover rounded-md border px-4 py-2 text-sm"},s("common.close")))))}var sk={documentManager:{},commands:{commands:Bx},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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Toggle Pan Mode"},pointer:{toggle:"Toggle Pointer Mode"},capture:{screenshot:"Screenshot",dragTip:"Drag to select area to capture",title:"Screenshot Preview",download:"Download",cancel:"Cancel"},document:{menu:"Document Menu",open:"Open",close:"Close",print:"Print",protect:"Security",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",redaction:"Redaction Sidebar"},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",form:"Form",redact:"Redact"},form:{textfield:"Text Field",checkbox:"Checkbox",radio:"Radio Button",select:"Dropdown",listbox:"List Box"},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",inkHighlighter:"Ink Highlighter",stamp:"Stamp",caret:"Caret",insertText:"Insert Text",replaceText:"Replace Text",freeText:"Free Text",square:"Square",style:"Annotation Style",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",deleteAllSelected:"Delete Selected",multiSelect:"{count} annotations selected",group:"Group",ungroup:"Ungroup",moreTools:"More Tools",addLink:"Add Link",removeLink:"Remove Link",gotoLink:"Go to Link",comment:"Comment",redact:"Redact",overlayText:"Overlay Text",overlayTextPlaceholder:"e.g., REDACTED",rotation:"Rotation"},redaction:{redact:"Redact",area:"Redact Area",text:"Redact Text",apply:"Apply Redaction",applyAll:"Apply All",clearAll:"Clear All",deleteSelected:"Delete selected redaction",commitSelected:"Apply selected redaction",emptyState:"No pending redactions",panel:{title:"Redactions",itemCount:"{count} pending redaction",itemCountPlural:"{count} pending redactions",clearAll:"Clear All",redactAll:"Redact All"}},history:{undo:"Undo",redo:"Redo"},comments:{page:"Page {page}",commentCount:"{count} comment",commentCountPlural:"{count} comments",addComment:"Add comment...",addReply:"Add reply...",showAllAnnotations:"Show All Annotations",closeAllAnnotations:"Close All Annotations",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"},print:{title:"Print Settings",loading:"Preparing document...",pages:"Pages to print",all:"All pages",current:"Current page ({currentPage})",specify:"Specify pages",specifyEG:"e.g., 1-3, 5, 8-10",total:"Total pages in document: {totalPages}",annotation:"Include annotations",printing:"Printing...",print:"Print",cancel:"Cancel"},protect:{title:"Protect Document",cancel:"Cancel",apply:"Apply Protection",applying:"Applying...",applyFailed:"Failed to apply protection. Please try again.",removeFailed:"Failed to remove protection. Please try again.",passwordMismatch:"Passwords do not match",noProtectionSelected:"Select at least one protection option to apply.",bothPasswordsNote:"Users who open with the document password will have restricted permissions. Use the owner password to unlock full access.",openPassword:{title:"Require password to open",description:"Users must enter a password to view this document.",label:"Document Password",placeholder:"Enter password",confirm:"Confirm Password",confirmPlaceholder:"Confirm password"},ownerPassword:{label:"Owner Password",placeholder:"Enter owner password",confirm:"Confirm Owner Password",confirmPlaceholder:"Confirm owner password"},permissions:{title:"Restrict permissions",description:"Limit what users can do with this document.",allowedActions:"Allowed actions",print:"Print",printHighQuality:"Print high quality",copy:"Copy content",accessibility:"Extract for accessibility",modify:"Modify content",annotations:"Add/modify annotations & comments",fillForms:"Fill forms & sign",assemble:"Assemble & extract pages"},encrypted:{title:"Document is Protected",description:"This document is protected by the owner. Enter the owner password to modify security settings.",enterOwnerPassword:"Enter Owner Password to Modify",unlockAndEdit:"Unlock & Edit"},modifyProtection:{title:"Modify Protection",description:"Choose how you want to modify the document protection.",changeOption:"Change Passwords or Permissions",changeDescription:"Update the document password or permission settings.",removeOption:"Remove All Protection",removeDescription:"Remove password protection from this document."},removeProtection:{title:"Remove Protection",warning:"Are you sure you want to remove protection?",description:"This will remove all password protection from the document. Anyone will be able to open and modify it.",confirm:"Remove Protection"}},security:{protected:{title:"This Document is Protected",description:"This file is protected and some features may be disabled. Go to Security in the document menu to view or unlock permissions.",viewPermissions:"View permissions"},viewPermissions:{title:"Document Permissions",description:"This file is restricted by the owner and requires a password to unlock certain actions.",restrictedActions:"Restricted Actions"},unlock:{label:"Enter Owner Password to Unlock File",placeholder:"Enter owner password",button:"Unlock file",invalidPassword:"Invalid password. Please try again.",failed:"Failed to unlock. Please try again.",success:"Owner permissions unlocked! You now have full access."}},common:{close:"Close",back:"Back",cancel:"Cancel"},link:{title:"Insert Link",url:"URL",page:"Page",enterUrl:"Enter URL",enterPage:"Enter Page Number",pageRange:"Page 1 to {totalPages}",link:"Link"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Pan-modus wisselen"},pointer:{toggle:"Aanwijzermodus wisselen"},capture:{screenshot:"Schermafbeelding",dragTip:"Sleep om een gebied te selecteren om vast te leggen",title:"Screenshot voorbeeld",download:"Downloaden",cancel:"Annuleren"},document:{menu:"Documentmenu",open:"Openen",close:"Sluiten",print:"Afdrukken",protect:"Beveiliging",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",redaction:"Redactie Zijbalk"},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",form:"Formulier",redact:"Redigeren"},form:{textfield:"Tekstveld",checkbox:"Selectievakje",radio:"Keuzerondje",select:"Dropdown",listbox:"Keuzelijst"},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",inkHighlighter:"Inktmarkeerstift",stamp:"Stempel",caret:"Invoegpunt",insertText:"Tekst invoegen",replaceText:"Tekst vervangen",freeText:"Vrije tekst",square:"Vierkant",style:"Annotatiestijl",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",deleteAllSelected:"Selectie verwijderen",multiSelect:"{count} annotaties geselecteerd",group:"Groeperen",ungroup:"Groepering opheffen",moreTools:"Meer gereedschappen",addLink:"Link toevoegen",removeLink:"Link verwijderen",gotoLink:"Ga naar link",comment:"Opmerking",redact:"Redigeren",overlayText:"Overlaytekst",overlayTextPlaceholder:"bijv. GEREDIGEERD",rotation:"Rotatie"},redaction:{redact:"Redigeren",area:"Gebied redigeren",text:"Tekst redigeren",apply:"Redactie toepassen",applyAll:"Alles toepassen",clearAll:"Alles wissen",deleteSelected:"Geselecteerde redactie verwijderen",commitSelected:"Geselecteerde redactie toepassen",emptyState:"Geen openstaande redacties",panel:{title:"Redacties",itemCount:"{count} openstaande redactie",itemCountPlural:"{count} openstaande redacties",clearAll:"Alles wissen",redactAll:"Alles redigeren"}},history:{undo:"Ongedaan maken",redo:"Opnieuw doen"},comments:{page:"Pagina {page}",commentCount:"{count} opmerking",commentCountPlural:"{count} opmerkingen",addComment:"Opmerking toevoegen...",addReply:"Antwoord toevoegen...",showAllAnnotations:"Alle annotaties tonen",closeAllAnnotations:"Alle annotaties sluiten",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"},print:{title:"Afdrukinstellingen",loading:"Document voorbereiden...",pages:"Af te drukken pagina's",all:"Alle pagina's",current:"Huidige pagina ({currentPage})",specify:"Pagina's",specifyEG:"bijv. 1-3, 5, 8-10",total:"Totaal aantal pagina's in document: {totalPages}",annotation:"Inclusief annotaties",printing:"Afdrukken...",print:"Afdrukken",cancel:"Annuleren"},protect:{title:"Document beveiligen",cancel:"Annuleren",apply:"Beveiliging toepassen",applying:"Bezig met toepassen...",applyFailed:"Beveiliging kon niet worden toegepast. Probeer het opnieuw.",removeFailed:"Beveiliging kon niet worden verwijderd. Probeer het opnieuw.",passwordMismatch:"Wachtwoorden komen niet overeen",noProtectionSelected:"Selecteer minimaal één beveiligingsoptie.",bothPasswordsNote:"Gebruikers die openen met het documentwachtwoord hebben beperkte rechten. Gebruik het eigenaarswachtwoord voor volledige toegang.",openPassword:{title:"Wachtwoord vereist om te openen",description:"Gebruikers moeten een wachtwoord invoeren om dit document te bekijken.",label:"Documentwachtwoord",placeholder:"Wachtwoord invoeren",confirm:"Wachtwoord bevestigen",confirmPlaceholder:"Wachtwoord bevestigen"},ownerPassword:{label:"Eigenaarswachtwoord",placeholder:"Eigenaarswachtwoord invoeren",confirm:"Eigenaarswachtwoord bevestigen",confirmPlaceholder:"Eigenaarswachtwoord bevestigen"},permissions:{title:"Rechten beperken",description:"Beperk wat gebruikers met dit document kunnen doen.",allowedActions:"Toegestane acties",print:"Afdrukken",printHighQuality:"Hoge kwaliteit afdrukken",copy:"Inhoud kopiëren",accessibility:"Extraheren voor toegankelijkheid",modify:"Inhoud wijzigen",annotations:"Annotaties & opmerkingen toevoegen/wijzigen",fillForms:"Formulieren invullen & ondertekenen",assemble:"Document samenstellen & pagina's extraheren"},encrypted:{title:"Document is beveiligd",description:"Dit document is beveiligd door de eigenaar. Voer het eigenaarswachtwoord in om beveiligingsinstellingen te wijzigen.",enterOwnerPassword:"Voer eigenaarswachtwoord in om te wijzigen",unlockAndEdit:"Ontgrendelen & Bewerken"},modifyProtection:{title:"Beveiliging wijzigen",description:"Kies hoe u de documentbeveiliging wilt wijzigen.",changeOption:"Wachtwoorden of rechten wijzigen",changeDescription:"Update het documentwachtwoord of rechtinstellingen.",removeOption:"Alle beveiliging verwijderen",removeDescription:"Verwijder wachtwoordbeveiliging van dit document."},removeProtection:{title:"Beveiliging verwijderen",warning:"Weet u zeker dat u de beveiliging wilt verwijderen?",description:"Dit verwijdert alle wachtwoordbeveiliging van het document. Iedereen kan het openen en wijzigen.",confirm:"Beveiliging verwijderen"}},security:{protected:{title:"Dit document is beveiligd",description:"Dit bestand is beveiligd en sommige functies zijn mogelijk uitgeschakeld. Ga naar Beveiliging in het documentmenu om rechten te bekijken of te ontgrendelen.",viewPermissions:"Rechten bekijken"},viewPermissions:{title:"Documentrechten",description:"Dit bestand is beperkt door de eigenaar en vereist een wachtwoord om bepaalde acties te ontgrendelen.",restrictedActions:"Beperkte acties"},unlock:{label:"Voer eigenaarswachtwoord in om te ontgrendelen",placeholder:"Eigenaarswachtwoord invoeren",button:"Bestand ontgrendelen",invalidPassword:"Ongeldig wachtwoord. Probeer het opnieuw.",failed:"Ontgrendelen mislukt. Probeer het opnieuw.",success:"Eigenaarrechten ontgrendeld! U heeft nu volledige toegang."}},common:{close:"Sluiten",back:"Terug",cancel:"Annuleren"},link:{title:"Link invoegen",url:"URL",page:"Pagina",enterUrl:"URL invoeren",enterPage:"Paginanummer invoeren",pageRange:"Pagina 1 tot {totalPages}",link:"Koppelen"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Verschieben-Modus umschalten"},pointer:{toggle:"Zeiger-Modus umschalten"},capture:{screenshot:"Screenshot",dragTip:"Ziehen Sie, um den Bereich zum Erfassen auszuwählen",title:"Screenshot-Vorschau",download:"Herunterladen",cancel:"Abbrechen"},document:{menu:"Dokument-Menü",open:"Öffnen",close:"Schließen",print:"Drucken",protect:"Sicherheit",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",redaction:"Schwärzungs-Seitenleiste"},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",form:"Formular",redact:"Schwärzen"},form:{textfield:"Textfeld",checkbox:"Kontrollkästchen",radio:"Optionsfeld",select:"Dropdown",listbox:"Listenfeld"},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",inkHighlighter:"Freihand-Textmarker",stamp:"Stempel",caret:"Einfügemarke",insertText:"Text einfügen",replaceText:"Text ersetzen",freeText:"Freitext",square:"Quadrat",style:"Anmerkungsstil",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",deleteAllSelected:"Ausgewählte löschen",multiSelect:"{count} Anmerkungen ausgewählt",group:"Gruppieren",ungroup:"Gruppierung aufheben",moreTools:"Weitere Werkzeuge",addLink:"Link hinzufügen",removeLink:"Link entfernen",gotoLink:"Zum Link gehen",comment:"Kommentar",redact:"Schwärzen",overlayText:"Überlagerungstext",overlayTextPlaceholder:"z.B. GESCHWÄRZT",rotation:"Drehung"},redaction:{redact:"Schwärzen",area:"Bereich schwärzen",text:"Text schwärzen",apply:"Schwärzung anwenden",applyAll:"Alle anwenden",clearAll:"Alle löschen",deleteSelected:"Ausgewählte Schwärzung löschen",commitSelected:"Ausgewählte Schwärzung anwenden",emptyState:"Keine ausstehenden Schwärzungen",panel:{title:"Schwärzungen",itemCount:"{count} ausstehende Schwärzung",itemCountPlural:"{count} ausstehende Schwärzungen",clearAll:"Alle löschen",redactAll:"Alle schwärzen"}},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...",showAllAnnotations:"Alle Anmerkungen anzeigen",closeAllAnnotations:"Alle Anmerkungen schließen",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"},print:{title:"Druckeinstellungen",loading:"Dokument wird vorbereitet...",pages:"Zu druckende Seiten",all:"Alle Seiten",current:"Aktuelle Seite ({currentPage})",specify:"Seiten angeben",specifyEG:"z.B. 1-3, 5, 8-10",total:"Gesamtseitenzahl im Dokument: {totalPages}",annotation:"Anmerkungen einbeziehen",printing:"Drucken...",print:"Drucken",cancel:"Abbrechen"},protect:{title:"Dokument schützen",cancel:"Abbrechen",apply:"Schutz anwenden",applying:"Wird angewendet...",applyFailed:"Schutz konnte nicht angewendet werden. Bitte versuchen Sie es erneut.",removeFailed:"Schutz konnte nicht entfernt werden. Bitte versuchen Sie es erneut.",passwordMismatch:"Passwörter stimmen nicht überein",noProtectionSelected:"Wählen Sie mindestens eine Schutzoption aus.",bothPasswordsNote:"Benutzer, die das Dokumentpasswort eingeben, haben eingeschränkte Berechtigungen. Verwenden Sie das Eigentümerpasswort für vollen Zugriff.",openPassword:{title:"Passwort zum Öffnen erforderlich",description:"Benutzer müssen ein Passwort eingeben, um dieses Dokument anzuzeigen.",label:"Dokumentpasswort",placeholder:"Passwort eingeben",confirm:"Passwort bestätigen",confirmPlaceholder:"Passwort bestätigen"},ownerPassword:{label:"Eigentümerpasswort",placeholder:"Eigentümerpasswort eingeben",confirm:"Eigentümerpasswort bestätigen",confirmPlaceholder:"Eigentümerpasswort bestätigen"},permissions:{title:"Berechtigungen einschränken",description:"Beschränken Sie, was Benutzer mit diesem Dokument tun können.",allowedActions:"Erlaubte Aktionen",print:"Drucken",printHighQuality:"In hoher Qualität drucken",copy:"Inhalt kopieren",accessibility:"Für Barrierefreiheit extrahieren",modify:"Inhalt ändern",annotations:"Anmerkungen & Kommentare hinzufügen/ändern",fillForms:"Formulare ausfüllen & unterschreiben",assemble:"Dokument zusammenstellen & Seiten extrahieren"},encrypted:{title:"Dokument ist geschützt",description:"Dieses Dokument ist vom Eigentümer geschützt. Geben Sie das Eigentümerpasswort ein, um die Sicherheitseinstellungen zu ändern.",enterOwnerPassword:"Eigentümerpasswort eingeben zum Ändern",unlockAndEdit:"Entsperren & Bearbeiten"},modifyProtection:{title:"Schutz ändern",description:"Wählen Sie, wie Sie den Dokumentschutz ändern möchten.",changeOption:"Passwörter oder Berechtigungen ändern",changeDescription:"Aktualisieren Sie das Dokumentpasswort oder die Berechtigungseinstellungen.",removeOption:"Gesamten Schutz entfernen",removeDescription:"Passwortschutz von diesem Dokument entfernen."},removeProtection:{title:"Schutz entfernen",warning:"Sind Sie sicher, dass Sie den Schutz entfernen möchten?",description:"Dadurch wird der gesamte Passwortschutz vom Dokument entfernt. Jeder kann es öffnen und bearbeiten.",confirm:"Schutz entfernen"}},security:{protected:{title:"Dieses Dokument ist geschützt",description:"Diese Datei ist geschützt und einige Funktionen sind möglicherweise deaktiviert. Gehen Sie zu Sicherheit im Dokumentmenü, um Berechtigungen anzuzeigen oder freizuschalten.",viewPermissions:"Berechtigungen anzeigen"},viewPermissions:{title:"Dokumentberechtigungen",description:"Diese Datei ist vom Eigentümer eingeschränkt und erfordert ein Passwort, um bestimmte Aktionen freizuschalten.",restrictedActions:"Eingeschränkte Aktionen"},unlock:{label:"Eigentümerpasswort eingeben zum Entsperren",placeholder:"Eigentümerpasswort eingeben",button:"Datei entsperren",invalidPassword:"Ungültiges Passwort. Bitte versuchen Sie es erneut.",failed:"Entsperren fehlgeschlagen. Bitte versuchen Sie es erneut.",success:"Eigentümerberechtigungen entsperrt! Sie haben jetzt vollen Zugriff."}},common:{close:"Schließen",back:"Zurück",cancel:"Abbrechen"},link:{title:"Link einfügen",url:"URL",page:"Seite",enterUrl:"URL eingeben",enterPage:"Seitennummer eingeben",pageRange:"Seite 1 bis {totalPages}",link:"Verknüpfen"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Basculer le mode déplacement"},pointer:{toggle:"Basculer le mode pointeur"},capture:{screenshot:"Capture d'écran",dragTip:"Faites glisser pour sélectionner la zone à capturer",title:"Aperçu de la capture",download:"Télécharger",cancel:"Annuler"},document:{menu:"Menu Document",open:"Ouvrir",close:"Fermer",print:"Imprimer",protect:"Sécurité",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",redaction:"Barre latérale de caviardage"},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",form:"Formulaire",redact:"Caviarder"},form:{textfield:"Champ de texte",checkbox:"Case à cocher",radio:"Bouton radio",select:"Liste déroulante",listbox:"Zone de liste"},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",inkHighlighter:"Surligneur à encre",stamp:"Tampon",caret:"Curseur",insertText:"Insérer du texte",replaceText:"Remplacer le texte",freeText:"Texte libre",square:"Carré",style:"Style d'annotation",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",deleteAllSelected:"Supprimer la sélection",multiSelect:"{count} annotations sélectionnées",group:"Grouper",ungroup:"Dissocier",moreTools:"Plus d'outils",addLink:"Ajouter un lien",removeLink:"Supprimer le lien",gotoLink:"Aller au lien",comment:"Commentaire",redact:"Caviarder",overlayText:"Texte de superposition",overlayTextPlaceholder:"ex: CAVIARDÉ",rotation:"Rotation"},redaction:{redact:"Caviarder",area:"Caviarder la zone",text:"Caviarder le texte",apply:"Appliquer le caviardage",applyAll:"Tout appliquer",clearAll:"Tout effacer",deleteSelected:"Supprimer la rédaction sélectionnée",commitSelected:"Appliquer la rédaction sélectionnée",emptyState:"Aucun caviardage en attente",panel:{title:"Caviardages",itemCount:"{count} caviardage en attente",itemCountPlural:"{count} caviardages en attente",clearAll:"Tout effacer",redactAll:"Tout caviarder"}},history:{undo:"Annuler",redo:"Refaire"},comments:{page:"Page {page}",commentCount:"{count} commentaire",commentCountPlural:"{count} commentaires",addComment:"Ajouter un commentaire...",addReply:"Ajouter une réponse...",showAllAnnotations:"Afficher toutes les annotations",closeAllAnnotations:"Fermer toutes les annotations",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é"},print:{title:"Paramètres d'impression",loading:"Préparation du document...",pages:"Pages à imprimer",all:"Toutes les pages",current:"Page actuelle ({currentPage})",specify:"Spécifier les pages",specifyEG:"ex : 1-3, 5, 8-10",total:"Nombre total de pages dans le document : {totalPages}",annotation:"Inclure les annotations",printing:"Impression...",print:"Imprimer",cancel:"Annuler"},protect:{title:"Protéger le document",cancel:"Annuler",apply:"Appliquer la protection",applying:"Application en cours...",applyFailed:"Échec de l'application de la protection. Veuillez réessayer.",removeFailed:"Échec de la suppression de la protection. Veuillez réessayer.",passwordMismatch:"Les mots de passe ne correspondent pas",noProtectionSelected:"Sélectionnez au moins une option de protection.",bothPasswordsNote:"Les utilisateurs qui ouvrent avec le mot de passe du document auront des permissions limitées. Utilisez le mot de passe propriétaire pour un accès complet.",openPassword:{title:"Mot de passe requis pour l'ouverture",description:"Les utilisateurs doivent entrer un mot de passe pour voir ce document.",label:"Mot de passe du document",placeholder:"Entrer le mot de passe",confirm:"Confirmer le mot de passe",confirmPlaceholder:"Confirmer le mot de passe"},ownerPassword:{label:"Mot de passe propriétaire",placeholder:"Entrer le mot de passe propriétaire",confirm:"Confirmer le mot de passe propriétaire",confirmPlaceholder:"Confirmer le mot de passe propriétaire"},permissions:{title:"Restreindre les permissions",description:"Limitez ce que les utilisateurs peuvent faire avec ce document.",allowedActions:"Actions autorisées",print:"Imprimer",printHighQuality:"Imprimer en haute qualité",copy:"Copier le contenu",accessibility:"Extraire pour l'accessibilité",modify:"Modifier le contenu",annotations:"Ajouter/modifier les annotations et commentaires",fillForms:"Remplir les formulaires et signer",assemble:"Assembler le document et extraire les pages"},encrypted:{title:"Document protégé",description:"Ce document est protégé par le propriétaire. Entrez le mot de passe propriétaire pour modifier les paramètres de sécurité.",enterOwnerPassword:"Entrer le mot de passe propriétaire pour modifier",unlockAndEdit:"Déverrouiller & Modifier"},modifyProtection:{title:"Modifier la protection",description:"Choisissez comment vous voulez modifier la protection du document.",changeOption:"Modifier les mots de passe ou les permissions",changeDescription:"Mettre à jour le mot de passe du document ou les paramètres de permissions.",removeOption:"Supprimer toute la protection",removeDescription:"Supprimer la protection par mot de passe de ce document."},removeProtection:{title:"Supprimer la protection",warning:"Êtes-vous sûr de vouloir supprimer la protection ?",description:"Cela supprimera toute la protection par mot de passe du document. Tout le monde pourra l'ouvrir et le modifier.",confirm:"Supprimer la protection"}},security:{protected:{title:"Ce document est protégé",description:"Ce fichier est protégé et certaines fonctionnalités peuvent être désactivées. Allez dans Sécurité dans le menu document pour afficher ou déverrouiller les permissions.",viewPermissions:"Voir les permissions"},viewPermissions:{title:"Permissions du document",description:"Ce fichier est restreint par le propriétaire et nécessite un mot de passe pour débloquer certaines actions.",restrictedActions:"Actions restreintes"},unlock:{label:"Entrer le mot de passe propriétaire pour déverrouiller",placeholder:"Entrer le mot de passe propriétaire",button:"Déverrouiller le fichier",invalidPassword:"Mot de passe invalide. Veuillez réessayer.",failed:"Échec du déverrouillage. Veuillez réessayer.",success:"Permissions propriétaire déverrouillées ! Vous avez maintenant un accès complet."}},common:{close:"Fermer",back:"Retour",cancel:"Annuler"},link:{title:"Insérer un lien",url:"URL",page:"Page",enterUrl:"Entrer l'URL",enterPage:"Entrer le numéro de page",pageRange:"Page 1 à {totalPages}",link:"Lier"}}},{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}%)",dragTip:"Drag to select area to zoom"},pan:{toggle:"Alternar modo desplazamiento"},pointer:{toggle:"Alternar modo puntero"},capture:{screenshot:"Captura de pantalla",dragTip:"Arrastre para seleccionar el área a capturar",title:"Vista previa de la captura",download:"Descargar",cancel:"Cancelar"},document:{menu:"Menú del documento",open:"Abrir",close:"Cerrar",print:"Imprimir",protect:"Seguridad",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",redaction:"Barra lateral de redacció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",form:"Formulario",redact:"Redactar"},form:{textfield:"Campo de texto",checkbox:"Casilla",radio:"Botón de radio",select:"Desplegable",listbox:"Cuadro de lista"},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",inkHighlighter:"Resaltador de tinta",stamp:"Sello",caret:"Cursor",insertText:"Insertar texto",replaceText:"Reemplazar texto",freeText:"Texto libre",square:"Cuadrado",style:"Estilo de anotación",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",deleteAllSelected:"Eliminar selección",multiSelect:"{count} anotaciones seleccionadas",group:"Agrupar",ungroup:"Desagrupar",moreTools:"Más herramientas",addLink:"Agregar enlace",removeLink:"Eliminar enlace",gotoLink:"Ir al enlace",comment:"Comentario",redact:"Redactar",overlayText:"Texto superpuesto",overlayTextPlaceholder:"ej: REDACTADO",rotation:"Rotación"},redaction:{redact:"Redactar",area:"Redactar área",text:"Redactar texto",apply:"Aplicar redacción",applyAll:"Aplicar todo",clearAll:"Borrar todo",deleteSelected:"Eliminar redacción seleccionada",commitSelected:"Aplicar redacción seleccionada",emptyState:"No hay redacciones pendientes",panel:{title:"Redacciones",itemCount:"{count} redacción pendiente",itemCountPlural:"{count} redacciones pendientes",clearAll:"Borrar todo",redactAll:"Redactar 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...",showAllAnnotations:"Mostrar todas las anotaciones",closeAllAnnotations:"Cerrar todas las anotaciones",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"},print:{title:"Configuración de impresión",loading:"Preparando documento...",pages:"Páginas a imprimir",all:"Todas las páginas",current:"Página actual ({currentPage})",specify:"Especificar páginas",specifyEG:"ej: 1-3, 5, 8-10",total:"Total de páginas en el documento: {totalPages}",annotation:"Incluir anotaciones",printing:"Imprimiendo...",print:"Imprimir",cancel:"Cancelar"},protect:{title:"Proteger documento",cancel:"Cancelar",apply:"Aplicar protección",applying:"Aplicando...",applyFailed:"No se pudo aplicar la protección. Por favor, inténtelo de nuevo.",removeFailed:"No se pudo eliminar la protección. Por favor, inténtelo de nuevo.",passwordMismatch:"Las contraseñas no coinciden",noProtectionSelected:"Seleccione al menos una opción de protección.",bothPasswordsNote:"Los usuarios que abran con la contraseña del documento tendrán permisos restringidos. Use la contraseña de propietario para acceso completo.",openPassword:{title:"Contraseña requerida para abrir",description:"Los usuarios deben ingresar una contraseña para ver este documento.",label:"Contraseña del documento",placeholder:"Ingresar contraseña",confirm:"Confirmar contraseña",confirmPlaceholder:"Confirmar contraseña"},ownerPassword:{label:"Contraseña de propietario",placeholder:"Ingresar contraseña de propietario",confirm:"Confirmar contraseña de propietario",confirmPlaceholder:"Confirmar contraseña de propietario"},permissions:{title:"Restringir permisos",description:"Limite lo que los usuarios pueden hacer con este documento.",allowedActions:"Acciones permitidas",print:"Imprimir",printHighQuality:"Imprimir alta calidad",copy:"Copiar contenido",accessibility:"Extraer para accesibilidad",modify:"Modificar contenido",annotations:"Añadir/modificar anotaciones y comentarios",fillForms:"Rellenar formularios y firmar",assemble:"Ensamblar documento y extraer páginas"},encrypted:{title:"Documento protegido",description:"Este documento está protegido por el propietario. Ingrese la contraseña de propietario para modificar la configuración de seguridad.",enterOwnerPassword:"Ingrese la contraseña de propietario para modificar",unlockAndEdit:"Desbloquear y Editar"},modifyProtection:{title:"Modificar protección",description:"Elija cómo desea modificar la protección del documento.",changeOption:"Cambiar contraseñas o permisos",changeDescription:"Actualizar la contraseña del documento o la configuración de permisos.",removeOption:"Eliminar toda la protección",removeDescription:"Eliminar la protección por contraseña de este documento."},removeProtection:{title:"Eliminar protección",warning:"¿Está seguro de que desea eliminar la protección?",description:"Esto eliminará toda la protección por contraseña del documento. Cualquiera podrá abrirlo y modificarlo.",confirm:"Eliminar protección"}},security:{protected:{title:"Este documento está protegido",description:"Este archivo está protegido y algunas funciones pueden estar deshabilitadas. Vaya a Seguridad en el menú del documento para ver o desbloquear los permisos.",viewPermissions:"Ver permisos"},viewPermissions:{title:"Permisos del documento",description:"Este archivo está restringido por el propietario y requiere una contraseña para desbloquear ciertas acciones.",restrictedActions:"Acciones restringidas"},unlock:{label:"Ingrese la contraseña de propietario para desbloquear",placeholder:"Ingresar contraseña de propietario",button:"Desbloquear archivo",invalidPassword:"Contraseña inválida. Por favor, inténtelo de nuevo.",failed:"Error al desbloquear. Por favor, inténtelo de nuevo.",success:"¡Permisos de propietario desbloqueados! Ahora tiene acceso completo."}},common:{close:"Cerrar",back:"Atrás",cancel:"Cancelar"},link:{title:"Insertar enlace",url:"URL",page:"Página",enterUrl:"Introducir URL",enterPage:"Introducir número de página",pageRange:"Página 1 a {totalPages}",link:"Enlazar"}}},{code:"zh-CN",name:"简体中文",translations:{search:{placeholder:"搜索",caseSensitive:"大小写敏感",wholeWord:"全词匹配",resultsFound:"{count} 个结果",page:"第{page}页"},zoom:{in:"放大",out:"缩小",fitWidth:"适合宽度",fitPage:"适合页面",marquee:"框选放大",menu:"缩放菜单",level:"缩放比例 ({level}%)",dragTip:"拖动鼠标选择要放大的区域"},pan:{toggle:"拖动模式"},pointer:{toggle:"光标模式"},capture:{screenshot:"截图",dragTip:"拖动鼠标选择要截取的区域",title:"截取的PDF区域",download:"下载",cancel:"取消"},document:{menu:"文件选项",open:"打开",close:"关闭",print:"打印",protect:"安全",export:"导出",fullscreen:"全屏",loading:"文件加载中..."},emptyState:{title:"尚无打开的文件",description:"请点击“+ 打开文件”按钮选择并打开一个PDF文件。",descriptionMulti:"您可以使用标签页同时打开多个文件。",openButton:"打开文件",supportedFormats:"支持的文件格式为: PDF"},passwordPrompt:{title:"请输入密码",required:"该文件设置有密码保护,要打开文件请输入密码。",incorrect:"你输入的密码错误,请重新输入。",incorrectWarning:"密码错误,请检查后重新输入。",label:"密码",placeholder:"请输入文件密码",open:"打开",opening:"打开中...",cancel:"取消",close:"关闭"},documentError:{title:"文件加载出错",unknown:"未知错误",errorCode:"错误码: {code}",close:"关闭文件"},panel:{sidebar:"大纲与书签",search:"搜索",comment:"评论",thumbnails:"缩略图",outline:"大纲",annotationStyle:"批注样式",redaction:"遮蔽侧边栏"},menu:{viewControls:"视图控件",zoomControls:"缩放控件",moreOptions:"更多选项"},outline:{title:"大纲",loading:"大纲加载中...",noOutline:"没有大纲",noBookmarks:"该文件不含书签"},page:{settings:"页面设置",single:"单页视图",twoOdd:"双页视图",twoEven:"书籍视图",vertical:"垂直滚动",horizontal:"水平滚动",spreadMode:"跨页模式",scrollLayout:"滚动布局",rotation:"页面转向",next:"下一页",previous:"上一页"},rotate:{clockwise:"顺时针旋转",counterClockwise:"逆时针旋转"},selection:{copy:"复制"},mode:{view:"阅读",annotate:"批注",shapes:"形状",form:"表单",redact:"遮蔽"},form:{textfield:"文本框",checkbox:"复选框",radio:"单选按钮",select:"下拉列表",listbox:"列表框"},annotation:{text:"任意文本",highlight:"高亮",strikeout:"删除线",underline:"下划线",squiggly:"下划曲线",rectangle:"矩形",circle:"圆形",line:"直线",arrow:"带箭头直线",polygon:"多边形",polyline:"多段线",ink:"自由绘制",inkHighlighter:"墨迹荧光笔",stamp:"印章",caret:"插入符号",insertText:"插入文本",replaceText:"替换文本",freeText:"任意文本",square:"矩形",style:"批注样式",styles:"{type} 样式",defaults:"{type} 默认值",color:"颜色",opacity:"透明度",blendMode:"混合模式",strokeWidth:"线条宽度",strokeColor:"线条颜色",borderStyle:"线条样式",fillColor:"填充色",fontSize:"字号",fontFamily:"字体",textAlign:"左右对齐",verticalAlign:"上下对齐",lineEnding:"行尾",lineStart:"线条起点",lineEnd:"线条结尾",font:"字体",fontColor:"字色",backgroundColor:"背景色",noStyles:"该批注无需设置样式。",noStylesStamp:"印章无需设置样式。",selectAnnotation:"在此处查看选中批注的样式。",deleteSelected:"删除选中的批注",deleteAllSelected:"删除选中",multiSelect:"已选择 {count} 个批注",group:"分组",ungroup:"取消分组",moreTools:"更多工具",addLink:"添加链接",removeLink:"移除链接",gotoLink:"跳转到链接",comment:"评论",redact:"遮蔽",overlayText:"覆盖文字",overlayTextPlaceholder:"例如:已遮蔽",rotation:"旋转"},redaction:{redact:"遮蔽",area:"遮蔽区域",text:"遮蔽文本",apply:"应用遮蔽",applyAll:"全部应用",clearAll:"全部取消",deleteSelected:"取消遮蔽",commitSelected:"应用遮蔽",emptyState:"暂无待处理的遮蔽",panel:{title:"遮蔽",itemCount:"{count} 个待处理遮蔽",itemCountPlural:"{count} 个待处理遮蔽",clearAll:"全部取消",redactAll:"全部遮蔽"}},history:{undo:"撤销",redo:"恢复"},comments:{page:"第{page}页",commentCount:"{count}条评论",commentCountPlural:"{count}条评论",addComment:"新增评论...",addReply:"新增回复...",showAllAnnotations:"显示所有注释",closeAllAnnotations:"关闭所有注释",save:"保存",cancel:"取消",edit:"编辑",delete:"删除",showMore:"展开",showLess:"收起",emptyState:"添加批注后,可以在这里对批注进行评论。"},blendMode:{normal:"正常",multiply:"正片",screen:"屏幕",overlay:"叠加",darken:"变暗",lighten:"变亮",colorDodge:"色彩减淡",colorBurn:"颜色加深",hardLight:"强光",softLight:"柔光",difference:"差值",exclusion:"排除",hue:"色相",saturation:"饱和度",color:"颜色",luminosity:"亮度"},print:{title:"打印设置",loading:"正在处理...",pages:"要打印的页码",all:"所有页",current:"当前页({currentPage})",specify:"指定页",specifyEG:"例如:1-3, 5, 8-10",total:"文档总页数:{totalPages}",annotation:"包含批注",printing:"打印中...",print:"打印",cancel:"取消"},protect:{title:"文档保护",cancel:"取消",apply:"应用保护",applying:"正在应用...",applyFailed:"无法应用保护。请重试。",removeFailed:"无法移除保护。请重试。",passwordMismatch:"密码不匹配",noProtectionSelected:"请至少选择一种保护方式。",bothPasswordsNote:"使用文档密码打开的用户将受到权限限制。使用所有者密码可获得完全访问权限。",openPassword:{title:"需要密码才能打开",description:"用户必须输入密码才能查看此文档。",label:"文档密码",placeholder:"输入密码",confirm:"确认密码",confirmPlaceholder:"确认密码"},ownerPassword:{label:"所有者密码",placeholder:"输入所有者密码",confirm:"确认所有者密码",confirmPlaceholder:"确认所有者密码"},permissions:{title:"限制权限",description:"限制用户对此文档的操作。",allowedActions:"允许的操作",print:"打印",printHighQuality:"高质量打印",copy:"复制内容",accessibility:"提取辅助功能",modify:"修改内容",annotations:"添加/修改批注和评论",fillForms:"填写表单和签名",assemble:"组装文档和提取页面"},encrypted:{title:"文档受保护",description:"此文档已被所有者保护。请输入所有者密码以修改安全设置。",enterOwnerPassword:"输入所有者密码以修改",unlockAndEdit:"解锁并编辑"},modifyProtection:{title:"修改保护",description:"选择如何修改文档保护。",changeOption:"更改密码或权限",changeDescription:"更新文档密码或权限设置。",removeOption:"移除所有保护",removeDescription:"移除此文档的密码保护。"},removeProtection:{title:"移除保护",warning:"确定要移除保护吗?",description:"这将移除文档的所有密码保护。任何人都可以打开和修改它。",confirm:"移除保护"}},security:{protected:{title:"此文档受保护",description:'此文件受保护,某些功能可能被禁用。请在文档菜单中点击"安全"以查看或解锁权限。',viewPermissions:"查看权限"},viewPermissions:{title:"文档权限",description:"此文件受所有者限制,需要密码才能解锁某些操作。",restrictedActions:"受限操作"},unlock:{label:"输入所有者密码以解锁文件",placeholder:"输入所有者密码",button:"解锁文件",invalidPassword:"密码无效。请重试。",failed:"解锁失败。请重试。",success:"所有者权限已解锁!您现在拥有完全访问权限。"}},common:{close:"关闭",back:"返回",cancel:"取消"},link:{title:"插入链接",url:"网址",page:"页面",enterUrl:"输入网址",enterPage:"输入页码",pageRange:"第1页到第{totalPages}页",link:"链接"}}},{code:"ja",name:"日本語",translations:{search:{placeholder:"検索",caseSensitive:"大文字小文字を区別",wholeWord:"単語単位で検索",resultsFound:"{count}件見つかりました",page:"{page}ページ"},zoom:{in:"拡大",out:"縮小",fitWidth:"幅に合わせる",fitPage:"ページに合わせる",marquee:"範囲選択ズーム",menu:"ズームメニュー",level:"ズーム ({level}%)",dragTip:"ドラッグしてズーム範囲を選択"},pan:{toggle:"パンモードの切り替え"},pointer:{toggle:"ポインターモードの切り替え"},capture:{screenshot:"スクリーンショット",dragTip:"ドラッグしてキャプチャ範囲を選択",title:"スクリーンショットプレビュー",download:"ダウンロード",cancel:"キャンセル"},document:{menu:"ドキュメントメニュー",open:"開く",close:"閉じる",print:"印刷",protect:"セキュリティ",export:"エクスポート",fullscreen:"全画面表示",loading:"ドキュメントを読み込み中..."},emptyState:{title:"ドキュメントが開かれていません",description:"PDFドキュメントを開いて始めましょう。",descriptionMulti:"タブを使って複数のドキュメントを表示できます。",openButton:"ドキュメントを開く",supportedFormats:"対応フォーマット: PDF"},passwordPrompt:{title:"パスワードが必要です",required:"このドキュメントはパスワードで保護されています。パスワードを入力してください。",incorrect:"入力されたパスワードが正しくありません。もう一度お試しください。",incorrectWarning:"パスワードが正しくありません。確認してもう一度お試しください。",label:"パスワード",placeholder:"ドキュメントのパスワードを入力",open:"開く",opening:"開いています...",cancel:"キャンセル",close:"閉じる"},documentError:{title:"ドキュメントの読み込みエラー",unknown:"不明なエラーが発生しました",errorCode:"エラーコード: {code}",close:"ドキュメントを閉じる"},panel:{sidebar:"サイドバー",search:"検索",comment:"コメント",thumbnails:"サムネイル",outline:"アウトライン",annotationStyle:"注釈スタイル",redaction:"黒塗りサイドバー"},menu:{viewControls:"表示コントロール",zoomControls:"ズームコントロール",moreOptions:"その他のオプション"},outline:{title:"アウトライン",loading:"アウトラインを読み込み中...",noOutline:"アウトラインがありません",noBookmarks:"このドキュメントにはブックマークがありません"},page:{settings:"ページ設定",single:"単一ページ",twoOdd:"見開き(奇数)",twoEven:"見開き(偶数)",vertical:"縦方向",horizontal:"横方向",spreadMode:"見開きモード",scrollLayout:"スクロールレイアウト",rotation:"ページ回転",next:"次のページ",previous:"前のページ"},rotate:{clockwise:"時計回りに回転",counterClockwise:"反時計回りに回転"},selection:{copy:"選択範囲をコピー"},mode:{view:"表示",annotate:"注釈",shapes:"図形",form:"フォーム",redact:"黒塗り"},form:{textfield:"テキストフィールド",checkbox:"チェックボックス",radio:"ラジオボタン",select:"ドロップダウン",listbox:"リストボックス"},annotation:{text:"テキスト",highlight:"ハイライト",strikeout:"取り消し線",underline:"下線",squiggly:"波線",rectangle:"四角形",circle:"円",line:"線",arrow:"矢印",polygon:"多角形",polyline:"折れ線",ink:"インク",inkHighlighter:"インク蛍光ペン",stamp:"スタンプ",freeText:"フリーテキスト",square:"正方形",style:"注釈スタイル",styles:"{type}のスタイル",defaults:"{type}のデフォルト",color:"色",opacity:"不透明度",blendMode:"ブレンドモード",strokeWidth:"線の太さ",strokeColor:"線の色",borderStyle:"枠線のスタイル",fillColor:"塗りつぶしの色",fontSize:"フォントサイズ",fontFamily:"フォント",textAlign:"テキスト配置",verticalAlign:"縦方向の配置",lineEnding:"線の端点",lineStart:"始点",lineEnd:"終点",font:"フォント",fontColor:"フォントの色",backgroundColor:"背景色",noStyles:"この注釈にはスタイルがありません。",noStylesStamp:"スタンプにはスタイルがありません。",selectAnnotation:"注釈を選択してスタイルを表示",deleteSelected:"選択した注釈を削除",deleteAllSelected:"選択を削除",multiSelect:"{count}件の注釈が選択されています",group:"グループ化",ungroup:"グループ解除",moreTools:"その他のツール",addLink:"リンクを追加",removeLink:"リンクを削除",gotoLink:"リンク先へ移動",comment:"コメント",redact:"黒塗り",overlayText:"オーバーレイテキスト",overlayTextPlaceholder:"例: 黒塗り済み",rotation:"回転"},redaction:{redact:"黒塗り",area:"範囲の黒塗り",text:"テキストの黒塗り",apply:"黒塗りを適用",applyAll:"すべて適用",clearAll:"すべてクリア",deleteSelected:"選択した黒塗りを削除",commitSelected:"選択した黒塗りを適用",emptyState:"保留中の黒塗りはありません",panel:{title:"黒塗り",itemCount:"{count}件の保留中の黒塗り",itemCountPlural:"{count}件の保留中の黒塗り",clearAll:"すべてクリア",redactAll:"すべて黒塗り"}},history:{undo:"元に戻す",redo:"やり直す"},comments:{page:"{page}ページ",commentCount:"{count}件のコメント",commentCountPlural:"{count}件のコメント",addComment:"コメントを追加...",addReply:"返信を追加...",showAllAnnotations:"すべての注釈を表示",closeAllAnnotations:"すべての注釈を閉じる",save:"保存",cancel:"キャンセル",edit:"編集",delete:"削除",showMore:"もっと見る",showLess:"閉じる",emptyState:"注釈を追加してコメントできるようにしましょう。"},blendMode:{normal:"通常",multiply:"乗算",screen:"スクリーン",overlay:"オーバーレイ",darken:"暗く",lighten:"明るく",colorDodge:"覆い焼きカラー",colorBurn:"焼き込みカラー",hardLight:"ハードライト",softLight:"ソフトライト",difference:"差の絶対値",exclusion:"除外",hue:"色相",saturation:"彩度",color:"カラー",luminosity:"輝度"},print:{title:"印刷設定",loading:"ドキュメントを準備中...",pages:"印刷するページ",all:"すべてのページ",current:"現在のページ ({currentPage})",specify:"ページを指定",specifyEG:"例: 1-3, 5, 8-10",total:"ドキュメントの総ページ数: {totalPages}",annotation:"注釈を含める",printing:"印刷中...",print:"印刷",cancel:"キャンセル"},protect:{title:"ドキュメントの保護",cancel:"キャンセル",apply:"保護を適用",applying:"適用中...",applyFailed:"保護の適用に失敗しました。もう一度お試しください。",removeFailed:"保護の解除に失敗しました。もう一度お試しください。",passwordMismatch:"パスワードが一致しません",noProtectionSelected:"適用する保護オプションを少なくとも1つ選択してください。",bothPasswordsNote:"ドキュメントパスワードで開いたユーザーは権限が制限されます。オーナーパスワードを使用すると完全なアクセスが可能になります。",openPassword:{title:"開くにはパスワードが必要",description:"このドキュメントを表示するにはパスワードの入力が必要です。",label:"ドキュメントパスワード",placeholder:"パスワードを入力",confirm:"パスワードの確認",confirmPlaceholder:"パスワードを確認"},ownerPassword:{label:"オーナーパスワード",placeholder:"オーナーパスワードを入力",confirm:"オーナーパスワードの確認",confirmPlaceholder:"オーナーパスワードを確認"},permissions:{title:"権限を制限",description:"このドキュメントでユーザーが行える操作を制限します。",allowedActions:"許可された操作",print:"印刷",printHighQuality:"高品質印刷",copy:"コンテンツのコピー",accessibility:"アクセシビリティのための抽出",modify:"コンテンツの変更",annotations:"注釈・コメントの追加/変更",fillForms:"フォームの入力と署名",assemble:"ページの組み立てと抽出"},encrypted:{title:"ドキュメントは保護されています",description:"このドキュメントはオーナーによって保護されています。セキュリティ設定を変更するにはオーナーパスワードを入力してください。",enterOwnerPassword:"オーナーパスワードを入力して変更",unlockAndEdit:"ロック解除して編集"},modifyProtection:{title:"保護の変更",description:"ドキュメントの保護をどのように変更するか選択してください。",changeOption:"パスワードまたは権限を変更",changeDescription:"ドキュメントパスワードまたは権限設定を更新します。",removeOption:"すべての保護を解除",removeDescription:"このドキュメントからパスワード保護を解除します。"},removeProtection:{title:"保護の解除",warning:"保護を解除してもよろしいですか?",description:"ドキュメントからすべてのパスワード保護が解除されます。誰でもドキュメントを開いて変更できるようになります。",confirm:"保護を解除"}},security:{protected:{title:"このドキュメントは保護されています",description:"このファイルは保護されており、一部の機能が無効になっている場合があります。ドキュメントメニューのセキュリティから権限を確認またはロック解除できます。",viewPermissions:"権限を表示"},viewPermissions:{title:"ドキュメントの権限",description:"このファイルはオーナーによって制限されており、特定の操作をロック解除するにはパスワードが必要です。",restrictedActions:"制限された操作"},unlock:{label:"オーナーパスワードを入力してロック解除",placeholder:"オーナーパスワードを入力",button:"ファイルのロックを解除",invalidPassword:"パスワードが無効です。もう一度お試しください。",failed:"ロック解除に失敗しました。もう一度お試しください。",success:"オーナー権限がロック解除されました!完全なアクセスが可能になりました。"}},common:{close:"閉じる",back:"戻る",cancel:"キャンセル"},link:{title:"リンクの挿入",url:"URL",page:"ページ",enterUrl:"URLを入力",enterPage:"ページ番号を入力",pageRange:"1~{totalPages}ページ",link:"リンク"}}},{code:"sv",name:"Svenska",translations:{search:{placeholder:"Sök",caseSensitive:"Skiftlägeskänslig",wholeWord:"Hela ord",resultsFound:"{count} träffar",page:"Sida {page}"},zoom:{in:"Zooma in",out:"Zooma ut",fitWidth:"Sidbredd",fitPage:"Sidnivå",marquee:"Zooma till markering",menu:"Zoommeny",level:"Zoomnivå ({level}%)",dragTip:"Dra för att välja ett område att zooma in på"},pan:{toggle:"Panorera"},pointer:{toggle:"Välj"},capture:{screenshot:"Skärmdumpa",dragTip:"Dra för att välja område",title:"Förhandsgranskning",download:"Ladda ned",cancel:"Avbryt"},document:{menu:"Filmeny",open:"Öppna",close:"Stäng",print:"Skriv ut",protect:"Säkerhet",export:"Ladda ned",fullscreen:"Helskärmsläge",loading:"Läser in dokumentet..."},emptyState:{title:"Ingen fil är öppen",description:"Öppna en pdf för att komma igång.",descriptionMulti:"Du kan växla mellan olika filer med hjälp av flikar.",openButton:"Öppna fil",supportedFormats:"Format som stöds: PDF"},passwordPrompt:{title:"Lösenord krävs",required:"Den här filen är lösenordsskyddad. Skriv in lösenordet för att öppna den.",incorrect:"Lösenordet du skrev in var fel. Var god försök igen.",incorrectWarning:"Fel lösenord. Kontrollera att du skrivit rätt och försök igen.",label:"Lösenord",placeholder:"Skriv in filens lösenord",open:"Öppna",opening:"Öppnar...",cancel:"Avbryt",close:"Stäng"},documentError:{title:"Fel när dokumentet lästes in",unknown:"Ett okänt fel inträffade",errorCode:"Felkod: {code}",close:"Stäng dokumentet"},panel:{sidebar:"Sidofält",search:"Sök",comment:"Kommentera",thumbnails:"Miniatyrbilder",outline:"Dokumentdisposition",annotationStyle:"Annoteringsstil",redaction:"Sidofält för maskning"},menu:{viewControls:"Visa kontroller",zoomControls:"Zoomkontroller",moreOptions:"Fler alternativ"},outline:{title:"Dokumentdisposition",loading:"Läser in disposition...",noOutline:"Ingen disposition tillgänglig",noBookmarks:"Det här dokumentet har inga bokmärken"},page:{settings:"Sidinställningar",single:"Enkelsidig vy",twoOdd:"Dubbelsidig vy (Udda)",twoEven:"Dubbelsidig vy (Jämna)",vertical:"Lodrätt",horizontal:"Vågrätt",spreadMode:"Vy",scrollLayout:"Skrollningsläge",rotation:"Rotera",next:"Nästa sida",previous:"Föregående sida"},rotate:{clockwise:"Rotera medurs",counterClockwise:"Rotera moturs"},selection:{copy:"Kopiera markering"},mode:{view:"Läsvy",annotate:"Annotera",shapes:"Rita former",form:"Formulär",redact:"Maskera"},form:{textfield:"Textfält",checkbox:"Kryssruta",radio:"Alternativknapp",select:"Rullgardinsmeny",listbox:"Listruta"},annotation:{text:"Text",highlight:"Överstrykningspenna",strikeout:"Genomstruken",underline:"Understruken",squiggly:"Vågig",rectangle:"Rektangel",circle:"Cirkel",line:"Linje",arrow:"Pil",polygon:"Polygon",polyline:"Flerpunktslinje",ink:"Bläck",inkHighlighter:"Bläcköverstrykningspenna",stamp:"Stämpel",freeText:"Fritext",square:"Kvadrat",style:"Annoteringsstil",styles:"{type}stilar",defaults:"{type}förval",color:"Färg",opacity:"Genomskinlighet",blendMode:"Blandningsläge",strokeWidth:"Linjebredd",strokeColor:"Linjefärg",borderStyle:"Kantlinjestil",fillColor:"Fyllningsfärg",fontSize:"Teckenstorlek",fontFamily:"Typsnitt",textAlign:"Justering",verticalAlign:"Vertikal justering",lineEnding:"Linjeslut",lineStart:"Linjestart",lineEnd:"Linjeslut",font:"Typsnitt",fontColor:"Teckenfärg",backgroundColor:"Bakgrundsfärg",noStyles:"Den här annoteringen har inga valda stilar.",noStylesStamp:"Inga stilar finns tillgängliga.",selectAnnotation:"Välj en annotering för att se stilalternativ.",deleteSelected:"Ta bort vald annotering",deleteAllSelected:"Ta bort alla valda",multiSelect:"{count} annoteringar valda",group:"Gruppera",ungroup:"Lös upp grupp",moreTools:"Fler verktyg",addLink:"Lägg till länk",removeLink:"Ta bort länk",gotoLink:"Gå till länk",comment:"Kommentera",redact:"Maskera",overlayText:"Textöverlägg",overlayTextPlaceholder:"t.ex., MASKERAD",rotation:"Rotera"},redaction:{redact:"Maskera",area:"Maskera område",text:"Maskera text",apply:"Tillämpa maskering",applyAll:"Tillämpa alla",clearAll:"Rensa alla",deleteSelected:"Ta bort vald maskering",commitSelected:"Tillämpa vald maskering",emptyState:"Inget väntar på att maskeras",panel:{title:"Maskering",itemCount:"{count} väntar på att maskeras",itemCountPlural:"{count} väntar på att maskeras",clearAll:"Rensa alla",redactAll:"Maskera alla"}},history:{undo:"Ångra",redo:"Gör om"},comments:{page:"Sida {page}",commentCount:"{count} kommentar",commentCountPlural:"{count} kommentarer",addComment:"Lägg till kommentar...",addReply:"Lägg till svar...",showAllAnnotations:"Visa alla anteckningar",closeAllAnnotations:"Stäng alla anteckningar",save:"Spara",cancel:"Avbryt",edit:"Redigera",delete:"Radera",showMore:"mer",showLess:"mindre",emptyState:"Lägg till annoteringar för att kunna kommentera dem."},blendMode:{normal:"Normal",multiply:"Multiplicera",screen:"Skärm",overlay:"Täck över",darken:"Mörkare",lighten:"Ljusare",colorDodge:"Färgskugga",colorBurn:"Efterbelys färg",hardLight:"Skarpt ljus",softLight:"Mjukt ljus",difference:"Differens",exclusion:"Uteslutning",hue:"Nyans",saturation:"Mättnad",color:"Färg",luminosity:"Luminiscens"},print:{title:"Utskriftsinställningar",loading:"Förbereder dokument...",pages:"Sidor att skriva ut",all:"Alla sidor",current:"Aktuell sida ({currentPage})",specify:"Välj sidor",specifyEG:"t.ex. 1-3, 5, 8-10",total:"Totalt antal sidor i dokumentet: {totalPages}",annotation:"Inkludera annoteringar",printing:"Skriver ut...",print:"Skriv ut",cancel:"Avbryt"},protect:{title:"Skydda dokumentet",cancel:"Avbryt",apply:"Tillämpa skydd",applying:"Tillämpar...",applyFailed:"Misslyckades med att tillämpa skydd. Var god försök igen.",removeFailed:"Misslyckades med att ta bort skydd. Var god försök igen.",passwordMismatch:"Lösenorden stämmer inte överens",noProtectionSelected:"Välj minst ett alternativ att tillämpa.",bothPasswordsNote:"Användare som öppnar dokumentet med lösenordet kommer ha begränsade behörigheter. Använd ägarlösenordet för att låsa upp alla behörigheter.",openPassword:{title:"Kräv lösenord för att öppna fil",description:"Användare måste skriva in ett lösenord för att öppna dokumentet.",label:"Dokumentlösenord",placeholder:"Skriv in lösenord",confirm:"Bekräfta lösenord",confirmPlaceholder:"Bekräfta lösenord"},ownerPassword:{label:"Ägarlösenord",placeholder:"Skriv in ägarlösenord",confirm:"Bekräfta ägarlösenord",confirmPlaceholder:"Bekräfta ägarlösenord"},permissions:{title:"Begränsa behörigheter",description:"Begränsa vad användaren kan göra med dokumentet.",allowedActions:"Tillåtna handlingar",print:"Skriv ut",printHighQuality:"Skriv ut i hög kvalitet",copy:"Kopiera innehåll",accessibility:"Extrahera för tillgänglighet",modify:"Ändra innehåll",annotations:"Lägga till/ändra annoteringar & kommentarer",fillForms:"Fylla i formulär & signera",assemble:"Ordna sidor"},encrypted:{title:"Dokumentet är skyddat",description:"Det här dokumentet skyddas av ägaren. Skriv in ägarlösenordet för att ändra säkerhetsinställningarna.",enterOwnerPassword:"Skriv in ägarlösenordet för att redigera",unlockAndEdit:"Lås upp & redigera"},modifyProtection:{title:"Ändra skydd",description:"Välj hur du vill ändra dokumentskyddet.",changeOption:"Ändra lösenord eller behörigheter",changeDescription:"Ändra dokumentets lösenord eller behörigheter.",removeOption:"Ta bort alla skydd",removeDescription:"Ta bort lösenordsskydd från dokumentet."},removeProtection:{title:"Ta bort skydd",warning:"Är du säker på att du vill ta bort skydd?",description:"Det här kommer ta bort allt lösenordsskydd från dokumentet. Vem som helst kommer kunna öppna och ändra det.",confirm:"Ta bort skydd"}},security:{protected:{title:"Det här dokumentet är skyddat",description:"Den här filen är skyddad och vissa funktioner kan vara inaktiverade. Gå till Säkerhet i filmenyn för att visa eller låsa upp behörigheter.",viewPermissions:"Visa behörigheter"},viewPermissions:{title:"Filbehörigheter",description:"Den här filen är skyddad av ägaren och kräver ett lösenord för vissa handlingar.",restrictedActions:"Begränsade handlingar"},unlock:{label:"Skriv in ägarlösenordet för att låsa upp filen",placeholder:"Skriv in ägarlösenordet",button:"Lås upp filen",invalidPassword:"Ogiltigt lösenord. Var vänlig försök igen.",failed:"Misslyckades med att låsa upp. Var vänlig försök igen.",success:"Ägarbehörighet upplåst! Du har nu full åtkomst."}},common:{close:"Stäng",back:"Tillbaka",cancel:"Avbryt"},link:{title:"Lägg till länk",url:"URL",page:"Sida",enterUrl:"Skriv in URL",enterPage:"Skriv in sidnummer",pageRange:"Sida 1 till {totalPages}",link:"Länk"}}}],paramResolvers:Wx},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:"cjk-languages",locales:["zh-CN","ja"],breakpoints:{sm:{replaceHide:["zoom-toolbar","mode-select-button","overflow-tabs-button"],replaceShow:["view-mode","annotate-mode","shapes-mode","form-mode","redact-mode","pan-button","pointer-button","divider-3"]},md:{replaceShow:["view-mode","annotate-mode","shapes-mode","form-mode","redact-mode","zoom-toolbar","pan-button","pointer-button","divider-3"],replaceHide:["zoom-menu-button","mode-select-button","overflow-tabs-button"]}}},{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","form-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","form-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","form-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:{itemIds:["mode:annotate","mode:shapes","mode:form","mode:redact"]}},{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","form-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:"form-mode",commandId:"mode:form",variant:"text",categories:["mode","mode-form","form"]},{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","add-ink","add-ink-highlighter","add-insert-text","add-replace-text","add-comment"],show:["overflow-annotation-tools"]},md:{minWidth:640,hide:["overflow-annotation-tools"],show:["add-text","add-stamp","add-ink","add-ink-highlighter","add-insert-text","add-replace-text","add-comment"]}}},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-squiggly",commandId:"annotation:add-squiggly",variant:"icon",categories:["annotation","annotation-markup","annotation-squiggly"]},{type:"command-button",id:"add-ink",commandId:"annotation:add-ink",variant:"icon",categories:["annotation","annotation-ink"]},{type:"command-button",id:"add-ink-highlighter",commandId:"annotation:add-ink-highlighter",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-insert-text",commandId:"annotation:add-insert-text",variant:"icon",categories:["annotation","annotation-markup","annotation-insert-text"]},{type:"command-button",id:"add-replace-text",commandId:"annotation:add-replace-text",variant:"icon",categories:["annotation","annotation-markup","annotation-replace-text"]},{type:"command-button",id:"add-comment",commandId:"annotation:add-comment",variant:"icon",categories:["annotation","annotation-comment-tool"]},{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}]},"form-toolbar":{id:"form-toolbar",position:{placement:"top",slot:"secondary",order:0},permanent:!1,categories:["form"],items:[{type:"spacer",id:"spacer-form-1",flex:!0},{type:"group",id:"form-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"add-form-textfield",commandId:"form:add-textfield",variant:"icon",categories:["form","form-textfield"]},{type:"command-button",id:"add-form-checkbox",commandId:"form:add-checkbox",variant:"icon",categories:["form","form-checkbox"]},{type:"command-button",id:"add-form-radio",commandId:"form:add-radio",variant:"icon",categories:["form","form-radio"]},{type:"command-button",id:"add-form-select",commandId:"form:add-select",variant:"icon",categories:["form","form-select"]},{type:"command-button",id:"add-form-listbox",commandId:"form:add-listbox",variant:"icon",categories:["form","form-listbox"]},{type:"divider",id:"form-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:"command-button",id:"toggle-form-fill-mode",commandId:"form:toggle-fill-mode",variant:"icon",categories:["form","form-fill-mode"]},{type:"divider",id:"form-tools-divider-2",orientation:"vertical"},{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-form-2",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",commandId:"redaction:redact",variant:"icon",categories:["redaction","redaction-combined"]},{type:"divider",id:"redaction-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-redaction-panel",commandId:"panel:toggle-redaction",variant:"icon",categories:["panel","panel-redaction"]},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"redaction-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-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:form",commandId:"mode:form",categories:["mode","mode-form","form"]},{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:form","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-levels-menu:25",commandId:"zoom:25",categories:["zoom","zoom-level","zoom-level-25"]},{type:"command",id:"zoom-levels-menu:50",commandId:"zoom:50",categories:["zoom","zoom-level","zoom-level-50"]},{type:"command",id:"zoom-levels-menu:100",commandId:"zoom:100",categories:["zoom","zoom-level","zoom-level-100"]},{type:"command",id:"zoom-levels-menu:125",commandId:"zoom:125",categories:["zoom","zoom-level","zoom-level-125"]},{type:"command",id:"zoom-levels-menu:150",commandId:"zoom:150",categories:["zoom","zoom-level","zoom-level-150"]},{type:"command",id:"zoom-levels-menu:200",commandId:"zoom:200",categories:["zoom","zoom-level","zoom-level-200"]},{type:"command",id:"zoom-levels-menu:400",commandId:"zoom:400",categories:["zoom","zoom-level","zoom-level-400"]},{type:"command",id:"zoom-levels-menu:800",commandId:"zoom:800",categories:["zoom","zoom-level","zoom-level-800"]},{type:"command",id:"zoom-levels-menu:1600",commandId:"zoom:1600",categories:["zoom","zoom-level","zoom-level-1600"]}]},"zoom-menu":{id:"zoom-menu",categories:["zoom"],items:[{type:"command",id:"zoom-menu:25",commandId:"zoom:25",categories:["zoom","zoom-level","zoom-level-25"]},{type:"command",id:"zoom-menu:50",commandId:"zoom:50",categories:["zoom","zoom-level","zoom-level-50"]},{type:"command",id:"zoom-menu:100",commandId:"zoom:100",categories:["zoom","zoom-level","zoom-level-100"]},{type:"command",id:"zoom-menu:125",commandId:"zoom:125",categories:["zoom","zoom-level","zoom-level-125"]},{type:"command",id:"zoom-menu:150",commandId:"zoom:150",categories:["zoom","zoom-level","zoom-level-150"]},{type:"command",id:"zoom-menu:200",commandId:"zoom:200",categories:["zoom","zoom-level","zoom-level-200"]},{type:"command",id:"zoom-menu:400",commandId:"zoom:400",categories:["zoom","zoom-level","zoom-level-400"]},{type:"command",id:"zoom-menu:800",commandId:"zoom:800",categories:["zoom","zoom-level","zoom-level-800"]},{type:"command",id:"zoom-menu:1600",commandId:"zoom:1600",categories:["zoom","zoom-level","zoom-level-1600"]},{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-menu:in",commandId:"zoom:in",categories:["zoom","zoom-in"]},{type:"command",id:"zoom-menu: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"],hide:["zoom-menu:25","zoom-menu:50","zoom-menu:100","zoom-menu:125","zoom-menu:150","zoom-menu:200","zoom-menu:400","zoom-menu:800","zoom-menu:1600"]},md:{minWidth:768,show:["zoom-menu:25","zoom-menu:50","zoom-menu:100","zoom-menu:125","zoom-menu:150","zoom-menu:200","zoom-menu:400","zoom-menu:800","zoom-menu:1600"],hide:["zoom-levels-submenu","divider-zoom-in-out","zoom-menu:in","zoom-menu: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",visibilityDependsOn:{itemIds:["document:open","document:close"]}},{type:"command",id:"document:print",commandId:"document:print",categories:["document","document-print"]},{type:"command",id:"document:protect",commandId:"document:protect",categories:["document","document-protect"]},{type:"command",id:"document:capture",commandId:"document:capture",categories:["document","document-capture"]},{type:"command",id:"document:export",commandId:"document:export",categories:["document","document-export"]},{type:"divider",id:"divider-11",visibilityDependsOn:{itemIds:["document:export","document:print","document:capture","document:protect"]}},{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-ink",commandId:"annotation:add-ink",categories:["annotation","annotation-ink"]},{type:"command",id:"annotation:add-ink-highlighter",commandId:"annotation:add-ink-highlighter",categories:["annotation","annotation-ink"]},{type:"command",id:"annotation:add-text",commandId:"annotation:add-text",categories:["annotation","annotation-text"]},{type:"command",id:"annotation:add-insert-text",commandId:"annotation:add-insert-text",categories:["annotation","annotation-markup","annotation-insert-text"]},{type:"command",id:"annotation:add-replace-text",commandId:"annotation:add-replace-text",categories:["annotation","annotation-markup","annotation-replace-text"]},{type:"command",id:"annotation:add-comment",commandId:"annotation:add-comment",categories:["annotation","annotation-comment-tool"]},{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},"widget-edit-panel":{id:"widget-edit-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"widget-edit-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},"redaction-panel":{id:"redaction-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"redaction-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1,categories:["redaction"]}},modals:{"print-modal":{id:"print-modal",content:{type:"component",componentId:"print-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0},"protect-modal":{id:"protect-modal",content:{type:"component",componentId:"protect-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0},"view-permissions-modal":{id:"view-permissions-modal",content:{type:"component",componentId:"view-permissions-modal"},maxWidth:"28rem",closeOnClickOutside:!0,closeOnEscape:!0},"link-modal":{id:"link-modal",content:{type:"component",componentId:"link-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},"unlock-owner-overlay":{id:"unlock-owner-overlay",position:{anchor:"bottom-right",offset:{bottom:"1.5rem",right:"1.5rem"}},content:{type:"component",componentId:"unlock-owner-overlay"},defaultEnabled:!0}},selectionMenus:{annotation:{id:"annotation",categories:["annotation"],items:[{type:"command-button",id:"comment-button",commandId:"annotation:toggle-comment",variant:"icon",categories:["annotation","annotation-comment"]},{type:"command-button",id:"toggle-link",commandId:"annotation:toggle-link",variant:"icon",categories:["annotation","annotation-link"]},{type:"command-button",id:"toggle-annotation-widget-edit",commandId:"annotation:toggle-widget-edit",variant:"icon",categories:["annotation","annotation-widget-edit"]},{type:"command-button",id:"toggle-annotation-style",commandId:"annotation:toggle-annotation-style",variant:"icon",categories:["annotation","annotation-style"]},{type:"command-button",id:"apply-redaction",commandId:"annotation:apply-redaction",variant:"icon",categories:["annotation","annotation-redaction"]},{type:"command-button",id:"delete-annotation",commandId:"annotation:delete-selected",variant:"icon",categories:["annotation","annotation-delete"]},{type:"command-button",id:"goto-link",commandId:"annotation:goto-link",variant:"icon-text",categories:["annotation","annotation-link"]}]},groupAnnotation:{id:"groupAnnotation",categories:["annotation","annotation-group"],items:[{type:"command-button",id:"comment-button",commandId:"annotation:toggle-comment",variant:"icon",categories:["annotation","annotation-comment"]},{type:"command-button",id:"toggle-group-annotations",commandId:"annotation:toggle-group",variant:"icon",categories:["annotation","annotation-group"]},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"command-button",id:"delete-all-annotations",commandId:"annotation:delete-all-selected",variant:"icon",categories:["annotation","annotation-delete","annotation-group"]}]},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","add-link","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:"add-link",commandId:"annotation:add-link",variant:"icon",categories:["annotation","annotation-link"]},{type:"command-button",id:"redact-text",commandId:"redaction:redact-text",variant:"icon",categories:["redaction","redaction-text"]}]}}}},viewport:{viewportGap:10},scroll:{defaultStrategy:xi.Vertical},zoom:{defaultZoomLevel:Za.FitPage},spread:{defaultSpreadMode:Fi.None},rotation:{defaultRotation:We.Degree0},pan:{},render:{defaultImageType:"image/png"},tiling:{tileSize:768,overlapPx:2.5,extraRings:0},thumbnails:{width:150,gap:10,buffer:3,labelHeight:30},annotations:{locked:{type:ld.Include,categories:["form"]}},search:{},selection:{},bookmarks:{},attachments:{},capture:{scale:2,imageType:"image/png"},redaction:{drawBlackBoxes:!0,useAnnotationMode:!0},print:{},export:{defaultFileName:"document.pdf"},fullscreen:{},history:{},interactionManager:{},form:{}};function lk(e){var t=e.documentId,n=e.tabBarVisibility,o=void 0===n?"multiple":n,i=function(e){const t=va(),{provides:n}=ia(),o=null==n?void 0:n.getSchema(),i=ra(e);return{renderToolbar:(r,a)=>{const s=`${r}-${a}`;if(!o||!n||!i)return null;const l=i.activeToolbars[s],c=l?o.toolbars[l.toolbarId]:null;l&&!c&&console.warn(`Toolbar "${l.toolbarId}" not found in schema`);const d=c&&!c.permanent?()=>n.forDocument(e).closeToolbarSlot(r,a):void 0,u=t.toolbar;return Be(B,{children:l&&c&&Be(u,{schema:c,documentId:e,isOpen:l.isOpen,onClose:d})},`toolbar-slot-${s}`)},renderSidebar:(r,a)=>{var s;const l=`${r}-${a}`;if(!o||!n||!i)return null;const c=i.activeSidebars[l],d=c?null==(s=o.sidebars)?void 0:s[c.sidebarId]:null;c&&!d&&console.warn(`Sidebar "${c.sidebarId}" not found in schema`);const u=t.sidebar;return Be(B,{children:c&&d&&Be(u,{schema:d,documentId:e,isOpen:c.isOpen,onClose:()=>{n.forDocument(e).closeSidebarSlot(r,a)}})},`sidebar-slot-${l}`)},renderModal:()=>{var r;if(!o||!n||!i)return null;const a=t.modal;if(!a)return null;const s=i.activeModal,l=s?null==(r=o.modals)?void 0:r[s.modalId]:null;return s&&!l&&console.warn(`Modal "${s.modalId}" not found in schema`),Be(B,{children:s&&l&&Be(a,{schema:l,documentId:e,isOpen:s.isOpen,onClose:()=>{n.forDocument(e).closeModal()},onExited:()=>{n.forDocument(e).clearModal()},modalProps:s.props})},"modal-slot")},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(!o||!n||!i)return null;const r=t.overlay;return r?Be(B,{children:(o.overlays?Object.values(o.overlays):[]).filter(e=>!1!==i.enabledOverlays[e.id]).map(t=>Be(r,{schema:t,documentId:e},t.id))},"overlays-slot"):null}}}(t),r=i.renderToolbar,a=i.renderSidebar,s=i.renderModal,l=i.renderOverlays,c=Ka(t).translate,d=ya("selection",t),u=ya("annotation",t),h=ya("groupAnnotation",t),m=ya("redaction",t),g=(e=>{const t=Ho();return Te(()=>t?t.documentOrder.map(e=>t.documents[e]).filter(e=>null!=e):[],[t,e])})(),p=(()=>{const e=Ho();return Te(()=>{if(!e)return{activeDocumentId:null,activeDocument:null};const t=e.activeDocumentId;return{activeDocumentId:t,activeDocument:t?e.documents[t]??null:null}},[e])})();return j(B,null,j(Yx,{documentStates:g,activeDocumentId:p.activeDocumentId,visibility:o}),r("top","main"),r("top","secondary"),j("div",{id:"document-content",className:"bg-bg-surface flex flex-1 overflow-hidden"},a("left","main"),j("div",{className:"flex-1 overflow-hidden"},j(Sa,{documentId:t},function(e){var n=e.documentState,o=e.isLoading,i=e.isError,r=e.isLoaded;return j(B,null,o&&j("div",{className:"flex h-full items-center justify-center"},j(pw,{size:"lg",text:c("document.loading")})),i&&j(Jx,{documentState:n}),r&&j("div",{className:"relative h-full w-full"},j(lm,{documentId:t},j(wi,{className:"bg-bg-app",documentId:t},j(us,{documentId:t},j(_i,{documentId:t,renderPage:function(e){var n=e.pageIndex;return j(Ms,{documentId:t,pageIndex:n,style:{backgroundColor:"#fff"}},j(cm,{documentId:t,pageIndex:n},j(vs,{documentId:t,pageIndex:n,scale:.5,style:{pointerEvents:"none"}}),j(gc,{documentId:t,pageIndex:n,style:{pointerEvents:"none"}}),j(Zs,{documentId:t,pageIndex:n}),j(hs,{documentId:t,pageIndex:n}),j(Fg,{documentId:t,pageIndex:n}),j(Yl,{documentId:t,pageIndex:n,selectionMenu:d}),j(Tp,{documentId:t,pageIndex:n,selectionMenu:m}),j(Zm,{documentId:t,pageIndex:n,selectionMenu:u,groupSelectionMenu:h})))}})))),l()))})),a("right","main")),s())}var ck=new yt([new pt,new vt]);function dk(e){var t,o=e.config,i=e.onRegistryReady,r=function(e){const{wasmUrl:t=Yo,worker:n=!0,logger:o,encoderPoolSize:i,fontFallback:r}=e??{},[a,s]=Se(null),[l,c]=Se(!0),[d,u]=Se(null),h=Pe(null);return Me(()=>{let e=!1;return(async()=>{try{const{createPdfiumEngine:e}=n?await import("./worker-engine-B9za95Tx.js"):await import("./direct-engine-BXXPY_J7.js"),a=await e(t,{logger:o,encoderPoolSize:i,fontFallback:r});h.current=a,s(a),c(!1)}catch(t){e||(u(t),c(!1))}})(),()=>{var t,n;e=!0,null==(n=null==(t=h.current)?void 0:t.closeAllDocuments)||n.call(t).wait(()=>{var e,t;null==(t=null==(e=h.current)?void 0:e.destroy)||t.call(e),h.current=null},Bn)}},[t,n,o,r]),{engine:a,isLoading:l,error:d}}(h(h(h({},o.wasmUrl&&{wasmUrl:o.wasmUrl}),o.fontFallback&&{fontFallback:o.fontFallback}),{},{worker:o.worker,logger:o.log?ck:void 0})),a=r.engine,s=r.isLoading,l=Te(function(){return{"thumbnails-sidebar":cw,"annotation-sidebar":wx,"zoom-toolbar":Ow,"search-sidebar":mw,"outline-sidebar":gw,"comment-sidebar":Ew,"widget-edit-sidebar":Mx,"print-modal":Fx,"link-modal":$x,"protect-modal":ik,"unlock-owner-overlay":rk,"page-controls":jx,"mode-select-button":ek,"view-permissions-modal":ak,"redaction-sidebar":Cx}},[]),c=Te(function(){return{toolbar:Bb,sidebar:Qb,modal:lw,overlay:Lx,menu:tw,selectionMenu:Ex}},[]);return j(B,null,j("style",null,je),!a||s?j("div",{className:"flex h-full w-full items-center justify-center"},j(pw,{size:"lg",text:"Initializing PDF engine..."})):j(Uo,{config:{logger:o.log?ck:void 0,permissions:o.permissions},onInitialized:(t=n(g().m(function e(t){return g().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:[Co(Ma,h(h(h({},sk.documentManager),o.src&&{initialDocuments:[{url:o.src}]}),o.documentManager)),Co(_a,h(h(h({},sk.commands),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.commands)),Co(Va,h(h({},sk.i18n),o.i18n)),Co(oa,h(h(h({},sk.ui),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.ui)),Co(fi,h(h({},sk.viewport),o.viewport)),Co(Oi,h(h({},sk.scroll),o.scroll)),Co(ss,h(h({},sk.zoom),o.zoom)),Co(Zi,h(h({},sk.spread),o.spread)),Co(As,h(h({},sk.rotation),o.rotation)),Co(Ag,h(h({},sk.pan),o.pan)),Co(fs,h(h({},sk.render),o.render)),Co(uc,h(h({},sk.tiling),o.tiling)),Co(Ac,h(h({},sk.thumbnails),o.thumbnails)),Co(Xm,h(h({},sk.annotations),o.annotations)),Co(Vs,h(h({},sk.search),o.search)),Co(Ql,h(h({},sk.selection),o.selection)),Co(pg,h(h({},sk.bookmarks),o.bookmarks)),Co(Np,h(h({},sk.attachments),o.attachments)),Co(Lg,h(h({},sk.capture),o.capture)),Co(Rp,h(h({},sk.redaction),o.redaction)),Co(ng,h(h({},sk.print),o.print)),Co(bg,h(h({},sk.export),o.export)),Co(dg,h(h({},sk.fullscreen),o.fullscreen)),Co(Kg,h(h({},sk.history),o.history)),Co(tm,h(h({},sk.interactionManager),o.interactionManager)),Co(Nf,h(h({},sk.form),o.form))]},function(e){var t=e.pluginsReady,n=e.activeDocumentId;return j(B,null,t?j(B,null,n?j(xa,{documentId:n,components:l,renderers:c,className:"relative flex h-full w-full select-none flex-col"},j(lk,{documentId:n,tabBarVisibility:o.tabBar}),j(tk,{documentId:n}),j(yw,{documentId:n})):j(Qx,null)):j("div",{className:"flex h-full items-center justify-center"},j(pw,{size:"lg",text:"Initializing plugins..."})))}))}var uk="undefined"!=typeof HTMLElement?HTMLElement:r(function e(){i(this,e)}),hk=function(){function e(){var t;return i(this,e),s(t=o(this,e),"_resolveRegistry",null),s(t,"themeStyleEl",null),s(t,"systemPreferenceCleanup",null),s(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 c(e,uk),r(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,ce(null,this.root)}},{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&&dy(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 Kx(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=Kx((null==o?void 0:o.preference)||"system"),r="dark"===i?Gx:Hx,a=null==o?void 0:o[i];return n=r,(t=a)?Vx(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=Xx(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?h(h({},this._config.theme),{},{preference:e}):h(h({},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){cy(e,t)}},{key:"registerIcons",value:function(e){dy(e)}},{key:"renderViewer",value:function(){this._config&&(ce(j(dk,{config:this._config,onRegistryReady:this.handleRegistryReady}),this.root),this.injectTheme())}}])}(),mk=["type","target"],gk="2.10.1";"undefined"==typeof customElements||customElements.get("embedpdf-container")||customElements.define("embedpdf-container",hk);var pk={version:gk,init:function(e){if("container"===e.type)return function(e){e.type,e.target;var t=m(e,mk),n=document.createElement("embedpdf-container");return n.config=t,e.target.appendChild(n),n}(e)}};export{vg as $,Xe as A,qt as B,Zt as C,Xt as D,Ft as E,qe as F,ot as G,mt as H,Ot as I,Nt as J,Lt as K,At as L,Et as M,gt as N,hn as O,sn as P,tn as Q,We as R,jn as S,kt as T,eh as U,Ep as V,gg as W,Ng as X,Ea as Y,Ca as Z,hk as _,ln as a,of as a0,sg as a1,Gg as a2,Ga as a3,Qh as a4,Ig as a5,eg as a6,Zg as a7,yp as a8,gs as a9,Is as aa,zi as ab,xi as ac,Gs as ad,El as ae,Fi as af,Gi as ag,Sc as ah,dc as ai,Xr as aj,pi as ak,Za as al,as as am,Vx as an,Gx as ao,pk as ap,Bn as aq,Hx as ar,cy as as,dy as at,gk as au,en as b,_t as c,Jt as d,Qt as e,Bt as f,an as g,St as h,Fn as i,$t as j,Wt as k,Ht as l,Dt as m,Gt as n,cn as o,mn as p,jt as q,zt as r,Ln as s,Mt as t,$n as u,un as v,dn as w,Ut as x,gn as y,Ze as z};
|