{"version":3,"file":"PdfEmbed.0eHZvBER.mjs","names":["React.useRef","React.useState","__esmMin","init_ssg_sandbox_shims","_e","de","p","c","init_jsx_runtime","init_npm_react_18_3_1","ce","window","init_framer_BWFVvmND","addPropertyControls","ControlType","loadPdfJs","pdfjsPromise","PDFJS_BASE","lib","PdfEmbed","props","url","pdfUrl","boxRef","status","setStatus","cancelled","box","doc","ratio","targetWidth","i","page","base","viewport","canvas","title","rootStyle","style","msgStyle","init_PdfEmbed"],"sources":["https:/framerusercontent.com/modules/fjcvWOmmHKn1C20BVXUH/tAakfk0yCbySHnGnVNUG/PdfEmbed.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Draws each page of a PDF directly onto the page with PDF.js.\n// No third-party viewer, so it loads first time on desktop and mobile.\nconst PDFJS_VERSION=\"4.4.168\";const PDFJS_BASE=\"https://cdn.jsdelivr.net/npm/pdfjs-dist@\"+PDFJS_VERSION+\"/build/\";let pdfjsPromise=null;function loadPdfJs(){if(!pdfjsPromise){pdfjsPromise=import(/* @vite-ignore */PDFJS_BASE+\"pdf.min.mjs\").then(lib=>{lib.GlobalWorkerOptions.workerSrc=PDFJS_BASE+\"pdf.worker.min.mjs\";return lib;});}return pdfjsPromise;}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function PdfEmbed(props){const{pdfUrl,title,style}=props;const url=(pdfUrl||\"\").trim();const boxRef=React.useRef(null);const[status,setStatus]=React.useState(\"loading\");React.useEffect(()=>{if(!url||typeof window===\"undefined\")return;let cancelled=false;const box=boxRef.current;if(!box)return;box.innerHTML=\"\";setStatus(\"loading\");(async()=>{try{const pdfjs=await loadPdfJs();const doc=await pdfjs.getDocument(url).promise;const ratio=Math.min(window.devicePixelRatio||1,2);const targetWidth=Math.max(box.clientWidth||900,600)*ratio;for(let i=1;i<=doc.numPages;i++){if(cancelled)return;const page=await doc.getPage(i);const base=page.getViewport({scale:1});const viewport=page.getViewport({scale:targetWidth/base.width});const canvas=document.createElement(\"canvas\");canvas.width=Math.floor(viewport.width);canvas.height=Math.floor(viewport.height);canvas.setAttribute(\"role\",\"img\");canvas.setAttribute(\"aria-label\",(title||\"PDF\")+\" - page \"+i);canvas.style.cssText=\"width:100%;height:auto;display:block;background:#fff;margin:0 auto 16px\";await page.render({canvasContext:canvas.getContext(\"2d\"),viewport}).promise;if(cancelled)return;box.appendChild(canvas);if(i===1)setStatus(\"ready\");}}catch(e){if(!cancelled)setStatus(\"error\");}})();return()=>{cancelled=true;};},[url]);const rootStyle={...style,width:\"100%\",position:\"relative\"};const msgStyle={margin:0,padding:\"48px 16px\",textAlign:\"center\",color:\"#c9a96e\",fontSize:14,letterSpacing:\"0.1em\",textTransform:\"uppercase\"};if(!url){return /*#__PURE__*/_jsx(\"div\",{style:rootStyle,children:/*#__PURE__*/_jsx(\"p\",{style:msgStyle,children:\"Add a PDF URL to display the document.\"})});}return /*#__PURE__*/_jsxs(\"div\",{style:rootStyle,children:[status===\"loading\"&&/*#__PURE__*/_jsx(\"p\",{style:msgStyle,children:\"Loading…\"}),status===\"error\"&&/*#__PURE__*/_jsx(\"p\",{style:msgStyle,children:/*#__PURE__*/_jsxs(\"a\",{href:url,target:\"_blank\",rel:\"noopener\",style:{color:\"inherit\"},children:[\"Open \",title||\"the list\"]})}),/*#__PURE__*/_jsx(\"div\",{ref:boxRef,style:{width:\"100%\",maxWidth:900,margin:\"0 auto\"}})]});}addPropertyControls(PdfEmbed,{pdfUrl:{type:ControlType.String,title:\"PDF URL\",defaultValue:\"\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"PDF document\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PdfEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"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