import{t as e}from"./transcode-CQf3sO1K.js";import{t}from"./pdf-lib-D4xHcGpT.js";async function n(t){if(t.type===`image/jpeg`)return{bytes:new Uint8Array(await t.arrayBuffer()),kind:`jpg`};if(t.type===`image/png`)return{bytes:new Uint8Array(await t.arrayBuffer()),kind:`png`};let{blob:n}=await e(t,{target:`image/png`,quality:1,matte:`#ffffff`,keepExif:!0});return{bytes:new Uint8Array(await n.arrayBuffer()),kind:`png`}}async function r(e){let r=await t.create();for(let t of e){let{bytes:e,kind:i}=await n(t),a=i===`jpg`?await r.embedJpg(e):await r.embedPng(e);r.addPage([a.width,a.height]).drawImage(a,{x:0,y:0,width:a.width,height:a.height})}let i=await r.save();return new Blob([i],{type:`application/pdf`})}export{r as imagesToPdf};