({x:e,y:e}),af={left:"right",right:"left",bottom:"top",top:"bottom"},sf={start:"end",end:"start"};function lf(e,t,n){return tf(e,ef(t,n))}function cf(e,t){return"function"==typeof e?e(t):e}function df(e){return e.split("-")[0]}function uf(e){return e.split("-")[1]}function hf(e){return"x"===e?"y":"x"}function mf(e){return"y"===e?"height":"width"}const gf=new Set(["top","bottom"]);function pf(e){return gf.has(df(e))?"y":"x"}function ff(e){return hf(pf(e))}function vf(e){return e.replace(/start|end/g,e=>sf[e])}const yf=["left","right"],bf=["right","left"],wf=["top","bottom"],xf=["bottom","top"];function Cf(e,t,n,o){const i=uf(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?bf:yf:t?yf:bf;case"left":case"right":return t?wf:xf;default:return[]}}(df(e),"start"===n,o);return i&&(r=r.map(e=>e+"-"+i),t&&(r=r.concat(r.map(vf)))),r}function If(e){return e.replace(/left|right|bottom|top/g,e=>af[e])}function kf(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 Sf(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 Mf(e,t,n){let{reference:o,floating:i}=e;const r=pf(t),a=ff(t),s=mf(a),l=df(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(uf(t)){case"start":m[a]-=h*(n&&c?-1:1);break;case"end":m[a]+=h*(n&&c?-1:1)}return m}async function Af(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}=cf(t,e),g=kf(m),p=s[h?"floating"===u?"reference":"floating":u],f=Sf(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=Sf(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 Pf=new Set(["left","top"]);function Df(){return"undefined"!=typeof window}function Rf(e){return Ef(e)?(e.nodeName||"").toLowerCase():"#document"}function zf(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Tf(e){var t;return null==(t=(Ef(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Ef(e){return!!Df()&&(e instanceof Node||e instanceof zf(e).Node)}function _f(e){return!!Df()&&(e instanceof Element||e instanceof zf(e).Element)}function Nf(e){return!!Df()&&(e instanceof HTMLElement||e instanceof zf(e).HTMLElement)}function Of(e){return!(!Df()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof zf(e).ShadowRoot)}const Lf=new Set(["inline","contents"]);function $f(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=Yf(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Lf.has(i)}const jf=new Set(["table","td","th"]);function Ff(e){return jf.has(Rf(e))}const Uf=[":popover-open",":modal"];function Hf(e){return Uf.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Bf=["transform","translate","scale","rotate","perspective"],Wf=["transform","translate","scale","rotate","perspective","filter"],qf=["paint","layout","strict","content"];function Gf(e){const t=Vf(),n=_f(e)?Yf(e):e;return Bf.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Wf.some(e=>(n.willChange||"").includes(e))||qf.some(e=>(n.contain||"").includes(e))}function Vf(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Kf=new Set(["html","body","#document"]);function Zf(e){return Kf.has(Rf(e))}function Yf(e){return zf(e).getComputedStyle(e)}function Xf(e){return _f(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qf(e){if("html"===Rf(e))return e;const t=e.assignedSlot||e.parentNode||Of(e)&&e.host||Tf(e);return Of(t)?t.host:t}function Jf(e){const t=Qf(e);return Zf(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nf(t)&&$f(t)?t:Jf(t)}function ev(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Jf(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),a=zf(i);if(r){const e=tv(a);return t.concat(a,a.visualViewport||[],$f(i)?i:[],e&&n?ev(e):[])}return t.concat(i,ev(i,[],n))}function tv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nv(e){const t=Yf(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=Nf(e),r=i?e.offsetWidth:n,a=i?e.offsetHeight:o,s=nf(n)!==r||nf(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function ov(e){return _f(e)?e:e.contextElement}function iv(e){const t=ov(e);if(!Nf(t))return rf(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=nv(t);let a=(r?nf(n.width):n.width)/o,s=(r?nf(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const rv=rf(0);function av(e){const t=zf(e);return Vf()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rv}function sv(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=ov(e);let a=rf(1);t&&(o?_f(o)&&(a=iv(o)):a=iv(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==zf(e))&&t}(r,n,o)?av(r):rf(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=zf(r),t=o&&_f(o)?zf(o):o;let n=e,i=tv(n);for(;i&&o&&t!==n;){const e=iv(i),t=i.getBoundingClientRect(),o=Yf(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=zf(i),i=tv(n)}}return Sf({width:d,height:u,x:l,y:c})}function lv(e,t){const n=Xf(e).scrollLeft;return t?t.left+n:sv(Tf(e)).left+n}function cv(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lv(e,n),y:n.top+t.scrollTop}}const dv=new Set(["absolute","fixed"]);function uv(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=zf(e),o=Tf(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=Vf();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}const c=lv(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=Tf(e),n=Xf(e),o=e.ownerDocument.body,i=tf(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=tf(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+lv(e);const s=-n.scrollTop;return"rtl"===Yf(o).direction&&(a+=tf(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(Tf(e));else if(_f(t))o=function(e,t){const n=sv(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=Nf(e)?iv(e):rf(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=av(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Sf(o)}function hv(e,t){const n=Qf(e);return!(n===t||!_f(n)||Zf(n))&&("fixed"===Yf(n).position||hv(n,t))}function mv(e,t,n){const o=Nf(t),i=Tf(t),r="fixed"===n,a=sv(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=rf(0);function c(){l.x=lv(i)}if(o||!o&&!r)if(("body"!==Rf(t)||$f(i))&&(s=Xf(t)),o){const e=sv(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?rf(0):cv(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 gv(e){return"static"===Yf(e).position}function pv(e,t){if(!Nf(e)||"fixed"===Yf(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Tf(e)===n&&(n=n.ownerDocument.body),n}function fv(e,t){const n=zf(e);if(Hf(e))return n;if(!Nf(e)){let t=Qf(e);for(;t&&!Zf(t);){if(_f(t)&&!gv(t))return t;t=Qf(t)}return n}let o=pv(e,t);for(;o&&Ff(o)&&gv(o);)o=pv(o,t);return o&&Zf(o)&&gv(o)&&!Gf(o)?n:o||function(e){let t=Qf(e);for(;Nf(t)&&!Zf(t);){if(Gf(t))return t;if(Hf(t))return null;t=Qf(t)}return null}(e)||n}const vv={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,a=Tf(o),s=!!t&&Hf(t.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=rf(1);const d=rf(0),u=Nf(o);if((u||!u&&!r)&&(("body"!==Rf(o)||$f(a))&&(l=Xf(o)),Nf(o))){const e=sv(o);c=iv(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const h=!a||u||r?rf(0):cv(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:Tf,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?Hf(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=ev(e,[],!1).filter(e=>_f(e)&&"body"!==Rf(e)),i=null;const r="fixed"===Yf(e).position;let a=r?Qf(e):e;for(;_f(a)&&!Zf(a);){const t=Yf(a),n=Gf(a);n||"fixed"!==t.position||(i=null),(r?!n&&!i:!n&&"static"===t.position&&i&&dv.has(i.position)||$f(a)&&!n&&hv(e,a))?o=o.filter(e=>e!==a):i=t,a=Qf(a)}return t.set(e,o),o}(t,this._c):[].concat(n),o],a=r[0],s=r.reduce((e,n)=>{const o=uv(t,n,i);return e.top=tf(o.top,e.top),e.right=ef(o.right,e.right),e.bottom=ef(o.bottom,e.bottom),e.left=tf(o.left,e.left),e},uv(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:fv,getElementRects:async function(e){const t=this.getOffsetParent||fv,n=this.getDimensions,o=await n(e.floating);return{reference:mv(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}=nv(e);return{width:t,height:n}},getScale:iv,isElement:_f,isRTL:function(e){return"rtl"===Yf(e).direction}};function yv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bv(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=ov(e),d=i||r?[...c?ev(c):[],...ev(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=Tf(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:-of(u)+"px "+-of(i.clientWidth-(d+h))+"px "+-of(i.clientHeight-(u+m))+"px "+-of(d)+"px",threshold:tf(0,ef(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||yv(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?sv(e):null;return l&&function t(){const o=sv(e);p&&!yv(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 wv=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=df(n),s=uf(n),l="y"===pf(n),c=Pf.has(a)?-1:1,d=r&&l?-1:1,u=cf(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}}}}},xv=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}=cf(e,t),d={x:n,y:o},u=await r.detectOverflow(t,c),h=pf(df(i)),m=hf(h);let g=d[m],p=d[h];if(a){const e="y"===m?"bottom":"right";g=lf(g+u["y"===m?"top":"left"],g,g-u[e])}if(s){const e="y"===h?"bottom":"right";p=lf(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}}}}}},Cv=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}=cf(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const v=df(i),y=pf(s),b=df(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=h||(b||!p?[If(s)]:function(e){const t=If(e);return[vf(e),t,vf(t)]}(s)),C="none"!==g;!h&&C&&x.push(...Cf(s,p,g,w));const I=[s,...x],k=await l.detectOverflow(t,f),S=[];let M=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&S.push(k[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=uf(e),i=ff(e),r=mf(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=If(a)),[a,If(a)]}(i,a,w);S.push(k[e[0]],k[e[1]])}if(M=[...M,{placement:i,overflows:S}],!S.every(e=>e<=0)){var A,P;const e=((null==(A=r.flip)?void 0:A.index)||0)+1,t=I[e];if(t){if(!("alignment"===u&&y!==pf(t))||M.every(e=>pf(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:M},reset:{placement:t}}}let n=null==(P=M.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(m){case"bestFit":{var D;const e=null==(D=M.filter(e=>{if(C){const t=pf(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:D[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},Iv=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}=cf(e,t)||{};if(null==c)return{};const u=kf(d),h={x:n,y:o},m=ff(i),g=mf(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],C=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let I=C?C[b]:0;I&&await(null==a.isElement?void 0:a.isElement(C))||(I=s.floating[b]||r.floating[g]);const k=w/2-x/2,S=I/2-p[g]/2-1,M=ef(u[v],S),A=ef(u[y],S),P=M,D=I-p[g]-A,R=I/2-p[g]/2+k,z=lf(P,R,D),T=!l.arrow&&null!=uf(i)&&R!==z&&r.reference[g]/2-(R{const o=new Map,i={platform:vv,...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}=Mf(c,o,l),h=o,m={},g=0;for(let n=0;n=75?"full":o<=25?"closed":"half",C.current={y:e,height:o,time:Date.now(),state:t},I.current={y:e,time:Date.now()},f(0),t!==c&&d(t),m(!0)}},[s,c]),M=ze(function(e){if(h){var t=s.clientHeight,n=(C.current.y-e)/t*100,o=Math.max(0,Math.min(100,C.current.height+n));I.current={y:e,time:Date.now()};var i=k(C.current.state);f(o-i)}},[h,s]),A=ze(function(){if(h){if(Math.abs(C.current.y-I.current.y)<5)return m(!1),void f(0);var e=k(C.current.state)+p,t=Date.now()-I.current.time,n=I.current.y-C.current.y,o=function(e,t){return Math.abs(t)>.5?t>0?e>50?"half":"closed":e<50?"half":"full":e>=75?"full":e<=25?"closed":"half"}(e,t>0?n/t:0);"closed"===o?(d("closed"),m(!1),f(0),i()):(m(!1),f(0),d(o))}},[h,p,i]),P=ze(function(e){S(e.touches[0].clientY)},[S]),D=ze(function(e){h&&(e.cancelable&&e.preventDefault(),M(e.touches[0].clientY))},[h,M]),R=ze(function(){A()},[A]),z=ze(function(e){e.preventDefault(),S(e.clientY)},[S]);if(Ae(function(){if(h){var e=function(e){M(e.clientY)},t=function(){A()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[h,M,A]),!b)return null;var T=k(h?C.current.state:c),E=h?Math.max(0,Math.min(100,T+p)):T,_=.3*Math.min(E/50,1);return F(H,null,F("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(0===E?"pointer-events-none":""),style:{opacity:_},onClick:i}),F("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},F("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:P,onTouchMove:D,onTouchEnd:R,onMouseDown:z},F("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),F("div",{className:"min-h-0 flex-1 overflow-hidden"},"tabs"===a.type&&F(Fv,{content:a,documentId:n,renderCustomComponent:r}),"component"===a.type&&F(H,null,r(a.componentId,n,{})))))}function Fv(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 F("div",{className:"flex h-full flex-1 flex-col"},F("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 F("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&&F(Xp,{icon:e.icon,className:"h-5 w-5"}))})),F("div",{className:"min-h-0 flex-1 overflow-auto"},n.tabs.filter(function(e){return e.id===a}).map(function(e){return F(H,{key:e.id},i(e.componentId,o,{}))})))}function Uv(e){var t=e.schema,n=e.documentId,o=e.anchorEl,i=e.onClose,r=Qr().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{const{provides:e}=Zr();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];Ae(function(){u([{menuId:t.id,schema:t,title:void 0}])},[t]);var h=d[d.length-1],m=ze(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=ze(function(){d.length>1&&u(function(e){return e.slice(0,-1)})},[d.length]);return h?a&&s?yu(F(Hv,{currentMenu:h,menuStack:d,documentId:n,onClose:i,onNavigateBack:g,onNavigateToSubmenu:m,container:s}),s):F(Bv,{currentMenu:h,documentId:n,anchorEl:o,onClose:i,onNavigateToSubmenu:m}):null}function Hv(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=De(null),w=De(null),x=De({isDragging:!1,startY:0,currentY:0,startTime:0,sheetHeight:0});Ae(function(){d(!0),requestAnimationFrame(function(){requestAnimationFrame(function(){g(!0)})})},[]);var C=v(Se(null),2),I=C[0],k=C[1];Ae(function(){if(w.current){var e=(n.length>1?60:0)+w.current.scrollHeight+24,t=.8*s.clientHeight;k(Math.min(e,t))}},[t,n.length,s]);var S=ze(function(){g(!1),setTimeout(function(){d(!1),i()},300)},[i]),M=ze(function(e){b.current&&(x.current={isDragging:!0,startY:e,currentY:e,startTime:Date.now(),sheetHeight:b.current.offsetHeight})},[]),A=ze(function(e){if(x.current.isDragging){var t=e-x.current.startY,n=Math.max(0,t);x.current.currentY=e,y(n)}},[]),P=ze(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]),D=ze(function(e){M(e.touches[0].clientY)},[M]),R=ze(function(e){x.current.isDragging&&e.cancelable&&e.preventDefault(),A(e.touches[0].clientY)},[A]),z=ze(function(){P()},[P]),T=ze(function(e){e.preventDefault(),M(e.clientY)},[M]);if(Ae(function(){if(x.current.isDragging){var e=function(e){return A(e.clientY)},t=function(){return P()};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[A,P]),Ae(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:I||400;return F(H,null,F("div",{className:"bg-bg-overlay absolute inset-0 z-40 transition-opacity duration-300 ".concat(m?"opacity-100":"opacity-0"),onClick:S}),F("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)")}},jr(t.schema)),F("div",{className:"flex flex-shrink-0 cursor-grab touch-none items-center justify-center py-3 active:cursor-grabbing",onTouchStart:D,onTouchMove:R,onTouchEnd:z,onMouseDown:T},F("div",{className:"bg-border-default h-1.5 w-12 rounded-full"})),n.length>1&&F("div",{className:"border-border-subtle flex items-center gap-3 border-b px-4 pb-3"},F("button",{onClick:r,className:"hover:bg-interactive-hover rounded-full p-1"},F($p,{className:"h-5 w-5"})),F("h3",{className:"text-fg-primary font-semibold"},t.title||"Menu")),F("div",{ref:w,className:"flex-1 overflow-y-auto py-2"},t.schema.items.map(function(e){return F(Wv,{key:e.id,item:e,documentId:o,onClose:S,isMobile:!0,onNavigateToSubmenu:a})}))))}function Bv(e){var t=e.currentMenu,n=e.documentId,o=e.anchorEl,i=e.onClose,r=e.onNavigateToSubmenu,a=De(null),s=v(Se(null),2),l=s[0],c=s[1];Ae(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]),Ae(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]),Ae(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 F("div",h(h({ref:a},jr(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 F(Wv,{key:e.id,item:e,documentId:n,onClose:i,isMobile:!1,onNavigateToSubmenu:r})}))}function Wv(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu;switch(t.type){case"command":return F(qv,{item:t,documentId:n,onClose:o,isMobile:i});case"submenu":return F(Gv,{item:t,documentId:n,isMobile:i,onNavigateToSubmenu:r});case"divider":return F("div",h({},jr(t)),F("hr",{className:"border-border-subtle my-2"}));case"section":return F(Vv,{item:t,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r});default:return null}}function qv(e){var t,n,o=e.item,i=e.documentId,r=e.onClose,a=e.isMobile,s=Aa(o.commandId,i);if(!s||!s.visible)return null;var l,c,d=function(){s.disabled||(s.execute(),r())};return a?F("button",h(h({},jr(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&&F(Xp,{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}),F("span",{className:"flex-1"},s.label)):F("button",h(h({},jr(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"}),F("div",{className:"flex items-center gap-2"},F("div",{className:"flex h-6 w-6 items-center justify-center"},s.icon&&F(Xp,{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})),F("span",{className:"text-sm"},s.label)))}function Gv(e){var t=e.item,n=e.documentId,o=e.isMobile,i=e.onNavigateToSubmenu,r=ja(n).translate,a=t.labelKey?r(t.labelKey):t.label||"",s=function(){return i(t.menuId,a)};return o?F("button",h(h({},jr(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"}),F("span",{className:"flex-1"},a),F(Lp,{className:"h-4 w-4"})):F("button",h(h({},jr(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"}),F("span",{className:"text-sm"},a),F(Lp,{className:"h-6 w-6"}))}function Vv(e){var t=e.item,n=e.documentId,o=e.onClose,i=e.isMobile,r=e.onNavigateToSubmenu,a=ja(n).translate,s=t.labelKey?a(t.labelKey):t.label||"";return F("div",h({},jr(t)),F("div",{className:"text-fg-secondary px-4 py-3 text-xs font-medium uppercase"},s),t.items.map(function(e){return F(Wv,{key:e.id,item:e,documentId:n,onClose:o,isMobile:i,onNavigateToSubmenu:r})}))}function Kv(e){var t=e.schema,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,a=e.modalProps,s=t.content,l=ra().renderCustomComponent;return"component"!==s.type?(console.warn("SchemaModal only supports component content type, got: ".concat(s.type)),null):F(H,null,l(s.componentId,n,h({isOpen:o,onClose:i,onExited:r},a)))}function Zv(e){var t=e.documentId;e.onClose;var n=Ai(t),o=n.state,i=n.provides;return F("div",{className:"flex h-full flex-1 flex-col"},F("div",{className:"flex-1 overflow-hidden"},F(lc,{documentId:t,style:{width:"100%",height:"100%"}},function(e){return F("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})}},F("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"}},F(cc,{documentId:t,meta:e,style:{width:"100%",height:"100%"}})),F("div",{style:{height:e.labelHeight,display:"flex",alignItems:"center",justifyContent:"center",marginTop:"4px"}},F("span",{className:"text-fg-secondary text-xs"},e.pageIndex+1)))})))}function Yv(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 Ae(function(){var n=window.setTimeout(function(){return i(e)},t);return function(){return clearTimeout(n)}},[e,t]),o}var Xv=function(e){var t=e.label,n=e.checked,o=e.onChange;return F("label",{className:"text-fg-secondary inline-flex cursor-pointer select-none items-center gap-2 text-xs font-medium"},F("input",{type:"checkbox",checked:n,onChange:function(e){return o(e.target.checked)},className:"border-border-default bg-bg-input checked:border-accent checked:bg-accent peer h-4 w-4 shrink-0 appearance-none rounded-[3px] border transition-all"}),F("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"},F("polyline",{points:"20 6 9 17 4 12"})),t)},Qv=function(e){var t=e.hit,n=e.onClick,o=e.active,i=De(null);return Ae(function(){o&&i.current&&i.current.scrollIntoView({behavior:"smooth",block:"nearest"})},[o]),F("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")},F("span",null,t.context.truncatedLeft&&"… ",t.context.before,F("span",{className:"text-accent font-bold"},t.context.match),t.context.after,t.context.truncatedRight&&" …"))};function Jv(e){var t=e.documentId;e.onClose;var n=(e=>{const{provides:t}=js(),[n,o]=Se(Ts),i=Re(()=>null==t?void 0:t.forDocument(e),[t,e]);return Ae(()=>{if(i)return o(i.getState()),i.onStateChange(e=>o(e));o(Ts)},[i]),{state:n,provides:i??null}})(t),o=n.state,i=n.provides,r=Mi().provides,a=ja(t).translate,s=De(null),l=v(Se(""),2),c=l[0],d=l[1];Ae(function(){},[]),Ae(function(){o.query&&!c&&d(o.query)},[o.query]),Ae(function(){void 0!==o.activeResultIndex&&o.activeResultIndex>=0&&m(o.activeResultIndex)},[o.activeResultIndex]);var u=Yv(c,300);Ae(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 F("div",{className:"bg-bg-surface flex h-full flex-col"},F("div",{className:"p-4"},F("div",{className:"relative"},F("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2"},F(Fp,{className:"text-fg-muted h-4 w-4"})),F("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&&F("div",{className:"absolute inset-y-0 right-0 flex cursor-pointer items-center pr-3",onClick:function(){d(""),s.current&&s.current.focus()}},F(Up,{className:"text-fg-muted hover:text-fg-secondary h-4 w-4"}))),F("div",{className:"mt-3 flex flex-col gap-2"},F(Xv,{label:a("search.caseSensitive"),checked:o.flags.includes(Kt.MatchCase),onChange:function(e){return h(Kt.MatchCase,e)}}),F(Xv,{label:a("search.wholeWord"),checked:o.flags.includes(Kt.MatchWholeWord),onChange:function(e){return h(Kt.MatchWholeWord,e)}})),F("hr",{className:"border-border-subtle mb-2 mt-5"}),o.active&&F("div",{className:"flex h-[32px] flex-row items-center justify-between"},F("div",{className:"text-fg-muted text-xs"},a("search.resultsFound",{params:{count:o.total}})),o.total>1&&F("div",{className:"flex flex-row"},F(Jp,{onClick:function(){null==i||i.previousResult()}},F($p,{className:"h-4 w-4"})),F(Jp,{onClick:function(){null==i||i.nextResult()}},F(Lp,{className:"h-4 w-4"}))))),F("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 F("div",{key:n,className:"mt-2 first:mt-0"},F("div",{className:"bg-bg-surface/80 text-fg-muted py-2 text-xs backdrop-blur"},a("search.page",{params:{page:Number(n)+1}})),F("div",{className:"flex flex-col gap-2"},r.map(function(e){var t=e.hit,n=e.index;return F(Qv,{key:n,hit:t,active:n===o.activeResultIndex,onClick:function(){null==i||i.goToResult(n)}})})))}),F("div",null)))}function ey(e){var t=e.documentId,n=_o(Jh.id).provides,o=Mi().provides,i=ja(t).translate,r=Oo(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];Ae(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:Qt.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 F("div",{key:a,className:"select-none"},F("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===Mt.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&&F("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"},F(l?jp:Lp,{className:"h-3 w-3"})),!s&&F("div",{className:"w-4"}),F("span",{className:"text-fg-secondary text-sm"},e.title)),s&&l&&F("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?F("div",{className:"text-fg-secondary flex h-full flex-col gap-3 p-4 text-sm"},F("div",{className:"text-fg-primary font-medium"},i("outline.title")),F("p",null,i("outline.loading"))):0===s.length?F("div",{className:"flex h-full items-center justify-center p-6"},F("div",{className:"text-fg-muted text-center"},F("div",{className:"text-sm"},i("outline.noOutline")),F("div",{className:"mt-1 text-xs"},i("outline.noBookmarks")))):F("div",{className:"bg-bg-surface flex h-full flex-col"},F("div",{className:"flex-1 overflow-y-auto"},F("div",{className:"outline-tree"},s.map(function(e,t){return p(e,t)}))))}function ty(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 F("div",{className:"flex flex-col items-center justify-center gap-3 ".concat(void 0===i?"":i)},F("div",{className:"relative"},F("div",{className:"".concat(r[n]," border-border-default animate-spin rounded-full border-4")}),F("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&&F("p",{className:"".concat({sm:"text-sm",md:"text-base",lg:"text-lg"}[n]," text-fg-secondary animate-pulse font-medium")},o))}function ny(e){var t=e.size,n=void 0===t?"md":t,o=e.className,i=void 0===o?"":o;return F("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 oy,iy=function(e){var t=e.documentId,n=Ju().provides,o=v(Se({show:!1,mode:null,isAnimating:!1}),2),i=o[0],r=o[1],a=ja(t).translate;Ae(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 F("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"}},F("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),F("div",{className:"drag-demo",style:{position:"relative",width:"150px",height:"100px"}},F("div",{style:{position:"absolute",top:"20px",left:"20px",width:"110px",height:"60px",border:"2px dashed ".concat(l),borderRadius:"4px",opacity:.6}}),F("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"}}),F("div",{className:"cursor-demo",style:{position:"absolute",width:"20px",height:"20px"}},F("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},F("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)"}),F("path",{d:"M3 2L16 10L10 11.5L7.5 16L3 2Z",fill:"white",stroke:"black",strokeWidth:"1"}),F("path",{d:"M4 3.5L13.5 9.5L9.5 10.5L7.5 14L4 3.5Z",fill:"rgba(255,255,255,0.8)"})))),F("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 "))},ry=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 F("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(""))}},F("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")}),F("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"},F("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},F("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"}))))},ay=["bg-red-500","bg-blue-500","bg-green-500","bg-yellow-500","bg-purple-500","bg-pink-500","bg-indigo-500","bg-teal-500"],sy=function(e){if(!e)return ay[0];var t=e.length>0?e.charCodeAt(0)%ay.length:0;return ay[t]},ly=function(e){var t=e.name,n=e.className,o=void 0===n?"":n;return F("div",{className:"flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium text-white ".concat(sy(t)," ").concat(o)},function(e){return e?e.split(" ").map(function(e){return e[0]}).join("").toUpperCase().slice(0,2):"G"}(t))},cy=function(e){var t,n,o=e.onEdit,i=e.onDelete,r=e.onClose,a=e.documentId,s=De(null),l=ja(a).translate;Ae(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 F("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"},F("div",{className:"py-1"},F("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")),F("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"))))},dy=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=De(null),u=ja(a).translate;Ae(function(){r&&d.current&&(d.current.focus(),d.current.setSelectionRange(l.length,l.length))},[r,l.length]);return F("div",{className:"flex-1 space-y-2"},F("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}),F("div",{className:"flex flex-wrap gap-2"},F("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")),F("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"))))},uy=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)"}},hy=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?F("div",{className:"flex w-full items-start space-x-3",onClick:function(e){return e.stopPropagation()}},r&&F(ly,{name:p,className:"h-8 w-8"}),F(dy,{initialText:t.contents||"",onSave:function(e){n(e),g(!1)},onCancel:function(){g(!1)},autoFocus:!0,documentId:a})):F("div",{className:"flex items-start space-x-3"},r&&F(ly,{name:p,className:"h-8 w-8"}),F("div",{className:"min-w-0 flex-1"},r&&F("div",{className:"flex items-center justify-between"},F("div",{className:"leading-none"},F("h5",{className:"text-fg-primary text-sm font-medium"},p),F("span",{className:"text-fg-muted text-xs"},uy(t.modified||t.created))),!l&&F("div",{className:"relative"},F("button",{onClick:function(e){e.stopPropagation(),u(!0)},className:"text-fg-muted hover:bg-interactive-hover rounded-md p-1"},F("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},F("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&&F(cy,{onEdit:function(){return g(!0)},onDelete:o,onClose:function(){return u(!1)},documentId:a}))),F("p",{className:"text-fg-primary mt-2 text-sm"},t.contents)))},my=(s(s(s(s(s(s(s(s(s(s(oy={},_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:"text",iconProps:function(e){return{primaryColor:e.fontColor||"#000000"}}}),_t.POLYGON,{label:"Polygon",labelKey:"annotation.polygon",icon:"polygon",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color}}}),s(s(s(oy,_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.REDACT,{label:"Redact",labelKey:"annotation.redact",icon:"redact",iconProps:function(e){return{primaryColor:e.strokeColor||"#000000",secondaryColor:e.color||"#000000"}}})),gy=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=ja(a).translate,u=t.split(" ");return u.length>o?F("div",{className:r},l?t:u.slice(0,o).join(" ")+"..."," ",F("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"))):F("div",{className:r},t)},py=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 F("div",{className:"bg-bg-surface-alt flex items-center justify-center rounded-full ".concat(i),title:r},F(Xp,h({icon:n.icon},a)))},fy=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=v(Se(!1),2),g=m[0],p=m[1],f=v(Se(!1),2),y=f[0],b=f[1],w=ja(l).translate,x=function(e){return Qc(e)?my[e.object.type]:null}(u),C=!!u.object.contents,I=h.length>0,k=!C&&!I,S=De(null),M=De(!1),A=u.object.author||"Guest";if(Ae(function(){var e;o&&!M.current&&(null===(e=S.current)||void 0===e||e.focus({preventScroll:!0}));M.current=o},[o]),!x)return null;return F("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")},F("div",{className:"p-4"},F("div",{className:"flex items-start space-x-3"},F(py,{annotation:u,config:x,title:w(x.labelKey,{fallback:x.label}),className:"h-8 w-8"}),F("div",{className:"min-w-0 flex-1"},F("div",{className:"flex items-center justify-between"},F("div",{className:"leading-none"},F("h4",{className:"text-fg-primary text-sm font-medium"},A),F("span",{className:"text-fg-disabled text-xs"},uy(u.object.modified||u.object.created))),!d&&F("div",{className:"relative"},F("button",{onClick:function(e){e.stopPropagation(),p(!0)},className:"text-fg-disabled hover:bg-interactive-hover hover:text-fg-secondary rounded-md p-1"},F("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20"},F("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"}))),g&&F(cy,{onEdit:function(){return b(!0)},onDelete:function(){return a(u)},onClose:function(){return p(!1)},documentId:l}))),(null===(t=u.object.custom)||void 0===t?void 0:t.text)&&F(gy,{text:u.object.custom.text,maxWords:14,className:"text-fg-muted mt-2 text-sm",documentId:l}),y?F("div",{className:"mt-2"},F(dy,{initialText:u.object.contents||"",onSave:function(e){r(u.object.id,e),b(!1)},onCancel:function(){b(!1)},autoFocus:!0,documentId:l})):C?F("p",{className:"text-fg-primary mt-2 text-sm"},u.object.contents):null)),I&&F("div",{className:"border-border-subtle mt-4 space-y-4 border-t pt-4"},h.map(function(e){return F(hy,{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})})),!y&&!d&&F(ry,{inputRef:S,isFocused:o,placeholder:w(k?"comments.addComment":"comments.addReply"),onSubmit:function(e){k?r(u.object.id,e):s(u.object.id,e)}})))},vy=function(e){var t=e.documentId,n=ja(t).translate;return F("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},F(Xp,{icon:"comment",className:"h-18 w-18 text-fg-muted"}),F("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("comments.emptyState")))},yy=function(e){var t=e.documentId,n=uh().provides,o=hh(t).state,i=Mi().provides,r=ja(t).translate,s=Uo(t).canModifyAnnotations,l=De({}),c=De(null),d=!s,u=o.selectedUid?nd(o,o.selectedUid):null,h=(e=>{const t={};for(const n of Object.values(e.pages))for(const o of n){const n=e.byUid[o];if(n&&Yc(n)){const e=n.object.inReplyToId;e&&(t[e]||(t[e]=[])).push(n)}}const n={};for(const[o,i]of Object.entries(e.pages)){const r=Number(o),a=[];for(const n of i){const o=e.byUid[n];o&&Qc(o)&&a.push({page:r,annotation:o,replies:t[o.object.id]??[]})}a.length>0&&(n[r]=a)}return n})(o);Ae(function(){if(u&&c.current){var e=l.current[u.object.id];if(e&&c.current){var t=c.current,n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.top-n.top+t.scrollTop-t.clientHeight/2+o.height/2;t.scrollTo({top:i,behavior:"smooth"})}}},[u]);var m=function(e,t){var o=v(e);o&&(null==n||n.updateAnnotation(o.object.pageIndex,e,{contents:t,modified:new Date}))},g=function(e){null==n||n.deleteAnnotation(e.object.pageIndex,e.object.id)},p=function(e,t){var o=v(e);o&&(null==n||n.createAnnotation(o.object.pageIndex,{id:zn(),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:Ot.Comment}))},f=Object.keys(h).map(Number).sort(function(e,t){return e-t}),v=function(e){var t,n=a(f);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===f.length?F(vy,{documentId:t}):F("div",{ref:c,className:"h-full overflow-y-auto"},F("div",{className:"space-y-6 p-3"},f.map(function(e){return F("div",{key:e,className:"space-y-3"},F("div",{className:"bg-bg-surface sticky top-0 z-10 px-1"},F("div",{className:"border-border-subtle border-b py-2"},F("h3",{className:"text-md text-fg-primary font-semibold"},r("comments.page",{params:{page:e+1}})),F("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}})))),F("div",{className:"space-y-3 px-1"},h[e].map(function(e){return F("div",{key:e.annotation.object.id,ref:function(t){t&&(l.current[e.annotation.object.id]=t)}},F(fy,{entry:e,isSelected:(null==u?void 0:u.object.id)===e.annotation.object.id,onSelect:function(){return t=e.annotation,null==n||n.selectAnnotation(t.object.pageIndex,t.object.id),void(null==i||i.scrollToPage({pageNumber:t.object.pageIndex+1,pageCoordinates:{x:t.object.rect.origin.x,y:t.object.rect.origin.y},alignX:50,alignY:25,behavior:"smooth"}));var t},onUpdate:m,onDelete:g,onReply:p,documentId:t,isReadOnly:d}))})))})))};function by(e){var t=e.documentId,n=(e=>{const{provides:t}=Ja(),[n,o]=Se(Ka);return Ae(()=>{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);Ae(function(){s(l.toString())},[l]);return F("div",{className:"relative"},F("div",{className:"bg-interactive-hover flex items-center rounded"},F("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"},F("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())}}),F("span",{className:"text-sm"},"%")),F(Av,{commandId:"zoom:toggle-menu",documentId:t,itemId:"zoom-menu-button"}),F(Av,{commandId:"zoom:out",documentId:t}),F(Av,{commandId:"zoom:in",documentId:t})))}var wy,xy=function(e){var t=e.documentId,n=ja(t).translate;return F("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},F(Xp,{icon:"palette",className:"h-18 w-18 text-fg-muted"}),F("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("annotation.selectAnnotation")))},Cy={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"},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"}},Iy=(s(s(s(s(s(s(s(s(s(s(wy={},_t.INK,["strokeColor","opacity","strokeWidth","rotation"]),_t.CIRCLE,["color","opacity","strokeColor","strokeStyle","strokeWidth","rotation"]),_t.SQUARE,["color","opacity","strokeColor","strokeStyle","strokeWidth","rotation"]),_t.POLYGON,["strokeColor","opacity","strokeStyle","strokeWidth","color","rotation"]),_t.LINE,["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color","rotation"]),_t.POLYLINE,["strokeColor","opacity","strokeStyle","strokeWidth","lineEndings","color","rotation"]),_t.HIGHLIGHT,["strokeColor","opacity","blendMode"]),_t.UNDERLINE,["strokeColor","opacity","blendMode"]),_t.STRIKEOUT,["strokeColor","opacity","blendMode"]),_t.SQUIGGLY,["strokeColor","opacity","blendMode"]),s(s(s(wy,_t.STAMP,["rotation"]),_t.FREETEXT,["fontFamily","fontSize","fontColor","textAlign","verticalAlign","opacity","color","rotation"]),_t.REDACT,["strokeColor","color","opacity"]));var ky,Sy=["position"],My=function(){var e=v(Se(!1),2),t=e[0],n=e[1],o=De(null),i=De(null);return Ae(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]),Ae(function(){t&&i.current&&i.current.scrollIntoView({block:"center",inline:"start"})},[t]),{open:t,setOpen:n,rootRef:o,selectedItemRef:i}},Ay=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=My(),d=c.open,u=c.setOpen,h=c.rootRef,m=c.selectedItemRef;return F("div",{ref:h,class:"relative inline-block w-full"},F("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),F("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},F("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&&F("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 F("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))})))},Py=function(e){var t=e.children,n=e.className;return F("label",{class:"text-fg-primary mb-2 block text-sm font-medium ".concat(void 0===n?"":n)},t)},Dy=function(e){var t=e.children,n=e.className;return F("span",{class:"text-fg-muted text-xs ".concat(void 0===n?"":n)},t)},Ry=function(e){var t=e.children,n=e.className;return F("section",{class:"mb-6 ".concat(void 0===n?"":n)},t)},zy=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 F("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))}})},Ty=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 F("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)}})},Ey=[{id:Ut.SOLID},{id:Ut.DASHED,dash:[6,2]},{id:Ut.DASHED,dash:[8,4]},{id:Ut.DASHED,dash:[3,3]},{id:Ut.DASHED,dash:[1,2]},{id:Ut.DASHED,dash:[4,2,1,2]},{id:Ut.DASHED,dash:[8,4,1,4]}],_y=function(e){return F("svg",{width:"80",height:"8",viewBox:"0 0 80 8"},F("line",{x1:"0",y1:"4",x2:"80",y2:"4",style:{strokeDasharray:null==e?void 0:e.join(" "),stroke:"currentColor",strokeWidth:"2"}}))},Ny=function(e){return F(Ay,h(h({},e),{},{options:Ey,getOptionKey:function(e){var t;return e.id+((null===(t=e.dash)||void 0===t?void 0:t.join("-"))||"")},renderValue:function(e){return _y(e.dash)},renderOption:function(e){return F("div",{class:"px-1 py-2"},_y(e.dash))}}))},Oy=[Lt.None,Lt.Square,Lt.Circle,Lt.Diamond,Lt.OpenArrow,Lt.ClosedArrow,Lt.ROpenArrow,Lt.RClosedArrow,Lt.Butt,Lt.Slash],Ly=function(e){var t,n=e.ending,o=e.position,i=s(s(s(s(s(s(s(s(s({},Lt.Square,F("path",{d:"M68 -4 L76 -4 L76 4 L68 4 Z"})),Lt.Circle,F("circle",{cx:"72",cy:"0",r:"4"})),Lt.Diamond,F("path",{d:"M72 -5 L77 0 L72 5 L67 0 Z"})),Lt.OpenArrow,F("path",{d:"M67 -5 L77 0 L67 5",fill:"none"})),Lt.ClosedArrow,F("path",{d:"M67 -5 L77 0 L67 5 Z"})),Lt.ROpenArrow,F("path",{d:"M77 -5 L67 0 L77 5",fill:"none"})),Lt.RClosedArrow,F("path",{d:"M77 -5 L67 0 L77 5 Z"})),Lt.Butt,F("path",{d:"M72 -5 L72 5",fill:"none"})),Lt.Slash,F("path",{d:"M67 -5 L77 5",fill:"none"})),r=s(s(s(s(s(s(s(s(s({},Lt.Square,68),Lt.Circle,68),Lt.Diamond,67),Lt.OpenArrow,76),Lt.ClosedArrow,67),Lt.ROpenArrow,67),Lt.RClosedArrow,67),Lt.Butt,72),Lt.Slash,72),a=i[n];return F("svg",{width:"80",height:"20",viewBox:"0 0 80 20",class:"text-fg-primary"},F("g",{transform:"start"===o?"rotate(180 40 10)":""},F("line",{x1:"4",y1:"10",x2:null!==(t=r[n])&&void 0!==t?t:77,y2:"10",stroke:"currentColor","stroke-width":"1.5"}),a&&F("g",{transform:"translate(0, 10)",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5"},a)))},$y=function(e){var t=e.position,n=m(e,Sy);return F(Ay,h(h({},n),{},{options:Oy,getOptionKey:function(e){return e},triggerClass:"px-3 py-1",renderValue:function(e){return F(Ly,{ending:e,position:t})},renderOption:function(e){return F("div",{class:"px-1 py-1"},F(Ly,{ending:e,position:t}))}}))},jy=function(e){return F(Ay,h(h({},e),{},{options:Cn,getOptionKey:function(e){return e},triggerClass:"px-2 py-1 text-sm",renderValue:function(e){return F("span",null,In(e))},renderOption:function(e){return F("div",{class:"px-2 py-1"},In(e))}}))},Fy=function(e){var t=e.value,n=e.onChange,o=(t%360+360)%360,i=function(e){n(((o+e)%360+360)%360)};return F("div",{class:"flex items-center gap-1"},F("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)}},F("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},F("path",{d:"M1 4v6h6"}),F("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"}))),F("div",{class:"relative flex-1"},F("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)}}),F("span",{class:"text-fg-muted pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs"},"°")),F("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)}},F("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},F("path",{d:"M23 4v6h-6"}),F("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))))},Uy=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=My(),a=r.open,s=r.setOpen,l=r.rootRef,c=r.selectedItemRef;return F("div",{ref:l,class:"relative w-full"},F("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)}}),F("button",{type:"button",class:"absolute inset-y-0 right-1 flex items-center",onClick:function(){return s(function(e){return!e})},tabIndex:-1},F("svg",{class:"text-fg-secondary h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},F("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&&F("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 F("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 Hy(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 F("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 By(e){switch(e.config.type){case"color":return He(Wy,h(h({},e),{},{allowTransparent:!1}));case"colorWithTransparent":return He(Wy,h(h({},e),{},{allowTransparent:!0}));case"opacity":return He(qy,h({},e));case"slider":return He(Gy,h({},e));case"strokeStyle":return He(Vy,h({},e));case"lineEndings":return He(Ky,h({},e));case"fontFamily":return He(Zy,h({},e));case"fontSize":return He(Yy,h({},e));case"fontColor":return He(Xy,h({},e));case"textAlign":return He(Qy,h({},e));case"verticalAlign":return He(Jy,h({},e));case"blendMode":return He(tb,h({},e));case"text":return He(nb,h({},e));case"rotation":return He(ob,h({},e));default:return null}}function Wy(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];Ae(function(){return c(null!=n?n:"#000000")},[n]);var d=function(e){c(e),o(e)};return He(Ry,{children:[He(Py,{className:"mb-3",children:r(t.labelKey)}),He("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4",children:[i.map(function(e){return He(Ty,{color:e,active:e===l,onSelect:d},e)}),a&&He(Ty,{color:"transparent",active:"transparent"===l,onSelect:d})]})]})}function qy(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];Ae(function(){return d(null!=r?r:1)},[r]);var u=Yv(c,300);return Ae(function(){u!==r&&a(u)},[u]),He(Ry,{children:[He(Py,{children:s(i.labelKey)}),He(zy,{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}),He(Dy,{children:[Math.round(100*c),"%"]})]})}function Gy(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];Ae(function(){var e;return h(null!==(e=null!=s?s:a.min)&&void 0!==e?e:1)},[s]);var m=Yv(u,300);return Ae(function(){m!==s&&l(m)},[m]),He(Ry,{children:[He(Py,{children:c(a.labelKey)}),He(zy,{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}),He(Dy,{children:[u,null!==(r=a.unit)&&void 0!==r?r:""]})]})}function Vy(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:Ut.SOLID}),2),a=r[0],s=r[1];Ae(function(){var e="object"===w(n)&&null!==n?n:{id:null!=n?n:Ut.SOLID};s(e)},[n]);return He(Ry,{children:[He(Py,{className:"mb-3",children:i(t.labelKey)}),He(Ny,{value:a,onChange:function(e){s(e),o({strokeStyle:e.id,strokeDashArray:e.dash})}})]})}function Ky(e){e.config;var t=e.value,n=e.onChange,o=e.translate,i=null!=t?t:{start:Lt.None,end:Lt.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];Ae(function(){s(i.start),d(i.end)},[t]);return He(Ry,{children:He("div",{class:"grid grid-cols-2 gap-4",children:[He("div",{children:[He(Py,{className:"mb-3",children:o("annotation.lineStart")}),He($y,{value:a,onChange:function(e){s(e),n({start:e,end:c})},position:"start"})]}),He("div",{children:[He(Py,{className:"mb-3",children:o("annotation.lineEnd")}),He($y,{value:c,onChange:function(e){d(e),n({start:a,end:e})},position:"end"})]})]})})}function Zy(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=null!=n?n:Pt.Helvetica,a=vn(r),s=yn(r),l=bn(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];Ae(function(){var e=null!=n?n:Pt.Helvetica;u(vn(e)),g(yn(e)),y(bn(e))},[n]);var b=function(e,t,n){var i=wn(e,{bold:t,italic:n});o(i)};return He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He("div",{class:"mb-3",children:He(jy,{value:d,onChange:function(e){var t=yn(wn(e,{bold:!0,italic:!1})),n=bn(wn(e,{bold:!1,italic:!0})),o=!!t&&m,i=!!n&&f;u(e),g(o),y(i),b(e,o,i)}})}),He("div",{class:"flex gap-2",children:[He(Hy,{title:"Bold",active:m,disabled:!yn(wn(d,{bold:!0,italic:!1})),onClick:function(){if(yn(wn(d,{bold:!0,italic:!1}))){var e=!m;g(e),b(d,e,f)}},className:"font-bold",children:He(Xp,{icon:"bold",size:18})}),He(Hy,{title:"Italic",active:f,disabled:!bn(wn(d,{bold:!1,italic:!0})),onClick:function(){if(bn(wn(d,{bold:!1,italic:!0}))){var e=!f;y(e),b(d,m,e)}},className:"italic",children:He(Xp,{icon:"italic",size:18})})]})]})}function Yy(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];Ae(function(){return s(null!=n?n:12)},[n]);return He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He(Uy,{value:a,onChange:function(e){!Number.isFinite(e)||e<=0||(s(e),o(e))}})]})}function Xy(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];Ae(function(){return l(null!=n?n:"#000000")},[n]);var c=function(e){l(e),o(e)};return He(Ry,{children:[He(Py,{className:"mb-3",children:r(t.labelKey)}),He("div",{class:"grid grid-cols-6 gap-x-1 gap-y-4",children:i.map(function(e){return He(Ty,{color:e,active:e===s,onSelect:c},e)})})]})}function Qy(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:Dt.Left),2),a=r[0],s=r[1];Ae(function(){return s(null!=n?n:Dt.Left)},[n]);var l=function(e){s(e),o(e)};return He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He("div",{class:"flex gap-2",children:[He(Hy,{title:"Align left",active:a===Dt.Left,onClick:function(){return l(Dt.Left)},children:He(Xp,{icon:"alignLeft",size:18})}),He(Hy,{title:"Align center",active:a===Dt.Center,onClick:function(){return l(Dt.Center)},children:He(Xp,{icon:"alignCenter",size:18})}),He(Hy,{title:"Align right",active:a===Dt.Right,onClick:function(){return l(Dt.Right)},children:He(Xp,{icon:"alignRight",size:18})})]})]})}function Jy(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:Rt.Top),2),a=r[0],s=r[1];Ae(function(){return s(null!=n?n:Rt.Top)},[n]);var l=function(e){s(e),o(e)};return He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He("div",{class:"flex gap-2",children:[He(Hy,{title:"Align top",active:a===Rt.Top,onClick:function(){return l(Rt.Top)},children:He(Xp,{icon:"alignTop",size:18})}),He(Hy,{title:"Align middle",active:a===Rt.Middle,onClick:function(){return l(Rt.Middle)},children:He(Xp,{icon:"alignMiddle",size:18})}),He(Hy,{title:"Align bottom",active:a===Rt.Bottom,onClick:function(){return l(Rt.Bottom)},children:He(Xp,{icon:"alignBottom",size:18})})]})]})}var eb=(s(s(s(s(s(s(s(s(s(s(ky={},zt.Normal,"blendMode.normal"),zt.Multiply,"blendMode.multiply"),zt.Screen,"blendMode.screen"),zt.Overlay,"blendMode.overlay"),zt.Darken,"blendMode.darken"),zt.Lighten,"blendMode.lighten"),zt.ColorDodge,"blendMode.colorDodge"),zt.ColorBurn,"blendMode.colorBurn"),zt.HardLight,"blendMode.hardLight"),zt.SoftLight,"blendMode.softLight"),s(s(s(s(s(s(ky,zt.Difference,"blendMode.difference"),zt.Exclusion,"blendMode.exclusion"),zt.Hue,"blendMode.hue"),zt.Saturation,"blendMode.saturation"),zt.Color,"blendMode.color"),zt.Luminosity,"blendMode.luminosity"));function tb(e){var t=e.config,n=e.value,o=e.onChange,i=e.translate,r=v(Se(null!=n?n:zt.Normal),2),a=r[0],s=r[1];Ae(function(){return s(null!=n?n:zt.Normal)},[n]);return He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He("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:An.map(function(e){return He("option",{value:e,children:i(eb[e])},e)})})]})}function nb(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];Ae(function(){return s(null!=n?n:"")},[n]);var l=Yv(a,300);Ae(function(){l!==n&&o(l)},[l]);return He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He("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 ob(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];Ae(function(){return s(null!=n?n:0)},[n]);var l=Yv(a,300);return Ae(function(){l!==n&&o(l)},[l]),He(Ry,{children:[He(Py,{children:i(t.labelKey)}),He(Fy,{value:a,onChange:s})]})}function ib(e){var t=e.documentId,n=e.annotations,o=e.activeTool,i=e.colorPresets,r=uh().provides,l=ja(t).translate;if(!r)return null;var c=n.length>0,d=c?y(new Set(n.map(function(e){return e.object.type}).filter(function(e){return void 0!==e}))):void 0!==(null==o?void 0:o.defaults.type)?[o.defaults.type]:[];if(0===d.length)return null;var u=function(e){var t;if(0===e.length)return[];for(var n=e.map(function(e){var t;return new Set(null!==(t=Iy[e])&&void 0!==t?t:[])}),o=n[0],i=1;i0,h="";if(c.length>1)h=s("annotation.multiSelect",{params:{count:String(c.length)}});else if(u){var m=c[0].object.type,g=rb[m],p=g?s(g):"";h=p?s("annotation.styles",{params:{type:p}}):""}else if(d){var f=d.defaults.type;if(void 0!==f){var v=rb[f],b=v?s(v):"";h=b?s("annotation.defaults",{params:{type:b}}):""}}var w=u?y(new Set(c.map(function(e){return e.object.type}))):void 0!==(null==d?void 0:d.defaults.type)?[d.defaults.type]:[],x=w.length>0&&w.some(function(e){var t,n;return(null!==(t=null===(n=Iy[e])||void 0===n?void 0:n.length)&&void 0!==t?t:0)>0});return x||u||d?He("div",{class:"h-full overflow-y-auto p-4",children:[h&&He("h2",{class:"text-md mb-4 font-medium",children:h}),He(ib,{documentId:n,annotations:c,activeTool:d,colorPresets:l})]}):He(xy,{documentId:n})}var sb=function(e){var t=e.item,n=e.pageNumber,o=e.isSelected,i=e.onSelect,r="text"===t.kind?Hp:Bp;return F("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":"")},F("div",{class:"flex-shrink-0"},F(r,{size:20,primaryColor:t.markColor,secondaryColor:t.redactionColor})),F("div",{class:"min-w-0 flex-1"},F("div",{class:"text-fg-muted text-xs"},"Page ",n),F("div",{class:"text-fg-primary text-sm font-medium"},"text"===t.kind?"Text Redaction":"Area Redaction"),"text"===t.kind&&t.text&&F("div",{class:"text-fg-muted mt-1 truncate text-xs italic"},'"',t.text,'"')))},lb=function(e){var t=e.documentId,n=ja(t).translate;return F("div",{class:"text-fg-muted flex flex-col items-center gap-2 p-4"},F(Xp,{icon:"redact",className:"h-18 w-18 text-fg-muted"}),F("div",{className:"text-fg-muted max-w-[150px] text-center text-sm"},n("redaction.emptyState",{fallback:"No pending redactions"})))};function cb(e){var t=e.documentId,n=(e=>{const{provides:t}=dg(),[n,o]=Se(Qm),i=Re(()=>t?t.forDocument(e):null,[t,e]);return Ae(()=>{if(i){try{o(i.getState())}catch(e){o(Qm)}return i.onStateChange(e=>{o(e)})}o(Qm)},[i]),{state:n,provides:i}})(t),o=n.state,i=n.provides,r=Uo(t),a=r.canModifyAnnotations,s=r.canModifyContents,l=Mi().provides,c=ja(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 F("div",{class:"flex h-full flex-col"},F("div",{class:"border-border-subtle border-b p-3"},F("h2",{class:"text-fg-primary text-md font-semibold"},c("redaction.panel.title",{fallback:"Redactions"})),d.length>0&&F("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}}))),F("div",{class:"flex-1 overflow-y-auto p-3"},0===d.length?F(lb,{documentId:t}):F("div",{class:"space-y-2"},d.map(function(e){var t,n=e.item,r=e.pageNumber;return F(sb,{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&&F("div",{class:"border-border-subtle flex gap-2 border-t p-3"},F(Jp,{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"})),F(Jp,{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"}))))}function db(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,F("div",h(h({},i),jr(t)),F("div",{style:s,className:"border-border-subtle bg-bg-elevated rounded-lg border shadow-lg"},F("div",{className:"flex items-center gap-1 p-1"},t.items.map(function(e){return F(hb,{key:e.id,item:e,documentId:n,props:o})}))))}function ub(e){var t=e.item,n=e.documentId,o=Aa(t.commandId,n);return null!=o&&o.visible?F("div",h({},jr(t)),F(Av,{commandId:t.commandId,documentId:n,variant:t.variant})):null}function hb(e){var t,n=e.item,o=e.documentId,i=e.props;switch(n.type){case"command-button":return F(ub,{item:n,documentId:o});case"divider":return F("div",h({},jr(n)),F("div",{className:"bg-border-default h-6 w-px","aria-hidden":"true"}));case"group":return F("div",h({className:"flex items-center gap-".concat(null!==(t=n.gap)&&void 0!==t?t:1)},jr(n)),n.items.map(function(e){return F(hb,{key:e.id,item:e,documentId:o,props:i})}));default:return null}}function mb(e){var t,n,o=e.schema,i=e.documentId,r=e.className,a=o.content,s=o.position,l=ra().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 F("div",{className:"z-3 absolute ".concat(c," ").concat(r||""),style:d,"data-overlay-id":o.id},l(a.componentId,i))}function gb(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=De(null),d=v(Se(t),2),u=d[0],h=d[1],m=v(Se(!1),2),g=m[0],p=m[1];Ae(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]),Ae(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 Ae(function(){return document.body.style.overflow=u?"hidden":"",function(){document.body.style.overflow=""}},[u]),u?He("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:He("div",{className:_p("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)&&He("div",{className:"border-border-subtle flex flex-shrink-0 items-center justify-between border-b px-6 py-4",children:[n&&He("h2",{className:"text-fg-primary text-lg font-semibold",children:n}),l&&He(Jp,{onClick:i,className:"hover:bg-interactive-hover p-1",children:He(Xp,{icon:"x",className:"h-5 w-5"})})]}),He("div",{className:"flex-1 overflow-y-auto px-6 py-4 md:max-h-[80vh] md:flex-none",children:o})]})}):null}function pb(e){var t=e.documentId,n=e.isOpen,o=e.onClose,i=e.onExited,r=Mi().provides,a=Fh().provides,s=ja(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),C=x[0],I=x[1],k=null==r?void 0:r.forDocument(t).getMetrics(),S=(null==k?void 0:k.currentPage)||1,M=(null==r?void 0:r.forDocument(t).getTotalPages())||0;Ae(function(){n&&(d("all"),m(""),f(!0),w(!1),I(""))},[n]);var A=("custom"!==c||h.trim().length>0)&&!b;return F(gb,{open:null!=n&&n,title:s("print.title"),onClose:o,onExited:i,className:"md:w-[32rem]"},F("div",{className:"space-y-6"},F("div",null,F("label",{className:"text-fg-secondary mb-3 block text-sm font-medium"},s("print.pages")),F("div",{className:"space-y-2"},F("label",{className:"flex items-center"},F("input",{type:"radio",name:"pageRange",value:"all",checked:"all"===c,onChange:function(){return d("all")},disabled:b,className:"accent-accent mr-2"}),F("span",{className:"text-fg-primary text-sm"},s("print.all"))),F("label",{className:"flex items-center"},F("input",{type:"radio",name:"pageRange",value:"current",checked:"current"===c,onChange:function(){return d("current")},disabled:b,className:"accent-accent mr-2"}),F("span",{className:"text-fg-primary text-sm"},s("print.current",{params:{currentPage:S}}))),F("label",{className:"flex items-start"},F("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"}),F("div",{className:"flex-1"},F("span",{className:"text-fg-primary mb-1 block text-sm"},s("print.specify")),F("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()&&M>0&&F("p",{className:"text-fg-muted mt-1 text-xs"},s("print.current",{params:{totalPages:M}})))))),F("div",null,F("label",{className:"flex items-center"},F("input",{type:"checkbox",checked:p,onChange:function(e){return f(e.target.checked)},disabled:b,className:"accent-accent mr-2"}),F("span",{className:"text-fg-secondary text-sm font-medium"},s("print.annotation")))),b&&F("div",{className:"bg-state-info-light flex items-center space-x-3 rounded-md p-3"},F(ny,{className:"text-accent"}),F("span",{className:"text-accent text-sm"},C)),F("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},F(Jp,{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")),F(Jp,{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),I(s("print.loading"));var i=null==a?void 0:a.forDocument(t).print(n);i&&(i.onProgress(function(e){I(e.message)}),i.wait(function(){w(!1),I(""),null==o||o()},function(e){console.error("Print failed:",e),w(!1),I("")}))}catch(e){console.error("Print failed:",e),w(!1),I("")}},disabled:!A,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&&F(ny,{size:"sm"}),F("span",null,s(b?"print.printing":"print.print"))))))}function fb(e){var t,n=e.documentId,o=e.isOpen,i=e.onClose,r=e.onExited,s=e.source,l=Mi().provides,c=uh().provides,d=Al().provides,u=ja(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],C=(null==l?void 0:l.forDocument(n).getTotalPages())||1,I=null==c?void 0:c.forDocument(n),k=null==d?void 0:d.forDocument(n),S=null==I?void 0:I.getSelectedAnnotation(),M=null!==(t=null==k?void 0:k.getFormattedSelection())&&void 0!==t?t:[];Ae(function(){o&&(g("url"),y(""),x(1))},[o]);var A="page"===m||f.trim().length>0;return F(gb,{open:null!=o&&o,title:u("link.title")||"Insert Link or Page",onClose:i,onExited:r,className:"md:w-[28rem]"},F("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:Mt.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==I||I.createAnnotation(S.object.pageIndex,{id:zn(),type:_t.LINK,pageIndex:S.object.pageIndex,rect:i,inReplyToId:S.object.id,replyType:$t.Group,target:e,strokeStyle:Ut.UNDERLINE,strokeColor:"#0000FF",strokeWidth:2})}}catch(e){o.e(e)}finally{o.f()}return!0},n=function(){if(0===M.length)return!1;var t,n=null==k?void 0:k.getSelectedText(),o=a(M);try{var i=function(){var o=t.value;null==n||n.wait(function(t){var n,i=zn();null==I||I.createAnnotation(o.pageIndex,{id:i,created:new Date,flags:["print"],type:_t.HIGHLIGHT,blendMode:zt.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==I||I.createAnnotation(o.pageIndex,{id:zn(),type:_t.LINK,pageIndex:o.pageIndex,rect:l,inReplyToId:i,replyType:$t.Group,target:e,strokeStyle:Ut.UNDERLINE,strokeColor:"#0000FF",strokeWidth:2})}}catch(e){s.e(e)}finally{s.f()}null==I||I.selectAnnotation(o.pageIndex,i)},En)};for(o.s();!(t=o.n()).done;)i()}catch(e){o.e(e)}finally{o.f()}return null==k||k.clear(),!0};"annotation"===s?t():"selection"===s?n():t()||n(),null==i||i()}()},className:"space-y-6"},F("div",{className:"border-border-subtle flex border-b"},F(Op,{active:"url"===m,onClick:function(){return g("url")}},u("link.url")||"URL"),F(Op,{active:"page"===m,onClick:function(){return g("page")}},u("link.page")||"Page")),F("div",{className:"bg-bg-muted rounded-lg"},"url"===m?F("div",null,F("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},u("link.enterUrl")||"Enter URL"),F("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})):F("div",null,F("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},u("link.enterPage")||"Enter Page Number"),F("input",{type:"number",min:1,max:C,value:w,onInput:function(e){var t=parseInt(e.target.value,10);isNaN(t)||x(Math.max(1,Math.min(C,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}),F("p",{className:"text-fg-muted mt-1 text-xs"},u("link.pageRange",{params:{totalPages:C}})||"Page 1 to ".concat(C)))),F("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},F(Jp,{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"),F(Jp,{type:"submit",disabled:!A,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 vb(e){var t=e.documentId,n=ci().provides,o=Ai(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=De(null),p=v(Se(a.toString()),2),f=p[0],y=p[1],b=De(null);Ae(function(){y(a.toString())},[a]);var w=ze(function(){g.current&&clearTimeout(g.current),g.current=setTimeout(function(){h||d(!1)},4e3)},[h]);Ae(function(){if(n)return n.onScrollActivity(function(e){e.documentId===t&&(d(!0),w())})},[n,t,w]),Ae(function(){return function(){g.current&&clearTimeout(g.current)}},[]);return s<=1?null:F("div",{onMouseEnter:function(){m(!0),d(!0),g.current&&clearTimeout(g.current)},onMouseLeave:function(){m(!1),w()},className:"pointer-events-auto"},F("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")},F(Av,{commandId:"scroll:previous-page",documentId:t,variant:"icon"}),F("div",{className:"flex items-center gap-1 px-1"},F("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"}),F("span",{className:"text-fg-secondary text-sm"}," ",s)),F(Av,{commandId:"scroll:next-page",documentId:t,variant:"icon"})))}var yb=function(e,t,n){return!function(e,t,n){return lo(e.core,t,n)}(e,t,n)},bb={"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(Fa.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)===Fa.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(Fa.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)===Fa.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(Ui);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(Ui);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 yb(t,n,Zt.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(Ui);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 Vr(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(Ui);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 Vr(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(Ui);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 Vr(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(Ui);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 Vr(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(Ui);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 Vr(t.plugins,n,"left","main","annotation-panel")},disabled:function(e){var t=e.state,n=e.documentId;return yb(t,n,Zt.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(Ui);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(Di.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)===Di.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(Di.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)===Di.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(Di.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)===Di.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(hi.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)===hi.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(hi.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)===hi.Horizontal}},"scroll:next-page":{id:"scroll:next-page",labelKey:"page.next",icon:"chevronRight",categories:["page","navigation","navigation-next"],shortcuts:["Ctrl+]","Meta+]","ArrowRight"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).scrollToNextPage()},disabled:function(e){var t,n,o=e.state,i=e.documentId;return(null===(t=o.plugins.scroll)||void 0===t||null===(t=t.documents[i])||void 0===t?void 0:t.currentPage)>=(null===(n=o.plugins.scroll)||void 0===n||null===(n=n.documents[i])||void 0===n?void 0:n.totalPages)}},"scroll:previous-page":{id:"scroll:previous-page",labelKey:"page.previous",icon:"chevronLeft",categories:["page","navigation","navigation-previous"],shortcuts:["Ctrl+[","Meta+[","ArrowLeft"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("scroll"))||void 0===t?void 0:t.provides();null==i||i.forDocument(o).scrollToPreviousPage()},disabled:function(e){var t,n=e.state,o=e.documentId;return(null===(t=n.plugins.scroll)||void 0===t||null===(t=t.documents[o])||void 0===t?void 0:t.currentPage)<=1}},"mode:view":{id:"mode:view",labelKey:"mode.view",categories:["mode","mode-view"],action:function(e){var t,n,o=e.registry,i=e.documentId,r=null===(t=o.getPlugin("ui"))||void 0===t?void 0:t.provides(),a=null===(n=o.getPlugin("interaction-manager"))||void 0===n?void 0:n.provides();if(r&&a){var s=a.forDocument(i);s&&(s.activateDefaultMode(),r.forDocument(i).closeToolbarSlot("top","secondary"))}},active:function(e){var t=e.state,n=e.documentId;return!Gr(t.plugins,n,"top","secondary")}},"mode:annotate":{id:"mode:annotate",labelKey:"mode.annotate",categories:["mode","mode-annotate","annotation"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","annotation-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return Gr(t.plugins,n,"top","secondary","annotation-toolbar")}},"mode:shapes":{id:"mode:shapes",labelKey:"mode.shapes",categories:["mode","mode-shapes","annotation"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","shapes-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return Gr(t.plugins,n,"top","secondary","shapes-toolbar")}},"mode:redact":{id:"mode:redact",labelKey:"mode.redact",categories:["mode","mode-redact","redaction"],action:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin("ui"))||void 0===t?void 0:t.provides();i&&i.setActiveToolbar("top","secondary","redaction-toolbar",o)},active:function(e){var t=e.state,n=e.documentId;return Gr(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=od(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(dc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Us))||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 h=s.getTool("highlight");if(h&&eu(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=zn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:_t.HIGHLIGHT,blendMode:zt.Multiply,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},En)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.f()}u.clear(),d.setActiveTool("highlight"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"highlight"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("highlight")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-underline":{id:"annotation:add-underline",labelKey:"annotation.underline",icon:"underline",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Us))||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 h=s.getTool("underline");if(h&&nu(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=zn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:_t.UNDERLINE,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},En)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.f()}u.clear(),d.setActiveTool("underline"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"underline"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("underline")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-strikeout":{id:"annotation:add-strikeout",labelKey:"annotation.strikeout",icon:"strikethrough",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Us))||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 h=s.getTool("strikeout");if(h&&ou(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=zn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:_t.STRIKEOUT,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},En)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.f()}u.clear(),d.setActiveTool("strikeout"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"strikeout"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("strikeout")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-squiggly":{id:"annotation:add-squiggly",labelKey:"annotation.squiggly",icon:"squiggly",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||void 0===t?void 0:t.provides(),l=null===(n=i.getPlugin(Us))||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 h=s.getTool("squiggly");if(h&&tu(h)){var m=h.defaults,g=u.getFormattedSelection(),p=u.getSelectedText();if(g.length>0){var f,v=a(g);try{var y=function(){var e=f.value;p.wait(function(t){var n=zn();d.createAnnotation(e.pageIndex,{id:n,created:new Date,flags:["print"],type:_t.SQUIGGLY,strokeColor:m.strokeColor,opacity:m.opacity,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,custom:{text:t.join("\n")}}),d.selectAnnotation(e.pageIndex,n)},En)};for(v.s();!(f=v.n()).done;)y()}catch(e){v.e(e)}finally{v.f()}u.clear(),d.setActiveTool("squiggly"),c.setActiveToolbar("top","secondary","annotation-toolbar",r)}else{var b;"squiggly"===(null===(b=d.getActiveTool())||void 0===b?void 0:b.id)?d.setActiveTool(null):d.setActiveTool("squiggly")}}}}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-ink":{id:"annotation:add-ink",labelKey:"annotation.ink",icon:"pencilMarker",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||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[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-text":{id:"annotation:add-text",labelKey:"annotation.text",icon:"text",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||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[dc])||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 yb(t,n,Zt.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(dc))||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[dc])||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 yb(t,n,Zt.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=od(o.plugins.annotation,"square"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=od(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(dc))||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[dc])||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 yb(t,n,Zt.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=od(o.plugins.annotation,"circle"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=od(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(dc))||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[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-line":{id:"annotation:add-line",labelKey:"annotation.line",icon:"line",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||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[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-arrow":{id:"annotation:add-arrow",labelKey:"annotation.arrow",icon:"lineArrow",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||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[dc])||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 yb(t,n,Zt.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=od(o.plugins.annotation,"polygon"))||void 0===t?void 0:t.strokeColor,secondaryColor:null===(n=od(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(dc))||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[dc])||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:add-polyline":{id:"annotation:add-polyline",labelKey:"annotation.polyline",icon:"zigzag",iconProps:function(e){var t;return{primaryColor:null===(t=od(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(dc))||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[dc])||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 yb(t,n,Zt.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(dc))||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 yb(t,n,Zt.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(dc))||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 yb(t,n,Zt.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(dc))||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(dc))||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(dc))||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!!yb(o,i,Zt.ModifyAnnotations)||"disabled"===(null===(t=n.getPlugin(dc))||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 yb(t,n,Zt.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 yb(t,n,Zt.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 yb(t,n,Zt.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(Ui);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 Vr(t.plugins,n,"left","main","annotation-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(dc))||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 yb(t,n,Zt.ModifyAnnotations)}},"annotation:toggle-link":{id:"annotation:toggle-link",labelKey:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(dc))||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(dc))||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(dc))||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(dc))||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},disabled:function(e){var t=e.state,n=e.documentId;return yb(t,n,Zt.ModifyAnnotations)}},"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(Ui);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 Vr(t.plugins,n,"right","main","comment-panel")},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(dc))||void 0===t?void 0:t.provides().forDocument(o),r=null==i?void 0:i.getSelectedAnnotation();return!r||r.object.type!==_t.LINK}},"annotation:goto-link":{id:"annotation:goto-link",labelKey:"annotation.gotoLink",icon:"externalLink",categories:["annotation","annotation-link"],action:function(e){var t,n,o,i=e.registry,r=e.documentId,a=null===(t=i.getPlugin(dc))||void 0===t?void 0:t.provides(),s=null===(n=i.getPlugin("scroll"))||void 0===n?void 0:n.provides();if(a){var l=a.forDocument(r),c=l.getSelectedAnnotation();if(c){var d=null;if(Xc(c))d=c.object;else{var u=l.getAttachedLinks(c.object.id);u.length>0&&(d=u[0].object)}if(null!==(o=d)&&void 0!==o&&o.target){var h=d.target;if("action"===h.type){var m=h.action;if(m.type===Et.URI)window.open(m.uri,"_blank","noopener,noreferrer");else if(m.type===Et.Goto&&s){var g=m.destination;s.forDocument(r).scrollToPage({pageNumber:g.pageIndex+1,behavior:"smooth"})}}else if("destination"===h.type&&s){var p=h.destination;s.forDocument(r).scrollToPage({pageNumber:p.pageIndex+1,behavior:"smooth"})}}}}},visible:function(e){var t,n=e.registry,o=e.documentId,i=null===(t=n.getPlugin(dc))||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 yb(t,n,Zt.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 yb(t,n,Zt.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(Us))||void 0===n?void 0:n.provides(),c=null===(o=r.getPlugin("ui"))||void 0===o?void 0:o.provides();if(s&&l&&c){var d=s.forDocument(a),u=null==l?void 0:l.forDocument(a);(null!==(i=null==u?void 0:u.getFormattedSelection())&&void 0!==i?i:[]).length>0?(d.queueCurrentSelectionAsPending(),c.setActiveToolbar("top","secondary","redaction-toolbar",a)):d.toggleRedactSelection()}},active:function(e){var t,n=e.state,o=e.documentId,i=null===(t=n.plugins[ig])||void 0===t?void 0:t.documents[o];return(null==i?void 0:i.activeType)===_m.RedactSelection},disabled:function(e){var t=e.state,n=e.documentId;return yb(t,n,Zt.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[ig])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)||yb(n,o,Zt.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[ig])||void 0===t?void 0:t.documents[o];return 0===(null==i?void 0:i.pendingCount)||yb(n,o,Zt.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(dc))||void 0===t?void 0:t.provides(),s=null===(n=o.getPlugin(ig))||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(dc))||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 yb(t,n,Zt.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 yb(t,n,Zt.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 yb(t,n,Zt.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(km))||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[km])||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(km))||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[km])||void 0===t?void 0:t.documents[o];return!(null!=i&&i.global.canRedo)}}},wb={"zoom.level":function(e){var t,n,o=e.state,i=e.documentId,r=i&&null!==(t=null===(n=o.plugins[Ha])||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)}}},xb={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"}}},Cb={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 Ib(e,t){var n=h({},e);for(var o in t){var i=t[o];i&&"object"===w(i)&&!Array.isArray(i)?n[o]=Ib(e[o]||{},i):void 0!==i&&(n[o]=i)}return n}function kb(e,t){return{colors:Ib(e.colors,t)}}function Sb(e){return"system"===e?"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Mb(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Ab(e){return":host {\n".concat(function(e){var t=[];return function e(n,o){for(var i=0,r=Object.entries(n);i1?F("div",{className:"bg-bg-surface-alt flex items-end pr-2 pt-2"},F("div",{className:"flex flex-1 items-end overflow-x-auto pl-4"},t.map(function(e){var t,o,i=n===e.id;return F("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")},F("span",{className:"min-w-0 flex-1 truncate"},null!==(t=e.name)&&void 0!==t?t:"Document ".concat(e.id.slice(0,8))),i&&F("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")},F(Xp,{icon:"x",size:14})))}),a&&F("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"},F(Xp,{icon:"plus",size:14})))):null}function Db(){var e=va().provides,t=ja().translate;return F("div",{className:"bg-bg-app flex h-full w-full items-center justify-center"},F("div",{className:"flex max-w-sm flex-col items-center text-center"},F("div",{className:"bg-accent-light mb-6 rounded-full p-5"},F(Xp,{icon:"file",size:48,className:"text-accent"})),F("h2",{className:"text-fg-primary mb-2 text-xl font-semibold"},t("emptyState.title")),F("p",{className:"text-fg-secondary mb-6 text-sm leading-relaxed"},t("emptyState.description"),F("br",null),t("emptyState.descriptionMulti")),F("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"},F(Xp,{icon:"plus",size:16}),t("emptyState.openButton")),F("p",{className:"text-fg-muted mt-4 text-xs"},t("emptyState.supportedFormats"))))}function Rb(e){var t=e.documentState,o=va().provides,i=ja().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===Qt.Password,f=p&&!m,y=p&&m;if(!p)return F("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},F("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"},F("div",{className:"bg-state-error-light mb-4 rounded-full p-4"},F(Xp,{icon:"alertTriangle",size:28,className:"text-state-error"})),F("h3",{className:"text-fg-primary text-lg font-semibold"},i("documentError.title")),F("p",{className:"text-fg-secondary mt-2 text-sm"},t.error||i("documentError.unknown")),h&&F("p",{className:"text-fg-muted mt-1 text-xs"},i("documentError.errorCode",{params:{code:String(h)}})),F("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 F("div",{className:"bg-bg-app flex h-full items-center justify-center p-8"},F("div",{className:"bg-bg-surface border-border-default w-full max-w-sm rounded-xl border p-6 shadow-lg"},F("div",{className:"flex flex-col items-center text-center"},F("div",{className:"bg-accent-light mb-4 rounded-full p-4"},F(Xp,{icon:"lock",size:28,className:"text-accent"})),F("h3",{className:"text-fg-primary text-lg font-semibold"},i("passwordPrompt.title")),u&&F("p",{className:"text-fg-muted mt-1 text-sm"},u)),F("p",{className:"text-fg-secondary mt-4 text-center text-sm"},f&&i("passwordPrompt.required"),y&&i("passwordPrompt.incorrect")),F("div",{className:"mt-5"},F("label",{className:"text-fg-primary mb-1.5 block text-sm font-medium"},i("passwordPrompt.label")),F("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&&F("div",{className:"bg-state-error-light border-state-error mt-3 flex items-center gap-2 rounded-md border p-3"},F(Xp,{icon:"alertTriangle",size:16,className:"text-state-error flex-shrink-0"}),F("p",{className:"text-state-error text-sm"},i("passwordPrompt.incorrectWarning"))),F("div",{className:"mt-6 flex gap-3"},F("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")),F("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 zb(e){var t=e.documentId,n=e.className,o=Aa("mode:view",t),i=Aa("mode:annotate",t),r=Aa("mode:shapes",t),a=Aa("mode:redact",t),s=Aa("tabs:overflow-menu",t),l=Re(function(){return[o,i,r,a].find(function(e){return null==e?void 0:e.active})||o},[o,i,r,a]),c=ze(function(e){e.preventDefault(),e.stopPropagation(),s&&!s.disabled&&s.execute()},[s]);if(!s||!s.visible)return null;var d=s.active;return F("div",{style:{maxWidth:"100px",width:"100px"},className:n},F(Jp,{className:"bg-bg-surface col-start-1 row-start-1 !w-full appearance-none rounded-md py-1.5 pl-3 pr-2 text-[13px] ".concat(d?"bg-interactive-selected ring-accent border-none shadow ring":"border-border-default outline-border-default hover:bg-interactive-hover hover:ring-accent outline outline-1 -outline-offset-1 hover:ring"," flex flex-row items-center justify-between gap-2"),onClick:c,disabled:s.disabled,style:{height:34}},F("span",{className:"min-w-0 flex-1 truncate text-left ".concat(d?"text-accent":"text-fg-primary")},null==l?void 0:l.label),F(Xp,{icon:"chevronDown",className:"h-4 w-4 ".concat(d?"text-accent":"text-fg-secondary")})))}function Tb(e){var t=e.documentId,n=Cm().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=De(null),f=De(null),y=ja(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)};Ae(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 F(H,null,F(gb,{open:i,onClose:b,title:y("capture.title"),className:"md:w-[48rem]"},F("div",{className:"space-y-6"},F("div",{className:"flex justify-center"},d&&F("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"}})),F("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},F(Jp,{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")),F(Jp,{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"))))),F("a",{ref:f,style:{display:"none"},href:"",download:""}))}var Eb=[{flag:Zt.Print,labelKey:"protect.permissions.print"},{flag:Zt.PrintHighQuality,labelKey:"protect.permissions.printHighQuality"},{flag:Zt.CopyContents,labelKey:"protect.permissions.copy"},{flag:Zt.ExtractForAccessibility,labelKey:"protect.permissions.accessibility"},{flag:Zt.ModifyContents,labelKey:"protect.permissions.modify"},{flag:Zt.ModifyAnnotations,labelKey:"protect.permissions.annotations"},{flag:Zt.FillForms,labelKey:"protect.permissions.fillForms"},{flag:Zt.AssembleDocument,labelKey:"protect.permissions.assemble"}];function _b(e){var t=e.permissions,n=e.translate,o=e.label;return F("div",null,F("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},null!=o?o:n("security.viewPermissions.restrictedActions")),F("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2"},Eb.map(function(e){var o,i=(o=e.flag,0!==(t&o));return F("div",{key:e.flag,className:"flex items-center rounded-md p-2 ".concat(i?"text-fg-primary":"text-fg-muted")},F(Xp,{icon:i?"check":"x",className:"mr-2 h-4 w-4 flex-shrink-0 ".concat(i?"text-state-success":"text-state-error")}),F("span",{className:"text-sm"},n(e.labelKey)))})))}function Nb(e){var t,n,o,i=e.documentId,r=e.isOpen,s=e.onClose,l=e.onExited,c=ja(i).translate,d=va().provides,u=Oo(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],C=w[1],I=v(Se(!1),2),k=I[0],S=I[1],M=v(Se(!1),2),A=M[0],P=M[1],D=v(Se(null),2),R=D[0],z=D[1],T=v(Se(!1),2),E=T[0],_=T[1],N=v(Se(""),2),O=N[0],L=N[1],$=v(Se(""),2),j=$[0],U=$[1],H=v(Se(!1),2),B=H[0],W=H[1],q=v(Se(!1),2),G=q[0],V=q[1],K=v(Se(""),2),Z=K[0],Y=K[1],X=v(Se(""),2),Q=X[0],J=X[1],ee=v(Se(!1),2),te=ee[0],ne=ee[1],oe=Se(new Set(Eb.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];Ae(function(){r&&(C(""),S(!1),P(!1),z(null),_(!1),L(""),U(""),W(!1),V(!1),Y(""),J(""),ne(!1),ae(new Set(Eb.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=O===j,ge=Z===Q,pe=!E||O.length>0&&me,fe=!G||Z.length>0&&ge,ve=(E||G)&&pe&&fe&&!le,ye=function(){d&&x&&(P(!0),z(null),d.unlockOwnerPermissions(i,x).wait(function(e){P(!1),e?b("choose-action"):z(c("security.unlock.invalidPassword"))},function(e){var t,n;P(!1),z(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(G){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=Zt.AllowAll;var o=E?O:"",r=G?Z:E?O:"";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 F("div",{className:"space-y-6"},F("div",{className:"bg-bg-subtle rounded-lg"},F("label",{className:"flex cursor-pointer items-start"},F("input",{type:"checkbox",checked:E,onChange:function(e){return _(e.target.checked)},className:"accent-accent mr-3 mt-0.5"}),F("div",{className:"flex-1"},F("span",{className:"text-fg-primary block font-medium"},c("protect.openPassword.title")),F("span",{className:"text-fg-muted text-sm"},c("protect.openPassword.description")))),E&&F("div",{className:"mt-4 space-y-3 pl-6"},F("div",null,F("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.openPassword.label")),F("div",{className:"relative"},F("input",{type:B?"text":"password",value:O,onInput:function(e){return L(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"}),F("button",{type:"button",onClick:function(){return W(!B)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},F(Xp,{icon:B?"eye-off":"eye",className:"h-4 w-4"})))),F("div",null,F("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.openPassword.confirm")),F("input",{type:B?"text":"password",value:j,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(j&&!me?"border-state-error focus:border-state-error":"focus:border-accent")}),j&&!me&&F("p",{className:"text-state-error mt-1 text-xs"},c("protect.passwordMismatch"))))),F("div",{className:"bg-bg-subtle rounded-lg"},F("label",{className:"flex cursor-pointer items-start"},F("input",{type:"checkbox",checked:G,onChange:function(e){return V(e.target.checked)},className:"accent-accent mr-3 mt-0.5"}),F("div",{className:"flex-1"},F("span",{className:"text-fg-primary block font-medium"},c("protect.permissions.title")),F("span",{className:"text-fg-muted text-sm"},c("protect.permissions.description")))),G&&F("div",{className:"mt-4 space-y-4 pl-6"},F("div",{className:"border-border-subtle border-b pb-4"},F("div",null,F("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.ownerPassword.label")),F("div",{className:"relative"},F("input",{type:te?"text":"password",value:Z,onInput:function(e){return Y(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"}),F("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"},F(Xp,{icon:te?"eye-off":"eye",className:"h-4 w-4"})))),F("div",{className:"mt-3"},F("label",{className:"text-fg-secondary mb-1 block text-sm"},c("protect.ownerPassword.confirm")),F("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&&F("p",{className:"text-state-error mt-1 text-xs"},c("protect.passwordMismatch")))),F("div",null,F("label",{className:"text-fg-secondary mb-2 block text-sm font-medium"},c("protect.permissions.allowedActions")),F("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2"},Eb.map(function(e){return F("label",{key:e.flag,className:"hover:bg-bg-surface flex cursor-pointer items-center rounded-md p-2 transition-colors"},F("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===Zt.PrintHighQuality&&n.add(Zt.Print)),n});var t},className:"accent-accent mr-2"}),F("span",{className:"text-fg-primary text-sm"},c(e.labelKey)))}))))),E&&G&&F("div",{className:"bg-state-info-light flex items-start space-x-2 rounded-md p-3"},F(Xp,{icon:"info",className:"text-accent mt-0.5 h-4 w-4 flex-shrink-0"}),F("p",{className:"text-fg-secondary text-sm"},c("protect.bothPasswordsNote"))),!E&&!G&&!ue&&F("div",{className:"bg-state-warning-light flex items-start space-x-2 rounded-md p-3"},F(Xp,{icon:"alertTriangle",className:"text-state-warning mt-0.5 h-4 w-4 flex-shrink-0"}),F("p",{className:"text-fg-secondary text-sm"},c("protect.noProtectionSelected"))),ue&&F("div",{className:"bg-state-error-light flex items-start space-x-2 rounded-md p-3"},F(Xp,{icon:"alertTriangle",className:"text-state-error mt-0.5 h-4 w-4 flex-shrink-0"}),F("p",{className:"text-state-error text-sm"},ue)),F("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},m&&g&&F(Jp,{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")),F(Jp,{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&&F(ny,{size:"sm"}),F("span",null,c(le?"protect.applying":"protect.apply")))))};return F(gb,{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 F("div",{className:"space-y-5"},F("p",{className:"text-fg-secondary text-sm"},c("protect.encrypted.description")),F("div",null,F("label",{className:"text-fg-primary mb-2 block text-sm font-medium"},c("protect.encrypted.enterOwnerPassword")),F("div",{className:"relative"},F("input",{type:k?"text":"password",value:x,onInput:function(e){return C(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()}}),F("button",{type:"button",onClick:function(){return S(!k)},className:"text-fg-muted hover:text-fg-secondary absolute right-2 top-1/2 -translate-y-1/2"},F(Xp,{icon:k?"eye-off":"eye",className:"h-4 w-4"}))),R&&F("p",{className:"text-state-error mt-2 text-xs"},R)),F(_b,{permissions:p,translate:c}),F("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},F(Jp,{onClick:ye,disabled:!x||A,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"},A&&F(ny,{size:"sm"}),F("span",null,c("protect.encrypted.unlockAndEdit")))));case"choose-action":return F("div",{className:"space-y-5"},F("p",{className:"text-fg-secondary text-sm"},c("protect.modifyProtection.description")),F("div",{className:"space-y-3"},F("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"},F("div",{className:"bg-accent/10 mr-4 rounded-full p-2"},F(Xp,{icon:"lock",size:20,className:"text-accent"})),F("div",null,F("span",{className:"text-fg-primary block font-medium"},c("protect.modifyProtection.changeOption")),F("span",{className:"text-fg-muted text-sm"},c("protect.modifyProtection.changeDescription")))),F("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"},F("div",{className:"bg-state-error-light mr-4 rounded-full p-2"},F(Xp,{icon:"unlock",size:20,className:"text-state-error"})),F("div",null,F("span",{className:"text-fg-primary block font-medium"},c("protect.modifyProtection.removeOption")),F("span",{className:"text-fg-muted text-sm"},c("protect.modifyProtection.removeDescription"))))),F("div",{className:"border-border-subtle flex justify-end border-t pt-4"},F(Jp,{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 F("div",{className:"space-y-5"},F("div",{className:"bg-state-warning-light flex items-start space-x-3 rounded-lg p-4"},F(Xp,{icon:"alertTriangle",className:"text-state-warning mt-0.5 h-5 w-5 flex-shrink-0"}),F("div",null,F("p",{className:"text-fg-primary font-medium"},c("protect.removeProtection.warning")),F("p",{className:"text-fg-secondary mt-1 text-sm"},c("protect.removeProtection.description")))),ue&&F("div",{className:"bg-state-error-light flex items-start space-x-2 rounded-md p-3"},F(Xp,{icon:"alertTriangle",className:"text-state-error mt-0.5 h-4 w-4 flex-shrink-0"}),F("p",{className:"text-state-error text-sm"},ue)),F("div",{className:"border-border-subtle flex justify-end space-x-3 border-t pt-4"},F(Jp,{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")),F(Jp,{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&&F(ny,{size:"sm"}),F("span",null,c("protect.removeProtection.confirm")))));default:return xe()}}())}function Ob(e){var t,n,o,i=e.documentId,r=ja(i).translate,a=Zr().provides,s=Oo(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:Zt.AllowAll)&Zt.AllowAll)!==Zt.AllowAll,h=c&&!d&&u,m=ze(function(){null==a||a.forDocument(i).disableOverlay("unlock-owner-overlay")},[i,a]),g=ze(function(){null==a||a.forDocument(i).disableOverlay("unlock-owner-overlay"),null==a||a.forDocument(i).openModal("view-permissions-modal")},[i,a]);return h?F("div",{className:""},F("div",{className:"bg-bg-surface border-border-default flex max-w-sm items-start gap-3 rounded-lg border p-4 shadow-lg"},F("div",{className:"bg-accent/10 flex-shrink-0 rounded-full p-2"},F(Xp,{icon:"lock",size:20,className:"text-accent"})),F("div",{className:"min-w-0 flex-1"},F("h3",{className:"text-fg-primary text-sm font-semibold"},r("security.protected.title")),F("p",{className:"text-fg-secondary mt-1 text-xs leading-relaxed"},r("security.protected.description")),F("button",{type:"button",onClick:g,className:"text-accent hover:text-accent-hover mt-2 text-xs font-medium"},r("security.protected.viewPermissions"))),F("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")},F(Xp,{icon:"x",size:16})))):null}function Lb(e){var t,n,o=e.documentId,i=e.isOpen,r=e.onClose,a=e.onExited,s=ja(o).translate,l=Oo(o),c=va().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],C=w[1],I=null==l?void 0:l.document,k=null!==(t=null==I?void 0:I.permissions)&&void 0!==t?t:0,S=null!==(n=null==I?void 0:I.isOwnerUnlocked)&&void 0!==n&&n;Ae(function(){i&&(h(""),p(!1),b(!1),C(null))},[i]);var M=function(){c&&u&&(b(!0),C(null),c.unlockOwnerPermissions(o,u).wait(function(e){b(!1),e?h(""):C(s("security.unlock.invalidPassword"))},function(e){var t,n;b(!1),C(null!==(t=null===(n=e.reason)||void 0===n?void 0:n.message)&&void 0!==t?t:s("security.unlock.failed"))}))};return F(gb,{open:null!=i&&i,title:s("security.viewPermissions.title"),onClose:r,onExited:a,className:"md:w-[32rem]"},F("div",{className:"space-y-5"},F("p",{className:"text-fg-secondary text-sm"},s("security.viewPermissions.description")),!S&&F("div",null,F("label",{className:"text-fg-primary mb-2 block text-sm font-medium"},s("security.unlock.label")),F("div",{className:"relative"},F("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&&M()}}),F("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"},F(Xp,{icon:g?"eye-off":"eye",className:"h-4 w-4"}))),x&&F("p",{className:"text-state-error mt-2 text-xs"},x),F(Jp,{onClick:M,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&&F(ny,{size:"sm"}),F("span",null,s("security.unlock.button")))),S&&F("div",{className:"bg-state-success-light flex items-center space-x-2 rounded-md p-3"},F(Xp,{icon:"check",className:"text-state-success h-4 w-4 flex-shrink-0"}),F("p",{className:"text-fg-secondary text-sm"},s("security.unlock.success"))),F(_b,{permissions:k,translate:s}),F("div",{className:"border-border-subtle flex justify-end border-t pt-4"},F(Jp,{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 $b={documentManager:{},commands:{commands:bb},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",redact:"Redact"},annotation:{text:"Text",highlight:"Highlight",strikeout:"Strikethrough",underline:"Underline",squiggly:"Squiggly",rectangle:"Rectangle",circle:"Circle",line:"Line",arrow:"Arrow",polygon:"Polygon",polyline:"Polyline",ink:"Ink",stamp:"Stamp",freeText:"Free Text",square:"Square",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...",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",redact:"Redigeren"},annotation:{text:"Tekst",highlight:"Markeren",strikeout:"Doorhalen",underline:"Onderstrepen",squiggly:"Golflijn",rectangle:"Rechthoek",circle:"Cirkel",line:"Lijn",arrow:"Pijl",polygon:"Veelhoek",polyline:"Polylijn",ink:"Inkt",stamp:"Stempel",freeText:"Vrije tekst",square:"Vierkant",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...",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",redact:"Schwärzen"},annotation:{text:"Text",highlight:"Markieren",strikeout:"Durchstreichen",underline:"Unterstreichen",squiggly:"Wellenlinie",rectangle:"Rechteck",circle:"Kreis",line:"Linie",arrow:"Pfeil",polygon:"Polygon",polyline:"Polylinie",ink:"Freihand",stamp:"Stempel",freeText:"Freitext",square:"Quadrat",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...",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",redact:"Caviarder"},annotation:{text:"Texte",highlight:"Surligner",strikeout:"Barrer",underline:"Souligner",squiggly:"Ondulé",rectangle:"Rectangle",circle:"Cercle",line:"Ligne",arrow:"Flèche",polygon:"Polygone",polyline:"Polyligne",ink:"Encre",stamp:"Tampon",freeText:"Texte libre",square:"Carré",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...",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",redact:"Redactar"},annotation:{text:"Texto",highlight:"Resaltar",strikeout:"Tachar",underline:"Subrayar",squiggly:"Ondulado",rectangle:"Rectángulo",circle:"Círculo",line:"Línea",arrow:"Flecha",polygon:"Polígono",polyline:"Polilínea",ink:"Tinta",stamp:"Sello",freeText:"Texto libre",square:"Cuadrado",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...",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:"形状",redact:"遮蔽"},annotation:{text:"任意文本",highlight:"高亮",strikeout:"删除线",underline:"下划线",squiggly:"下划曲线",rectangle:"矩形",circle:"圆形",line:"直线",arrow:"带箭头直线",polygon:"多边形",polyline:"多段线",ink:"自由绘制",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:"新增回复...",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:"链接"}}}],paramResolvers:wb},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:"chinese-languages",locales:["zh-CN"],breakpoints:{sm:{replaceHide:["zoom-toolbar","mode-select-button","overflow-tabs-button"],replaceShow:["view-mode","annotate-mode","shapes-mode","redact-mode","pan-button","pointer-button","divider-3"]},md:{replaceShow:["view-mode","annotate-mode","shapes-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","redact-mode","zoom-toolbar","pan-button","pointer-button","divider-3","page-settings-button","zoom-menu-button","divider-2","overflow-tabs-button"],show:["mode-select-button"]},xxs:{minWidth:400,show:["page-settings-button","zoom-menu-button","divider-2"],hide:["overflow-left-action-menu-button"]},xs:{minWidth:500,maxWidth:640,show:["pan-button","pointer-button","divider-3"]},sm:{minWidth:640,maxWidth:768,hide:["shapes-mode","redact-mode","zoom-toolbar","mode-select-button"],show:["view-mode","annotate-mode","overflow-tabs-button","pan-button","pointer-button","divider-3"]},md:{minWidth:768,show:["view-mode","annotate-mode","shapes-mode","zoom-toolbar","pan-button","pointer-button","divider-3","overflow-tabs-button"],hide:["zoom-menu-button","mode-select-button"]},lg:{minWidth:1024,show:["shapes-mode","redact-mode"],hide:["overflow-tabs-button"]}}},items:[{type:"group",id:"left-group",alignment:"start",gap:2,items:[{type:"command-button",id:"document-menu-button",commandId:"document:menu",variant:"icon",categories:["document","document-menu"]},{type:"divider",id:"divider-1",orientation:"vertical"},{type:"command-button",id:"sidebar-button",commandId:"panel:toggle-sidebar",variant:"icon",categories:["panel","panel-sidebar"]},{type:"command-button",id:"overflow-left-action-menu-button",commandId:"left-action-menu:overflow-menu",variant:"icon",categories:["ui","ui-menu"]},{type:"command-button",id:"page-settings-button",commandId:"page:settings",variant:"icon",categories:["page","page-settings"]}]},{type:"divider",id:"divider-2",orientation:"vertical"},{type:"group",id:"center-group",alignment:"center",gap:2,items:[{type:"command-button",id:"zoom-menu-button",commandId:"zoom:toggle-menu-mobile",variant:"icon",categories:["zoom","zoom-menu"]},{type:"custom",id:"zoom-toolbar",componentId:"zoom-toolbar",categories:["zoom"]},{type:"divider",id:"divider-3",orientation:"vertical",visibilityDependsOn:{itemIds:["zoom-toolbar","zoom-menu-button"]}},{type:"command-button",id:"pan-button",commandId:"pan:toggle",variant:"icon",categories:["tools","pan"]},{type:"command-button",id:"pointer-button",commandId:"pointer:toggle",variant:"icon",categories:["tools","pointer"]}]},{type:"spacer",id:"spacer-1",flex:!0},{type:"custom",id:"mode-select-button",componentId:"mode-select-button",categories:["mode"],visibilityDependsOn:{itemIds:["mode:annotate","mode:shapes","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","redact-mode"]}},{id:"annotate-mode",commandId:"mode:annotate",variant:"text",categories:["mode","mode-annotate","annotation"]},{id:"shapes-mode",commandId:"mode:shapes",variant:"text",categories:["mode","mode-shapes","annotation"]},{id:"redact-mode",commandId:"mode:redact",variant:"text",categories:["mode","mode-redact","redaction"]},{id:"overflow-tabs-button",commandId:"tabs:overflow-menu",variant:"icon",categories:["ui","ui-menu"],visibilityDependsOn:{menuId:"mode-tabs-overflow-menu"}}]},{type:"spacer",id:"spacer-2",flex:!0},{type:"group",id:"right-group",alignment:"end",gap:2,items:[{type:"command-button",id:"search-button",commandId:"panel:toggle-search",variant:"icon",categories:["panel","panel-search"]},{type:"command-button",id:"comment-button",commandId:"panel:toggle-comment",variant:"icon",categories:["panel","panel-comment"]}]}]},"annotation-toolbar":{id:"annotation-toolbar",position:{placement:"top",slot:"secondary",order:0},responsive:{breakpoints:{sm:{maxWidth:640,hide:["add-text","add-stamp","add-ink"],show:["overflow-annotation-tools"]},md:{minWidth:640,hide:["overflow-annotation-tools"],show:["add-text","add-stamp","add-ink"]}}},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-text",commandId:"annotation:add-text",variant:"icon",categories:["annotation","annotation-text"]},{type:"command-button",id:"add-stamp",commandId:"annotation:add-stamp",variant:"icon",categories:["annotation","annotation-stamp"]},{type:"command-button",id:"overflow-annotation-tools",commandId:"annotation:overflow-tools",variant:"icon",categories:["annotation","annotation-overflow"]},{type:"divider",id:"annotation-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"annotation-tools-divider-2",orientation:"vertical",visibilityDependsOn:{itemIds:["toggle-annotation-style"]}},{type:"command-button",id:"undo-button",commandId:"history:undo",variant:"icon",categories:["history","history-undo"]},{type:"command-button",id:"redo-button",commandId:"history:redo",variant:"icon",categories:["history","history-redo"]}]},{type:"spacer",id:"spacer-4",flex:!0}]},"shapes-toolbar":{id:"shapes-toolbar",position:{placement:"top",slot:"secondary",order:0},responsive:{breakpoints:{sm:{maxWidth:640,hide:["add-polygon","add-polyline"],show:["overflow-shapes-tools"]},md:{minWidth:640,hide:["overflow-shapes-tools"],show:["add-polygon","add-polyline"]}}},permanent:!1,categories:["annotation","annotation-shape"],items:[{type:"spacer",id:"spacer-5",flex:!0},{type:"group",id:"shapes-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"add-rectangle",commandId:"annotation:add-rectangle",variant:"icon",categories:["annotation","annotation-shape","annotation-rectangle"]},{type:"command-button",id:"add-circle",commandId:"annotation:add-circle",variant:"icon",categories:["annotation","annotation-shape","annotation-circle"]},{type:"command-button",id:"add-line",commandId:"annotation:add-line",variant:"icon",categories:["annotation","annotation-shape","annotation-line"]},{type:"command-button",id:"add-arrow",commandId:"annotation:add-arrow",variant:"icon",categories:["annotation","annotation-shape","annotation-arrow"]},{type:"command-button",id:"add-polygon",commandId:"annotation:add-polygon",variant:"icon",categories:["annotation","annotation-shape","annotation-polygon"]},{type:"command-button",id:"add-polyline",commandId:"annotation:add-polyline",variant:"icon",categories:["annotation","annotation-shape","annotation-polyline"]},{type:"command-button",id:"overflow-shapes-tools",commandId:"annotation:overflow-shapes",variant:"icon",categories:["annotation","annotation-shape","annotation-overflow"]},{type:"divider",id:"shapes-tools-divider-1",orientation:"vertical"},{type:"command-button",id:"toggle-annotation-style",commandId:"panel:toggle-annotation-style",variant:"icon",categories:["panel","panel-annotation-style"]},{type:"divider",id:"shapes-tools-divider-2",orientation:"vertical",visibilityDependsOn:{itemIds:["toggle-annotation-style"]}},{type:"command-button",id:"undo-button",commandId:"history:undo",variant:"icon",categories:["history","history-undo"]},{type:"command-button",id:"redo-button",commandId:"history:redo",variant:"icon",categories:["history","history-redo"]}]},{type:"spacer",id:"spacer-6",flex:!0}]},"redaction-toolbar":{id:"redaction-toolbar",position:{placement:"top",slot:"secondary",order:0},permanent:!1,categories:["redaction"],items:[{type:"spacer",id:"spacer-7",flex:!0},{type:"group",id:"redaction-tools",alignment:"start",gap:2,items:[{type:"command-button",id:"redact",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:redact",commandId:"mode:redact",categories:["mode","mode-redact","redaction"]}],responsive:{breakpoints:{xs:{maxWidth:640,show:["mode:view","mode:annotate","mode:shapes","mode:redact"]},sm:{minWidth:640,maxWidth:768,hide:["mode:view","mode:annotate"]},md:{minWidth:768,hide:["mode:view","mode:annotate","mode:shapes"]}},localeOverrides:{groups:[{id:"germanic-languages",locales:["de","nl"],breakpoints:{md:{replaceHide:["mode:view","mode:annotate"]}}}]}}},"zoom-levels-menu":{id:"zoom-levels-menu",categories:["zoom","zoom-level"],items:[{type:"command",id:"zoom-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-text",commandId:"annotation:add-text",categories:["annotation","annotation-text"]},{type:"command",id:"annotation:add-stamp",commandId:"annotation:add-stamp",categories:["annotation","annotation-stamp"]}]},"shapes-tools-menu":{id:"shapes-tools-menu",categories:["annotation","annotation-shape"],items:[{type:"command",id:"annotation:add-polygon",commandId:"annotation:add-polygon",categories:["annotation","annotation-shape","annotation-polygon"]},{type:"command",id:"annotation:add-polyline",commandId:"annotation:add-polyline",categories:["annotation","annotation-shape","annotation-polyline"]}]},"page-settings-menu":{id:"page-settings-menu",categories:["page"],items:[{type:"section",id:"spread-mode-section",labelKey:"page.spreadMode",label:"Spread Mode",categories:["page","spread"],items:[{type:"command",id:"spread:none",commandId:"spread:none",categories:["page","spread","spread-none"]},{type:"command",id:"spread:odd",commandId:"spread:odd",categories:["page","spread","spread-odd"]},{type:"command",id:"spread:even",commandId:"spread:even",categories:["page","spread","spread-even"]}]},{type:"divider",id:"divider-13"},{type:"section",id:"scroll-layout-section",labelKey:"page.scrollLayout",label:"Scroll Layout",categories:["page","scroll"],items:[{type:"command",id:"scroll:vertical",commandId:"scroll:vertical",categories:["page","scroll","scroll-vertical"]},{type:"command",id:"scroll:horizontal",commandId:"scroll:horizontal",categories:["page","scroll","scroll-horizontal"]}]},{type:"divider",id:"divider-14"},{type:"section",id:"page-rotation-section",labelKey:"page.rotation",label:"Page Rotation",categories:["page","rotate"],items:[{type:"command",id:"rotate:clockwise",commandId:"rotate:clockwise",categories:["page","rotate","rotate-clockwise"]},{type:"command",id:"rotate:counter-clockwise",commandId:"rotate:counter-clockwise",categories:["page","rotate","rotate-counter-clockwise"]}]},{type:"divider",id:"divider-15"},{type:"command",id:"document:fullscreen",commandId:"document:fullscreen",categories:["document","document-fullscreen"]}]}},sidebars:{"sidebar-panel":{id:"sidebar-panel",position:{placement:"left",slot:"main",order:0},content:{type:"tabs",tabs:[{id:"thumbnails",labelKey:"panel.thumbnails",label:"Thumbnails",icon:"squares",componentId:"thumbnails-sidebar"},{id:"outline",labelKey:"panel.outline",label:"Outline",icon:"listTree",componentId:"outline-sidebar"}]},width:"250px",collapsible:!0,defaultOpen:!1},"annotation-panel":{id:"annotation-panel",position:{placement:"left",slot:"main",order:0},content:{type:"component",componentId:"annotation-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"search-panel":{id:"search-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"search-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"comment-panel":{id:"comment-panel",position:{placement:"right",slot:"main",order:0},content:{type:"component",componentId:"comment-sidebar"},width:"250px",collapsible:!0,defaultOpen:!1},"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-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:"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:hi.Vertical},zoom:{defaultZoomLevel:Fa.FitPage},spread:{defaultSpreadMode:Di.None},rotation:{defaultRotation:Be.Degree0},pan:{},render:{defaultImageType:"image/png"},tiling:{tileSize:768,overlapPx:2.5,extraRings:0},thumbnails:{width:150,gap:10,buffer:3,labelHeight:30},annotations:{},search:{},selection:{},bookmarks:{},attachments:{},capture:{scale:2,imageType:"image/png"},redaction:{drawBlackBoxes:!0,useAnnotationMode:!0},print:{},export:{defaultFileName:"document.pdf"},fullscreen:{},history:{},interactionManager:{}};function jb(e){var t=e.documentId,n=e.tabBarVisibility,o=void 0===n?"multiple":n,i=function(e){const t=la(),{provides:n}=Zr(),o=null==n?void 0:n.getSchema(),i=Yr(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 He(H,{children:l&&c&&He(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 He(H,{children:c&&d&&He(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`),He(H,{children:s&&l&&He(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?He(H,{children:(o.overlays?Object.values(o.overlays):[]).filter(e=>!1!==i.enabledOverlays[e.id]).map(t=>He(r,{schema:t,documentId:e},t.id))},"overlays-slot"):null}}}(t),r=i.renderToolbar,a=i.renderSidebar,s=i.renderModal,l=i.renderOverlays,c=ja(t).translate,d=ca("selection",t),u=ca("annotation",t),h=ca("groupAnnotation",t),m=ca("redaction",t),g=(e=>{const t=No();return Re(()=>t?t.documentOrder.map(e=>t.documents[e]).filter(e=>null!=e):[],[t,e])})(),p=(()=>{const e=No();return Re(()=>{if(!e)return{activeDocumentId:null,activeDocument:null};const t=e.activeDocumentId;return{activeDocumentId:t,activeDocument:t?e.documents[t]??null:null}},[e])})();return F(H,null,F(Pb,{documentStates:g,activeDocumentId:p.activeDocumentId,visibility:o}),r("top","main"),r("top","secondary"),F("div",{id:"document-content",className:"bg-bg-surface flex flex-1 overflow-hidden"},a("left","main"),F("div",{className:"flex-1 overflow-hidden"},F(fa,{documentId:t},function(e){var n=e.documentState,o=e.isLoading,i=e.isError,r=e.isLoaded;return F(H,null,o&&F("div",{className:"flex h-full items-center justify-center"},F(ty,{size:"lg",text:c("document.loading")})),i&&F(Rb,{documentState:n}),r&&F("div",{className:"relative h-full w-full"},F(rh,{documentId:t},F(ui,{className:"bg-bg-app",documentId:t},F(ns,{documentId:t},F(Pi,{documentId:t,renderPage:function(e){var n=e.pageIndex;return F(ys,{documentId:t,pageIndex:n,style:{backgroundColor:"#fff"}},F(ah,{documentId:t,pageIndex:n},F(ls,{documentId:t,pageIndex:n,scale:.5,style:{pointerEvents:"none"}}),F(Kl,{documentId:t,pageIndex:n,style:{pointerEvents:"none"}}),F(Fs,{documentId:t,pageIndex:n}),F(os,{documentId:t,pageIndex:n}),F(Im,{documentId:t,pageIndex:n}),F(zl,{documentId:t,pageIndex:n,selectionMenu:d}),F(pg,{documentId:t,pageIndex:n,selectionMenu:m}),F(Eh,{documentId:t,pageIndex:n,selectionMenu:u,groupSelectionMenu:h})))}})))),l()))})),a("right","main")),s())}var Fb=new yt([new pt,new vt]);function Ub(e){var t,o=e.config,i=e.onRegistryReady,r=function(e){const{wasmUrl:t=Ho,worker:n=!0,logger:o,encoderPoolSize:i,fontFallback:r}=e??{},[a,s]=Se(null),[l,c]=Se(!0),[d,u]=Se(null),h=De(null);return Ae(()=>{let e=!1;return(async()=>{try{const{createPdfiumEngine:e}=n?await import("./worker-engine-DQJaSVUN.js"):await import("./direct-engine-D0ascLRA.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},En)}},[t,n,o,r]),{engine:a,isLoading:l,error:d}}(h(h({},o.wasmUrl&&{wasmUrl:o.wasmUrl}),{},{worker:o.worker,logger:o.log?Fb:void 0})),a=r.engine,s=r.isLoading,l=Re(function(){return{"thumbnails-sidebar":Zv,"annotation-sidebar":ab,"zoom-toolbar":by,"search-sidebar":Jv,"outline-sidebar":ey,"comment-sidebar":yy,"print-modal":pb,"link-modal":fb,"protect-modal":Nb,"unlock-owner-overlay":Ob,"page-controls":vb,"mode-select-button":zb,"view-permissions-modal":Lb,"redaction-sidebar":cb}},[]),c=Re(function(){return{toolbar:Pv,sidebar:$v,modal:Kv,overlay:mb,menu:Uv,selectionMenu:db}},[]);return F(H,null,F("style",null,Fe),!a||s?F("div",{className:"flex h-full w-full items-center justify-center"},F(ty,{size:"lg",text:"Initializing PDF engine..."})):F(To,{config:{logger:o.log?Fb: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:[go(ya,h(h(h({},$b.documentManager),o.src&&{initialDocuments:[{url:o.src}]}),o.documentManager)),go(Pa,h(h(h({},$b.commands),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.commands)),go($a,h(h({},$b.i18n),o.i18n)),go(Kr,h(h(h({},$b.ui),o.disabledCategories&&{disabledCategories:o.disabledCategories}),o.ui)),go(si,h(h({},$b.viewport),o.viewport)),go(Si,h(h({},$b.scroll),o.scroll)),go(Qa,h(h({},$b.zoom),o.zoom)),go(Fi,h(h({},$b.spread),o.spread)),go(vs,h(h({},$b.rotation),o.rotation)),go(um,h(h({},$b.pan),o.pan)),go(ss,h(h({},$b.render),o.render)),go(ql,h(h({},$b.tiling),o.tiling)),go(ac,h(h({},$b.thumbnails),o.thumbnails)),go(Nh,h(h({},$b.annotations),o.annotations)),go($s,h(h({},$b.search),o.search)),go(Tl,h(h({},$b.selection),o.selection)),go(em,h(h({},$b.bookmarks),o.bookmarks)),go(wg,h(h({},$b.attachments),o.attachments)),go(xm,h(h({},$b.capture),o.capture)),go(fg,h(h({},$b.redaction),o.redaction)),go(Uh,h(h({},$b.print),o.print)),go(im,h(h({},$b.export),o.export)),go(Zh,h(h({},$b.fullscreen),o.fullscreen)),go(Em,h(h({},$b.history),o.history)),go(Qu,h(h({},$b.interactionManager),o.interactionManager))]},function(e){var t=e.pluginsReady,n=e.activeDocumentId;return F(H,null,t?F(H,null,n?F(ha,{documentId:n,components:l,renderers:c,className:"relative flex h-full w-full select-none flex-col"},F(jb,{documentId:n,tabBarVisibility:o.tabBar}),F(Tb,{documentId:n}),F(iy,{documentId:n})):F(Db,null)):F("div",{className:"flex h-full items-center justify-center"},F(ty,{size:"lg",text:"Initializing plugins..."})))}))}var Hb="undefined"!=typeof HTMLElement?HTMLElement:r(function e(){i(this,e)}),Bb=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,Hb),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&&Zp(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 Sb(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=Sb((null==o?void 0:o.preference)||"system"),r="dark"===i?Cb:xb,a=null==o?void 0:o[i];return n=r,(t=a)?kb(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=Ab(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){Kp(e,t)}},{key:"registerIcons",value:function(e){Zp(e)}},{key:"renderViewer",value:function(){this._config&&(ce(F(Ub,{config:this._config,onRegistryReady:this.handleRegistryReady}),this.root),this.injectTheme())}}])}(),Wb=["type","target"],qb="2.6.1";"undefined"==typeof customElements||customElements.get("embedpdf-container")||customElements.define("embedpdf-container",Bb);var Gb={version:qb,init:function(e){if("container"===e.type)return function(e){e.type,e.target;var t=m(e,Wb),n=document.createElement("embedpdf-container");return n.config=t,e.target.appendChild(n),n}(e)}};export{_m as $,Nt as A,Ge as B,ot as C,mt as D,Mt as E,Et as F,on as G,Vt as H,Tn as I,Xd as J,yg as K,Jh as L,wm as M,gt as N,ka as O,Qt as P,ga as Q,Be as R,Bb as S,Ct as T,nm as U,Gh as V,Rm as W,Oa as X,Zu as Y,cm as Z,jh as _,Jt as a,og as a0,rs as a1,ps as a2,Ii as a3,hi as a4,Os as a5,gl as a6,Di as a7,Oi as a8,rc as a9,Wl as aa,Ur as ab,ai as ac,Fa as ad,Xa as ae,kb as af,Cb as ag,Gb as ah,En as ai,xb as aj,Kp as ak,Zp as al,qb as am,_t as b,Xt as c,St as d,Ot as e,Ut as f,Ft as g,Lt as h,Rn as i,Pt as j,Tt as k,At as l,en as m,nn as n,$t as o,rn as p,an as q,Ze as r,Pn as s,Ye as t,zn as u,Ht as v,tn as w,qt as x,Gt as y,jt as z};
diff --git a/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-DX_zb2Zx.js b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-DX_zb2Zx.js
new file mode 100644
index 00000000..fd96dd52
--- /dev/null
+++ b/src/components/BootstrapBlazor.EmbedPDF/wwwroot/embedpdf-DX_zb2Zx.js
@@ -0,0 +1,3 @@
+function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n=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;t3?(i=g===o)&&(l=r[(s=r[4])?5:(s=3,3)],r[4]=r[5]=e):r[0]<=m&&((i=n<2&&mo||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 C,I,k,S,M,A,P,D,R,z,T,E,_={},N=[],O=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,L=Array.isArray;function $(e,t){for(var n in t)e[n]=t[n];return e}function j(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function F(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?C.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===a[r]&&(a[r]=e.defaultProps[r]);return U(e,a,o,i,null)}function U(e,t,n,o,i){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++k:i,__i:-1,__u:0};return null==i&&null!=I.vnode&&I.vnode(r),r}function H(e){return e.children}function B(e,t){this.props=e,this.context=t}function W(e,t){if(null==t)return e.__?W(e.__,e.__i+1):null;for(var n;ts&&S.sort(P),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=$({},o)).__v=o.__v+1,I.vnode&&I.vnode(n),te(t.__P,n,o,t.__n,t.__P.namespaceURI,32&o.__u?[i]:null,r,null==i?W(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&&q(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;r0?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=X(a,n,l,u))&&(u--,(s=n[c])&&(s.__u|=2)),null==s||null==s.__v?(-1==c&&(i>d?h--:il?h--:h++,a.__u|=4))):e.__k[r]=null;if(u)for(r=0;r(d?1:0))for(i=n-1,r=n+1;i>=0||r=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||O.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(D,"$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=R,e.addEventListener(t,r?T:z,r)):e.removeEventListener(t,r?T:z,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=R++;else if(t.t0?e:L(e)?e.map(ie):$({},e)}function re(e,t,n,o,i,r,a,s,l){var c,d,u,h,m,g,p,f=n.props||_,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=n.__.length&&n.__.push({}),n.__[e]}function Se(e){return pe=1,Me(je,e)}function Me(e,t,n){var o=ke(ue++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):je(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=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 Ae(e,t){var n=ke(ue++,3);!ve.__s&&$e(n.__H,t)&&(n.__=e,n.u=t,he.__H.__h.push(n))}function Pe(e,t){var n=ke(ue++,4);!ve.__s&&$e(n.__H,t)&&(n.__=e,n.u=t,he.__h.push(n))}function De(e){return pe=5,Re(function(){return{current:e}},[])}function Re(e,t){var n=ke(ue++,7);return $e(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ze(e,t){return pe=8,Re(function(){return e},t)}function Te(e){var t=he.context[e.__c],n=ke(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(Oe),e.__H.__h.forEach(Le),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),Ie&&Ie(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(Oe),t.__h.forEach(Le),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(Oe),e.__h=e.__h.filter(function(e){return!e.__||Le(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){Ce&&Ce(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{Oe(e)}catch(e){t=e}}),n.__H=void 0,t&&ve.__e(t,n.__v))};var _e="function"==typeof requestAnimationFrame;function Ne(e){var t,n=function(){clearTimeout(o),_e&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);_e&&(t=requestAnimationFrame(n))}function Oe(e){var t=he,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),he=t}function Le(e){var t=he;e.__c=e.__(),he=t}function $e(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function je(e,t){return"function"==typeof t?t(e):t}var Fe='/*! 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-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 .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 .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-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-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: "";\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: "";\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: "";\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 He(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 I.vnode&&I.vnode(c),c}var Be=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(Be||{});function We(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function qe(e){return{width:Math.ceil(e.width),height:Math.ceil(e.height)}}function Ge(e){return{origin:We(e.origin),size:qe(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 Ye(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 Xe(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 Ct{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 Ct;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 Ct;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 Ct;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=Ct.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 It=Object.freeze(["","","","\ufeff","",""]),kt=new RegExp(`[${It.join("")}]`,"g");function St(e){return e.replace(kt,"")}var Mt=(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))(Mt||{}),At=(e=>(e[e.NotSet=0]="NotSet",e[e.True=1]="True",e[e.False=2]="False",e[e.Unknown=3]="Unknown",e))(At||{}),Pt=(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))(Pt||{}),Dt=(e=>(e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e))(Dt||{}),Rt=(e=>(e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom",e))(Rt||{}),zt=(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))(zt||{}),Tt=(e=>(e[e.Contain=0]="Contain",e[e.Cover=1]="Cover",e[e.Stretch=2]="Stretch",e))(Tt||{}),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||{}),_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||{}),Nt=(e=>(e[e.Normal=0]="Normal",e[e.Rollover=1]="Rollover",e[e.Down=2]="Down",e))(Nt||{}),Ot=(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))(Ot||{}),Lt=(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))(Lt||{}),$t=(e=>(e[e.Unknown=0]="Unknown",e[e.Reply=1]="Reply",e[e.Group=2]="Group",e))($t||{}),jt=(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))(jt||{}),Ft=(e=>(e[e.Color=0]="Color",e[e.InteriorColor=1]="InteriorColor",e[e.OverlayColor=2]="OverlayColor",e))(Ft||{}),Ut=(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))(Ut||{}),Ht=(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))(Ht||{});const Bt=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView"}),Wt=Object.entries(Bt).reduce((e,[t,n])=>(e[n]=Number(t),e),{});function qt(e){return Object.keys(Bt).filter(t=>0!==(e&t)).map(e=>Bt[e])}function Gt(e){return e.reduce((e,t)=>e|Wt[t],0)}var Vt=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))(Vt||{}),Kt=(e=>(e[e.None=0]="None",e[e.MatchCase=1]="MatchCase",e[e.MatchWholeWord=2]="MatchWholeWord",e[e.MatchConsecutive=4]="MatchConsecutive",e))(Kt||{}),Zt=(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))(Zt||{});class Yt extends Error{constructor(e,t){const n=e.map(e=>Zt[e]).join(", ");super(`Permission denied. Required: ${n}`),this.requiredFlags=e,this.currentPermissions=t,this.name="PermissionDeniedError"}}var Xt=(e=>(e[e.Display=0]="Display",e[e.Print=1]="Print",e))(Xt||{}),Qt=(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))(Qt||{});class Jt{static create(){return new Ct}static resolve(e){const t=new Ct;return t.resolve(e),t}static reject(e){const t=new Ct;return t.reject(e),t}static abort(e){const t=new Ct;return t.reject(e),t}}function en(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 tn(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 nn(e){return(e=>Math.max(0,Math.min(255,e)))(e)/255}function on(e){return((e,t=255)=>Math.max(0,Math.min(t,e)))(Math.round(255*e))}function rn(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 an(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 sn=Object.freeze([{id:Dt.Left,label:"Left",css:"left"},{id:Dt.Center,label:"Center",css:"center"},{id:Dt.Right,label:"Right",css:"right"}]),ln=sn.reduce((e,t)=>(e[t.id]=t,e),{});function cn(e){return function(e){return ln[e]??ln[Dt.Left]}(e).css}sn.reduce((e,t)=>(e[t.css]=t.id,e),{}),sn.map(e=>({value:e.id,label:e.label}));var dn=(e=>(e.Courier="Courier",e.Helvetica="Helvetica",e.Times="Times",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats",e.Unknown="Unknown",e))(dn||{});const un=Pt.Helvetica,hn={id:Pt.Helvetica,family:"Helvetica",bold:!1,italic:!1,label:"Helvetica",css:"Helvetica, Arial, sans-serif"},mn=Object.freeze([{id:Pt.Courier,family:"Courier",bold:!1,italic:!1,label:"Courier",css:"Courier, monospace"},{id:Pt.Courier_Bold,family:"Courier",bold:!0,italic:!1,label:"Courier Bold",css:"Courier, monospace"},{id:Pt.Courier_BoldOblique,family:"Courier",bold:!0,italic:!0,label:"Courier Bold Oblique",css:"Courier, monospace"},{id:Pt.Courier_Oblique,family:"Courier",bold:!1,italic:!0,label:"Courier Oblique",css:"Courier, monospace"},hn,{id:Pt.Helvetica_Bold,family:"Helvetica",bold:!0,italic:!1,label:"Helvetica Bold",css:"Helvetica, Arial, sans-serif"},{id:Pt.Helvetica_BoldOblique,family:"Helvetica",bold:!0,italic:!0,label:"Helvetica Bold Oblique",css:"Helvetica, Arial, sans-serif"},{id:Pt.Helvetica_Oblique,family:"Helvetica",bold:!1,italic:!0,label:"Helvetica Oblique",css:"Helvetica, Arial, sans-serif"},{id:Pt.Times_Roman,family:"Times",bold:!1,italic:!1,label:"Times Roman",css:'"Times New Roman", Times, serif'},{id:Pt.Times_Bold,family:"Times",bold:!0,italic:!1,label:"Times Bold",css:'"Times New Roman", Times, serif'},{id:Pt.Times_BoldItalic,family:"Times",bold:!0,italic:!0,label:"Times Bold Italic",css:'"Times New Roman", Times, serif'},{id:Pt.Times_Italic,family:"Times",bold:!1,italic:!0,label:"Times Italic",css:'"Times New Roman", Times, serif'},{id:Pt.Symbol,family:"Symbol",bold:!1,italic:!1,label:"Symbol",css:"Symbol, serif"},{id:Pt.ZapfDingbats,family:"ZapfDingbats",bold:!1,italic:!1,label:"Zapf Dingbats",css:"ZapfDingbats, serif"}]),gn=mn.reduce((e,t)=>(e[t.id]=t,e),{}),pn=new Map;for(const e of mn)pn.set(`${e.family}_${e.bold}_${e.italic}`,e.id);function fn(e){return gn[e]??hn}function vn(e){return fn(e).family}function yn(e){return fn(e).bold}function bn(e){return fn(e).italic}function wn(e,{bold:t,italic:n}){return pn.get(`${e}_${t}_${n}`)??un}function xn(e){const t=fn(e);return{fontFamily:t.css,fontWeight:t.bold?"bold":"normal",fontStyle:t.italic?"italic":"normal"}}Object.values(dn).filter(e=>"Unknown"!==e).map(e=>({value:e,label:e}));const Cn=[...new Set(mn.map(e=>e.family))];function In(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 kn=Object.freeze([{id:zt.Normal,label:"Normal",css:"normal"},{id:zt.Multiply,label:"Multiply",css:"multiply"},{id:zt.Screen,label:"Screen",css:"screen"},{id:zt.Overlay,label:"Overlay",css:"overlay"},{id:zt.Darken,label:"Darken",css:"darken"},{id:zt.Lighten,label:"Lighten",css:"lighten"},{id:zt.ColorDodge,label:"Color Dodge",css:"color-dodge"},{id:zt.ColorBurn,label:"Color Burn",css:"color-burn"},{id:zt.HardLight,label:"Hard Light",css:"hard-light"},{id:zt.SoftLight,label:"Soft Light",css:"soft-light"},{id:zt.Difference,label:"Difference",css:"difference"},{id:zt.Exclusion,label:"Exclusion",css:"exclusion"},{id:zt.Hue,label:"Hue",css:"hue"},{id:zt.Saturation,label:"Saturation",css:"saturation"},{id:zt.Color,label:"Color",css:"color"},{id:zt.Luminosity,label:"Luminosity",css:"luminosity"}]),Sn=kn.reduce((e,t)=>(e[t.id]=t,e),{});function Mn(e){return function(e){return Sn[e]??Sn[zt.Normal]}(e).css}kn.reduce((e,t)=>(e[t.css]=t.id,e),{}),kn.map(e=>({value:e.id,label:e.label}));const An=kn.map(e=>e.id);function Pn(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:Pn(t.logger)}}}if(e instanceof yt){return{type:"all",config:{loggers:e.loggers.map(Pn)}}}return{type:"noop"}}const Dn=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Rn(e){return Dn.test(e)}function zn(){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;te.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 Tn extends Ct{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 Tn({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 Tn({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 Tn(t);return e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}static first(e){let t=!1;const n=new Tn({aggregate:e=>e[0],failFast:!1});return n.handleChildSuccess=(e,o)=>{if(!t){t=!0;for(const[t]of n.children)t!==e&&t.abort("Race won by sibling");n.resolve(o)}},e.forEach((e,t)=>n.addChild(e,t)),n.finalize(),n}}function En(){}class _n{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 Nn extends Error{constructor(e){super(e),this.name="PluginRegistrationError"}}class On extends Error{constructor(e){super(e),this.name="PluginNotFoundError"}}class Ln extends Error{constructor(e){super(e),this.name="CircularDependencyError"}}class $n extends Error{constructor(e){super(e),this.name="PluginConfigurationError"}}class jn{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 Fn="START_LOADING_DOCUMENT",Un="UPDATE_DOCUMENT_LOADING_PROGRESS",Hn="SET_DOCUMENT_LOADED",Bn="SET_DOCUMENT_ERROR",Wn="RETRY_LOADING_DOCUMENT",qn="CLOSE_DOCUMENT",Gn="SET_ACTIVE_DOCUMENT",Vn="REORDER_DOCUMENTS",Kn="MOVE_DOCUMENT",Zn="UPDATE_DOCUMENT_SECURITY",Yn="REFRESH_PAGES",Xn="SET_SCALE",Qn="SET_ROTATION",Jn=[Fn,Un,Hn,qn,Gn,Bn,Wn,"REFRESH_DOCUMENT",Yn,"SET_PAGES",Xn,Qn,"SET_DEFAULT_SCALE","SET_DEFAULT_ROTATION",Vn,Kn,Zn],eo=(e,t,n,o,i,r,a)=>({type:Fn,payload:{documentId:e,name:t,scale:n,rotation:o,passwordProvided:i,autoActivate:r,permissions:a}}),to=(e,t)=>({type:qn,payload:{documentId:e,nextActiveDocumentId:t}}),no=(e,t)=>({type:Yn,payload:{documentId:e,pageIndexes:t}}),oo=(e,t)=>({type:Qn,payload:{rotation:e,documentId:t}});class io{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 jn(this,e)}isCoreAction(e){return Jn.includes(e.type)}destroy(){var e,t;this.listeners.length=0;for(const n in this.pluginListeners)null==(t=null==(e=this.pluginListeners[n])?void 0:e.splice)||t.call(e,0);this.pluginListeners={},this.pluginReducers={},this.state.plugins={},this.state.core={...this.initialCoreState}}}Zt.Print,Zt.ModifyContents,Zt.CopyContents,Zt.ModifyAnnotations,Zt.FillForms,Zt.ExtractForAccessibility,Zt.AssembleDocument,Zt.PrintHighQuality;const ro=[Zt.Print,Zt.ModifyContents,Zt.CopyContents,Zt.ModifyAnnotations,Zt.FillForms,Zt.ExtractForAccessibility,Zt.AssembleDocument,Zt.PrintHighQuality],ao={[Zt.Print]:"print",[Zt.ModifyContents]:"modifyContents",[Zt.CopyContents]:"copyContents",[Zt.ModifyAnnotations]:"modifyAnnotations",[Zt.FillForms]:"fillForms",[Zt.ExtractForAccessibility]:"extractForAccessibility",[Zt.AssembleDocument]:"assembleDocument",[Zt.PrintHighQuality]:"printHighQuality"};function so(e,t){if(!e)return;if(t in e)return e[t];const n=ao[t];return n&&n in e?e[n]:void 0}function lo(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)??Zt.AllowAll,l=so(null==r?void 0:r.overrides,n);if(void 0!==l)return l;const c=so(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 co(e,t){return ro.reduce((n,o)=>lo(e,t,o)?n|o:n,0)}function uo(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{switch(t.type){case Fn:{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 Un:{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 Hn:{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 Bn:{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 Wn:{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 qn:{const{documentId:n,nextActiveDocumentId:o}=t.payload,{[n]:i,...r}=e.documents;return{...e,documents:r,documentOrder:e.documentOrder.filter(e=>e!==n),activeDocumentId:uo(e,n,o)}}case Kn:{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 Vn:return{...e,documentOrder:t.payload};case Gn:return{...e,activeDocumentId:t.payload};case Xn:{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 Qn:{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 Yn:{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 Zn:{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 mo{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 _n,this.engine=e,this.initialCoreState=(e=>({documents:{},documentOrder:[],activeDocumentId:null,defaultScale:(null==e?void 0:e.defaultScale)??1,defaultRotation:(null==e?void 0:e.defaultRotation)??Be.Degree0,globalPermissions:null==e?void 0:e.permissions}))(t),this.store=new io(ho,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 Nn("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 Nn("Registry has been destroyed");return this.initPromise||(this.initPromise=(async()=>{if(this.initialized)throw new Nn("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 _n}this.initialized=!0}catch(e){if(e instanceof Error)throw new Ln(`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 Nn(`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 Nn(`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 On(`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 $n(`Missing required configuration keys for plugin ${e}: ${o.join(", ")}`)}async updatePluginConfig(e,t){const n=this.getPlugin(e);if(!n)throw new On(`Plugin ${e} not found`);const o=this.manifests.get(e),i=this.configurations.get(e);if(!o||!i)throw new On(`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 On(`Plugin ${e} is not registered`);const n=this.manifests.get(e);if(!n)throw new On(`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 Nn(`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 On(`Plugin ${e} not found`);return t}validatePlugin(e){if(!e.id)throw new Nn("Plugin must have an id")}validateManifest(e){if(!e.id)throw new Nn("Manifest must have an id");if(!e.name)throw new Nn("Manifest must have a name");if(!e.version)throw new Nn("Manifest must have a version");if(!Array.isArray(e.provides))throw new Nn("Manifest must have a provides array");if(!Array.isArray(e.requires))throw new Nn("Manifest must have a requires array");if(!Array.isArray(e.optional))throw new Nn("Manifest must have an optional array")}isDestroyed(){return this.destroyed}async destroy(){var e;if(this.destroyed)throw new Nn("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 go(e,t){return{package:e,config:t}}function po(e){return"autoMountElements"in e&&"function"==typeof e.autoMountElements}class fo{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(Fn,e=>{this.onDocumentLoadingStarted(e.payload.documentId)}),this.unsubscribeFromSetDocumentLoaded=this.coreStore.onAction(Hn,e=>{this.onDocumentLoaded(e.payload.documentId)}),this.unsubscribeFromCloseDocument=this.coreStore.onAction(qn,e=>{this.onDocumentClosed(e.payload.documentId)}),this.unsubscribeFromSetScale=this.coreStore.onAction(Xn,(e,t)=>{const n=e.payload.documentId??t.core.activeDocumentId;n&&this.onScaleChanged(n,e.payload.scale)}),this.unsubscribeFromSetRotation=this.coreStore.onAction(Qn,(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?co(this.coreState.core,t):Zt.AllowAll}checkPermission(e,...t){const n=e??this.coreState.core.activeDocumentId;return!n||t.every(e=>lo(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)lo(this.coreState.core,n,e)||o.push(e);if(o.length>0){const e=co(this.coreState.core,n);throw new Yt(o,e)}}}class vo{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 yo{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 vo(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 bo(e){return"keyExtractor"in e}function wo(e,t,n){return en?n:e}function xo(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`${ko(e)}__${ko(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;ie.forEach(e=>e(t)),on:t=>(e.add(t),()=>e.delete(t)),off:t=>e.delete(t),clear:()=>e.clear()}}function Mo(e,t=xo){const n=new Set,o=new Map;let i=e;const r=(e,t)=>{let r=e,a=()=>{};if(t){if(bo(t)){const n=new yo(e,t);r=n.handle,a=()=>n.destroy()}else{const n=new vo(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=xo)=>(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 Ao(e,t){const n=(null==t?void 0:t.cache)??!0,o=(null==t?void 0:t.equality)??xo,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(bo(o)){const t=new yo(e,o);c=t.handle,d=()=>t.destroy()}else{const t=new vo(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(bo(t)){const i=new yo(e,t);n=i.handle,o=()=>i.destroy()}else{const i=new vo(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 Po{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 Do(e){return new Po(e)}const Ro=de({registry:null,coreState:null,isInitializing:!0,pluginsReady:!1,activeDocumentId:null,activeDocument:null,documents:{},documentStates:[]});function zo({plugins:e,children:t}){const{utilities:n,wrappers:o}=Re(()=>{const t=[],n=[];for(const o of e){const e=o.package;if(po(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=He(H,{children:[t,n.map((e,t)=>He(e,{},`utility-${t}`))]});return He(H,{children:o.reduce((e,t)=>He(t,{children:e}),i)})}function To({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=De(o);Ae(()=>{p.current=o},[o]),Ae(()=>{const o={...t,logger:(null==t?void 0:t.logger)??n},r=new mo(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=Re(()=>{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 He(Ro.Provider,{value:f,children:m&&a?He(zo,{plugins:i,children:v}):v})}function Eo(e){const{registry:t}=function(){const e=Te(Ro);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 _o(e){const{plugin:t,isLoading:n,ready:o}=Eo(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 No(){const{coreState:e}=Te(Ro);return e}function Oo(e){const t=No();return Re(()=>t&&e?t.documents[e]??null:null,[t,e])}Zt.Print,Zt.ModifyContents,Zt.CopyContents,Zt.ModifyAnnotations,Zt.FillForms,Zt.ExtractForAccessibility,Zt.AssembleDocument,Zt.PrintHighQuality;const Lo=[Zt.Print,Zt.ModifyContents,Zt.CopyContents,Zt.ModifyAnnotations,Zt.FillForms,Zt.ExtractForAccessibility,Zt.AssembleDocument,Zt.PrintHighQuality],$o={[Zt.Print]:"print",[Zt.ModifyContents]:"modifyContents",[Zt.CopyContents]:"copyContents",[Zt.ModifyAnnotations]:"modifyAnnotations",[Zt.FillForms]:"fillForms",[Zt.ExtractForAccessibility]:"extractForAccessibility",[Zt.AssembleDocument]:"assembleDocument",[Zt.PrintHighQuality]:"printHighQuality"};function jo(e,t){if(!e)return;if(t in e)return e[t];const n=$o[t];return n&&n in e?e[n]:void 0}function Fo(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)??Zt.AllowAll,l=jo(null==r?void 0:r.overrides,n);if(void 0!==l)return l;const c=jo(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 Uo(e){const t=No();return Re(()=>{var n,o;if(!t)return{permissions:Zt.AllowAll,pdfPermissions:Zt.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 Lo.reduce((n,o)=>Fo(e,t,o)?n|o:n,0)}(t,e),r=n=>Fo(t,e,n);return{permissions:i,pdfPermissions:(null==(o=null==(n=t.documents[e])?void 0:n.document)?void 0:o.permissions)??Zt.AllowAll,hasPermission:r,hasAllPermissions:(...n)=>n.every(n=>Fo(t,e,n)),canPrint:r(Zt.Print),canModifyContents:r(Zt.ModifyContents),canCopyContents:r(Zt.CopyContents),canModifyAnnotations:r(Zt.ModifyAnnotations),canFillForms:r(Zt.FillForms),canExtractForAccessibility:r(Zt.ExtractForAccessibility),canAssembleDocument:r(Zt.AssembleDocument),canPrintHighQuality:r(Zt.PrintHighQuality)}},[t,e])}const Ho="https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.6.2/dist/pdfium.wasm";de(void 0);const Bo="viewport",Wo={id:Bo,name:"Viewport Plugin",version:"1.0.0",provides:["viewport"],requires:[],optional:[],defaultConfig:{viewportGap:10,scrollEndDelay:300}},qo="INIT_VIEWPORT_STATE",Go="CLEANUP_VIEWPORT_STATE",Vo="REGISTER_VIEWPORT",Ko="UNREGISTER_VIEWPORT",Zo="SET_VIEWPORT_METRICS",Yo="SET_VIEWPORT_SCROLL_METRICS",Xo="SET_VIEWPORT_GAP",Qo="SET_SCROLL_ACTIVITY",Jo="SET_SMOOTH_SCROLL_ACTIVITY",ei="ADD_VIEWPORT_GATE",ti="REMOVE_VIEWPORT_GATE";function ni(e,t){return{type:Jo,payload:{documentId:e,isSmoothScrolling:t}}}const oi={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},ii={viewportGap:0,documents:{},activeViewports:new Set,activeDocumentId:null},ri=class extends fo{constructor(e,t,n){var o;super(e,t),this.id=e,this.viewportResize$=Mo(),this.viewportMetrics$=Mo(),this.scrollMetrics$=Mo(),this.scrollActivity$=Mo(),this.gateState$=Mo(),this.scrollRequests$=new Map,n.viewportGap&&this.dispatch((o=n.viewportGap,{type:Xo,payload:o})),this.scrollEndDelay=n.scrollEndDelay||100}onDocumentLoadingStarted(e){this.dispatch(function(e){return{type:qo,payload:{documentId:e}}}(e)),this.scrollRequests$.set(e,So()),this.logger.debug("ViewportPlugin","DocumentOpened",`Initialized viewport state for document: ${e}`)}onDocumentClosed(e){var t;this.dispatch(function(e){return{type:Go,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:Vo,payload:{documentId:e}}}(e)),this.logger.debug("ViewportPlugin","RegisterViewport",`Registered viewport (DOM mounted) for document: ${e}`))}unregisterViewport(e){this.registry.isDestroyed()||this.state.activeViewports.has(e)&&(this.dispatch(function(e){return{type:Ko,payload:{documentId:e}}}(e)),this.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:Zo,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:Yo,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:ei,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:ti,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(ni(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:Qo,payload:{documentId:e,isScrolling:t}}}(e,!1),this.scrollEndDelay),this.debouncedDispatch(ni(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()}};ri.id="viewport";let ai=ri;const si={manifest:Wo,create:(e,t)=>new ai(Bo,e,t),reducer:(e=ii,t)=>{switch(t.type){case qo:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...oi,gates:new Set}}}}case Go:{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 Vo:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.add(n),{...e,activeViewports:o,activeDocumentId:e.activeDocumentId??n}}case Ko:{const{documentId:n}=t.payload,o=new Set(e.activeViewports);return o.delete(n),{...e,activeViewports:o}}case"SET_ACTIVE_VIEWPORT_DOCUMENT":return{...e,activeDocumentId:t.payload};case Xo:return{...e,viewportGap:t.payload};case Zo:{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 Yo:{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 Qo:{const{documentId:n,isScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isScrolling:o}}}:e}case Jo:{const{documentId:n,isSmoothScrolling:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,isSmoothScrolling:o}}}:e}case ei:{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 ti:{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:ii},li=de(null),ci=()=>_o(ai.id);function di(e){const{plugin:t}=Eo(ai.id),n=De(null);return Pe(()=>{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 ui({children:e,documentId:t,...n}){const[o,i]=Se(0),r=di(t),{provides:a}=ci(),s=(e=>{const{provides:t}=ci(),[n,o]=Se((null==t?void 0:t.isGated(e))??!1);return Ae(()=>{if(t)return o(t.isGated(e)),t.onGateChange(t=>{t.documentId===e&&o(t.isGated)})},[t,e]),n})(t);Ae(()=>{a&&i(a.getViewportGap())},[a]);const{style:l,...c}=n;return He(li.Provider,{value:r,children:He("div",{...c,ref:r,style:{width:"100%",height:"100%",overflow:"auto",..."object"==typeof l?l:{},padding:`${o}px`},children:!s&&e})})}var hi=(e=>(e.Vertical="vertical",e.Horizontal="horizontal",e))(hi||{});class mi{constructor(e){this.pageGap=e.pageGap??20,this.viewportGap=e.viewportGap??20,this.bufferSize=e.bufferSize??2}getVisibleRange(e,t,n){const o=this.getScrollOffset(e),i=o,r=o+this.getClientSize(e);let a=0;for(;ae.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=u?(t[t.length-1].offset+t[t.length-1].height)*n-(u.offset+u.height)*n:0;return{currentPage:c,visiblePages:s,pageVisibilityMetrics:a,renderedPageIndexes:l,scrollOffset:{x:e.scrollLeft,y:e.scrollTop},startSpacing:h,endSpacing:m}}calculatePageVisibility(e,t,n,o){const i=[],r=o??Math.max(...e.map(e=>e.width));return e.forEach(e=>{const o=e.width{const a=(e.x+o)*n,s=e.y*n,l=a+r.x*n,c=s+r.y*n,d=r.rotatedWidth*n,u=r.rotatedHeight*n,h=t.scrollLeft,m=t.scrollTop,g=h+t.clientWidth,p=m+t.clientHeight,f=Math.max(l,h),v=Math.max(c,m),y=Math.min(l+d,g),b=Math.min(c+u,p);if(fe.visiblePercentage)),n=e.filter(e=>e.visiblePercentage===t);return 1===n.length?n[0].pageNumber:n.sort((e,t)=>e.pageNumber-t.pageNumber)[0].pageNumber}getRectLocationForPage(e,t,n){const o=t.find(t=>t.pageNumbers.includes(e));if(!o)return null;const i=o.pageLayouts.find(t=>t.pageNumber===e);if(!i)return null;let r=0;if(n){const e=n.width;o.width{let o=0;const i=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:o,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height};return o+=e.rotatedSize.width+this.pageGap,t}),r=e.reduce((t,n,o)=>t+n.rotatedSize.width+(oe.rotatedSize.height)),s={id:`item-${n}`,x:0,y:t,offset:t,width:r,height:a,pageLayouts:i,pageNumbers:e.map(e=>e.index+1),index:n};return t+=a+this.pageGap,s})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:Math.max(...e.map(e=>e.width)),height:e[e.length-1].y+e[e.length-1].height}}getScrollOffset(e){return e.scrollTop}getClientSize(e){return e.clientHeight}}class pi extends mi{constructor(e){super(e)}createVirtualItems(e){let t=0;return e.map((e,n)=>{let o=0;const i=e.map(e=>{const t={pageNumber:e.index+1,pageIndex:e.index,x:o,y:0,width:e.size.width,height:e.size.height,rotatedWidth:e.rotatedSize.width,rotatedHeight:e.rotatedSize.height};return o+=e.rotatedSize.width+this.pageGap,t}),r=e.reduce((t,n,o)=>t+n.rotatedSize.width+(oe.rotatedSize.height)),s={id:`item-${n}`,x:t,y:0,offset:t,width:r,height:a,pageLayouts:i,pageNumbers:e.map(e=>e.index+1),index:n};return t+=r+this.pageGap,s})}getTotalContentSize(e){if(0===e.length)return{width:0,height:0};return{width:e[e.length-1].x+e[e.length-1].width,height:Math.max(...e.map(e=>e.height))}}getScrollOffset(e){return e.scrollLeft}getClientSize(e){return e.clientWidth}}const fi="INIT_SCROLL_STATE",vi="CLEANUP_SCROLL_STATE",yi="UPDATE_DOCUMENT_SCROLL_STATE",bi="SET_SCROLL_STRATEGY";function wi(e,t){return{type:yi,payload:{documentId:e,state:t}}}const xi={isChanging:!1,targetPage:1,fromPage:1,startTime:0},Ci=class extends fo{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$=Mo(),this.scroll$=Mo(),this.layoutChange$=Mo(),this.pageChangeState$=Mo(),this.layoutReady$=Mo(),this.state$=Mo(),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:fi,payload:{documentId:e,state:t}}}(e,n));const o=this.createStrategy(n.strategy);this.strategies.set(e,o),this.scrollerLayoutEmitters.set(e,Mo())}onDocumentLoaded(e){var t;const n=this.getCoreDocument(e);n&&(this.dispatch(wi(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:vi,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===hi.Horizontal?new pi(t):new gi(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:xi}}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(wi(e,{pageChangeState:i})),"instant"===n&&this.completePageChange(e)}completePageChange(e){const t=this.getDocumentState(e);if(!t||!t.pageChangeState.isChanging)return;const n={isChanging:!1,targetPage:t.pageChangeState.targetPage,fromPage:t.pageChangeState.fromPage,startTime:t.pageChangeState.startTime};this.dispatch(wi(e,{pageChangeState:n}))}computeLayout(e,t){const n=this.getStrategy(e),o=n.createVirtualItems(t);return{virtualItems:o,totalContentSize:n.getTotalContentSize(o)}}computeMetrics(e,t,n){const o=this.getCoreDocumentOrThrow(e),i=this.getDocumentState(e),r=this.getStrategy(e);if(!i)throw new Error(`Document state not found: ${e}`);return r.handleScroll(t,n??i.virtualItems,o.scale)}commitMetrics(e,t){const n=this.getDocumentState(e);n&&(this.dispatch(wi(e,t)),this.scroll$.emit({documentId:e,metrics:t}),t.currentPage!==n.currentPage&&this.pageChange$.emit({documentId:e,pageNumber:t.currentPage,totalPages:n.totalPages}),this.pushScrollerLayout(e))}pushScrollerLayout(e){const t=this.scrollerLayoutEmitters.get(e);if(t)try{const n=this.getScrollerLayout(e);t.emit(n)}catch(e){}}refreshDocumentLayout(e){const t=this.coreState.core.documents[e],n=this.getDocumentState(e);if(!t||!n||"loaded"!==t.status)return;const o=this.getSpreadPagesWithRotatedSize(e),i=this.computeLayout(e,o),r=this.viewport.forDocument(e),a=this.computeMetrics(e,r.getMetrics(),i.virtualItems);this.dispatch(wi(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&&ae.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:bi,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()}};Ci.id="scroll";let Ii=Ci;const ki="scroll",Si={manifest:{id:ki,name:"Scroll Plugin",version:"1.0.0",provides:["scroll"],requires:["viewport"],optional:["spread","interaction-manager"],defaultConfig:{defaultPageGap:10,defaultBufferSize:4,defaultStrategy:hi.Vertical}},create:(e,t)=>new Ii(ki,e,t),reducer:(e,t)=>{switch(t.type){case fi:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case vi:{const{[t.payload]:n,...o}=e.documents;return{...e,documents:o}}case yi:{const{documentId:n,state:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,...o}}}:e}case bi:{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??hi.Vertical,defaultPageGap:t.defaultPageGap??10,defaultBufferSize:t.defaultBufferSize??2,documents:{}}))(0,t)},Mi=()=>_o(Ii.id),Ai=e=>{const{provides:t}=Mi(),[n,o]=Se(1),[i,r]=Se(1);return Ae(()=>{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 Pi({documentId:e,renderPage:t,...n}){const{plugin:o}=Eo(Ii.id),[i,r]=Se({layout:null,docId:null});Ae(()=>{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 Pe(()=>{o&&e&&a&&o.setLayoutReady(e)},[o,e,a]),a?He("div",{...n,style:{width:`${a.totalWidth}px`,height:`${a.totalHeight}px`,position:"relative",boxSizing:"border-box",margin:"0 auto",...a.strategy===hi.Horizontal&&{display:"flex",flexDirection:"row"}},children:[He("div",{style:{...a.strategy===hi.Horizontal?{width:a.startSpacing,height:"100%",flexShrink:0}:{height:a.startSpacing,width:"100%"}}}),He("div",{style:{gap:a.pageGap,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",...a.strategy===hi.Horizontal?{flexDirection:"row",minHeight:"100%"}:{flexDirection:"column",minWidth:"fit-content"}},children:a.items.map(e=>He("div",{style:{display:"flex",justifyContent:"center",gap:a.pageGap},children:e.pageLayouts.map(e=>He("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]))}),He("div",{style:{...a.strategy===hi.Horizontal?{width:a.endSpacing,height:"100%",flexShrink:0}:{height:a.endSpacing,width:"100%"}}})]}):null}var Di=(e=>(e.None="none",e.Odd="odd",e.Even="even",e))(Di||{});const Ri="SPREAD/INIT_STATE",zi="SPREAD/CLEANUP_STATE",Ti="SPREAD/SET_SPREAD_MODE",Ei="SPREAD/SET_PAGE_GROUPING";function _i(e,t){return{type:Ei,payload:{documentId:e,grouping:t}}}const Ni=class extends fo{constructor(e,t,n){var o;super(e,t),this.spreadEmitter$=Mo(),this.defaultSpreadMode=n.defaultSpreadMode??Di.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:Ri,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(_i(e,t))}null==(t=this.viewport)||t.releaseGate("spread",e)}onDocumentClosed(e){this.dispatch(function(e){return{type:zi,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:Ti,payload:{documentId:e,spreadMode:t}}}(n,e));const t=this.calculatePageGrouping(n,i.document.pages.length);this.dispatch(_i(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 Di.None:return Array.from({length:t},(e,t)=>[t]);case Di.Odd:return Array.from({length:Math.ceil(t/2)},(e,n)=>{const o=[2*n];return 2*n+1{const o=[1+2*n];return 1+2*n+1[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)??Di.None} -> ${i.spreadMode}`)}}async initialize(e){this.logger.info("SpreadPlugin","Initialize","Spread plugin initialized")}async destroy(){this.spreadEmitter$.clear(),super.destroy()}};Ni.id="spread";let Oi=Ni;const Li="spread",$i={id:Li,name:"Spread Plugin",version:"1.0.0",provides:["spread"],requires:[],optional:["viewport"],defaultConfig:{}};Di.None;const ji={documents:{},activeDocumentId:null},Fi={manifest:$i,create:(e,t)=>new Oi(Li,e,t),reducer:(e=ji,t)=>{switch(t.type){case Ri:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case zi:{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 Ti:{const{documentId:n,spreadMode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,spreadMode:o}}}:e}case Ei:{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:ji},Ui="ui",Hi={id:Ui,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:{}}}},Bi="UI/INIT_STATE",Wi="UI/CLEANUP_STATE",qi="UI/SET_ACTIVE_TOOLBAR",Gi="UI/CLOSE_TOOLBAR_SLOT",Vi="UI/SET_ACTIVE_SIDEBAR",Ki="UI/CLOSE_SIDEBAR_SLOT",Zi="UI/SET_SIDEBAR_TAB",Yi="UI/OPEN_MODAL",Xi="UI/CLOSE_MODAL",Qi="UI/CLEAR_MODAL",Ji="UI/OPEN_MENU",er="UI/CLOSE_MENU",tr="UI/CLOSE_ALL_MENUS",nr="UI/SET_OVERLAY_ENABLED",or="UI/SET_DISABLED_CATEGORIES",ir="UI/SET_HIDDEN_ITEMS",rr=(e,t,n,o,i)=>({type:Vi,payload:{documentId:e,placement:t,slot:n,sidebarId:o,activeTab:i}}),ar=(e,t,n)=>({type:Ki,payload:{documentId:e,placement:t,slot:n}}),sr=(e,t)=>({type:Ji,payload:{documentId:e,menuState:t}}),lr=(e,t)=>({type:er,payload:{documentId:e,menuId:t}}),cr=(e,t,n)=>({type:nr,payload:{documentId:e,overlayId:t,enabled:n}}),dr=e=>({type:or,payload:{categories:e}}),ur=e=>({type:ir,payload:{hiddenItems:e}});function hr(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 mr(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 gr(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 pr(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 fr="data-epdf",vr="data-epdf-s",yr="data-epdf-i",br="data-epdf-cat",wr="data-epdf-dis",xr="data-epdf-hid",Cr={ROOT:`[${fr}]`,STYLES:`[${vr}]`,ITEM:e=>`[${yr}="${e}"]`,CATEGORIES:e=>`[${br}~="${e}"]`,DISABLED_CATEGORY:e=>`[${wr}~="${e}"]`,HIDDEN_ITEM:e=>`[${xr}~="${e}"]`},Ir={useContainerQueries:!0};function kr(e,t={}){const n={...Ir,...t.config},o=t.locale,i=Mr(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=Cr.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(`${Cr.ROOT}[${wr}~="${e}"] [${br}~="${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=$r(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 Sr(e,t){const n=new Set(t),o=[];return e.forEach((e,t)=>{e.some(e=>n.has(e))&&o.push(t)}),o}function Mr(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))Ar(s,l,n,o,i,r,a,t);for(const[r,s]of Object.entries(e.toolbars))zr(r,s,n,o,i,a,t);for(const[t,r]of Object.entries(e.sidebars))_r(t,r,n,o,i);for(const[r,s]of Object.entries(e.selectionMenus||{}))Nr(r,s,n,o,i,a,t);return{categories:n,itemCategories:o,dependencies:i,menuBreakpoints:r,responsiveItems:a}}function Ar(e,t,n,o,i,r,a,s){Lr(e,t.categories,t.visibilityDependsOn,n,o,i),Pr(t.items,n,o,i);const l=pr(t,s);l&&l.items.forEach((e,t)=>{a.set(t,e)});const c=function(e,t,n){var o;const i=[],r=pr(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=Rr(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;Dr(e.items,t,n,o),i.push({visibleItemIds:n,visibleCategories:o})}return i}(t,o,s);r.set(e,c)}function Pr(e,t,n,o){for(const i of e)Lr(i.id,i.categories,i.visibilityDependsOn,t,n,o),"section"===i.type&&Pr(i.items,t,n,o)}function Dr(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&&Dr(i.items,t,n,o)}}function Rr(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 zr(e,t,n,o,i,r,a){Lr(e,t.categories,t.visibilityDependsOn,n,o,i);const s=pr(t,a);s&&s.items.forEach((e,t)=>{r.set(t,e)}),Tr(t.items,n,o,i)}function Tr(e,t,n,o){for(const i of e)Lr(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&Tr(i.items,t,n,o),"tab-group"===i.type&&i.tabs&&Er(i.tabs,t,n,o)}function Er(e,t,n,o){for(const i of e)Lr(i.id,i.categories,i.visibilityDependsOn,t,n,o)}function _r(e,t,n,o,i){if(Lr(e,t.categories,t.visibilityDependsOn,n,o,i),"tabs"===t.content.type)for(const e of t.content.tabs)Lr(e.id,e.categories,e.visibilityDependsOn,n,o,i)}function Nr(e,t,n,o,i,r,a){if(Lr(e,t.categories,t.visibilityDependsOn,n,o,i),t.responsive){const e=pr(t,a);e&&e.items.forEach((e,t)=>{r.set(t,e)})}Or(t.items,n,o,i)}function Or(e,t,n,o){for(const i of e)Lr(i.id,i.categories,i.visibilityDependsOn,t,n,o),"group"===i.type&&i.items&&Or(i.items,t,n,o)}function Lr(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 $r(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=>Cr.HIDDEN_ITEM(e)).join(""),i=`${Cr.ROOT}${o} ${Cr.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=>Cr.HIDDEN_ITEM(e)).join("");r.push(`${Cr.ROOT}${t} ${Cr.ITEM(e.itemId)} {\n display: none !important;\n}`)}return r}function jr(e,t){var n;return{[yr]:e.id,[br]:(null==(n=e.categories)?void 0:n.join(" "))||void 0,...t}}const Fr=class extends fo{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$=Mo(),this.stylesheetInvalidated$=So(),this.toolbarChanged$=Ao((e,t)=>({documentId:e,...t}),{cache:!1}),this.sidebarChanged$=Ao((e,t)=>({documentId:e,...t}),{cache:!1}),this.modalChanged$=Ao((e,t)=>({documentId:e,...t}),{cache:!1}),this.menuChanged$=Ao((e,t)=>({documentId:e,...t}),{cache:!1}),this.overlayChanged$=Ao((e,t)=>({documentId:e,...t}),{cache:!1}),this.schema=n.schema,this.stylesheetConfig=n.stylesheetConfig||{},this.itemCategories=Mr(this.schema).itemCategories,null==(o=n.disabledCategories)?void 0:o.length){this.dispatch(dr(n.disabledCategories));const e=Sr(this.itemCategories,n.disabledCategories);this.dispatch(ur(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:Bi,payload:{documentId:e,schema:t}}))(e,this.schema))}onDocumentClosed(e){this.dispatch((e=>({type:Wi,payload:{documentId:e}}))(e)),this.toolbarChanged$.clearScope(e),this.sidebarChanged$.clearScope(e),this.modalChanged$.clearScope(e),this.menuChanged$.clearScope(e),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=kr(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(dr(n));const o=Sr(this.itemCategories,n);this.dispatch(ur(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(dr(n));const o=Sr(this.itemCategories,n);this.dispatch(ur(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(dr(e));const t=Sr(this.itemCategories,e);this.dispatch(ur(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:hr(t.toolbars,n.toolbars),menus:mr(t.menus,n.menus),sidebars:gr(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:qi,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:Gi,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(rr(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(ar(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(ar(r,e,t)),this.sidebarChanged$.emit(r,{placement:e,slot:t,sidebarId:""})):(this.dispatch(rr(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:Zi,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:Yi,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:Xi,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:Qi,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(sr(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(lr(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(lr(i,e)),this.menuChanged$.emit(i,{menuId:e,isOpen:!1})):(this.dispatch(sr(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:tr,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(cr(n,e,!0)),this.overlayChanged$.emit(n,{overlayId:e,isEnabled:!0})}disableOverlayForDocument(e,t){const n=t??this.getActiveDocumentId();this.dispatch(cr(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)}};Fr.id="ui";let Ur=Fr;const Hr={activeToolbars:{},activeSidebars:{},activeModal:null,openMenus:{},sidebarTabs:{},enabledOverlays:{}},Br={documents:{},disabledCategories:[],hiddenItems:[]};function Wr(e,t){const n=function(e){return e.ui??null}(e);return(null==n?void 0:n.documents[t])??null}function qr(e,t){return`${e}-${t}`}function Gr(e,t,n,o,i){const r=function(e,t,n,o){const i=Wr(e,t);return i?i.activeToolbars[qr(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.toolbarId===i)}function Vr(e,t,n,o,i){const r=function(e,t,n,o){const i=Wr(e,t);return i?i.activeSidebars[qr(n,o)]??null:null}(e,t,n,o);return!(!r||!r.isOpen)&&(!i||r.sidebarId===i)}const Kr={manifest:Hi,create:(e,t)=>new Ur(Ui,e,t),reducer:(e=Br,t)=>{var n;switch(t.type){case Bi:{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]:{...Hr,activeToolbars:i,enabledOverlays:r}}}}case Wi:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case qi:{const{documentId:n,placement:o,slot:i,toolbarId:r}=t.payload,a=e.documents[n]||Hr,s=`${o}-${i}`;return{...e,documents:{...e.documents,[n]:{...a,activeToolbars:{...a.activeToolbars,[s]:{toolbarId:r,isOpen:!0}}}}}}case Gi:{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 Vi:{const{documentId:n,placement:o,slot:i,sidebarId:r,activeTab:a}=t.payload,s=e.documents[n]||Hr,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 Ki:{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 Zi:{const{documentId:n,sidebarId:o,tabId:i}=t.payload,r=e.documents[n]||Hr;return{...e,documents:{...e.documents,[n]:{...r,sidebarTabs:{...r.sidebarTabs,[o]:i}}}}}case Yi:{const{documentId:n,modalId:o,props:i}=t.payload,r=e.documents[n]||Hr;return{...e,documents:{...e.documents,[n]:{...r,activeModal:{modalId:o,isOpen:!0,props:i},openMenus:{}}}}}case Xi:{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 Qi:{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 Ji:{const{documentId:n,menuState:o}=t.payload,i=e.documents[n]||Hr;return{...e,documents:{...e.documents,[n]:{...i,openMenus:{[o.menuId]:o}}}}}case er:{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 tr:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,openMenus:{}}}}:e}case nr:{const{documentId:n,overlayId:o,enabled:i}=t.payload,r=e.documents[n]||Hr;return{...e,documents:{...e.documents,[n]:{...r,enabledOverlays:{...r.enabledOverlays,[o]:i}}}}}case or:return{...e,disabledCategories:t.payload.categories};case ir:return{...e,hiddenItems:t.payload.hiddenItems};default:return e}},initialState:Br},Zr=()=>_o(Ur.id),Yr=e=>{const{provides:t}=Zr(),[n,o]=Se(null);return Ae(()=>{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},Xr=de(null);function Qr(){const e=Te(Xr);if(!e)throw new Error("useUIContainer must be used within a UIProvider");return e}const Jr=de(null);function ea({children:e}){const t=De(new Map),n={register:ze((e,n,o)=>{const i=`${e}:${n}`;t.current.set(i,o)},[]),unregister:ze((e,n)=>{const o=`${e}:${n}`;t.current.delete(o)},[]),getAnchor:ze((e,n)=>{const o=`${e}:${n}`;return t.current.get(o)||null},[])};return He(Jr.Provider,{value:n,children:e})}function ta(){const e=Te(Jr);if(!e)throw new Error("useAnchorRegistry must be used within UIProvider");return e}function na(e,t){const n=ta(),o=De(null),i=De(e),r=De(t);return i.current=e,r.current=t,ze(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 oa=de(null);function ia({children:e,initialComponents:t={}}){const n=De(new Map(Object.entries(t))),o={register:ze((e,t)=>{n.current.set(e,t)},[]),unregister:ze(e=>{n.current.delete(e)},[]),get:ze(e=>n.current.get(e),[]),has:ze(e=>n.current.has(e),[]),getRegisteredIds:ze(()=>Array.from(n.current.keys()),[])};return He(oa.Provider,{value:o,children:e})}function ra(){const e=function(){const e=Te(oa);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?He(i,{documentId:n,...o||{}}):(console.error(`Component "${t}" not found in registry`),null)}}}const aa=de(null);function sa({children:e,renderers:t}){return He(aa.Provider,{value:t,children:e})}function la(){const e=Te(aa);if(!e)throw new Error("useRenderers must be used within UIProvider");return e}function ca(e,t){var n;const{provides:o}=Zr(),i=la(),r=ze(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 He(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 da({container:e,documentId:t}){const n=Yr(t),{provides:o}=Zr(),i=ta(),r=la(),[a,s]=Se(null),l=(null==n?void 0:n.openMenus)||{},c=null==o?void 0:o.getSchema();Ae(()=>{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 He(r.menu,{schema:d,documentId:t,anchorEl:a.anchorEl,onClose:()=>{a&&(null==o||o.forDocument(t).closeMenu(a.menuId))},container:e})}function ua({children:e,style:t,...n}){const{plugin:o}=Eo(Ur.id),{provides:i}=Zr(),[r,a]=Se([]),[s,l]=Se([]),c=De(null),d=De(null),u=De(null),h=De(null),m=Re(()=>({containerRef:h,getContainer:()=>h.current}),[]),g=ze(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(Cr.STYLES);if(n)return c.current=n,void(n.textContent=o.getStylesheet());const i=o.getStylesheet(),r=document.createElement("style");r.setAttribute(vr,""),r.textContent=i,t instanceof ShadowRoot?t.insertBefore(r,t.firstChild):t.appendChild(r),c.current=r}},[o]);Ae(()=>()=>{var e;(null==(e=c.current)?void 0:e.parentNode)&&!u.current&&c.current.remove(),c.current=null,d.current=null},[]),Ae(()=>{if(o)return o.onStylesheetInvalidated(()=>{c.current&&(c.current.textContent=o.getStylesheet())})},[o]),Ae(()=>{if(i)return a(i.getDisabledCategories()),l(i.getHiddenItems()),i.onCategoryChanged(({disabledCategories:e,hiddenItems:t})=>{a(e),l(t)})},[i]);const p=Re(()=>r.length>0?r.join(" "):void 0,[r]),f=Re(()=>s.length>0?s.join(" "):void 0,[s]),v=Re(()=>{const e={containerType:"inline-size"};return t&&"object"==typeof t?{...e,...t}:e},[t]),y={[fr]:"",[wr]:p,[xr]:f};return He(Xr.Provider,{value:m,children:He("div",{ref:g,...y,...n,style:v,children:e})})}function ha({children:e,documentId:t,components:n={},renderers:o,menuContainer:i,...r}){return He(ea,{children:He(ia,{initialComponents:n,children:He(sa,{renderers:o,children:He(ua,{...r,children:[e,He(da,{documentId:t,container:i})]})})})})}const ma=class extends fo{constructor(e,t,n){super(e,t),this.id=e,this.documentOpened$=Mo(),this.documentClosed$=Mo(),this.activeDocumentChanged$=Mo(),this.documentError$=Mo(),this.documentOrderChanged$=Mo(),this.openFileRequest$=So(),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:Gn,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:Kn,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:Vn,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 Ct,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(eo(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 Ct,n=this.checkDocumentLimit();if(n)return t.reject(n),t;const o=e.documentId||this.generateDocumentId();this.loadOptions.set(o,e),this.dispatchCoreAction(eo(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 Ct,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:Wn,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 Ct;return this.openFileRequest$.emit({task:t,options:e}),t}closeDocument(e){const t=new Ct,n=this.coreState.core.documents[e];return n?("loaded"===n.status&&n.document?this.engine.closeDocument(n.document).wait(()=>{this.dispatchCoreAction(to(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(to(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`),Ct.all(t)}setDocumentEncryption(e,t){const n=new Ct,o=this.coreState.core.documents[e];if(!(null==o?void 0:o.document))return n.reject({code:Qt.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 Ct,o=this.coreState.core.documents[e];if(!(null==o?void 0:o.document))return n.reject({code:Qt.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:Zn,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 Ct,n=this.coreState.core.documents[e];if(!(null==n?void 0:n.document))return t.reject({code:Qt.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:Qt.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:Qt.Unknown,message:`Document ${e} is already loaded successfully`}}:"error"!==t.status?{valid:!1,error:{code:Qt.Unknown,message:`Document ${e} is not in error state (current state: ${t.status})`}}:this.loadOptions.has(e)?{valid:!0}:{valid:!1,error:{code:Qt.Unknown,message:`No retry information available for document ${e}`}}:{valid:!1,error:{code:Qt.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:Hn,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:Bn,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()}};ma.id="document-manager";let ga=ma;const pa="document-manager";function fa({documentId:e,children:t}){const n=Oo(e);if(!n)return null;return He(H,{children:t({documentState:n,isLoading:"loading"===n.status,isError:"error"===n.status,isLoaded:"loaded"===n.status})})}const va=()=>_o(ga.id);const ya=Do({manifest:{id:pa,name:"Document Manager Plugin",version:"1.0.0",provides:["document-manager"],requires:[],optional:[],defaultConfig:{maxDocuments:10}},create:(e,t)=>new ga(pa,e,t),reducer:e=>e,initialState:{}}).addUtility(function(){const{plugin:e}=Eo(ga.id),{provides:t}=va(),n=De(null),o=De(null),i=De(void 0);return Ae(()=>{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]),He("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(),ba="commands",wa={id:ba,name:"Commands Plugin",version:"1.0.0",provides:["commands"],requires:[],optional:["i18n","ui"],defaultConfig:{commands:{}}},xa="COMMANDS/SET_DISABLED_CATEGORIES",Ca=e=>({type:xa,payload:e}),Ia=class extends fo{constructor(e,t,n){var o;super(e,t),this.commands=new Map,this.i18n=null,this.shortcutMap=new Map,this.commandExecuted$=So(),this.commandStateChanged$=So(),this.shortcutExecuted$=So(),this.categoryChanged$=Mo(),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(Ca(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(Ca(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(Ca(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(Ca(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),xo(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)}};Ia.id="commands";let ka=Ia;const Sa={disabledCategories:[]},Ma=()=>_o(ka.id),Aa=(e,t)=>{const{provides:n}=Ma(),[o,i]=Se(()=>n?n.resolve(e,t):null);return Ae(()=>{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 Pa=Do({manifest:wa,create:(e,t)=>new ka(ba,e,t),reducer:(e=Sa,t)=>t.type===xa?{...e,disabledCategories:t.payload}:e,initialState:Sa}).addUtility(function(){const{provides:e}=Ma();return Ae(()=>{if(!e)return;const t=function(e){return t=>{const n=t.composedPath()[0]||t.target;if("INPUT"===n.tagName||"TEXTAREA"===n.tagName||n.isContentEditable)return;const o=function(e){const t=[];e.ctrlKey&&t.push("ctrl"),e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.metaKey&&t.push("meta");const n=e.key.toLowerCase();return["control","shift","alt","meta"].includes(n)?null:[...t,n].sort().join("+")}(t);if(!o)return;const i=e.getCommandByShortcut(o);if(!i)return;const r=e.resolve(i.id);!r.disabled&&r.visible&&(t.preventDefault(),t.stopPropagation(),e.execute(i.id,void 0,"keyboard"))}}(e);return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e]),null}).build(),Da="i18n",Ra={id:Da,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"}}}]}},za="I18N/SET_LOCALE",Ta="I18N/REGISTER_LOCALE",Ea=e=>({type:za,payload:e}),_a=e=>({type:Ta,payload:e}),Na=class extends fo{constructor(e,t,n){super(e,t),this.locales=new Map,this.paramResolvers=new Map,this.paramsCache=new Map,this.localeChange$=So(),this.paramsChanged$=Ao((e,t)=>({documentId:e,...t}),{cache:!1}),this.config=n,n.locales.forEach(e=>{this.locales.set(e.code,e),this.dispatch(_a(e.code))}),n.paramResolvers&&Object.entries(n.paramResolvers).forEach(([e,t])=>{this.paramResolvers.set(e,t)}),this.dispatch(Ea(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});xo(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(Ea(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(_a(e.code)),this.logger.info("I18nPlugin","LocaleRegistered",`Locale registered: ${e.code}`))}};Na.id="i18n";let Oa=Na;const La={currentLocale:"en",availableLocales:[]},$a={manifest:Ra,create:(e,t)=>new Oa(Da,e,t),reducer:(e=La,t)=>{switch(t.type){case za:{const n=t.payload;return e.availableLocales.includes(n)?{...e,currentLocale:n}:(console.warn(`I18nPlugin: Locale '${n}' not available`),e)}case Ta:{const n=t.payload;return e.availableLocales.includes(n)?e:{...e,availableLocales:[...e.availableLocales,n]}}default:return e}},initialState:La},ja=e=>{const{provides:t}=_o(Oa.id),[,n]=Me(e=>e+1,0),o=ze((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 Ae(()=>{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 Fa=(e=>(e.Automatic="automatic",e.FitPage="fit-page",e.FitWidth="fit-width",e))(Fa||{}),Ua=(e=>(e[e.Center=0]="Center",e[e.Top=1]="Top",e))(Ua||{});const Ha="zoom",Ba={id:Ha,name:"Zoom Plugin",version:"1.0.0",provides:["zoom"],requires:["viewport","scroll"],optional:["interaction-manager","spread"],defaultConfig:{defaultZoomLevel:Fa.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:Fa.FitPage},{name:"Fit Width",value:Fa.FitWidth},{name:"Automatic",value:Fa.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}]}},Wa="ZOOM/INIT_STATE",qa="ZOOM/CLEANUP_STATE",Ga="ZOOM/SET_ZOOM_LEVEL",Va="ZOOM/SET_MARQUEE_ZOOM_ACTIVE";const Ka={zoomLevel:Fa.Automatic,currentZoomLevel:1,isMarqueeZoomActive:!1},Za={documents:{},activeDocumentId:null};const Ya=class extends fo{constructor(e,t,n){var o,i,r;super(e,t),this.zoom$=So(),this.state$=Mo(),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,Ua.Top),{mode:"debounce",wait:150,keyExtractor:e=>e.documentId}),null==(o=this.spread)||o.onSpreadChange(e=>{this.recalcAuto(e.documentId,Ua.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:Va,payload:{documentId:o,isActive:t}}))})}onDocumentLoadingStarted(e){this.viewport.gate("zoom",e);const t={...Ka,zoomLevel:this.defaultZoomLevel};this.dispatch(function(e,t){return{type:Wa,payload:{documentId:e,state:t}}}(e,t)),this.logger.debug("ZoomPlugin","DocumentOpened",`Initialized zoom state for document: ${e}`)}onDocumentLoaded(e){this.recalcAuto(e,Ua.Top)}onDocumentClosed(e){this.dispatch(function(e){return{type:qa,payload:e}}(e)),this.logger.debug("ZoomPlugin","DocumentClosed",`Cleaned up zoom state for document: ${e}`)}onRotationChanged(e){this.recalcAuto(e,Ua.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=Ua.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=wo(u+t,this.minZoom,this.maxZoom),m=Math.floor(1e3*h)/1e3,g=n??{vx:c.clientWidth/2,vy:o===Ua.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:Ga,payload:{documentId:e,zoomLevel:t,currentZoomLevel:n}}}(a,"number"==typeof e?m:e,m)),this.dispatchCoreAction(((e,t)=>({type:Xn,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 Fa.FitWidth:return s/c;case Fa.FitPage:return Math.min(s/c,l/d);case Fa.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*ne.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*ne.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{};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=wo(e.x,0,t.width),o=wo(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()}};Ya.id="zoom";let Xa=Ya;const Qa={manifest:Ba,create:(e,t)=>new Xa(Ha,e,t),reducer:(e=Za,t)=>{switch(t.type){case Wa:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case qa:{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 Ga:{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 Va:{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:Za},Ja=()=>_o(Xa.id);function es(e){const[t,n]=[e[0],e[1]],o=n.clientX-t.clientX,i=n.clientY-t.clientY;return Math.hypot(o,i)}function ts(e,t={}){const{provides:n}=_o("viewport"),{provides:o}=Ja(),i=Te(li),r=De(null);return Pe(()=>{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,C=0,I=0,k=0,S=0,M=0,A=0,P=0;const D=(e,t,n)=>Math.min(Math.max(e,t),n),R=()=>{const n=t.clientWidth-2*i,o=e.offsetWidth,r=o{const t=f*e,n=v*e;let o=k*(1-e);const i=I-t/2-y,r=S-P*e-y,a=Math.max(0,t-C),s=.3*C,l=Math.min(1,a/s);let c=i+(r-i)*l;return n>x-2*A&&(o=D(b+o,x-A-n,A)-b),t>w-2*A&&(c=D(y+c,w-A-t,A)-y),{tx:c,ty:o,blend:l,finalWidth:t}},T=t=>{u=t;const{tx:n,ty:o}=z(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},_=()=>{const{tx:e,finalWidth:t}=z(u),n=(u-1)*d;let o,i=M;if(t<=C)o=I;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();A=i,f=a.width,v=a.height,y=a.left-r.left,b=a.top-r.top,w=r.width,x=r.height,C=t.clientWidth,I=t.clientLeft+C/2;const s=n-a.left;k=o-a.top,S=n-r.left,M=o-r.top,P=f{if(2!==e.touches.length)return;h=!0,d=c().currentZoomLevel,m=es(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()},L=e=>{if(!h||2!==e.touches.length)return;const t=es(e.touches);T(t/m),e.preventDefault()},$=e=>{h&&(e.touches.length>=2||(h=!1,_()))},j=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)),T(p),g=setTimeout(()=>{g=null,_(),p=1},150)},F=l.onStateChange(()=>R()),U=new ResizeObserver(()=>R());return U.observe(e),U.observe(t),R(),a&&(t.addEventListener("touchstart",O,{passive:!1}),t.addEventListener("touchmove",L,{passive:!1}),t.addEventListener("touchend",$),t.addEventListener("touchcancel",$)),s&&t.addEventListener("wheel",j,{passive:!1}),()=>{a&&(t.removeEventListener("touchstart",O),t.removeEventListener("touchmove",L),t.removeEventListener("touchend",$),t.removeEventListener("touchcancel",$)),s&&t.removeEventListener("wheel",j),g&&clearTimeout(g),F(),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 ns({children:e,documentId:t,style:n,enablePinch:o=!0,enableWheel:i=!0,...r}){const a=Re(()=>({enablePinch:o,enableWheel:i}),[o,i]),{elementRef:s}=ts(t,a);return He("div",{ref:s,...r,style:{...n,display:"inline-block",overflow:"visible",boxSizing:"border-box"},children:e})}const os=({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}=Ja(),s=Oo(e),[l,c]=Se(null),d=Re(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Ae(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?He("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},is=class extends fo{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()}};is.id="render";let rs=is;const as="render",ss={manifest:{id:as,name:"Render Plugin",version:"1.0.0",provides:["render"],requires:[],optional:[],defaultConfig:{}},create:(e,t)=>new rs(as,e,t),reducer:()=>{},initialState:{}};function ls({documentId:e,pageIndex:t,scale:n,dpr:o,style:i,...r}){const{provides:a}=_o(rs.id),s=Oo(e),[l,c]=Se(null),d=De(null),u=Re(()=>s&&s.pageRefreshVersions[t]||0,[s,t]),h=Re(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]),m=Re(()=>void 0!==o?o:window.devicePixelRatio,[o]);Ae(()=>{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},En),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):n.abort({code:Qt.Cancelled,message:"canceled render task"})}},[e,t,h,m,a,u]);return He(H,{children:l&&He("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...r,style:{width:"100%",height:"100%",...i||{}}})})}const cs="rotate",ds={id:cs,name:"Rotate Plugin",version:"1.0.0",provides:["rotate"],requires:[],optional:[],defaultConfig:{}};const us="ROTATE/INIT_STATE",hs="ROTATE/CLEANUP_STATE",ms="ROTATE/SET_ROTATION";const gs=class extends fo{constructor(e,t,n){super(e,t),this.rotate$=Mo(),this.defaultRotation=n.defaultRotation??0}onDocumentLoadingStarted(e){const t={rotation:this.defaultRotation};this.dispatch(function(e,t){return{type:us,payload:{documentId:e,state:t}}}(e,t)),this.dispatchCoreAction(oo(this.defaultRotation,e)),this.logger.debug("RotatePlugin","DocumentOpened",`Initialized rotation state for document: ${e}`)}onDocumentClosed(e){this.dispatch(function(e){return{type:hs,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:ms,payload:{documentId:e,rotation:t}}}(n,e)),this.dispatchCoreAction(oo(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()}};gs.id="rotate";let ps=gs;const fs={documents:{},activeDocumentId:null},vs={manifest:ds,create:(e,t)=>new ps(cs,e,t),reducer:(e=fs,t)=>{switch(t.type){case us:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case hs:{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 ms:{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:fs};function ys({children:e,documentId:t,pageIndex:n,rotation:o,scale:i,style:r,...a}){var s,l,c,d;const{plugin:u}=Eo(ps.id),h=Oo(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?He("div",{...a,style:{position:"absolute",transformOrigin:"0 0",transform:w,...r},children:e}):null}const bs="SEARCH/INIT_STATE",ws="SEARCH/CLEANUP_STATE",xs="SEARCH/START_SEARCH_SESSION",Cs="SEARCH/STOP_SEARCH_SESSION",Is="SEARCH/SET_SEARCH_FLAGS",ks="SEARCH/SET_SHOW_ALL_RESULTS",Ss="SEARCH/START_SEARCH",Ms="SEARCH/SET_SEARCH_RESULTS",As="SEARCH/APPEND_SEARCH_RESULTS",Ps="SEARCH/SET_ACTIVE_RESULT_INDEX";function Ds(e,t){return{type:ks,payload:{documentId:e,showAll:t}}}function Rs(e,t,n,o){return{type:Ms,payload:{documentId:e,results:t,total:n,activeResultIndex:o}}}function zs(e,t){return{type:Ps,payload:{documentId:e,index:t}}}const Ts={flags:[],results:[],total:0,activeResultIndex:-1,showAllResults:!0,query:"",loading:!1,active:!1},Es={documents:{}},_s=(e,t,n)=>{const o=e.documents[t]||Ts;return{...e,documents:{...e.documents,[t]:{...o,...n}}}},Ns=class extends fo{constructor(e,t,n){super(e,t),this.searchStop$=Mo(),this.searchStart$=Mo(),this.searchResult$=Mo(),this.searchActiveResultChange$=Mo(),this.searchResultState$=Mo(),this.searchState$=Mo(),this.currentTask=new Map,this.pluginConfig=n}onDocumentLoadingStarted(e){const t={...Ts,flags:this.pluginConfig.flags||[],showAllResults:this.pluginConfig.showAllResults??!0};this.dispatch(function(e,t){return{type:bs,payload:{documentId:e,state:t}}}(e,t))}onDocumentClosed(e){this.stopSearchSession(e),this.dispatch(function(e){return{type:ws,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(Ds(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(Ds(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:Is,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:xs,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:Qt.Cancelled,message:"search stopped"})}catch{}this.currentTask.delete(e)}this.dispatch(function(e){return{type:Cs,payload:{documentId:e}}}(e)),this.notifySearchStop(e)}searchAllPages(e,t,n=!1){var o;const i=this.state.documents[t];if(!i)return Jt.reject({code:Qt.NotFound,message:"Search state not initialized"});const r=this.getCoreDocument(t);if(!(null==r?void 0:r.document))return Jt.reject({code:Qt.NotFound,message:"Document not loaded"});const a=e.trim();if(i.query===a&&!n)return Jt.resolve({results:i.results,total:i.total});const s=this.currentTask.get(t);if(s){try{null==(o=s.abort)||o.call(s,{code:Qt.Cancelled,message:"new search"})}catch{}this.currentTask.delete(t)}if(this.dispatch(function(e,t){return{type:Ss,payload:{documentId:e,query:t}}}(t,a)),!a)return this.dispatch(Rs(t,[],0,-1)),Jt.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:As,payload:{documentId:e,results:t}}}(t,e.results)),-1===this.state.documents[t].activeResultIndex&&(this.dispatch(zs(t,0)),this.notifyActiveResultChange(t,0)))}),l.wait(e=>{this.currentTask.delete(t);const n=e.total>0?0:-1;this.dispatch(Rs(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)!==Qt.Cancelled&&(console.error("Error during search:",e),this.dispatch(Rs(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(zs(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()}};Ns.id="search";let Os=Ns;const Ls="search",$s={manifest:{id:Ls,name:"Search Plugin",version:"1.0.0",provides:["search"],requires:[],optional:[],defaultConfig:{flags:[]}},create:(e,t)=>new Os(Ls,e,t),reducer:(e=Es,t)=>{switch(t.type){case bs:return{...e,documents:{...e.documents,[t.payload.documentId]:t.payload.state}};case ws:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case xs:return _s(e,t.payload.documentId,{active:!0});case Cs:return _s(e,t.payload.documentId,{results:[],total:0,activeResultIndex:-1,query:"",loading:!1,active:!1});case Is:return _s(e,t.payload.documentId,{flags:t.payload.flags});case ks:return _s(e,t.payload.documentId,{showAllResults:t.payload.showAll});case Ss:return _s(e,t.payload.documentId,{loading:!0,query:t.payload.query,results:[],total:0,activeResultIndex:-1});case As:{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 _s(e,n,{results:r,total:r.length,activeResultIndex:a,loading:!0})}case Ms:{const{documentId:n,results:o,total:i,activeResultIndex:r}=t.payload;return _s(e,n,{results:o,total:i,activeResultIndex:r,loading:!1})}case Ps:return _s(e,t.payload.documentId,{activeResultIndex:t.payload.index});default:return e}},initialState:Es},js=()=>_o(Os.id);function Fs({documentId:e,pageIndex:t,scale:n,style:o,highlightColor:i="#FFFF00",activeHighlightColor:r="#FFBF00",...a}){const{provides:s}=js(),[l,c]=Se(null),d=Oo(e),u=Re(()=>null==s?void 0:s.forDocument(e),[s,e]),h=Re(()=>void 0!==n?n:(null==d?void 0:d.scale)??1,[n,null==d?void 0:d.scale]);if(Ae(()=>{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 He("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)=>He("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 Us="selection",Hs={id:Us,name:"Selection Plugin",version:"1.0.0",provides:["selection"],requires:["interaction-manager"],optional:["viewport","scroll"],defaultConfig:{menuHeight:40}},Bs="SELECTION/INIT_STATE",Ws="SELECTION/CLEANUP_STATE",qs="SELECTION/CACHE_PAGE_GEOMETRY",Gs="SELECTION/SET_SELECTION",Vs="SELECTION/START_SELECTION",Ks="SELECTION/END_SELECTION",Zs="SELECTION/CLEAR_SELECTION",Ys="SELECTION/SET_RECTS",Xs="SELECTION/SET_SLICES",Qs="SELECTION/EVICT_PAGE_GEOMETRY",Js=(e,t)=>({type:Gs,payload:{documentId:e,selection:t}}),el=e=>({type:Vs,payload:{documentId:e}}),tl=e=>({type:Ks,payload:{documentId:e}}),nl=(e,t)=>({type:Ys,payload:{documentId:e,rects:t}}),ol=(e,t)=>({type:Xs,payload:{documentId:e,slices:t}}),il={geometry:{},rects:{},slices:{},selection:null,active:!1,selecting:!1},rl={documents:{}},al=(e,t,n)=>({...e,documents:{...e.documents,[t]:n}});function sl(e,t){return e.rects[t]??[]}function ll(e,t){return rt(sl(e,t))}function cl(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 dl(e,t){const n=e.rects[t]||[];if(0===n.length)return null;const o=ll(e,t);return o?{pageIndex:t,rect:o,segmentRects:n}:null}function ul(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=ll(e,o);i&&t.push({pageIndex:o,rect:i,segmentRects:n})}return t}function hl(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.yn.rect.y+n.rect.height+i||t.xn.rect.x+n.rect.width+i))for(let e=0;eh||t.yg)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)));pe.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 gl(e,t,n,o=!0){const i=[];for(const o of e.runs){const e=o.charStart,r=e+o.glyphs.length-1;if(rn)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?yl(n,i)?o=pl(o,i.rect):(t.push(o),o=i.rect):o=i.rect,n=i;o&&!fl(o)&&t.push(o);return t}(i):i.map(e=>e.rect)}function pl(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 fl(e){return e.size.width<=0||e.size.height<=0}function vl(e,t){if(fl(e)||fl(t))return 0;const n=pl(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 yl(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(vl(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 al}function bl(e,t){for(let n=0;n=0&&i=.5}const Il=class extends fo{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$=Ao((e,t)=>({documentId:e,placement:t})),this.selChange$=Ao((e,t)=>({documentId:e,selection:t,modeId:this.interactionManagerCapability.forDocument(e).getActiveMode()})),this.textRetrieved$=Ao((e,t)=>({documentId:e,text:t})),this.copyToClipboard$=Ao((e,t)=>({documentId:e,text:t}),{cache:!1}),this.beginSelection$=Ao((e,t)=>({documentId:e,page:t.page,index:t.index,modeId:t.modeId}),{cache:!1}),this.endSelection$=Ao((e,t)=>({documentId:e,modeId:t.modeId}),{cache:!1}),this.marqueeChange$=Ao((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}),{cache:!1}),this.marqueeEnd$=Ao((e,t)=>({documentId:e,pageIndex:t.pageIndex,rect:t.rect,modeId:t.modeId}),{cache:!1}),this.emptySpaceClick$=Ao((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(Yn,e=>{const{documentId:t,pageIndexes:n}=e.payload,o=n.map(e=>this.getNewPageGeometryAndCache(t,e));Ct.all(o).wait(()=>{n.forEach(e=>{this.notifyPage(t,e)})},En)}),null==(r=this.viewportCapability)||r.onViewportChange(e=>{this.recalculateMenuPlacement(e.documentId)},{mode:"throttle",wait:100})}onDocumentLoadingStarted(e){var t;this.dispatch(((e,t)=>({type:Bs,payload:{documentId:e,state:t}}))(e,il));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:Ws,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=>ul(this.getDocumentState(e(t))),getFormattedSelectionForPage:(t,n)=>dl(this.getDocumentState(e(n)),t),getHighlightRectsForPage:(t,n)=>sl(this.getDocumentState(e(n)),t),getHighlightRects:t=>this.getDocumentState(e(t)).rects,getBoundingRectForPage:(t,n)=>ll(this.getDocumentState(e(n)),t),getBoundingRects:t=>cl(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:()=>ul(this.getDocumentState(e)),getFormattedSelectionForPage:t=>dl(this.getDocumentState(e),t),getHighlightRectsForPage:t=>sl(this.getDocumentState(e),t),getHighlightRects:()=>this.getDocumentState(e).rects,getBoundingRectForPage:t=>ll(this.getDocumentState(e),t),getBoundingRects:()=>cl(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:sl(r,o),boundingRect:ll(r,o)}),a.wait(e=>{const t=this.getDocumentState(n),i=t.selection;if(!i||oi.end.page)return;const r=ml(i,e,o);if(!r)return;const a=gl(e,r.from,r.to);this.dispatch(nl(n,{...t.rects,[o]:a})),this.dispatch(ol(n,{...t.slices,[o]:{start:r.from,count:r.to-r.from+1}})),this.notifyPage(n,o)},En);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=hl(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=hl(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=hl(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=hl(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:Qt.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=wo(n.x,0,t.width),l=wo(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&&sthis.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:sl(n,t),boundingRect:ll(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 Jt.reject({code:Qt.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:qs,payload:{documentId:e,page:t,geo:n}}))(e,t,n)),this.touchGeometry(e,t)},En),i}getOrLoadGeometry(e,t){const n=this.getDocumentState(e).geometry[t];return n?(this.touchGeometry(e,t),Jt.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:Qs,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(el(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(tl(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:Zs,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(!bl(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=bl(e,o-1);if(!t)break;if(wl(e.runs[t.runIdx].glyphs[t.localIdx].flags))break;o--}let i=t;for(;i=0;t--){const n=e.runs[t];if(!xl(n)){if(!Cl(n.rect.y,n.rect.y+n.rect.height,i,r))break;a=n.charStart}}for(let t=n.runIdx+1;ti.page||t===i.page&&n>=i.index,a={start:r?i:{page:t,index:n},end:r?{page:t,index:n}:i};this.dispatch(Js(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=ml(t,r,e);a&&(o[e]=gl(r,a.from,a.to),i[e]={start:a.from,count:a.to-a.from+1})}this.dispatch(nl(e,o)),this.dispatch(ol(e,i))}getSelectedText(e){if(!this.checkPermission(e,Zt.CopyContents))return this.logger.debug("SelectionPlugin","GetSelectedText",`Cannot get selected text: document ${e} lacks CopyContents permission`),Jt.reject({code:Qt.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 Jt.reject({code:Qt.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 Jt.resolve([]);const r=this.engine.getTextSlices(t.document,i);return r.wait(t=>{this.textRetrieved$.emit(e,t)},En),r}copyToClipboard(e){if(!this.checkPermission(e,Zt.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"))},En)}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)}};Il.id="selection";let kl=Il;const Sl={manifest:Hs,create:(e,t)=>new kl(Us,e,t),reducer:(e=rl,t)=>{switch(t.type){case Bs:{const{documentId:n,state:o}=t.payload;return al(e,n,o)}case Ws:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case qs:{const{documentId:n,page:o,geo:i}=t.payload,r=e.documents[n];return r?al(e,n,{...r,geometry:{...r.geometry,[o]:i}}):e}case Gs:{const{documentId:n,selection:o}=t.payload,i=e.documents[n];return i?al(e,n,{...i,selection:o,active:!0}):e}case Vs:{const{documentId:n}=t.payload,o=e.documents[n];return o?al(e,n,{...o,selecting:!0,selection:null,rects:{}}):e}case Ks:{const{documentId:n}=t.payload,o=e.documents[n];return o?al(e,n,{...o,selecting:!1}):e}case Zs:{const{documentId:n}=t.payload,o=e.documents[n];return o?al(e,n,{...o,selecting:!1,selection:null,rects:{},active:!1}):e}case Ys:{const{documentId:n,rects:o}=t.payload,i=e.documents[n];return i?al(e,n,{...i,rects:o}):e}case Xs:{const{documentId:n,slices:o}=t.payload,i=e.documents[n];return i?al(e,n,{...i,slices:o}):e}case Qs:{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 al(e,n,{...i,geometry:r,rects:a,slices:s})}case"SELECTION/RESET":{const{documentId:n}=t.payload;return e.documents[n]?al(e,n,il):e}default:return e}},initialState:rl};const Ml="onDblClick";function Al({children:e,...t}){const{rect:n,rotation:o}=t,{matrix:i,width:r,height:a}=function(e,t){const{width:n,height:o}=e.size;switch(t%4){case 1:return{matrix:`matrix(0, -1, 1, 0, 0, ${o})`,width:o,height:n};case 2:return{matrix:`matrix(-1, 0, 0, -1, ${n}, ${o})`,width:n,height:o};case 3:return{matrix:`matrix(0, 1, -1, 0, ${n}, 0)`,width:o,height:n};default:return{matrix:"matrix(1, 0, 0, 1, 0, 0)",width:n,height:o}}}(n,o),s=De(null);Ae(()=>{const e=s.current;if(!e)return;const t=e=>{e.stopPropagation()},n=e=>{e.stopPropagation()};return e.addEventListener("pointerdown",t,{capture:!0}),e.addEventListener("touchstart",n,{capture:!0}),()=>{e.removeEventListener("pointerdown",t,{capture:!0}),e.removeEventListener("touchstart",n,{capture:!0})}},[]);return He(H,{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}}})})}const Pl={n:0,ne:45,e:90,se:135,s:180,sw:225,w:270,nw:315},Dl=["ns-resize","nesw-resize","ew-resize","nwse-resize","ns-resize","nesw-resize","ew-resize","nwse-resize"];function Rl(e,t,n=0){const o=((Pl[e]+90*t+n)%360+360)%360,i=Math.round(o/45)%8;return Dl[i]}function zl(e,t,n){const o=-e/2;return"center"===n?o:"outside"===n?o-t:o+t}function Tl(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;ad&&(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 El(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 _l(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=Tl(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}class Nl{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){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=_l(e,t,n,!1,!0);if(El(i,o,r))return i;let a=_l({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=_l({x:e.x*i,y:e.y*i},t,n,!1,!0);El(c,o,r)?(a=c,s=i):l=i}return a}return _l(e,t,n,!0,!1)}(this.calculateLocalDelta(e,t),this.activeHandle,{startRect:this.startElement,maintainAspectRatio:this.config.maintainAspectRatio,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}}})}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 Tl(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 Ol(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=De(null),r=De(t),a=De(null),s=De(null);Ae(()=>{r.current=t},[t]),Ae(()=>{i.current?i.current.updateConfig(o):i.current=new Nl(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=ze(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=ze(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]);Ae(()=>{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]),Ae(()=>()=>{var e;null!==a.current&&(null==(e=i.current)||e.end(),l())},[l]);const d=ze(e=>{var t;n&&(e.preventDefault(),e.stopPropagation(),null==(t=i.current)||t.startDrag(e.clientX,e.clientY),c(e))},[n,c]),u=ze(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),a.current===e.pointerId&&0===e.buttons&&l(e.pointerId))},[l]),h=ze(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=ze(e=>{var t;const n=a.current;null!==n&&e.pointerId===n&&(null==(t=i.current)||t.end(),l(e.pointerId))},[l]),g=ze(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=ze(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=ze((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=Re(()=>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]:zl(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?Rl(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]),C=Re(()=>{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:C,rotation:Re(()=>{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 Ll=()=>_o(kl.id),$l=()=>Eo(kl.id);function jl({documentId:e,pageIndex:t,scale:n,rotation:o,background:i="rgba(33,150,243)",selectionMenu:r}){var a,s;const{plugin:l}=$l(),c=Oo(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);Ae(()=>{if(l&&e)return l.registerSelectionOnPage({documentId:e,pageIndex:t,onRectsChange:({rects:e,boundingRect:t})=>{h(e),g(t)}})},[l,e,t]),Ae(()=>{if(l&&e)return l.onMenuPlacement(e,e=>{f(e)})},[l,e]);const v=Re(()=>void 0!==n?n:(null==c?void 0:c.scale)??1,[n,null==c?void 0:c.scale]),y=Re(()=>{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?He(H,{children:[He("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)=>He("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&&He(Al,{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 Fl=({documentId:e,pageIndex:t,scale:n,className:o,background:i,borderColor:r,borderStyle:a="dashed",stroke:s,fill:l})=>{const{plugin:c}=$l(),d=Oo(e),[u,h]=Se(null),m=r??s??"rgba(0,122,204,0.8)",g=i??l??"rgba(0,122,204,0.15)",p=Re(()=>void 0!==n?n:(null==d?void 0:d.scale)??1,[n,null==d?void 0:d.scale]);return Ae(()=>{if(c&&e)return c.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:p,onRectChange:h})},[c,e,t,p]),u?He("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 Ul({documentId:e,pageIndex:t,scale:n,rotation:o,background:i,textStyle:r,marqueeStyle:a,marqueeClassName:s,selectionMenu:l}){return He(H,{children:[He(jl,{documentId:e,pageIndex:t,scale:n,rotation:o,background:(null==r?void 0:r.background)??i,selectionMenu:l}),He(Fl,{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 Hl=Do(Sl).addUtility(function(){const{provides:e}=Ll();return Ae(()=>{if(e)return e.onCopyToClipboard(({text:e})=>{navigator.clipboard.writeText(e)})},[e]),null}).build(),Bl="tiling",Wl={id:Bl,name:"Tiling Plugin",version:"1.0.0",provides:["tiling"],requires:["render","scroll","viewport"],optional:[],defaultConfig:{tileSize:768,overlapPx:2.5,extraRings:0}},ql="TILING/INIT_STATE",Gl="TILING/CLEANUP_STATE",Vl="TILING/UPDATE_VISIBLE_TILES",Kl="TILING/MARK_TILE_STATUS",Zl=(e,t)=>({type:Vl,payload:{documentId:e,tiles:t}}),Yl=(e,t,n,o)=>({type:Kl,payload:{documentId:e,pageIndex:t,tileId:n,status:o}}),Xl={visibleTiles:{}};function Ql({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 Jl=class extends fo{constructor(e,t,n){super(e,t),this.tileRendering$=Mo(),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(Yn,e=>this.recalculateTiles(e.payload))}onDocumentLoadingStarted(e){this.dispatch(((e,t)=>({type:ql,payload:{documentId:e,state:t}}))(e,Xl))}onDocumentClosed(e){this.dispatch((e=>({type:Gl,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]=Ql({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(Zl(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=Ql({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(Zl(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(Yl(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(Yl(n,e.pageIndex,e.tile.id,"ready"))},En),o}};Jl.id="tiling";let ec=Jl;const tc={manifest:Wl,create:(e,t)=>new ec(Bl,e,t),reducer:(e,t)=>((e,t)=>{var n,o;switch(t.type){case ql:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o}}}case Gl:{const n=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i}}case Vl:{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 Kl:{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:{}}},nc=()=>_o(ec.id);function oc({documentId:e,pageIndex:t,tile:n,dpr:o,scale:i}){const{provides:r}=nc(),a=Re(()=>null==r?void 0:r.forDocument(e),[r,e]),[s,l]=Se(),c=De(null),d=i/n.srcScale;Ae(()=>{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)},En),()=>{c.current?(URL.revokeObjectURL(c.current),c.current=null):e.abort({code:Qt.Cancelled,message:"canceled render task"})}},[a,t,n.id]);return s?He("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 ic({documentId:e,pageIndex:t,scale:n,style:o,...i}){const{provides:r}=nc(),a=Oo(e),[s,l]=Se([]);Ae(()=>{if(r)return r.onTileRendering(n=>{n.documentId===e&&l(n.tiles[t]??[])})},[r,e,t]);const c=Re(()=>void 0!==n?n:(null==a?void 0:a.scale)??1,[n,null==a?void 0:a.scale]);return He("div",{style:{...o},...i,children:null==s?void 0:s.map(n=>He(oc,{documentId:e,pageIndex:t,tile:n,dpr:window.devicePixelRatio,scale:c},n.id))})}const rc="thumbnail",ac={id:rc,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}},sc="THUMBNAIL/INIT_STATE",lc="THUMBNAIL/CLEANUP_STATE",cc="THUMBNAIL/SET_WINDOW_STATE",dc="THUMBNAIL/UPDATE_VIEWPORT_METRICS";function uc(e,t){return{type:sc,payload:{documentId:e,state:t}}}const hc={thumbs:[],window:null,viewportH:0,scrollY:0},mc={documents:{},activeDocumentId:null},gc=class extends fo{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$=Ao((e,t)=>({documentId:e,window:t})),this.scrollTo$=Ao((e,t)=>({documentId:e,options:t})),this.refreshPages$=Ao((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(Yn,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(uc(e,{...hc})),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:lc,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(uc(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:dc,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.wrapperHeighto.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(En,()=>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()}};gc.id="thumbnail";let pc=gc;const fc={manifest:ac,create:(e,t)=>new pc(rc,e,t),reducer:(e=mc,t)=>{switch(t.type){case sc:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case lc:{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 cc:{const{documentId:n,window:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,window:o}}}:e}case dc:{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:mc},vc=()=>Eo(pc.id);function yc({documentId:e,style:t,children:n,...o}){const{plugin:i}=vc(),r=De(null),[a,s]=Se({window:null,docId:null}),l=a.docId===e?a.window:null;Ae(()=>{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]),Ae(()=>{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]),Ae(()=>{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]),Ae(()=>{const t=r.current;if(!t||!i)return;i.provides().forDocument(e).updateWindow(t.scrollTop,t.clientHeight)},[l,i,e]),Ae(()=>{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 He("div",{ref:r,style:{overflowY:"auto",position:"relative",paddingTop:c,paddingBottom:c,height:"100%",...t},...o,children:He("div",{style:{height:(null==l?void 0:l.totalHeight)??0,position:"relative"},children:null==l?void 0:l.items.map(e=>n(e))})})}function bc({documentId:e,meta:t,style:n,...o}){const{provides:i}=_o(pc.id),{plugin:r}=vc(),[a,s]=Se(),l=De(null),[c,d]=Se(0);Ae(()=>{if(!r)return;return r.provides().forDocument(e).onRefreshPages(e=>{e.includes(t.pageIndex)&&d(e=>e+1)})},[r,e,t.pageIndex]),Ae(()=>{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)},En),()=>{l.current?(URL.revokeObjectURL(l.current),l.current=null):null==o||o.abort({code:Qt.Cancelled,message:"canceled render task"})}},[i,e,t.pageIndex,c]);return a?He("img",{src:a,onLoad:()=>{l.current&&(URL.revokeObjectURL(l.current),l.current=null)},style:n,...o}):null}const wc="annotation",xc={id:wc,name:"Annotation Plugin",version:"1.0.0",provides:["annotation"],requires:["interaction-manager","selection"],optional:["history"],defaultConfig:{autoCommit:!0,annotationAuthor:"Guest",deactivateToolAfterCreate:!1,selectAfterCreate:!0}},Cc="ANNOTATION/INIT_STATE",Ic="ANNOTATION/CLEANUP_STATE",kc="ANNOTATION/SET_ANNOTATIONS",Sc="ANNOTATION/SELECT_ANNOTATION",Mc="ANNOTATION/DESELECT_ANNOTATION",Ac="ANNOTATION/ADD_TO_SELECTION",Pc="ANNOTATION/REMOVE_FROM_SELECTION",Dc="ANNOTATION/SET_SELECTION",Rc="ANNOTATION/SET_ACTIVE_TOOL_ID",zc="ANNOTATION/CREATE_ANNOTATION",Tc="ANNOTATION/PATCH_ANNOTATION",Ec="ANNOTATION/DELETE_ANNOTATION",_c="ANNOTATION/COMMIT",Nc="ANNOTATION/PURGE_ANNOTATION",Oc="ANNOTATION/ADD_COLOR_PRESET",Lc="ANNOTATION/SET_TOOL_DEFAULTS",$c="ANNOTATION/ADD_TOOL";const jc=e=>({type:Mc,payload:{documentId:e}}),Fc=(e,t,n)=>({type:Ac,payload:{documentId:e,pageIndex:t,id:n}}),Uc=(e,t)=>({type:Pc,payload:{documentId:e,id:t}}),Hc=(e,t)=>({type:Dc,payload:{documentId:e,ids:t}}),Bc=(e,t)=>({type:Rc,payload:{documentId:e,toolId:t}}),Wc=(e,t,n)=>({type:zc,payload:{documentId:e,pageIndex:t,annotation:n}}),qc=(e,t,n,o)=>({type:Tc,payload:{documentId:e,pageIndex:t,id:n,patch:o}}),Gc=(e,t,n)=>({type:Ec,payload:{documentId:e,pageIndex:t,id:n}}),Vc=(e,t,n)=>({type:Nc,payload:{documentId:e,pageIndex:t,uid:n}});function Kc(e){return e.object.type===_t.INK}function Zc(e){return e.object.type===_t.CIRCLE}function Yc(e){return e.object.type===_t.POLYGON}function Xc(e){return e.object.type===_t.SQUARE}function Qc(e){return e.object.type===_t.LINE}function Jc(e){return e.object.type===_t.POLYLINE}function ed(e){return e.object.type===_t.HIGHLIGHT}function td(e){return e.object.type===_t.UNDERLINE}function nd(e){return e.object.type===_t.STRIKEOUT}function od(e){return e.object.type===_t.SQUIGGLY}function id(e){return e.object.type===_t.FREETEXT}function rd(e){return e.object.type===_t.STAMP}function ad(e){return e.object.type===_t.TEXT}function sd(e){return e.object.type===_t.LINK}function ld(e){return function(e){return ed(e)||td(e)||nd(e)||od(e)}(e)||Kc(e)||Xc(e)||Zc(e)||Yc(e)||Qc(e)||Jc(e)||id(e)||rd(e)||function(e){return e.object.type===_t.REDACT}(e)}const cd=(e,t)=>(e.pages[t]??[]).map(t=>e.byUid[t]),dd=e=>e.selectedUids.map(t=>e.byUid[t]).filter(e=>void 0!==e),ud=e=>e.selectedUids,hd=(e,t)=>e.byUid[t]??null;function md(e,t){const n=e.tools.find(e=>e.id===t);return null==n?void 0:n.defaults}const gd=(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]),pd=(e,t)=>{const n=((e,t)=>{const n=e.byUid[t];if(n)return n.object.inReplyToId&&n.object.replyType===$t.Group?n.object.inReplyToId:t})(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===$t.Group&&t.object.type!==_t.LINK&&o.push(t)}return o},fd=(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===$t.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===$t.Group&&n.object.type!==_t.LINK)return!0}return!1},vd=[{id:"highlight",name:"Highlight",matchScore:e=>e.type===_t.HIGHLIGHT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.HIGHLIGHT,strokeColor:"#FFCD45",color:"#FFCD45",opacity:1,blendMode:zt.Multiply}},{id:"underline",name:"Underline",matchScore:e=>e.type===_t.UNDERLINE?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.UNDERLINE,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"strikeout",name:"Strikeout",matchScore:e=>e.type===_t.STRIKEOUT?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.STRIKEOUT,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"squiggly",name:"Squiggly",matchScore:e=>e.type===_t.SQUIGGLY?1:0,interaction:{exclusive:!1,textSelection:!0,isDraggable:!1,isResizable:!1,isGroupDraggable:!1,isGroupResizable:!1},defaults:{type:_t.SQUIGGLY,strokeColor:"#E44234",color:"#E44234",opacity:1}},{id:"ink",name:"Pen",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}},{id:"inkHighlighter",name:"Ink Highlighter",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:zt.Multiply}},{id:"circle",name:"Circle",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:Ut.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"square",name:"Square",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:Ut.SOLID},clickBehavior:{enabled:!0,defaultSize:{width:100,height:100}}},{id:"line",name:"Line",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}},{id:"lineArrow",name:"Arrow",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:Lt.None,end:Lt.OpenArrow}},clickBehavior:{enabled:!0,defaultLength:100,defaultAngle:0}},{id:"polyline",name:"Polyline",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"}},{id:"polygon",name:"Polygon",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"}},{id:"freeText",name:"Free Text",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:Pt.Helvetica,textAlign:Dt.Left,verticalAlign:Rt.Top,color:"transparent",backgroundColor:"transparent",opacity:1},clickBehavior:{enabled:!0,defaultSize:{width:100,height:20},defaultContent:"Insert text"},behavior:{insertUpright:!0}},{id:"stamp",name:"Image",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}}],yd=["#E44234","#FF8D00","#FFCD45","#5CC96E","#25D2D1","#597CE2","#C544CE","#7D2E25","#000000","#FFFFFF"],bd=e=>1===e.length?e[0]:null,wd=(e,t,n)=>{const o=e.byUid[t];return o?{...e,byUid:{...e.byUid,[t]:{...o,commitState:"synced"===o.commitState?"dirty":o.commitState,object:{...o.object,...n}}},hasPendingChanges:!0}:e};function xd(e){let t=e;return[()=>t,e=>{t=e}]}const Cd={annotationType:_t.INK,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=xd([]),[s,l]=xd(!1),c={current:null},d=e=>({x:wo(e.x,0,i.width),y:wo(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}}};return{onPointerDown:(e,t)=>{var o;const i=d(e);l(!0),c.current&&clearTimeout(c.current);const s=[...r(),{points:[i]}];a(s),n(h()),null==(o=t.setPointerCapture)||o.call(t)},onPointerMove:e=>{if(!s())return;const t=r();if(0===t.length)return;const o=d(e);t[t.length-1].points.push(o),a(t),n(h())},onPointerUp:(o,i)=>{var s;l(!1),null==(s=i.releasePointerCapture)||s.call(i),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{const o=r();if(o.length>0&&o[0].points.length>1){const n=u();if(!n)return;const i=o.flatMap(e=>e.points),r=et(Je(i),n.strokeWidth/2);t({...n,inkList:o,rect:r,type:_t.INK,pageIndex:e.pageIndex,id:zn(),created:new Date})}a([]),n(null)},800)},onPointerCancel:(e,t)=>{var o;a([]),l(!1),n(null),c.current&&clearTimeout(c.current),null==(o=t.releasePointerCapture)||o.call(t)}}}};function Id({threshold:e=5,getTool:t,onClickDetected:n}){const[o,i]=xd(null),[r,a]=xd(!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)}}}function kd(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 Sd(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 Md=kd(!1),Ad=kd(!0),Pd={[Lt.OpenArrow]:Md,[Lt.ClosedArrow]:Ad,[Lt.ROpenArrow]:{...Md,getRotation:e=>e+Math.PI},[Lt.RClosedArrow]:{...Ad,getRotation:e=>e+Math.PI},[Lt.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},[Lt.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},[Lt.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},[Lt.Butt]:Sd(6,e=>e+Math.PI/2),[Lt.Slash]:Sd(18,e=>e+Math.PI/1.5)};function Dd(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=Pd[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 Rd(e,t){if(!e.unrotatedRect)return{rect:t};const n=st(t);return{rect:dt(t,e.rotation??0,n),unrotatedRect:t}}function zd(e){return e.unrotatedRect?ht(e.unrotatedRect,e.rect,e.rotation??0):st(e.rect)}function Td(e,t,n){const o=zd(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 Ed(e,t,n){if(!e.unrotatedRect)return t;const o=e.rotation??0;if(Math.abs(o%360)<1e-8)return t;const i=zd(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 _d{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 Nd=new _d;function Od(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{...Td(e,{origin:{...i.origin},size:{...i.size}},o),rotation:o}}function Ld(e,t){return{rotation:t,...Td(e,e.unrotatedRect??e.rect,t)}}function $d(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 jd(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 Fd(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 Ud(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}=Ld(i,o);return{...i,rotation:r,rect:a,unrotatedRect:s}}function Hd(e,t){const n=wo(e.rect.origin.x,0,t.width-e.rect.size.width),o=wo(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 Bd=Object.freeze(Object.defineProperty({__proto__:null,LINE_ENDING_HANDLERS:Pd,PatchRegistry:_d,applyInsertUpright:Ud,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:Ed,createEnding:function(e,t,n,o,i){if(!e)return null;const r=Pd[e];if(!r)return null;const a=r.getRotation(n);return{d:r.getSvgPath(t),transform:`translate(${o} ${i}) rotate(${(e=>180*e/Math.PI)(a)})`,filled:r.filled}},getRectCenter:st,lineRectWithEndings:Dd,patchRegistry:Nd,resolveAnnotationRotationCenter:zd,resolveRotateRects:Td,resolveVertexEditRects:Rd,rotatePointAroundCenter:lt,rotateVertices:ct},Symbol.toStringTag,{value:"Module"})),Wd={annotationType:_t.FREETEXT,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i,pageIndex:r,pageRotation:a}=e,[s,l]=xd(null),c=e=>({x:wo(e.x,0,i.width),y:wo(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??Pt.Helvetica,color:e.defaults.color??e.defaults.backgroundColor??"transparent",textAlign:e.defaults.textAlign??Dt.Left,verticalAlign:e.defaults.verticalAlign??Rt.Top,contents:e.defaults.contents??"Insert text here",flags:e.defaults.flags??["print"]}:null},u=Id({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:zn(),created:new Date};(null==(o=n.behavior)?void 0:o.insertUpright)&&(g=Ud(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:zn(),created:new Date};(null==(h=null==i?void 0:i.behavior)?void 0:h.insertUpright)&&(r=Ud(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)}}}},qd={annotationType:_t.LINE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=xd(null),l=e=>({x:wo(e.x,0,r.width),y:wo(e.y,0,r.height)}),c=()=>{const e=i();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:Lt.None,end:Lt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeStyle:e.defaults.strokeStyle??Ut.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],strokeColor:e.defaults.strokeColor??"#000000",flags:e.defaults.flags??["print"]}:null},d=Id({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=Dd([g,p],i.strokeWidth,i.lineEndings);n({...i,rect:f,linePoints:{start:g,end:p},pageIndex:t,id:zn(),created:new Date,type:_t.LINE})}}),u=e=>{const t=a();if(!t)return null;const n=c();if(!n)return null;const o=Dd([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=Dd([u,h],e.strokeWidth,e.lineEndings);n({...e,rect:o,linePoints:{start:u,end:h},pageIndex:t,id:zn(),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)}}}},Gd={annotationType:_t.POLYLINE,create(e){const{onCommit:t,onPreview:n,getTool:o,pageSize:i}=e,[r,a]=xd([]),[s,l]=xd(null),c=e=>({x:wo(e.x,0,i.width),y:wo(e.y,0,i.height)}),d=()=>{const e=o();return e?{...e.defaults,strokeWidth:e.defaults.strokeWidth??1,lineEndings:e.defaults.lineEndings??{start:Lt.None,end:Lt.None},color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,strokeColor:e.defaults.strokeColor??"#000000",strokeStyle:e.defaults.strokeStyle??Ut.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=Dd(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=Dd(o,i.strokeWidth,i.lineEndings),c={...i,vertices:o,rect:s,type:_t.POLYLINE,pageIndex:e.pageIndex,id:zn(),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)}}}},Vd={annotationType:_t.POLYGON,create(e){const{onCommit:t,onPreview:n,getTool:o,scale:i,pageSize:r}=e,[a,s]=xd([]),[l,c]=xd(null),d=e=>({x:wo(e.x,0,r.width),y:wo(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??Ut.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=et(Je(o),i.strokeWidth/2),l={...i,vertices:o,rect:r,type:_t.POLYGON,pageIndex:e.pageIndex,id:zn(),created:new Date};t(l),s([]),c(null),n(null)},m=()=>{const e=a(),t=l();if(0===e.length||!t)return null;const n=u();if(!n)return null;const o=et(Je([...e,t]),n.strokeWidth/2);return{type:_t.POLYGON,bounds:o,data:{...n,rect:o,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)}}}},Kd={annotationType:_t.SQUARE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=xd(null),l=e=>({x:wo(e.x,0,r.width),y:wo(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??Ut.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1}:null},d=Id({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=wo(e.x-d,0,r.width-s),m=wo(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,f={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},v={...i,type:_t.SQUARE,created:new Date,id:zn(),pageIndex:t,rect:f};n(v)}}),u=e=>{const t=a();if(!t)return null;const n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),s=c();if(!s)return null;const l=s.strokeWidth,d=l/2,u={origin:{x:n-d,y:o-d},size:{width:i+l,height:r+l}};return{type:_t.SQUARE,bounds:u,data:{rect:u,...s}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;if(!a())return;if(!c())return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;const o=u(h);if(o){const i={...e,type:_t.SQUARE,created:new Date,id:zn(),pageIndex:t,rect:o.data.rect};n(i)}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Zd={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??Ot.Draft,subject:s.defaults.subject??"Stamp",flags:s.defaults.flags??["print"],pageIndex:e.pageIndex,id:zn(),created:new Date};(null==(c=s.behavior)?void 0:c.insertUpright)&&(u=Ud(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)})}})}}}},Yd={annotationType:_t.CIRCLE,create(e){const{pageIndex:t,onCommit:n,onPreview:o,getTool:i,pageSize:r}=e,[a,s]=xd(null),l=e=>({x:wo(e.x,0,r.width),y:wo(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??Ut.SOLID,strokeDashArray:e.defaults.strokeDashArray??[],color:e.defaults.color??"#000000",opacity:e.defaults.opacity??1,flags:e.defaults.flags??["print"]}:null},d=Id({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=wo(e.x-d,0,r.width-s),m=wo(e.y-u,0,r.height-l),g=i.strokeWidth,p=g/2,f={origin:{x:h-p,y:m-p},size:{width:s+g,height:l+g}},v={...i,type:_t.CIRCLE,created:new Date,id:zn(),pageIndex:t,rect:f};n(v)}}),u=e=>{const t=a();if(!t)return null;const n=Math.min(t.x,e.x),o=Math.min(t.y,e.y),i=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y),s=c();if(!s)return null;const l=s.strokeWidth,d=l/2,u={origin:{x:n-d,y:o-d},size:{width:i+l,height:r+l}};return{type:_t.CIRCLE,bounds:u,data:{rect:u,...s}}};return{onPointerDown:(e,t)=>{var n;const i=l(e);s(i),d.onStart(i),o(u(i)),null==(n=t.setPointerCapture)||n.call(t)},onPointerMove:e=>{const t=l(e);d.onMove(t),a()&&d.hasMoved()&&o(u(t))},onPointerUp:(e,i)=>{var r;if(!a())return;if(!c())return;const h=l(e);if(d.hasMoved()){const e=c();if(!e)return;const o=u(h);if(o){const i={...e,type:_t.CIRCLE,flags:["print"],created:new Date,id:zn(),pageIndex:t,rect:o.data.rect};n(i)}}else d.onEnd(h);s(null),o(null),d.reset(),null==(r=i.releasePointerCapture)||r.call(i)},onPointerLeave:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)},onPointerCancel:(e,t)=>{var n;s(null),o(null),d.reset(),null==(n=t.releasePointerCapture)||n.call(t)}}}},Xd=(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}=$d(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{oldRect:n,resolvedRect:o,rects:i}=jd(e,t.changes.rect,t.metadata),r=(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)}}),a=Math.min(o.size.width/n.size.width,o.size.height/n.size.height),s=Math.max(1,Math.round(e.strokeWidth*a)),l=r(n,e.strokeWidth/2),c=r(o,s/2),d=c.size.width/Math.max(l.size.width,1e-6),u=c.size.height/Math.max(l.size.height,1e-6);return{...i,inkList:e.inkList.map(e=>({points:e.points.map(e=>({x:c.origin.x+(e.x-l.origin.x)*d,y:c.origin.y+(e.y-l.origin.y)*u}))})),strokeWidth:s}}case"rotate":{const n=Od(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Fd(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,zd(e))}:{...t.changes,rect:i}}}},Qd=(e,t)=>{switch(t.type){case"vertex-edit":if(t.changes.linePoints){const{start:n,end:o}=t.changes.linePoints,i=[n,o],r=Ed(e,i,Dd(i,e.strokeWidth,e.lineEndings));return{...Rd(e,Dd(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}=$d(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}=jd(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=Od(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Fd(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=Dd([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,zd(e))}:{...t.changes,rect:o}}default:return t.changes}},Jd=(e,t)=>{switch(t.type){case"vertex-edit":if(t.changes.vertices&&t.changes.vertices.length){const n=t.changes.vertices,o=Ed(e,n,Dd(n,e.strokeWidth,e.lineEndings));return{...Rd(e,Dd(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}=$d(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}=jd(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=Od(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Fd(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=Dd(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,zd(e))}:{...t.changes,rect:o}}default:return t.changes}},eu=(e,t)=>{switch(t.type){case"vertex-edit":if(t.changes.vertices&&t.changes.vertices.length){const n=e.strokeWidth/2,o=t.changes.vertices,i=Ed(e,o,et(Je(o),n));return{...Rd(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}=$d(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}=jd(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=Od(e,t);if(!n)return t.changes;const{dx:o,dy:i}=Fd(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.rotation))return t.changes;const n={...e,...t.changes},o=n.strokeWidth/2,i=et(Je(n.vertices),o),r=t.changes.rotation??e.rotation??0;return e.unrotatedRect||void 0!==t.changes.rotation?{...t.changes,unrotatedRect:i,rect:dt(i,r,zd(e))}:{...t.changes,rect:i}}default:return t.changes}},tu=(e,t)=>{switch(t.type){case"move":return t.changes.rect?$d(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?jd(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Od(e,t)??t.changes;case"property-update":return void 0!==t.changes.rotation?{...t.changes,...Ld(e,t.changes.rotation)}:t.changes;default:return t.changes}},nu=(e,t)=>{switch(t.type){case"move":return t.changes.rect?$d(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?jd(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Od(e,t)??t.changes;case"property-update":return void 0!==t.changes.rotation?{...t.changes,...Ld(e,t.changes.rotation)}:t.changes;default:return t.changes}},ou=(e,t)=>{switch(t.type){case"move":return t.changes.rect?$d(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?jd(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Od(e,t)??t.changes;case"property-update":return void 0!==t.changes.rotation?{...t.changes,...Ld(e,t.changes.rotation)}:t.changes;default:return t.changes}},iu=(e,t)=>{switch(t.type){case"move":return t.changes.rect?$d(e,t.changes.rect).rects:t.changes;case"resize":return t.changes.rect?jd(e,t.changes.rect,t.metadata).rects:t.changes;case"rotate":return Od(e,t)??t.changes;case"property-update":return void 0!==t.changes.rotation?{...t.changes,...Ld(e,t.changes.rotation)}:t.changes;default:return t.changes}};function ru(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 au=class extends fo{constructor(e,t,n){var o,i,r;super(e,t),this.ANNOTATION_HISTORY_TOPIC="annotations",this.state$=Mo(),this.pendingContexts=new Map,this.isInitialLoadComplete=new Map,this.importQueue=new Map,this.commitInProgress=new Map,this.handlerFactories=new Map,this.activeTool$=Mo(),this.events$=Mo(),this.toolsChange$=Mo(),this.patchRegistry=new _d,this.unifiedDragStates=new Map,this.unifiedDrag$=Mo(),this.unifiedResizeStates=new Map,this.unifiedResize$=Mo(),this.unifiedRotateStates=new Map,this.unifiedRotate$=Mo(),this.config=n,this.selection=(null==(o=t.getPlugin("selection"))?void 0:o.provides())??null,this.history=(null==(i=t.getPlugin("history"))?void 0:i.provides())??null,this.interactionManager=(null==(r=t.getPlugin("interaction-manager"))?void 0:r.provides())??null,this.registerHandlerFactories(),this.registerBuiltInPatches()}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:Cc,payload:{documentId:e,state:t}}}(e,{pages:{},byUid:{},selectedUids:[],selectedUid:null,activeToolId:null,hasPendingChanges:!1})),this.pendingContexts.set(e,new Map),this.isInitialLoadComplete.set(e,!1),this.importQueue.set(e,[]),this.logger.debug("AnnotationPlugin","DocumentOpened",`Initialized annotation state for document: ${e}`)}onDocumentLoaded(e){const t=this.getCoreDocument(e);if((null==t?void 0:t.document)&&this.getAllAnnotations(e,t.document),this.selection)for(const e of this.state.tools)e.interaction.textSelection&&this.selection.enableForMode(e.interaction.mode??e.id,{showSelectionRects:!1,enableSelection:!0,enableMarquee:!1})}onDocumentClosed(e){this.dispatch(function(e){return{type:Ic,payload:e}}(e)),this.pendingContexts.delete(e),this.isInitialLoadComplete.delete(e),this.importQueue.delete(e),this.logger.debug("AnnotationPlugin","DocumentClosed",`Cleaned up annotation state for document: ${e}`)}registerHandlerFactories(){this.handlerFactories.set(_t.CIRCLE,Yd),this.handlerFactories.set(_t.SQUARE,Kd),this.handlerFactories.set(_t.STAMP,Zd),this.handlerFactories.set(_t.POLYGON,Vd),this.handlerFactories.set(_t.POLYLINE,Gd),this.handlerFactories.set(_t.LINE,qd),this.handlerFactories.set(_t.INK,Cd),this.handlerFactories.set(_t.FREETEXT,Wd)}registerBuiltInPatches(){this.patchRegistry.register(_t.INK,Xd),this.patchRegistry.register(_t.LINE,Qd),this.patchRegistry.register(_t.POLYLINE,Jd),this.patchRegistry.register(_t.POLYGON,eu),this.patchRegistry.register(_t.CIRCLE,tu),this.patchRegistry.register(_t.SQUARE,nu),this.patchRegistry.register(_t.FREETEXT,ou),this.patchRegistry.register(_t.STAMP,iu)}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(Bc(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=>!sd(e)).filter(e=>function(e,t){return!(e.origin.x+e.size.widthe.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;if(!this.checkPermission(e,Zt.ModifyAnnotations))return;const i=this.getActiveTool(e);if(!i||!i.interaction.textSelection)return;const r=null==(t=this.selection)?void 0:t.getFormattedSelection(),a=null==(n=this.selection)?void 0:n.getSelectedText();if(r&&a){for(const t of r)a.wait(n=>{var o,r;const a=zn();this.createAnnotation(t.pageIndex,{...i.defaults,rect:t.rect,segmentRects:t.segmentRects,pageIndex:t.pageIndex,created:new Date,id:a,custom:{text:n.join("\n")}},void 0,e),(null==(o=i.behavior)?void 0:o.deactivateToolAfterCreate)&&this.setActiveTool(null,e),(null==(r=i.behavior)?void 0:r.selectAfterCreate)&&this.selectAnnotation(t.pageIndex,a,e)},En);null==(o=this.selection)||o.clear()}})}registerInteractionForTool(e){var t;null==(t=this.interactionManager)||t.registerMode({id:e.interaction.mode??e.id,scope:"page",exclusive:e.interaction.exclusive,cursor:e.interaction.cursor})}buildCapability(){return{getActiveTool:()=>this.getActiveTool(),setActiveTool:e=>this.setActiveTool(e),getState:()=>this.getDocumentState(),getPageAnnotations:e=>this.getPageAnnotations(e),getSelectedAnnotation:()=>this.getSelectedAnnotation(),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),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),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),forDocument:e=>this.createAnnotationScope(e),getTools:()=>this.state.tools,getTool:e=>this.getTool(e),addTool:e=>{this.dispatch((e=>({type:$c,payload:e}))(e)),this.registerInteractionForTool(e)},findToolForAnnotation:e=>this.findToolForAnnotation(e),setToolDefaults:(e,t)=>this.dispatch(((e,t)=>({type:Lc,payload:{toolId:e,patch:t}}))(e,t)),getColorPresets:()=>[...this.state.colorPresets],addColorPreset:e=>this.dispatch((e=>({type:Oc,payload:e}))(e)),transformAnnotation:(e,t)=>this.transformAnnotation(e,t),registerPatchFunction:(e,t)=>this.registerPatchFunction(e,t),onStateChange:this.state$.on,onActiveToolChange:this.activeTool$.on,onAnnotationEvent:this.events$.on,onToolsChange:this.toolsChange$.on}}createAnnotationScope(e){return{getState:()=>this.getDocumentState(e),getPageAnnotations:t=>this.getPageAnnotations(t,e),getSelectedAnnotation:()=>this.getSelectedAnnotation(e),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),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),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),onStateChange:t=>this.state$.on(n=>{n.documentId===e&&t(n.state)}),onAnnotationEvent:t=>this.events$.on(n=>{n.documentId===e&&t(n)}),onActiveToolChange:t=>this.activeTool$.on(n=>{n.documentId===e&&t(n.tool)})}}onStoreUpdated(e,t){for(const n in t.documents){const o=e.documents[n],i=t.documents[n];o!==i&&(this.state$.emit({documentId:n,state:i}),o&&o.activeToolId!==i.activeToolId&&this.activeTool$.emit({documentId:n,tool:this.getActiveTool(n)}),(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({documentId:e,tool:this.getActiveTool(e)});this.toolsChange$.emit({tools:t.tools})}}registerPatchFunction(e,t){this.patchRegistry.register(e,t)}transformAnnotation(e,t){const n={type:t.type,changes:t.changes,metadata:t.metadata};return this.patchRegistry.transform(e,n)}registerPageHandlers(e,t,n,o){var i;const r=this.getCoreDocument(e),a=null==(i=null==r?void 0:r.document)?void 0:i.pages[t];if(!a)return()=>{};if(!this.interactionManager)return()=>{};const s=[],l=((a.rotation??0)+((null==r?void 0:r.rotation)??0))%4;for(const i of this.state.tools){if(!i.defaults.type)continue;const r=this.handlerFactories.get(i.defaults.type);if(!r)continue;const c={pageIndex:t,pageSize:a.size,pageRotation:l,scale:n,services:o.services,onPreview:e=>o.onPreview(i.id,e),onCommit:(n,o)=>{var r,a;this.createAnnotation(t,n,o,e),(null==(r=i.behavior)?void 0:r.deactivateToolAfterCreate)&&this.setActiveTool(null,e),(null==(a=i.behavior)?void 0:a.selectAfterCreate)&&this.selectAnnotation(t,n.id,e)},getTool:()=>this.state.tools.find(e=>e.id===i.id)},d=this.interactionManager.registerHandlers({documentId:e,modeId:i.interaction.mode??i.id,handlers:r.create(c),pageIndex:t});s.push(d)}return()=>s.forEach(e=>e())}getDocumentState(e){const t=e??this.getActiveDocumentId(),n=this.state.documents[t];if(!n)throw new Error(`Annotation state not found for document: ${t}`);return n}getAllAnnotations(e,t){this.engine.getAllAnnotations(t).wait(t=>{this.dispatch(((e,t)=>({type:kc,payload:{documentId:e,annotations:t}}))(e,t)),this.isInitialLoadComplete.set(e,!0);const n=this.importQueue.get(e);n&&n.length>0&&this.processImportQueue(e),this.events$.emit({type:"loaded",documentId:e,total:Object.values(t).reduce((e,t)=>e+t.length,0)})},En)}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 Jt.reject({code:Qt.NotFound,message:"Document not found"});const a=r.pages.find(e=>e.index===n);return a?this.engine.getPageAnnotations(r,a):Jt.reject({code:Qt.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){const n=this.getDocumentState(t);return hd(n,e)}renderAnnotation({pageIndex:e,annotation:t,options:n},o){const i=o??this.getActiveDocumentId(),r=this.getCoreDocument(i),a=null==r?void 0:r.document;if(!a)return Jt.reject({code:Qt.NotFound,message:"Document not found"});const s=a.pages.find(t=>t.index===e);return s?this.engine.renderPageAnnotation(a,s,t,n):Jt.reject({code:Qt.NotFound,message:"Page not found"})}importAnnotations(e,t){const n=t??this.getActiveDocumentId();if(!this.isInitialLoadComplete.get(n)){const t=this.importQueue.get(n)||[];return t.push(...e),void this.importQueue.set(n,t)}this.processImportItems(n,e)}processImportQueue(e){const t=this.importQueue.get(e);if(!t||0===t.length)return;const n=[...t];this.importQueue.set(e,[]),this.processImportItems(e,n)}processImportItems(e,t){const n=this.pendingContexts.get(e);if(n){for(const o of t){const{annotation:t,ctx:i}=o,r=t.pageIndex,a=t.id;this.dispatch(Wc(e,r,t)),i&&n.set(a,i)}!1!==this.config.autoCommit&&this.commit(e)}}createAnnotation(e,t,n,o){const i=o??this.getActiveDocumentId();if(!this.checkPermission(i,Zt.ModifyAnnotations))return void this.logger.debug("AnnotationPlugin","CreateAnnotation",`Cannot create annotation: document ${i} lacks ModifyAnnotations permission`);const r=t.id,a=this.pendingContexts.get(i);if(!a)return;const s={...t,author:t.author??this.config.annotationAuthor},l=()=>{this.dispatch(Wc(i,e,s)),n&&a.set(r,n),this.events$.emit({type:"create",documentId:i,annotation:s,pageIndex:e,ctx:n,committed:!1})};if(!this.history)return l(),void(this.config.autoCommit&&this.commit(i));const c={execute:l,undo:()=>{a.delete(r),this.dispatch(jc(i)),this.dispatch(Gc(i,e,r)),this.events$.emit({type:"delete",documentId:i,annotation:s,pageIndex:e,committed:!1})},metadata:{annotationIds:[r]}};this.history.forDocument(i).register(c,this.ANNOTATION_HISTORY_TOPIC)}buildPatch(e,t){return"rect"in t?t:this.transformAnnotation(e,{type:"property-update",changes:t})}updateAnnotation(e,t,n,o){const i=o??this.getActiveDocumentId();if(!this.checkPermission(i,Zt.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(qc(i,e,t,a)),this.events$.emit({type:"update",documentId:i,annotation:r,pageIndex:e,patch:a,committed:!1})};if(!this.history)return s(),void(!1!==this.config.autoCommit&&this.commit(i));const l=Object.fromEntries(Object.keys(n).map(e=>[e,r[e]])),c={execute:s,undo:()=>{this.dispatch(qc(i,e,t,l)),this.events$.emit({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,Zt.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(Gc(i,e.pageIndex,e.id)),this.events$.emit({type:"delete",documentId:i,annotation:t,pageIndex:e.pageIndex,committed:!1}))}this.dispatch(jc(i)),this.dispatch(Gc(i,e,t)),this.events$.emit({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(Wc(i,e,a)),this.events$.emit({type:"create",documentId:i,annotation:a,pageIndex:e,committed:!1});for(const e of l)this.dispatch(Wc(i,e.pageIndex,e)),this.events$.emit({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(Vc(o,e,t))}selectAnnotation(e,t,n){const o=n??this.getActiveDocumentId();if(this.isInGroupMethod(t,o)){const e=this.getGroupMembersMethod(t,o).map(e=>e.object.id);this.dispatch(Hc(o,e))}else this.dispatch(((e,t,n)=>({type:Sc,payload:{documentId:e,pageIndex:t,id:n}}))(o,e,t))}deselectAnnotation(e){const t=e??this.getActiveDocumentId();this.dispatch(jc(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 dd(this.getDocumentState(e))}getSelectedAnnotationIdsMethod(e){return ud(this.getDocumentState(e))}toggleSelectionMethod(e,t,n){const o=n??this.getActiveDocumentId(),i=this.getDocumentState(o);if(i.selectedUids.includes(t))this.dispatch(Uc(o,t));else if(this.isInGroupMethod(t,o)){const e=this.getGroupMembersMethod(t,o);for(const t of e)i.selectedUids.includes(t.object.id)||this.dispatch(Fc(o,t.object.pageIndex,t.object.id))}else this.dispatch(Fc(o,e,t))}addToSelectionMethod(e,t,n){const o=n??this.getActiveDocumentId();this.dispatch(Fc(o,e,t))}removeFromSelectionMethod(e,t){const n=t??this.getActiveDocumentId();this.dispatch(Uc(n,e))}setSelectionMethod(e,t){const n=t??this.getActiveDocumentId();this.dispatch(Hc(n,e))}getAttachedLinksMethod(e,t){return gd(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,Zt.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:$t.Group}}));this.updateAnnotationsMethod(i,t)}ungroupAnnotationsMethod(e,t){const n=t??this.getActiveDocumentId();if(!this.checkPermission(n,Zt.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===$t.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 pd(this.getDocumentState(t),e)}isInGroupMethod(e,t){return fd(this.getDocumentState(t),e)}getGroupingActionMethod(e){return(e=>{const t=dd(e);if(0===t.length)return"disabled";const n=t[0].object.id;if(fd(e,n)){const o=pd(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.updateAnnotationsMethod(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=ru(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=ru(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=zd({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,Zt.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(qc(n,e,t,o)),this.events$.emit({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(qc(n,e,t,o)),this.events$.emit({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)}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,Zt.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(Bc(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}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"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 Ct,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}of n.updates){const n=t.pages.find(e=>e.index===o.object.pageIndex);if(!n)continue;const i=this.engine.updatePageAnnotation(t,n,o.object);r.push({type:"update",task:i,ta:o,uid:e})}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 Ct;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(Vc(e,i.object.pageIndex,o))}const a=r.map(e=>e.task);return Ct.allSettled(a).wait(()=>{var t,a;this.emitCommitEvents(e,r,i),this.dispatch((t=e,a=n.committedUids,{type:_c,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({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({type:"update",documentId:e,annotation:o.ta.object,pageIndex:o.ta.object.pageIndex,patch:o.ta.object,committed:!0});break;case"delete":this.dispatch(Vc(e,o.ta.object.pageIndex,o.uid)),this.events$.emit({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 Jt.resolve(!0);if(!this.acquireCommitLock(t))return Jt.resolve(!0);const n=this.getCoreDocument(t),o=null==n?void 0:n.document;if(!o)return this.releaseCommitLock(t),Jt.reject({code:Qt.NotFound,message:"Document not found"});const i=this.collectPendingChanges(t,o);if(i.isEmpty)return this.releaseCommitLock(t),Jt.resolve(!0);const r=new Ct;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}};au.id="annotation";let su=au;function lu(e,t,n){return void 0===e?n:"function"==typeof e?e(t):e}function cu(e){return t=>(null==t?void 0:t.id)===e}const du=cu("highlight"),uu=cu("squiggly"),hu=cu("underline"),mu=cu("strikeout"),gu={manifest:xc,create:(e,t)=>new su(wc,e,t),reducer:(e,t)=>{switch(t.type){case Cc:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Ic:{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 kc:{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 Sc:{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 Mc:{const{documentId:n}=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selectedUids:[],selectedUid:null}}}:e}case Ac:{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:bd(r)}}}}case Pc:{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:bd(r)}}}}case Dc:{const{documentId:n,ids:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,selectedUids:o,selectedUid:bd(o)}}}:e}case Rc:{const{documentId:n,toolId:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeToolId:o}}}:e}case zc:{const{documentId:n,pageIndex:o,annotation:i}=t.payload,r=e.documents[n];if(!r)return e;const a=i.id;return{...e,documents:{...e.documents,[n]:{...r,pages:{...r.pages,[o]:[...r.pages[o]??[],a]},byUid:{...r.byUid,[a]:{commitState:"new",object:i}},hasPendingChanges:!0}}}}case Ec:{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 Tc:{const{documentId:n,id:o,patch:i}=t.payload,r=e.documents[n];return r?{...e,documents:{...e.documents,[n]:wd(r,o,i)}}:e}case _c:{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?"synced":t.commitState}:(a[e]=t,"new"!==t.commitState&&"dirty"!==t.commitState&&"deleted"!==t.commitState||(s=!0));return{...e,documents:{...e.documents,[n]:{...i,byUid:a,hasPendingChanges:s}}}}case Nc:{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 $c:{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 Lc:{const{toolId:n,patch:o}=t.payload;return{...e,tools:e.tools.map(e=>e.id===n?{...e,defaults:{...e.defaults,...o}}:e)}}case Oc:return e.colorPresets.includes(t.payload)?e:{...e,colorPresets:[...e.colorPresets,t.payload]};default:return e}},initialState:(e,t)=>(e=>{const t=new Map;vd.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;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}}});return{documents:{},activeDocumentId:null,tools:o,colorPresets:e.colorPresets??yd}})(t)};function pu(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 fu(e,t){this.props=e,this.context=t}(fu.prototype=new B).isPureReactComponent=!0,fu.prototype.shouldComponentUpdate=function(e,t){return pu(this.props,e)||pu(this.state,t)};var vu=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),vu&&vu(e)};var yu=I.__e;I.__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);yu(e,t,n,o)};var bu=I.unmount;function wu(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 wu(e,t,n)})),e}function xu(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return xu(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 Cu(){this.__u=0,this.o=null,this.__b=null}function Iu(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function ku(){this.i=null,this.l=null}I.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),bu&&bu(e)},(Cu.prototype=new B).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var i=Iu(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]=xu(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)},Cu.prototype.componentWillUnmount=function(){this.o=[]},Cu.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]=wu(this.__b,n,o.__O=o.__P)}this.__b=null}var i=t.__a&&F(H,null,e.fallback);return i&&(i.__u&=-33),[F(H,null,t.__a?null:e.children),i]};var Su=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]>>1,1),t.h.removeChild(e)}}}ce(F(Mu,{context:t.context},e.__v),t.v)}function Pu(e,t){var n=F(Au,{__v:e,h:t});return n.containerInfo=t,n}(ku.prototype=new B).__a=function(e){var t=this,n=Iu(t.__v),o=t.l.get(e);return o[0]++,function(i){var r=function(){t.props.revealOrder?(o.push(i),Su(t,e,o)):i()};n?n(r):r()}},ku.prototype.render=function(e){this.i=null,this.l=new Map;var t=Y(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},ku.prototype.componentDidUpdate=ku.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Su(e,n,t)})};var Du="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Ru=/^(?: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]/,zu=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Tu=/[A-Z0-9]/g,Eu="undefined"!=typeof document,_u=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};B.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(B.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Nu=I.event;function Ou(){}function Lu(){return this.cancelBubble}function $u(){return this.defaultPrevented}I.event=function(e){return Nu&&(e=Nu(e)),e.persist=Ou,e.isPropagationStopped=Lu,e.isDefaultPrevented=$u,e.nativeEvent=e};var ju={enumerable:!1,configurable:!0,get:function(){return this.class}},Fu=I.vnode;I.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||Eu&&"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||_u(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":zu.test(r)&&(r=s):s=r="oninput":i&&Ru.test(r)?r=r.replace(Tu,"-$&").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=Y(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=Y(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",ju)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Du,Fu&&Fu(e)};var Uu=I.__r;I.__r=function(e){Uu&&Uu(e),e.__c};var Hu=I.diffed;I.diffed=function(e){Hu&&Hu(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 Bu="INTERACTION/INIT_STATE",Wu="INTERACTION/CLEANUP_STATE",qu="INTERACTION/ACTIVATE_MODE",Gu="INTERACTION/PAUSE",Vu="INTERACTION/RESUME",Ku="INTERACTION/SET_CURSOR",Zu="INTERACTION/SET_DEFAULT_MODE",Yu="INTERACTION/SET_EXCLUSION_RULES",Xu="INTERACTION/ADD_EXCLUSION_CLASS",Qu="INTERACTION/REMOVE_EXCLUSION_CLASS",Ju="INTERACTION/ADD_EXCLUSION_ATTRIBUTE",eh="INTERACTION/REMOVE_EXCLUSION_ATTRIBUTE";function th(e){return{type:Zu,payload:{mode:e}}}function nh(e){return{type:Yu,payload:{rules:e}}}const oh="pointerMode",ih=class extends fo{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$=So(),this.onHandlerChange$=So(),this.onCursorChange$=So(),this.onStateChange$=Mo(),this.onPageActivityChange$=So(),this.registerMode({id:oh,scope:"page",exclusive:!1,cursor:"auto"}),this.dispatch(th(oh)),n.exclusionRules&&this.dispatch(nh(n.exclusionRules))}onDocumentLoadingStarted(e){const t={activeMode:this.state.defaultMode,cursor:"auto",paused:!1};this.dispatch(function(e,t){return{type:Bu,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:Wu,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(nh(e)),addExclusionClass:e=>this.dispatch(function(e){return{type:Xu,payload:{className:e}}}(e)),removeExclusionClass:e=>this.dispatch(function(e){return{type:Qu,payload:{className:e}}}(e)),addExclusionAttribute:e=>this.dispatch(function(e){return{type:Ju,payload:{attribute:e}}}(e)),removeExclusionAttribute:e=>this.dispatch(function(e){return{type:eh,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:qu,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(th(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:Gu,payload:e}}(t))}resume(e){const t=e??this.getActiveDocumentId();this.dispatch(function(e){return{type:Vu,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:Ku,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()}};ih.id="interaction-manager";let rh=ih;const ah="interaction-manager",sh={defaultMode:"pointerMode",exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]},documents:{},activeDocumentId:null},lh={manifest:{id:ah,name:"Interaction Manager Plugin",version:"1.0.0",provides:["interaction-manager"],requires:[],optional:[],defaultConfig:{exclusionRules:{classes:[],dataAttributes:["data-no-interaction"]}}},create:(e,t)=>new rh(ah,e,t),reducer:(e=sh,t)=>{switch(t.type){case Bu:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Wu:{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 qu:{const{documentId:n,mode:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,activeMode:o}}}:e}case Ku:{const{documentId:n,cursor:o}=t.payload,i=e.documents[n];return i?{...e,documents:{...e.documents,[n]:{...i,cursor:o}}}:e}case Gu:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!0}}}:e}case Vu:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,paused:!1}}}:e}case Zu:return{...e,defaultMode:t.payload.mode};case Yu:return{...e,exclusionRules:t.payload.rules};case Xu:return{...e,exclusionRules:{...e.exclusionRules,classes:[...e.exclusionRules.classes||[],t.payload.className].filter((e,t,n)=>n.indexOf(e)===t)}};case Qu:return{...e,exclusionRules:{...e.exclusionRules,classes:(e.exclusionRules.classes||[]).filter(e=>e!==t.payload.className)}};case Ju:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:[...e.exclusionRules.dataAttributes||[],t.payload.attribute].filter((e,t,n)=>n.indexOf(e)===t)}};case eh:return{...e,exclusionRules:{...e.exclusionRules,dataAttributes:(e.exclusionRules.dataAttributes||[]).filter(e=>e!==t.payload.attribute)}};default:return e}},initialState:sh},ch=()=>_o(rh.id);const dh={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"},uh=["pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","mousedown","mouseup","mousemove","mouseenter","mouseleave","mousecancel","click","dblclick"],hh="undefined"!=typeof PointerEvent?uh:[...uh,"touchstart","touchend","touchmove","touchcancel"];function mh(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}function gh(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=>{hh.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=()=>{hh.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=dh[t.type];if(!s||!(null==r?void 0:r[s]))return;let c,d;mh(t)&&l&&("touchmove"===t.type||"touchcancel"===t.type)&&t.preventDefault();let u=!1;if(mh(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 ph=({children:e,documentId:t,style:n,...o})=>{const i=De(null),{provides:r}=ch();return Ae(()=>{if(r&&i.current)return gh(r,{type:"global",documentId:t},i.current)},[r,t]),He("div",{ref:i,style:{width:"100%",height:"100%",...n},...o,children:e})},fh=({documentId:e,pageIndex:t,children:n,rotation:o,scale:i,convertEventToPoint:r,style:a,...s})=>{var l,c;const d=De(null),{provides:u}=ch(),h=function(e){const{provides:t}=ch(),[n,o]=Se(()=>{if(!t)return!1;const n=t.forDocument(e).getActiveInteractionMode();return"page"===(null==n?void 0:n.scope)&&!!n.exclusive});return Ae(()=>{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=Oo(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=ze((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(Xe(e,t,(4-n)%4),1/o)}(Ke({width:w.width,height:w.height},y,1),o,y,b)},[p,y,b]);return Ae(()=>{if(u&&d.current)return gh(u,{type:"page",documentId:e,pageIndex:t},d.current,r||x)},[u,e,t,r,x]),He("div",{ref:d,style:{position:"relative",width:w.width,height:w.height,...a},...s,children:[n,h&&He("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:10}})]})},vh={},yh=de(null),bh=de([]);const wh=()=>Eo(su.id),xh=()=>_o(su.id),Ch=e=>{var t;const{provides:n}=xh(),[o,i]=Se((null==(t=null==n?void 0:n.forDocument(e))?void 0:t.getState())??{pages:{},byUid:{},selectedUids:[],selectedUid:null,activeToolId:null,hasPendingChanges:!1});return Ae(()=>{if(!n)return;const t=n.forDocument(e);return i(t.getState()),t.onStateChange(e=>{i(e)})},[n,e]),{state:o,provides:(null==n?void 0:n.forDocument(e))??null}};function Ih({scale:e,documentId:t,pageIndex:n,rotation:o,pageWidth:i,pageHeight:r,trackedAnnotation:a,children:s,isSelected:l,isMultiSelected:c=!1,isDraggable:d,isResizable:u,isRotatable:h=!0,lockAspectRatio:m=!1,style:g={},vertexConfig:p,selectionMenu:f,outlineOffset:v=1,onDoubleClick:y,onSelect:b,zIndex:w=1,resizeUI:x,vertexUI:C,rotationUI:I,selectionOutlineColor:k,selectionOutline:S,customAnnotationRenderer:M,groupSelectionMenu:A,groupSelectionOutline:P,annotationRenderers:D,...R}){var z,T,E;const[_,N]=Se(a.object),[O,L]=Se(null),[$,j]=Se(null),[F,U]=Se(!1),{provides:B}=xh(),{plugin:W}=wh(),{canModifyAnnotations:q}=Uo(t),G=De(null),V=q&&d&&!c,K=q&&u&&!c,Z=q&&h&&!c,Y=Re(()=>B?B.forDocument(t):null,[B,t]),X=_?{...a.object,..._}:a.object,Q=(null==x?void 0:x.color)??"#007ACC",J=(null==C?void 0:C.color)??"#007ACC",ee=(null==I?void 0:I.color)??"white",te=(null==I?void 0:I.connectorColor)??"#007ACC",ne=(null==x?void 0:x.size)??12,oe=(null==C?void 0:C.size)??12,ie=(null==I?void 0:I.size)??32,re=null==I?void 0:I.margin,ae=(null==I?void 0:I.iconColor)??"#007ACC",se=(null==I?void 0:I.showConnector)??!1,le=(null==(z=null==I?void 0:I.border)?void 0:z.color)??"#007ACC",ce=(null==(T=null==I?void 0:I.border)?void 0:T.width)??1,de=(null==(E=null==I?void 0:I.border)?void 0:E.style)??"solid",ue=(null==S?void 0:S.color)??k??"#007ACC",he=(null==S?void 0:S.style)??"solid",me=(null==S?void 0:S.width)??1,ge=(null==S?void 0:S.offset)??v??1,pe=O??X.rotation??0,fe=O??X.rotation??0,ve=Number.isFinite(fe)?Math.round(10*fe)/10:0,ye=null!==O,be=De(null),we=ze(e=>{var o;if(!(null==(o=e.transformData)?void 0:o.type)||c||!W)return;const{type:s,changes:l,metadata:d}=e.transformData,u=a.object.id,h={width:i,height:r};if("start"===e.state&&(be.current=a.object.unrotatedRect??a.object.rect,G.current=a.object,"move"===s?W.startDrag(t,{annotationIds:[u],pageSize:h}):"resize"===s&&W.startResize(t,{annotationIds:[u],pageSize:h,resizeHandle:(null==d?void 0:d.handle)??"se"})),l.rect&&be.current)if("move"===s){const e={x:l.rect.origin.x-be.current.origin.x,y:l.rect.origin.y-be.current.origin.y};W.updateDrag(t,e)}else"resize"===s&&W.updateResize(t,l.rect);if("vertex-edit"===s&&l.vertices&&p){const t=G.current??a.object,o=p.transformAnnotation(t,l.vertices),i=null==B?void 0:B.transformAnnotation(t,{type:s,changes:o,metadata:d});i&&(N(e=>({...e,...i})),"end"===e.state&&(null==Y||Y.updateAnnotation(n,u,i)))}if("rotate"===s){const n=(null==d?void 0:d.rotationAngle)??pe,o=null==d?void 0:d.cursorPosition;return o&&j({x:o.clientX,y:o.clientY}),void("start"===e.state?(L(n),W.startRotation(t,{annotationIds:[u],cursorAngle:n,rotationCenter:null==d?void 0:d.rotationCenter})):"move"===e.state?(L(n),W.updateRotation(t,n,null==d?void 0:d.rotationDelta)):"end"===e.state&&(L(null),j(null),W.commitRotation(t)))}"end"===e.state&&(be.current=null,G.current=null,"move"===s?W.commitDrag(t):"resize"===s&&W.commitResize(t))},[W,t,a.object,i,r,n,c,p,B,Y,pe]),xe=X.unrotatedRect,Ce=xe??X.rect,Ie=xe&&0!==pe?ht(Ce,X.rect,pe):void 0,ke=Ce,{dragProps:Me,vertices:Pe,resize:Te,rotation:Ee}=Ol({controller:{element:ke,vertices:null==p?void 0:p.extractVertices(X),constraints:{minWidth:10,minHeight:10,boundingBox:{width:i,height:r}},maintainAspectRatio:m,pageRotation:o,annotationRotation:pe,rotationCenter:Ie,rotationElement:X.rect,scale:e,enabled:l&&!c,onUpdate:we},resizeUI:{handleSize:ne,spacing:ge,offsetMode:"outside",includeSides:!m,zIndex:w+1},vertexUI:{vertexSize:oe,zIndex:w+2},rotationUI:{handleSize:ie,margin:re,zIndex:w+3,showConnector:se},includeVertices:!!p,includeRotation:Z,currentRotation:pe}),_e=function(e,{delay:t=300,tolerancePx:n=18}={}){const o=De({t:0,x:0,y:0}),i=ze(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=ze(t=>{null==e||e(t)},[e]);return e?{[Ml]:r,onPointerUpCapture:i}:{}}(Re(()=>{if(q&&y)return y},[q,y]));Ae(()=>{N(a.object)},[a.object]),Ae(()=>{if(!W)return;const e=a.object.id,n=n=>{var o;if(n.documentId!==t)return;"end"!==n.type&&"cancel"!==n.type||L(null);const i=null==(o=n.previewPatches)?void 0:o[e];"update"===n.type&&i?N(e=>({...e,...i})):"cancel"===n.type&&N(a.object)},o=[W.onDragChange(n),W.onResizeChange(n),W.onRotateChange(n)];return()=>o.forEach(e=>e())},[W,t,a.object]);const Ne=l&&!c,Oe=X.rect.size.width*e,Le=X.rect.size.height*e,$e=Ce.size.width*e,je=Ce.size.height*e,Fe=Boolean(xe)&&0!==pe,Ue=Fe?(Ce.origin.x-X.rect.origin.x)*e:(Oe-$e)/2,Be=Fe?(Ce.origin.y-X.rect.origin.y)*e:(Le-je)/2,We=Fe&&Ie?`${(Ie.x-Ce.origin.x)*e}px ${(Ie.y-Ce.origin.y)*e}px`:"center center",qe=Ie?(Ie.x-X.rect.origin.x)*e:Oe/2,Ge=Ie?(Ie.y-X.rect.origin.y)*e:Le/2,Ve=Math.max(300,Math.max(Oe,Le)+80),Ke=Re(()=>xe?{...X,rect:xe}:X,[X,xe]);return He("div",{"data-no-interaction":!0,children:[He("div",{style:{position:"absolute",left:X.rect.origin.x*e,top:X.rect.origin.y*e,width:Oe,height:Le,pointerEvents:"none",zIndex:w,...g},...R,children:[ye&&He(H,{children:[He("div",{style:{position:"absolute",left:qe-Ve/2,top:Ge,width:Ve,height:1,backgroundColor:te,opacity:.35,pointerEvents:"none"}}),He("div",{style:{position:"absolute",left:qe,top:Ge-Ve/2,width:1,height:Ve,backgroundColor:te,opacity:.35,pointerEvents:"none"}}),He("div",{style:{position:"absolute",left:qe-Ve/2,top:Ge,width:Ve,height:1,transformOrigin:"center center",transform:`rotate(${pe}deg)`,backgroundColor:te,opacity:.8,pointerEvents:"none"}})]}),l&&Z&&Ee&&((null==I?void 0:I.component)?He("div",{onPointerEnter:()=>U(!0),onPointerLeave:()=>{U(!1),j(null)},onPointerMove:e=>{ye||j({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:I.component({...Ee.handle,backgroundColor:ee,iconColor:ae,connectorStyle:{...Ee.connector.style,backgroundColor:te,opacity:ye?0:1},showConnector:se,opacity:ye?0:1,border:{color:le,width:ce,style:de}})}):He("div",{onPointerEnter:()=>U(!0),onPointerLeave:()=>{U(!1),j(null)},onPointerMove:e=>{ye||j({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:[se&&He("div",{style:{...Ee.connector.style,backgroundColor:te,opacity:ye?0:1}}),He("div",{...Ee.handle,style:{...Ee.handle.style,backgroundColor:ee,border:`${ce}px ${de} ${le}`,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",opacity:ye?0:1},children:He("svg",{width:Math.round(.6*ie),height:Math.round(.6*ie),viewBox:"0 0 24 24",fill:"none",stroke:ae,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[He("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),He("path",{d:"M21 3v5h-5"})]})})]})),He("div",{...V&&l?Me:{},..._e,style:{position:"absolute",left:Ue,top:Be,width:$e,height:je,transform:0!==pe?`rotate(${pe}deg)`:void 0,transformOrigin:We,outline:Ne?`${me}px ${he} ${ue}`:"none",outlineOffset:Ne?`${ge}px`:"0px",pointerEvents:l&&!c?"auto":"none",touchAction:"none",cursor:l&&V?"move":"default"},children:[(()=>{const t="function"==typeof s?s(Ke):s,a=null==M?void 0:M({annotation:Ke,children:t,isSelected:l,scale:e,rotation:o,pageWidth:i,pageHeight:r,pageIndex:n,onSelect:b});return null!=a?a:t})(),l&&K&&!ye&&Te.map(({key:e,...t})=>(null==x?void 0:x.component)?x.component({key:e,...t,backgroundColor:Q}):He("div",{...t,style:{...t.style,backgroundColor:Q}},e)),l&&q&&!c&&!ye&&Pe.map(({key:e,...t})=>(null==C?void 0:C.component)?C.component({key:e,...t,backgroundColor:J}):He("div",{...t,style:{...t.style,backgroundColor:J}},e))]})]}),f&&!c&&!ye&&He(Al,{rect:{origin:{x:X.rect.origin.x*e,y:X.rect.origin.y*e},size:{width:X.rect.size.width*e,height:X.rect.size.height*e}},rotation:o,children:e=>{const t=((pe+90*o)%360+360)%360;return f({...e,context:{type:"annotation",annotation:a,pageIndex:n},selected:l,placement:{suggestTop:Z&&t>90&&t<270}})}}),(ye||F)&&$&&Pu(He("div",{style:{position:"fixed",left:$.x+16,top:$.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:[ve.toFixed(0),"°"]}),document.body)]})}function kh({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}=wh(),{canModifyAnnotations:C}=Uo(e),I=De(null),k=De(!1),S=De(!1),[M,A]=Se(null),[P,D]=Se(null),[R,z]=Se(!1),T=C&&s,E=C&&l,_=C&&c,N=Re(()=>function(e){return rt(e)??it}(a.map(e=>e.object.rect)),[a]),[O,L]=Se(N);Ae(()=>{k.current||S.current||L(N)},[N]),Ae(()=>{if(!x)return;return x.onRotateChange(t=>{t.documentId===e&&("end"!==t.type&&"cancel"!==t.type||A(null))})},[x,e]);const $=ze(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&&!T)return;if("start"===t.state&&(I.current=N,m?(k.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&&D({x:i.clientX,y:i.clientY}),void("start"===t.state?(A(o),x.startRotation(e,{annotationIds:n,cursorAngle:o,rotationCenter:null==(d=t.transformData.metadata)?void 0:d.rotationCenter})):"move"===t.state?(A(o),x.updateRotation(e,o,null==(u=t.transformData.metadata)?void 0:u.rotationDelta)):"end"===t.state&&(A(null),D(null),x.commitRotation(e)))}const p=I.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);L({...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),L(n)}"end"===t.state&&(I.current=null,m&&k.current?(k.current=!1,x.commitDrag(e)):g&&S.current&&(S.current=!1,x.commitResize(e)))},[x,e,i,r,N,T,a,c]),j=M??0,F=null!==M,U=Number.isFinite(j)?Math.round(10*j)/10:0,B=(null==u?void 0:u.color)??"#007ACC",W=(null==u?void 0:u.size)??12,q=(null==h?void 0:h.color)??"white",G=(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",Y=(null==h?void 0:h.showConnector)??!1,X=(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}=Ol({controller:{element:O,constraints:{minWidth:20,minHeight:20,boundingBox:{width:i,height:r}},maintainAspectRatio:d,pageRotation:o,scale:n,enabled:!0,onUpdate:$},resizeUI:{handleSize:W,spacing:oe,offsetMode:"outside",includeSides:!d,zIndex:f+1},vertexUI:{vertexSize:0,zIndex:f},rotationUI:{handleSize:V,margin:K,zIndex:f+2,showConnector:Y},includeVertices:!1,includeRotation:_,currentRotation:M??0});if(a.length<2)return null;const se=O.size.width*n,le=O.size.height*n,ce=se/2,de=le/2,ue=Math.max(300,Math.max(se,le)+80);return He("div",{"data-group-selection-box":!0,"data-no-interaction":!0,children:[He("div",{style:{position:"absolute",left:O.origin.x*n,top:O.origin.y*n,width:se,height:le,pointerEvents:"none",zIndex:f},children:[F&&He(H,{children:[He("div",{style:{position:"absolute",left:ce-ue/2,top:de,width:ue,height:1,backgroundColor:B,opacity:.35,pointerEvents:"none"}}),He("div",{style:{position:"absolute",left:ce,top:de-ue/2,width:1,height:ue,backgroundColor:B,opacity:.35,pointerEvents:"none"}}),He("div",{style:{position:"absolute",left:ce-ue/2,top:de,width:ue,height:1,transformOrigin:"center center",transform:`rotate(${j}deg)`,backgroundColor:B,opacity:.8,pointerEvents:"none"}})]}),_&&ae&&((null==h?void 0:h.component)?He("div",{onPointerEnter:()=>z(!0),onPointerLeave:()=>{z(!1),D(null)},onPointerMove:e=>{F||D({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:h.component({...ae.handle,backgroundColor:q,iconColor:Z,connectorStyle:{...ae.connector.style,backgroundColor:G,opacity:F?0:1},showConnector:Y,opacity:F?0:1,border:{color:X,width:Q,style:J}})}):He("div",{onPointerEnter:()=>z(!0),onPointerLeave:()=>{z(!1),D(null)},onPointerMove:e=>{F||D({x:e.clientX,y:e.clientY})},style:{display:"contents"},children:[Y&&He("div",{style:{...ae.connector.style,backgroundColor:G,opacity:F?0:1}}),He("div",{...ae.handle,style:{...ae.handle.style,backgroundColor:q,border:`${Q}px ${J} ${X}`,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",opacity:F?0:1},children:He("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:[He("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),He("path",{d:"M21 3v5h-5"})]})})]})),He("div",{...T?ie:{onPointerDown:e=>e.stopPropagation()},style:{position:"absolute",left:0,top:0,width:se,height:le,outline:F?"none":`${ne}px ${te} ${ee}`,outlineOffset:oe-1,cursor:T?"move":"default",touchAction:"none",pointerEvents:"auto"},children:E&&!F&&re.map(({key:e,...t})=>(null==u?void 0:u.component)?u.component({key:e,...t,backgroundColor:B}):He("div",{...t,style:{...t.style,backgroundColor:B}},e))})]}),(F||R)&&P&&Pu(He("div",{style:{position:"fixed",left:P.x+16,top:P.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&&He(Al,{rect:{origin:{x:O.origin.x*n,y:O.origin.y*n},size:{width:O.size.width*n,height:O.size.height*n}},rotation:o,children:e=>{const n=((j+90*o)%360+360)%360;return v({...e,context:{type:"group",annotations:a,pageIndex:t},selected:!0,placement:{suggestTop:_&&n>90&&n<270}})}})]})}function Sh({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=e??"#FFFF00";return He(H,{children:n.map((e,n)=>He("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?e.origin.x-o.origin.x:e.origin.x)*i,top:(o?e.origin.y-o.origin.y:e.origin.y)*i,width:e.size.width*i,height:e.size.height*i,background:s,opacity:t,pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:void 0,...a}},n))})}function Mh({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=e??"#FFFF00",l=2*i;return He(H,{children:n.map((e,n)=>He("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?e.origin.x-o.origin.x:e.origin.x)*i,top:(o?e.origin.y-o.origin.y:e.origin.y)*i,width:e.size.width*i,height:e.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:He("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:l,background:s,opacity:t,pointerEvents:"none"}})},n))})}function Ah({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=e??"#FFFF00",l=2*i;return He(H,{children:n.map((e,n)=>He("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?e.origin.x-o.origin.x:e.origin.x)*i,top:(o?e.origin.y-o.origin.y:e.origin.y)*i,width:e.size.width*i,height:e.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:He("div",{style:{position:"absolute",left:0,top:"50%",width:"100%",height:l,background:s,opacity:t,transform:"translateY(-50%)",pointerEvents:"none"}})},n))})}function Ph({strokeColor:e,opacity:t=.5,segmentRects:n,rect:o,scale:i,onClick:r,style:a}){const s=2*i,l=6*i,c=`url("data:image/svg+xml;utf8,${encodeURIComponent(``)}")`;return He(H,{children:n.map((e,n)=>He("div",{onPointerDown:r,onTouchStart:r,style:{position:"absolute",left:(o?e.origin.x-o.origin.x:e.origin.x)*i,top:(o?e.origin.y-o.origin.y:e.origin.y)*i,width:e.size.width*i,height:e.size.height*i,background:"transparent",pointerEvents:r?"auto":"none",cursor:r?"pointer":"default",zIndex:r?1:0,...a},children:He("div",{style:{position:"absolute",left:0,bottom:0,width:"100%",height:2*s,backgroundImage:c,backgroundRepeat:"repeat-x",backgroundSize:`${l}px ${2*s}px`,opacity:t,pointerEvents:"none"}})},n))})}function Dh({isSelected:e,strokeColor:t,opacity:n=1,strokeWidth:o,inkList:i,rect:r,scale:a,onClick:s}){const l=t??"#000000",c=Re(()=>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]),d=r.size.width*a,u=r.size.height*a;return He("svg",{style:{position:"absolute",width:d,height:u,pointerEvents:"none",zIndex:2,overflow:"visible"},width:d,height:u,viewBox:`0 0 ${r.size.width} ${r.size.height}`,children:c.map((t,i)=>He("path",{d:t,fill:"none",opacity:n,onPointerDown:s,onTouchStart:s,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"visibleStroke",stroke:l,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}},i))})}function Rh({isSelected:e,color:t="#000000",strokeColor:n,opacity:o=1,strokeWidth:i,strokeStyle:r=Ut.SOLID,strokeDashArray:a,rect:s,scale:l,onClick:c}){const{width:d,height:u,x:h,y:m}=Re(()=>{const e=s.size.width,t=s.size.height;return{width:Math.max(e-i,0),height:Math.max(t-i,0),x:i/2,y:i/2}},[s,i]),g=(d+i)*l,p=(u+i)*l;return He("svg",{style:{position:"absolute",width:g,height:p,pointerEvents:"none",zIndex:2},width:g,height:p,viewBox:`0 0 ${d+i} ${u+i}`,children:He("rect",{x:h,y:m,width:d,height:u,fill:t,opacity:o,onPointerDown:c,onTouchStart:c,style:{cursor:e?"move":"pointer",pointerEvents:e?"none":"transparent"===t?"visibleStroke":"visible",stroke:n??t,strokeWidth:i,...r===Ut.DASHED&&{strokeDasharray:null==a?void 0:a.join(",")}}})})}function zh({color:e="#000000",strokeColor:t,opacity:n=1,strokeWidth:o,strokeStyle:i=Ut.SOLID,strokeDashArray:r,rect:a,scale:s,onClick:l,isSelected:c}){const{width:d,height:u,cx:h,cy:m,rx:g,ry:p}=Re(()=>{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]),f=d*s,v=u*s;return He("svg",{style:{position:"absolute",width:f,height:v,pointerEvents:"none",zIndex:2},width:f,height:v,viewBox:`0 0 ${d} ${u}`,children:He("ellipse",{cx:h,cy:m,rx:g,ry:p,fill:e,opacity:n,onPointerDown:l,onTouchStart:l,style:{cursor:c?"move":"pointer",pointerEvents:c?"none":"transparent"===e?"visibleStroke":"visible",stroke:t??e,strokeWidth:o,...i===Ut.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}})})}function Th({color:e="transparent",opacity:t=1,strokeWidth:n,strokeColor:o="#000000",strokeStyle:i=Ut.SOLID,strokeDashArray:r,rect:a,linePoints:s,lineEndings:l,scale:c,onClick:d,isSelected:u}){const{x1:h,y1:m,x2:g,y2:p}=Re(()=>({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]),f=Re(()=>{const e=Math.atan2(p-m,g-h);return{start:Bd.createEnding(null==l?void 0:l.start,n,e+Math.PI,h,m),end:Bd.createEnding(null==l?void 0:l.end,n,e,g,p)}},[l,n,h,m,g,p]),v=a.size.width*c,y=a.size.height*c;return He("svg",{style:{position:"absolute",width:v,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:v,height:y,viewBox:`0 0 ${a.size.width} ${a.size.height}`,children:[He("line",{x1:h,y1:m,x2:g,y2:p,opacity:t,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",pointerEvents:u?"none":"visibleStroke",stroke:o,strokeWidth:n,strokeLinecap:"butt",...i===Ut.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}}}),f.start&&He("path",{d:f.start.d,transform:f.start.transform,onPointerDown:d,onTouchStart:d,stroke:o,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":f.start.filled?"visible":"visibleStroke",...i===Ut.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:f.start.filled?e:"none"}),f.end&&He("path",{d:f.end.d,transform:f.end.transform,stroke:o,onPointerDown:d,onTouchStart:d,style:{cursor:u?"move":"pointer",strokeWidth:n,strokeLinecap:"butt",pointerEvents:u?"none":f.end.filled?"visible":"visibleStroke",...i===Ut.DASHED&&{strokeDasharray:null==r?void 0:r.join(",")}},fill:f.end.filled?e:"none"})]})}function Eh({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,scale:a,isSelected:s,onClick:l,lineEndings:c}){const d=Re(()=>t.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[t,e]),u=Re(()=>{if(!d.length)return"";const[e,...t]=d;return`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y} `).join("").trim()},[d]),h=Re(()=>{if(d.length<2)return{start:null,end:null};const e=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),t=e(d[0],d[1]),n=e(d[d.length-2],d[d.length-1]);return{start:Bd.createEnding(null==c?void 0:c.start,r,t+Math.PI,d[0].x,d[0].y),end:Bd.createEnding(null==c?void 0:c.end,r,n,d[d.length-1].x,d[d.length-1].y)}},[d,c,r]),m=e.size.width*a,g=e.size.height*a;return He("svg",{style:{position:"absolute",width:m,height:g,pointerEvents:"none",zIndex:2,overflow:"visible"},width:m,height:g,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[He("path",{d:u,onPointerDown:l,onTouchStart:l,opacity:i,style:{fill:"none",stroke:o??n,strokeWidth:r,cursor:s?"move":"pointer",pointerEvents:s?"none":"visibleStroke",strokeLinecap:"butt",strokeLinejoin:"miter"}}),h.start&&He("path",{d:h.start.d,transform:h.start.transform,stroke:o,fill:h.start.filled?n:"none",onPointerDown:l,onTouchStart:l,style:{cursor:s?"move":"pointer",strokeWidth:r,pointerEvents:s?"none":h.start.filled?"visible":"visibleStroke",strokeLinecap:"butt"}}),h.end&&He("path",{d:h.end.d,transform:h.end.transform,stroke:o,fill:h.end.filled?n:"none",onPointerDown:l,onTouchStart:l,style:{cursor:s?"move":"pointer",strokeWidth:r,pointerEvents:s?"none":h.end.filled?"visible":"visibleStroke",strokeLinecap:"butt"}})]})}function _h({rect:e,vertices:t,color:n="transparent",strokeColor:o="#000000",opacity:i=1,strokeWidth:r,strokeStyle:a=Ut.SOLID,strokeDashArray:s,scale:l,isSelected:c,onClick:d,currentVertex:u,handleSize:h=14}){const m=u?[...t,u]:t,g=Re(()=>m.map(({x:t,y:n})=>({x:t-e.origin.x,y:n-e.origin.y})),[m,e]),p=Re(()=>{if(!g.length)return"";const[e,...t]=g,n=!!u;return(`M ${e.x} ${e.y} `+t.map(e=>`L ${e.x} ${e.y}`).join(" ")+(n?"":" Z")).trim()},[g,u]),f=u&&t.length>0,v=e.size.width*l,y=e.size.height*l;return He("svg",{style:{position:"absolute",width:v,height:y,pointerEvents:"none",zIndex:2,overflow:"visible"},width:v,height:y,viewBox:`0 0 ${e.size.width} ${e.size.height}`,children:[He("path",{d:p,onPointerDown:d,onTouchStart:d,opacity:i,style:{fill:u?"none":n,stroke:o??n,strokeWidth:r,cursor:c?"move":"pointer",pointerEvents:c?"none":"transparent"===n?"visibleStroke":"visible",strokeLinecap:"butt",strokeLinejoin:"miter",...a===Ut.DASHED&&{strokeDasharray:null==s?void 0:s.join(",")}}}),f&&t.length>1&&He("path",{d:`M ${g[g.length-1].x} ${g[g.length-1].y} L ${g[0].x} ${g[0].y}`,fill:"none",style:{stroke:o,strokeWidth:r,strokeDasharray:"4,4",opacity:.7}}),f&&t.length>=2&&He("rect",{x:g[0].x-h/l/2,y:g[0].y-h/l/2,width:h/l,height:h/l,fill:o,opacity:.4,stroke:o,strokeWidth:r/2})]})}function Nh({isSelected:e,isEditing:t,annotation:n,pageIndex:o,scale:i,onClick:r}){const a=De(null),{provides:s}=xh(),[l,c]=Se(!1);Ae(()=>{if(t&&a.current){const e=a.current;e.focus();const t=window.getSelection();if(t){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}},[t]),Pe(()=>{try{const e=navigator,t=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&(null==e?void 0:e.maxTouchPoints)>1;c(t)}catch{c(!1)}},[]);const d=n.object.fontSize*i,u=l&&t&&d>0&&d<16,h=u?16:d,m=u?d/16:1,g=u?100/m:100;return He("div",{style:{position:"absolute",width:n.object.rect.size.width*i,height:n.object.rect.size.height*i,cursor:e&&!t?"move":"default",pointerEvents:e&&!t?"none":"auto",zIndex:2},onPointerDown:r,onTouchStart:r,children:He("span",{ref:a,onBlur:()=>{s&&a.current&&s.updateAnnotation(o,n.object.id,{contents:a.current.innerText})},tabIndex:0,style:{color:n.object.fontColor,fontSize:h,...xn(n.object.fontFamily),textAlign:cn(n.object.textAlign),flexDirection:"column",justifyContent:n.object.verticalAlign===Rt.Top?"flex-start":n.object.verticalAlign===Rt.Middle?"center":"flex-end",display:"flex",backgroundColor:n.object.color??n.object.backgroundColor,opacity:n.object.opacity,width:u?`${g}%`:"100%",height:u?`${g}%`:"100%",lineHeight:"1.18",overflow:"hidden",cursor:t?"text":"pointer",outline:"none",transform:u?`scale(${m})`:void 0,transformOrigin:"top left"},contentEditable:t,...vh,children:n.object.contents})})}function Oh({documentId:e,pageIndex:t,annotation:n,scaleFactor:o=1,unrotated:i,style:r,...a}){const{provides:s}=xh(),[l,c]=Se(null),d=De(null),{width:u,height:h}=n.rect.size;Ae(()=>{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},En),()=>{d.current?(URL.revokeObjectURL(d.current),d.current=null):r.abort({code:Qt.Cancelled,message:"canceled render task"})}}},[t,o,i,s,e,n.id,u,h]);return He(H,{children:l&&He("img",{src:l,onLoad:()=>{d.current&&(URL.revokeObjectURL(d.current),d.current=null)},...a,style:{width:"100%",height:"100%",display:"block",...r||{}}})})}function Lh({isSelected:e,annotation:t,documentId:n,pageIndex:o,scale:i,onClick:r}){const a=!!t.object.rotation&&!!t.object.unrotatedRect;return He("div",{style:{position:"absolute",width:"100%",height:"100%",zIndex:2,pointerEvents:e?"none":"auto",cursor:"pointer"},onPointerDown:r,onTouchStart:r,children:He(Oh,{documentId:n,pageIndex:o,annotation:{...t.object,id:t.object.id},scaleFactor:i,unrotated:a})})}function $h({isSelected:e,strokeColor:t="#0000FF",strokeWidth:n=2,strokeStyle:o=Ut.UNDERLINE,strokeDashArray:i,rect:r,scale:a,onClick:s,hasIRT:l=!1}){const{width:c,height:d}=Re(()=>({width:r.size.width,height:r.size.height}),[r]),u=c*a,h=d*a,m=Re(()=>{if(o===Ut.DASHED)return(null==i?void 0:i.join(","))??`${3*n},${n}`},[o,i,n]),g=o===Ut.UNDERLINE;return He("svg",{style:{position:"absolute",width:u,height:h,pointerEvents:"none",zIndex:2},width:u,height:h,viewBox:`0 0 ${c} ${d}`,children:[He("rect",{x:0,y:0,width:c,height:d,fill:"transparent",onPointerDown:l?void 0:s,onTouchStart:l?void 0:s,style:{cursor:l?"default":e?"move":"pointer",pointerEvents:l||e?"none":"visible"}}),g?He("line",{x1:1,y1:d-1,x2:c-1,y2:d-1,stroke:t,strokeWidth:n,strokeDasharray:m,style:{pointerEvents:"none"}}):He("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 jh(e){const{documentId:t,pageIndex:n,scale:o,pageWidth:i,pageHeight:r,selectionMenu:a}=e,{provides:s}=xh(),{provides:l}=Ll(),[c,d]=Se([]),{register:u}=function({modeId:e,pageIndex:t,documentId:n}){const{provides:o}=ch();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=Re(()=>s?s.forDocument(t):null,[s,t]),v=h.length>1;Ae(()=>{if(f){const e=f.getState();return d(cd(e,n)),m(ud(e)),f.onStateChange(e=>{d(cd(e,n)),m(ud(e))})}},[f,n]);const y=Re(()=>({onPointerDown:(e,t)=>{t.target===t.currentTarget&&f&&(f.deselectAnnotation(),p(null))}}),[f]),b=ze((e,t)=>{if(e.stopPropagation(),f&&l){l.clear();"metaKey"in e&&(e.metaKey||e.ctrlKey)?f.toggleSelection(n,t.object.id):f.selectAnnotation(n,t.object.id),t.object.id!==g&&p(null)}},[f,l,g,n]),w=ze((e,t)=>{if(e.stopPropagation(),f&&l){if(l.clear(),t.object.inReplyToId){const e=t.object.inReplyToId,n=c.find(t=>t.object.id===e);if(n)return void f.selectAnnotation(n.object.pageIndex,e)}f.selectAnnotation(n,t.object.id)}},[f,l,c,n]);Ae(()=>u(y,{documentId:t}),[u,y]);const x=Re(()=>c.filter(e=>h.includes(e.object.id)),[c,h]),C=Re(()=>!(x.length<2)&&x.every(e=>{const t=null==f?void 0:f.findToolForAnnotation(e.object),n=lu(null==t?void 0:t.interaction.isGroupDraggable,e.object,!0),o=lu(null==t?void 0:t.interaction.isDraggable,e.object,!0);return void 0!==(null==t?void 0:t.interaction.isGroupDraggable)?n:o}),[x,f]),I=Re(()=>!(x.length<2)&&x.every(e=>{const t=null==f?void 0:f.findToolForAnnotation(e.object),n=lu(null==t?void 0:t.interaction.isGroupResizable,e.object,!0),o=lu(null==t?void 0:t.interaction.isResizable,e.object,!0);return void 0!==(null==t?void 0:t.interaction.isGroupResizable)?n:o}),[x,f]),k=Re(()=>!(x.length<2)&&x.every(e=>{const t=null==f?void 0:f.findToolForAnnotation(e.object),n=lu(null==t?void 0:t.interaction.isGroupRotatable,e.object,!0),o=lu(null==t?void 0:t.interaction.isRotatable,e.object,!0);return void 0!==(null==t?void 0:t.interaction.isGroupRotatable)?n:o}),[x,f]),S=Re(()=>!(x.length<2)&&x.some(e=>{const t=null==f?void 0:f.findToolForAnnotation(e.object),n=lu(null==t?void 0:t.interaction.lockGroupAspectRatio,e.object,!1),o=lu(null==t?void 0:t.interaction.lockAspectRatio,e.object,!1);return void 0!==(null==t?void 0:t.interaction.lockGroupAspectRatio)?n:o}),[x,f]),M=Re(()=>{if(!f)return!1;const e=f.getSelectedAnnotations();return e.length>1&&e.every(e=>e.object.pageIndex===n)},[f,n,h]);return He(H,{children:[c.map(i=>{const r=h.includes(i.object.id),s=g===i.object.id,l=null==f?void 0:f.findToolForAnnotation(i.object);for(const t of e.annotationRenderers??[]){const s=t.tryRender(i,{isSelected:r,scale:o,pageIndex:n,onClick:e=>b(e,i)});if(s)return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!1),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!1),selectionMenu:a,onSelect:e=>b(e,i),style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:()=>s},i.object.id)}if(Kc(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!0),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(Dh,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Xc(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!0),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(Rh,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Zc(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!0),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(zh,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})},i.object.id);if(td(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!1),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!1),selectionMenu:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(Mh,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(nd(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!1),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!1),selectionMenu:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(Ah,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(od(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!1),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!1),selectionMenu:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(Ph,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(ed(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!1),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!1),selectionMenu:a,onSelect:e=>b(e,i),zIndex:0,style:{mixBlendMode:Mn(i.object.blendMode??zt.Multiply)},...e,children:e=>He(Sh,{...e,scale:o,onClick:e=>b(e,i)})},i.object.id);if(Qc(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),vertexConfig:{extractVertices:e=>[e.linePoints.start,e.linePoints.end],transformAnnotation:(e,t)=>({...e,linePoints:{start:t[0],end:t[1]}})},style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(H,{children:He(Th,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})})},i.object.id);if(Jc(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(H,{children:He(Eh,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})})},i.object.id);if(Yc(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!1),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),vertexConfig:{extractVertices:e=>e.vertices,transformAnnotation:(e,t)=>({...e,vertices:t})},style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(H,{children:He(_h,{...e,isSelected:r,scale:o,onClick:e=>b(e,i)})})},i.object.id);if(id(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0)&&!s,isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!0),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},onDoubleClick:e=>{e.stopPropagation(),p(i.object.id)},...e,children:e=>He(Nh,{isSelected:r,isEditing:s,annotation:{...i,object:e},pageIndex:n,scale:o,onClick:e=>b(e,i)})},i.object.id);if(rd(i))return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:lu(null==l?void 0:l.interaction.isDraggable,i.object,!0),isResizable:lu(null==l?void 0:l.interaction.isResizable,i.object,!0),lockAspectRatio:lu(null==l?void 0:l.interaction.lockAspectRatio,i.object,!1),isRotatable:lu(null==l?void 0:l.interaction.isRotatable,i.object,!0),selectionMenu:a,onSelect:e=>b(e,i),style:{mixBlendMode:Mn(i.object.blendMode??zt.Normal)},...e,children:e=>He(Lh,{isSelected:r,annotation:i,documentId:t,pageIndex:n,scale:o,onClick:e=>b(e,i)})},i.object.id);if(sd(i)){const t=!!i.object.inReplyToId;return He(Ih,{trackedAnnotation:i,isSelected:r,isMultiSelected:v,isDraggable:!1,isResizable:!1,lockAspectRatio:!1,isRotatable:!1,selectionMenu:t?void 0:a,onSelect:e=>w(e,i),...e,children:e=>He($h,{...e,isSelected:r,scale:o,onClick:e=>w(e,i),hasIRT:t})},i.object.id)}return null}),M&&x.length>=2&&He(kh,{documentId:t,pageIndex:n,scale:o,rotation:e.rotation,pageWidth:i,pageHeight:r,selectedAnnotations:x,isDraggable:C,isResizable:I,isRotatable:k,lockAspectRatio:S,resizeUI:e.resizeUI,rotationUI:e.rotationUI,selectionOutlineColor:e.selectionOutlineColor,selectionOutline:e.groupSelectionOutline??e.selectionOutline,groupSelectionMenu:e.groupSelectionMenu})]})}function Fh({documentId:e,pageIndex:t,scale:n}){var o,i,r,a,s,l,c,d,u,h,m,g;const{provides:p}=Ll(),{provides:f}=xh(),[v,y]=Se([]),[b,w]=Se(null),[x,C]=Se(null);if(Ae(()=>{if(p)return p.forDocument(e).onSelectionChange(()=>{y(p.forDocument(e).getHighlightRectsForPage(t)),w(p.forDocument(e).getBoundingRectForPage(t))})},[p,e,t]),Ae(()=>{if(f)return C(f.forDocument(e).getActiveTool()),f.forDocument(e).onActiveToolChange(e=>C(e))},[f,e]),!b)return null;if(!x||!x.defaults)return null;switch(x.defaults.type){case _t.UNDERLINE:return He("div",{style:{mixBlendMode:Mn((null==(o=x.defaults)?void 0:o.blendMode)??zt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:He(Mh,{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 He("div",{style:{mixBlendMode:Mn((null==(a=x.defaults)?void 0:a.blendMode)??zt.Multiply),pointerEvents:"none",position:"absolute",inset:0},children:He(Sh,{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 He("div",{style:{mixBlendMode:Mn((null==(c=x.defaults)?void 0:c.blendMode)??zt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:He(Ah,{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 He("div",{style:{mixBlendMode:Mn((null==(h=x.defaults)?void 0:h.blendMode)??zt.Normal),pointerEvents:"none",position:"absolute",inset:0},children:He(Ph,{strokeColor:null==(m=x.defaults)?void 0:m.strokeColor,opacity:null==(g=x.defaults)?void 0:g.opacity,segmentRects:v,scale:n})});default:return null}}function Uh({preview:e,scale:t}){const{bounds:n}=e,o={position:"absolute",left:n.origin.x*t,top:n.origin.y*t,width:n.size.width*t,height:n.size.height*t,pointerEvents:"none",zIndex:10};return e.type===_t.CIRCLE?He("div",{style:o,children:He(zh,{isSelected:!1,scale:t,...e.data})}):e.type===_t.SQUARE?He("div",{style:o,children:He(Rh,{isSelected:!1,scale:t,...e.data})}):e.type===_t.POLYGON?He("div",{style:o,children:He(_h,{isSelected:!1,scale:t,...e.data})}):e.type===_t.POLYLINE?He("div",{style:o,children:He(Eh,{isSelected:!1,scale:t,...e.data})}):e.type===_t.LINE?He("div",{style:o,children:He(Th,{isSelected:!1,scale:t,...e.data})}):e.type===_t.INK?He("div",{style:o,children:He(Dh,{isSelected:!1,scale:t,...e.data})}):e.type===_t.FREETEXT?He("div",{style:o,children:He("div",{style:{width:"100%",height:"100%",border:`1px dashed ${e.data.fontColor||"#000000"}`,backgroundColor:"transparent"}})}):null}function Hh({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=wh(),[i,r]=Se(new Map),a=De(null),s=De(null),l=Re(()=>({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 Ae(()=>{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]),He(H,{children:[He("input",{ref:a,type:"file",style:{display:"none"}}),He("canvas",{ref:s,style:{display:"none"}}),Array.from(i.entries()).map(([e,t])=>He(Uh,{preview:t,scale:n},e))]})}function Bh({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=Oo(t),x=null==(v=null==(f=null==w?void 0:w.document)?void 0:f.pages)?void 0:v[n],C=(null==(y=null==x?void 0:x.size)?void 0:y.width)??0,I=(null==(b=null==x?void 0:x.size)?void 0:b.height)??0,k=Te(bh),S=Re(()=>{const e=[...k];for(const t of g??[]){const n=e.findIndex(e=>e.id===t.id);n>=0?e[n]=t:e.push(t)}return e},[k,g]),M=Re(()=>void 0!==o?o:(null==w?void 0:w.scale)??1,[o,null==w?void 0:w.scale]);return He("div",{style:{...e},...p,children:[He(jh,{documentId:t,selectionMenu:r,groupSelectionMenu:a,pageIndex:n,scale:M,rotation:Re(()=>{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:C,pageHeight:I,resizeUI:s,vertexUI:l,rotationUI:c,selectionOutlineColor:d,selectionOutline:u,groupSelectionOutline:h,customAnnotationRenderer:m,annotationRenderers:S}),He(Fh,{documentId:t,pageIndex:n,scale:M}),He(Hh,{documentId:t,pageIndex:n,scale:M})]})}function Wh(e){return{id:e.id,tryRender:(t,n)=>e.matches(t.object)?e.render({...n,annotation:t}):null}}const qh=Do(gu).addWrapper(function({children:e}){const[t,n]=Se([]),o=ze(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 He(yh.Provider,{value:o,children:He(bh.Provider,{value:t,children:e})})}).build(),Gh="print",Vh={id:Gh,name:"Print Plugin",version:"1.0.0",provides:["print"],requires:[],optional:[],defaultConfig:{}},Kh=class extends fo{constructor(e,t,n){super(e,t),this.printReady$=So()}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,Zt.Print))return this.logger.debug("PrintPlugin","Print",`Cannot print: document ${n} lacks Print permission`),Jt.reject({code:Qt.Security,message:"Document lacks Print permission"});const o=e??{},i=new Ct;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):Jt.reject({code:Qt.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()}};Kh.id="print";let Zh=Kh;const Yh=()=>_o(Zh.id);const Xh=Do({manifest:Vh,create:(e,t)=>new Zh(Gh,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{provides:e}=Yh(),{plugin:t}=Eo(Zh.id),n=De(null),o=De(null);return Ae(()=>{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]),He("iframe",{ref:n,style:{position:"absolute",display:"none"},title:"Print Document",src:"about:blank"})}).build(),Qh="fullscreen",Jh={id:Qh,name:"Fullscreen Plugin",version:"1.0.0",provides:["fullscreen"],requires:[],optional:[],defaultConfig:{}},em="SET_FULLSCREEN";const tm=class extends fo{constructor(e,t,n){super(e,t),this.onStateChange$=Mo(),this.fullscreenRequest$=So(),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:em,payload:e})}async destroy(){this.fullscreenRequest$.clear(),super.destroy()}};tm.id="fullscreen";let nm=tm;const om=()=>Eo(nm.id);async function im(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 rm=Do({manifest:Jh,create:(e,t)=>new nm(Qh,e,t),reducer:(e,t)=>t.type===em?{...e,isFullscreen:t.payload}:e,initialState:{isFullscreen:!1}}).addWrapper(function({children:e,...t}){const{provides:n}=_o(nm.id),{plugin:o}=om(),{plugin:i}=om(),r=De(null);return Ae(()=>{if(!n||!o)return;return n.onRequest(async e=>{const t=o.getTargetSelector();await im(e,r.current,t)})},[n,o]),Ae(()=>{if(!i)return;const e=()=>i.setFullscreenState(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[i]),He("div",{...t,style:{position:"relative",width:"100%",height:"100%",...t.style},ref:r,children:e})}).build(),am="bookmark",sm={id:am,name:"Bookmark Plugin",version:"1.0.0",provides:["bookmark"],requires:[],optional:[],defaultConfig:{}},lm=class extends fo{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)}};lm.id="bookmark";let cm=lm;const dm={manifest:sm,create:e=>new cm(am,e),reducer:()=>{},initialState:{}},um=class extends fo{constructor(e,t,n){super(e,t),this.downloadRequest$=So(),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):Jt.reject({code:Qt.DocNotOpen,message:`Document ${t} not found`})}saveAsCopyAndGetBufferAndName(e){const t=new Ct,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):Jt.reject({code:Qt.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()}};um.id="export";let hm=um;const mm="export";const gm=Do({manifest:{id:mm,name:"Export Plugin",version:"1.0.0",provides:["export"],requires:[],optional:[],defaultConfig:{defaultFileName:"document.pdf"}},create:(e,t)=>new hm(mm,e,t),reducer:()=>{},initialState:{}}).addUtility(function(){const{plugin:e}=Eo(hm.id),t=De(null);return Ae(()=>{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)},En)})},[e]),He("a",{style:{display:"none"},ref:t})}).build(),pm="PAN/INIT_STATE",fm="PAN/CLEANUP_STATE",vm="PAN/SET_PAN_MODE";const ym=class extends fo{constructor(e,t,n){var o,i,r;super(e,t),this.panMode$=Mo(),this.documentHandlers=new Map,this.config=n,this.interactionManager=null==(o=t.getPlugin(rh.id))?void 0:o.provides(),this.viewport=null==(i=t.getPlugin(ai.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:vm,payload:{documentId:e,isPanMode:t}}}(e.documentId,t))}))}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:pm,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:fm,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()}};ym.id="pan";let bm=ym;const wm={documents:{},activeDocumentId:null},xm=Do({manifest:{id:"pan",name:"Pan Plugin",version:"1.0.0",provides:["pan"],requires:["interaction-manager","viewport"],optional:[],defaultConfig:{defaultMode:"mobile"}},create:(e,t)=>new bm("pan",e,t),reducer:(e=wm,t)=>{switch(t.type){case pm:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case fm:{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 vm:{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:wm}).addUtility(()=>{const{provides:e}=_o(bm.id),{plugin:t}=Eo(bm.id);return Ae(()=>{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(),Cm="capture",Im={id:Cm,name:"Capture Plugin",version:"1.0.0",provides:["capture"],requires:["render"],optional:["interaction-manager"],defaultConfig:{scale:1,imageType:"image/png",withAnnotations:!1}};const km="CAPTURE/INIT_STATE",Sm="CAPTURE/CLEANUP_STATE",Mm="CAPTURE/SET_MARQUEE_CAPTURE_ACTIVE";const Am={isMarqueeCaptureActive:!1},Pm={documents:{},activeDocumentId:null},Dm=class extends fo{constructor(e,t,n){var o;super(e,t),this.captureArea$=So(),this.state$=Mo(),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:Mm,payload:{documentId:o,isActive:t}}))}))}onDocumentLoadingStarted(e){const t={...Am};this.dispatch(function(e,t){return{type:km,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:Sm,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=wo(e.x,0,t.width),o=wo(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})},En)}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()}};Dm.id="capture";let Rm=Dm;const zm={manifest:Im,create:(e,t)=>new Rm(Cm,e,t),reducer:(e=Pm,t)=>{switch(t.type){case km:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Sm:{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 Mm:{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:Pm},Tm=()=>_o(Rm.id),Em=({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}=Tm(),s=Oo(e),[l,c]=Se(null),d=Re(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return Ae(()=>{if(a)return a.registerMarqueeOnPage({documentId:e,pageIndex:t,scale:d,callback:{onPreview:c}})},[a,e,t,d]),l?He("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},_m="history",Nm={id:_m,name:"History Plugin",version:"1.0.0",provides:["history"],requires:[],optional:[],defaultConfig:{}},Om="HISTORY/INIT_STATE",Lm="HISTORY/CLEANUP_STATE",$m="HISTORY/SET_DOCUMENT_STATE",jm=class extends fo{constructor(e,t){super(e,t),this.documentHistories=new Map,this.historyChange$=So()}async initialize(e){this.logger.info("HistoryPlugin","Initialize","History plugin initialized")}onDocumentLoadingStarted(e){this.dispatch((e=>({type:Om,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:Lm,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-1,canRedo:t.globalIndex({type:$m,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-1}return n.globalIndex>-1}canRedo(e,t){const n=this.getDocumentHistoryData(t);if(e){const t=n.topicHistories.get(e);return!!t&&t.currentIndexe(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;e0&&(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()}};jm.id="history";let Fm=jm;const Um={global:{canUndo:!1,canRedo:!1},topics:{}},Hm={documents:{},activeDocumentId:null},Bm={manifest:Nm,create:e=>new Fm(_m,e),reducer:(e=Hm,t)=>{switch(t.type){case Om:{const{documentId:n}=t.payload;return{...e,documents:{...e.documents,[n]:{...Um}}}}case Lm:{const{documentId:n}=t.payload,{[n]:o,...i}=e.documents;return{...e,documents:i,activeDocumentId:e.activeDocumentId===n?null:e.activeDocumentId}}case $m:{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:Hm};var Wm=(e=>(e.Redact="redact",e.MarqueeRedact="marqueeRedact",e.RedactSelection="redactSelection",e))(Wm||{});const qm="REDACTION/INIT_STATE",Gm="REDACTION/CLEANUP_STATE",Vm="START_REDACTION",Km="END_REDACTION",Zm="ADD_PENDING",Ym="REMOVE_PENDING",Xm="UPDATE_PENDING",Qm="CLEAR_PENDING",Jm="SELECT_PENDING",eg="DESELECT_PENDING";const tg=(e,t)=>({type:Zm,payload:{documentId:e,items:t}}),ng=(e,t,n)=>({type:Ym,payload:{documentId:e,page:t,id:n}}),og=e=>({type:Qm,payload:e}),ig=(e,t,n,o)=>({type:Xm,payload:{documentId:e,page:t,id:n,patch:o}}),rg=(e,t,n)=>({type:Jm,payload:{documentId:e,page:t,id:n}}),ag=e=>({type:eg,payload:e}),sg=e=>Object.values(e).reduce((e,t)=>e+t.length,0),lg={isRedacting:!1,activeType:null,pending:{},pendingCount:0,selected:null},cg={documents:{},activeDocumentId:null},dg={id:"redact",name:"Redact",matchScore:e=>e.type===_t.REDACT?10:0,interaction:{mode:Wm.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}},ug=[dg],hg=class extends fo{constructor(e,t,n){var o,i,r,a;if(super(e,t),this.redactionSelection$=new Map,this.redactionMarquee$=new Map,this.pending$=Mo(),this.selected$=Mo(),this.state$=Mo(),this.events$=Mo(),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)for(const e of ug)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:Wm.Redact,scope:"page",exclusive:!1,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:Wm.MarqueeRedact,scope:"page",exclusive:!1,cursor:"crosshair"}),this.interactionManagerCapability.registerMode({id:Wm.RedactSelection,scope:"page",exclusive:!1}))}setupModeChangeListener(){var e;null==(e=this.interactionManagerCapability)||e.onModeChange(e=>{const t=e.documentId;if(e.activeMode===Wm.Redact||e.activeMode===Wm.MarqueeRedact||e.activeMode===Wm.RedactSelection)this.dispatch(((e,t)=>({type:Vm,payload:{documentId:e,mode:t}}))(t,e.activeMode));else{const e=this.getDocumentState(t);(null==e?void 0:e.isRedacting)&&this.dispatch((e=>({type:Km,payload:e}))(t))}})}onDocumentLoadingStarted(e){this.dispatch(function(e,t){return{type:qm,payload:{documentId:e,state:t}}}(e,{...lg})),this.redactionSelection$.set(e,Mo()),this.redactionMarquee$.set(e,Mo());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,Zt.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,Zt.ModifyContents))if(this.useAnnotationMode)this.createRedactAnnotationFromArea(e,t.pageIndex,t.rect);else{const n=this.config.drawBlackBoxes?"#000000":"transparent",o={id:zn(),kind:"area",page:t.pageIndex,rect:t.rect,source:"legacy",markColor:"#FF0000",redactionColor:n};this.dispatch(tg(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(Wm.Redact,{enableSelection:!0,showSelectionRects:!1,enableMarquee:!0,showMarqueeRects:!1},e),null==(n=this.selectionCapability)||n.enableForMode(Wm.MarqueeRedact,{enableSelection:!1,enableMarquee:!0,showMarqueeRects:!1},e),null==(o=this.selectionCapability)||o.enableForMode(Wm.RedactSelection,{enableSelection:!0,showSelectionRects:!1},e)}onDocumentClosed(e){this.dispatch(function(e){return{type:Gm,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}syncFromAnnotationCreate(e,t){const n=this.annotationToRedactionItem(t);this.dispatch(tg(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(ig(e,t.pageIndex,t.id,o))}syncFromAnnotationDelete(e,t){this.dispatch(ng(e,t.pageIndex,t.id))}syncFromAnnotationLoad(e){const t=this.getPendingFromAnnotations(e);this.dispatch(og(e));for(const[,n]of Object.entries(t))n.length>0&&this.dispatch(tg(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(rg(e,t.pageIndex,t.id))}else{const t=this.getDocumentState(e);(null==t?void 0:t.selected)&&this.dispatch(ag(e))}}addPendingItems(e,t){const n=t??this.getActiveDocumentId();if(this.checkPermission(n,Zt.ModifyContents)){if(this.useAnnotationMode){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(tg(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(ng(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(og(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(rg(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(ag(o)),null==(n=this.interactionManagerCapability)||n.releasePageActivity(o,"redaction-selection"))}enableRedactSelection(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,Zt.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Wm.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())===Wm.RedactSelection)null==o||o.activateDefaultMode();else{if(!this.checkPermission(n,Zt.ModifyContents))return;null==o||o.activate(Wm.RedactSelection)}}isRedactSelectionActive(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode();return o===Wm.Redact||o===Wm.RedactSelection}enableMarqueeRedact(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,Zt.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Wm.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())===Wm.MarqueeRedact)null==o||o.activateDefaultMode();else{if(!this.checkPermission(n,Zt.ModifyContents))return;null==o||o.activate(Wm.MarqueeRedact)}}isMarqueeRedactActive(e){var t;const n=e??this.getActiveDocumentId(),o=null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode();return o===Wm.Redact||o===Wm.MarqueeRedact}enableRedact(e){var t;const n=e??this.getActiveDocumentId();this.checkPermission(n,Zt.ModifyContents)?null==(t=this.interactionManagerCapability)||t.forDocument(n).activate(Wm.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())===Wm.Redact)null==o||o.activateDefaultMode();else{if(!this.checkPermission(n,Zt.ModifyContents))return;null==o||o.activate(Wm.Redact)}}isRedactActive(e){var t;const n=e??this.getActiveDocumentId();return(null==(t=this.interactionManagerCapability)?void 0:t.forDocument(n).getActiveMode())===Wm.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(){if(this.useAnnotationMode&&this.annotationCapability){const e=this.annotationCapability.getTool("redact");return(null==e?void 0:e.defaults.strokeColor)??"#FF0000"}return"#FF0000"}queueCurrentSelectionAsPending(e){const t=e??this.getActiveDocumentId();if(!this.selectionCapability)return Jt.reject({code:Qt.NotFound,message:"[RedactionPlugin] selection plugin required"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Jt.reject({code:Qt.NotFound,message:"Document not found"});const o=this.selectionCapability.forDocument(t),i=o.getFormattedSelection();if(!i.length)return Jt.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 Ct;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,Zt.ModifyContents))return this.logger.debug("RedactionPlugin","CommitPendingOne",`Cannot commit redaction: document ${o} lacks ModifyContents permission`),Jt.reject({code:Qt.Security,message:"Document lacks ModifyContents permission"});const i=this.coreState.core.documents[o];if(!(null==i?void 0:i.document))return Jt.reject({code:Qt.NotFound,message:"Document not found"});const r=i.document.pages[e];if(!r)return Jt.reject({code:Qt.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 Jt.reject({code:Qt.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}`),Jt.resolve(!0))}commitPendingOneLegacy(e,t,n,o,i){const r="text"===i.kind?i.rects:[i.rect],a=new Ct;return this.engine.redactTextInRects(t,n,r,{drawBlackBoxes:this.config.drawBlackBoxes}).wait(()=>{this.dispatch(ng(e,o,i.id)),this.dispatchCoreAction(no(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:Qt.Unknown,message:"Failed to commit redactions"})}),a}applyRedactionAnnotationMode(e,t,n,o){var i;const r=new Ct,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(ng(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(no(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:Qt.Unknown,message:"Failed to apply redaction"})}),r):(this.logger.warn("RedactionPlugin","ApplyRedactionAnnotationMode",`Redaction annotation not found or wrong type: ${o}`),Jt.reject({code:Qt.NotFound,message:"Redaction annotation not found"}))}commitAllPending(e){const t=e??this.getActiveDocumentId();if(!this.checkPermission(t,Zt.ModifyContents))return this.logger.debug("RedactionPlugin","CommitAllPending",`Cannot commit redactions: document ${t} lacks ModifyContents permission`),Jt.reject({code:Qt.Security,message:"Document lacks ModifyContents permission"});const n=this.coreState.core.documents[t];if(!(null==n?void 0:n.document))return Jt.reject({code:Qt.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):Jt.reject({code:Qt.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 Ct;return Ct.all(r).wait(()=>{this.dispatch(og(e)),this.dispatchCoreAction(no(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:Qt.Unknown,message:"Failed to commit redactions"})}),a}applyAllRedactionsAnnotationMode(e,t){const n=this.annotationCapability.forDocument(e).getState(),o=new Map;for(const e of Object.values(n.byUid))if(e.object.type===_t.REDACT){const t=o.get(e.object.pageIndex)??[];t.push(e.object.id),o.set(e.object.pageIndex,t)}const i=Array.from(o.keys());if(0===i.length)return Jt.resolve(!0);const r=[];for(const e of i){const n=t.pages[e];n&&r.push(this.engine.applyAllRedactions(t,n))}const a=new Ct;return Ct.all(r).wait(()=>{var t,n;const r=null==(t=this.annotationCapability)?void 0:t.forDocument(e),s=[];for(const[t,n]of o)for(const o of n)null==r||r.purgeAnnotation(t,o),this.dispatch(ng(e,t,o)),s.push(o);s.length>0&&(null==(n=this.historyCapability)||n.forDocument(e).purgeByMetadata(e=>{var t;return(null==(t=null==e?void 0:e.annotationIds)?void 0:t.some(e=>s.includes(e)))??!1},"annotations")),this.dispatchCoreAction(no(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:Qt.Unknown,message:"Failed to apply redactions"})}),a}createRedactAnnotationsFromSelection(e,t,n){if(!this.annotationCapability)return[];const o=this.annotationCapability.forDocument(e),i=this.annotationCapability.getTool("redact"),r=null==i?void 0:i.defaults,a=[];for(const e of t){const i=zn();a.push(i);const s={...r,id:i,type:_t.REDACT,pageIndex:e.pageIndex,rect:e.rect,segmentRects:e.segmentRects,...n?{custom:{text:n}}:{},created:new Date};o.createAnnotation(e.pageIndex,s),e===t[t.length-1]&&o.selectAnnotation(e.pageIndex,i)}if(n)for(let o=0;o({id:zn(),kind:"text",page:e.pageIndex,rect:e.rect,rects:e.segmentRects,source:"legacy",markColor:"#FF0000",redactionColor:o,text:n}));this.dispatch(tg(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){if(!this.annotationCapability)return;const o=this.annotationCapability.forDocument(e),i=this.annotationCapability.getTool("redact"),r=null==i?void 0:i.defaults,a=zn(),s={...r,id:a,type:_t.REDACT,pageIndex:t,rect:n,segmentRects:[],created:new Date};o.createAnnotation(t,s),o.selectAnnotation(t,a)}redactionItemToAnnotation(e){var t;const n=null==(t=this.annotationCapability)?void 0:t.getTool("redact");return{...(null==n?void 0:n.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()}};hg.id="redaction";let mg=hg;const gg="redaction",pg={manifest:{id:gg,name:"Redaction Plugin",version:"1.0.0",provides:["redaction"],requires:[],optional:["interaction-manager","selection","annotation"],defaultConfig:{drawBlackBoxes:!0}},create:(e,t)=>new mg(gg,e,t),reducer:(e=cg,t)=>{switch(t.type){case qm:{const{documentId:n,state:o}=t.payload;return{...e,documents:{...e.documents,[n]:o},activeDocumentId:e.activeDocumentId??n}}case Gm:{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 Zm:{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:sg(r)}}}}case Ym:{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:sg(s),selected:l?r.selected:null}}}}case Xm:{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 Qm:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,pending:{},pendingCount:0,selected:null}}}:e}case Jm:{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 eg:{const n=t.payload,o=e.documents[n];return o?{...e,documents:{...e.documents,[n]:{...o,selected:null}}}:e}case Vm:{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 Km:{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:cg};function fg({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??Pt.Helvetica,y=s.textAlign??Dt.Center,b=()=>{if(!g)return null;if(!p)return g;return Array(10).fill(g).join(" ")};return He("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{position:"absolute",inset:0},children:l.map((e,t)=>He("div",{onPointerDown:o,onTouchStart: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===Dt.Left?"flex-start":y===Dt.Right?"flex-end":"center",overflow:"hidden",...i},children:r&&g&&He("span",{style:{color:m,fontSize:Math.min(f*n,e.size.height*n*.8),...xn(v),textAlign:cn(y),whiteSpace:p?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1},children:b()})},t))})}function vg({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??Pt.Helvetica,f=s.textAlign??Dt.Center;return He("div",{onPointerDown:t?void 0:o,onTouchStart: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===Dt.Left?"flex-start":f===Dt.Right?"flex-end":"center",overflow:"hidden",...i},children:r&&h&&He("span",{style:{color:u,fontSize:g*n,...xn(p),textAlign:cn(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 yg=[Wh({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:e=>He(fg,{...e})}),Wh({id:"redactArea",matches:e=>{var t;return!(e.type!==_t.REDACT||"segmentRects"in e&&(null==(t=e.segmentRects)?void 0:t.length))},render:e=>He(vg,{...e})})];const bg=()=>Eo(mg.id),wg=()=>_o(mg.id),xg=({documentId:e,pageIndex:t,scale:n,className:o,stroke:i,fill:r="transparent"})=>{const{plugin:a}=bg(),s=Oo(e),[l,c]=Se(null),d=n??(null==s?void 0:s.scale)??1,u=i??(null==a?void 0:a.getPreviewStrokeColor())??"red";return Ae(()=>{if(a&&e)return a.onRedactionMarqueeChange(e,e=>{c(e.pageIndex===t?e.rect:null)})},[a,e,t]),l?He("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 Cg({color:e="#FFFF00",opacity:t=1,border:n="1px solid red",rects:o,rect:i,scale:r,onClick:a,style:s,...l}){return He(H,{children:o.map((o,c)=>He("div",{onPointerDown:a,onTouchStart:a,style:{position:"absolute",border:n,left:(i?o.origin.x-i.origin.x:o.origin.x)*r,top:(i?o.origin.y-i.origin.y:o.origin.y)*r,width:o.size.width*r,height:o.size.height*r,background:e,opacity:t,pointerEvents:a?"auto":"none",cursor:a?"pointer":"default",zIndex:a?1:void 0,...s},...l},c))})}function Ig({documentId:e,pageIndex:t,scale:n}){const{plugin:o}=bg(),[i,r]=Se([]),[a,s]=Se(null),l=(null==o?void 0:o.getPreviewStrokeColor())??"red";return Ae(()=>{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?He("div",{style:{mixBlendMode:"normal",pointerEvents:"none",position:"absolute",inset:0},children:He(Cg,{color:"transparent",opacity:1,rects:i,scale:n,border:`1px solid ${l}`})}):null}function kg({documentId:e,pageIndex:t,scale:n,bboxStroke:o="rgba(0,0,0,0.8)",rotation:i=Be.Degree0,selectionMenu:r}){const{provides:a}=wg(),[s,l]=Se([]),[c,d]=Se(null);Ae(()=>{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=ze((n,o)=>{n.stopPropagation(),a&&a.forDocument(e).selectPending(t,o)},[a,e,t]);return s.length?He("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:s.map(e=>{if("area"===e.kind){const a=e.rect;return He(H,{children:[He("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),onTouchStart:t=>u(t,e.id)}),r&&He(Al,{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 He(H,{children:[He("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:He(Cg,{rect:a,rects:e.rects,color:"transparent",border:`1px solid ${e.markColor}`,scale:n,onClick:t=>u(t,e.id)})}),r&&He(Al,{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 Sg=({documentId:e,pageIndex:t,scale:n,rotation:o,selectionMenu:i})=>{var r,a;const s=Oo(e),l=null==(a=null==(r=null==s?void 0:s.document)?void 0:r.pages)?void 0:a[t],c=Re(()=>void 0!==n?n:(null==s?void 0:s.scale)??1,[n,null==s?void 0:s.scale]);return He(H,{children:[He(kg,{documentId:e,pageIndex:t,scale:c,rotation:Re(()=>{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}),He(xg,{documentId:e,pageIndex:t,scale:c}),He(Ig,{documentId:e,pageIndex:t,scale:c})]})},Mg=Do(pg).addUtility(function(){return function(e){const t=Te(yh),n=De(e);Ae(()=>{if(t)return t(n.current)},[t])}(yg),null}).build(),Ag=class extends fo{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):Jt.reject({code:Qt.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):Jt.reject({code:Qt.NotFound,message:`Document ${t} not found`})}};Ag.id="attachment";let Pg=Ag;const Dg="attachment",Rg={manifest:{id:Dg,name:"Attachment Plugin",version:"1.0.0",provides:["attachment"],requires:[],optional:[],defaultConfig:{}},create:e=>new Pg(Dg,e),reducer:()=>{},initialState:{}},zg=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Tg="-",Eg=[],_g=e=>{const t=Lg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Og(e);const n=e.split(Tg),o=""===n[0]&&n.length>1?1:0;return Ng(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{if(0===e.length-t)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const n=Ng(e,t+1,i);if(n)return n}const r=n.validators;if(null===r)return;const a=0===t?e.join(Tg):e.slice(t).join(Tg),s=r.length;for(let e=0;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})(),Lg=e=>{const{theme:t,classGroups:n}=e;return $g(n,t)},$g=(e,t)=>{const n=zg();for(const o in e){const i=e[o];jg(i,n,o,t)}return n},jg=(e,t,n,o)=>{const i=e.length;for(let r=0;r{"string"!=typeof e?"function"!=typeof e?Bg(e,t,n,o):Hg(e,t,n,o):Ug(e,t,n)},Ug=(e,t,n)=>{(""===e?t:Wg(t,e)).classGroupId=n},Hg=(e,t,n,o)=>{qg(e)?jg(e(o),t,n,o):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},Bg=(e,t,n,o)=>{const i=Object.entries(e),r=i.length;for(let e=0;e{let n=e;const o=t.split(Tg),i=o.length;for(let e=0;e"isThemeGetter"in e&&!0===e.isThemeGetter,Gg=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)}}},Vg=[],Kg=(e,t,n,o,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:i}),Zg=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;sr?n-r:void 0)};if(t){const e=t+":",n=o;o=t=>t.startsWith(e)?n(t.slice(e.length)):Kg(Vg,!1,t,void 0,!0)}if(n){const e=o;o=t=>n({className:t,parseClassName:e})}return o},Yg=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;i0&&(o.sort(),n.push(...o),o=[]),n.push(r)):o.push(r)}return o.length>0&&(o.sort(),n.push(...o)),n}},Xg=/\s+/,Qg=e=>{if("string"==typeof e)return e;let t,n="";for(let o=0;o{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(Xg);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;e0?" "+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:Gg(e.cacheSize),parseClassName:Zg(e),sortModifiers:Yg(e),..._g(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{const t=t=>t[e]||ep;return t.isThemeGetter=!0,t},np=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,op=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ip=/^\d+\/\d+$/,rp=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ap=/\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$/,sp=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lp=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cp=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,dp=e=>ip.test(e),up=e=>!!e&&!Number.isNaN(Number(e)),hp=e=>!!e&&Number.isInteger(Number(e)),mp=e=>e.endsWith("%")&&up(e.slice(0,-1)),gp=e=>rp.test(e),pp=()=>!0,fp=e=>ap.test(e)&&!sp.test(e),vp=()=>!1,yp=e=>lp.test(e),bp=e=>cp.test(e),wp=e=>!Cp(e)&&!Pp(e),xp=e=>Np(e,jp,vp),Cp=e=>np.test(e),Ip=e=>Np(e,Fp,fp),kp=e=>Np(e,Up,up),Sp=e=>Np(e,Lp,vp),Mp=e=>Np(e,$p,bp),Ap=e=>Np(e,Bp,yp),Pp=e=>op.test(e),Dp=e=>Op(e,Fp),Rp=e=>Op(e,Hp),zp=e=>Op(e,Lp),Tp=e=>Op(e,jp),Ep=e=>Op(e,$p),_p=e=>Op(e,Bp,!0),Np=(e,t,n)=>{const o=np.exec(e);return!!o&&(o[1]?t(o[1]):n(o[2]))},Op=(e,t,n=!1)=>{const o=op.exec(e);return!!o&&(o[1]?t(o[1]):n)},Lp=e=>"position"===e||"percentage"===e,$p=e=>"image"===e||"url"===e,jp=e=>"length"===e||"size"===e||"bg-size"===e,Fp=e=>"length"===e,Up=e=>"number"===e,Hp=e=>"family-name"===e,Bp=e=>"shadow"===e,Wp=Jg(()=>{const e=tp("color"),t=tp("font"),n=tp("text"),o=tp("font-weight"),i=tp("tracking"),r=tp("leading"),a=tp("breakpoint"),s=tp("container"),l=tp("spacing"),c=tp("radius"),d=tp("shadow"),u=tp("inset-shadow"),h=tp("text-shadow"),m=tp("drop-shadow"),g=tp("blur"),p=tp("perspective"),f=tp("aspect"),v=tp("ease"),y=tp("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Pp,Cp],w=()=>[Pp,Cp,l],x=()=>[dp,"full","auto",...w()],C=()=>[hp,"none","subgrid",Pp,Cp],I=()=>["auto",{span:["full",hp,Pp,Cp]},hp,Pp,Cp],k=()=>[hp,"auto",Pp,Cp],S=()=>["auto","min","max","fr",Pp,Cp],M=()=>["auto",...w()],A=()=>[dp,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],P=()=>[e,Pp,Cp],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",zp,Sp,{position:[Pp,Cp]}],R=()=>["auto","cover","contain",Tp,xp,{size:[Pp,Cp]}],z=()=>[mp,Dp,Ip],T=()=>["","none","full",c,Pp,Cp],E=()=>["",up,Dp,Ip],_=()=>[up,mp,zp,Sp],N=()=>["","none",g,Pp,Cp],O=()=>["none",up,Pp,Cp],L=()=>["none",up,Pp,Cp],$=()=>[up,Pp,Cp],j=()=>[dp,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[gp],breakpoint:[gp],color:[pp],container:[gp],"drop-shadow":[gp],ease:["in","out","in-out"],font:[wp],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[gp],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[gp],shadow:[gp],spacing:["px",up],text:[gp],"text-shadow":[gp],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",dp,Cp,Pp,f]}],container:["container"],columns:[{columns:[up,Cp,Pp,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:[hp,"auto",Pp,Cp]}],basis:[{basis:[dp,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[up,dp,"auto","initial","none",Cp]}],grow:[{grow:["",up,Pp,Cp]}],shrink:[{shrink:["",up,Pp,Cp]}],order:[{order:[hp,"first","last","none",Pp,Cp]}],"grid-cols":[{"grid-cols":C()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":C()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"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:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[s,"screen",...A()]}],"min-w":[{"min-w":[s,"screen","none",...A()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",n,Dp,Ip]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Pp,kp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",mp,Cp]}],"font-family":[{font:[Rp,Cp,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,Pp,Cp]}],"line-clamp":[{"line-clamp":[up,"none",Pp,kp]}],leading:[{leading:[r,...w()]}],"list-image":[{"list-image":["none",Pp,Cp]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Pp,Cp]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[up,"from-font","auto",Pp,Ip]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[up,"auto",Pp,Cp]}],"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",Pp,Cp]}],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",Pp,Cp]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hp,Pp,Cp],radial:["",Pp,Cp],conic:[hp,Pp,Cp]},Ep,Mp]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"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:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[up,Pp,Cp]}],"outline-w":[{outline:["",up,Dp,Ip]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",d,_p,Ap]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,_p,Ap]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:E()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[up,Ip]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":E()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,_p,Ap]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[up,Pp,Cp]}],"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":[up]}],"mask-image-linear-from-pos":[{"mask-linear-from":_()}],"mask-image-linear-to-pos":[{"mask-linear-to":_()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":_()}],"mask-image-t-to-pos":[{"mask-t-to":_()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":_()}],"mask-image-r-to-pos":[{"mask-r-to":_()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":_()}],"mask-image-b-to-pos":[{"mask-b-to":_()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":_()}],"mask-image-l-to-pos":[{"mask-l-to":_()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":_()}],"mask-image-x-to-pos":[{"mask-x-to":_()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":_()}],"mask-image-y-to-pos":[{"mask-y-to":_()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Pp,Cp]}],"mask-image-radial-from-pos":[{"mask-radial-from":_()}],"mask-image-radial-to-pos":[{"mask-radial-to":_()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[up]}],"mask-image-conic-from-pos":[{"mask-conic-from":_()}],"mask-image-conic-to-pos":[{"mask-conic-to":_()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Pp,Cp]}],filter:[{filter:["","none",Pp,Cp]}],blur:[{blur:N()}],brightness:[{brightness:[up,Pp,Cp]}],contrast:[{contrast:[up,Pp,Cp]}],"drop-shadow":[{"drop-shadow":["","none",m,_p,Ap]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",up,Pp,Cp]}],"hue-rotate":[{"hue-rotate":[up,Pp,Cp]}],invert:[{invert:["",up,Pp,Cp]}],saturate:[{saturate:[up,Pp,Cp]}],sepia:[{sepia:["",up,Pp,Cp]}],"backdrop-filter":[{"backdrop-filter":["","none",Pp,Cp]}],"backdrop-blur":[{"backdrop-blur":N()}],"backdrop-brightness":[{"backdrop-brightness":[up,Pp,Cp]}],"backdrop-contrast":[{"backdrop-contrast":[up,Pp,Cp]}],"backdrop-grayscale":[{"backdrop-grayscale":["",up,Pp,Cp]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[up,Pp,Cp]}],"backdrop-invert":[{"backdrop-invert":["",up,Pp,Cp]}],"backdrop-opacity":[{"backdrop-opacity":[up,Pp,Cp]}],"backdrop-saturate":[{"backdrop-saturate":[up,Pp,Cp]}],"backdrop-sepia":[{"backdrop-sepia":["",up,Pp,Cp]}],"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",Pp,Cp]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[up,"initial",Pp,Cp]}],ease:[{ease:["linear","initial",v,Pp,Cp]}],delay:[{delay:[up,Pp,Cp]}],animate:[{animate:["none",y,Pp,Cp]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,Pp,Cp]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:O()}],"rotate-x":[{"rotate-x":O()}],"rotate-y":[{"rotate-y":O()}],"rotate-z":[{"rotate-z":O()}],scale:[{scale:L()}],"scale-x":[{"scale-x":L()}],"scale-y":[{"scale-y":L()}],"scale-z":[{"scale-z":L()}],"scale-3d":["scale-3d"],skew:[{skew:$()}],"skew-x":[{"skew-x":$()}],"skew-y":[{"skew-y":$()}],transform:[{transform:[Pp,Cp,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:j()}],"translate-x":[{"translate-x":j()}],"translate-y":[{"translate-y":j()}],"translate-z":[{"translate-z":j()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Pp,Cp]}],"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",Pp,Cp]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[up,Dp,Ip,kp]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});var qp=["children","onClick","active","disabled","className","anchorRef"];function Gp(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,qp);return F("button",h({type:"button",ref:c,onClick:n,disabled:a,className:Wp("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 Vp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M9 6l6 6l-6 6"}))},Kp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M15 6l-6 6l6 6"}))},Zp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M6 9l6 6l6 -6"}))},Yp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),F("path",{d:"M21 21l-6 -6"}))},Xp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M18 6l-12 12"}),F("path",{d:"M6 6l12 12"}))},Qp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M7 4h10"}),F("path",{d:"M12 4v8"}),F("defs",null,F("clipPath",{id:"stripeClip"},F("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2"}))),F("rect",{x:"2",y:"12",width:"20",height:"10",rx:"2",fill:"none",stroke:a}),F("g",{"clip-path":"url(#stripeClip)",stroke:l},F("path",{d:"M-7 24l12 -12"}),F("path",{d:"M-3 24l12 -12"}),F("path",{d:"M1 24l12 -12"}),F("path",{d:"M5 24l12 -12"}),F("path",{d:"M9 24l12 -12"}),F("path",{d:"M13 24l12 -12"}),F("path",{d:"M17 24l12 -12"}),F("path",{d:"M21 24l12 -12"}),F("path",{d:"M25 24l12 -12"})))},Jp=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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M6 20h-1a2 2 0 0 1 -2 -2v-1"}),F("path",{d:"M3 13v-3"}),F("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),F("path",{d:"M10 3h3"}),F("path",{d:"M17 3h1a2 2 0 0 1 2 2v1"}),F("defs",null,F("clipPath",{id:"redactClip"},F("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2"}))),F("rect",{x:"10",y:"10",width:"12",height:"12",rx:"2",fill:"none"}),F("g",{"clip-path":"url(#redactClip)",stroke:l},F("path",{d:"M-2 24l14 -14"}),F("path",{d:"M2 24l14 -14"}),F("path",{d:"M6 24l14 -14"}),F("path",{d:"M10 24l15 -15"}),F("path",{d:"M14 24l15 -15"}),F("path",{d:"M18 24l15 -15"})))};var ef={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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),F("path",{d:"M7 11l5 5l5 -5"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 8l16 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2"}),F("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),F("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 8v-2c0 -.551 .223 -1.05 .584 -1.412"}),F("path",{d:"M4 16v2a2 2 0 0 0 2 2h2"}),F("path",{d:"M16 4h2a2 2 0 0 1 2 2v2"}),F("path",{d:"M16 20h2c.545 0 1.04 -.218 1.4 -.572"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M17 9v-4a2 2 0 0 0 -2 -2h-6a2 2 0 0 0 -2 2v4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("path",{d:"M12 10.5v1.5"}),F("path",{d:"M12 16v1.5"}),F("path",{d:"M15.031 12.25l-1.299 .75"}),F("path",{d:"M10.268 15l-1.3 .75"}),F("path",{d:"M15 15.803l-1.285 -.773"}),F("path",{d:"M10.285 12.97l-1.285 -.773"}),F("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"}),F("path",{d:"M9 12h6"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 12v-6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v6"}),F("path",{d:"M10 18h-7"}),F("path",{d:"M21 18h-7"}),F("path",{d:"M6 15l-3 3l3 3"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M12 20h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h6"}),F("path",{d:"M18 14v7"}),F("path",{d:"M18 3v7"}),F("path",{d:"M15 18l3 3l3 -3"}),F("path",{d:"M15 6l3 -3l3 3"}))},chevronRight:Vp,chevronLeft:Kp,chevronDown:Zp,search:Yp,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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M12 11v.01"}),F("path",{d:"M8 11v.01"}),F("path",{d:"M16 11v.01"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),F("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M8 7l4 -4l4 4"}),F("path",{d:"M8 17l4 4l4 -4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M7 8l-4 4l4 4"}),F("path",{d:"M17 8l4 4l-4 4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),F("path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0"}),F("path",{d:"M3 6l0 13"}),F("path",{d:"M12 6l0 13"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M19 4v16h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12z"}),F("path",{d:"M19 16h-12a2 2 0 0 0 -2 2"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M9 6h11"}),F("path",{d:"M12 12h8"}),F("path",{d:"M15 18h5"}),F("path",{d:"M5 6v.01"}),F("path",{d:"M8 12v.01"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 20h16",stroke:a}),F("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),F("path",{d:"M8 10h8",stroke:"currentColor"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("rect",{x:"2",y:"6",width:"20",height:"16",rx:"2",fill:a,stroke:"none"}),F("path",{d:"M8 16v-8a4 4 0 1 1 8 0v8",stroke:"currentColor"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),F("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),F("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}))},x:Xp,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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5"}),F("path",{d:"M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5"}),F("path",{d:"M14 5.5a1.5 1.5 0 0 1 3 0v6.5"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M15 13v4"}),F("path",{d:"M13 15h4"}),F("path",{d:"M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"}),F("path",{d:"M22 22l-3 -3"}),F("path",{d:"M6 18h-1a2 2 0 0 1 -2 -2v-1"}),F("path",{d:"M3 11v-1"}),F("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),F("path",{d:"M10 3h1"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M7 19a2 2 0 0 1 -2 -2"}),F("path",{d:"M5 13v-2"}),F("path",{d:"M5 7a2 2 0 0 1 2 -2"}),F("path",{d:"M11 5h2"}),F("path",{d:"M17 5a2 2 0 0 1 2 2"}),F("path",{d:"M19 11v2"}),F("path",{d:"M19 17v4"}),F("path",{d:"M21 19h-4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M9 14l-4 -4l4 -4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M15 14l4 -4l-4 -4"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 7l16 0"}),F("path",{d:"M10 11l0 6"}),F("path",{d:"M14 11l0 6"}),F("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("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 F("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},F("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"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M20 4l-16 16"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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},F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M14 19v-10.5a3.5 3.5 0 0 1 7 0v10.5"}),F("path",{d:"M14 13h7"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M11 5l6 0"}),F("path",{d:"M7 19l6 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 6l16 0"}),F("path",{d:"M4 12l10 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 6l16 0"}),F("path",{d:"M8 12l8 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M4 6l16 0"}),F("path",{d:"M10 12l10 0"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M11 13h2"}),F("path",{d:"M9 10h6"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M11 15h2"}),F("path",{d:"M9 12h6"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M11 17h2"}),F("path",{d:"M9 14h6"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M15 8h.01"}),F("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"}),F("path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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:Qp,redactArea:Jp,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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M6 20h-1a2 2 0 0 1 -2 -2v-1"}),F("path",{d:"M3 13v-3"}),F("path",{d:"M20 13v-3"}),F("path",{d:"M3 6v-1a2 2 0 0 1 2 -2h1"}),F("path",{d:"M10 3h3"}),F("path",{d:"M17 3h1a2 2 0 0 1 2 2v1"}),F("path",{d:"M8 8h8"}),F("path",{d:"M12 8v7"}),F("defs",null,F("clipPath",{id:"redactCombinedClip"},F("rect",{x:"10",y:"18",width:"13",height:"6",rx:"2"}))),F("rect",{x:"10",y:"17",width:"13",height:"6",rx:"2",fill:"none"}),F("g",{"clip-path":"url(#redactCombinedClip)",stroke:l},F("path",{d:"M6 19l12 -12"}),F("path",{d:"M6 23l12 -12"}),F("path",{d:"M10 23l12 -12"}),F("path",{d:"M14 27l12 -12"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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 F("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&&F("title",null,l),F("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),F("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 F("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&&F("title",null,l),F("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),F("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 F("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},F("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),F("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 F("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},F("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),F("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 F("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},F("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"}),F("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),F("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 F("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},F("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),F("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 F("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},F("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"}),F("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 F("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},F("circle",{cx:"12",cy:"12",r:"10"}),F("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M9 15l6 -6"}),F("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M9 15l3 -3m2 -2l1 -1"}),F("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.072 7.071l-.534 .464"}),F("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"}),F("path",{d:"M3 3l18 18"}))},externalLink:function(e){return F("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},F("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),F("path",{d:"M11 13l9 -9"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M17 20h6"}),F("path",{d:"M20 17v6"}),F("path",{d:"M4 13v-2"}),F("path",{d:"M4 6v-1a1 1 0 0 1 1 -1h1"}),F("path",{d:"M6 20h-1a1 1 0 0 1 -1 -1v-1"}),F("path",{d:"M11 4h2"}),F("path",{d:"M11 20h2"}),F("path",{d:"M18 4h1a1 1 0 0 1 1 1v1"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("path",{d:"M3 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("path",{d:"M17 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("path",{d:"M17 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}),F("path",{d:"M5 7v10"}),F("path",{d:"M19 7v10"}),F("path",{d:"M7 5h10"}),F("path",{d:"M7 19h10"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("rect",{x:"4",y:"4",width:"7",height:"7",rx:"1"}),F("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 F("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},F("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),F("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"}),F("path",{d:"M15 4v16"}),F("path",{d:"M7 8h5"}),F("path",{d:"M7 11h5"}),F("path",{d:"M7 14h4"}))}},tf=new Map,nf=/^[MmZzLlHhVvCcSsQqTtAa0-9\s,.\-eE]+$/;function of(e){return nf.test(e.trim())}function rf(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({x:e,y:e}),ff={left:"right",right:"left",bottom:"top",top:"bottom"},vf={start:"end",end:"start"};function yf(e,t,n){return hf(e,uf(t,n))}function bf(e,t){return"function"==typeof e?e(t):e}function wf(e){return e.split("-")[0]}function xf(e){return e.split("-")[1]}function Cf(e){return"x"===e?"y":"x"}function If(e){return"y"===e?"height":"width"}const kf=new Set(["top","bottom"]);function Sf(e){return kf.has(wf(e))?"y":"x"}function Mf(e){return Cf(Sf(e))}function Af(e){return e.replace(/start|end/g,e=>vf[e])}const Pf=["left","right"],Df=["right","left"],Rf=["top","bottom"],zf=["bottom","top"];function Tf(e,t,n,o){const i=xf(e);let r=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Df:Pf:t?Pf:Df;case"left":case"right":return t?Rf:zf;default:return[]}}(wf(e),"start"===n,o);return i&&(r=r.map(e=>e+"-"+i),t&&(r=r.concat(r.map(Af)))),r}function Ef(e){return e.replace(/left|right|bottom|top/g,e=>ff[e])}function _f(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 Nf(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 Of(e,t,n){let{reference:o,floating:i}=e;const r=Sf(t),a=Mf(t),s=If(a),l=wf(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(xf(t)){case"start":m[a]-=h*(n&&c?-1:1);break;case"end":m[a]+=h*(n&&c?-1:1)}return m}async function Lf(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}=bf(t,e),g=_f(m),p=s[h?"floating"===u?"reference":"floating":u],f=Nf(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=Nf(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 $f=new Set(["left","top"]);function jf(){return"undefined"!=typeof window}function Ff(e){return Bf(e)?(e.nodeName||"").toLowerCase():"#document"}function Uf(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Hf(e){var t;return null==(t=(Bf(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Bf(e){return!!jf()&&(e instanceof Node||e instanceof Uf(e).Node)}function Wf(e){return!!jf()&&(e instanceof Element||e instanceof Uf(e).Element)}function qf(e){return!!jf()&&(e instanceof HTMLElement||e instanceof Uf(e).HTMLElement)}function Gf(e){return!(!jf()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Uf(e).ShadowRoot)}const Vf=new Set(["inline","contents"]);function Kf(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=av(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Vf.has(i)}const Zf=new Set(["table","td","th"]);function Yf(e){return Zf.has(Ff(e))}const Xf=[":popover-open",":modal"];function Qf(e){return Xf.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Jf=["transform","translate","scale","rotate","perspective"],ev=["transform","translate","scale","rotate","perspective","filter"],tv=["paint","layout","strict","content"];function nv(e){const t=ov(),n=Wf(e)?av(e):e;return Jf.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||ev.some(e=>(n.willChange||"").includes(e))||tv.some(e=>(n.contain||"").includes(e))}function ov(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const iv=new Set(["html","body","#document"]);function rv(e){return iv.has(Ff(e))}function av(e){return Uf(e).getComputedStyle(e)}function sv(e){return Wf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lv(e){if("html"===Ff(e))return e;const t=e.assignedSlot||e.parentNode||Gf(e)&&e.host||Hf(e);return Gf(t)?t.host:t}function cv(e){const t=lv(e);return rv(t)?e.ownerDocument?e.ownerDocument.body:e.body:qf(t)&&Kf(t)?t:cv(t)}function dv(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=cv(e),r=i===(null==(o=e.ownerDocument)?void 0:o.body),a=Uf(i);if(r){const e=uv(a);return t.concat(a,a.visualViewport||[],Kf(i)?i:[],e&&n?dv(e):[])}return t.concat(i,dv(i,[],n))}function uv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hv(e){const t=av(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=qf(e),r=i?e.offsetWidth:n,a=i?e.offsetHeight:o,s=mf(n)!==r||mf(o)!==a;return s&&(n=r,o=a),{width:n,height:o,$:s}}function mv(e){return Wf(e)?e:e.contextElement}function gv(e){const t=mv(e);if(!qf(t))return pf(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=hv(t);let a=(r?mf(n.width):n.width)/o,s=(r?mf(n.height):n.height)/i;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const pv=pf(0);function fv(e){const t=Uf(e);return ov()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:pv}function vv(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=mv(e);let a=pf(1);t&&(o?Wf(o)&&(a=gv(o)):a=gv(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Uf(e))&&t}(r,n,o)?fv(r):pf(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=Uf(r),t=o&&Wf(o)?Uf(o):o;let n=e,i=uv(n);for(;i&&o&&t!==n;){const e=gv(i),t=i.getBoundingClientRect(),o=av(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=Uf(i),i=uv(n)}}return Nf({width:d,height:u,x:l,y:c})}function yv(e,t){const n=sv(e).scrollLeft;return t?t.left+n:vv(Hf(e)).left+n}function bv(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-yv(e,n),y:n.top+t.scrollTop}}const wv=new Set(["absolute","fixed"]);function xv(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=Uf(e),o=Hf(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=ov();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}const c=yv(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=Hf(e),n=sv(e),o=e.ownerDocument.body,i=hf(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=hf(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+yv(e);const s=-n.scrollTop;return"rtl"===av(o).direction&&(a+=hf(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:a,y:s}}(Hf(e));else if(Wf(t))o=function(e,t){const n=vv(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=qf(e)?gv(e):pf(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=fv(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Nf(o)}function Cv(e,t){const n=lv(e);return!(n===t||!Wf(n)||rv(n))&&("fixed"===av(n).position||Cv(n,t))}function Iv(e,t,n){const o=qf(t),i=Hf(t),r="fixed"===n,a=vv(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const l=pf(0);function c(){l.x=yv(i)}if(o||!o&&!r)if(("body"!==Ff(t)||Kf(i))&&(s=sv(t)),o){const e=vv(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?pf(0):bv(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 kv(e){return"static"===av(e).position}function Sv(e,t){if(!qf(e)||"fixed"===av(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Hf(e)===n&&(n=n.ownerDocument.body),n}function Mv(e,t){const n=Uf(e);if(Qf(e))return n;if(!qf(e)){let t=lv(e);for(;t&&!rv(t);){if(Wf(t)&&!kv(t))return t;t=lv(t)}return n}let o=Sv(e,t);for(;o&&Yf(o)&&kv(o);)o=Sv(o,t);return o&&rv(o)&&kv(o)&&!nv(o)?n:o||function(e){let t=lv(e);for(;qf(t)&&!rv(t);){if(nv(t))return t;if(Qf(t))return null;t=lv(t)}return null}(e)||n}const Av={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r="fixed"===i,a=Hf(o),s=!!t&&Qf(t.floating);if(o===a||s&&r)return n;let l={scrollLeft:0,scrollTop:0},c=pf(1);const d=pf(0),u=qf(o);if((u||!u&&!r)&&(("body"!==Ff(o)||Kf(a))&&(l=sv(o)),qf(o))){const e=vv(o);c=gv(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}const h=!a||u||r?pf(0):bv(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:Hf,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[..."clippingAncestors"===n?Qf(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=dv(e,[],!1).filter(e=>Wf(e)&&"body"!==Ff(e)),i=null;const r="fixed"===av(e).position;let a=r?lv(e):e;for(;Wf(a)&&!rv(a);){const t=av(a),n=nv(a);n||"fixed"!==t.position||(i=null),(r?!n&&!i:!n&&"static"===t.position&&i&&wv.has(i.position)||Kf(a)&&!n&&Cv(e,a))?o=o.filter(e=>e!==a):i=t,a=lv(a)}return t.set(e,o),o}(t,this._c):[].concat(n),o],a=r[0],s=r.reduce((e,n)=>{const o=xv(t,n,i);return e.top=hf(o.top,e.top),e.right=uf(o.right,e.right),e.bottom=uf(o.bottom,e.bottom),e.left=hf(o.left,e.left),e},xv(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Mv,getElementRects:async function(e){const t=this.getOffsetParent||Mv,n=this.getDimensions,o=await n(e.floating);return{reference:Iv(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}=hv(e);return{width:t,height:n}},getScale:gv,isElement:Wf,isRTL:function(e){return"rtl"===av(e).direction}};function Pv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dv(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=mv(e),d=i||r?[...c?dv(c):[],...dv(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=Hf(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:-gf(u)+"px "+-gf(i.clientWidth-(d+h))+"px "+-gf(i.clientHeight-(u+m))+"px "+-gf(d)+"px",threshold:hf(0,uf(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||Pv(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?vv(e):null;return l&&function t(){const o=vv(e);p&&!Pv(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 Rv=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=wf(n),s=xf(n),l="y"===Sf(n),c=$f.has(a)?-1:1,d=r&&l?-1:1,u=bf(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}}}}},zv=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}=bf(e,t),d={x:n,y:o},u=await r.detectOverflow(t,c),h=Sf(wf(i)),m=Cf(h);let g=d[m],p=d[h];if(a){const e="y"===m?"bottom":"right";g=yf(g+u["y"===m?"top":"left"],g,g-u[e])}if(s){const e="y"===h?"bottom":"right";p=yf(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}}}}}},Tv=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}=bf(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const v=wf(i),y=Sf(s),b=wf(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=h||(b||!p?[Ef(s)]:function(e){const t=Ef(e);return[Af(e),t,Af(t)]}(s)),C="none"!==g;!h&&C&&x.push(...Tf(s,p,g,w));const I=[s,...x],k=await l.detectOverflow(t,f),S=[];let M=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&S.push(k[v]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=xf(e),i=Mf(e),r=If(i);let a="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=Ef(a)),[a,Ef(a)]}(i,a,w);S.push(k[e[0]],k[e[1]])}if(M=[...M,{placement:i,overflows:S}],!S.every(e=>e<=0)){var A,P;const e=((null==(A=r.flip)?void 0:A.index)||0)+1,t=I[e];if(t){if(!("alignment"===u&&y!==Sf(t))||M.every(e=>Sf(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:M},reset:{placement:t}}}let n=null==(P=M.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:P.placement;if(!n)switch(m){case"bestFit":{var D;const e=null==(D=M.filter(e=>{if(C){const t=Sf(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:D[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},Ev=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}=bf(e,t)||{};if(null==c)return{};const u=_f(d),h={x:n,y:o},m=Mf(i),g=If(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],C=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let I=C?C[b]:0;I&&await(null==a.isElement?void 0:a.isElement(C))||(I=s.floating[b]||r.floating[g]);const k=w/2-x/2,S=I/2-p[g]/2-1,M=uf(u[v],S),A=uf(u[y],S),P=M,D=I-p[g]-A,R=I/2-p[g]/2+k,z=yf(P,R,D),T=!l.arrow&&null!=xf(i)&&R!==z&&r.reference[g]/2-(R