PageSourceSearch

https://crppr.org.br/assets/TesteFlipbookLocal-DQj9Hl7u.js

js crppr.org.br collected 2026-09-25 02:54:11 UTC 5,617 bytes, 1 lines download raw bytes

1import{A as C,j as e,o as H}from"./index-BCp-6lKF.js";import{r as a,L as T}from"./vendor-react-CpRvMXaC.js";import{H as z,p as b}from"./vendor-pdf-CLXYJc0c.js";import{F as D}from"./ArrowLeftIcon-BRwFpEWC.js";import{F as $}from"./ChevronLeftIcon-BvZhC08K.js";import"./vendor-ui-5rZvml82.js";import"./vendor-editor-DoAMYjM7.js";b.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${b.version}/build/pdf.worker.min.js`;function V(){const[l,N]=a.useState([]),[d,k]=a.useState(0),[m,w]=a.useState(!0),[p,g]=a.useState(""),[y,P]=a.useState({width:820,height:1160}),[E,S]=a.useState(!1),h=a.useRef(null),j=a.useRef(null),f=a.useMemo(()=>`${C.BASE_URL}/storage/anais/Anais-EPP_2025-VF.pdf`,[]);a.useEffect(()=>{(async()=>{try{w(!0),g("");const s=await fetch(f,{method:"GET",cache:"no-store",credentials:"omit"});if(!s.ok)throw new Error(`Falha ao buscar PDF de teste (HTTP ${s.status})`);const r=await s.arrayBuffer(),i=await b.getDocument({data:new Uint8Array(r),disableStream:!0,disableRange:!0,disableAutoFetch:!0}).promise,o=i.numPages,n=[];for(let x=1;x<=o;x++){const F=await i.getPage(x),u=F.getViewport({scale:1.6}),c=document.createElement("canvas"),A=c.getContext("2d");c.height=u.height,c.width=u.width,await F.render({canvasContext:A,viewport:u}).promise,n.push(c.toDataURL("image/png"))}N(n)}catch(s){g((s==null?void 0:s.message)||"Nao foi possivel carregar o PDF de teste.")}finally{w(!1)}})()},[f]),a.useEffect(()=>{const t=()=>{const v=window.innerWidth-8,i=window.innerHeight-64;let o=Math.floor(v/2),n=Math.floor(o*1.414);n>i&&(n=i,o=Math.floor(n/1.414)),P({width:o,height:n})};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),a.useEffect(()=>{const t=()=>{S(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",t),()=>document.removeEventListener("fullscreenchange",t)},[]);const L=()=>{var s,r;const t=(r=(s=h.current)==null?void 0:s.pageFlip)==null?void 0:r.call(s);t&&t.flipPrev()},B=()=>{var s,r;const t=(r=(s=h.current)==null?void 0:s.pageFlip)==null?void 0:r.call(s);t&&t.flipNext()},R=async()=>{var t;try{document.fullscreenElement?await document.exitFullscreen():await((t=j.current)==null?void 0:t.requestFullscreen())}catch{g("Nao foi possivel alternar para tela cheia neste navegador.")}};return e.jsxs("div",{ref:j,className:"h-screen w-screen overflow-hidden flex flex-col bg-gray-900",children:[e.jsxs("div",{className:"flex-shrink-0 flex flex-wrap items-center justify-between gap-2 px-3 py-2 bg-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(T,{to:"/publicacoes/materiais/anais",className:"inline-flex items-center gap-2 px-3 py-2 bg-gray-700 text-gray-200 rounded-lg hover:bg-gray-600 transition-colors text-sm",children:[e.jsx(D,{className:"h-4 w-4"}),e.jsx("span",{children:"Voltar"})]}),e.jsx("h1",{className:"text-base font-bold text-white",children:"Teste Flipbook Local"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:R,className:"inline-flex items-center px-3 py-2 text-sm font-medium bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors",children:E?"Sair da tela cheia":"Tela cheia"})})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[m&&e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-10 w-10 border-b-2 border-primary-400"}),e.jsx("p",{className:"mt-4 text-gray-300",children:"Processando PDF de teste..."})]}),!m&&p&&e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"bg-red-900/40 border border-red-600 rounded-lg p-6 max-w-lg w-full",children:[e.jsx("p",{className:"text-red-300 font-semibold mb-2",children:"Falha ao carregar o flipbook de teste."}),e.jsx("p",{className:"text-sm text-red-400 mb-4",children:p}),e.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-3 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors",children:"Abrir PDF direto"})]})}),!m&&!p&&l.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center gap-2 py-2",children:[e.jsxs("button",{onClick:L,disabled:d===0,className:"inline-flex items-center gap-1 px-3 py-1.5 bg-gray-700 text-gray-200 rounded-lg hover:bg-gray-600 disabled:opacity-40 disabled:cursor-not-allowed text-sm",children:[e.jsx($,{className:"h-4 w-4"}),e.jsx("span",{children:"Anterior"})]}),e.jsxs("span",{className:"px-3 py-1.5 bg-gray-700 text-gray-200 rounded-lg text-sm",children:["Pág ",d+1," / ",l.length]}),e.jsxs("button",{onClick:B,disabled:d>=l.length-1,className:"inline-flex items-center gap-1 px-3 py-1.5 bg-gray-700 text-gray-200 rounded-lg hover:bg-gray-600 disabled:opacity-40 disabled:cursor-not-allowed text-sm",children:[e.jsx("span",{children:"Próxima"}),e.jsx(H,{className:"h-4 w-4"})]})]}),e.jsx("div",{className:"flex-1 flex justify-center items-center overflow-hidden",children:e.jsx(z,{ref:h,width:y.width,height:y.height,size:"fixed",minWidth:200,maxWidth:2e3,minHeight:300,maxHeight:4e3,maxShadowOpacity:.45,showCover:!0,mobileScrollSupport:!0,onFlip:t=>k((t==null?void 0:t.data)||0),className:"flipbook-teste-local",children:l.map((t,s)=>e.jsx("div",{className:"page bg-white flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:t,alt:`Pagina ${s+1}`,style:{width:"100%",height:"100%",objectFit:"contain",display:"block"},draggable:!1})},s))})})]})]})]})}export{V 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.