1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="87114b1c-5919-4fd4-8016-de584f4b8be7",e._sentryDebugIdIdentifier="sentry-dbid-87114b1c-5919-4fd4-8016-de584f4b8be7")}()}catch(e){}!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];if(null!=r)for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],{"_sentryBundlerPluginAppKey:ns-web":!0})}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92175],{92175:(e,t,r)=>{r.r(t),r.d(t,{PdfDocumentViewer:()=>g});var n=r(85468),l=r(29152),a=r(13356),o=r(72457),i=r(81463),c=r(97320);function u(e){return{left:"".concat(100*e.x,"%"),top:"".concat(100*e.y,"%"),width:"".concat(100*e.w,"%"),height:"".concat(100*e.h,"%")}}function s(e){var{boxes:t,pageHeight:r,className:n}=e,s=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>{for(var e of null!=(n=null==(t=s.current)?void 0:t.querySelectorAll("[data-translation-text]"))?n:[])e.style.transform="none";var t,r,n,l,a=Array.from(null!=(l=null==(r=s.current)?void 0:r.querySelectorAll("[data-translation-text]"))?l:[]),o=a.map(e=>{var t,r;return Math.min(1,(null!=(r=null==(t=e.parentElement)?void 0:t.clientWidth)?r:0)/Math.max(e.scrollWidth,1))});a.forEach((e,t)=>{e.style.transform="scale(".concat(o[t],")")})},[t,r]);var d=t.filter(e=>e.english.trim());return 0===d.length?null:(0,l.jsx)("div",{ref:s,className:(0,o.cn)("pointer-events-none absolute inset-0",n),role:"group","aria-label":"English translation of this page",children:d.map((e,t)=>(0,l.jsx)("span",{title:e.english,tabIndex:0,className:"pointer-events-auto absolute flex items-center overflow-hidden whitespace-nowrap bg-white text-black focus-visible:outline focus-visible:outline-2 focus-visible:outline-violet-600",style:(0,c._)((0,i._)({},u(e)),{fontSize:"".concat(Math.max(e.h*r*.86,4),"px"),lineHeight:1}),children:(0,l.jsx)("span",{"data-translation-text":!0,className:"origin-left",children:e.english})},t))})}function d(e){return e<0?0:e>1?1:e}function f(e,t){var r=d(Math.min(e.x,t.x)),n=d(Math.min(e.y,t.y)),l=d(Math.max(e.x,t.x)),a=d(Math.max(e.y,t.y)),o=l-r,i=a-n;return o<.01||i<.01?null:{x:r,y:n,w:o,h:i}}function h(e){var{pdfDocument:t,TextLayer:r,pageNumber:i,pageWidth:c,annotationRects:h,lineHighlights:g,translationBoxes:p,draftClassName:v,editable:m,onCreateAnnotation:x,registerPageNode:y}=e,b=(0,a.useRef)(null),w=(0,a.useRef)(null),M=(0,a.useRef)(null),[R,j]=(0,a.useState)(null),[E,N]=(0,a.useState)(null),C=(0,a.useRef)(null);return(0,a.useEffect)(()=>(y(i,b.current),()=>y(i,null)),[i,y]),(0,a.useEffect)(()=>{var e=!1,l=null,a=null;return(0,n._)(function*(){var n=w.current;if(!n)return;var o=yield t.getPage(i);if(e)return;var u=c/o.getViewport({scale:1}).width,s=o.getViewport({scale:u}),d=window.devicePixelRatio||1,f=n.getContext("2d");if(f){n.width=Math.floor(s.width*d),n.height=Math.floor(s.height*d),n.style.width="".concat(s.width,"px"),n.style.height="".concat(s.height,"px"),f.setTransform(d,0,0,d,0,0),f.clearRect(0,0,s.width,s.height),j(s.height),l=o.render({canvas:n,canvasContext:f,viewport:s});try{yield l.promise}catch(e){if(!(e instanceof Error)||"RenderingCancelledException"!==e.name)throw e;return}var h=M.current;if(h&&!e){var g=yield o.getTextContent();if(!e){h.replaceChildren(),h.style.setProperty("--scale-factor",String(u)),h.style.setProperty("--total-scale-factor",String(u)),a=new r({textContentSource:g,container:h,viewport:s});try{yield a.render()}catch(e){if(!(e instanceof Error)||"RenderingCancelledException"!==e.name)throw e}}}}})().catch(e=>{console.error("Failed to render PDF page",{error:e,pageNumber:i})}),()=>{e=!0,null==l||l.cancel(),null==a||a.cancel()}},[i,c,t,r]),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("div",{className:"text-xs font-medium uppercase tracking-[0.2em] text-muted-foreground",children:["Page ",i]}),(0,l.jsxs)("div",{ref:b,className:"relative mx-auto overflow-hidden rounded-xl border border-border bg-white shadow-sm",style:{width:c,minHeight:null!=R?R:Math.round(1.35*c)},children:[(0,l.jsx)("canvas",{ref:w,className:"block w-full"}),(0,l.jsx)(s,{boxes:p,pageHeight:null!=R?R:1.414*c}),(0,l.jsx)("div",{ref:M,className:(0,o.cn)("textLayer",m?"pointer-events-none select-none":void 0),"aria-hidden":!0}),(0,l.jsxs)("div",{className:(0,o.cn)("absolute inset-0",m?"cursor-crosshair touch-none":"pointer-events-none"),onPointerDown:e=>{if(m){var t=e.currentTarget.getBoundingClientRect(),r={x:d((e.clientX-t.left)/t.width),y:d((e.clientY-t.top)/t.height)};C.current=r,N({x:r.x,y:r.y,w:0,h:0}),e.currentTarget.setPointerCapture(e.pointerId)}},onPointerMove:e=>{if(m&&C.current){var t=e.currentTarget.getBoundingClientRect(),r={x:d((e.clientX-t.left)/t.width),y:d((e.clientY-t.top)/t.height)};N(f(C.current,r))}},onPointerUp:e=>{if(m&&C.current){var t=e.currentTarget.getBoundingClientRect(),r={x:d((e.clientX-t.left)/t.width),y:d((e.clientY-t.top)/t.height)},n=f(C.current,r);C.current=null,N(null),e.currentTarget.releasePointerCapture(e.pointerId),n&&x(i,n)}},children:[h.map((e,t)=>(0,l.jsx)("div",{className:"absolute rounded border border-amber-500 bg-amber-300/45 shadow-[0_0_0_1px_rgba(245,158,11,0.18)]",style:u(e)},"".concat(i,"-").concat(t,"-").concat(e.x,"-").concat(e.y))),g.flatMap(e=>e.rects.map((t,r)=>(0,l.jsx)("div",{className:(0,o.cn)("absolute rounded border",e.className),style:u(t)}
1,"".concat(e.id,"-").concat(r,"-").concat(t.x,"-").concat(t.y)))),E?(0,l.jsx)("div",{className:(0,o.cn)("absolute rounded border",v),style:u(E)}):null]})]})]})}function g(e){var{url:t,documentAnnotation:r=null,onDocumentAnnotationChange:i,editable:c=!1,lineHighlights:u=[],translationPages:s,onDrawRect:d,draftClassName:f="border-sky-500 bg-sky-300/25",editHint:g,className:p,scale:v=1,compact:m=!1,fitToContainer:x=!1,zoomable:y=!1,onScaleChange:b,minScale:w=1,maxScale:M=4}=e,R=(0,a.useRef)(null),j=(0,a.useRef)(null),E=(0,a.useRef)(new Map),[N,C]=(0,a.useState)(0),[_,k]=(0,a.useState)(null),[P,T]=(0,a.useState)(null),[S,D]=(0,a.useState)(!0),[I,A]=(0,a.useState)(null),L=(0,a.useMemo)(()=>{if(!x)return 720*v;var e=m?12:32;return(N?Math.max(320,Math.min(N-e,960)):720)*v},[N,v,m,x]);(0,a.useEffect)(()=>{if(x&&R.current&&"undefined"!=typeof ResizeObserver){var e=new ResizeObserver(e=>{var t=e[0];t&&C(t.contentRect.width)});return e.observe(R.current),C(R.current.getBoundingClientRect().width),()=>e.disconnect()}},[x,S,I,_,P]),(0,a.useEffect)(()=>{var e=!1,r=null;return(0,n._)(function*(){try{D(!0),A(null),k(null),T(null);var l,a=yield(0,n._)(function*(){return yield import("/vendor/pdfjs/pdf.mjs")})();if(e)return;a.GlobalWorkerOptions.workerSrc="/vendor/pdfjs/pdf.worker.mjs";var o=a.getDocument(t);r=o;var i=yield o.promise;if(e){null==(l=i.destroy)||l.call(i);return}k(i),T(()=>a.TextLayer)}catch(t){console.error("Failed to load PDF document",t),e||A("Failed to load PDF preview.")}finally{e||D(!1)}})(),()=>{var t;e=!0,null==r||null==(t=r.destroy)||t.call(r)}},[t]),(0,a.useEffect)(()=>()=>{var e;null==_||null==(e=_.destroy)||e.call(_)},[_]),(0,a.useEffect)(()=>{var e=null==r?void 0:r.amountAnnotation.page;if(e&&_){var t=E.current.get(e);t&&requestAnimationFrame(()=>{t.scrollIntoView({block:"center",behavior:"smooth"})})}},[r,_]);var Y=(0,a.useRef)(v),X=(0,a.useRef)(null),F=(0,a.useRef)(null),B=(0,a.useRef)(null),V=(0,a.useCallback)(()=>{var e=j.current;e&&(e.style.transform="",e.style.transformOrigin="",e.style.willChange="")},[]);(0,a.useEffect)(()=>{X.current||(Y.current=v,V())},[v,V]),(0,a.useLayoutEffect)(()=>{var e=F.current;if(e){F.current=null;var t=R.current;t&&(t.scrollTop=Math.max(0,e.top),t.scrollLeft=Math.max(0,e.left)),V()}},[v,V]),(0,a.useEffect)(()=>{if(y){var e=R.current;if(e){var t=Math.max(.1,w),r=Math.max(t,M),n=n=>{if(n.ctrlKey){n.preventDefault();var l=j.current;if(l){var a=Y.current,o=Math.min(r,Math.max(t,a*Math.exp(-(.01*n.deltaY))));if(o!==a){if(Y.current=o,!B.current){var i=e.getBoundingClientRect(),c=l.getBoundingClientRect();B.current={originX:n.clientX-c.left,originY:n.clientY-c.top,cursorViewportX:n.clientX-i.left,cursorViewportY:n.clientY-i.top,wrapperInsetLeft:c.left-i.left+e.scrollLeft,wrapperInsetTop:c.top-i.top+e.scrollTop,startScale:v}}var u=B.current,s=o/u.startScale;l.style.transformOrigin="".concat(u.originX,"px ").concat(u.originY,"px"),l.style.transform="scale(".concat(s,")"),l.style.willChange="transform";var d=o/u.startScale,f=u.originX*d,h=u.originY*d;F.current={top:u.wrapperInsetTop+h-u.cursorViewportY,left:u.wrapperInsetLeft+f-u.cursorViewportX},X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{X.current=null,B.current=null;var e=Y.current;b?b(e):(F.current=null,V())},150)}}}};return e.addEventListener("wheel",n,{passive:!1}),()=>{e.removeEventListener("wheel",n),X.current&&(clearTimeout(X.current),X.current=null),B.current=null}}}},[y,v,w,M,b,V,S,I,_,P]);var O=(e,t)=>{var n;i&&i({version:1,amountAnnotation:{page:e,rects:[t],text:null!=(n=null==r?void 0:r.amountAnnotation.text)?n:""}})},H=(e,t)=>{if(t)return void E.current.set(e,t);E.current.delete(e)};return S?(0,l.jsx)("div",{className:(0,o.cn)("flex min-h-[320px] items-center justify-center rounded-xl border bg-background text-sm text-muted-foreground",p),children:"Loading PDFâ¦"}):!I&&_&&P?(0,l.jsx)("div",{ref:R,className:(0,o.cn)("overflow-y-auto rounded-xl bg-muted/10",m?"p-0":"p-4",p),children:(0,l.jsxs)("div",{ref:j,className:(0,o.cn)("mx-auto flex max-w-[1120px] flex-col",m?"gap-4":"gap-6"),children:[c?(0,l.jsx)("div",{className:"rounded-xl border border-dashed border-border bg-background px-4 py-3 text-sm text-muted-foreground",children:null!=g?g:"Drag a rectangle over the amount. Drawing a new rectangle replaces the previous one."}):null,Array.from({length:_.numPages},(e,n)=>{var a,o,i=n+1,g=(null==r?void 0:r.amountAnnotation.page)===i?r.amountAnnotation.rects:[],p=u.filter(e=>e.page===i),v=null!=(o=null==s||null==(a=s.find(e=>e.page===i))?void 0:a.boxes)?o:[];return(0,l.jsx)(h,{pdfDocument:_,TextLayer:P,pageNumber:i,pageWidth:L,annotationRects:g,lineHighlights:p,translationBoxes:v,draftClassName:f,editable:c,onCreateAnnotation:null!=d?d:O,registerPageNode:H},"".concat(t,"-").concat(i))})]})}):(0,l.jsx)("div",{className:(0,o.cn)("flex min-h-[320px] items-center justify-center rounded-xl border bg-background text-sm text-muted-foreground",p),children:null!=I?I:"PDF preview unavailable."})}}}]); 2//# sourceMappingURL=92175-5957463ce84447e4.js.map
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.