ultisuite-client/out/_next/static/chunks/2084.c5a7324a0d7f4f3c.js
R3D347HR4Y d6d18f911b
Some checks failed
E2E / Playwright e2e (push) Has been cancelled
Lots of stuff and mobile app
2026-06-17 00:13:28 +02:00

1 line
7.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2084],{5675:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(43200).A)("printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]])},44195:(e,t,r)=>{e.exports=r.p+"static/media/pdf.worker.min.5124e539.mjs"},92084:(e,t,r)=>{r.r(t),r.d(t,{PdfPreviewViewer:()=>y});var n=r(4208),i=r(91356),a=r(91505),s=r(5675),l=r(43200);let c=(0,l.A)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),o=(0,l.A)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);var u=r(30758),h=r(9519),d=r(98359),x=r(61554),m=r(58113);async function f(e){if(e)try{await e.cleanup()}catch{}}async function w(e){if(e&&!e.destroyed)try{await e.destroy()}catch{}}function p({pdf:e,pageNumber:t,containerWidth:r,zoom:a,shouldRender:s}){let l=(0,i.useRef)(null),c=(0,i.useRef)(null);return(0,i.useEffect)(()=>{if(!s||r<=0||a<=0)return;let n=!1,i=l.current;if(i)return(async()=>{try{var s;let l=await e.getPage(t);if(n)return;let o=(s=l.getViewport({scale:1}).width,(s<=0||r<=0?1:Math.min(2,Math.max(.25,r/s)))*a),u=l.getViewport({scale:o}),h=i.getContext("2d");if(!h)return;let d=window.devicePixelRatio||1;i.width=Math.floor(u.width*d),i.height=Math.floor(u.height*d),i.style.width=`${u.width}px`,i.style.height=`${u.height}px`,h.setTransform(d,0,0,d,0,0),c.current?.cancel();let x=l.render({canvasContext:h,viewport:u,canvas:i});c.current=x,await x.promise}catch{}})(),()=>{n=!0,c.current?.cancel(),c.current=null}},[e,t,r,a,s]),(0,n.jsx)("canvas",{ref:l,className:"block bg-white","aria-hidden":!0})}function y({blobUrl:e,name:t}){let r=(0,i.useRef)(null),l=(0,i.useRef)(new Map),b=(0,i.useRef)(null),[g,v]=(0,i.useState)(null),[j,k]=(0,i.useState)(0),[N,z]=(0,i.useState)(!0),[C,M]=(0,i.useState)(null),[S,E]=(0,i.useState)(1),[A,P]=(0,i.useState)(0),[R,$]=(0,i.useState)(1),[_,I]=(0,i.useState)(()=>new Set([1]));(0,i.useEffect)(()=>{let t=!1,r=null;return b.current=null,z(!0),M(null),v(null),k(0),E(1),$(1),I(new Set([1])),l.current.clear(),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error("fetch failed");let i=await n.arrayBuffer();if(t)return;let a=(0,d.getDocument)({data:i,isEvalSupported:!1});b.current=a;let s=await a.promise;if(t)return void await f(s);r=s,v(s),k(s.numPages),z(!1)}catch{t||(M("Impossible dafficher ce PDF."),z(!1))}})(),()=>{t=!0,w(b.current),f(r)}},[e]);let V=(0,i.useCallback)(()=>{let e=r.current;if(!e)return;let t=e.clientWidth-48;t>0&&P(t)},[]);(0,i.useEffect)(()=>{if(!g)return;V();let e=r.current;if(!e)return;let t=new ResizeObserver(V);return t.observe(e),()=>t.disconnect()},[g,V]);let W=(0,i.useCallback)(()=>{let e=r.current;if(!e||0===l.current.size)return;let t=e.getBoundingClientRect().top+.35*e.clientHeight,n=1,i=1/0;l.current.forEach((e,r)=>{let a=Math.abs(e.getBoundingClientRect().top-t);a<i&&(i=a,n=r)}),E(n)},[]);(0,i.useEffect)(()=>{if(!g||0===j)return;let e=r.current;if(!e)return;let t=new IntersectionObserver(e=>{I(t=>{let r=new Set(t);for(let t of e){let e=Number(t.target.dataset.page);e&&t.isIntersecting&&r.add(e)}return r}),W()},{root:e,rootMargin:"320px 0px",threshold:0});return[...l.current.values()].forEach(e=>t.observe(e)),e.addEventListener("scroll",W,{passive:!0}),W(),()=>{t.disconnect(),e.removeEventListener("scroll",W)}},[g,j,W]);let D=e=>{let t=l.current.get(e);t?.scrollIntoView({behavior:"smooth",block:"start"}),E(e)};if(N)return(0,n.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-zinc-400",children:[(0,n.jsx)(a.A,{className:"h-10 w-10 animate-spin","aria-hidden":!0}),(0,n.jsx)("span",{className:"text-sm",children:"Ouverture du PDF…"})]});if(C||!g)return(0,n.jsx)("p",{className:"text-center text-sm text-zinc-400",children:C??"Aper\xe7u indisponible."});let O=Math.round(100*R);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)("div",{ref:r,className:"min-h-0 flex-1 overflow-auto overscroll-contain bg-zinc-900/60","aria-label":`Aper\xe7u PDF : ${t}`,children:(0,n.jsx)("div",{className:(0,m.cn)("mx-auto flex w-max min-w-full flex-col items-center px-4 py-6",R<=1&&"max-w-5xl"),style:{gap:24},children:Array.from({length:j},(e,t)=>{let r=t+1;return(0,n.jsxs)("div",{ref:e=>{e?l.current.set(r,e):l.current.delete(r)},"data-page":r,className:(0,m.cn)("inline-flex w-max max-w-none flex-col scroll-mt-4","rounded-sm bg-white shadow-[0_8px_32px_rgba(0,0,0,0.45)] ring-1 ring-white/10"),children:[(0,n.jsx)("div",{className:"flex w-full shrink-0 items-center justify-between border-b border-zinc-200/80 bg-zinc-50 px-3 py-1.5",children:(0,n.jsxs)("span",{className:"text-xs font-medium tabular-nums text-zinc-500",children:["Page ",r]})}),(0,n.jsx)("div",{className:"flex shrink-0 justify-center bg-zinc-100 p-2 sm:p-3",children:(0,n.jsx)(p,{pdf:g,pageNumber:r,containerWidth:A,zoom:R,shouldRender:_.has(r)&&A>0})})]},r)})})}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-white/10 bg-zinc-950/95 px-4 py-2.5 backdrop-blur-sm",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 cursor-pointer text-zinc-400 hover:bg-white/10 hover:text-white",onClick:()=>{let r,n;return(r=document.createElement("iframe")).style.position="fixed",r.style.right="0",r.style.bottom="0",r.style.width="0",r.style.height="0",r.style.border="0",r.setAttribute("title",t),r.src=e,n=()=>{r.remove()},void(r.onload=()=>{try{r.contentWindow?.focus(),r.contentWindow?.print()}finally{window.setTimeout(n,1e3)}},document.body.appendChild(r))},"aria-label":"Imprimer",children:(0,n.jsx)(s.A,{className:"h-4 w-4"})}),(0,n.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 cursor-pointer text-zinc-400 hover:bg-white/10 hover:text-white",onClick:()=>$(e=>Math.max(.5,e-.15)),disabled:R<=.5,"aria-label":"Zoom arri\xe8re",children:(0,n.jsx)(c,{className:"h-4 w-4"})}),(0,n.jsxs)("span",{className:"min-w-[3.5rem] text-center text-xs tabular-nums text-zinc-400",children:[O,"%"]}),(0,n.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 cursor-pointer text-zinc-400 hover:bg-white/10 hover:text-white",onClick:()=>$(e=>Math.min(2.5,e+.15)),disabled:R>=2.5,"aria-label":"Zoom avant",children:(0,n.jsx)(o,{className:"h-4 w-4"})})]}),(0,n.jsxs)("p",{className:"text-sm font-medium tabular-nums text-zinc-200",children:["Page ",S," / ",j]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 cursor-pointer text-zinc-400 hover:bg-white/10 hover:text-white",onClick:()=>D(Math.max(1,S-1)),disabled:S<=1,"aria-label":"Page pr\xe9c\xe9dente",children:(0,n.jsx)(u.A,{className:"h-4 w-4"})}),(0,n.jsx)(x.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 cursor-pointer text-zinc-400 hover:bg-white/10 hover:text-white",onClick:()=>D(Math.min(j,S+1)),disabled:S>=j,"aria-label":"Page suivante",children:(0,n.jsx)(h.A,{className:"h-4 w-4"})})]})]})]})}d.GlobalWorkerOptions.workerSrc=new r.U(r(44195)).toString()}}]);