PageSourceSearch

https://wealthy-technology-dev.io/assets/index-ff13f960.js

js wealthy-technology-dev.io collected 2026-10-03 21:16:57 UTC 175,301 bytes, 178 lines download raw bytes

1import{r as M,a as s,j as a,P as Le,aZ as Be,aT as Rr,aG as Fr,b as Ie,e as Oe,Z as Or,u as Dn,d as Kt,_ as V,B as he,R as hn,H as ot,a_ as Tt,F as $e,X as jr,L as Br}from"./index-1cf826c3.js";import{S as ut}from"./Spinner-b42c1562.js";import"./index.es-99337f7a.js";import{D as Ar}from"./details-952bd718.js";import"./index-2b4f54d9.js";import"./sweetalert2.esm.all-6f4c742c.js";import{C as Vr}from"./Container-0495666d.js";import{R as Ge,C as je}from"./Col-56364f32.js";import{B as Ur}from"./ButtonGroup-fb2f9e55.js";import{C as Ve}from"./Card-9f44b81d.js";import{C as We}from"./CardBody-4ee248c2.js";import{C as xt}from"./CardHeader-89245433.js";import{C as zn}from"./CardTitle-fda4c374.js";import{P as Rt}from"./Progress-e37f6c0d.js";import{T as Wr}from"./Table-065bd331.js";import{I as nt}from"./Input-fd614982.js";import{A as Re}from"./Alert-096761d8.js";import{U as kt}from"./UncontrolledTooltip-0c6b7e51.js";import{D as Hr,g as Kr,a as Gr}from"./documentTypes-ce7281bd.js";import{M as Tn,a as Ln,b as $n}from"./ModalBody-2ca50a8b.js";import{M as Rn}from"./ModalFooter-b88c8919.js";import{L as Zr,a as ct}from"./ListGroupItem-f4468d16.js";import{a as qr}from"./DeviceDocumentEditor-4fb79481.js";import{R as Yr}from"./refresh-cw-c82725e2.js";import{I as Xr}from"./inbox-25f21a43.js";import{a as Fn}from"./more-vertical-e7a6600b.js";import{F as dt}from"./file-text-62948a6f.js";import{L as Lt}from"./Label-1d996193.js";import{u as Jr}from"./index-5afb6486.js";import{U as gn}from"./upload-cc6af778.js";import{R as Qr}from"./refresh-cw-2d926f6f.js";import{D as eo}from"./download-cloud-7732b700.js";import{F as to}from"./folder-open-cb015e76.js";import{P as vn}from"./plus-de8d5a8b.js";import{T as no}from"./trash-2-cc09035f.js";import{C as ro}from"./circle-x-59dfdc75.js";import{A as bt}from"./alert-circle-2d27ecde.js";import{E as oo}from"./edit-c2e1c8e2.js";import{F as bn}from"./file-9336d3f7.js";import{U as io}from"./upload-d7d5b56e.js";import{C as ao}from"./clock-30800bc6.js";import"./emotion-memoize.esm-c1dc0059.js";import"./MarkdownRenderer-6890185d.js";import"./index.modern-bf0cd344.js";import"./Fade-a84d8c9c.js";import"./Tooltip-73854bc5.js";import"./collaborationApi-3aa8c973.js";import"./index-6dc08eac.js";import"./index-27ff77ac.js";import"./index-544ef2fc.js";import"./send-0a1872bc.js";import"./arrow-left-b7f71b8a.js";import"./list-17c25fb0.js";import"./download-dd119785.js";import"./check-circle-d420bee4.js";import"./alert-triangle-e22a26c7.js";import"./search-1eebcbda.js";typeof globalThis<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);function lo(e,n){if(e==null)return{};var t=co(e,n),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o])}return t}function co(e,n){if(e==null)return{};var t={},o=Object.keys(e),r,i;for(i=0;i<o.length;i++)r=o[i],!(n.indexOf(r)>=0)&&(t[r]=e[r]);return t}var Gt=M.forwardRef(function(e,n){var t=e.color,o=t===void 0?"currentColor":t,r=e.size,i=r===void 0?24:r,l=lo(e,["color","size"]);return s("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...l,children:[a("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),a("polyline",{points:"12 5 19 12 12 19"})]})});Gt.propTypes={color:Le.string,size:Le.oneOfType([Le.string,Le.number])};Gt.displayName="ArrowRight";const so=Gt;function uo(e,n){if(e==null)return{};var t=mo(e,n),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o])}return t}function mo(e,n){if(e==null)return{};var t={},o=Object.keys(e),r,i;for(i=0;i<o.length;i++)r=o[i],!(n.indexOf(r)>=0)&&(t[r]=e[r]);return t}var Zt=M.forwardRef(function(e,n){var t=e.color,o=t===void 0?"currentColor":t,r=e.size,i=r===void 0?24:r,l=uo(e,["color","size"]);return s("svg",{ref:n,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...l,children:[a("polyline",{points:"23 4 23 10 17 10"}),a("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})});Zt.propTypes={color:Le.string,size:Le.oneOfType([Le.string,Le.number])};Zt.displayName="RotateCw";const fo=Zt;var On={exports:{}},yt={},jn={exports:{}},Bn={};(function(e){var n=Be;function t(w){var b=Object.create(null);
1return w&&Object.keys(w).forEach(function(f){if(f!=="default"){var N=Object.getOwnPropertyDescriptor(w,f);Object.defineProperty(b,f,N.get?N:{enumerable:!0,get:function(){return w[f]}})}}),b.default=w,Object.freeze(b)}var o,r=t(M),i=function(){return r.createElement(n.Icon,{size:16},r.createElement("path",{d:`M11.5,5.5v-2C11.5,2.672,12.172,2,13,2s1.5,0.672,1.5,1.5v2 M14.5,11.5v-6C14.5,4.672,15.172,4,16,4
2            c0.828,0,1.5,0.672,1.5,1.5v3 M17.5,13V8.5C17.5,7.672,18.172,7,19,7s1.5,0.672,1.5,1.5v10c0,2.761-2.239,5-5,5h-3.335
3            c-1.712-0.001-3.305-0.876-4.223-2.321C6.22,18.467,4.083,14,4.083,14c-0.378-0.545-0.242-1.292,0.303-1.67
4            c0.446-0.309,1.044-0.281,1.458,0.07L8.5,15.5v-10C8.5,4.672,9.172,4,10,4s1.5,0.672,1.5,1.5v6`}))},l=function(){return l=Object.assign||function(w){for(var b,f=1,N=arguments.length;f<N;f++)for(var k in b=arguments[f])Object.prototype.hasOwnProperty.call(b,k)&&(w[k]=b[k]);return w},l.apply(this,arguments)};e.SelectionMode=void 0,(o=e.SelectionMode||(e.SelectionMode={})).Hand="Hand",o.Text="Text";var c=function(){return r.createElement(n.Icon,{size:16},r.createElement("path",{d:`M13.675,11.671l2.941-2.941c0.195-0.196,0.195-0.512-0.001-0.707C16.563,7.971,16.5,7.931,16.43,7.906
5            L4.168,3.527C3.908,3.434,3.622,3.57,3.529,3.83c-0.039,0.109-0.039,0.228,0,0.336l4.379,12.262
6            c0.093,0.26,0.379,0.396,0.639,0.303c0.07-0.025,0.133-0.065,0.185-0.117l2.943-2.943l6.146,6.146c0.195,0.195,0.512,0.195,0.707,0
7            l1.293-1.293c0.195-0.195,0.195-0.512,0-0.707L13.675,11.671z`}))},m=function(w){var b=w.children,f=w.mode,N=w.onClick,k=r.useContext(n.LocalizationContext).l10n,S="",ae=r.createElement(c,null);switch(f){case e.SelectionMode.Hand:S=k&&k.selectionMode?k.selectionMode.handTool:"Hand tool",ae=r.createElement(i,null);break;case e.SelectionMode.Text:default:S=k&&k.selectionMode?k.selectionMode.textSelectionTool:"Text selection tool",ae=r.createElement(c,null)}return b({icon:ae,label:S,onClick:N})},g={left:0,top:8},h=function(w){var b=w.isSelected,f=w.mode,N=w.onClick,k="";switch(f){case e.SelectionMode.Hand:k="selection-mode__hand-button";break;case e.SelectionMode.Text:default:k="selection-mode__text-button"}return r.createElement(m,{mode:f,onClick:N},function(S){return r.createElement(n.Tooltip,{ariaControlsSuffix:"selection-mode-switch",position:n.Position.BottomCenter,target:r.createElement(n.MinimalButton,{ariaLabel:S.label,isSelected:b,testId:k,onClick:S.onClick},S.icon),content:function(){return S.label},offset:g})})},C=function(w){var b=w.children,f=w.mode,N=w.store,k=f===N.get("selectionMode");return(b||function(S){return r.createElement(h,{isSelected:k,mode:S.mode,onClick:S.onClick})})({isSelected:k,mode:f,onClick:function(){return N.update("selectionMode",f)}})},p=function(w){var b=w.isSelected,f=w.mode,N=w.onClick,k="";switch(f){case e.SelectionMode.Hand:k="selection-mode__hand-menu";break;case e.SelectionMode.Text:default:k="selection-mode__text-menu"}return r.createElement(m,{mode:f,onClick:N},function(S){return r.createElement(n.MenuItem,{checked:b,icon:S.icon,testId:k,onClick:S.onClick},S.label)})},y=function(w){var b=w.store,f=r.useRef(null),N=r.useState(e.SelectionMode.Text),k=N[0],S=N[1],ae=r.useRef({top:0,left:0,x:0,y:0}),me=function(Z){var F=f.current;F&&(F.scrollTop=ae.current.top-(Z.clientY-ae.current.y),F.scrollLeft=ae.current.left-(Z.clientX-ae.current.x))},ce=function(){var Z=f.current;Z&&(Z.classList.add("rpv-selection-mode__grab"),Z.classList.remove("rpv-selection-mode__grabbing"),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",ce))},Ce=function(Z){var F=f.current;F&&k!==e.SelectionMode.Text&&(F.classList.remove("rpv-selection-mode__grab"),F.classList.add("rpv-selection-mode__grabbing"),Z.preventDefault(),Z.stopPropagation(),ae.current={left:F.scrollLeft,top:F.scrollTop,x:Z.clientX,y:Z.clientY},document.addEventListener("mousemove",me),document.addEventListener("mouseup",ce))},_e=function(Z){f.current=Z()},se=function(Z){S(Z)};return r.useEffect(function(){var Z=f.current;if(Z)return k===e.SelectionMode.Hand?Z.classList.add("rpv-selection-mode__grab"):Z.classList.remove("rpv-selection-mode__grab"),Z.addEventListener("mousedown",Ce),function(){Z.removeEventListener("mousedown",Ce)}},[k]),r.useEffect(function(){return b.subscribe("getPagesContainer",_e),b.subscribe("selectionMode",se),function(){b.unsubscribe("getPagesContainer",_e),b.unsubscribe("selectionMode",se)}},[]),r.createElement(r.Fragment,null)};e.HandToolIcon=i,e.TextSelectionIcon=c,e.selectionModePlugin=function(w){var b=r.useMemo(function(){return n.createStore(
7)},[]),f=function(N){return r.createElement(C,l({},N,{store:b}))};return{install:function(N){b.update("selectionMode",w&&w.selectionMode?w.selectionMode:e.SelectionMode.Text),b.update("getPagesContainer",N.getPagesContainer)},renderViewer:function(N){var k=N.slot;return k.subSlot&&k.subSlot.children&&(k.subSlot.children=r.createElement(r.Fragment,null,r.createElement(y,{store:b}),k.subSlot.children)),k},SwitchSelectionMode:f,SwitchSelectionModeButton:function(N){return r.createElement(f,{mode:N.mode},function(k){return r.createElement(h,{isSelected:k.isSelected,mode:k.mode,onClick:function(){k.onClick()}})})},SwitchSelectionModeMenuItem:function(N){return r.createElement(f,{mode:N.mode},function(k){return r.createElement(p,{isSelected:k.isSelected,mode:k.mode,onClick:function(){k.onClick(),N.onClick()}})})}}}})(Bn);/**
8 * A React component to view a PDF document
9 *
10 * @see https://react-pdf-viewer.dev
11 * @license https://react-pdf-viewer.dev/license
12 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
13 */jn.exports=Bn;var po=jn.exports,An={exports:{}},Et={},ie=Be;function ho(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var $=ho(M),qt=function(){return $.createElement(ie.Icon,{size:16},$.createElement("path",{d:"M11.5 23.499L11.5 14.499"}),$.createElement("path",{d:"M7.5 18.499L11.5 14.499 15.5 18.499"}),$.createElement("path",{d:"M11.5 1.499L11.5 10.499"}),$.createElement("path",{d:"M7.5 6.499L11.5 10.499 15.5 6.499"}),$.createElement("path",{d:"M20.5 12.499L1.5 12.499"}))},Yt=function(){return $.createElement(ie.Icon,{size:16},$.createElement("path",{d:"M0.5 12L23.5 12"}),$.createElement("path",{d:"M11.5 1L11.5 23"}),$.createElement("path",{d:"M8.5 4L11.5 1 14.5 4"}),$.createElement("path",{d:"M20.5 9L23.5 12 20.5 15"}),$.createElement("path",{d:"M3.5 15L0.5 12 3.5 9"}),$.createElement("path",{d:"M14.5 20L11.5 23 8.5 20"}))},_t=function(){return _t=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},_t.apply(this,arguments)},go={left:0,top:8},Vn=function(e){var n=e.enableShortcuts,t=e.onClick,o=$.useContext(ie.LocalizationContext).l10n,r=o&&o.fullScreen?o.fullScreen.enterFullScreen:"Full screen",i=n?ie.isMac()?"Meta+Ctrl+F":"F11":"";return $.createElement(ie.Tooltip,{ariaControlsSuffix:"full-screen-enter",position:ie.Position.BottomCenter,target:$.createElement(ie.MinimalButton,{ariaKeyShortcuts:i,ariaLabel:r,isDisabled:!ie.isFullScreenEnabled(),testId:"full-screen__enter-button",onClick:t},$.createElement(Yt,null)),content:function(){return r},offset:go})},vo={left:0,top:8},bo=function(e){var n=e.onClick,t=$.useContext(ie.LocalizationContext).l10n,o=t&&t.fullScreen?t.fullScreen.exitFullScreen:"Exit full screen";return $.createElement(ie.Tooltip,{ariaControlsSuffix:"full-screen-exit",position:ie.Position.BottomCenter,target:$.createElement(ie.MinimalButton,{ariaKeyShortcuts:"Esc",ariaLabel:o,testId:"full-screen__exit-button-with-tooltip",onClick:n},$.createElement(qt,null)),content:function(){return o},offset:vo})},Xt=function(e,n){var t=$.useState(n.get("fullScreenMode")),o=t[0],r=t[1],i=$.useCallback(function(l){r(l)},[]);return $.useEffect(function(){return n.subscribe("fullScreenMode",i),function(){n.unsubscribe("fullScreenMode",i)}},[]),{enterFullScreen:function(){var l=n.get("getPagesContainer");if(l){var c=e(l());n.get("enterFullScreenMode")(c)}},exitFullScreen:function(){n.get("exitFullScreenMode")()},isFullScreen:o===ie.FullScreenMode.Entering||o===ie.FullScreenMode.EnteredCompletely}},yo=function(e){var n=e.children,t=e.enableShortcuts,o=e.getFullScreenTarget,r=e.store,i=Xt(o,r),l=i.enterFullScreen,c=i.exitFullScreen,m=i.isFullScreen;return(n||function(g){return m?$.createElement(bo,{onClick:g.onClick}):$.createElement(Vn,{enableShortcuts:t,onClick:g.onClick})})({onClick:m?c:l})},Eo=function(e){var n=e.onClick,t=$.useContext(ie.LocalizationContext).l10n,o=t&&t.fullScreen?t.fullScreen.enterFullScreen:"Full screen";return $.createElement(ie.MenuItem,{icon:$.createElement(Yt,null),isDisabled:!ie.isFullScreenEnabled(),testId:"full-screen__enter-menu",onClick:n},o)},Co=function(e){var n=e.onClick,t=$.useContext(ie.LocalizationContext).l10n,o=$.useContext(ie.ThemeContext).direction===ie.TextDirection.RightToLeft,r=t&&t.fullScreen?t.fullScreen.exitFullScreen:"Exit full screen";return $.createElement("div",{className:ie.classNames({"rpv-full-screen__exit-button":!0,"rpv-full-screen__exit-button--ltr":!o,"rpv-full-screen__exit-button--rtl":o})},$.createElement(ie.MinimalButton,{ariaLabel:r,testId:"full-screen__exit-button",onClick:n},$.createElement(qt,null)))},So=function(e){var n=e.children,t=e.getFullScreenTarget,o=e.store,r=Xt(t,o),i=r.enterFullScreen,l=r.exitFullScreen,c=r.isFullScreen;return c&&(n||function(m){return $.createElement(Co,{onClick:m.onClick})})({onClick:c?l:i})},wo=function(e){var n=e.store,t=e.onEnterFullScreen,o=e.onExitFullScreen,r=$.useState(n.get("fullScreenMode")),i=r[0],l=r[1],c=$.useCallback(function(m){l(m)},[]);return $.useEffect(function(){switch(i){case ie.FullScreenMode.EnteredCompletely:t(n.get("zoom"));break;case ie.FullScreenMode.Exited:o(n.get("zoom"))}},[i]),$.useEffect(function(){return n.subscribe("fullScreenMode",c),function(){n.unsubscribe("fullScreenMode",c)}},[]),(i===ie.FullScreenMode.Entering||i===ie.FullScreenMode.Entered)&&$.createElement("div",{className:"rpv-full-screen__overlay"},$.createElement(ie.Spinner,null))},xo=function(e){var n=e.containerRef,t=e.getFullScreenTarget,o=e.store,r=Xt(t,o).enterFullScreen,i=function(l){if(!l.shiftKey&&!l.altKey&&
13(ie.isMac()?l.metaKey&&l.ctrlKey&&l.key==="f":l.key==="F11")){var c=n.current;c&&document.activeElement&&c.contains(document.activeElement)&&(l.preventDefault(),r())}};return $.useEffect(function(){if(n.current)return document.addEventListener("keydown",i),function(){document.removeEventListener("keydown",i)}},[n.current]),$.createElement($.Fragment,null)};Et.ExitFullScreenIcon=qt,Et.FullScreenIcon=Yt,Et.fullScreenPlugin=function(e){var n=(e==null?void 0:e.getFullScreenTarget)||function(l){return l},t=$.useMemo(function(){return Object.assign({},{enableShortcuts:!0,onEnterFullScreen:function(){},onExitFullScreen:function(){}},e)},[]),o=$.useMemo(function(){return ie.createStore({enterFullScreenMode:function(){},exitFullScreenMode:function(){},fullScreenMode:ie.FullScreenMode.Normal,zoom:function(){}})},[]),r=function(l){return $.createElement(yo,_t({},l,{enableShortcuts:t.enableShortcuts,getFullScreenTarget:n,store:o}))},i=function(){return $.createElement(So,{getFullScreenTarget:n,store:o},e==null?void 0:e.renderExitFullScreenButton)};return{install:function(l){o.update("enterFullScreenMode",l.enterFullScreenMode),o.update("exitFullScreenMode",l.exitFullScreenMode),o.update("getPagesContainer",l.getPagesContainer),o.update("zoom",l.zoom)},onViewerStateChange:function(l){return o.update("fullScreenMode",l.fullScreenMode),l},renderViewer:function(l){var c=l.slot;return c.subSlot&&(c.subSlot.children=$.createElement($.Fragment,null,t.enableShortcuts&&$.createElement(xo,{containerRef:l.containerRef,getFullScreenTarget:n,store:o}),$.createElement(wo,{store:o,onEnterFullScreen:t.onEnterFullScreen,onExitFullScreen:t.onExitFullScreen}),$.createElement(i,null),c.subSlot.children)),c},EnterFullScreen:r,EnterFullScreenButton:function(){return $.createElement(r,null,function(l){return $.createElement(Vn,_t({enableShortcuts:t.enableShortcuts},l))})},EnterFullScreenMenuItem:function(l){return $.createElement(r,null,function(c){return $.createElement(Eo,{onClick:function(){c.onClick(),l.onClick()}})})}}};/**
14 * A React component to view a PDF document
15 *
16 * @see https://react-pdf-viewer.dev
17 * @license https://react-pdf-viewer.dev/license
18 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
19 */An.exports=Et;var ko=An.exports,Un={exports:{}},Ft={},Ye=Be;function _o(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var Me=_o(M),Jt=function(){return Me.createElement(Ye.Icon,{size:16},Me.createElement("path",{d:"M5.5,11.5c-.275,0-.341.159-.146.354l6.292,6.293a.5.5,0,0,0,.709,0l6.311-6.275c.2-.193.13-.353-.145-.355L15.5,11.5V1.5a1,1,0,0,0-1-1h-5a1,1,0,0,0-1,1V11a.5.5,0,0,1-.5.5Z"}),Me.createElement("path",{d:"M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4"}))},Mt=function(){return Mt=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Mt.apply(this,arguments)},Mo={left:0,top:8},Wn=function(e){var n=e.onClick,t=Me.useContext(Ye.LocalizationContext).l10n,o=t&&t.download?t.download.download:"Download";return Me.createElement(Ye.Tooltip,{ariaControlsSuffix:"get-file",position:Ye.Position.BottomCenter,target:Me.createElement(Ye.MinimalButton,{ariaLabel:o,testId:"get-file__download-button",onClick:n},Me.createElement(Jt,null)),content:function(){return o},offset:Mo})},Hn=function(e,n){var t=document.createElement("a");t.style.display="none",t.href=e,t.setAttribute("download",n),document.body.appendChild(t),t.click(),document.body.removeChild(t)},yn=function(e,n,t){var o=URL.createObjectURL(new Blob([e],{type:t}));Hn(o,n),o&&URL.revokeObjectURL(o)},No=function(e,n){e.getData().then(function(t){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?yn(t,n,"application/octet-stream"):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?Hn("data:application/pdf;base64,".concat(function(o){return btoa(Array(o.length).fill("").map(function(r,i){return String.fromCharCode(o[i])}).join(""))}(t)),n):yn(t,n,"application/pdf")})},Po=function(e){var n=e.children,t=e.fileNameGenerator,o=e.store,r=Me.useState(o.get("file")),i=r[0],l=r[1],c=Me.useState(o.get("doc")),m=c[0],g=c[1],h=function(p){g(p)},C=function(p){l(p)};return Me.useEffect(function(){return o.subscribe("doc",h),o.subscribe("file",C),function(){o.subscribe("doc",h),o.unsubscribe("file",C)}},[]),(n||function(p){return Me.createElement(Wn,{onClick:p.onClick})})({onClick:function(){m&&i&&No(m,t(i))}})},Io=function(e){var n=e.onClick,t=Me.useContext(Ye.LocalizationContext).l10n,o=t&&t.download?t.download.download:"Download";return Me.createElement(Ye.MenuItem,{icon:Me.createElement(Jt,null),testId:"get-file__download-menu",onClick:n},o)};Ft.DownloadIcon=Jt,Ft.getFilePlugin=function(e){var n=Me.useMemo(function(){return Ye.createStore({})},[]),t=function(r){return r.name?(i=r.name,(l=i.split("/").pop())?l.split("#")[0].split("?")[0]:i):"document.pdf";var i,l},o=function(r){return Me.createElement(Po,Mt({},r,{fileNameGenerator:e&&e.fileNameGenerator||t,store:n}))};return{onDocumentLoad:function(r){n.update("doc",r.doc),n.update("file",r.file)},Download:o,DownloadButton:function(){return Me.createElement(o,null,function(r){return Me.createElement(Wn,Mt({},r))})},DownloadMenuItem:function(r){return Me.createElement(o,null,function(i){return Me.createElement(Io,{onClick:function(){i.onClick(),r.onClick()}})})}}};/**
20 * A React component to view a PDF document
21 *
22 * @see https://react-pdf-viewer.dev
23 * @license https://react-pdf-viewer.dev/license
24 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
25 */Un.exports=Ft;var Do=Un.exports,Kn={exports:{}},Ot={},Ke=Be;function zo(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var le=zo(M),Qt=function(){return le.createElement(Ke.Icon,{size:16},le.createElement("path",{d:"M18.5,7.5c.275,0,.341-.159.146-.354L12.354.854a.5.5,0,0,0-.708,0L5.354,7.147c-.2.195-.129.354.146.354h3v10a1,1,0,0,0,1,1h5a1,1,0,0,0,1-1V7.5Z"}),le.createElement("path",{d:"M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4"}))},mt=function(){return mt=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},mt.apply(this,arguments)},Gn=function(e){var n=le.useRef(),t=function(){var r=n.current;r&&(r.click(),e.get("triggerOpenFile")&&e.update("triggerOpenFile",!1))},o=function(r){r&&t()};return le.useEffect(function(){return e.subscribe("triggerOpenFile",o),function(){e.unsubscribe("triggerOpenFile",o)}},[]),{inputRef:n,openFile:t}},To={left:0,top:8},Lo=function(e){var n=e.enableShortcuts,t=e.store,o=e.onClick,r=le.useContext(Ke.LocalizationContext).l10n,i=r&&r.open?r.open.openFile:"Open file",l=Gn(t),c=l.inputRef,m=l.openFile,g=n?Ke.isMac()?"Meta+O":"Ctrl+O":"";return le.createElement(Ke.Tooltip,{ariaControlsSuffix:"open",position:Ke.Position.BottomCenter,target:le.createElement("div",{className:"rpv-open__input-wrapper"},le.createElement("input",{accept:".pdf",ref:c,className:"rpv-open__input",multiple:!1,tabIndex:-1,title:"",type:"file",onChange:o}),le.createElement(Ke.MinimalButton,{ariaKeyShortcuts:g,ariaLabel:i,testId:"open__button",onClick:m},le.createElement(Qt,null))),content:function(){return i},offset:To})},$o=function(e){var n=e.children,t=e.enableShortcuts,o=e.store;return(n||function(r){return le.createElement(Lo,{enableShortcuts:t,store:o,onClick:r.onClick})})({onClick:function(r){var i=r.target.files;if(i&&i.length){var l=o.get("openFile");l&&l(i[0])}}})},Ro=function(e){var n=e.store,t=e.onClick,o=le.useContext(Ke.LocalizationContext).l10n,r=o&&o.open?o.open.openFile:"Open file",i=Gn(n),l=i.inputRef,c=i.openFile;return le.createElement(Ke.MenuItem,{icon:le.createElement(Qt,null),testId:"open__menu",onClick:c},le.createElement("div",{className:"rpv-open__input-wrapper"},le.createElement("input",{accept:".pdf",ref:l,className:"rpv-open__input",multiple:!1,tabIndex:-1,title:"",type:"file",onChange:t}),r))},Fo=function(e){var n=e.containerRef,t=e.store,o=function(r){if(!r.shiftKey&&!r.altKey&&r.key==="o"&&(Ke.isMac()?r.metaKey:r.ctrlKey)){var i=n.current;i&&document.activeElement&&i.contains(document.activeElement)&&(r.preventDefault(),t.update("triggerOpenFile",!0))}};return le.useEffect(function(){if(n.current)return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o)}},[n.current]),le.createElement(le.Fragment,null)};Ot.OpenFileIcon=Qt,Ot.openPlugin=function(e){var n=le.useMemo(function(){return Object.assign({},{enableShortcuts:!0},e)},[]),t=le.useMemo(function(){return Ke.createStore({})},[]),o=function(r){return le.createElement($o,mt({enableShortcuts:n.enableShortcuts},r,{store:t}))};return{install:function(r){t.update("openFile",r.openFile)},renderViewer:function(r){var i=r.slot,l={children:le.createElement(le.Fragment,null,n.enableShortcuts&&le.createElement(Fo,{containerRef:r.containerRef,store:t}),i.children)};return mt(mt({},i),l)},Open:o,OpenButton:function(){return le.createElement(o,null)},OpenMenuItem:function(){return le.createElement(o,null,function(r){return le.createElement(Ro,{store:t,onClick:r.onClick})})}}};/**
26 * A React component to view a PDF document
27 *
28 * @see https://react-pdf-viewer.dev
29 * @license https://react-pdf-viewer.dev/license
30 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
31 */Kn.exports=Ot;var Oo=Kn.exports,Zn={exports:{}},it={},te=Be;function jo(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var x=jo(M),en=function(){return x.createElement(te.Icon,{size:16},x.createElement("path",{d:`M2.32,2.966h19.452c0.552,0.001,1,0.449,0.999,1.001c0,0.182-0.05,0.36-0.144,0.516L12.9,20.552
32            c-0.286,0.472-0.901,0.624-1.373,0.338c-0.138-0.084-0.254-0.2-0.338-0.338L1.465,4.483C1.179,4.01,1.331,3.396,1.804,3.11
33            C1.96,3.016,2.138,2.966,2.32,2.966z`}))},tn=function(){return x.createElement(te.Icon,{size:16},x.createElement("path",{d:`M0.541,5.627L11.666,18.2c0.183,0.207,0.499,0.226,0.706,0.043c0.015-0.014,0.03-0.028,0.043-0.043
34            L23.541,5.627`}))},Fe=function(){return Fe=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Fe.apply(this,arguments)},rt=function(e){var n=x.useState(e.get("currentPage")||0),t=n[0],o=n[1],r=function(i){o(i)};return te.useIsomorphicLayoutEffect(function(){return e.subscribe("currentPage",r),function(){e.unsubscribe("currentPage",r)}},[]),{currentPage:t}},gt=function(e){var n=x.useState(e.get("numberOfPages")||0),t=n[0],o=n[1],r=function(i){o(i)};return x.useEffect(function(){return e.subscribe("numberOfPages",r),function(){e.unsubscribe("numberOfPages",r)}},[]),{numberOfPages:t}},Bo=function(e){var n=e.store,t=x.useContext(te.LocalizationContext).l10n,o=x.use
34State("1"),r=o[0],i=o[1],l=rt(n).currentPage,c=gt(n).numberOfPages;x.useEffect(function(){return i("".concat(l+1))},[l]);var m=function(h){var C=n.get("jumpToPage");C&&C(h)},g=t&&t.pageNavigation?t.pageNavigation.enterPageNumber:"Enter a page number";return x.createElement("span",{className:"rpv-page-navigation__current-page-input"},x.createElement(te.TextBox,{ariaLabel:g,testId:"page-navigation__current-page-input",type:"text",value:r,onChange:i,onKeyDown:function(h){switch(h.key){case"ArrowUp":(y=l-1)>=0&&(i("".concat(y+1)),m(y));break;case"ArrowDown":(p=l+1)<c&&(i("".concat(p+1)),m(p));break;case"Enter":C=parseInt(r,10),r===""||C<1||C>c?i("".concat(l+1)):m(C-1)}var C,p,y}}))},Ao=function(e){var n=e.children,t=e.doc,o=te.useIsMounted(),r=x.useState({loading:!0,labels:[]}),i=r[0],l=r[1];return x.useEffect(function(){t.getPageLabels().then(function(c){o.current&&l({loading:!1,labels:c||[]})})},[t.loadingTask.docId]),i.loading?x.createElement(x.Fragment,null):n(i.labels)},Vo=function(e){var n=e.children,t=e.store,o=function(c){var m=x.useState(c.get("doc")),g=m[0],h=m[1],C=function(p){h(p)};return x.useEffect(function(){return c.subscribe("doc",C),function(){c.unsubscribe("doc",C)}},[]),g}(t),r=rt(t).currentPage,i=gt(t).numberOfPages,l=n||function(c){return x.createElement(x.Fragment,null,c.currentPage+1)};return o?x.createElement(Ao,{doc:o},function(c){var m=c.length===i&&i>0?c[r]:"";return l({currentPage:r,numberOfPages:i,pageLabel:m})}):x.createElement(x.Fragment,null)},nn=function(){return x.createElement(te.Icon,{size:16},x.createElement("path",{d:`M21.783,21.034H2.332c-0.552,0-1-0.448-1-1c0-0.182,0.05-0.361,0.144-0.517L11.2,3.448
35            c0.286-0.472,0.901-0.624,1.373-0.338c0.138,0.084,0.254,0.2,0.338,0.338l9.726,16.069c0.286,0.473,0.134,1.087-0.339,1.373
36            C22.143,20.984,21.965,21.034,21.783,21.034z`}))},Uo={left:0,top:8},qn=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToFirstPage:"First page";return x.createElement(te.Tooltip,{ariaControlsSuffix:"page-navigation-first",position:te.Position.BottomCenter,target:x.createElement(te.MinimalButton,{ariaLabel:r,isDisabled:n,testId:"page-navigation__first-button",onClick:t},x.createElement(nn,null)),content:function(){return r},offset:Uo})},Wo=function(e){var n=e.children,t=e.store;return(n||function(o){return x.createElement(qn,{isDisabled:o.isDisabled,onClick:o.onClick})})({isDisabled:rt(t).currentPage===0,onClick:function(){var o=t.get("jumpToPage");o&&o(0)}})},Ho=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToFirstPage:"First page";return x.createElement(te.MenuItem,{icon:x.createElement(nn,null),isDisabled:n,testId:"page-navigation__first-menu",onClick:t},r)},Ko={left:0,top:8},Yn=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToLastPage:"Last page";return x.createElement(te.Tooltip,{ariaControlsSuffix:"page-navigation-last",position:te.Position.BottomCenter,target:x.createElement(te.MinimalButton,{ariaLabel:r,isDisabled:n,testId:"page-navigation__last-button",onClick:t},x.createElement(en,null)),content:function(){return r},offset:Ko})},Go=function(e){var n=e.children,t=e.store,o=rt(t).currentPage,r=gt(t).numberOfPages;return(n||function(i){return x.createElement(Yn,{isDisabled:i.isDisabled,onClick:i.onClick})})({isDisabled:o+1>=r,onClick:function(){var i=t.get("jumpToPage");i&&i(r-1)}})},Zo=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToLastPage:"Last page";return x.createElement(te.MenuItem,{icon:x.createElement(en,null),isDisabled:n,testId:"page-navigation__last-menu",onClick:t},r)},qo={left:0,top:8},Xn=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToNextPage:"Next page";return x.createElement(te.Tooltip,{ariaControlsSuffix:"page-navigation-next",position:te.Position.BottomCenter,target:x.createElement(te.MinimalButton,{ariaLabel:r,isDisabled:n,testId:"page-navigation__next-button",onClick:t},x.createElement(tn,null)),content:function(){return r},offset:qo})},Yo=function(e){var n=e.children,t=e.store;return(n||function(o){return x.createElement(Xn,{onClick:o.onClick,isDisabled:o.isDisabled})})({isDisabled:rt(t).currentPage+1>=gt(t).numberOfPages,onClick:function(){var o=t.get("jumpToNextPage");o&&o()}})},Xo=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToNextPage:"Next page";return x.createElement(te.MenuItem,{icon:x.createElement(tn,null),isDisabled:n,testId:"page-navigation__next-menu",onClick:t},r)},rn=function(){return x.createElement(te.Icon,{size:16},x.createElement("path",{d:`M23.535,18.373L12.409,5.8c-0.183-0.207-0.499-0.226-0.706-0.043C11.688,5.77,11.674,5.785,11.66,5.8
37            L0.535,18.373`}))},Jo={left:0,top:8},Jn=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToPreviousPage:"Previous page";
37return x.createElement(te.Tooltip,{ariaControlsSuffix:"page-navigation-previous",position:te.Position.BottomCenter,target:x.createElement(te.MinimalButton,{ariaLabel:r,isDisabled:n,testId:"page-navigation__previous-button",onClick:t},x.createElement(rn,null)),content:function(){return r},offset:Jo})},Qo=function(e){var n=e.store;return(e.children||function(t){return x.createElement(Jn,{isDisabled:t.isDisabled,onClick:t.onClick})})({isDisabled:rt(n).currentPage<=0,onClick:function(){var t=n.get("jumpToPreviousPage");t&&t()}})},ei=function(e){var n=e.isDisabled,t=e.onClick,o=x.useContext(te.LocalizationContext).l10n,r=o&&o.pageNavigation?o.pageNavigation.goToPreviousPage:"Previous page";return x.createElement(te.MenuItem,{icon:x.createElement(rn,null),isDisabled:n,testId:"page-navigation__previous-menu",onClick:t},r)},ti=function(e){var n=e.children,t=e.store,o=gt(t).numberOfPages;return n?n({numberOfPages:o}):x.createElement(x.Fragment,null,o)},ni=function(e){var n=e.containerRef,t=e.numPages,o=e.store,r=rt(o).currentPage,i=x.useRef(r);i.current=r;var l=x.useRef(!1),c=function(){l.current=!0},m=function(){l.current=!1},g=function(h){var C=n.current,p=l.current||document.activeElement&&C.contains(document.activeElement);if(C&&p){var y,w,b=h.altKey&&h.key==="ArrowDown"||!h.shiftKey&&!h.altKey&&h.key==="PageDown",f=h.altKey&&h.key==="ArrowUp"||!h.shiftKey&&!h.altKey&&h.key==="PageUp";if(b)return h.preventDefault(),y=o.get("jumpToPage"),w=i.current+1,void(y&&w<t&&y(w));if(f)return h.preventDefault(),void function(){var N=o.get("jumpToPage"),k=i.current-1;N&&k>=0&&N(k)}();if(te.isMac()?h.metaKey&&!h.ctrlKey:h.altKey)switch(h.key){case"ArrowLeft":h.preventDefault(),function(){var N=o.get("jumpToPreviousDestination");N&&N()}();break;case"ArrowRight":h.preventDefault(),function(){var N=o.get("jumpToNextDestination");N&&N()}()}}};return x.useEffect(function(){var h=n.current;if(h)return document.addEventListener("keydown",g),h.addEventListener("mouseenter",c),h.addEventListener("mouseleave",m),function(){document.removeEventListener("keydown",g),h.removeEventListener("mouseenter",c),h.removeEventListener("mouseleave",m)}},[n.current]),x.createElement(x.Fragment,null)};it.DownArrowIcon=en,it.NextIcon=tn,it.PreviousIcon=rn,it.UpArrowIcon=nn,it.pageNavigationPlugin=function(e){var n=x.useMemo(function(){return Object.assign({},{enableShortcuts:!0},e)},[]),t=x.useMemo(function(){return te.createStore()},[]),o=function(c){return x.createElement(Wo,Fe({},c,{store:t}))},r=function(c){return x.createElement(Go,Fe({},c,{store:t}))},i=function(c){return x.createElement(Yo,Fe({},c,{store:t}))},l=function(c){return x.createElement(Qo,Fe({},c,{store:t}))};return{install:function(c){t.update("jumpToDestination",c.jumpToDestination),t.update("jumpToNextDestination",c.jumpToNextDestination),t.update("jumpToNextPage",c.jumpToNextPage),t.update("jumpToPage",c.jumpToPage),t.update("jumpToPreviousDestination",c.jumpToPreviousDestination),t.update("jumpToPreviousPage",c.jumpToPreviousPage)},renderViewer:function(c){var m=c.slot;if(!n.enableShortcuts)return m;var g={children:x.createElement(x.Fragment,null,x.createElement(ni,{containerRef:c.containerRef,numPages:c.doc.numPages,store:t}),m.children)};return Fe(Fe({},m),g)},onDocumentLoad:function(c){t.update("doc",c.doc),t.update("numberOfPages",c.doc.numPages)},onViewerStateChange:function(c){return t.update("currentPage",c.pageIndex),c},jumpToNextPage:function(){var c=t.get("jumpToNextPage");c&&c()},jumpToPage:function(c){var m=t.get("jumpToPage");m&&m(c)},jumpToPreviousPage:function(){var c=t.get("jumpToPreviousPage");c&&c()},CurrentPageInput:function(){return x.createElement(Bo,{store:t})},CurrentPageLabel:function(c){return x.createElement(Vo,Fe({},c,{store:t}))},GoToFirstPage:o,GoToFirstPageButton:function(){return x.createElement(o,null,function(c){return x.createElement(qn,Fe({},c))})},GoToFirstPageMenuItem:function(c){return x.createElement(o,null,function(m){return x.createElement(Ho,{isDisabled:m.isDisabled,onClick:function(){m.onClick(),c.onClick()}})})},GoToLastPage:r,GoToLastPageButton:function(){return x.createElement(r,
37null,function(c){return x.createElement(Yn,Fe({},c))})},GoToLastPageMenuItem:function(c){return x.createElement(r,null,function(m){return x.createElement(Zo,{isDisabled:m.isDisabled,onClick:function(){m.onClick(),c.onClick()}})})},GoToNextPage:i,GoToNextPageButton:function(){return x.createElement(i,null,function(c){return x.createElement(Xn,Fe({},c))})},GoToNextPageMenuItem:function(c){return x.createElement(i,null,function(m){return x.createElement(Xo,{isDisabled:m.isDisabled,onClick:function(){m.onClick(),c.onClick()}})})},GoToPreviousPage:l,GoToPreviousPageButton:function(){return x.createElement(l,null,function(c){return x.createElement(Jn,Fe({},c))})},GoToPreviousPageMenuItem:function(c){return x.createElement(l,null,function(m){return x.createElement(ei,{isDisabled:m.isDisabled,onClick:function(){m.onClick(),c.onClick()}})})},NumberOfPages:function(c){return x.createElement(ti,Fe({},c,{store:t}))}}};/**
38 * A React component to view a PDF document
39 *
40 * @see https://react-pdf-viewer.dev
41 * @license https://react-pdf-viewer.dev/license
42 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
43 */Zn.exports=it;var Qn=Zn.exports,er={exports:{}},tt={},ke=Be,ri=M,oi=Rr;function ii(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var ze,D=ii(ri),on=function(){return D.createElement(ke.Icon,{size:16},D.createElement("path",{d:`M7.5,19.499h9 M7.5,16.499h9 M5.5,16.5h-3c-1.103-0.003-1.997-0.897-2-2v-6c0.003-1.103,0.897-1.997,2-2h19
44            c1.103,0.003,1.997,0.897,2,2v6c-0.003,1.103-0.897,1.997-2,2h-3
45            M5.5,4.5v-4h9.586c0.265,0,0.52,0.105,0.707,0.293l2.414,2.414
46            C18.395,3.394,18.5,3.649,18.5,3.914V4.5
47            M18.5,22.5c0,0.552-0.448,1-1,1h-11c-0.552,0-1-0.448-1-1v-9h13V22.5z
48            M3.5,8.499
49            c0.552,0,1,0.448,1,1s-0.448,1-1,1s-1-0.448-1-1S2.948,8.499,3.5,8.499z
50            M14.5,0.499v4h4`}))},at=function(){return at=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},at.apply(this,arguments)},ai={left:0,top:8},tr=function(e){var n=e.enableShortcuts,t=e.onClick,o=D.useContext(ke.LocalizationContext).l10n,r=o&&o.print?o.print.print:"Print",i=n?ke.isMac()?"Meta+P":"Ctrl+P":"";return D.createElement(ke.Tooltip,{ariaControlsSuffix:"print",position:ke.Position.BottomCenter,target:D.createElement(ke.MinimalButton,{ariaKeyShortcuts:i,ariaLabel:r,testId:"print__button",onClick:t},D.createElement(on,null)),content:function(){return r},offset:ai})};(function(e){e.CheckingPermission="CheckingPermission",e.Inactive="Inactive",e.Preparing="Preparing",e.Cancelled="Cancelled",e.Ready="Ready"})(ze||(ze={}));var li=function(e){var n=e.children,t=e.enableShortcuts,o=e.store;return(n||tr)({enableShortcuts:t,onClick:function(){o.update("printStatus",ze.CheckingPermission)}})},ci=function(e){var n=e.doc,t=e.store,o=D.useContext(ke.LocalizationContext).l10n,r=D.useState(!0),i=r[0],l=r[1];return D.useEffect(function(){n.getPermissions().then(function(c){c===null||c.includes(4)||c.includes(2048)?t.update("printStatus",ze.Preparing):l(!1)})},[]),i?D.createElement(D.Fragment,null):D.createElement(ke.Modal,{ariaControlsSuffix:"print-permission",closeOnClickOutside:!1,closeOnEscape:!1,content:function(c){return D.createElement(D.Fragment,null,D.createElement("div",{className:"rpv-print__permission-body"},o&&o.print?o.print.disallowPrint:"The document does not allow to print"),D.createElement("div",{className:"rpv-print__permission-footer"},D.createElement(ke.Button,{onClick:function(){c(),t.update("printStatus",ze.Cancelled)}},o&&o.print?o.print.close:"Close")))},isOpened:!0})},si=function(e){var n=e.numLoadedPages,t=e.numPages,o=e.onCancel,r=D.useContext(ke.LocalizationContext).l10n,i=D.useContext(ke.ThemeContext).direction===ke.TextDirection.RightToLeft,l=Math.floor(100*n/t);return D.createElement("div",{className:"rpv-print__progress"},D.createElement("div",{className:ke.classNames({"rpv-print__progress-body":!0,"rpv-print__progress-body--rtl":i})},D.createElement("div",{className:"rpv-print__progress-message"},r&&r.print?r.print.preparingDocument:"Preparing document ..."),D.createElement("div",{className:"rpv-print__progress-bar"},D.createElement(ke.ProgressBar,{progress:l})),D.createElement(ke.Button,{onClick:o},r&&r.print?r.print.cancel:"Cancel")))},ui=function(e){var n=e.canvas,t=e.page,o=e.pageHeight,r=e.pageIndex,i=e.pageWidth,l=e.rotation,c=e.onLoad,m=ke.useIsMounted(),g=D.useRef(),h=D.use
50State(""),C=h[0],p=h[1],y=D.useMemo(function(){return typeof Fr<"u"&&{}.JEST_WORKER_ID!==void 0},[]);return D.useEffect(function(){var w=g.current;w&&w.cancel();var b=150/72;n.height=Math.floor(o*b),n.width=Math.floor(i*b);var f=n.getContext("2d");f.save(),f.fillStyle="rgb(255, 255, 255)",f.fillRect(0,0,n.width,n.height),f.restore();var N=t.getViewport({rotation:l,scale:1});g.current=t.render({canvasContext:f,intent:"print",transform:[b,0,0,b,0,0],viewport:N}),g.current.promise.then(function(){"toBlob"in n&&"createObjectURL"in URL?n.toBlob(function(k){m.current&&p(URL.createObjectURL(k)),y&&c()}):(m.current&&p(n.toDataURL()),y&&c())},function(){})},[]),C&&D.createElement("div",{className:"rpv-print__page"},D.createElement("img",{"data-testid":"print__thumbnail-".concat(r),src:C,onLoad:function(){y||c()}}))},di=function(e){var n=e.canvas,t=e.doc,o=e.pageIndex,r=e.pageRotation,i=e.pageSize,l=e.rotation,c=e.shouldRender,m=e.onLoad,g=ke.useIsMounted(),h=D.useState(null),C=h[0],p=h[1],y=Math.abs(l+r)%180==0;D.useEffect(function(){c&&ke.getPage(t,o).then(function(b){g.current&&p(b)})},[c]);var w=(i.rotation+l+r)%360;return C&&D.createElement(ui,{canvas:n,page:C,pageHeight:y?i.pageHeight:i.pageWidth,pageIndex:o,pageWidth:y?i.pageWidth:i.pageHeight,rotation:w,onLoad:m})},mi=function(e){var n=e.doc,t=e.numLoadedPages,o=e.pagesRotation,r=e.pageSizes,i=e.printPages,l=e.printStatus,c=e.rotation,m=e.onCancel,g=e.onLoad,h=D.useMemo(function(){return document.createElement("canvas")},[]),C=D.useMemo(function(){var w=document.querySelector(".rpv-print__zone");if(w)return w;var b=document.createElement("div");return b.classList.add("rpv-print__zone"),b.setAttribute("data-testid","print__zone"),document.body.appendChild(b),b},[]);D.useEffect(function(){l===ze.Ready&&(document.documentElement.classList.add("rpv-print__html-printing"),document.body.classList.add("rpv-print__body-printing"),window.print());var w=function(){if(l===ze.Ready){document.documentElement.classList.remove("rpv-print__html-printing"),document.body.classList.remove("rpv-print__body-printing");var b=document.querySelectorAll(".rpv-print__zone");b&&b.forEach(function(f){f.parentElement.removeChild(f)}),h.height=0,h.width=0,document.removeEventListener("mousemove",w),m()}};return document.addEventListener("mousemove",w),function(){return document.removeEventListener("mousemove",w)}},[l]);var p=r[0].pageHeight,y=r[0].pageWidth;return oi.createPortal(D.createElement(D.Fragment,null,i.map(function(w,b){return D.createElement(di,{key:w,canvas:h,doc:n,pageIndex:w,pageRotation:o.has(w)?o.get(w):0,pageSize:r[w],rotation:c,shouldRender:b===t,onLoad:g})}),D.createElement("style",{dangerouslySetInnerHTML:{__html:"@page { size: ".concat(y,"pt ").concat(p,"pt }")}})),C)},fi=function(e){var n=e.doc,t=e.pagesRotation,o=e.pageSizes,r=e.renderProgressBar,i=e.rotation,l=e.setPages,c=e.store,m=D.useState(ze.Inactive),g=m[0],h=m[1],C=D.useState(0),p=C[0],y=C[1],w=D.useMemo(function(){var k=n.numPages;return l(n).filter(function(S){return S>=0&&S<k})},[n,l]),b=w.length,f=function(){y(0),h(ze.Inactive)},N=function(k){return h(k)};return D.useEffect(function(){return c.subscribe("printStatus",N),function(){c.unsubscribe("printStatus",N)}},[]),D.createElement(D.Fragment,null,g===ze.CheckingPermission&&D.createElement(ci,{doc:n,store:c}),g===ze.Preparing&&(r?r(p,b,f):D.createElement(si,{numLoadedPages:p,numPages:b,onCancel:f})),(g===ze.Preparing||g===ze.Ready)&&p<=b&&D.createElement(mi,{doc:n,numLoadedPages:p,pagesRotation:t,pageSizes:o,printPages:w,printStatus:g,rotation:i,onCancel:f,onLoad:function(){var k=p+1;k<=b&&(y(k),k===b&&h(ze.Ready))}}))},pi=function(e){var n=e.onClick,t=D.useContext(ke.LocalizationContext).l10n,o=t&&t.print?t.print.print:"Print";return D.createElement(ke.MenuItem,{icon:D.createElement(on,null),testId:"print__menu",onClick:n},o)},hi=function(e){var n=e.containerRef,t=e.store,o=function(r){if(!r.shiftKey&&!r.altKey&&r.key==="p"&&(ke.isMac()?r.metaKey:r.ctrlKey)){var i=n.current;i&&document.activeElement&&i.contains(document.activeElement)&&(r.preventDefault(),t.update("printStatus",ze.Preparing))}};return D.useEffect(function(){if(n.current)return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o)}},[n.current]),D.createElement(D.Fragment,null)};tt.PrintIcon=on,tt.getAllPagesNumbers=function(e){return Array(e.numPages).fill(0).map(function(n,t){return t})},tt.getCustomPagesNumbers=function(e){return function(n){var t,o=[];return e.replace(/\s+/g,"").split(",").forEach(function(r){var i,l,c=r.split("-").map(function(m){return parseInt(m,10)}).filter(function(m){return Number.isInteger(m)}
50);c.length===1?o.push(c[0]-1):c.length===2&&o.push.apply(o,(i=c[0]-1,l=c[1]-1,Array(l-i+1).fill(0).map(function(m,g){return i+g})))}),(t=o,t.filter(function(r){return t.indexOf(r)===t.lastIndexOf(r)})).filter(function(r){return r>=0&&r<n.numPages})}},tt.getEvenPagesNumbers=function(e){return Array(e.numPages).fill(0).map(function(n,t){return t}).filter(function(n){return(n+1)%2==0})},tt.getOddPagesNumbers=function(e){return Array(e.numPages).fill(0).map(function(n,t){return t}).filter(function(n){return(n+1)%2==1})},tt.printPlugin=function(e){var n=D.useMemo(function(){return Object.assign({},{enableShortcuts:!0,setPages:function(r){return Array(r.numPages).fill(0).map(function(i,l){return l})}},e)},[]),t=D.useMemo(function(){return ke.createStore({printStatus:ze.Inactive})},[]),o=function(r){return D.createElement(li,at({enableShortcuts:n.enableShortcuts},r,{store:t}))};return{print:function(){t.update("printStatus",ze.CheckingPermission)},renderViewer:function(r){var i=r.slot,l={children:D.createElement(D.Fragment,null,n.enableShortcuts&&D.createElement(hi,{containerRef:r.containerRef,store:t}),D.createElement(fi,{doc:r.doc,pagesRotation:r.pagesRotation,pageSizes:r.pageSizes,renderProgressBar:e==null?void 0:e.renderProgressBar,rotation:r.rotation,setPages:n.setPages,store:t}),i.children)};return at(at({},i),l)},Print:o,PrintButton:function(){return D.createElement(o,null,function(r){return D.createElement(tr,at({},r))})},PrintMenuItem:function(r){return D.createElement(o,null,function(i){return D.createElement(pi,{onClick:function(){i.onClick(),r.onClick()}})})},setPages:function(r){n.setPages=r}}};/**
51 * A React component to view a PDF document
52 *
53 * @see https://react-pdf-viewer.dev
54 * @license https://react-pdf-viewer.dev/license
55 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
56 */er.exports=tt;var gi=er.exports,nr={exports:{}},jt={},Te=Be;function vi(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var U=vi(M),an=function(){return U.createElement(Te.Icon,{size:16},U.createElement("path",{d:`M12,1.001c6.075,0,11,4.925,11,11s-4.925,11-11,11s-11-4.925-11-11S5.925,1.001,12,1.001z
57            M14.5,17.005H13
58            c-0.552,0-1-0.448-1-1v-6.5c0-0.276-0.224-0.5-0.5-0.5H10
59            M11.745,6.504L11.745,6.504
60            M11.745,6.5c-0.138,0-0.25,0.112-0.25,0.25
61            S11.607,7,11.745,7s0.25-0.112,0.25-0.25S11.883,6.5,11.745,6.5`}))},pt=function(){return pt=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},pt.apply(this,arguments)},bi=function(e){var n=e.doc,t=e.render,o=U.useState(),r=o[0],i=o[1];return U.useEffect(function(){n.getMetadata().then(function(l){return Promise.resolve(l)}).then(function(l){return n.getDownloadInfo().then(function(c){return Promise.resolve({fileName:l.contentDispositionFilename||"",info:l.info,length:c.length})})}).then(function(l){i(l)})},[]),r?t(r):U.createElement("div",{className:"rpv-properties__loader"},U.createElement(Te.Spinner,null))},Ae=function(e){var n=e.label,t=e.value,o=U.useContext(Te.ThemeContext).direction===Te.TextDirection.RightToLeft;return U.createElement("dl",{className:Te.classNames({"rpv-properties__item":!0,"rpv-properties__item--rtl":o})},U.createElement("dt",{className:"rpv-properties__item-label"},n,":"),U.createElement("dd",{className:"rpv-properties__item-value"},t||"-"))},yi=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),et=function(e,n,t,o){var r=parseInt(e,10);return r>=n&&r<=t?r:o},Ei=function(e){var n=e.doc,t=e.fileName,o=e.onToggle,r=U.useContext(Te.LocalizationContext).l10n,i=function(l){var c=function(m){var g=yi.exec(m);if(!g)return null;var h=parseInt(g[1],10),C=et(g[2],1,12,1)-1,p=et(g[3],1,31,1),y=et(g[4],0,23,0),w=et(g[5],0,59,0),b=et(g[6],0,59,0),f=g[7]||"Z",N=et(g[8],0,23,0),k=et(g[9],0,59,0);switch(f){case"-":y+=N,w+=k;break;case"+":y-=N,w-=k}return new Date(Date.UTC(h,C,p,y,w,b))}(l);return c?"".concat(c.toLocaleDateString(),", ").concat(c.toLocaleTimeString()):""};return U.createElement("div",{className:"rpv-properties__modal"},U.createElement(bi,{doc:n,render:function(l){return U.createElement(U.Fragment,null,U.createElement("div",{className:"rpv-properties__modal-section"},U.createElement(Ae,{label:r&&r.properties?r.properties.fileName:"File name",value:l.fileName||(g=t,h=g.split("/").pop(),h?h.split("#")[0].split("?")[0]:g)}),U.createElement(Ae,{label:r&&r.properties?r.properties.fileSize:"File size",value:(c=l.length,m=Math.floor(Math.log(c)/Math.log(1024)),"".concat((c/Math.pow(1024,m)).toFixed(2)," ").concat(["B","kB","MB","GB","TB"][m]))})),U.createElement(Te.Separator,null),U.createElement("div",{className:"rpv-properties__modal-section"},U.createElement(Ae,{label:r&&r.properties?r.properties.title:"Title",value:l.info.Title}),U.createElement(Ae,{label:r&&r.properties?r.properties.author:"Author",value:l.info.Author}),U.createElement(Ae,{label:r&&r.properties?r.properties.subject:"Subject",value:l.info.Subject}),U.createElement(Ae,{label:r&&r.properties?r.properties.keywords:"Keywords",value:l.info.Keywords}),U.createElement(Ae,{label:r&&r.properties?r.properties.creator:"Creator",value:l.info.Creator}),U.createElement(Ae,{label:r&&r.properties?r.properties.creationDate:"Creation date",value:i(l.info.CreationDate)}),U.createElement(Ae,{label:r&&r.properties?r.properties.modificationDate:"Modification date",value:i(l.info.ModDate)})),U.createElement(Te.Separator,null),U.createElement("div",{className:"rpv-properties__modal-section"},U.createElement(Ae,{label:r&&r.properties?r.properties.pdfProducer:"PDF producer",value:l.info.Producer}),U.createElement(Ae,{label:r&&r.properties?r.properties.pdfVersion:"PDF version",value:l.info.PDFFormatVersion}),U.createElement(Ae,{label:r&&r.properties?r.properties.pageCount:"Page count",value:"".concat(n.numPages)})));var c,m,g,h}}),U.createElement("div",{className:"rpv-properties__modal-footer"},U.createElement(Te.Button,{onClick:o},r&&r.properties?r.properties.close:"Close")))},Ci={left:0,top:8},Si=function(e){var n=e.onClick,t=U.useContext(Te.LocalizationContext).l10n,o=t&&t.properties?t.properties.showProperties:"Show properties";
61return U.createElement(Te.Tooltip,{ariaControlsSuffix:"properties",position:Te.Position.BottomCenter,target:U.createElement(Te.MinimalButton,{ariaLabel:o,testId:"properties__button",onClick:n},U.createElement(an,null)),content:function(){return o},offset:Ci})},En=function(e){var n=e.children,t=e.store,o=function(l){var c=U.useState(l.get("doc")),m=c[0],g=c[1],h=function(C){g(C)};return U.useEffect(function(){return l.subscribe("doc",h),function(){l.unsubscribe("doc",h)}},[]),{currentDoc:m}}(t).currentDoc,r=t.get("fileName")||"",i=n||function(l){return U.createElement(Si,pt({},l))};return o?U.createElement(Te.Modal,{ariaControlsSuffix:"properties",target:function(l){return i({onClick:l})},content:function(l){return U.createElement(Ei,{doc:o,fileName:r,onToggle:l})},closeOnClickOutside:!0,closeOnEscape:!0}):U.createElement(U.Fragment,null)},wi=function(e){var n=e.onClick,t=U.useContext(Te.LocalizationContext).l10n,o=t&&t.properties?t.properties.showProperties:"Show properties";return U.createElement(Te.MenuItem,{icon:U.createElement(an,null),testId:"properties__menu",onClick:n},o)};jt.InfoIcon=an,jt.propertiesPlugin=function(){var e=U.useMemo(function(){return Te.createStore({fileName:""})},[]),n=function(t){return U.createElement(En,pt({},t,{store:e}))};return{onDocumentLoad:function(t){e.update("doc",t.doc)},onViewerStateChange:function(t){return e.update("fileName",t.file.name),t},ShowProperties:n,ShowPropertiesButton:function(){return U.createElement(En,{store:e})},ShowPropertiesMenuItem:function(t){return U.createElement(n,null,function(o){return U.createElement(wi,pt({},o))})}}};/**
62 * A React component to view a PDF document
63 *
64 * @see https://react-pdf-viewer.dev
65 * @license https://react-pdf-viewer.dev/license
66 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
67 */nr.exports=jt;var xi=nr.exports,rr={exports:{}},Ct={},Pe=Be;function ki(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var ge=ki(M),ln=function(){return ge.createElement(Pe.Icon,{ignoreDirection:!0,size:16},ge.createElement("path",{d:`M3.434,10.537c0.141-0.438,0.316-0.864,0.523-1.274
68            M3.069,14.425C3.023,14.053,3,13.679,3,13.305 c0-0.291,0.014-0.579,0.041-0.863
69            M4.389,18.111c-0.341-0.539-0.623-1.112-0.843-1.711
70            M7.163,20.9 c-0.543-0.345-1.048-0.747-1.506-1.2
71            M10.98,22.248c-0.65-0.074-1.29-0.218-1.909-0.431
72            M10,4.25h2 c4.987,0.015,9.017,4.069,9.003,9.055c-0.013,4.581-3.456,8.426-8.008,8.945
73            M13.5,1.75L10,4.25l3.5,2.5`}))},cn=function(){return ge.createElement(Pe.Icon,{ignoreDirection:!0,size:16},ge.createElement("path",{d:`M20.566,10.537c-0.141-0.438-0.316-0.864-0.523-1.274
74            M20.931,14.425C20.977,14.053,21,13.679,21,13.305 c0-0.291-0.014-0.579-0.041-0.863
75            M19.611,18.111c0.341-0.539,0.624-1.114,0.843-1.713
76            M16.837,20.9 c0.543-0.345,1.048-0.747,1.506-1.2
77            M13.02,22.248c0.65-0.074,1.29-0.218,1.909-0.431
78            M14,4.25h-2 c-4.987,0.015-9.017,4.069-9.003,9.055c0.013,4.581,3.456,8.426,8.008,8.945
79            M10.5,1.75l3.5,2.5l-3.5,2.5`}))},lt=function(){return lt=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},lt.apply(this,arguments)},_i={left:0,top:8},Bt=function(e){var n=e.direction,t=e.onClick,o=ge.useContext(Pe.LocalizationContext).l10n,r=o&&o.rotate?o.rotate.rotateBackward:"Rotate counterclockwise",i=o&&o.rotate?o.rotate.rotateForward:"Rotate clockwise",l=n===Pe.RotateDirection.Backward?r:i,c=n===Pe.RotateDirection.Backward?ge.createElement(ln,null):ge.createElement(cn,null);return ge.createElement(Pe.Tooltip,{ariaControlsSuffix:"rotate",position:Pe.Position.BottomCenter,target:ge.createElement(Pe.MinimalButton,{ariaLabel:l,testId:n===Pe.RotateDirection.Backward?"rotate__backward-button":"rotate__forward-button",onClick:t},c),content:function(){return l},offset:_i})},Mi=function(e){var n=e.children,t=e.direction,o=e.store;return(n||function(r){return ge.createElement(Bt,{direction:r.direction,onClick:r.onClick})})({direction:t,onClick:function(){var r=o.get("rotate");r&&r(t)}})},Cn=function(e){var n=e.direction,t=e.onClick,o=ge.useContext(Pe.LocalizationContext).l10n,r=o&&o.rotate?o.rotate.rotateBackward:"Rotate counterclockwise",i=o&&o.rotate?o.rotate.rotateForward:"Rotate clockwise",l=n===Pe.RotateDirection.Backward?r:i,c=n===Pe.RotateDirection.Backward?ge.createElement(ln,null):ge.createElement(cn,null);return ge.createElement(Pe.MenuItem,{icon:c,testId:n===Pe.RotateDirection.Backward?"rotate__backward-menu":"rotate__forward-menu",onClick:t},l)},Ni=function(e){var n=e.children,t=e.store;return n({onRotatePage:function(o,r){var i=t.get("rotatePage");i&&i(o,r)}})};Ct.RotateBackwardIcon=ln,Ct.RotateForwardIcon=cn,Ct.rotatePlugin=function(){var e=ge.useMemo(function(){return Pe.createStore(
79)},[]),n=function(t){return ge.createElement(Mi,lt({},t,{store:e}))};return{install:function(t){e.update("rotate",t.rotate),e.update("rotatePage",t.rotatePage)},Rotate:n,RotateBackwardButton:function(){return ge.createElement(n,{direction:Pe.RotateDirection.Backward},function(t){return ge.createElement(Bt,lt({},t))})},RotateBackwardMenuItem:function(t){return ge.createElement(n,{direction:Pe.RotateDirection.Backward},function(o){return ge.createElement(Cn,{direction:o.direction,onClick:function(){o.onClick(),t.onClick()}})})},RotateForwardButton:function(){return ge.createElement(n,{direction:Pe.RotateDirection.Forward},function(t){return ge.createElement(Bt,lt({},t))})},RotateForwardMenuItem:function(t){return ge.createElement(n,{direction:Pe.RotateDirection.Forward},function(o){return ge.createElement(Cn,{direction:o.direction,onClick:function(){o.onClick(),t.onClick()}})})},RotatePage:function(t){return ge.createElement(Ni,lt({},t,{store:e}))}}};/**
80 * A React component to view a PDF document
81 *
82 * @see https://react-pdf-viewer.dev
83 * @license https://react-pdf-viewer.dev/license
84 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
85 */rr.exports=Ct;var Pi=rr.exports,or={exports:{}},qe={},R=Be;function Ii(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var W=Ii(M),ir=function(){return W.createElement(R.Icon,{size:16},W.createElement("rect",{x:"0.5",y:"0.497",width:"22",height:"22",rx:"1",ry:"1"}),W.createElement("line",{x1:"0.5",y1:"6.497",x2:"22.5",y2:"6.497"}),W.createElement("line",{x1:"11.5",y1:"6.497",x2:"11.5",y2:"22.497"}))},ar=function(){return W.createElement(R.Icon,{size:16},W.createElement("rect",{x:"0.5",y:"0.497",width:"22",height:"22",rx:"1",ry:"1"}),W.createElement("line",{x1:"11.5",y1:"0.497",x2:"11.5",y2:"22.497"}))},lr=function(){return W.createElement(R.Icon,{size:16},W.createElement("path",{d:`M6.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z
86            M14.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z
87            M22.5,21.5 c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z`}))},Nt=function(){return W.createElement(R.Icon,{size:16},W.createElement("rect",{x:"0.5",y:"0.497",width:"22",height:"22",rx:"1",ry:"1"}))},Pt=function(){return Pt=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Pt.apply(this,arguments)},cr=function(e,n){e.get("switchScrollMode")(n);var t=e.get("viewMode");n!==R.ScrollMode.Horizontal&&n!==R.ScrollMode.Wrapped||t===R.ViewMode.SinglePage||e.get("switchViewMode")(R.ViewMode.SinglePage)},At=function(){return W.createElement(R.Icon,{size:16},W.createElement("path",{d:`M23.5,5.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V5.5z
88            M23.5,13.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V13.5z
89            M23.5,21.5 c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V21.5z`}))},sr=function(){return W.createElement(R.Icon,{size:16},W.createElement("path",{d:`M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z
90            M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z
91            M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z
92            M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z`}))},ur=function(e){var n=e.children,t=e.mode,o=e.onClick,r=W.useContext(R.LocalizationContext).l10n,i="",l=W.createElement(At,null);switch(t){case R.ScrollMode.Horizontal:i=r&&r.scrollMode?r.scrollMode.horizontalScrolling:"Horizontal scrolling",l=W.createElement(lr,null);break;case R.ScrollMode.Page:i=r&&r.scrollMode?r.scrollMode.pageScrolling:"Page scrolling",l=W.createElement(Nt,null);break;case R.ScrollMode.Wrapped:i=r&&r.scrollMode?r.scrollMode.wrappedScrolling:"Wrapped scrolling",l=W.createElement(sr,null);break;case R.ScrollMode.Vertical:default:i=r&&r.scrollMode?r.scrollMode.verticalScrolling:"Vertical scrolling",l=W.createElement(At,null)}return n({icon:l,label:i,onClick:o})},Di={left:0,top:8},dr=function(e){var n=e.isDisabled,t=e.isSelected,o=e.mode,r=e.onClick,i="";switch(o){case R.ScrollMode.Horizontal:i="scroll-mode__horizontal-button";break;case R.ScrollMode.Page:i="scroll-mode__page-button";break;case R.ScrollMode.Wrapped:i="scroll-mode__wrapped-button";break;case R.ScrollMode.Vertical:default:i="scroll-mode__vertical-button"}return W.createElement(ur,{mode:o,onClick:r}
92,function(l){return W.createElement(R.Tooltip,{ariaControlsSuffix:"scroll-mode-switch",position:R.Position.BottomCenter,target:W.createElement(R.MinimalButton,{ariaLabel:l.label,isDisabled:n,isSelected:t,testId:i,onClick:l.onClick},l.icon),content:function(){return l.label},offset:Di})})},mr=function(e){var n=W.useState(e.get("scrollMode")||R.ScrollMode.Vertical),t=n[0],o=n[1],r=function(i){o(i)};return W.useEffect(function(){return e.subscribe("scrollMode",r),function(){e.unsubscribe("scrollMode",r)}},[]),{scrollMode:t}},fr=function(e){var n=W.useState(e.get("viewMode")||R.ViewMode.SinglePage),t=n[0],o=n[1],r=function(i){o(i)};return W.useEffect(function(){return e.subscribe("viewMode",r),function(){e.unsubscribe("viewMode",r)}},[]),{viewMode:t}},zi=function(e){var n=e.children,t=e.mode,o=e.store,r=fr(o).viewMode,i=mr(o).scrollMode===t,l=(t===R.ScrollMode.Horizontal||t===R.ScrollMode.Wrapped)&&r!==R.ViewMode.SinglePage;return(n||function(c){return W.createElement(dr,{isDisabled:l,isSelected:i,mode:c.mode,onClick:c.onClick})})({isDisabled:l,isSelected:i,mode:t,onClick:function(){cr(o,t)}})},Ti=function(e){var n=e.isDisabled,t=e.isSelected,o=e.mode,r=e.onClick,i="";switch(o){case R.ScrollMode.Horizontal:i="scroll-mode__horizontal-menu";break;case R.ScrollMode.Page:i="scroll-mode__page-menu";break;case R.ScrollMode.Wrapped:i="scroll-mode__wrapped-menu";break;case R.ScrollMode.Vertical:default:i="scroll-mode__vertical-menu"}return W.createElement(ur,{mode:o,onClick:r},function(l){return W.createElement(R.MenuItem,{checked:t,icon:l.icon,isDisabled:n,testId:i,onClick:l.onClick},l.label)})},pr=function(e,n){e.get("switchViewMode")(n);var t=e.get("scrollMode");t!==R.ScrollMode.Horizontal&&t!==R.ScrollMode.Wrapped||n===R.ViewMode.SinglePage||e.get("switchScrollMode")(R.ScrollMode.Vertical)},hr=function(e){var n=e.children,t=e.mode,o=e.onClick,r=W.useContext(R.LocalizationContext).l10n,i="",l=W.createElement(Nt,null);switch(t){case R.ViewMode.DualPage:i=r&&r.scrollMode?r.scrollMode.dualPage:"Dual page",l=W.createElement(ar,null);break;case R.ViewMode.DualPageWithCover:i=r&&r.scrollMode?r.scrollMode.dualPageCover:"Dual page with cover",l=W.createElement(ir,null);break;case R.ViewMode.SinglePage:default:i=r&&r.scrollMode?r.scrollMode.singlePage:"Single page",l=W.createElement(Nt,null)}return n({icon:l,label:i,onClick:o})},Li={left:0,top:8},gr=function(e){var n=e.isDisabled,t=e.isSelected,o=e.mode,r=e.onClick,i="";switch(o){case R.ViewMode.DualPage:i="view-mode__dual-button";break;case R.ViewMode.DualPageWithCover:i="view-mode__dual-cover-button";break;case R.ViewMode.SinglePage:default:i="view-mode__single-button"}return W.createElement(hr,{mode:o,onClick:r},function(l){return W.createElement(R.Tooltip,{ariaControlsSuffix:"view-mode-switch",position:R.Position.BottomCenter,target:W.createElement(R.MinimalButton,{ariaLabel:l.label,isDisabled:n,isSelected:t,testId:i,onClick:l.onClick},l.icon),content:function(){return l.label},offset:Li})})},$i=function(e){var n=e.children,t=e.mode,o=e.store,r=fr(o).viewMode,i=mr(o).scrollMode,l=r===t,c=(i===R.ScrollMode.Horizontal||i===R.ScrollMode.Wrapped)&&t!==R.ViewMode.SinglePage;return(n||function(m){return W.createElement(gr,{isDisabled:c,isSelected:l,mode:m.mode,onClick:m.onClick})})({isDisabled:c,isSelected:l,mode:t,onClick:function(){pr(o,t)}})},Ri=function(e){var n=e.isDisabled,t=e.isSelected,o=e.mode,r=e.onClick,i="";switch(o){case R.ViewMode.DualPage:i="view-mode__dual-menu";break;case R.ViewMode.DualPageWithCover:i="view-mode__dual-cover-menu";break;case R.ViewMode.SinglePage:default:i="view-mode__single-menu"}return W.createElement(hr,{mode:o,onClick:r},function(l){return W.createElement(R.MenuItem,{checked:t,icon:l.icon,isDisabled:n,testId:i,onClick:l.onClick},l.label)})};qe.DualPageCoverViewModeIcon=ir,qe.DualPageViewModeIcon=ar,qe.HorizontalScrollingIcon=lr,qe.PageScrollingIcon=Nt,qe.VerticalScrollingIcon=At,qe.WrappedScrollingIcon=sr,qe.scrollModePlugin=function(){var e=W.useMemo(function(){return R.createStore({scrollMode:R.ScrollMode.Vertical,viewMode:R.ViewMode.SinglePage,switchScrollMode:function(){},switchViewMode:function(){}})},[]),n=function(o){return W.createElement(zi,Pt({},o,{store:e}))},t=function(o){return W.createElement($i,Pt({},o,{store:e}))};return{install:function(o){e.update("switchScrollMode",o.switchScrollMode),e.update("switchViewMode",o.switchViewMode)},onViewerStateChange:function(o){return e.update("scrollMode",o.scrollMode),e.update("viewMode",o.viewMode),o},switchScrollMode:function(o){cr(e,o)},switchViewMode:function(o){pr(e,o)},SwitchScrollMode:n,SwitchScrollModeButton:function(o){return W.createElement(n,{mode:o.mode},function(r){return W.createElement(dr,{isDisabled:r.isDisabled,isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick()}})})},SwitchScrollModeMenuItem:function(o){return W.createElement(n,{mode:o.mode},function(r){return W.createElement(Ti,{isDisabled:r.isDisabled,isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick(),o.onClick()}})})},SwitchViewMode:t,SwitchViewModeButton:function(o){return W.createElement(t,{mode:o.mode},function(r){return W.createElement(gr,{isDisabled:r.isDisabled,isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick()}})})},SwitchViewModeMenuItem:function(o){return W.createElement(t,{mode:o.mode},function(r){return W.createElement(Ri,{isDisabled:r.isDisabled,isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick(),o.onClick()}})})}}};/**
93 * A React component to view a PDF document
94 *
95 * @see https://react-pdf-viewer.dev
96 * @license https://react-pdf-viewer.dev/license
97 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
98 */or.exports=qe;var Fi=or.exports,vr={exports:{}},st={},X=Be;function Oi(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var _=Oi(M),br=function(){return _.createElement(X.Icon,{size:16},_.createElement("path",{d:`M0.541,5.627L11.666,18.2c0.183,0.207,0.499,0.226,0.706,0.043c0.015-0.014,0.03-0.028,0.043-0.043
99            L23.541,5.627`}))},yr=function(){return _.createElement(X.Icon,{size:16},_.createElement("path",{d:`M23.535,18.373L12.409,5.8c-0.183-0.207-0.499-0.226-0.706-0.043C11.688,5.77,11.674,5.785,11.66,5.8
100            L0.535,18.373`}))},Er=function(){return _.createElement(X.Icon,{ignoreDirection:!0,size:16},_.createElement("path",{d:`M10.5,0.5c5.523,0,10,4.477,10,10s-4.477,10-10,10s-10-4.477-10-10S4.977,0.5,10.5,0.5z
101            M23.5,23.5
102            l-5.929-5.929`}))},Xe=function(){return Xe=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Xe.apply(this,arguments)},ht={keyword:"",regExp:new RegExp(" "),wholeWords:!1},Cr=function(e){return{left:"".concat(e.left,"%"),top:"".concat(e.top,"%"),height:"".concat(e.height,"%"),width:"".concat(e.width,"%")}},ji=function(e){var n=e.index,t=e.area,o=e.onHighlightKeyword,r=_.useRef();return X.useIsomorphicLayoutEffect(function(){var i=r.current;o&&i&&o({highlightEle:i,keyword:t.keyword})},[]),_.createElement("div",{className:"rpv-search__highlight","data-index":n,ref:r,style:Cr(t),title:t.keywordStr.trim()})},Sn=function(e){var n=e.parentNode;n&&n.removeChild(e)},Bi=function(e){var n=e.parentNode;if(n){var t=document.createRange();t.selectNodeContents(e),function(o,r){Sn(o);var i=r.parentNode;i&&i.insertBefore(o,r),Sn(r)}(t.extractContents(),e),n.normalize()}},Ai=function(e,n){return e.top<n.top?-1:e.top>n.top?1:e.left<n.left?-1:e.left>n.left?1:0},Vi=function(e){var n=e.numPages,t=e.pageIndex,o=e.renderHighlights,r=e.store,i=e.onHighlightKeyword,l=_.useRef(),c=_.useCallback(function(O){return _.createElement(_.Fragment,null,O.highlightAreas.map(function(oe,ve){return _.createElement(ji,{index:ve,key:ve,area:oe,onHighlightKeyword:i})}))},[]),m=o||c,g=_.useState(r.get("matchPosition")),h=g[0],C=g[1],p=_.useState(r.get("keyword")||[ht]),y=p[0],w=p[1],b=_.useState({pageIndex:t,scale:1,status:X.LayerRenderStatus.PreRender}),f=b[0],N=b[1],k=_.useRef(null),S=_.useRef([]),ae=_.useState([]),me=ae[0],ce=ae[1],Ce=function(){return!0},_e=_.useCallback(function(){return r.get("targetPageFilter")||Ce},[r.get("targetPageFilter")]),se=function(O){var oe=S.current;if(oe.length===0)return[];var ve=[],Ne=[].slice.call(O.querySelectorAll(".rpv-core__text-layer-text")),De=oe.map(function(be){return be.char}).join("");return y.forEach(function(be){var de=be.keyword;if(de.trim()){for(var Se,ye=be.regExp.flags.indexOf("g")===-1?new RegExp(be.regExp,"".concat(be.regExp.flags,"g")):be.regExp,fe=[];(Se=ye.exec(De))!==null;)fe.push({keyword:ye,startIndex:Se.index,endIndex:ye.lastIndex});fe.map(function(A){return{keyword:A.keyword,indexes:oe.slice(A.startIndex,A.endIndex)}}).forEach(function(A){var Q=A.indexes.reduce(function(ne,re){return ne[re.spanIndex]=(ne[re.spanIndex]||[]).concat([re]),ne},{});Object.values(Q).forEach(function(ne){if(ne.length!==1||ne[0].char.trim()!==""){var re=be.wholeWords?ne.slice(1,-1):ne,d=function(v,I,z,H,j){var T=document.createRange(),K=H.firstChild;if(!K||K.nodeType!==Node.TEXT_NODE)return null;var u=K.textContent.length,P=j[0].charIndexInSpan,q=j.length===1?P:j[j.length-1].charIndexInSpan;if(P>u||q+1>u)return null;T.setStart(K,P),T.setEnd(K,q+1);var B=document.createElement("span");T.surroundContents(B);var G=B.getBoundingClientRect(),Y=z.getBoundingClientRect(),we=Y.height,xe=Y.width,Je=100*(G.left-Y.left)/xe,pn=100*(G.top-Y.top)/we,Ze=100*G.height/we,Qe=100*G.width/xe;return Bi(B),{keyword:I,keywordStr:v,numPages:n,pageIndex:t,left:Je,top:pn,height:Ze,width:Qe,pageHeight:we,pageWidth:xe}}(de,A.keyword,O,Ne[re[0].spanIndex],re);d&&ve.push(d)}})})}}),ve.sort(Ai)},Z=function(O){O&&O.length>0&&w(O)},F=function(O){return C(O)},ue=function(O){if(O.has(t)){var oe=O.get(t);oe&&N({ele:oe.ele,pageIndex:t,scale:oe.scale,status:oe.status})}},J=function(){return y.length===0||y.length===1&&y[0].keyword.trim()===""};return _.useEffect(function(){if(!J()&&f.status===X.LayerRenderStatus.DidRender&&!S.current.length){var O=f.ele,oe=[].slice.call(O.querySelectorAll(".rpv-core__text-layer-text")).map(function(ve){return ve.textContent}).reduce(function(ve,Ne,De){return ve.concat(Ne.split("").map(function(be,de){return{char:be,charIndexInSpan:de,spanIndex:De}}))},[{char:"",charIndexInSpan:0,spanIndex:0}]).slice(1);S.current=oe}},[y,f.status]),_.useEffect(function(){if(!J()&&f.ele&&f.status===X.LayerRenderStatus.DidRender&&_e()({pageIndex:t,numPages:n})){var O=f.ele,oe=se(O);ce(oe)}},[y,h,f.status,S.current]),_.useEffect(function(){J()&&f.ele&&f.status===X.LayerRenderStatus.DidRender&&ce([])},[y,f.status]),_.useEffect(function(){if(me.length!==0){var O=l.current;if(h.pageIndex===t&&O&&f.status===X.LayerRenderStatus.DidRender){var oe=O.querySelector('.rpv-search__highlight[data-index="'.concat(h.matchIndex,'"]'));if(oe){var ve=function(de,Se){for(var ye=de.offsetTop,fe=de.offsetLeft,A=de.parentElement;A&&A!==Se;)ye+=A.offsetTop,fe+=A.offsetLeft,A=A.parentElement;return{left:fe,top:ye}}(oe,O),Ne=ve.left,De=ve.top,be=r.get("jumpToDestination");be&&(be({pageIndex:t,bottomOffset:(O.getBoundingClientRect().height-De)/f.scale,leftOffset:Ne/f.scale,scaleTo:f.scale}),k.current&&k.current.classList.remove("rpv-search__highlight--current"),k.current=oe,oe.classList.add("rpv-search__highlight--current"))}}}},[me,h]),_.useEffect(function(){return r.subscribe("keyword",Z),r.subscribe("matchPosition",F),r.subscribe("renderStatus",ue),function(){r.unsubscribe("keyword",Z),r.unsubscribe("matchPosition",F),r.unsubscribe("renderStatus",ue)}},[]),_.createElement("div",{className:"rpv-search__highlights","data-testid":"search__highlights-".concat(t),ref:l},m({getCssProperties:Cr,highlightAreas:me}))},wn=function(e){var n,t=e.wholeWords?" ".concat(e.keyword," "):e.keyword,o=e.matchCase?"g":"gi";return{keyword:e.keyword,regExp:new RegExp((n=t,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o),wholeWords:e.wholeWords||!1}},It=function(e,n,t){return e instanceof RegExp?{keyword:e.source,regExp:e,wholeWords:t||!1}:typeof e=="string"?e===""?ht:wn({keyword:e,matchCase:n||!1,wholeWords:t||!1}):(n!==void 0&&(e.matchCase=n),t!==void 0&&(e.wholeWords=t),wn(e))},sn=function(e){var n,t=e.get("initialKeyword"),o=_.useMemo(function(){if(t&&t.length===1){var F=It(t[0]);return{matchCase:F.regExp.flags.indexOf("i")===-1,wholeWords:F.wholeWords}}return{matchCase:!1,wholeWords:!1}},[]),r=function(F){var ue=_.useRef(F.get("doc")),J=function(O){ue.current=O};return _.useEffect(function(){return F.subscribe("doc",J),function(){F.unsubscribe("doc",J)}},[]),ue}(e),i=_.useState(t),l=i[0],c=i[1],m=_.useState([]),g=m[0],h=m[1],C=_.useState(0),p=C[0],y=C[1],w=_.useState(o.matchCase),b=w[0],f=w[1],N=_.useRef([]),k=_.useState(o.wholeWords),S=k[0],ae=k[1],me=function(){return!0},ce=_.useCallback(function(){return e.get("targetPageFilter")||me},[e.get("targetPageFilter")]),Ce=function(F){var ue=g.length;if(l.length===0||ue===0)return null;var J=F===ue+1?1:Math.max(1,Math.min(ue,F));return y(J),se(g[J-1])},_e=function(F){return c(F===""?[]:[F])},se=function(F){var ue=e.get("jumpToPage");return ue&&ue(F.pageIndex),e.update("matchPosition",{matchIndex:F.matchIndex,pageIndex:F.pageIndex}),F},Z=function(F,ue,J){var O=r.current;if(!O)return Promise.resolve([]);var oe=O.numPages,ve=F.map(function(Ne){return It(Ne,ue,J)});return e.update("keyword",ve),y(0),h([]),new Promise(function(Ne,De){var be=N.current.length===0?function(){var de=r.current;if(!de)return Promise.resolve([]);var Se=Array(de.numPages).fill(0).map(function(ye,fe){return X.getPage(de,fe).then(function(A){return A.getTextContent()}).then(function(A){var Q=A.items.map(function(ne){return ne.str||""}).join("");return Promise.resolve({pageContent:Q,pageIndex:fe})})});return Promise.all(Se).then(function(ye){return ye.sort(function(fe,A){return fe.pageIndex-A.pageIndex}),Promise.resolve(ye.map(function(fe){return fe.pageContent}))})}().then(function(de){return N.current=de,Promise.resolve(de)}):Promise.resolve(N.current);be.then(function(de){var Se=[];de.forEach(function(ye,fe){ce()({pageIndex:fe,numPages:oe})&&ve.forEach(function(A){for(var Q,ne=0;(Q=A.regExp.exec(ye))!==null;)Se.push({keyword:A.regExp,matchIndex:ne,pageIndex:fe,pageText:ye,startIndex:Q.index,endIndex:A.regExp.lastIndex}),ne++})}),h(Se),Se.length>0&&(y(1),se(Se[0])),Ne(Se)})})};return _.useEffect(function(){N.current=[]},[r.current]),{clearKeyword:function(){e.update("keyword",[ht]),_e(""),y(0),h([]),f(!1),ae(!1)},changeMatchCase:function(F){f(F),l.length>0&&Z(l,F,S)},changeWholeWords:function(F){ae(F),l.length>0&&Z(l,b,F)},currentMatch:p,jumpToMatch:Ce,jumpToNextMatch:function(){return Ce(p+1)},jumpToPreviousMatch:function(){return Ce(p-1)},keywords:l,matchCase:b,numberOfMatches:g.length,wholeWords:S,search:function(){return Z(l,b,S)},searchFor:Z,setKeywords:c,keyword:l.length===0?"":(n=l[0],n instanceof RegExp?n.source:typeof n=="string"?n:n.keyword),setKeyword:_e,setTargetPages:function(F){e.update("targetPageFilter",F)}}},Ui=function(e){var n=e.children,t=e.store,o=sn(t),r=_.useState(!1),i=r[0],l=r[1],c=function(m){return l(!0)};return _.useEffect(function(){return t.subscribe("doc",c),function(){t.unsubscribe("doc",c)}},[]),n(Xe(Xe({},o),{isDocumentLoaded:i}))},Wi=function(e){var n=e.containerRef,t=e.store,o=_.useRef(!1),r=function(){o.current=!0},i=function(){o.current=!1},l=function(c){var m=n.current;m&&(c.shiftKey||c.altKey||c.key!=="f"||(X.isMac()?c.metaKey&&!c.ctrlKey:c.ctrlKey)&&
102(o.current||document.activeElement&&m.contains(document.activeElement))&&(c.preventDefault(),t.update("areShortcutsPressed",!0)))};return _.useEffect(function(){var c=n.current;if(c)return document.addEventListener("keydown",l),c.addEventListener("mouseenter",r),c.addEventListener("mouseleave",i),function(){document.removeEventListener("keydown",l),c.removeEventListener("mouseenter",r),c.removeEventListener("mouseleave",i)}},[n.current]),_.createElement(_.Fragment,null)},xn={left:0,top:8},Hi=function(e){var n=e.store,t=e.onToggle,o=_.useContext(X.LocalizationContext).l10n,r=_.useContext(X.ThemeContext).direction,i=_.useState(!1),l=i[0],c=i[1],m=_.useState(!1),g=m[0],h=m[1],C=r===X.TextDirection.RightToLeft,p=sn(n),y=p.clearKeyword,w=p.changeMatchCase,b=p.changeWholeWords,f=p.currentMatch,N=p.jumpToNextMatch,k=p.jumpToPreviousMatch,S=p.keyword,ae=p.matchCase,me=p.numberOfMatches,ce=p.wholeWords,Ce=p.search,_e=p.setKeyword,se=function(O){c(!0),Ce().then(function(oe){c(!1),h(!0),O&&O()})};_.useEffect(function(){var O=n.get("initialKeyword");O&&O.length===1&&S&&se(function(){n.update("initialKeyword",[])})},[]);var Z=o&&o.search?o.search.enterToSearch:"Enter to search",F=o&&o.search?o.search.previousMatch:"Previous match",ue=o&&o.search?o.search.nextMatch:"Next match",J=o&&o.search?o.search.close:"Close";return _.createElement("div",{className:"rpv-search__popover"},_.createElement("div",{className:"rpv-search__popover-input-counter"},_.createElement(X.TextBox,{ariaLabel:Z,autoFocus:!0,placeholder:Z,type:"text",value:S,onChange:function(O){h(!1),_e(O)},onKeyDown:function(O){O.key==="Enter"&&S&&(g?N():se())}}),_.createElement("div",{className:X.classNames({"rpv-search__popover-counter":!0,"rpv-search__popover-counter--ltr":!C,"rpv-search__popover-counter--rtl":C})},l&&_.createElement(X.Spinner,{testId:"search__popover-searching",size:"1rem"}),!l&&_.createElement("span",{"data-testid":"search__popover-num-matches"},f,"/",me))),_.createElement("label",{className:"rpv-search__popover-label"},_.createElement("input",{className:"rpv-search__popover-label-checkbox","data-testid":"search__popover-match-case",checked:ae,type:"checkbox",onChange:function(O){h(!1),w(O.target.checked)}})," ",o&&o.search?o.search.matchCase:"Match case"),_.createElement("label",{className:"rpv-search__popover-label"},_.createElement("input",{className:"rpv-search__popover-label-checkbox",checked:ce,"data-testid":"search__popover-whole-words",type:"checkbox",onChange:function(O){h(!1),b(O.target.checked)}})," ",o&&o.search?o.search.wholeWords:"Whole words"),_.createElement("div",{className:"rpv-search__popover-footer"},_.createElement("div",{className:"rpv-search__popover-footer-item"},_.createElement(X.Tooltip,{ariaControlsSuffix:"search-previous-match",position:C?X.Position.BottomRight:X.Position.BottomCenter,target:_.createElement(X.MinimalButton,{ariaLabel:F,isDisabled:f<=1,onClick:k},_.createElement(yr,null)),content:function(){return F},offset:xn})),_.createElement("div",{className:"rpv-search__popover-footer-item"},_.createElement(X.Tooltip,{ariaControlsSuffix:"search-next-match",position:X.Position.BottomCenter,target:_.createElement(X.MinimalButton,{ariaLabel:ue,isDisabled:f>me-1,onClick:N},_.createElement(br,null)),content:function(){return ue},offset:xn})),_.createElement("div",{className:X.classNames({"rpv-search__popover-footer-button":!0,"rpv-search__popover-footer-button--ltr":!C,"rpv-search__popover-footer-button--rtl":C})},_.createElement(X.Button,{onClick:function(){t(),y()}},J))))},Ki=function(e){var n=e.children,t=e.onClick,o=_.useContext(X.LocalizationContext).l10n,r=o&&o.search?o.search.search:"Search";return n({icon:_.createElement(Er,null),label:r,onClick:t})},Gi={left:0,top:8},Sr=function(e){var n=e.enableShortcuts,t=e.store,o=e.onClick,r=n?X.isMac()?"Meta+F":"Ctrl+F":"",i=function(l){l&&o()};return _.useEffect(function(){return t.subscribe("areShortcutsPressed",i),function(){t.unsubscribe("areShortcutsPressed",i)}},[]),_.createElement(Ki,{onClick:o},function(l){return _.createElement(X.Tooltip,{ariaControlsSuffix:"search-popover",position:X.Position.BottomCenter,target:_.createElement(X.MinimalButton,{ariaKeyShortcuts:r,ariaLabel:l.label,testId:"search__popover-button",onClick:o},l.icon),content:function(){return l.label},offset:Gi})})},Zi={left:0,top:8},qi=function(e){var n=e.children,t=e.enableShortcuts,o=e.store,r=_.useContext(X.ThemeContext).direction===X.TextDirection.RightToLeft?X.Position.BottomRight:X.Position.BottomLeft,i=n||function(l){return _.createElement(Sr,Xe({enableShortcuts:t,store:o},l))};
102return _.createElement(X.Popover,{ariaControlsSuffix:"search",lockScroll:!1,position:r,target:function(l){return i({onClick:l})},content:function(l){return _.createElement(Hi,{store:o,onToggle:l})},offset:Zi,closeOnClickOutside:!1,closeOnEscape:!0})},kn=function(e){return Array.isArray(e)?e.map(function(n){return It(n)}):[It(e)]};st.NextIcon=br,st.PreviousIcon=yr,st.SearchIcon=Er,st.searchPlugin=function(e){var n=_.useMemo(function(){return Object.assign({},{enableShortcuts:!0,onHighlightKeyword:function(){}},e)},[]),t=_.useMemo(function(){return X.createStore({initialKeyword:e&&e.keyword?Array.isArray(e.keyword)?e.keyword:[e.keyword]:[],keyword:e&&e.keyword?kn(e.keyword):[ht],matchPosition:{matchIndex:-1,pageIndex:-1},renderStatus:new Map})},[]),o=sn(t),r=o.clearKeyword,i=o.jumpToMatch,l=o.jumpToNextMatch,c=o.jumpToPreviousMatch,m=o.searchFor,g=o.setKeywords,h=o.setTargetPages,C=function(p){return _.createElement(qi,Xe({enableShortcuts:n.enableShortcuts},p,{store:t}))};return{install:function(p){var y=e&&e.keyword?Array.isArray(e.keyword)?e.keyword:[e.keyword]:[],w=e&&e.keyword?kn(e.keyword):[ht];t.update("initialKeyword",y),t.update("jumpToDestination",p.jumpToDestination),t.update("jumpToPage",p.jumpToPage),t.update("keyword",w)},renderPageLayer:function(p){return _.createElement(Vi,{key:p.pageIndex,numPages:p.doc.numPages,pageIndex:p.pageIndex,renderHighlights:e==null?void 0:e.renderHighlights,store:t,onHighlightKeyword:n.onHighlightKeyword})},renderViewer:function(p){var y=p.slot;return y.subSlot&&(y.subSlot.children=_.createElement(_.Fragment,null,n.enableShortcuts&&_.createElement(Wi,{containerRef:p.containerRef,store:t}),y.subSlot.children)),y},uninstall:function(p){var y=t.get("renderStatus");y&&y.clear()},onDocumentLoad:function(p){t.update("doc",p.doc)},onTextLayerRender:function(p){var y=t.get("renderStatus");y&&(y=y.set(p.pageIndex,p),t.update("renderStatus",y))},Search:function(p){return _.createElement(Ui,Xe({},p,{store:t}))},ShowSearchPopover:C,ShowSearchPopoverButton:function(){return _.createElement(C,null,function(p){return _.createElement(Sr,Xe({enableShortcuts:n.enableShortcuts,store:t},p))})},clearHighlights:function(){r()},highlight:function(p){var y=Array.isArray(p)?p:[p];return g(y),m(y)},jumpToMatch:i,jumpToNextMatch:l,jumpToPreviousMatch:c,setTargetPages:h}};/**
103 * A React component to view a PDF document
104 *
105 * @see https://react-pdf-viewer.dev
106 * @license https://react-pdf-viewer.dev/license
107 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
108 */vr.exports=st;var Yi=vr.exports,wr={exports:{}},St={},He=Be;function Xi(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var Ee=Xi(M),un=function(){return Ee.createElement(He.Icon,{size:16},Ee.createElement("path",{d:"M19.5,15.106l2.4-2.4a1,1,0,0,0,0-1.414l-2.4-2.4V5.5a1,1,0,0,0-1-1H15.106l-2.4-2.4a1,1,0,0,0-1.414,0l-2.4,2.4H5.5a1,1,0,0,0-1,1V8.894l-2.4,2.4a1,1,0,0,0,0,1.414l2.4,2.4V18.5a1,1,0,0,0,1,1H8.894l2.4,2.4a1,1,0,0,0,1.414,0l2.4-2.4H18.5a1,1,0,0,0,1-1Z"}),Ee.createElement("path",{d:"M10,6.349a6,6,0,0,1,0,11.3,6,6,0,1,0,0-11.3Z"}))},dn=function(){return Ee.createElement(He.Icon,{size:16},Ee.createElement("path",{d:"M19.491,15.106l2.4-2.4a1,1,0,0,0,0-1.414l-2.4-2.4V5.5a1,1,0,0,0-1-1H15.1L12.7,2.1a1,1,0,0,0-1.414,0l-2.4,2.4H5.491a1,1,0,0,0-1,1V8.894l-2.4,2.4a1,1,0,0,0,0,1.414l2.4,2.4V18.5a1,1,0,0,0,1,1H8.885l2.4,2.4a1,1,0,0,0,1.414,0l2.4-2.4h3.394a1,1,0,0,0,1-1Z"}),Ee.createElement("path",{d:"M11.491,6c4,0,6,2.686,6,6s-2,6-6,6Z"}))},Dt=function(){return Dt=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Dt.apply(this,arguments)},Ji={left:0,top:8},xr=function(e){var n=e.onClick,t=Ee.useContext(He.ThemeContext),o=Ee.useContext(He.LocalizationContext).l10n,r=t.currentTheme==="dark",i=o&&o.theme?r?o.theme.switchLightTheme:o.theme.switchDarkTheme:r?"Switch to the light theme":"Switch to the dark theme";
108return Ee.createElement(He.Tooltip,{ariaControlsSuffix:"theme-switch",position:He.Position.BottomCenter,target:Ee.createElement(He.MinimalButton,{ariaLabel:i,testId:"theme__switch-button",onClick:n},r?Ee.createElement(dn,null):Ee.createElement(un,null)),content:function(){return i},offset:Ji})},Qi=function(e){var n=e.children,t=Ee.useContext(He.ThemeContext);return(n||function(o){return Ee.createElement(xr,{onClick:o.onClick})})({onClick:function(){return t.setCurrentTheme(t.currentTheme==="dark"?"light":"dark")}})},ea=function(e){var n=e.onClick,t=Ee.useContext(He.ThemeContext),o=Ee.useContext(He.LocalizationContext).l10n,r=t.currentTheme==="dark",i=o&&o.theme?r?o.theme.switchLightTheme:o.theme.switchDarkTheme:r?"Switch to the light theme":"Switch to the dark theme";return Ee.createElement(He.MenuItem,{icon:r?Ee.createElement(dn,null):Ee.createElement(un,null),testId:"theme__switch-menu",onClick:n},i)};St.DarkIcon=un,St.LightIcon=dn,St.themePlugin=function(){var e=function(n){return Ee.createElement(Qi,Dt({},n))};return{SwitchTheme:e,SwitchThemeButton:function(){return Ee.createElement(e,null,function(n){return Ee.createElement(xr,Dt({},n))})},SwitchThemeMenuItem:function(n){return Ee.createElement(e,null,function(t){return Ee.createElement(ea,{onClick:function(){t.onClick(),n.onClick()}})})}}};/**
109 * A React component to view a PDF document
110 *
111 * @see https://react-pdf-viewer.dev
112 * @license https://react-pdf-viewer.dev/license
113 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
114 */wr.exports=St;var ta=wr.exports,kr={exports:{}},wt={},ee=Be;function na(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var L=na(M),mn=function(){return L.createElement(ee.Icon,{ignoreDirection:!0,size:16},L.createElement("path",{d:`M10.5,0.499c5.523,0,10,4.477,10,10s-4.477,10-10,10s-10-4.477-10-10S4.977,0.499,10.5,0.499z
115            M23.5,23.499
116            l-5.929-5.929
117            M5.5,10.499h10
118            M10.5,5.499v10`}))},fn=function(){return L.createElement(ee.Icon,{ignoreDirection:!0,size:16},L.createElement("path",{d:`M10.5,0.499c5.523,0,10,4.477,10,10s-4.477,10-10,10s-10-4.477-10-10S4.977,0.499,10.5,0.499z
119            M23.5,23.499
120            l-5.929-5.929
121            M5.5,10.499h10`}))},Ue=function(){return Ue=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Ue.apply(this,arguments)},zt=function(e){var n=L.useState(e.get("scale")||0),t=n[0],o=n[1],r=function(i){o(i)};return L.useEffect(function(){return e.subscribe("scale",r),function(){e.unsubscribe("scale",r)}},[]),{scale:t}},ra=function(e){var n=e.children,t=e.store;return(n||function(o){return L.createElement(L.Fragment,null,"".concat(Math.round(100*o.scale),"%"))})({scale:zt(t).scale})},oa={passive:!1},_n=null,ia=function(e){var n=e.pagesContainerRef,t=e.store,o=ee.useDebounceCallback(function(i){var l=t.get("zoom");l&&l(i)},40),r=function(i){if(i.ctrlKey){i.preventDefault();var l=i.target.getBoundingClientRect(),c=1-i.deltaY/100,m=i.clientX-l.left,g=i.clientY-l.top,h=t.get("scale"),C=(_n||(_n=document.createElementNS("http://www.w3.org/2000/svg","svg"))).createSVGMatrix().translate(m,g).scale(c).translate(-m,-g).scale(h);o(C.a)}};return ee.useIsomorphicLayoutEffect(function(){var i=n.current;if(i)return i.addEventListener("wheel",r,oa),function(){i.removeEventListener("wheel",r)}},[]),L.createElement(L.Fragment,null)},Vt=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],_r=function(e){return Vt.find(function(n){return n>e})||e},Mr=function(e){var n=Vt.findIndex(function(t){return t>=e});return n===-1||n===0?e:Vt[n-1]},aa=function(e){var n=e.containerRef,t=e.store,o=function(r){if(!r.shiftKey&&!r.altKey&&(ee.isMac()?r.metaKey:r.ctrlKey)){var i=n.current;if(i&&document.activeElement&&i.contains(document.activeElement)){var l=t.get("zoom");if(l){var c=t.get("scale")||1,m=1;switch(r.key){case"-":m=Mr(c);break;case"=":m=_r(c);break;case"0":m=1;break;default:m=c}m!==c&&(r.preventDefault(),l(m))}}}};return L.useEffect(function(){if(n.current)return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o)}},[n.current]),L.createElement(L.Fragment,null)},la=[.5,.75,1,1.25,1.5,2,3,4],ca={left:0,top:8},Nr=function(e){var n=e.levels,t=n===void 0?la:n,o=e.scale,r=e.onZoom,i=L.useContext(ee.LocalizationContext).l10n,l=L.useContext(ee.ThemeContext).direction===ee.TextDirection.RightToLeft,c=i&&i.zoom?i.zoom.zoomDocument:"Zoom document";
121return L.createElement(ee.Popover,{ariaControlsSuffix:"zoom",ariaHasPopup:"menu",position:ee.Position.BottomCenter,target:function(m){return L.createElement(ee.MinimalButton,{ariaLabel:c,testId:"zoom__popover-target",onClick:function(){m()}},L.createElement("span",{className:"rpv-zoom__popover-target"},L.createElement("span",{"data-testid":"zoom__popover-target-scale",className:ee.classNames({"rpv-zoom__popover-target-scale":!0,"rpv-zoom__popover-target-scale--ltr":!l,"rpv-zoom__popover-target-scale--rtl":l})},Math.round(100*o),"%"),L.createElement("span",{className:"rpv-zoom__popover-target-arrow"})))},content:function(m){return L.createElement(ee.Menu,null,Object.keys(ee.SpecialZoomLevel).map(function(g){var h=g;return L.createElement(ee.MenuItem,{key:h,onClick:function(){m(),r(h)}},function(C){switch(C){case ee.SpecialZoomLevel.ActualSize:return i&&i.zoom?i.zoom.actualSize:"Actual size";case ee.SpecialZoomLevel.PageFit:return i&&i.zoom?i.zoom.pageFit:"Page fit";case ee.SpecialZoomLevel.PageWidth:return i&&i.zoom?i.zoom.pageWidth:"Page width"}}(h))}),L.createElement(ee.MenuDivider,null),t.map(function(g){return L.createElement(ee.MenuItem,{key:g,onClick:function(){m(),r(g)}},"".concat(Math.round(100*g),"%"))}))},offset:ca,closeOnClickOutside:!0,closeOnEscape:!0})},sa=function(e){var n=e.children,t=e.levels,o=e.store;return(n||function(r){return L.createElement(Nr,{levels:t,scale:r.scale,onZoom:r.onZoom})})({scale:zt(o).scale,onZoom:function(r){var i=o.get("zoom");i&&i(r)}})},ua={left:0,top:8},Pr=function(e){var n=e.enableShortcuts,t=e.onClick,o=L.useContext(ee.LocalizationContext).l10n,r=o&&o.zoom?o.zoom.zoomIn:"Zoom in",i=n?ee.isMac()?"Meta+=":"Ctrl+=":"";return L.createElement(ee.Tooltip,{ariaControlsSuffix:"zoom-in",position:ee.Position.BottomCenter,target:L.createElement(ee.MinimalButton,{ariaKeyShortcuts:i,ariaLabel:r,testId:"zoom__in-button",onClick:t},L.createElement(mn,null)),content:function(){return r},offset:ua})},da=function(e){var n=e.children,t=e.enableShortcuts,o=e.store,r=zt(o).scale;return(n||Pr)({enableShortcuts:t,onClick:function(){var i=o.get("zoom");i&&i(_r(r))}})},ma=function(e){var n=e.onClick,t=L.useContext(ee.LocalizationContext).l10n,o=t&&t.zoom?t.zoom.zoomIn:"Zoom in";return L.createElement(ee.MenuItem,{icon:L.createElement(mn,null),testId:"zoom__in-menu",onClick:n},o)},fa={left:0,top:8},Ir=function(e){var n=e.enableShortcuts,t=e.onClick,o=L.useContext(ee.LocalizationContext).l10n,r=o&&o.zoom?o.zoom.zoomOut:"Zoom out",i=n?ee.isMac()?"Meta+-":"Ctrl+-":"";return L.createElement(ee.Tooltip,{ariaControlsSuffix:"zoom-out",position:ee.Position.BottomCenter,target:L.createElement(ee.MinimalButton,{ariaKeyShortcuts:i,ariaLabel:r,testId:"zoom__out-button",onClick:t},L.createElement(fn,null)),content:function(){return r},offset:fa})},pa=function(e){var n=e.children,t=e.enableShortcuts,o=e.store,r=zt(o).scale;return(n||Ir)({enableShortcuts:t,onClick:function(){var i=o.get("zoom");i&&i(Mr(r))}})},ha=function(e){var n=e.onClick,t=L.useContext(ee.LocalizationContext).l10n,o=t&&t.zoom?t.zoom.zoomOut:"Zoom out";return L.createElement(ee.MenuItem,{icon:L.createElement(fn,null),testId:"zoom__out-menu",onClick:n},o)};wt.ZoomInIcon=mn,wt.ZoomOutIcon=fn,wt.zoomPlugin=function(e){var n=L.useMemo(function(){return Object.assign({},{enableShortcuts:!0},e)},[]),t=L.useMemo(function(){return ee.createStore({})},[]),o=function(l){return L.createElement(da,Ue({enableShortcuts:n.enableShortcuts},l,{store:t}))},r=function(l){return L.createElement(pa,Ue({enableShortcuts:n.enableShortcuts},l,{store:t}))},i=function(l){return L.createElement(sa,Ue({},l,{store:t}))};return{renderViewer:function(l){var c=l.slot;if(!n.enableShortcuts)return c;var m={children:L.createElement(L.Fragment,null,L.createElement(aa,{containerRef:l.containerRef,store:t}),L.createElement(ia,{pagesContainerRef:l.pagesContainerRef,store:t}),c.children)};return Ue(Ue({},c),m)},install:function(l){t.update("zoom",l.zoom)},onViewerStateChange:function(l){return t.update("scale",l.scale),l},zoomTo:function(l){var c=t.get("zoom");c&&c(l)},CurrentScale:function(l){return L.createElement(ra,Ue({},l,{store:t}))},ZoomIn:o,ZoomInButton:function(){return L.createElement(o,null,function(l){return L.createElement(Pr,Ue({},l))})},ZoomInMenuItem:function(l){return L.createElement(o,null,function(c){return L.createElement(ma,{onClick:function(){c.onClick(),l.onClick()}})})}
121,ZoomOut:r,ZoomOutButton:function(){return L.createElement(r,null,function(l){return L.createElement(Ir,Ue({},l))})},ZoomOutMenuItem:function(l){return L.createElement(r,null,function(c){return L.createElement(ha,{onClick:function(){c.onClick(),l.onClick()}})})},Zoom:i,ZoomPopover:function(l){return L.createElement(i,null,function(c){return L.createElement(Nr,Ue({levels:l==null?void 0:l.levels},c))})}}};/**
122 * A React component to view a PDF document
123 *
124 * @see https://react-pdf-viewer.dev
125 * @license https://react-pdf-viewer.dev/license
126 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
127 */kr.exports=wt;var ga=kr.exports,pe=Be,Ut=po,va=M,ba=ko,ya=Do,Ea=Oo,Ca=Qn,Sa=gi,wa=xi,xa=Pi,ka=Fi,_a=Yi,Ma=ta,Na=ga;function Pa(e){var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if(t!=="default"){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,Object.freeze(n)}var E=Pa(va),Dr=function(){return E.createElement(pe.Icon,{size:16},E.createElement("path",{d:`M12,0.5c1.381,0,2.5,1.119,2.5,2.5S13.381,5.5,12,5.5S9.5,4.381,9.5,3S10.619,0.5,12,0.5z
128            M12,9.5
129            c1.381,0,2.5,1.119,2.5,2.5s-1.119,2.5-2.5,2.5S9.5,13.381,9.5,12S10.619,9.5,12,9.5z
130            M12,18.5c1.381,0,2.5,1.119,2.5,2.5
131            s-1.119,2.5-2.5,2.5S9.5,22.381,9.5,21S10.619,18.5,12,18.5z`}))},Mn={left:0,top:8},zr=function(e){var n=e.toolbarSlot,t=E.useContext(pe.LocalizationContext).l10n,o=E.useContext(pe.ThemeContext).direction===pe.TextDirection.RightToLeft?pe.Position.BottomLeft:pe.Position.BottomRight,r=n.DownloadMenuItem,i=n.EnterFullScreenMenuItem,l=n.GoToFirstPageMenuItem,c=n.GoToLastPageMenuItem,m=n.GoToNextPageMenuItem,g=n.GoToPreviousPageMenuItem,h=n.OpenMenuItem,C=n.PrintMenuItem,p=n.RotateBackwardMenuItem,y=n.RotateForwardMenuItem,w=n.ShowPropertiesMenuItem,b=n.SwitchScrollModeMenuItem,f=n.SwitchSelectionModeMenuItem,N=n.SwitchViewModeMenuItem,k=n.SwitchThemeMenuItem;return E.createElement(pe.Popover,{ariaControlsSuffix:"toolbar-more-actions",ariaHasPopup:"menu",position:o,target:function(S,ae){var me=t&&t.toolbar?t.toolbar.moreActions:"More actions";return E.createElement(pe.Tooltip,{ariaControlsSuffix:"toolbar-more-actions",position:o,target:E.createElement(pe.MinimalButton,{ariaLabel:me,isSelected:ae,testId:"toolbar__more-actions-popover-target",onClick:S},E.createElement(Dr,null)),content:function(){return me},offset:Mn})},content:function(S){return E.createElement(pe.Menu,null,E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(k,{onClick:S})),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(i,{onClick:S})),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(h,null)),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(C,{onClick:S})),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(r,{onClick:S})),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(pe.MenuDivider,null)),E.createElement(l,{onClick:S}),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(g,{onClick:S})),E.createElement("div",{className:"rpv-core__display--block rpv-core__display--hidden-medium"},E.createElement(m,{onClick:S})),E.createElement(c,{onClick:S}),E.createElement(pe.MenuDivider,null),E.createElement(y,{onClick:S}),E.createElement(p,{onClick:S}),E.createElement(pe.MenuDivider,null),E.createElement(f,{mode:Ut.SelectionMode.Text,onClick:S}),E.createElement(f,{mode:Ut.SelectionMode.Hand,onClick:S}),E.createElement(pe.MenuDivider,null),E.createElement(b,{mode:pe.ScrollMode.Page,onClick:S}),E.createElement(b,{mode:pe.ScrollMode.Vertical,onClick:S}),E.createElement(b,{mode:pe.ScrollMode.Horizontal,onClick:S}),E.createElement(b,{mode:pe.ScrollMode.Wrapped,onClick:S}),E.createElement(pe.MenuDivider,null),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement(N,{mode:pe.ViewMode.SinglePage,onClick:S})),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement(N,{mode:pe.ViewMode.DualPage,onClick:S})),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement(N,{mode:pe.ViewMode.DualPageWithCover,onClick:S})),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement(pe.MenuDivider,null)),E.createElement(w,{onClick:S}))},offset:Mn,closeOnClickOutside:!0,closeOnEscape:!0})},ft=function(){return ft=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},ft.apply(this,arguments)},Tr=function(e){return function(n){var t=E.useMemo(function(){return e(n)},[]),o=E.useContext(pe.ThemeContext).direction===pe.TextDirection.RightToLeft,r=t.CurrentPageInput,i=t.Download,l=t.EnterFullScreen,c=t.GoToNextPage,m=t.GoToPreviousPage,g=t.NumberOfPages,h=t.Open,C=t.Print,p=t.ShowSearchPopover,y=t.SwitchTheme,w=t.Zoom,b=t.ZoomIn,f=t.ZoomOut;return E.createElement("div",{"data-testid":"toolbar",className:pe.classNames({"rpv-toolbar":!0,"rpv-toolbar--rtl":o}),role:"toolbar","aria-orientation":"horizontal"},E.createElement("div",{className:"rpv-toolbar__left"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(p,null)),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(m,null))),E.createElement("div",{className:"rpv-toolbar__item"}
131,E.createElement(r,null),E.createElement("span",{className:"rpv-toolbar__label"},E.createElement(g,null))),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(c,null)))),E.createElement("div",{className:"rpv-toolbar__center"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(f,null)),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-small"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(w,null))),E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(b,null))),E.createElement("div",{className:"rpv-toolbar__right"},E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-medium"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(y,null))),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-medium"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(l,null))),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-medium"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(h,null))),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-medium"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(i,null))),E.createElement("div",{className:"rpv-core__display--hidden rpv-core__display--block-medium"},E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(C,null))),E.createElement("div",{className:"rpv-toolbar__item"},E.createElement(zr,{toolbarSlot:t}))))}},Ia=function(e){var n=e.NumberOfPages;return Object.assign({},e,{NumberOfPages:function(){return E.createElement(E.Fragment,null,"/ ",E.createElement(n,null))}})},Da=function(e){return Tr(Ia)(e)},za=function(e){var n=e.children,t=e.slot;return(n||Da)(t)};yt.MoreActionsPopover=zr,yt.MoreIcon=Dr,yt.toolbarPlugin=function(e){var n=ba.fullScreenPlugin(e?e.fullScreenPlugin:{}),t=ya.getFilePlugin(e?e.getFilePlugin:{}),o=Ea.openPlugin(e?e.openPlugin:{}),r=Ca.pageNavigationPlugin(e?e.pageNavigationPlugin:{}),i=Sa.printPlugin(e?e.printPlugin:{}),l=wa.propertiesPlugin(),c=xa.rotatePlugin(),m=ka.scrollModePlugin(),g=_a.searchPlugin(e?e.searchPlugin:{}),h=Ut.selectionModePlugin(e?e.selectionModePlugin:{}),C=Ma.themePlugin(),p=Na.zoomPlugin(e?e.zoomPlugin:{}),y=[n,t,o,r,i,l,c,m,g,h,C,p],w=E.useCallback(function(b){var f=n.EnterFullScreen,N=n.EnterFullScreenMenuItem,k=t.Download,S=t.DownloadMenuItem,ae=o.Open,me=o.OpenMenuItem,ce=r.CurrentPageInput,Ce=r.CurrentPageLabel,_e=r.GoToFirstPage,se=r.GoToFirstPageMenuItem,Z=r.GoToLastPage,F=r.GoToLastPageMenuItem,ue=r.GoToNextPage,J=r.GoToNextPageMenuItem,O=r.GoToPreviousPage,oe=r.GoToPreviousPageMenuItem,ve=r.NumberOfPages,Ne=i.Print,De=i.PrintMenuItem,be=l.ShowProperties,de=l.ShowPropertiesMenuItem,Se=c.Rotate,ye=c.RotateBackwardMenuItem,fe=c.RotateForwardMenuItem,A=m.SwitchScrollMode,Q=m.SwitchScrollModeMenuItem,ne=m.SwitchViewMode,re=m.SwitchViewModeMenuItem,d=g.Search,v=g.ShowSearchPopover,I=h.SwitchSelectionMode,z=h.SwitchSelectionModeMenuItem,H=C.SwitchTheme,j=C.SwitchThemeMenuItem,T=p.CurrentScale,K=p.Zoom,u=p.ZoomIn,P=p.ZoomInMenuItem,q=p.ZoomOut,B=p.ZoomOutMenuItem;return E.createElement(za,ft({},b,{slot:{CurrentPageInput:ce,CurrentPageLabel:Ce,CurrentScale:T,Download:k,DownloadMenuItem:S,EnterFullScreen:f,EnterFullScreenMenuItem:N,GoToFirstPage:_e,GoToFirstPageMenuItem:se,GoToLastPage:Z,GoToLastPageMenuItem:F,GoToNextPage:ue,GoToNextPageMenuItem:J,GoToPreviousPage:O,GoToPreviousPageMenuItem:oe,NumberOfPages:ve,Open:ae,OpenMenuItem:me,Print:Ne,PrintMenuItem:De,Rotate:Se,RotateBackwardMenuItem:ye,RotateForwardMenuItem:fe,Search:d,ShowProperties:be,ShowPropertiesMenuItem:de,ShowSearchPopover:v,SwitchScrollMode:A,SwitchScrollModeMenuItem:Q,SwitchSelectionMode:I,SwitchSelectionModeMenuItem:z,SwitchViewMode:ne,SwitchViewModeMenuItem:re,SwitchTheme:H,SwitchThemeMenuItem:j,Zoom:K,ZoomIn:u,ZoomInMenuItem:P,ZoomOut:q,ZoomOutMenuItem:B}}))},[]);return{fullScreenPluginInstance:n,getFilePluginInstance:t,openPluginInstance:o,pageNavigationPluginInstance:r,printPluginInstance:i,propertiesPluginInstance:l,rotatePluginInstance:c,scrollModePluginInstance:m,searchPluginInstance:g,selectionModePluginInstance:h,themePluginInstance:C,zoomPluginInstance:p,install:function(b){y.forEac
131h(function(f){f.install&&f.install(b)})},renderPageLayer:function(b){return E.createElement(E.Fragment,null,y.map(function(f,N){return f.renderPageLayer?E.createElement(E.Fragment,{key:N},f.renderPageLayer(b)):E.createElement(E.Fragment,{key:N})}))},renderViewer:function(b){var f=b.slot;return y.forEach(function(N){N.renderViewer&&(f=N.renderViewer(ft(ft({},b),{slot:f})))}),f},uninstall:function(b){y.forEach(function(f){f.uninstall&&f.uninstall(b)})},onDocumentLoad:function(b){y.forEach(function(f){f.onDocumentLoad&&f.onDocumentLoad(b)})},onAnnotationLayerRender:function(b){y.forEach(function(f){f.onAnnotationLayerRender&&f.onAnnotationLayerRender(b)})},onTextLayerRender:function(b){y.forEach(function(f){f.onTextLayerRender&&f.onTextLayerRender(b)})},onViewerStateChange:function(b){var f=b;return y.forEach(function(N){N.onViewerStateChange&&(f=N.onViewerStateChange(f))}),f},renderDefaultToolbar:Tr,Toolbar:w}};/**
132 * A React component to view a PDF document
133 *
134 * @see https://react-pdf-viewer.dev
135 * @license https://react-pdf-viewer.dev/license
136 * @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]>
137 */On.exports=yt;var Ta=On.exports;const Wt=({projectId:e,sectionId:n=null,selectedIds:t,onChange:o,disabled:r=!1})=>{const[i,l]=M.useState([]),[c,m]=M.useState(!1),[g,h]=M.useState(null),C=M.useCallback(async()=>{var k;if(e){m(!0),h(null);try{const{data:S}=await Ie.post("/apiv1/ctd/devices/fetch-related-docs/",{project_id:e,section_id:n},{headers:{"Content-Type":"application/json"}});l(Array.isArray(S==null?void 0:S.documents)?S.documents:[])}catch(S){((k=S==null?void 0:S.response)==null?void 0:k.status)===404?l([]):(console.error("Error fetching project documents:",S),h("Couldn't load your documents."))}finally{m(!1)}}},[e,n]);M.useEffect(()=>{C()},[C]);const p=M.useMemo(()=>i.map(k=>k.id),[i]),y=M.useMemo(()=>new Set(t||[]),[t]),w=M.useCallback(k=>{if(r)return;const S=new Set(y);S.has(k)?S.delete(k):S.add(k),o(Array.from(S))},[r,o,y]),b=M.useCallback(()=>o(p),[p,o]),f=M.useCallback(()=>o([]),[o]),N=y.size?`${y.size} of ${i.length} selected`:`Using all ${i.length} document${i.length===1?"":"s"}`;return s("div",{className:"devices-doc-picker",children:[s("div",{className:"devices-doc-picker__header",children:[s("div",{children:[a("h6",{className:"devices-doc-picker__title",children:"Source documents"}),a("p",{className:"devices-doc-picker__subtitle",children:i.length?N:"No documents uploaded yet"})]}),s("div",{className:"devices-doc-picker__actions",children:[a("button",{type:"button",className:"devices-doc-picker__link",onClick:b,disabled:r||c||!i.length,children:"Select all"}),a("button",{type:"button",className:"devices-doc-picker__link",onClick:f,disabled:r||c||!y.size,children:"Clear"}),a("button",{type:"button",className:"devices-doc-picker__link",onClick:C,disabled:r||c,title:"Refresh document list",children:a(Yr,{size:13})})]})]}),s("div",{className:"devices-doc-picker__list",children:[c&&s("div",{className:"devices-doc-picker__loading",children:[a(ut,{size:"sm"}),a("span",{children:"Loading your documents..."})]}),!c&&g&&a("div",{className:"devices-doc-picker__empty",children:a("span",{className:"text-danger",children:g})}),!c&&!g&&!i.length&&s("div",{className:"devices-doc-picker__empty",children:[a(Xr,{size:16}),a("span",{children:"Upload documents to pick sources."})]}),!c&&!g&&i.map(k=>{const S=y.has(k.id);return s("button",{type:"button",className:`devices-doc-row${S?" devices-doc-row--selected":""}`,onClick:()=>w(k.id),disabled:r,"aria-pressed":S,children:[a("span",{className:"devices-doc-row__check",children:S&&a(Fn,{size:13,strokeWidth:3})}),a("span",{className:"devices-doc-row__icon",children:a(dt,{size:18})}),s("span",{className:"devices-doc-row__content",children:[a("span",{className:"devices-doc-row__filename",title:k.filename,children:k.filename}),k.title&&a(Oe,{color:"light-primary",className:"devices-doc-row__badge",children:k.title})]})]},k.id)})]})]})};Wt.propTypes={projectId:Le.oneOfType([Le.string,Le.number]),sectionId:Le.string,selectedIds:Le.array,onChange:Le.func.isRequired,disabled:Le.bool};const Ht=e=>{if(Array.isArray(e))return e;if(!e)return[];if(typeof e=="string")try{const n=JSON.parse(e);return typeof n=="string"?[]:Ht(n)}catch{return[]}return typeof e!="object"?[]:Array.isArray(e.sections)?e.sections:Array.isArray(e.results)?e.results:Object.entries(e).filter(([,n])=>n&&typeof n=="object").map(([n,t])=>({section_id:t.section_id??n,section_type:t.section_type??t.type??"text",section_name:t.section_name??t.name??n,section_content:t.section_content??t.content??""}))},La=e=>{if(!e)return"";if(typeof e=="object")return String(e.detail||e.message||e.error||"").trim();const n=String(e).trim();if(!n)return"";if(n.startsWith("{")||n.startsWith("["))try{const t=JSON.parse(n),o=Array.isArray(t)?t[0]:t;
137return typeof o=="string"?o.trim():String((o==null?void 0:o.detail)||(o==null?void 0:o.message)||(o==null?void 0:o.error)||n).trim()}catch{return n}return n},$a=[{match:/at least one document is required to initialize rag/i,message:"No source document is attached to this project, so the AI has nothing to draw on.",action:"Add at least one reference document to the project, then run this again."},{match:/no sections? (were )?found|section .* does not exist/i,message:"The section this request points to no longer exists.",action:"Reload the document and try again."},{match:/timed? ?out|timeout/i,message:"The request took too long and was stopped before it finished.",action:"Try again — long sections sometimes need a second attempt."}],Ra={401:{message:"Your session has expired.",action:"Sign in again, then retry."},403:{message:"You do not have permission to run this on the current project.",action:"Ask your administrator for access."},404:{message:"The requested item could not be found on the server.",action:"Reload the page and try again."},500:{message:"The service hit an internal error while handling the request.",action:"Try again shortly. If it keeps failing, contact your administrator."},502:{message:"The service is unreachable right now.",action:"Try again in a few minutes."},503:{message:"The service is temporarily unavailable.",action:"Try again in a few minutes."},504:{message:"The service took too long to respond.",action:"Try again in a few minutes."}},Fa=(e,n="Something went wrong.")=>{var c,m;const t=(c=e==null?void 0:e.response)==null?void 0:c.data,o=((m=e==null?void 0:e.response)==null?void 0:m.status)??(t==null?void 0:t.status_code)??null,r=La(t==null?void 0:t.details)||String((t==null?void 0:t.detail)||"").trim()||String((t==null?void 0:t.message)||"").trim()||String((t==null?void 0:t.error)||"").trim()||(typeof t=="string"?t.trim():""),i=$a.find(g=>g.match.test(r));if(i)return{message:i.message,action:i.action,status:o,raw:r};if(r)return{message:r,action:"",status:o,raw:""};const l=Ra[o];return l?{...l,status:o,raw:""}:e!=null&&e.request&&!(e!=null&&e.response)?{message:"The server could not be reached.",action:"Check your connection and try again.",status:null,raw:""}:{message:String((e==null?void 0:e.message)||n).trim()||n,action:"",status:o,raw:""}},Oa=(e,n)=>{const{message:t,action:o}=Fa(e,n);return o?`${t} ${o}`:t},ja=({isOpen:e,toggle:n,details:t={docTypes:[],activeTab:"",module:{},theme:null,subSection:null},handleComplete:o,selectedDocTypes:r=[]})=>{var ye,fe;console.log("Selected Doc Types in ValidationModal:",r);const i=Or(),l=Dn();M.useState(!1);const[c,m]=M.useState(null),[g,h]=M.useState(null),[C,p]=M.useState(!1),[y,w]=M.useState(!1),[b,f]=M.useState(null),[N,k]=M.useState(!1),[S,ae]=M.useState(null),[me,ce]=M.useState(null),[Ce,_e]=M.useState(!1),[se,Z]=M.useState(null),[F,ue]=M.useState([]),J=M.useRef(null);M.useEffect(()=>{const A=Kt();m(A),console.log("Current Project Data:",A)},[]),M.useEffect(()=>{(async()=>{var ne,re,d,v,I,z,H,j,T,K;if(!e||!(c!=null&&c.id)||!r)return;let Q;try{_e(!0),Q=V.loading("Loading your document...");const u=await Ie.post("/apiv1/ctd/devices/get-sections/",{project_id:c.id,hierarchy_id:r},{headers:{"Content-Type":"application/json"}});if(Q&&(V.dismiss(Q),Q=null),u.status>=200&&u.status<300){const P=Ht((re=(ne=u.data)==null?void 0:ne.data)==null?void 0:re.content);P.length>0?(h(P),w(!0),V.success("Document loaded successfully!")):(h(null),w(!1),V("No sections found yet for this document."))}else throw new Error(`Failed to fetch sections with status: ${u.status}`)}catch(u){if(Q&&V.dismiss(Q),console.error("Error fetching sections:",u),((d=u.response)==null?void 0:d.status)===404&&((I=(v=u.response)==null?void 0:v.data)==null?void 0:I.error)==="No document found for the given hierarchy_id"){h(null),w(!1),f(null);return}let P="Failed to fetch sections. Please try again.";(H=(z=u.response)==null?void 0:z.data)!=null&&H.error?P=u.response.data.error:(T=(j=u.response)==null?void 0:j.data)!=null&&T.details?P=u.response.data.details:u.message?P=u.message:(K=u.response)!=null&&K.status&&(P=`Failed to fetch sections with status: ${u.response.status}`),f(P),V.error(P)}finally{_e(!1)}})(),De()},[e,c,r]),M.useEffect(()=>{e||(J.current&&(clearInterval(J.current),J.current=null),h(null),w(!1),f(null),p(!1),ae(null),ce(null),_e(!1),Z(null))},[e]),M.useEffect(()=>()=>{J.current&&clearInterval(J.current)},[]);const O=M.useMemo(()=>{const A=r==null?void 0:r[0];return{name:Hr[A]||A||"Document"}},[r]),oe=async()=>{k(!0),await De(),k(!1)},ve=(A,Q)=>{J.current&&clearInterval(J.current),J.current=setInterval(async()=>{var ne,re,d,v,I,z,H;try{const j=await Ie.get("/apiv1/ctd/devices/sections-status/",{params:{project_id:c.id,hierarchy_id:A,...Q?{document_id:Q}:{}}}),T=(ne=j.data)==null?void 0:ne.state;if(T==="COMPLETED"){clearInterval(J.current),J.current=null;const K=Ht((d=(re=j.data)==null?void 0:re.data)==null?void 0:d.results);if(h(K.length>0?K:null),w(!0),p(!1),V.success("Your document sections are ready!"),Q){i(`${Kr(l.pathname)}
137/${Q}`);return}oe()}else if(T==="FAILED"){clearInterval(J.current),J.current=null;const K=((I=(v=j.data)==null?void 0:v.data)==null?void 0:I.error)||"Section generation failed";p(!1),f(K),V.error(K)}}catch(j){clearInterval(J.current),J.current=null,console.error("Error polling section generation status:",j);const T=((H=(z=j.response)==null?void 0:z.data)==null?void 0:H.error)||j.message||"Status check failed";p(!1),f(T),V.error(T)}},4e3)},Ne=async()=>{var ne,re,d,v;if(!(c!=null&&c.id)){f("No project found");return}const A=r==null?void 0:r[0];let Q;try{p(!0),f(null),Z(null),Q=V.loading("Generating your clinical document...");const I=await Ie.post("/apiv1/ctd/devices/add-sections/",{project_id:c.id,hierarchy_id:A,selected_documents:F},{headers:{"Content-Type":"application/json"}});Q&&(V.dismiss(Q),Q=null);const z=((ne=I.data)==null?void 0:ne.workflow_id)||((d=(re=I.data)==null?void 0:re.data)==null?void 0:d.workflow_id)||null;Z(z),ve(A,((v=I.data)==null?void 0:v.document_id)||null)}catch(I){Q&&V.dismiss(Q),console.error("Error generating sections:",I);const z=Oa(I,"Failed to generate sections. Please try again.");p(!1),f(z),V.error(z)}},De=async()=>{var A,Q,ne;if(!(c!=null&&c.id))return ce("No project found."),{generated:!1};ce(null);try{const re=await Ie.post("/apiv1/ctd/devices/final-doc-status/",{project_id:c.id},{headers:{"Content-Type":"application/json"}});if(re.status>=200&&re.status<300){const{generated:v,url:I,message:z}=re.data||{};return v&&I?(ae(I),{generated:!0,url:I}):(ae(null),ce(z||"Document not yet generated."),{generated:!1})}const d=((A=re.data)==null?void 0:A.error)||`Something went wrong (status ${re.status}).`;return ce(d),{generated:!1}}catch(re){console.error("Error checking final doc status:",re);const d=((ne=(Q=re.response)==null?void 0:Q.data)==null?void 0:ne.error)||re.message||"Could not check document status.";return ce(d),V.error(d),{generated:!1}}},be=()=>{if(S){const A=document.createElement("a");A.href=S,A.download="clinical_evaluation_plan.docx",document.body.appendChild(A),A.click(),document.body.removeChild(A),V.success("Document download started!")}},de=()=>{f(null),w(!1),Ne()};Ta.toolbarPlugin(),Qn.pageNavigationPlugin();const Se=()=>Ce?s("div",{className:"text-center py-5",children:[a(ut,{color:"primary",size:"lg"}),s("div",{className:"mt-3",children:[a("h5",{children:"Loading your document..."}),a("p",{className:"text-muted",children:"Looking up your regulatory content..."})]})]}):C?s("div",{className:"text-center py-5",children:[a(ut,{color:"primary",size:"lg"}),s("div",{className:"mt-3",children:[s("h5",{children:["Crafting your ",O.name,"..."]}),a("p",{className:"text-muted mb-1",children:"Our AI is generating your regulatory content..."})]})]}):b?s(Re,{color:"danger",className:"mt-3",children:[a("h6",{className:"alert-heading",children:"Document Generation Failed"}),a("p",{className:"mb-3",children:b}),s(he,{color:"danger",size:"sm",onClick:de,disabled:C,children:[a("i",{className:"bi bi-arrow-clockwise me-2"}),"Retry Generation"]})]}):g?s("div",{children:[s("div",{className:"d-flex justify-content-between align-items-center mb-3",children:[s("h5",{className:"text-success mb-0",children:[a("i",{className:"bi bi-check-circle me-2"}),y?"Document Sections Ready":"Document Sections Loaded"]}),a("div",{className:"d-flex gap-2",children:s(he,{color:"outline-primary",size:"sm",onClick:de,disabled:C,title:"Redraft the section content with AI",children:[a("i",{className:"bi bi-arrow-clockwise me-2"}),"Regenerate"]})})]}),a("div",{className:"mb-3",children:a(Wt,{projectId:c==null?void 0:c.id,selectedIds:F,onChange:ue,disabled:C})}),N&&a(Re,{color:"info",className:"mb-3",children:s("div",{className:"d-flex align-items-center",children:[a(ut,{size:"sm",className:"me-2"}),a("span",{children:"Checking your document..."})]})}),S&&a(Re,{color:"success",className:"mb-3",children:s("div",{className:"d-flex justify-content-between align-items-center",children:[s("div",{children:[s("h6",{className:"alert-heading mb-1",children:[a("i",{className:"bi bi-check-circle me-2"}),"Your Document is Ready!"]}),s("small",{className:"text-muted",children:["This downloads the last saved version of your"," ",O.name,". Unsaved edits live in the editor below - s
137ave a version there to include them."]})]}),s(he,{color:"success",size:"sm",onClick:be,children:[a("i",{className:"bi bi-download me-2"}),"Download DOCX"]})]})}),a(qr,{projectId:c==null?void 0:c.id,hierarchyId:r[0]})]}):s("div",{className:"text-center py-4",children:[a("div",{className:"mb-3",children:a("i",{className:"bi bi-file-text",style:{fontSize:"3rem",color:"#6c757d"}})}),s("h5",{className:"mb-3",children:["Generate Your ",O.name]}),s("p",{className:"text-muted mb-4",children:["No sections found for this document yet. Pick the sources you want to generate from — or leave them all unselected to use everything — then let our AI draft your ",O.name," sections."]}),a("div",{className:"mb-4",children:a(Wt,{projectId:c==null?void 0:c.id,selectedIds:F,onChange:ue,disabled:C})}),s(he,{color:"primary",size:"lg",onClick:Ne,disabled:C||!c||!r,children:[a("i",{className:"bi bi-play-circle me-2"}),"Generate Sections"]}),(!c||!r)&&a("div",{className:"mt-2",children:a("small",{className:"text-danger",children:c?"Document type not selected":"Project data not available"})})]});return s(Tn,{isOpen:e,toggle:n,size:"xl",children:[a(Ln,{toggle:n,children:"Review Your Document Selection"}),s($n,{children:[s(Zr,{children:[s(ct,{children:[a("strong",{children:"Regulation:"}),a("div",{className:"ms-3 text-primary",children:t.activeTab})]}),s(ct,{children:[a("strong",{children:"Module:"}),s("div",{className:"ms-3 text-primary",children:[(ye=t.module)==null?void 0:ye.id,". ",(fe=t.module)==null?void 0:fe.name]})]}),t.theme&&s(ct,{children:[a("strong",{children:"Theme:"}),s("div",{className:"ms-3 text-primary",children:[t.theme.id," ",t.theme.name]})]}),t.subSection&&s(ct,{children:[a("strong",{children:"Sub-section:"}),s("div",{className:"ms-3 text-primary",children:[t.subSection.id," ",t.subSection.name]})]}),r&&s(ct,{children:[a("strong",{children:"Document Name:"}),s("div",{className:"ms-3 text-primary",children:[r[0]," ",O.name]})]})]}),Se(),s(Re,{color:"info",className:"mt-3",children:[a("i",{className:"bi bi-info-circle me-2"}),"Please review your selections — once confirmed, we'll get started on your document!"]})]}),a(Rn,{children:a(he,{color:"primary",onClick:n,children:"Back to Selection"})})]})},Nn=["Literature Review Plan (LRP)","Literature Review Report (LRR)","Clinical Evaluation Plan (CEP)","Clinical Evaluation Report (CER)","Investigator’s Brochure","Clinical Investigation Plan (CIP)","Clinical Investigation Report (CIR)","Study Protocol","Clinical Study Report (CSR)","Study Synopsis","Instructions for Use (IFU)","Labelling","Product Specification","Postmarket Surveillance Plan (PMS Plan)","Periodic Safety Update Report (PSUR)","Postmarket Surveillance Report (PMS Report)","Postmarket Clinical Follow-up Plan (PMCF Plan)","Postmarket Clinical Follow-up Evaluation Report (PMCF Evaluation Report)","Risk Management Plan (RMP)","Risk Evaluation Report (RER)","Risk Management Report (RMR)","Biocompatibility","Physical, Chemical and Microbiological Testing","Electrical Safety and Electromagnetic Compatibility (EMC)","Software Verification and Validation","Stability, Including Shelf Life","Other Pre-clinical tests","Equivalent Device Document","Similar Document","Other Documentation"],Lr={"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"]},$r=[".pdf",".docx",".xlsx"],Pn=e=>{if(Object.prototype.hasOwnProperty.call(Lr,e==null?void 0:e.type))return!0;const n=((e==null?void 0:e.name)||"").toLowerCase();return $r.some(t=>n.endsWith(t))},$t=1024,In=e=>e==="External service rejected file"?"Document type not recognized — please select a different type and try again.":e||"Registration failed",Ba=e=>{const[n,t]=M.useState([]),[o,r]=M.useState(!1),[i,l]=M.useState(null),[c,m]=M.useState(!1),[g,h]=M.useState(!1),[C,p]=M.useState("idle"),[y,w]=M.useState(!1),[b,f]=M.useState(null),N=M.useRef(null),k=hn.useRef(null),S=M.useRef(null),ae=(d=0)=>new Promise(v=>setTimeout(v,d));M.useEffect(()=>{const d=Kt();l(d)},[]),M.useEffect(()=>()=>{S.current&&clearInterval(S.current)},[]);const me=M.useMemo(()=>n.filter(d=>!!d.doc_title).length,[n]),ce=M.useMemo(()=>n.filter(d=>!d.doc_title).length,[n]),Ce=d=>{const v={size:20,className:"flex-shrink-0"};switch(d){case"application/pdf":return a(bn,{...v,className:"flex-shrink-0 text-danger"});case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return a(dt,{...v,className:"flex-shrink-0 text-primary"});case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return a(dt,{...v,className:"flex-shrink-0 text-success"});case"text/plain":return a(dt,{...v,className:"flex-shrink-0 text-secondary"});default:return a(bn,{...v,className:"flex-shrink-0 text-info"})}},{getRootProps:_e,getInputProps:se}=Jr({multiple:!0,accept:Lr,onDrop:d=>{r(!1);const v=d.filter(I=>Pn(I));if(v.length!==d.length&&V.error("Some files couldn't be added — only PDF, DOCX, and XLSX documents are accepted."),v.length>0){const I=Date.now(),z=v.map((H,j)=>({id:`file-${I}-${j}-${Math.random().toString(36).slice(2)}`,file:H,doc_title:"",file_category:"",is_article:!1,status:"pending",bytesUploaded:0,error:null}));t(H=>[...H,...z]),p("idle"),f(null)}},onDragEnter:()=>r(!0),onDragLeave:()=>r(!1)}),Z=d=>{const v=d/$t;return v>=1024?`${(v/1024).toFixed(2)} MB`:`${v.toFixed(1)} KB`},F=async d=>{var j,T;console.log("Delete button clicked for file ID:",d);const v=n.find(K=>K.id===d);if(console.log("Target file:",v),!v){console.log("No target file found"),V.error("Hmm, couldn't find this document.");return}if(v.status==="uploading"){V.error("This document is still being uploaded — please wait!");return}console.log("File status:",v.status),console.log("Server record ID:",v.serverRecordId),console.log("Current project:",i);const I=v.status==="success"&&v.serverRecordId&&(i==null?void 0:i.id),z=I?`Are you sure you want to delete "${v.file.name}"? This will permanently remove the file from the server.`:`Remove "${v.file.name}" from the upload list?`;if(!window.confirm(z)){console.log("User cancelled deletion");return}if(I){console.log("Attempting to delete from server...");try{const K=await Ie.post("/apiv1/ctd/devices/delete-file/",{file_id:v.serverRecordId,project_id:i.id});if(console.log("Server response:",K),K.status===200)V.success("Document removed from your dossier!"),e.onUploadComplete&&(console.log("Calling onUploadComplete callback after file deleti
137on"),e.onUploadComplete());else{V.error("Couldn't remove this document from your dossier. Please try again.");return}}catch(K){console.error("Error deleting file:",K),V.error(`Couldn't remove this document: ${((T=(j=K==null?void 0:K.response)==null?void 0:j.data)==null?void 0:T.error)||(K==null?void 0:K.message)||"unexpected error"}`);return}}else console.log("File not uploaded to server, just removing from UI"),V.success("Document cleared from your list.");console.log("Removing file from local state"),t(K=>{const u=K.filter(P=>P.id!==d);return console.log("Files after removal:",u.length),u}),n.length-1===0&&(console.log("No files left, resetting upload state"),p("idle"),f(null)),console.log("File removal completed")},ue=async()=>{if(g)return;const d=n.filter(v=>v.status==="success"&&v.serverRecordId);if(!(d.length>0&&!window.confirm(`Are you sure you want to delete all ${n.length} files? This will permanently remove ${d.length} uploaded file(s) from the server.`))){if(d.length>0&&(i!=null&&i.id)){const v=d.map(I=>Ie.post("/apiv1/ctd/devices/delete-file/",{file_id:I.serverRecordId,project_id:i.id}).catch(z=>(console.error(`Failed to delete file ${I.file.name}:`,z),{error:!0,fileName:I.file.name})));try{const z=(await Promise.all(v)).filter(H=>H==null?void 0:H.error);z.length>0?V.error(`${z.length} document(s) couldn't be removed. Please try again.`):d.length>0&&V.success(`${d.length} document(s) removed from your dossier!`),d.length>0&&e.onUploadComplete&&(console.log("Calling onUploadComplete callback after bulk file deletion"),e.onUploadComplete())}catch(I){console.error("Error during bulk file deletion:",I),V.error("Some documents couldn't be removed. Please check and try again.")}}t([]),p("idle"),f(null)}},J=(d,v)=>{const I=d.target.value;t(z=>z.map(H=>H.id===v?{...H,doc_title:I}:H))},O=(d,v)=>{const I=d.target.value;t(z=>z.map(H=>H.id===v?{...H,file_category:I}:H))},oe=d=>{var j;if(c||g||!((j=d.target.files)!=null&&j.length))return;const v=Array.from(d.target.files),I=v.filter(T=>Pn(T));if(I.length!==v.length&&V.error("Some files couldn't be added — only PDF, DOCX, and XLSX documents are accepted."),I.length===0){d.target.value="";return}const z=Date.now(),H=I.map((T,K)=>({id:`file-${z}-${K}-${Math.random().toString(36).slice(2)}`,file:T,doc_title:"",file_category:"",is_article:!1,status:"pending",bytesUploaded:0,error:null}));t(T=>[...T,...H]),p("idle"),f(null)},ve=async()=>{var I,z,H,j;if(c)return;if(!(i!=null&&i.id)){V.error("Please open a project before uploading.");return}const d=n.filter(T=>T.status==="pending"||T.status==="ready"||T.status==="error");
137if(d.length===0){V("Add some documents first!");return}let v;try{m(!0),p("scanning"),v=V.loading("Preparing secure upload channel...");const T=await Ie.post("/apiv1/ctd/devices/check-docs/",{project_id:i.id,files:d.map(B=>({file_name:B.file.name,file_category:B.file_category||""}))},{headers:{"Content-Type":"application/json"}});if(T.status<200||T.status>=300)throw new Error(`Failed to get upload URLs: ${T.status}`);const K=((I=T.data)==null?void 0:I.presigned_urls)||[],u={};K.forEach(B=>{u[B.file_name]=B}),V.dismiss(v),v=V.loading(`Transferring ${d.length} document(s) to your dossier...`),await Promise.all(d.map(async B=>{const G=u[B.file.name];if(!G)throw new Error(`No upload URL found for ${B.file.name}`);await Ne(G.upload_url,B.file)})),V.dismiss(v),v=V.loading("Identifying document types...");const P=await Ie.post("/apiv1/ctd/devices/scan-docs/",{project_id:i.id,files:d.map(B=>{const G=u[B.file.name];return{file_name:(G==null?void 0:G.file_name)||B.file.name,file_category:(G==null?void 0:G.file_category)||B.file_category||"",s3_key:(G==null?void 0:G.s3_key)||""}})},{headers:{"Content-Type":"application/json"}});if(P.status<200||P.status>=300)throw new Error(`Scan failed with status: ${P.status}`);const q=((z=P.data)==null?void 0:z.scan_response)||[];t(B=>B.map(G=>{const Y=Array.isArray(q)?q.find(we=>we.filename===G.file.name):null;return{...G,doc_title:(Y==null?void 0:Y.title)||G.doc_title,is_article:(Y==null?void 0:Y.is_article)??G.is_article??!1,status:"ready"}})),p("confirming"),w(!0),V.success(`${d.length} document${d.length!==1?"s":""} identified!`)}catch(T){console.error(T),V.error(((j=(H=T==null?void 0:T.response)==null?void 0:H.data)==null?void 0:j.error)||(T==null?void 0:T.message)||"Failed to process documents."),p("idle")}finally{m(!1),v&&V.dismiss(v)}},Ne=async(d,v,I)=>{const{url:z,fields:H}=d,j=new FormData;Object.entries(H).forEach(([K,u])=>j.append(K,u)),j.append("file",v);const T=await fetch(z,{method:"POST",body:j,signal:I});if(!T.ok)throw new Error(`S3 upload failed for ${v.name}: ${T.status}`)},De=()=>{if(!g){V("Nothing to cancel here!");return}k.current&&k.current.abort(),V("Stopping document transfer...")},be=async d=>{var I,z,H,j,T,K,u;if(!(i!=null&&i.id)){V.error("Please open a project before uploading.");return}const v=A.current.find(P=>P.id===d);if(!v){V.error("File not found.");return}h(!0),t(P=>P.map(q=>q.id===d?{...q,status:"uploading",error:null}:q));try{const B=(((I=(await Ie.post("/apiv1/ctd/devices/check-docs/",{project_id:i.id,files:[{file_name:v.file.name,file_category:v.file_category||""}]},{headers:{"Content-Type":"application/json"}})).data)==null?void 0:I.presigned_urls)||[]).find(Qe=>Qe.file_name===v.file.name);if(!B)throw new Error("Couldn't prepare the upload. Please try again.");await Ne(B.upload_url,v.file);const Y=((z=(await Ie.post("/apiv1/ctd/devices/scan-docs/",{project_id:i.id,files:[{file_name:B.file_name,file_category:B.file_category||v.file_category||"",s3_key:B.s3_key}]},{headers:{"Content-Type":"application/json"}})).data)==null?void 0:z.scan_response)||[],we=Array.isArray(Y)?Y.find(Qe=>Qe.filename===v.file.name):null,xe=(we==null?void 0:we.title)||v.doc_title,Je=(we==null?void 0:we.is_article)??v.is_article??!1,Ze=(j=(H=(await Ie.post("/apiv1/ctd/devices/add-docs/",{project_id:i.id,files:[{file_name:v.file.name,doc_title:xe,is_article:Je}]},{headers:{"Content-Type":"application/json"}})).data)==null?void 0:H.uploaded_files)==null?void 0:j[0];t(Qe=>Qe.map(vt=>vt.id===d?{...vt,status:"success",bytesUploaded:vt.file.size,serverRecordId:Ze==null?void 0:Ze.id,doc_title:(Ze==null?void 0:Ze.title)||xe}:vt)),V.success("Document added to your dossier!"),e.onUploadComplete&&e.onUploadComplete()}catch(P){const q=(T=P==null?void 0:P.response)==null?void 0:T.data,B=(q==null?void 0:q.error)||((u=(K=q==null?void 0:q.failed_files)==null?void 0:K[0])==null?void 0:u.error)||(P==null?void 0:P.message),G=In(B);t(Y=>Y.map(we=>we.id===d?{...we,status:"error",error:G}:we)),V.error(`Couldn't upload this document: ${G}`)}finally{h(!1)}},de=async d=>{if(!n.find(I=>I.id===d)){V.error("File not found.");return}if(g){V.error("Hold on — another document is still being processed.");return}t(I=>I.map(z=>z.id===d?{...z,status:"pending",error:null,bytesUploaded:0}:z)),await ae(100),await be(d)},Se=d=>{S.current&&clearInterval(S.current),S.current=setInterval(async()=>{var v,I,z,H,j;try{const T=await Ie.get("/apiv1/ctd/devices/upload-status/",{params:{project_id:d}}),K=(v=T.data)==null?void 0:v.state;if(K==="COMPLETED"){clearInterval(S.current),S.current=null;const u=((z=(I=T.data)==null?void 0:I.data)==null?void 0:z.files)||[];t(P=>P.map(q=>{const B=u.find(G=>G.filename===q.file.name);return(B==null?void 0:B.status)==="processed"?{...q,status:"success",bytesUploaded:q.file.size}:q})),h(!1),p("success"),V.success("All documents are ready in your dossier!"),e.onUploadComplete&&e.onUploadComplete(),setTimeout(()=>{var P;(P=e.toggleShow)==null||P.call(e),t([]),f(null),p("idle")},2500)}else if(K==="FAILED"){clearInterval(S.current),S.current=null;const u=((j=(H=T.data)==null?void 0:H.data)==null?void 0:j.error)||"Document processing failed. Please try again.";h(!1),p("confirming"),w(!0),V.error(u)}}catch(T){clearInterval(S.current),S.current=null,console.error("Error polling upload status:",T),h(!1),p("confirming"),w(!0),V.error("Couldn't verify document status. Please try again.")}},4e3)},ye=async()=>{var v,I;if(!(i!=null&&i.id)){V.error("Please open a project before uploading.");return}if(ce>0){V.error("Please assign a document type to each file before continuing.");return}w(!1),p("uploading"),f(null),h(!0);const d=A.current.filter(z=>z.status==="ready"||z.status==="pending"||z.status==="error");try{const H=(await Ie.post("/apiv1/ctd/devices/add-docs/",{project_id:i.id,files:d.map(P=>({file_name:P.file.name,doc_title:P.doc_title,is_article:P.is_article??!1}))},{headers:{"Content-Type":"application/json"}})).data,j=(H==null?void 0:H.uploaded_files)||[],T=(H==null?void 0:H.failed_files)||[],K=j.length,u=T.length;if(t(P=>P.map(q=>{const B=j.find(Y=>Y.filename===q.file.name),G=T.find(Y=>Y.filename===q.file.name);return B?{...q,status:"ingesting",serverRecordId:B.id,doc_title:B.title||q.doc_title}:G?{...q,status:"error",error:In(G.error)}:q})),f({uploaded_files:j,failed_files:T}),K===0){V.error("None of the documents could be registered. Please try again."),p("confirming"),h(!1);return}u>0&&V(P=>s("div",{children:[K," document(s) queued, ",u," could not be added.",a("div",{className:"mt-2",children:a(he,{size:"sm",color:"warning",onClick:()=>V.dismiss(P.id),children:"Dismiss"})})]})),p("ingesting"),Se(i.id)}catch(z){console.error(z),V.error(((I=(v=z==null?void 0:z.response)==null?void 0:v.data)==null?void 0:I.error)||(z==null?void 0:z.message)||"An unexpected error occurred during upload."),p("confirming"),h(!1)}},fe=()=>{g||(w(!1),p("idle"))},A=hn.useRef(n);M.useEffect(()=>{A.current=n},[n]);const Q=n.filter(d=>d.status==="success").length,ne=n.filter(d=>d.status==="uploading").length,re=n.filter(d=>d.status==="error").length;if(C==="ingesting"){const d=n.filter(v=>v.status==="ingesting"||v.status==="success");return a(Ve,{className:"shadow-sm border-0",children:s(We,{className:"text-center py-5",children:[a("div",{className:"spinner-border text-primary mb-3",role:"status",style:{width:"3rem",height:"3rem"},children:a("span",{className:"visually-hidden",children:"Loading..."})}),a("h4",{className:"mb-2",children:"Processing Your Documents..."}),a("p",{className:"text-muted mb-4",children:"Our AI is carefully analyzing your regulatory evidence. This may take a few minutes — perfect time for a coffee!"}),a("div",{className:"text-start mx-auto",style:{maxWidth:"420px"},children:d.map(v=>s("div",{className:"d-flex align-items-center mb-2 p-2 rounded bg-light",children:[v.status==="success"?a(ot,{size:16,className:"text-success me-2 flex-shrink-0"}):a("div",{className:"spinner-border spinner-border-sm text-primary me-2 flex-shrink-0",role:"status",children:a("span",{className:"visually-hidden",children:"Processing..."})}),a("small",{className:"text-truncate flex-grow-1",children:v.file.name}),a("small",{className:"text-muted ms-2 flex-shrink-0",children:v.status==="success"?"Ready":"Processing..."})]},v.id))})]})})}return C==="success"?a(Ve,{className:"shadow-sm border-0",children:s(We,{className:"text-center py-5",children:[a(ot,{size:48,className:"text-success mb-3"}),a("h4",{className:"text-success mb-2",children:"Dossier Updated!"}),s("p",{className:"text-muted",children:[Q," document",Q!==1?"s":""," ","added to your regulatory dossier"]}),a(Rt,{value:100,color:"success",className:"my-3"})]})}):s("div",{className:"document-uploader",children:[a(Ve,{className:"shadow-sm border-0 mb-3",children:a(xt,{className:"bg-gradient-light border-0",children:s("div",{className:"d-flex justify-content-between align-items-center",children:[s("div",{children:[s(zn,{tag:"h4",className:"mb-1 text-primary",children:[a(gn,{size:24,className:"me-2"}),"Smart Document Upload"]}),a("p",{className:"text-muted mb-0 small",children:"Drop your regulatory documents — titles are detected automatically"})]}),n.length>0&&s("div",{className:"text-end",children:[s("div",{className:"d-flex align-items-center gap-2 flex-wrap justify-content-end",children:[C==="scanning"&&s(Oe,{color:"info",pill:!0,children:[a(Qr,{size:12,className:"me-1"}),"Identifying..."]}),C==="confirming"&&s(Oe,{color:"warning",pill:!0,children:[a(Tt,{size:12,className:"me-1"}),"Review Titles"]}),me>0&&C!=="scanning"&&s(Oe,{color:"success",pill:!0,children:[a(ot,{size:12,className:"me-1"}),me," Ready"]}),ne>0&&s(Oe,{color:"primary",pill:!0,children:["Uploading ",ne]}),re>0&&s(Oe,{color:"danger",pill:!0,children:["Failed ",re]})]}),s("small",{className:"text-muted d-block mt-1",children:[n.length," file",n.length!==1?"s":""," selected"]})]})]})})}),a(Ve,{className:"shadow-sm border-0 mb-3",children:a(We,{className:"p-0",children:s("div",{..._e(),className:`upload-zone p-5 text-center rounded transition-all ${o?"bg-primary bg-opacity-10 border-primary border-2":"bg-light border-2 border-dashed"} ${c||g?"opacity-50 pointer-events-none":"cursor-pointer"}`,style:{minHeight:"160px",transition:"all 0.3s ease"},"aria-disabled":c||g,children:[a("input",{...se()}),a("div",{className:"upload-content",children:o?s($e,{children:[a(eo,{size:40,className:"text-primary mb-3"}),a("h5",{className:"text-primary mb-2",children:"Drop your files here"})]}):s($e,{children:[a(to,{size:40,className:"text-muted mb-3"}),a("h5",{className:"mb-2",children:"Choose files or drag them here"}),a("p",{className:"text-muted mb-3",children:"Support for PDF, DOCX, and XLSX files"}),s(he,{color:"primary",outline:!0,size:"sm",disabled:c||g,children:[a(vn,{size:16,className:"me-1"}),"Browse Files"]})]})})]})})}),n.length>0&&s(Ve,{className:"shadow-sm border-0",children:[a(xt,{className:"bg-white border-bottom",children:s("div",{className:"d-flex justify-content-between align-items-center",children:[s("h6",{className:"mb-0",children:["Selected Documents (",n.length,")"]}),s("div",{className:"d-flex gap-2",children:[s(he,{color:"danger",size:"sm",outline:!0,onClick:ue,disabled:c||g,title:"Clear all files",children:[a(no,{size:14,className:"me-1"}),"Clear All"]}),s(he,{color:"secondary",size:"sm",outline:!0,onClick:De,disabled:!g,title:"Cancel all ongoing uploads",children:[a(ro,{size:14,className:"me-1"}),"Cancel Uploads"]})]})]})}),s(We,{className:"p-0",children:[C==="idle"&&n.length>0&&s(Re,{color:"info",className:"m-3 mb-0",children:[a(gn,{size:16,className:"me-2"}),'Set the category for each document, then click "Identify Documents" to let our AI do the rest.']}),a("div",{className:"file-list",children:n.map((d,v)=>{const I=(d.file.size/$t).toFixed(2),z=(d.bytesUploaded/$t).toFixed(2),H=Math.min(100,Math.round(d.bytesUploaded/Math.max(d.file.size,1)*100));return a("div",{className:`file-item p-3 ${v!==n.length-1?"border-bottom":""}`,children:s(Ge,{className:"align-items-center gy-2",children:[a(je,{md:"5",children:s("div",{className:"d-flex align-items-center",children:[a("div",{className:"me-3",children:Ce(d.file.type)}),s("div",{className:"file-info flex-grow-1 min-width-0",children:[a("h6",{className:"mb-0 text-truncate",style:{maxWidth:"260px"},id:`file-name-${d.id}`,children:d.file.name}),a(kt,{target:`file-name-${d.id}`,children:d.file.name}),a("small",{className:"text-muted",children:Z(d.file.size)})]})]})}),a(je,{md:"5",children:s("div",{className:"d-flex align-items-center w-100",children:[s("div",{className:"flex-grow-1 me-2",children:[d.doc_title&&a("div",{className:"mb-2",children:s("small",{className:"text-muted d-block",children:[a(ot,{size:12,className:"me-1 text-success"}),d.doc_title]})}),d.status==="error"&&!d.doc_title&&s("div",{className:"mb-2",children:[a(Lt,{className:"form-label small text-muted mb-1",children:"Document Type:"}),s(nt,{type:"select",value:d.doc_title,onChange:j=>J(j,d.id),className:"form-select border-warning",size:"sm","aria-label":`Document type for ${d.file.name}`,children:[a("option",{value:"",children:"Choose document type..."}),Nn.map((j,T)=>a("option",{value:j,children:j},T))]}),s("small",{className:"text-warning d-block mt-1",children:[a(bt,{size:12,className:"me-1"}),"Document type required for retry"]})]}),s("div",{children:[a(Lt,{className:"form-label small text-muted mb-1",children:"File Category:"}),s(nt,{type:"select",value:d.file_category||"",onChange:j=>O(j,d.id),className:"form-select",disabled:c||["uploading","paused","success"].includes(d.status),size:"sm","aria-label":`File category for ${d.file.name}`,children:[a("option",{value:"",children:"Investigational"}),a("option",{value:"equivalent",children:"Equivalent"}),a("option",{value:"similar",children:"Similar"})]})]}),["uploading","success","canceled"].includes(d.status)&&s("div",{className:"mt-2",children:[s("div",{className:"d-flex justify-content-between mb-1",children:[s("small",{className:"text-muted",children:[z," KB / ",I," KB"]}
137),s("small",{className:"text-muted",children:[d.status==="uploading"&&"Saving...",d.status==="success"&&"Completed",d.status==="canceled"&&"Canceled"]})]}),a(Rt,{value:d.status==="success"?100:H,animated:d.status==="uploading",striped:d.status==="uploading",color:d.status==="success"?"success":"primary",className:"progress-sm"})]}),d.status==="error"&&d.error&&s("div",{className:"mt-2 p-2 rounded d-flex align-items-start gap-2",style:{background:"rgba(220,53,69,.08)",border:"1px solid rgba(220,53,69,.25)"},children:[a(bt,{size:14,className:"text-danger flex-shrink-0 mt-1"}),a("small",{className:"text-danger lh-sm",children:d.error})]})]}),a("div",{className:"d-flex gap-1",children:d.status==="error"&&s(he,{color:"warning",size:"sm",outline:!0,onClick:()=>de(d.id),title:d.doc_title?"Retry Upload":"Select document type first",disabled:g||!d.doc_title,children:[a(fo,{size:14}),a("span",{className:"ms-1 d-none d-md-inline",children:"Retry"})]})})]})}),s(je,{md:"2",className:"text-end",children:[a(he,{color:"danger",size:"sm",outline:!0,className:"btn-icon rounded-circle",onClick:j=>{j.preventDefault(),j.stopPropagation(),console.log("Delete button clicked!",d.id,d.status),console.log("Button disabled?",["uploading","paused"].includes(d.status)||c),F(d.id)},disabled:d.status==="uploading"||c,id:`remove-${d.id}`,"aria-label":`Remove ${d.file.name}`,title:d.status==="uploading"?"Cannot delete while uploading":"Remove file",children:a(jr,{size:14})}),a(kt,{target:`remove-${d.id}`,children:"Remove file"})]})]})},d.id)})}),a("div",{className:"p-3 bg-light border-top",children:s(Ge,{children:[a(je,{children:s(he,{color:"secondary",outline:!0,onClick:()=>{var d;return(d=N.current)==null?void 0:d.click()},disabled:c||g,className:"me-2",children:[a(vn,{size:16,className:"me-1"}),"Add More"]})}),a(je,{className:"text-end",children:C==="idle"&&a(he,{color:"primary",size:"lg",onClick:ve,disabled:c||n.length===0,className:"px-4",children:c?s($e,{children:[a("div",{className:"spinner-border spinner-border-sm me-2",role:"status",children:a("span",{className:"visually-hidden",children:"Loading..."})}),"Identifying..."]}):s($e,{children:[a(Tt,{size:16,className:"me-2"}),"Identify Documents",a(so,{size:16,className:"ms-1"})]})})})]})})]})]}),s(Tn,{isOpen:y,toggle:fe,size:"lg",children:[s(Ln,{toggle:fe,children:[a(Tt,{size:20,className:"me-2"}),"Confirm Your Document Types"]}),s($n,{children:[s(Re,{color:"success",className:"mb-3",children:[a(ot,{size:16,className:"me-2"}),"Our AI identified your document types! Review and adjust if needed before adding to your dossier."]}),a("div",{className:"detected-files-list",children:n.map(d=>a(Ve,{className:"mb-3 border",children:a(We,{className:"p-3",children:s(Ge,{className:"align-items-start gy-3",children:[a(je,{md:"3",children:s("div",{className:"d-flex align-items-center",children:[a("div",{className:"me-3",children:Ce(d.file.type)}),s("div",{children:[a("h6",{className:"mb-0 text-truncate",style:{maxWidth:"150px"},children:d.file.name}),a("small",{className:"text-muted",children:Z(d.file.size)})]})]})}),s(je,{md:"7",children:[a(Lt,{className:"form-label small text-muted mb-2",children:"Document Type:"}),s(nt,{type:"select",value:d.doc_title||"",onChange:v=>J(v,d.id),className:"form-select form-select-sm","aria-label":`Document type for ${d.file.name}`,children:[a("option",{value:"",children:"Choose document type..."}),Nn.map((v,I)=>a("option",{value:v,children:v},I))]})]}),a(je,{md:"2",className:"text-center",children:d.doc_title?a(ot,{size:20,className:"text-success"}):a(bt,{size:20,className:"text-warning"})})]})})},d.id))}),ce>0&&s(Re,{color:"warning",className:"mt-3",children:[a(bt,{size:16,className:"me-2"}),ce," document",ce!==1?"s":""," still need",ce===1?"s":""," a document type selected."]})]}),s(Rn,{children:[s(he,{color:"secondary",onClick:fe,disabled:g,children:[a(oo,{size:16,className:"me-1"}),"Back to Edit"]}),a(he,{color:"primary",onClick:ye,disabled:g||ce>0||n.length===0,className:"px-4",children:g?s($e,{children:[a("div",{className:"spinner-border spinner-border-sm me-2",role:"status",children:a("span",{className:"visually-hidden",children:"Loading..."})}),"Uploading..."]}):s($e,{children:[a(Fn,{size:16,className:"me-2"}),"Confirm & Upload ",me," Document",me!==1?"s":""]})})]})]}),a("input",{ref:N,type:"file",accept:$r.join(","),style:{display:"none"},multiple:!0,onChange:oe,disabled:c||g}),b&&s("div",{className:"mb-3",children:[b.message&&a(Re,{color:b.success?"success":"warning",className:"mb-2",children:b.message}),b.warning&&a(Re,{color:"warning",className:"mb-2",children:b.warning}),b.failed_files&&b.failed_files.length>0&&s(Re,{color:"danger",className:"mb-2",children:[a("strong",{className:"d-block mb-2",children:"Failed Files:"}),a("ul",{className:"mb-0 ps-3",children:b.failed_files.map((d,v)=>s("li",{className:"mb-1",children:[d.filename,": ",d.error]},v))})]})]})]})},Aa=()=>{var K;
137const e=Dn(),[n,t]=M.useState(""),[o,r]=M.useState(""),[i,l]=M.useState(""),[c,m]=M.useState([]),[g,h]=M.useState(!1),[C,p]=M.useState(null),[y,w]=M.useState([]),[b,f]=M.useState(!1),[N,k]=M.useState(""),[S,ae]=M.useState(!1),[me,ce]=M.useState("list"),[Ce,_e]=M.useState(null),[se,Z]=M.useState([]),[F,ue]=M.useState(!1);M.useEffect(()=>{const u=Kt();p(u),console.log("Current Project Data:",u),u&&J(u)},[]);const J=u=>{u&&Ie.post("/apiv1/ctd/devices/fetch-related-docs/",{project_id:u.id}).then(P=>{console.log("Fetching uploaded files for project:",P.data),w(P.data.documents||[])}).catch(P=>{console.error("Error fetching uploaded files:",P),w([])})},O=async(u,P)=>{var B,G;if(!(C!=null&&C.id)){alert("No project selected");return}if(window.confirm(`Are you sure you want to delete "${P}"? This will permanently remove the file from the server.`)){_e(u);try{(await Ie.post("/apiv1/ctd/devices/delete-file/",{file_id:u,project_id:C.id})).status===200?(w(we=>we.filter(xe=>xe.id!==u)),alert(`File "${P}" deleted successfully`)):alert("Failed to delete file from server")}catch(Y){console.error("Error deleting file:",Y),alert(`Failed to delete file: ${((G=(B=Y==null?void 0:Y.response)==null?void 0:B.data)==null?void 0:G.error)||(Y==null?void 0:Y.message)||"Unknown error"}`)}finally{_e(null)}}},oe=async()=>{if(se.length===0){alert("No files selected");return}if(window.confirm(`Are you sure you want to delete ${se.length} selected file(s)? This will permanently remove them from the server.`)){ue(!0);try{const P=se.map(xe=>Ie.post("/apiv1/ctd/devices/delete-file/",{file_id:xe,project_id:C.id}).catch(Je=>(console.error(`Failed to delete file ${xe}:`,Je),{error:!0,fileId:xe}))),B=(await Promise.all(P)).filter(xe=>xe==null?void 0:xe.error),G=se.length-B.length,Y=B.map(xe=>xe.fileId),we=se.filter(xe=>!Y.includes(xe));w(xe=>xe.filter(Je=>!we.includes(Je.id))),Z([]),B.length>0?alert(`${G} file(s) deleted successfully. ${B.length} file(s) failed to delete.`):alert(`All ${G} file(s) deleted successfully`)}catch(P){console.error("Error during bulk deletion:",P),alert("Error occurred during bulk deletion")}finally{ue(!1)}}},ve=u=>{Z(P=>P.includes(u)?P.filter(q=>q!==u):[...P,u])},Ne=()=>{se.length===y.length?Z([]):Z(y.map(u=>u.id))},De=[{id:"1",name:"Device description and specs",icon:"📱",description:"Complete device specifications and technical details"},{id:"2",name:"Labelling and IFU",icon:"🏷️",description:"Instructions for use and labeling requirements"},{id:"3",name:"Design and Manufacturing",icon:"⚙️",description:"Manufacturing processes and design controls"},{id:"4",name:"GSPR",icon:"📋",description:"General Safety and Performance Requirements"},{id:"5",name:"Risk Management",icon:"⚠️",description:"Risk analysis and mitigation strategies"},{id:"6",name:"Verification and Validation",icon:"✅",description:"Testing and validation documentation"},{id:"7",name:"Post market surveillance",icon:"📊",description:"Post-market monitoring and reporting"}],be=[{id:"6.1",name:"Biocompatibility",icon:"🧬",description:"Biological safety and compatibility testing"},{id:"6.2",name:"Physical, chemical and microbiological testing",icon:"🔬",description:"Material and sterilization testing"},{id:"6.7",name:"Clinical Evaluation",icon:"👨‍⚕️",description:"Clinical evidence and evaluation"}],de=[{id:"6.7.1",name:"Clinical Evaluation and author qualifications",icon:"👤",description:"Evaluator credentials and qualifications"},{id:"6.7.2",name:"Literature Review",icon:"📚",description:"Systematic literature search and analysis"},{id:"6.7.3",name:"Clinical Investigations",icon:"🔍",description:"Clinical trials and studies"},{id:"6.7.4",name:"Post marketing clinical follow-up",icon:"📈",description:"PMCF plans and reports"},{id:"6.7.5",name:"Clinical Evaluation Report",icon:"📄",description:"Final clinical evaluation documentation"}],Se={"6.7.1":[{id:"6.7.1.1",name:"Author CVs",icon:"📄",size:"2-5 pages"}],"6.7.2":[{id:"6.7.2.1",name:"Literature review plan",icon:"📑",size:"5-10 pages"},{id:"6.7.2.2",name:"Literature review report",icon:"📊",size:"20-50 pages"}],"6.7.3":[{id:"6.7.3.1",name:"Clinical investigation plans",icon:"📋",size:"15-30 pages"},{id:"6.7.3.2",name:"Clinical investigation reports",icon:"📈",size:"30-100 pages"},{id:"6.7.3.3",name:"Investigator's Brochures",icon:"📚",size:"10-25 pages"}
137],"6.7.4":[{id:"6.7.4.1",name:"PMCF Plan",icon:"📝",size:"10-20 pages"},{id:"6.7.4.2",name:"PMCF Report",icon:"📊",size:"15-30 pages"}],"6.7.5":[{id:"6.7.5.1",name:"Clinical evaluation plan",icon:"📋",size:"10-20 pages"},{id:"6.7.5.2",name:"Clinical evaluation report",icon:"📄",size:"50-150 pages"}]},ye=[{id:0,title:"Module",icon:"📦",description:"Select technical file module"},{id:1,title:"Theme",icon:"🎯",description:"Choose verification theme"},{id:2,title:"Sub-section",icon:"📑",description:"Pick specific sub-section"},{id:3,title:"Documents",icon:"📄",description:"Select document types"},{id:4,title:"Review",icon:"✓",description:"Confirm your selection"}],fe=()=>n?n==="6"&&!o?1:o==="6.7"&&!i?2:i&&c.length===0?3:c.length>0?4:0:0,A=()=>{t(""),r(""),l(""),m([])},Q=u=>{t(u),r(""),l(""),m([])},ne=u=>{r(u),l(""),m([])},re=u=>{l(u),m([])},d=u=>{m(P=>P.includes(u)?[]:[u])},v=()=>h(!g),I=()=>{f(!0),v(),setTimeout(()=>{f(!1),A()},3e3)},z=()=>{const u=De.find(G=>G.id===n),P=be.find(G=>G.id===o),q=de.find(G=>G.id===i),B=c.map(G=>{var Y;return(Y=Se[i])==null?void 0:Y.find(we=>we.id===G)}).filter(Boolean);return{module:u,theme:P,subSection:q,docTypes:B}},H=De.filter(u=>u.name.toLowerCase().includes(N.toLowerCase())||u.id.includes(N)),j=()=>{const u=fe(),P=(u+1)/ye.length*100;return s("div",{className:"mb-4",children:[s("div",{className:"d-flex justify-content-between align-items-center mb-3",children:[a("h5",{className:"mb-0 fw-bold",children:"Documentation Selection Journey"}),s(Oe,{color:"info",pill:!0,className:"px-3 py-2",children:["Step ",u+1," of ",ye.length]})]}),a(Rt,{value:P,className:"mb-3",style:{height:"10px",borderRadius:"10px"},children:a("div",{className:"progress-bar bg-gradient"})}),a(Ge,{className:"g-2",children:ye.map((q,B)=>a(je,{xs:"6",md:!0,className:"text-center px-1",children:s("div",{className:`p-2 rounded-3 ${B===u?"bg-primary text-white shadow-sm":B<u?"bg-success text-white":"bg-light text-muted"}`,style:{transition:"all 0.3s ease",border:B===u?"2px solid #0d6efd":"none",minHeight:"70px"},children:[a("div",{style:{fontSize:"1.2rem"},className:"mb-1",children:B<u?"✓":q.icon}),a("div",{className:"fw-bold mb-0",style:{fontSize:"0.75rem"},children:q.title}),a("div",{className:"small d-none d-lg-block",style:{fontSize:"0.65rem",opacity:.8},children:q.description})]})},q.id))})]})},T=({item:u,isSelected:P,onClick:q,multiSelect:B=!1,showDescription:G=!1,disabled:Y=!1})=>a(Ve,{onClick:Y?void 0:q,className:`mb-3 cursor-pointer h-100 ${P?"border-primary shadow-sm":"border-light shadow-none"}`,title:Y?"Generation is currently available only for 6.7.5.1.":void 0,style:{cursor:Y?"not-allowed":"pointer",transition:"all 0.2s",borderWidth:P?"1.5px":"1px",transform:P?"translateY(-2px)":"translateY(0)",backgroundColor:P?"#f8faff":"",borderRadius:"8px",opacity:Y?.55:1},children:a(We,{className:"p-2 px-3",children:s("div",{className:"d-flex align-items-center",children:[s("div",{className:"d-flex align-items-center flex-grow-1 overflow-hidden",children:[a("div",{className:`rounded-circle d-flex align-items-center justify-content-center me-2 ${P?"bg-primary text-white":"bg-light text-secondary"}`,style:{width:"32px",fontSize:"1.1rem",flexShrink:0},children:u.icon}),s("div",{className:"flex-grow-1 overflow-hidden",children:[s("div",{className:"d-flex align-items-center flex-nowrap",children:[a(Oe,{color:"secondary",size:"sm",className:"me-1 px-1 py-0",style:{fontSize:"1.0rem"},children:u.id}),a("h6",{className:"mb-0 fw-bold text-truncate",style:{fontSize:"1.0rem"},children:u.name})]}),G&&u.description&&a("p",{className:"text-muted small mb-0 mt-1 text-truncate",style:{fontSize:"0.95rem"},children:u.description}),u.size&&a(Oe,{color:"light-info",children:u.size})]})]}),P&&a("div",{className:"bg-primary text-white rounded-circle d-flex align-items-center justify-content-center ms-2",style:{width:"20px",height:"20px",flexShrink:0,fontSize:"0.7rem"},children:B?"✓":"•"})]})})});return s(Vr,{fluid:!0,children:[b&&a(Re,{color:"success",className:"shadow-sm border-0 mb-4 animate-fade-in",children:s("div",{className:"d-flex align-items-center",children:[a("div",{className:"bg-success text-white rounded-circle d-flex align-items-center justify-content-center me-3",style:{width:"40px",height:"40px",fontSize:"1.5rem"},children:"✓"}),s("div",{children:[a("h5",{className:"mb-0",children:"Selection Confirmed!"}),a("p",{className:"mb-0",children:"Your documentation structure has been saved successfully."})]})]})}),C?s($e,{children:[a(Ve,{className:"shadow-sm mb-4 border-0 overflow-hidden",style:{borderRadius:"12px"},children:s("div",{className:"text-white",style:{background:"linear-gradient(135deg, #184874 0%, #1a5a8f 100%)",position:"relative",overflow:"hidden"},children:[a("div",{style:{position:"absolute",top:"-50px",right:"-50px",width:"200px",height:"200px",background:"rgba(255, 255, 255, 0.05)",borderRadius:"50%"}}),a("div",{style:{position:"absolute",bottom:"-30px",left:"-30px",width:"150px",height:"150px",background:"rgba(255, 255, 255, 0.03)",borderRadius:"50%"}}),s("div",{className:"d-flex align-items-stretch",style:{position:"relative",zIndex:1},children:[a("div",{style:{width:"6px",backgroundColor:"#ff9f43",borderRadius:"12px 0 0 12px"}}),s("div",{className:"flex-grow-1 p-4",children:[s("div",{className:"d-flex align-items-start justify-content-between mb-3",children:[s("div",{className:"d-flex align-items-center",children:[a("div",{style:{width:"40px",height:"40px",background:"rgba(255,255,255,0.2)",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(10px)",border:"1px solid rgba(255,255,255,0.3)",marginRight:"12px"},children:a(dt,{size:24})}),s("div",{children:[a("h3",{className:"mb-0 fw-bold text-white",style:{fontSize:"1.75rem",letterSpacing:"-0.02em",lineHeight:"1.2"},children:"CTD Control Evaluation Dashboard"}),a("p",{className:"mb-0 text-white",style:{opacity:.95,fontSize:"1rem",lineHeight:"1.6",fontWeight:"400"},children:"EU MDR Medical Device Documentation & Compliance Management"})]})]}),s("div",{className:"d-flex align-items-center gap-3",children:[s("div",{className:"d-flex gap-3",children:[s("div",{className:"text-center",style:{padding:"0 10px"},children:[a("div",{style:{fontSize:"1.5rem",fontWeight:"bold",lineHeight:1,color:"white"},children:y.length}),a("div",{style:{fontSize:"0.75rem",opacity:.8,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Documents"})]}),s("div",{className:"text-center",style:{padding:"0 10px"},children:[a("div",{style:{fontSize:"1.5rem",fontWeight:"bold",lineHeight:1,color:"white"},children:y.filter(u=>u.status==="processed").length}),a("div",{style:{fontSize:"0.75rem",opacity:.8,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Processed"})]}),s("div",{className:"text-center",style:{padding:"0 10px"},children:[s("div",{style:{fontSize:"1.5rem",fontWeight:"bold",lineHeight:1,color:"white"},children:[Math.round(y.filter(u=>u.status==="processed").length/Math.max(y.length,1)*100),"%"]}),a("div",{style:{fontSize:"0.75rem",opacity:.8,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Complete"})]})]}),s("div",{className:"ms-3 d-flex flex-column gap-1",children:[s(he,{color:"light",size:"sm",onClick:()=>ae(!S),style:{background:"rgba(255,255,255,0.95)",color:"#184874",border:"none",fontWeight:"600",padding:"8px 16px",borderRadius:"8px",fontSize:"0.875rem",whiteSpace:"nowrap"},children:[a(io,{size:16,className:"me-1"}),S?"Close":"Upload"]}),s(he,{size:"sm",outline:!0,tag:Br,to:Gr(e.pathname),style:{background:"transparent",color:"#ffffff",borderColor:"rgba(255,255,255,0.6)",fontWeight:"600",padding:"8px 16px",borderRadius:"8px",fontSize:"0.875rem",whiteSpace:"nowrap"},children:[a(ao,{size:16,className:"me-1"}),"Generations"]})]})]})]}),s("div",{className:"d-flex align-items-center gap-4 mt-3",children:[s("div",{className:"d-flex align-items-center",children:[a("span",{className:"text-white",style:{opacity:.8,fontSize:"0.875rem",marginRight:"8px"},children:"Project:"}),a("span",{className:"fw-bold text-white",style:{fontSize:"0.875rem"},children:C.name})]}),s("div",{className:"d-flex align-items-center",children:[a("span",{className:"text-white",style:{opacity:.8,fontSize:"0.875rem",marginRight:"8px"},children:"Device ID:"}),a("code",{style:{background:"rgba(255,255,255,0.2)",color:"white",padding:"2px 8px",borderRadius:"4px",fontSize:"0.8rem"},children:C.medicament_id||C.project_id})]}),a(Oe,{style:{backgroundColor:"#ff9f43",color:"white",border:"none",borderRadius:"8px",fontSize:"0.7rem",fontWeight:"700",textTransform:"uppercase",letterSpacing:"0.8px",padding:"6px 12px"},children:C.status==="in_progress"?"In Progress":C.status})]})]})]})]})}),s(Ve,{className:"shadow-sm mb-4 border-0",style:{borderRadius:"12px",border:"none",backgroundColor:"#ffffff"},children:[a(xt,{style:{background:"linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)",borderBottom:"1px solid #dee2e6",borderRadius:"12px 12px 0 0"},children:s("div",{className:"d-flex justify-content-between align-items-center flex-wrap",children:[s("div",{className:"mb-2 mb-md-0",children:[a(zn,{tag:"h5",className:"mb-0",style:{color:"#184874"},children:"Document Management"}),a("small",{className:"text-muted",children:"Manage your technical documentation files"})]}),s(Oe,{color:"primary",style:{fontSize:"0.75rem",padding:"0.5rem 1rem"},children:[y.length," Files"]})]})}),S&&s(We,{className:"border-bottom bg-light",children:[s(Re,{color:"info",className:"mb-3",children:[a("strong",{children:"Upload Documents:"})," Add the required documentation for your selected regulatory structure."]}),a(Ba,{existingFiles:y,blockDuplicates:!0,onUploadComplete:()=>{console.log("DevicesUploader onUploadComplete callback triggered"),C?(console.log("Refreshing uploaded files list for project:",C.id),J(C)):console.log("No current project found, cannot refresh files")}})]}),y&&y.length>0&&s(We,{style:{padding:"0"},children:[s("div",{className:"p-1 d-flex justify-content-between align-items-center my-1",children:[s("div",{className:"d-flex align-items-center gap-3",children:[s("h6",{className:"mb-0 fw-bold",children:["Uploaded Documents (",y.length,")"]}),se.length>0&&s("div",{className:"d-flex align-items-center gap-2",children:[s(Oe,{color:"primary",pill:!0,children:[se.length," selected"]}),a(he,{color:"danger",size:"sm",onClick:oe,disabled:F,children:F?s($e,{children:[a("span",{className:"spinner-border spinner-border-sm me-1",role:"status","aria-hidden":"true"}),"Deleting..."]}):s($e,{children:[s("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"me-1",children:[a("polyline",{points:"3 6 5 6 21 6"}),a("path",{d:"m19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),"Delete Selected"]})})]})]}),s("div",{className:"d-flex align-items-center gap-2",children:[s(Ur,{size:"sm",children:[a(he,{color:me==="list"?"primary":"outline-secondary",id:"btn-list-view",onClick:()=>ce("list"),title:"List view",children:s("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),a("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),a("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),a("circle",{cx:"4",cy:"6",r:"1"}),a("circle",{cx:"4",cy:"12",r:"1"}),a("circle",{cx:"4",cy:"18",r:"1"})]})}),a(he,{color:me==="grid"?"primary":"outline-secondary",id:"btn-grid-view",onClick:()=>ce("grid"),title:"Grid view",children:s("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a("rect",{x:"3",y:"3",width:"7",height:"7"}),a("rect",{x:"14",y:"3",width:"7",height:"7"}),a("rect",{x:"3",y:"14",width:"7",height:"7"}),a("rect",{x:"14",y:"14",width:"7",height:"7"})]})})]}),a(kt,{placement:"bottom",target:"btn-list-view",children:"List view"}),a(kt,{placement:"bottom",target:"btn-grid-view",children:"Grid view"}),a(he,{size:"sm",color:"outline-primary",children:s("span",{className:"d-flex align-items-center",children:[s("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"me-1",children:[a("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),a("polyline",{points:"17 8 12 3 7 8"}),a("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),"Download All"]})})]})]}),me==="list"?a("div",{className:"table-responsive",children:s(Wr,{hover:!0,responsive:!0,className:"align-middle",children:[a("thead",{children:s("tr",{children:[a("th",{style:{width:"40px"},children:a(nt,{type:"checkbox",checked:se.length===y.length&&y.length>0,onChange:Ne,title:"Select all files"})}),a("th",{children:"File"}),a("th",{children:"Document Type"}),a("th",{children:"Status"}),a("th",{children:"Upload Date"}),a("th",{className:"text-end",children:"Actions"})]})}),a("tbody",{children:y.map(u=>s("tr",{children:[a("td",{style:{backgroundColor:"#ffffff"},children:a(nt,{type:"checkbox",checked:se.includes(u.id),onChange:()=>ve(u.id)})}),a("td",{style:{backgroundColor:"#ffffff"},children:s("div",{className:"d-flex align-items-center",children:[a("div",{className:"me-2",children:u.filename.toLowerCase().endsWith(".pdf")?s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#dc3545",strokeWidth:"2",children:[a("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a("polyline",{points:"14 2 14 8 20 8"})]}):u.filename.toLowerCase().endsWith(".docx")?s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#0d6efd",strokeWidth:"2",children:[a("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a("polyline",{points:"14 2 14 8 20 8"})]}):s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#6c757d",strokeWidth:"2",children:[a("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a("polyline",{points:"14 2 14 8 20 8"})]})}),a("div",{className:"text-truncate",style:{maxWidth:320},children:a("div",{className:"fw-semibold text-truncate",title:u.filename,children:u.filename})})]})}),a("td",{style:{backgroundColor:"#ffffff"},className:"fw-medium",children:u.title}),a("td",{style:{backgroundColor:"#ffffff"},children:a(Oe,{color:u.status==="processed"?"success":u.status==="error"?"danger":"warning",pill:!0,children:u.status})}),a("td",{style:{backgroundColor:"#ffffff"},children:new Date(u.created_at).toLocaleDateString()}),s("td",{style:{backgroundColor:"#ffffff"},className:"text-end",children:[a("a",{href:u.file,target:"_blank",rel:"noopener noreferrer",className:"btn btn-sm btn-outline-primary me-1",children:"View"}),a(he,{color:"outline-danger",size:"sm",onClick:()=>O(u.id,u.filename),disabled:Ce===u.id,children:Ce===u.id?s($e,{children:[a("span",{className:"spinner-border spinner-border-sm me-1",role:"status","aria-hidden":"true"}),"Deleting..."]}):"Delete"})]})]},u.id))})]})}):a(Ge,{children:y.map(u=>a(je,{xs:"12",md:"6",lg:"4",className:"mb-3",children:s(Ve,{className:`h-100 border shadow-sm ${se.includes(u.id)?"border-primary":""}`,children:[s("div",{className:"text-center p-3 bg-light position-relative",children:[a("div",{className:"position-absolute top-0 start-0 p-2",children:a(nt,{type:"checkbox",checked:se.includes(u.id),onChange:()=>ve(u.id)})}),a("div",{className:"mb-2",children:u.filename.toLowerCase().endsWith(".pdf")?s("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"#dc3545",strokeWidth:"2",children:[a("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a("polyline",{points:"14 2 14 8 20 8"})]}):u.filename.toLowerCase().endsWith(".docx")?s("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"#0d6efd",strokeWidth:"2",children:[a("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a("polyline",{points:"14 2 14 8 20 8"})]}):s("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"#6c757d",strokeWidth:"2",children:[a("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a("polyline",{points:"14 2 14 8 20 8"})]})}),a("h6",{className:"text-truncate mb-1",title:u.filename,children:u.filename}),a(Oe,{color:u.status==="processed"?"success":u.status==="error"?"danger":"warning",pill:!0,children:u.status})]}),s(We,{className:"p-3",children:[s("div",{className:"mb-2",children:[a("small",{className:"text-muted t
137ext-uppercase",children:"Document Type"}),a("p",{className:"mb-0 fw-medium",children:u.title})]}),s("div",{children:[a("small",{className:"text-muted text-uppercase",children:"Upload Date"}),a("p",{className:"mb-0",children:new Date(u.created_at).toLocaleDateString()})]})]}),s("div",{className:"border-top p-2 d-flex justify-content-between",children:[a("a",{href:u.file,target:"_blank",rel:"noopener noreferrer",className:"btn btn-sm btn-outline-primary",children:"View"}),a(he,{color:"outline-danger",size:"sm",onClick:()=>O(u.id,u.filename),disabled:Ce===u.id,children:Ce===u.id?s($e,{children:[a("span",{className:"spinner-border spinner-border-sm me-1",role:"status","aria-hidden":"true"}),"Deleting..."]}):"Delete"})]})]})},u.id))})]})]}),s(Ve,{className:"shadow-sm border-0",children:[a(xt,{className:"bg-white border-bottom py-2",children:s("div",{className:"d-flex justify-content-between align-items-center flex-wrap",children:[s("div",{className:"mb-2 mb-md-0",children:[a("h5",{className:"mb-0",children:"Technical Documentation Selection"}),a("small",{className:"text-muted",style:{fontSize:"0.75rem"},children:"Build your regulatory documentation structure"})]}),n&&s(he,{color:"outline-danger",size:"sm",onClick:A,children:[a("span",{className:"me-1",children:"↺"})," Reset"]})]})}),s(We,{className:"p-3",style:{backgroundColor:"#ffffff"},children:[a(j,{}),!n&&s("div",{className:"animate-fade-in",children:[s("div",{className:"mb-3",children:[a("h6",{className:"mb-2",children:"Select Module of Technical File"}),a(nt,{type:"text",placeholder:"🔍 Search modules...",value:N,onChange:u=>k(u.target.value),className:"mb-2 form-control-sm"})]}),a(Ge,{className:"g-2",children:H.map(u=>a(je,{md:"6",lg:"4",className:"mb-1",children:a(T,{item:u,isSelected:n===u.id,onClick:()=>Q(u.id),showDescription:!0})},u.id))})]}),n==="6"&&!o&&s("div",{className:"animate-fade-in",children:[s(Re,{color:"info",className:"mb-4",children:[a("strong",{children:"Module 6: Verification and Validation"})," - Select your verification theme"]}),a("h5",{className:"mb-3",children:"Select Theme in the Module"}),a(Ge,{className:"g-2",children:be.map(u=>a(je,{md:"6",lg:"4",className:"mb-2",children:a(T,{item:u,isSelected:o===u.id,onClick:()=>ne(u.id),showDescription:!0})},u.id))})]}),o==="6.7"&&!i&&s("div",{className:"animate-fade-in",children:[s(Re,{color:"info",className:"mb-4",children:[a("strong",{children:"Theme 6.7: Clinical Evaluation"})," - Select your clinical sub-section"]}),a("h5",{className:"mb-3",children:"Select Sub-section in the Theme"}),a(Ge,{className:"g-2",children:de.map(u=>a(je,{md:"6",className:"mb-2",children:a(T,{item:u,isSelected:i===u.id,onClick:()=>re(u.id),showDescription:!0})},u.id))})]}),i&&Se[i]&&s("div",{className:"animate-fade-in",children:[s(Re,{color:"info",className:"mb-4 d-flex align-items-start",children:[a("span",{className:"me-2",style:{fontSize:"1.5rem"},children:"📋"}),s("div",{children:[a("strong",{children:"Select One Document Type"}),a("p",{className:"mb-0",children:"Only 6.7.5.1 (Clinical evaluation plan) is currently available for generation."})]})]}),a("h5",{className:"mb-3",children:"Select Document Type"}),a(Ge,{className:"g-2",children:Se[i].map(u=>a(je,{md:"6",className:"mb-2",children:a(T,{item:u,isSelected:c.includes(u.id),onClick:()=>d(u.id),multiSelect:!1,showDescription:!0})},u.id))}),c.length>0&&a("div",{className:"text-center mt-4",children:s(he,{color:"primary",size:"lg",onClick:v,className:"px-5 shadow",children:[a("span",{className:"me-2",children:"→"}),"Review Selection"]})})]}),n&&n!=="6"&&s("div",{className:"animate-fade-in text-center py-5",children:[a("div",{className:"mb-4",children:a("div",{className:"bg-success text-white rounded-circle d-inline-flex align-items-center justify-content-center mb-3",style:{width:"80px",height:"80px",fontSize:"2.5rem"},children:"✓"})}),a("h4",{className:"mb-3",children:"Module Selected"}),s("p",{className:"text-muted mb-4",children:["You've selected"," ",a("strong",{children:(K=De.find(u=>u.id===n))==null?void 0:K.name})]}),s(he,{color:"primary",size:"lg",onClick:v,children:[a("span",{className:"me-2",children:"→"})," Review & Confirm"]})]})]})]})]}):a(Ve,{className:"shadow-sm p-5 text-center border-0",children:a(We,{children:s("div",{className:"py-5",children:[a("div",{className:"mb-4",children:a("div",{className:"rounded-circle bg-light p-4 d-inline-flex mb-3",children:s("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#6c757d",strokeWidth:"2",children:[a("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),a("polyline",{points:"13 2 13 9 20 9"})]})})}),a("h3",{className:"mb-3",children:"No Project Selected"}),a("p",{className:"text-muted mb-4 mx-auto",style:{maxWidth:"500px"},children:"Select a project to view and manage its technical documentation."})]})})}),a(ja,{isOpen:g,toggle:v,details:z(),handleComplete:I,selectedDocTypes:c}),a("style",{children:`
138                .animate-fade-in {
139                    animation: fadeIn 0.3s ease-in;
140                }
141                
142                @keyframes fadeIn {
143                    from {
144                        opacity: 0;
145                        transform: translateY(10px);
146                    }
147                    to {
148                        opacity: 1;
149                        transform: translateY(0);
150                    }
151                }
152                
153                .cursor-pointer {
154                    cursor: pointer;
155                }
156                
157                .card {
158                    transition: all 0.2s ease;
159                }
160                
161                .card:hover {
162                    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
163                }
164                
165                .bg-gradient {
166                    background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
167                }
168                
169                .progress-bar {
170                    transition: width 0.6s ease;
171                }
172                
173                @media (max-width: 768px) {
174                    .container-fluid {
175                        padding: 1rem !important;
176                    }
177                }
178            `})]})},Hl=()=>{const[e,n]=M.useState([]),[t,o]=M.useState(!1),[r,i]=M.useState(!1),[l,c]=M.useState([{}
178]),[m,g]=M.useState(0),[h,C]=M.useState(!1);M.useState(!1),M.useState(!1);const p=()=>{C(!1),Ie.get("/apiv1/reglementation/regulation/").then(y=>{n(y.data),C(!0)}).catch(y=>{console.error(`There was an error retrieving the sum pages: ${y}`)})};return M.useEffect(()=>{p()},[]),s($e,{children:[t?a($e,{children:a(ut,{})}):a($e,{})," ",r?a($e,{children:a(Ar,{data:l,id:m,closeDetails:()=>i(!1)})}):a(Aa,{})]})};export{Hl as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.