const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/core-D2wiG-fO.js","assets/planner-D5fqdPah.js","assets/rolldown-runtime-hePW80VL.js","assets/index-CKr-jwvi.js","assets/index-DZaZnuRK.css","assets/ui-CuDKrJrQ.js","assets/dates-n-jl3C-v.js","assets/planner-BLkPNopu.css","assets/dist-Di5CwiBI.js"])))=>i.map(i=>d[i]);
import{t as e}from"./index-CKr-jwvi.js";import{n as t,t as n}from"./dates-n-jl3C-v.js";import{t as r}from"./pdf-26wlXapU.js";import{r as i}from"./planner-D5fqdPah.js";async function a(a,o,s=`A4`){let c=i(a),l=e=>`${a.currency} ${e}`,u=[{text:`Project Timeline & Budget Planner`,size:18,bold:!0},{text:a.title,size:16,bold:!0},{text:a.description||`Project description not supplied.`},{text:`Planning estimate based on your inputs—not a quotation.`},{text:`Reference date: ${a.referenceDate}. Total hours: ${c.totalHours}.`},{text:`Base cost: ${l(c.baseCost)}. Contingency (${a.contingencyPercent}%): ${l(c.contingency)}. Total estimated cost: ${l(c.totalCost)}.`,size:12,bold:!0},{text:`Schedule: ${c.start} to ${c.end}, inclusive. ${c.calendarDays} calendar days; ${c.workingDays} Monday–Friday working days. Holidays are not deducted. Hours are entered separately from duration.`},{text:`Dependencies mean finish-to-start with zero lag. A following task should start no earlier than the next working day after its predecessor ends. Dependent tasks are never moved automatically.`},{text:`The numbered timeline appears on separate landscape pages after the task details. Each page repeats the same date scale and shows at most 18 tasks; numbers refer to the task list below. Exact inclusive dates are printed beside every task.`},{text:`Task details`,size:15,bold:!0}];for(let[e,t]of a.tasks.entries())u.push({text:`${e+1}. ${t.title} — ${t.phase}`,size:12,bold:!0},{text:`${t.start} to ${t.end} (inclusive). ${t.hours} hours × ${l(t.rate)} per hour = ${l(c.taskCosts[t.id])}. Progress: ${t.progressPercent}%.`},{text:`Task ID: ${t.id}. Predecessors: ${t.predecessors.map(e=>`${a.tasks.findIndex(t=>t.id===e)+1} (${e})`).join(`, `)||`None`}.`});let{validatePlan:d}=await e(async()=>{let{validatePlan:e}=await import(`./core-D2wiG-fO.js`);return{validatePlan:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])),f=d(a);f.warnings.length&&u.push({text:`Schedule conflicts to review`,size:14,bold:!0},...f.warnings.map(e=>({text:e.message})));let p=await r(u,o,s),{PDFDocument:m,StandardFonts:h,rgb:g}=await e(async()=>{let{PDFDocument:e,StandardFonts:t,rgb:n}=await import(`./dist-Di5CwiBI.js`);return{PDFDocument:e,StandardFonts:t,rgb:n}},__vite__mapDeps([8,2])),_=await m.load(p),v=await _.embedFont(h.Helvetica),y=await _.embedFont(h.HelveticaBold),b=Math.ceil(a.tasks.length/18);for(let e=0;e<b;e++){let r=_.addPage(s===`Letter`?[792,612]:[841.89,595.28]),i=r.getWidth(),o=r.getHeight(),l=i-245-30;r.drawText(`Project timeline ${e+1} of ${b}`,{x:30,y:o-35,size:18,font:y}),r.drawText(`Task numbers match the full task details. Dates include both the first and last day.`,{x:30,y:o-55,size:10,font:v});for(let e=0;e<=5;e++){let t=Math.round((c.calendarDays-1)*e/5),a=n(c.start,t),s=245+l*e/5;r.drawText(a,{x:Math.min(s-20,i-85),y:o-83,size:8,font:v}),r.drawLine({start:{x:s,y:o-92},end:{x:s,y:40},thickness:.4,color:g(.87,.87,.89)})}for(let[n,s]of a.tasks.slice(e*18,e*18+18).entries()){let a=e*18+n,u=o-116-n*24,d=t(c.start,s.start)-1,f=t(s.start,s.end),p=245+d/c.calendarDays*l,m=Math.max(1.5,f/c.calendarDays*l);r.drawText(`${a+1}. ${s.start} - ${s.end}`,{x:30,y:u,size:9,font:v}),r.drawRectangle({x:p,y:u-2,width:Math.min(m,i-30-p),height:13,color:g(.42,.27,1)})}r.drawText(`Long spans use the same proportional scale on every timeline page. Exact dates appear at left.`,{x:30,y:20,size:8,font:v})}return _.setTitle(a.title),_.setSubject(`Planning estimate based on user inputs; not a quotation.`),_.setCreator(`Essential Tools Project Planner`),_.save()}export{a as generatePlanPdf};