@antontranelis/money-printer 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),Se=require("zustand"),Ce=require("zustand/middleware"),v=require("react"),Te=require("jspdf");var _=typeof document<"u"?document.currentScript:null;const ee={personalInfo:{name:"",email:"",phone:""},voucherConfig:{hours:1,description:"",language:"de"},portrait:{original:null,enhanced:null,useEnhanced:!1,zoom:1,rawImage:null,bgRemovedImage:null,bgRemoved:!1,engravingIntensity:0},currentSide:"front",isEnhancing:!1,isExporting:!1},b=Se.create()(Ce.persist(e=>({...ee,setPersonalInfo:t=>e(n=>({personalInfo:{...n.personalInfo,...t}})),setVoucherConfig:t=>e(n=>({voucherConfig:{...n.voucherConfig,...t}})),setPortrait:(t,n=null)=>e(a=>({portrait:{...a.portrait,original:t,enhanced:n,useEnhanced:!1,zoom:a.portrait.original&&t?a.portrait.zoom:1}})),setEnhancedPortrait:t=>e(n=>({portrait:{...n.portrait,enhanced:t,useEnhanced:t!==null}})),toggleUseEnhanced:()=>e(t=>({portrait:{...t.portrait,useEnhanced:t.portrait.enhanced?!t.portrait.useEnhanced:!1}})),setPortraitZoom:t=>e(n=>({portrait:{...n.portrait,zoom:t}})),setPortraitRawImage:t=>e(n=>({portrait:{...n.portrait,rawImage:t}})),setPortraitBgRemoved:(t,n)=>e(a=>({portrait:{...a.portrait,bgRemoved:t,bgRemovedImage:n!==void 0?n:a.portrait.bgRemovedImage}})),setPortraitEngravingIntensity:t=>e(n=>({portrait:{...n.portrait,engravingIntensity:t}})),setCurrentSide:t=>e({currentSide:t}),flipSide:()=>e(t=>({currentSide:t.currentSide==="front"?"back":"front"})),setIsEnhancing:t=>e({isEnhancing:t}),setIsExporting:t=>e({isExporting:t}),setLanguage:t=>e(n=>({voucherConfig:{...n.voucherConfig,language:t}})),setHours:t=>e(n=>({voucherConfig:{...n.voucherConfig,hours:t}})),reset:()=>e(ee)}),{name:"money-generator-storage",partialize:e=>({personalInfo:e.personalInfo,voucherConfig:e.voucherConfig,portrait:e.portrait})})),Re={header:{title:"Money Generator",subtitle:"Erstelle deinen persönlichen Zeitgutschein"},form:{personalInfo:{title:"Persönliche Daten",name:"Name",namePlaceholder:"Dein Name",email:"E-Mail",emailPlaceholder:"deine@email.de",phone:"Telefon",phonePlaceholder:"+49 123 456789"},portrait:{title:"Portrait",upload:"Bild hochladen",dragDrop:"oder hierher ziehen",enhance:"Mit AI verbessern",enhancing:"Wird verbessert...",useOriginal:"Original verwenden",useEnhanced:"Verbessertes verwenden",zoom:"Zoom"},voucher:{title:"Gutschein",hours:"Stunden",hourLabel:"Stunde",hoursLabel:"Stunden",description:"Beschreibung",descriptionPlaceholder:"Was kann mit diesem Gutschein eingelöst werden?"}},preview:{front:"Vorderseite",back:"Rückseite",flip:"Umdrehen"},export:{button:"Als PDF herunterladen",exporting:"PDF wird erstellt...",success:"Download gestartet!"},bill:{descriptionText:"Für diesen Schein erhältst du {hours} {hourLabel} meiner Zeit oder ein gleichwertiges Dankeschön"}},Ae={header:{title:"Money Generator",subtitle:"Create your personal time voucher"},form:{personalInfo:{title:"Personal Information",name:"Name",namePlaceholder:"Your name",email:"Email",emailPlaceholder:"your@email.com",phone:"Phone",phonePlaceholder:"+1 234 567890"},portrait:{title:"Portrait",upload:"Upload image",dragDrop:"or drag and drop",enhance:"Enhance with AI",enhancing:"Enhancing...",useOriginal:"Use original",useEnhanced:"Use enhanced",zoom:"Zoom"},voucher:{title:"Voucher",hours:"Hours",hourLabel:"hour",hoursLabel:"hours",description:"Description",descriptionPlaceholder:"What can be redeemed with this voucher?"}},preview:{front:"Front",back:"Back",flip:"Flip"},export:{button:"Download as PDF",exporting:"Creating PDF...",success:"Download started!"},bill:{descriptionText:"This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"}},Le={de:Re,en:Ae};function A(e){return Le[e]}function O(e,t,n){if(n&&n.trim())return n;const a=A(e),o=t===1?a.form.voucher.hourLabel:a.form.voucher.hoursLabel;return a.bill.descriptionText.replace("{hours}",t.toString()).replace("{hourLabel}",o)}function _e(){const e=b(o=>o.voucherConfig.language),t=b(o=>o.personalInfo),n=b(o=>o.setPersonalInfo),a=A(e);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"form-control",children:[r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text font-medium",children:a.form.personalInfo.name})}),r.jsx("input",{type:"text",placeholder:a.form.personalInfo.namePlaceholder,className:"input input-bordered w-full",value:t.name,onChange:o=>n({name:o.target.value})})]}),r.jsxs("div",{className:"form-control",children:[r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text font-medium",children:a.form.personalInfo.email})}),r.jsx("input",{type:"email",placeholder:a.form.personalInfo.emailPlaceholder,className:"input input-bordered w-full",value:t.email,onChange:o=>n({email:o.target.value})})]}),r.jsxs("div",{className:"form-control",children:[r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text font-medium",children:a.form.personalInfo.phone})}),r.jsx("input",{type:"tel",placeholder:a.form.personalInfo.phonePlaceholder,className:"input input-bordered w-full",value:t.phone,onChange:o=>n({phone:o.target.value})})]})]})}async function ae(e,t=.5){return new Promise((n,a)=>{const o=new Image;o.onload=()=>{const i=document.createElement("canvas"),c=i.getContext("2d");if(!c){a(new Error("Failed to get canvas context"));return}i.width=o.width,i.height=o.height,c.drawImage(o,0,0);const l=c.getImageData(0,0,i.width,i.height),s=l.data,d=1+t*.8;for(let u=0;u<s.length;u+=4){const g=s[u],m=s[u+1],f=s[u+2];if(s[u+3]===0)continue;let y=(((.299*g+.587*m+.114*f)/255-.5)*d+.5)*255;y=Math.max(0,Math.min(255,y));const I=Math.min(255,y*.9+25),C=Math.min(255,y*.78+15),w=Math.min(255,y*.55+5);s[u]=Math.round(g*(1-t)+I*t),s[u+1]=Math.round(m*(1-t)+C*t),s[u+2]=Math.round(f*(1-t)+w*t)}c.putImageData(l,0,0),n(i.toDataURL("image/png"))},o.onerror=()=>a(new Error("Failed to load image")),o.src=e})}const Be="https://api.stability.ai/v1/generation",De="https://api.stability.ai/v2beta/stable-image/edit/remove-background",re="stability_api_key";let B=null;function $e(e){B=e}function Ue(){return B}function Me(){return B!==null}const Fe={vintage:"portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",engraved:"portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",currency:"portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"},te=[{width:1024,height:1024},{width:1152,height:896},{width:1216,height:832},{width:1344,height:768},{width:1536,height:640},{width:640,height:1536},{width:768,height:1344},{width:832,height:1216},{width:896,height:1152}];function ze(e,t){const n=e/t;let a=te[0],o=1/0;for(const i of te){const c=i.width/i.height,l=Math.abs(n-c);l<o&&(o=l,a=i)}return a}function He(e){return new Promise((t,n)=>{const a=new Image;a.onload=()=>{const o=ze(a.width,a.height),i=document.createElement("canvas");i.width=o.width,i.height=o.height;const c=i.getContext("2d");if(!c){n(new Error("Failed to get canvas context"));return}const l=a.width/a.height,s=o.width/o.height;let d=0,u=0,g=a.width,m=a.height;l>s?(g=a.height*s,d=(a.width-g)/2):(m=a.width/s,u=(a.height-m)/2),c.drawImage(a,d,u,g,m,0,0,o.width,o.height),t(i.toDataURL("image/png"))},a.onerror=()=>n(new Error("Failed to load image")),a.src=e})}function oe(e){var c;const t=e.split(","),n=((c=t[0].match(/:(.*?);/))==null?void 0:c[1])||"image/png",a=atob(t[1]),o=a.length,i=new Uint8Array(o);for(let l=0;l<o;l++)i[l]=a.charCodeAt(l);return new Blob([i],{type:n})}function F(){var t;const e=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.cjs",document.baseURI).href}<"u"&&"sk-7mEKklrqaltdtgbX0VoZbkA8E1cl939Spn75jSIYRvp1BW0b"||typeof process<"u"&&((t=process.env)==null?void 0:t.NEXT_PUBLIC_STABILITY_API_KEY);return e&&e!=="your-api-key-here"?e:typeof localStorage<"u"?localStorage.getItem(re):null}function ie(e){localStorage.setItem(re,e)}function se(){return B?!0:F()!==null}async function Ke(e){const t=F();if(!t)throw new Error("No Stability AI API key configured");const{imageDataUrl:n,style:a,strength:o=.35}=e,i=await He(n),c=oe(i),l=new FormData;l.append("init_image",c,"portrait.png"),l.append("init_image_mode","IMAGE_STRENGTH"),l.append("image_strength",String(1-o)),l.append("text_prompts[0][text]",Fe[a]),l.append("text_prompts[0][weight]","1"),l.append("cfg_scale","7"),l.append("samples","1"),l.append("steps","30");const d=await fetch(`${Be}/stable-diffusion-xl-1024-v1-0/image-to-image`,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},body:l});if(!d.ok){const g=await d.text();throw console.error("Stability AI error:",g),d.status===401?new Error("Invalid API key"):d.status===402?new Error("Insufficient credits"):d.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(`API error: ${d.status}`)}const u=await d.json();if(!u.artifacts||u.artifacts.length===0)throw new Error("No image generated");return`data:image/png;base64,${u.artifacts[0].base64}`}async function le(e){if(B){const c=await fetch(B,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageDataUrl:e})});if(!c.ok){const s=await c.json().catch(()=>({}));throw new Error(s.error||`API error: ${c.status}`)}return(await c.json()).imageDataUrl}const t=F();if(!t)throw new Error("No Stability AI API key configured");const n=oe(e),a=new FormData;a.append("image",n,"image.png"),a.append("output_format","png");const o=await fetch(De,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"image/*"},body:a});if(!o.ok){const c=await o.text();throw console.error("Stability AI remove background error:",c),o.status===401?new Error("Invalid API key"):o.status===402?new Error("Insufficient credits"):o.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(`API error: ${o.status}`)}const i=await o.blob();return new Promise((c,l)=>{const s=new FileReader;s.onload=()=>c(s.result),s.onerror=()=>l(new Error("Failed to read result")),s.readAsDataURL(i)})}function Oe(){const[e,t]=v.useState(!1),[n,a]=v.useState(!1),[o,i]=v.useState(null),[c,l]=v.useState(se()),s=v.useCallback(()=>i(null),[]),d=v.useCallback(m=>{ie(m),l(!0),i(null)},[]),u=v.useCallback(async(m,f=.5)=>{t(!0),i(null);try{return await ae(m,f)}catch(p){const N=p instanceof Error?p.message:"Enhancement failed";throw i(N),p}finally{t(!1)}},[]),g=v.useCallback(async m=>{a(!0),i(null);try{return await le(m)}catch(f){const p=f instanceof Error?f.message:"Background removal failed";throw i(p),f}finally{a(!1)}},[]);return{enhance:u,removeBg:g,isEnhancing:e,isRemovingBg:n,error:o,hasKey:c,setApiKey:d,clearError:s}}function ce({isOpen:e,onClose:t,onSubmit:n}){const a=b(d=>d.voucherConfig.language),[o,i]=v.useState("");if(!e)return null;const c=d=>{d.preventDefault(),o.trim()&&(n(o.trim()),i(""),t())},s={de:{title:"Stability AI API Key",description:"Um die AI-Bildverbesserung zu nutzen, benötigst du einen Stability AI API Key. Du kannst ihn auf platform.stability.ai erhalten.",placeholder:"sk-...",submit:"Speichern",cancel:"Abbrechen",hint:"Der Key wird lokal in deinem Browser gespeichert."},en:{title:"Stability AI API Key",description:"To use AI image enhancement, you need a Stability AI API key. You can get one at platform.stability.ai.",placeholder:"sk-...",submit:"Save",cancel:"Cancel",hint:"The key is stored locally in your browser."}}[a];return r.jsxs("dialog",{className:"modal modal-open",children:[r.jsxs("div",{className:"modal-box",children:[r.jsx("h3",{className:"font-bold text-lg",children:s.title}),r.jsx("p",{className:"py-4 text-sm opacity-80",children:s.description}),r.jsxs("form",{onSubmit:c,children:[r.jsxs("div",{className:"form-control",children:[r.jsx("input",{type:"password",placeholder:s.placeholder,className:"input input-bordered w-full",value:o,onChange:d=>i(d.target.value),autoFocus:!0}),r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text-alt",children:s.hint})})]}),r.jsxs("div",{className:"modal-action",children:[r.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t,children:s.cancel}),r.jsx("button",{type:"submit",className:"btn btn-primary",disabled:!o.trim(),children:s.submit})]})]})]}),r.jsx("form",{method:"dialog",className:"modal-backdrop",children:r.jsx("button",{onClick:t,children:"close"})})]})}function We(){const e=b(h=>h.voucherConfig.language),t=b(h=>h.portrait),n=b(h=>h.setPortrait),a=b(h=>h.setPortraitZoom),o=b(h=>h.setPortraitRawImage),i=b(h=>h.setPortraitBgRemoved),c=b(h=>h.setPortraitEngravingIntensity),{enhance:l,removeBg:s,isEnhancing:d,isRemovingBg:u,error:g,hasKey:m,setApiKey:f}=Oe(),p=A(e),N=v.useRef(null),[y,I]=v.useState(!1),[C,w]=v.useState(!1),P=v.useRef(null),k=t.rawImage,D=t.bgRemovedImage,L=t.bgRemoved,S=t.engravingIntensity;v.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]);const H=v.useCallback(async h=>{if(!h.type.startsWith("image/"))return;const x=new FileReader;x.onload=async j=>{var Q;const J=(Q=j.target)==null?void 0:Q.result;o(J),n(J),i(!1,null),c(0)},x.readAsDataURL(h)},[n,o,i,c]),xe=v.useCallback(h=>{h.preventDefault(),I(!1);const x=h.dataTransfer.files[0];x&&H(x)},[H]),we=v.useCallback(h=>{h.preventDefault(),I(!0)},[]),ye=v.useCallback(h=>{h.preventDefault(),I(!1)},[]),Ie=()=>{var h;(h=N.current)==null||h.click()},ke=h=>{var j;const x=(j=h.target.files)==null?void 0:j[0];x&&H(x)},$=v.useCallback(async(h,x)=>{try{return await l(h,x)}catch(j){return console.error("Enhancement failed:",j),h}},[l]),X=v.useCallback(async h=>{try{const x=await s(h);return i(!0,x),x}catch(x){return console.error("Background removal failed:",x),h}},[s,i]),Pe=async()=>{if(!k)return;if(!L&&!m){w(!0);return}if(!L){const x=await X(k);if(S>0){const j=await $(x,S);n(j)}else n(x)}else if(i(!1,null),S>0){const x=await $(k,S);n(x)}else n(k)},je=h=>{c(h),P.current&&clearTimeout(P.current),k&&(P.current=setTimeout(async()=>{const x=L&&D?D:k;if(h===0)n(x);else{const j=await $(x,h);n(j)}},150))},Ee=async h=>{if(f(h),!k)return;const x=await X(k);if(S>0){const j=await $(x,S);n(j)}else n(x)},Ne=()=>{n(null),o(null),i(!1,null),c(0)};return r.jsxs("div",{className:"space-y-4",children:[t.original?r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"w-32 h-32 rounded-full overflow-hidden border-4 border-currency-gold shadow-lg",children:r.jsx("img",{src:t.original||"",alt:"Portrait",className:"w-full h-full object-cover",style:{transform:`scale(${t.zoom})`}})}),r.jsx("button",{className:"btn btn-circle btn-xs btn-error absolute -top-1 -right-1",onClick:Ne,children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),r.jsxs("div",{className:"form-control w-full max-w-xs",children:[r.jsxs("label",{className:"label",children:[r.jsx("span",{className:"label-text",children:p.form.portrait.zoom}),r.jsxs("span",{className:"label-text-alt",children:[Math.round(t.zoom*100),"%"]})]}),r.jsx("input",{type:"range",min:"0.5",max:"2",step:"0.05",value:t.zoom,onChange:h=>a(parseFloat(h.target.value)),className:"range range-primary range-sm"})]}),r.jsxs("div",{className:"form-control w-full max-w-xs",children:[r.jsxs("label",{className:"label",children:[r.jsxs("span",{className:"label-text flex items-center gap-2",children:[e==="de"?"Gravur-Effekt":"Engraving effect",d&&r.jsx("span",{className:"loading loading-spinner loading-xs"})]}),r.jsxs("span",{className:"label-text-alt",children:[Math.round(S*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:S,onChange:h=>je(parseFloat(h.target.value)),className:"range range-secondary range-sm",disabled:d||!k})]}),r.jsx("div",{className:"form-control",children:r.jsxs("label",{className:"label cursor-pointer justify-start gap-3",children:[r.jsx("input",{type:"checkbox",className:`toggle toggle-primary ${u?"opacity-50":""}`,checked:L,onChange:Pe,disabled:u||!k}),r.jsxs("span",{className:"label-text flex items-center gap-2",children:[u?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"loading loading-spinner loading-xs"}),e==="de"?"Hintergrund wird entfernt...":"Removing background..."]}):e==="de"?"Hintergrund entfernen":"Remove background",!m&&r.jsx("span",{className:"badge badge-sm badge-outline",children:"API"})]})]})}),g&&r.jsxs("div",{className:"alert alert-warning text-sm py-2",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"stroke-current shrink-0 h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),r.jsx("span",{children:g})]})]}):r.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${u?"border-primary bg-primary/10 pointer-events-none":y?"border-primary bg-primary/10":"border-base-300 hover:border-primary hover:bg-base-200"}`,onDrop:xe,onDragOver:we,onDragLeave:ye,onClick:Ie,children:[r.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:ke}),u?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("span",{className:"loading loading-spinner loading-lg text-primary"}),r.jsx("p",{className:"font-medium",children:e==="de"?"Hintergrund wird entfernt...":"Removing background..."})]}):r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-12 w-12 text-base-content/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),r.jsx("p",{className:"font-medium",children:p.form.portrait.upload}),r.jsx("p",{className:"text-sm text-base-content/60",children:p.form.portrait.dragDrop})]})]}),r.jsx(ce,{isOpen:C,onClose:()=>w(!1),onSubmit:Ee})]})}function qe(){return null}const E=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.cjs",document.baseURI).href}<"u"&&"/"||"/",de={en:{1:{front:`${E}templates/front_ldpi_en.png`,back:`${E}templates/back_ldpi_en.png`,width:1536,height:1024},5:{front:`${E}templates/front_ldpi_en.png`,back:`${E}templates/back_ldpi_en.png`,width:1536,height:1024},10:{front:`${E}templates/front_ldpi_en.png`,back:`${E}templates/back_ldpi_en.png`,width:1536,height:1024}},de:{1:{front:`${E}templates/front_hdpi_de.webp`,back:`${E}templates/back_hdpi_de.webp`,width:6144,height:3200},5:{front:`${E}templates/front_hdpi_de.webp`,back:`${E}templates/back_hdpi_de.webp`,width:6144,height:3200},10:{front:`${E}templates/front_hdpi_de.webp`,back:`${E}templates/back_hdpi_de.webp`,width:6144,height:3200}}},T={front:{portrait:{x:768,y:490,radiusX:236,radiusY:258},namePlate:{x:768,y:848,fontSize:36,maxWidth:380,align:"center"}},back:{portrait:{x:0,y:0,radiusX:0,radiusY:0},namePlate:{x:768,y:832,fontSize:36,maxWidth:380,align:"center"},contactInfo:{x:380,y:500,fontSize:38,lineHeight:55,align:"center"},description:{x:1150,y:500,fontSize:38,maxWidth:480,lineHeight:42,align:"center"}}},R={front:{portrait:{x:3074,y:1530,radiusX:942,radiusY:1020},namePlate:{x:3072,y:2950,fontSize:144,maxWidth:1520,align:"center"}},back:{portrait:{x:0,y:0,radiusX:0,radiusY:0},namePlate:{x:3072,y:2930,fontSize:144,maxWidth:1520,align:"center"},contactInfo:{x:1520,y:1680,fontSize:160,lineHeight:280,align:"center"},description:{x:4600,y:1680,fontSize:145,maxWidth:2e3,lineHeight:210,align:"center"}}};function W(e){return e==="de"?R:T}function q(e,t){return de[e][t]}const K=new Map;async function U(e){return K.has(e)?K.get(e):new Promise((t,n)=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{K.set(e,a),t(a)},a.onerror=n,a.src=e})}function Y(e,t,n,a){e.drawImage(t,0,0,n,a)}function ue(e,t,n,a,o,i,c=1){e.save(),e.beginPath(),e.ellipse(n,a,o,i,0,0,Math.PI*2),e.closePath(),e.clip();const l=t.width/t.height,s=o/i,d=o*2,u=i*2;let g,m;l>s?(m=u,g=u*l):(g=d,m=d/l),g*=c,m*=c;const f=n-g/2,p=a-m/2;e.drawImage(t,f,p,g,m),e.restore()}function V(e,t,n,a="#2a3a2a"){e.save(),e.font=`${n.fontSize}px "Times New Roman", serif`,e.textAlign=n.align||"center",e.textBaseline="middle",e.fillStyle=a,n.maxWidth?e.fillText(t,n.x,n.y,n.maxWidth):e.fillText(t,n.x,n.y),e.restore()}function he(e,t,n,a="#2a3a2a"){e.save(),e.font=`${n.fontSize}px "Times New Roman", serif`,e.textAlign=n.align||"center",e.textBaseline="top",e.fillStyle=a;const o=n.maxWidth||400,i=n.lineHeight||n.fontSize*1.4,c=t.split(" "),l=[];let s="";for(const g of c){const m=s?`${s} ${g}`:g;e.measureText(m).width>o&&s?(l.push(s),s=g):s=m}s&&l.push(s);const d=l.length*i;let u=n.y-d/2;for(const g of l)e.fillText(g,n.x,u),u+=i;e.restore()}function pe(e,t,n,a,o,i="#2a3a2a"){e.save(),e.font=`${o.fontSize}px "Times New Roman", serif`,e.textAlign=o.align||"center",e.textBaseline="middle",e.fillStyle=i;const c=o.lineHeight||o.fontSize*1.8,l=[t,n,a].filter(Boolean),s=(l.length-1)*c;let d=o.y-s/2;for(const u of l)u&&(e.fillText(u,o.x,d),d+=c);e.restore()}async function G(e,t,n,a,o,i,c,l=1){const s=e.getContext("2d");if(!s)return;e.width=i,e.height=c,s.clearRect(0,0,i,c);const d=await U(t);if(Y(s,d,i,c),n)try{const u=await U(n);ue(s,u,o.portrait.x,o.portrait.y,o.portrait.radiusX,o.portrait.radiusY,l)}catch(u){console.error("Failed to load portrait:",u)}a&&V(s,a,o.namePlate)}async function Z(e,t,n,a,o,i,c,l,s){const d=e.getContext("2d");if(!d)return;e.width=l,e.height=s,d.clearRect(0,0,l,s);const u=await U(t);Y(d,u,l,s),c.contactInfo&&(n||a||o)&&pe(d,n,a,o,c.contactInfo),c.description&&i&&he(d,i,c.description),n&&V(d,n,c.namePlate)}function Ye(){const e=b(w=>w.voucherConfig.language),t=b(w=>w.voucherConfig.hours),n=b(w=>w.voucherConfig.description),a=b(w=>w.personalInfo),o=b(w=>w.portrait),i=b(w=>w.currentSide),c=b(w=>w.flipSide),l=A(e),s=v.useRef(null),d=v.useRef(null),u=v.useRef(null),[g,m]=v.useState(!1),f=q(e,t),p=W(e),N=o.useEnhanced&&o.enhanced?o.enhanced:o.original,y=O(e,t,n);v.useEffect(()=>{s.current&&G(s.current,f.front,N,a.name,p.front,f.width,f.height,o.zoom)},[f,N,a.name,p,o.zoom]),v.useEffect(()=>{d.current&&Z(d.current,f.back,a.name,a.email,a.phone,y,p.back,f.width,f.height)},[f,a,y,p]);const I=()=>{m(!0),setTimeout(()=>{c(),m(!1)},150)},C=f.width/f.height;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"tabs tabs-boxed bg-base-200",children:[r.jsx("button",{className:`tab ${i==="front"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>i!=="front"&&I(),children:l.preview.front}),r.jsx("button",{className:`tab ${i==="back"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>i!=="back"&&I(),children:l.preview.back})]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:I,children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),l.preview.flip]})]}),r.jsxs("div",{ref:u,className:"relative w-full overflow-hidden shadow-lg",style:{aspectRatio:C},children:[r.jsx("canvas",{ref:s,className:`absolute inset-0 w-full h-full transition-all duration-300 ${i==="front"?g?"opacity-0 scale-95":"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"}`}),r.jsx("canvas",{ref:d,className:`absolute inset-0 w-full h-full transition-all duration-300 ${i==="back"?g?"opacity-0 scale-95":"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"}`})]})]})}function Ve(){const e=v.useRef(null),t=v.useRef(null);return{frontCanvasRef:e,backCanvasRef:t}}async function me(e){const{frontTemplateSrc:t,backTemplateSrc:n,templateWidth:a,templateHeight:o,layout:i,portrait:c,portraitZoom:l=1,name:s,email:d,phone:u,description:g}=e,m=document.createElement("canvas"),f=document.createElement("canvas");await Promise.all([G(m,t,c,s,i.front,a,o,l),Z(f,n,s,d,u,g,i.back,a,o)]);const p=new Te({orientation:"landscape",unit:"mm",format:"a4"}),N=297,y=210,I=10,C=a/o;let w=N-I*2,P=w/C;P>y-I*2&&(P=y-I*2,w=P*C);const k=(N-w)/2,D=(y-P)/2,L=m.toDataURL("image/jpeg",.95);p.addImage(L,"JPEG",k,D,w,P),p.addPage();const S=f.toDataURL("image/jpeg",.95);return p.addImage(S,"JPEG",k,D,w,P),p.output("blob")}function ge(e,t){const n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}async function fe(e){const t=await me(e);ge(t,e.filename)}function Ge(){const e=b(p=>p.voucherConfig.language),t=b(p=>p.voucherConfig.hours),n=b(p=>p.voucherConfig.description),a=b(p=>p.personalInfo),o=b(p=>p.portrait),i=b(p=>p.isExporting),c=b(p=>p.setIsExporting),l=A(e),s=q(e,t),d=W(e),u=o.useEnhanced&&o.enhanced?o.enhanced:o.original,g=O(e,t,n),m=a.name.trim().length>0&&a.email.trim().length>0&&a.phone.trim().length>0&&o.original!==null,f=async()=>{if(!(!m||i)){c(!0);try{const p=`zeitgutschein-${t}h-${a.name.replace(/\s+/g,"-").toLowerCase()}.pdf`;await fe({frontTemplateSrc:s.front,backTemplateSrc:s.back,templateWidth:s.width,templateHeight:s.height,layout:d,portrait:u,portraitZoom:o.zoom,name:a.name,email:a.email,phone:a.phone,description:g,filename:p})}catch(p){console.error("PDF export failed:",p)}finally{c(!1)}}};return r.jsx("button",{className:`btn btn-primary flex-1 ${i?"loading":""}`,onClick:f,disabled:!m||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"loading loading-spinner loading-sm"}),l.export.exporting]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),l.export.button]})})}function be(){const e=b(a=>a.voucherConfig.language),t=b(a=>a.setLanguage),n=a=>{t(a)};return r.jsxs("div",{className:"join",children:[r.jsx("button",{className:`join-item btn btn-sm ${e==="de"?"btn-active btn-primary":"btn-ghost"}`,onClick:()=>n("de"),children:"DE"}),r.jsx("button",{className:`join-item btn btn-sm ${e==="en"?"btn-active btn-primary":"btn-ghost"}`,onClick:()=>n("en"),children:"EN"})]})}function Ze(){const e=b(n=>n.voucherConfig.language),t=A(e);return r.jsxs("div",{className:"navbar bg-currency-green text-currency-cream shadow-lg",children:[r.jsx("div",{className:"navbar-start",children:r.jsx("a",{className:"btn btn-ghost text-xl font-currency font-bold",children:t.header.title})}),r.jsx("div",{className:"navbar-center hidden sm:flex",children:r.jsx("span",{className:"text-sm opacity-80",children:t.header.subtitle})}),r.jsx("div",{className:"navbar-end",children:r.jsx(be,{})})]})}const M="/",Xe={id:"time-voucher-classic-de",name:"Zeitgutschein Classic",type:"time-voucher",category:"classic",images:{front:`${M}templates/front_hdpi_de.jpg`,back:`${M}templates/back_hdpi_de.jpg`,width:6144,height:4096},fields:[{id:"name",type:"text",label:{de:"Name",en:"Name"},required:!0,validation:{minLength:1,maxLength:50}},{id:"hours",type:"select",label:{de:"Stunden",en:"Hours"},required:!0,options:["1","5","10"]},{id:"portrait",type:"image",label:{de:"Portrait",en:"Portrait"},required:!1},{id:"email",type:"text",label:{de:"E-Mail",en:"Email"},required:!1},{id:"phone",type:"text",label:{de:"Telefon",en:"Phone"},required:!1},{id:"description",type:"textarea",label:{de:"Beschreibung",en:"Description"},required:!1,validation:{maxLength:200}}],layout:{front:{portrait:R.front.portrait,name:R.front.namePlate},back:{name:R.back.namePlate,contactInfo:R.back.contactInfo,description:R.back.description}},languages:["de"]},Je={id:"time-voucher-classic-en",name:"Time Voucher Classic",type:"time-voucher",category:"classic",images:{front:`${M}templates/front_ldpi_en.png`,back:`${M}templates/back_ldpi_en.png`,width:1536,height:1024},fields:[{id:"name",type:"text",label:{de:"Name",en:"Name"},required:!0,validation:{minLength:1,maxLength:50}},{id:"hours",type:"select",label:{de:"Stunden",en:"Hours"},required:!0,options:["1","5","10"]},{id:"portrait",type:"image",label:{de:"Portrait",en:"Portrait"},required:!1},{id:"email",type:"text",label:{de:"E-Mail",en:"Email"},required:!1},{id:"phone",type:"text",label:{de:"Telefon",en:"Phone"},required:!1},{id:"description",type:"textarea",label:{de:"Beschreibung",en:"Description"},required:!1,validation:{maxLength:200}}],layout:{front:{portrait:T.front.portrait,name:T.front.namePlate},back:{name:T.back.namePlate,contactInfo:T.back.contactInfo,description:T.back.description}},languages:["en"]},ne=[Xe,Je],ve={async listTemplates(e){let t=[...ne];return e!=null&&e.type&&(t=t.filter(n=>n.type===e.type)),e!=null&&e.category&&(t=t.filter(n=>n.category===e.category)),e!=null&&e.language&&(t=t.filter(n=>n.languages.includes(e.language))),t},async getTemplate(e){const t=ne.find(n=>n.id===e);if(!t)throw new Error(`Template not found: ${e}`);return t}};function Qe(e){return e==="de"?"time-voucher-classic-de":"time-voucher-classic-en"}let z=ve;function et(e){z=e}function tt(){return z}async function nt(e){return z.listTemplates(e)}async function at(e){return z.getTemplate(e)}exports.ApiKeyModal=ce;exports.BillPreview=Ye;exports.ExportButton=Ge;exports.Header=Ze;exports.LAYOUT_HDPI=R;exports.LAYOUT_LDPI=T;exports.LanguageToggle=be;exports.PersonalInfoForm=_e;exports.PortraitUpload=We;exports.TEMPLATES=de;exports.VoucherConfig=qe;exports.applyEngravingEffect=ae;exports.downloadBlob=ge;exports.drawContactInfo=pe;exports.drawMultilineText=he;exports.drawOvalPortrait=ue;exports.drawTemplate=Y;exports.drawText=V;exports.enhancePortrait=Ke;exports.exportBillAsPDF=fe;exports.formatDescription=O;exports.generateBillPDF=me;exports.getApiKey=F;exports.getDefaultTemplateId=Qe;exports.getLayout=W;exports.getRemoveBackgroundEndpoint=Ue;exports.getTemplate=q;exports.getTemplateById=at;exports.getTemplateProvider=tt;exports.hasApiKey=se;exports.hasCustomEndpoint=Me;exports.listTemplates=nt;exports.loadImage=U;exports.removeBackground=le;exports.renderBackSide=Z;exports.renderFrontSide=G;exports.setApiKey=ie;exports.setRemoveBackgroundEndpoint=$e;exports.setTemplateProvider=et;exports.staticTemplateProvider=ve;exports.t=A;exports.useBillCanvasRefs=Ve;exports.useBillStore=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),Ne=require("zustand"),Ce=require("zustand/middleware"),v=require("react"),Te=require("jspdf");var _=typeof document<"u"?document.currentScript:null;const te={personalInfo:{name:"",email:"",phone:""},voucherConfig:{hours:1,description:"",language:"de"},portrait:{original:null,enhanced:null,useEnhanced:!1,zoom:1,rawImage:null,bgRemovedImage:null,bgRemoved:!1,engravingIntensity:0},currentSide:"front",isEnhancing:!1,isExporting:!1},f=Ne.create()(Ce.persist(e=>({...te,setPersonalInfo:t=>e(n=>({personalInfo:{...n.personalInfo,...t}})),setVoucherConfig:t=>e(n=>({voucherConfig:{...n.voucherConfig,...t}})),setPortrait:(t,n=null)=>e(a=>({portrait:{...a.portrait,original:t,enhanced:n,useEnhanced:!1,zoom:a.portrait.original&&t?a.portrait.zoom:1}})),setEnhancedPortrait:t=>e(n=>({portrait:{...n.portrait,enhanced:t,useEnhanced:t!==null}})),toggleUseEnhanced:()=>e(t=>({portrait:{...t.portrait,useEnhanced:t.portrait.enhanced?!t.portrait.useEnhanced:!1}})),setPortraitZoom:t=>e(n=>({portrait:{...n.portrait,zoom:t}})),setPortraitRawImage:t=>e(n=>({portrait:{...n.portrait,rawImage:t}})),setPortraitBgRemoved:(t,n)=>e(a=>({portrait:{...a.portrait,bgRemoved:t,bgRemovedImage:n!==void 0?n:a.portrait.bgRemovedImage}})),setPortraitEngravingIntensity:t=>e(n=>({portrait:{...n.portrait,engravingIntensity:t}})),setCurrentSide:t=>e({currentSide:t}),flipSide:()=>e(t=>({currentSide:t.currentSide==="front"?"back":"front"})),setIsEnhancing:t=>e({isEnhancing:t}),setIsExporting:t=>e({isExporting:t}),setLanguage:t=>e(n=>({voucherConfig:{...n.voucherConfig,language:t}})),setHours:t=>e(n=>({voucherConfig:{...n.voucherConfig,hours:t}})),reset:()=>e(te)}),{name:"money-generator-storage",partialize:e=>({personalInfo:e.personalInfo,voucherConfig:e.voucherConfig,portrait:{original:null,enhanced:null,useEnhanced:e.portrait.useEnhanced,zoom:e.portrait.zoom,rawImage:null,bgRemovedImage:null,bgRemoved:!1,engravingIntensity:e.portrait.engravingIntensity}})})),Re={header:{title:"Money Generator",subtitle:"Erstelle deinen persönlichen Zeitgutschein"},form:{personalInfo:{title:"Persönliche Daten",name:"Name",namePlaceholder:"Dein Name",email:"E-Mail",emailPlaceholder:"deine@email.de",phone:"Telefon",phonePlaceholder:"+49 123 456789"},portrait:{title:"Portrait",upload:"Bild hochladen",dragDrop:"oder hierher ziehen",enhance:"Mit AI verbessern",enhancing:"Wird verbessert...",useOriginal:"Original verwenden",useEnhanced:"Verbessertes verwenden",zoom:"Zoom"},voucher:{title:"Gutschein",hours:"Stunden",hourLabel:"Stunde",hoursLabel:"Stunden",description:"Beschreibung",descriptionPlaceholder:"Was kann mit diesem Gutschein eingelöst werden?"}},preview:{front:"Vorderseite",back:"Rückseite",flip:"Umdrehen"},export:{button:"Als PDF herunterladen",exporting:"PDF wird erstellt...",success:"Download gestartet!"},bill:{descriptionText:"Für diesen Schein erhältst du {hours} {hourLabel} meiner Zeit oder ein gleichwertiges Dankeschön"}},Ae={header:{title:"Money Generator",subtitle:"Create your personal time voucher"},form:{personalInfo:{title:"Personal Information",name:"Name",namePlaceholder:"Your name",email:"Email",emailPlaceholder:"your@email.com",phone:"Phone",phonePlaceholder:"+1 234 567890"},portrait:{title:"Portrait",upload:"Upload image",dragDrop:"or drag and drop",enhance:"Enhance with AI",enhancing:"Enhancing...",useOriginal:"Use original",useEnhanced:"Use enhanced",zoom:"Zoom"},voucher:{title:"Voucher",hours:"Hours",hourLabel:"hour",hoursLabel:"hours",description:"Description",descriptionPlaceholder:"What can be redeemed with this voucher?"}},preview:{front:"Front",back:"Back",flip:"Flip"},export:{button:"Download as PDF",exporting:"Creating PDF...",success:"Download started!"},bill:{descriptionText:"This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"}},Le={de:Re,en:Ae};function R(e){return Le[e]}function q(e,t,n){if(n&&n.trim())return n;const a=R(e),o=t===1?a.form.voucher.hourLabel:a.form.voucher.hoursLabel;return a.bill.descriptionText.replace("{hours}",t.toString()).replace("{hourLabel}",o)}function _e(){const e=f(o=>o.voucherConfig.language),t=f(o=>o.personalInfo),n=f(o=>o.setPersonalInfo),a=R(e);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"form-control",children:[r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text font-medium",children:a.form.personalInfo.name})}),r.jsx("input",{type:"text",placeholder:a.form.personalInfo.namePlaceholder,className:"input input-bordered w-full",value:t.name,onChange:o=>n({name:o.target.value})})]}),r.jsxs("div",{className:"form-control",children:[r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text font-medium",children:a.form.personalInfo.email})}),r.jsx("input",{type:"email",placeholder:a.form.personalInfo.emailPlaceholder,className:"input input-bordered w-full",value:t.email,onChange:o=>n({email:o.target.value})})]}),r.jsxs("div",{className:"form-control",children:[r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text font-medium",children:a.form.personalInfo.phone})}),r.jsx("input",{type:"tel",placeholder:a.form.personalInfo.phonePlaceholder,className:"input input-bordered w-full",value:t.phone,onChange:o=>n({phone:o.target.value})})]})]})}async function re(e,t=.5){return new Promise((n,a)=>{const o=new Image;o.onload=()=>{const i=document.createElement("canvas"),c=i.getContext("2d");if(!c){a(new Error("Failed to get canvas context"));return}i.width=o.width,i.height=o.height,c.drawImage(o,0,0);const l=c.getImageData(0,0,i.width,i.height),s=l.data,d=1+t*.8;for(let u=0;u<s.length;u+=4){const g=s[u],h=s[u+1],b=s[u+2];if(s[u+3]===0)continue;let I=(((.299*g+.587*h+.114*b)/255-.5)*d+.5)*255;I=Math.max(0,Math.min(255,I));const k=Math.min(255,I*.9+25),N=Math.min(255,I*.78+15),w=Math.min(255,I*.55+5);s[u]=Math.round(g*(1-t)+k*t),s[u+1]=Math.round(h*(1-t)+N*t),s[u+2]=Math.round(b*(1-t)+w*t)}c.putImageData(l,0,0),n(i.toDataURL("image/png"))},o.onerror=()=>a(new Error("Failed to load image")),o.src=e})}const Be="https://api.stability.ai/v1/generation",De="https://api.stability.ai/v2beta/stable-image/edit/remove-background",oe="stability_api_key";let B=null;function $e(e){B=e}function Ue(){return B}function Me(){return B!==null}const ze={vintage:"portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",engraved:"portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",currency:"portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"},ne=[{width:1024,height:1024},{width:1152,height:896},{width:1216,height:832},{width:1344,height:768},{width:1536,height:640},{width:640,height:1536},{width:768,height:1344},{width:832,height:1216},{width:896,height:1152}];function Fe(e,t){const n=e/t;let a=ne[0],o=1/0;for(const i of ne){const c=i.width/i.height,l=Math.abs(n-c);l<o&&(o=l,a=i)}return a}function He(e){return new Promise((t,n)=>{const a=new Image;a.onload=()=>{const o=Fe(a.width,a.height),i=document.createElement("canvas");i.width=o.width,i.height=o.height;const c=i.getContext("2d");if(!c){n(new Error("Failed to get canvas context"));return}const l=a.width/a.height,s=o.width/o.height;let d=0,u=0,g=a.width,h=a.height;l>s?(g=a.height*s,d=(a.width-g)/2):(h=a.width/s,u=(a.height-h)/2),c.drawImage(a,d,u,g,h,0,0,o.width,o.height),t(i.toDataURL("image/png"))},a.onerror=()=>n(new Error("Failed to load image")),a.src=e})}function ie(e){var c;const t=e.split(","),n=((c=t[0].match(/:(.*?);/))==null?void 0:c[1])||"image/png",a=atob(t[1]),o=a.length,i=new Uint8Array(o);for(let l=0;l<o;l++)i[l]=a.charCodeAt(l);return new Blob([i],{type:n})}function F(){var t;const e=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.cjs",document.baseURI).href}<"u"&&"sk-7mEKklrqaltdtgbX0VoZbkA8E1cl939Spn75jSIYRvp1BW0b"||typeof process<"u"&&((t=process.env)==null?void 0:t.NEXT_PUBLIC_STABILITY_API_KEY);return e&&e!=="your-api-key-here"?e:typeof localStorage<"u"?localStorage.getItem(oe):null}function se(e){localStorage.setItem(oe,e)}function W(){return B?!0:F()!==null}async function Ke(e){const t=F();if(!t)throw new Error("No Stability AI API key configured");const{imageDataUrl:n,style:a,strength:o=.35}=e,i=await He(n),c=ie(i),l=new FormData;l.append("init_image",c,"portrait.png"),l.append("init_image_mode","IMAGE_STRENGTH"),l.append("image_strength",String(1-o)),l.append("text_prompts[0][text]",ze[a]),l.append("text_prompts[0][weight]","1"),l.append("cfg_scale","7"),l.append("samples","1"),l.append("steps","30");const d=await fetch(`${Be}/stable-diffusion-xl-1024-v1-0/image-to-image`,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},body:l});if(!d.ok){const g=await d.text();throw console.error("Stability AI error:",g),d.status===401?new Error("Invalid API key"):d.status===402?new Error("Insufficient credits"):d.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(`API error: ${d.status}`)}const u=await d.json();if(!u.artifacts||u.artifacts.length===0)throw new Error("No image generated");return`data:image/png;base64,${u.artifacts[0].base64}`}async function le(e){if(B){const c=await fetch(B,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageDataUrl:e})});if(!c.ok){const s=await c.json().catch(()=>({}));throw new Error(s.error||`API error: ${c.status}`)}return(await c.json()).imageDataUrl}const t=F();if(!t)throw new Error("No Stability AI API key configured");const n=ie(e),a=new FormData;a.append("image",n,"image.png"),a.append("output_format","png");const o=await fetch(De,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"image/*"},body:a});if(!o.ok){const c=await o.text();throw console.error("Stability AI remove background error:",c),o.status===401?new Error("Invalid API key"):o.status===402?new Error("Insufficient credits"):o.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(`API error: ${o.status}`)}const i=await o.blob();return new Promise((c,l)=>{const s=new FileReader;s.onload=()=>c(s.result),s.onerror=()=>l(new Error("Failed to read result")),s.readAsDataURL(i)})}function Oe(){const[e,t]=v.useState(!1),[n,a]=v.useState(!1),[o,i]=v.useState(null),[c,l]=v.useState(()=>W());v.useEffect(()=>{l(W())},[]);const s=v.useCallback(()=>i(null),[]),d=v.useCallback(h=>{se(h),l(!0),i(null)},[]),u=v.useCallback(async(h,b=.5)=>{t(!0),i(null);try{return await re(h,b)}catch(p){const S=p instanceof Error?p.message:"Enhancement failed";throw i(S),p}finally{t(!1)}},[]),g=v.useCallback(async h=>{a(!0),i(null);try{return await le(h)}catch(b){const p=b instanceof Error?b.message:"Background removal failed";throw i(p),b}finally{a(!1)}},[]);return{enhance:u,removeBg:g,isEnhancing:e,isRemovingBg:n,error:o,hasKey:c,setApiKey:d,clearError:s}}function ce({isOpen:e,onClose:t,onSubmit:n}){const a=f(d=>d.voucherConfig.language),[o,i]=v.useState("");if(!e)return null;const c=d=>{d.preventDefault(),o.trim()&&(n(o.trim()),i(""),t())},s={de:{title:"Stability AI API Key",description:"Um die AI-Bildverbesserung zu nutzen, benötigst du einen Stability AI API Key. Du kannst ihn auf platform.stability.ai erhalten.",placeholder:"sk-...",submit:"Speichern",cancel:"Abbrechen",hint:"Der Key wird lokal in deinem Browser gespeichert."},en:{title:"Stability AI API Key",description:"To use AI image enhancement, you need a Stability AI API key. You can get one at platform.stability.ai.",placeholder:"sk-...",submit:"Save",cancel:"Cancel",hint:"The key is stored locally in your browser."}}[a];return r.jsxs("dialog",{className:"modal modal-open",children:[r.jsxs("div",{className:"modal-box",children:[r.jsx("h3",{className:"font-bold text-lg",children:s.title}),r.jsx("p",{className:"py-4 text-sm opacity-80",children:s.description}),r.jsxs("form",{onSubmit:c,children:[r.jsxs("div",{className:"form-control",children:[r.jsx("input",{type:"password",placeholder:s.placeholder,className:"input input-bordered w-full",value:o,onChange:d=>i(d.target.value),autoFocus:!0}),r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text-alt",children:s.hint})})]}),r.jsxs("div",{className:"modal-action",children:[r.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t,children:s.cancel}),r.jsx("button",{type:"submit",className:"btn btn-primary",disabled:!o.trim(),children:s.submit})]})]})]}),r.jsx("form",{method:"dialog",className:"modal-backdrop",children:r.jsx("button",{onClick:t,children:"close"})})]})}function We(){const e=f(m=>m.voucherConfig.language),t=f(m=>m.portrait),n=f(m=>m.setPortrait),a=f(m=>m.setPortraitZoom),o=f(m=>m.setPortraitRawImage),i=f(m=>m.setPortraitBgRemoved),c=f(m=>m.setPortraitEngravingIntensity),{enhance:l,removeBg:s,isEnhancing:d,isRemovingBg:u,error:g,hasKey:h,setApiKey:b}=Oe(),p=R(e),S=v.useRef(null),[I,k]=v.useState(!1),[N,w]=v.useState(!1),j=v.useRef(null),P=t.rawImage,D=t.bgRemovedImage,A=t.bgRemoved,L=t.engravingIntensity;v.useEffect(()=>{t.original&&!t.rawImage&&o(t.original)},[t.original,t.rawImage,o]),v.useEffect(()=>()=>{j.current&&clearTimeout(j.current)},[]);const K=v.useCallback(async m=>{if(!m.type.startsWith("image/"))return;const x=new FileReader;x.onload=async y=>{var ee;const U=(ee=y.target)==null?void 0:ee.result;o(U),n(U),i(!1,null),c(0)},x.readAsDataURL(m)},[n,o,i,c]),xe=v.useCallback(m=>{m.preventDefault(),k(!1);const x=m.dataTransfer.files[0];x&&K(x)},[K]),we=v.useCallback(m=>{m.preventDefault(),k(!0)},[]),ye=v.useCallback(m=>{m.preventDefault(),k(!1)},[]),Ie=()=>{var m;(m=S.current)==null||m.click()},ke=m=>{var y;const x=(y=m.target.files)==null?void 0:y[0];x&&K(x)},$=v.useCallback(async(m,x)=>{try{return await l(m,x)}catch(y){return console.error("Enhancement failed:",y),m}},[l]),Q=v.useCallback(async m=>{try{const x=await s(m);return i(!0,x),x}catch(x){return console.error("Background removal failed:",x),m}},[s,i]),Pe=async()=>{if(!P)return;if(!A&&!h){w(!0);return}if(!A){const x=await Q(P),y=f.getState().portrait.engravingIntensity;if(y>0){const U=await $(x,y);n(U)}else n(x)}else{i(!1,null);const x=f.getState().portrait.engravingIntensity;if(x>0){const y=await $(P,x);n(y)}else n(P)}},je=m=>{c(m),j.current&&clearTimeout(j.current),P&&(j.current=setTimeout(async()=>{const x=A&&D?D:P;if(m===0)n(x);else{const y=await $(x,m);n(y)}},150))},Ee=async m=>{if(b(m),!P)return;const x=await Q(P);if(L>0){const y=await $(x,L);n(y)}else n(x)},Se=()=>{n(null),o(null),i(!1,null),c(0)};return r.jsxs("div",{className:"space-y-4",children:[t.original?r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"w-32 h-32 rounded-full overflow-hidden border-4 border-currency-gold shadow-lg",children:r.jsx("img",{src:t.original||"",alt:"Portrait",className:"w-full h-full object-cover",style:{transform:`scale(${t.zoom})`}})}),r.jsx("button",{className:"btn btn-circle btn-xs btn-error absolute -top-1 -right-1",onClick:Se,children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),r.jsxs("div",{className:"form-control w-full max-w-xs",children:[r.jsxs("label",{className:"label",children:[r.jsx("span",{className:"label-text",children:p.form.portrait.zoom}),r.jsxs("span",{className:"label-text-alt",children:[Math.round(t.zoom*100),"%"]})]}),r.jsx("input",{type:"range",min:"0.5",max:"2",step:"0.05",value:t.zoom,onChange:m=>a(parseFloat(m.target.value)),className:"range range-primary range-sm"})]}),r.jsxs("div",{className:"form-control w-full max-w-xs",children:[r.jsxs("label",{className:"label",children:[r.jsxs("span",{className:"label-text flex items-center gap-2",children:[e==="de"?"Sepia-Effekt":"Sepia effect",d&&r.jsx("span",{className:"loading loading-spinner loading-xs"})]}),r.jsxs("span",{className:"label-text-alt",children:[Math.round(L*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:L,onChange:m=>je(parseFloat(m.target.value)),className:"range range-secondary range-sm",disabled:d||!P})]}),r.jsx("div",{className:"form-control",children:r.jsxs("label",{className:"label cursor-pointer justify-start gap-3",children:[r.jsx("input",{type:"checkbox",className:`toggle toggle-primary ${u?"opacity-50":""}`,checked:A,onChange:Pe,disabled:u||!P}),r.jsxs("span",{className:"label-text flex items-center gap-2",children:[u?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"loading loading-spinner loading-xs"}),e==="de"?"Hintergrund wird entfernt...":"Removing background..."]}):e==="de"?"Hintergrund entfernen":"Remove background",!h&&r.jsx("span",{className:"badge badge-sm badge-outline",children:"API"})]})]})}),g&&r.jsxs("div",{className:"alert alert-warning text-sm py-2",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"stroke-current shrink-0 h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),r.jsx("span",{children:g})]})]}):r.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${u?"border-primary bg-primary/10 pointer-events-none":I?"border-primary bg-primary/10":"border-base-300 hover:border-primary hover:bg-base-200"}`,onDrop:xe,onDragOver:we,onDragLeave:ye,onClick:Ie,children:[r.jsx("input",{ref:S,type:"file",accept:"image/*",className:"hidden",onChange:ke}),u?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("span",{className:"loading loading-spinner loading-lg text-primary"}),r.jsx("p",{className:"font-medium",children:e==="de"?"Hintergrund wird entfernt...":"Removing background..."})]}):r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-12 w-12 text-base-content/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),r.jsx("p",{className:"font-medium",children:p.form.portrait.upload}),r.jsx("p",{className:"text-sm text-base-content/60",children:p.form.portrait.dragDrop})]})]}),r.jsx(ce,{isOpen:N,onClose:()=>w(!1),onSubmit:Ee})]})}function qe(){return null}const E=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.cjs",document.baseURI).href}<"u"&&"/"||"/",de={en:{1:{front:`${E}templates/front_ldpi_en.png`,back:`${E}templates/back_ldpi_en.png`,width:1536,height:1024},5:{front:`${E}templates/front_ldpi_en.png`,back:`${E}templates/back_ldpi_en.png`,width:1536,height:1024},10:{front:`${E}templates/front_ldpi_en.png`,back:`${E}templates/back_ldpi_en.png`,width:1536,height:1024}},de:{1:{front:`${E}templates/front_hdpi_de.webp`,back:`${E}templates/back_hdpi_de.webp`,width:6144,height:3200},5:{front:`${E}templates/front_hdpi_de.webp`,back:`${E}templates/back_hdpi_de.webp`,width:6144,height:3200},10:{front:`${E}templates/front_hdpi_de.webp`,back:`${E}templates/back_hdpi_de.webp`,width:6144,height:3200}}},C={front:{portrait:{x:768,y:490,radiusX:236,radiusY:258},namePlate:{x:768,y:848,fontSize:36,maxWidth:380,align:"center"}},back:{portrait:{x:0,y:0,radiusX:0,radiusY:0},namePlate:{x:768,y:832,fontSize:36,maxWidth:380,align:"center"},contactInfo:{x:380,y:500,fontSize:38,lineHeight:55,align:"center"},description:{x:1150,y:500,fontSize:38,maxWidth:480,lineHeight:42,align:"center"}}},T={front:{portrait:{x:3074,y:1530,radiusX:942,radiusY:1020},namePlate:{x:3072,y:2950,fontSize:144,maxWidth:1520,align:"center"}},back:{portrait:{x:0,y:0,radiusX:0,radiusY:0},namePlate:{x:3072,y:2930,fontSize:144,maxWidth:1520,align:"center"},contactInfo:{x:1520,y:1680,fontSize:160,lineHeight:280,align:"center"},description:{x:4600,y:1680,fontSize:145,maxWidth:2e3,lineHeight:210,align:"center"}}};function Y(e){return e==="de"?T:C}function V(e,t){return de[e][t]}const O=new Map;async function M(e){return O.has(e)?O.get(e):new Promise((t,n)=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{O.set(e,a),t(a)},a.onerror=n,a.src=e})}function G(e,t,n,a){e.drawImage(t,0,0,n,a)}function ue(e,t,n,a,o,i,c=1){e.save(),e.beginPath(),e.ellipse(n,a,o,i,0,0,Math.PI*2),e.closePath(),e.clip();const l=t.width/t.height,s=o/i,d=o*2,u=i*2;let g,h;l>s?(h=u,g=u*l):(g=d,h=d/l),g*=c,h*=c;const b=n-g/2,p=a-h/2;e.drawImage(t,b,p,g,h),e.restore()}function Z(e,t,n,a="#2a3a2a"){e.save(),e.font=`${n.fontSize}px "Times New Roman", serif`,e.textAlign=n.align||"center",e.textBaseline="middle",e.fillStyle=a,n.maxWidth?e.fillText(t,n.x,n.y,n.maxWidth):e.fillText(t,n.x,n.y),e.restore()}function me(e,t,n,a="#2a3a2a"){e.save(),e.font=`${n.fontSize}px "Times New Roman", serif`,e.textAlign=n.align||"center",e.textBaseline="top",e.fillStyle=a;const o=n.maxWidth||400,i=n.lineHeight||n.fontSize*1.4,c=t.split(" "),l=[];let s="";for(const g of c){const h=s?`${s} ${g}`:g;e.measureText(h).width>o&&s?(l.push(s),s=g):s=h}s&&l.push(s);const d=l.length*i;let u=n.y-d/2;for(const g of l)e.fillText(g,n.x,u),u+=i;e.restore()}function pe(e,t,n,a,o,i="#2a3a2a"){e.save(),e.font=`${o.fontSize}px "Times New Roman", serif`,e.textAlign=o.align||"center",e.textBaseline="middle",e.fillStyle=i;const c=o.lineHeight||o.fontSize*1.8,l=[t,n,a].filter(Boolean),s=(l.length-1)*c;let d=o.y-s/2;for(const u of l)u&&(e.fillText(u,o.x,d),d+=c);e.restore()}async function X(e,t,n,a,o,i,c,l=1){const s=e.getContext("2d");if(!s)return;e.width=i,e.height=c,s.clearRect(0,0,i,c);const d=await M(t);if(G(s,d,i,c),n)try{const u=await M(n);ue(s,u,o.portrait.x,o.portrait.y,o.portrait.radiusX,o.portrait.radiusY,l)}catch(u){console.error("Failed to load portrait:",u)}a&&Z(s,a,o.namePlate)}async function J(e,t,n,a,o,i,c,l,s){const d=e.getContext("2d");if(!d)return;e.width=l,e.height=s,d.clearRect(0,0,l,s);const u=await M(t);G(d,u,l,s),c.contactInfo&&(n||a||o)&&pe(d,n,a,o,c.contactInfo),c.description&&i&&me(d,i,c.description),n&&Z(d,n,c.namePlate)}function Ye(){const e=f(w=>w.voucherConfig.language),t=f(w=>w.voucherConfig.hours),n=f(w=>w.voucherConfig.description),a=f(w=>w.personalInfo),o=f(w=>w.portrait),i=f(w=>w.currentSide),c=f(w=>w.flipSide),l=R(e),s=v.useRef(null),d=v.useRef(null),u=v.useRef(null),[g,h]=v.useState(!1),b=V(e,t),p=Y(e),S=o.useEnhanced&&o.enhanced?o.enhanced:o.original,I=q(e,t,n);v.useEffect(()=>{s.current&&X(s.current,b.front,S,a.name,p.front,b.width,b.height,o.zoom)},[b,S,a.name,p,o.zoom]),v.useEffect(()=>{d.current&&J(d.current,b.back,a.name,a.email,a.phone,I,p.back,b.width,b.height)},[b,a,I,p]);const k=()=>{h(!0),setTimeout(()=>{c(),h(!1)},150)},N=b.width/b.height;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"tabs tabs-boxed bg-base-200",children:[r.jsx("button",{className:`tab ${i==="front"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>i!=="front"&&k(),children:l.preview.front}),r.jsx("button",{className:`tab ${i==="back"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>i!=="back"&&k(),children:l.preview.back})]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:k,children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),l.preview.flip]})]}),r.jsxs("div",{ref:u,className:"relative w-full overflow-hidden shadow-lg",style:{aspectRatio:N},children:[r.jsx("canvas",{ref:s,className:`absolute inset-0 w-full h-full transition-all duration-300 ${i==="front"?g?"opacity-0 scale-95":"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"}`}),r.jsx("canvas",{ref:d,className:`absolute inset-0 w-full h-full transition-all duration-300 ${i==="back"?g?"opacity-0 scale-95":"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"}`})]})]})}function Ve(){const e=v.useRef(null),t=v.useRef(null);return{frontCanvasRef:e,backCanvasRef:t}}async function he(e){const{frontTemplateSrc:t,backTemplateSrc:n,templateWidth:a,templateHeight:o,layout:i,portrait:c,portraitZoom:l=1,name:s,email:d,phone:u,description:g}=e,h=document.createElement("canvas"),b=document.createElement("canvas");await Promise.all([X(h,t,c,s,i.front,a,o,l),J(b,n,s,d,u,g,i.back,a,o)]);const p=new Te({orientation:"landscape",unit:"mm",format:"a4"}),S=297,I=210,k=10,N=a/o;let w=S-k*2,j=w/N;j>I-k*2&&(j=I-k*2,w=j*N);const P=(S-w)/2,D=(I-j)/2,A=h.toDataURL("image/jpeg",.95);p.addImage(A,"JPEG",P,D,w,j),p.addPage();const L=b.toDataURL("image/jpeg",.95);return p.addImage(L,"JPEG",P,D,w,j),p.output("blob")}function ge(e,t){const n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}async function fe(e){const t=await he(e);ge(t,e.filename)}function Ge(){const e=f(p=>p.voucherConfig.language),t=f(p=>p.voucherConfig.hours),n=f(p=>p.voucherConfig.description),a=f(p=>p.personalInfo),o=f(p=>p.portrait),i=f(p=>p.isExporting),c=f(p=>p.setIsExporting),l=R(e),s=V(e,t),d=Y(e),u=o.useEnhanced&&o.enhanced?o.enhanced:o.original,g=q(e,t,n),h=a.name.trim().length>0&&a.email.trim().length>0&&a.phone.trim().length>0&&o.original!==null,b=async()=>{if(!(!h||i)){c(!0);try{const p=`zeitgutschein-${t}h-${a.name.replace(/\s+/g,"-").toLowerCase()}.pdf`;await fe({frontTemplateSrc:s.front,backTemplateSrc:s.back,templateWidth:s.width,templateHeight:s.height,layout:d,portrait:u,portraitZoom:o.zoom,name:a.name,email:a.email,phone:a.phone,description:g,filename:p})}catch(p){console.error("PDF export failed:",p)}finally{c(!1)}}};return r.jsx("button",{className:`btn btn-primary flex-1 ${i?"loading":""}`,onClick:b,disabled:!h||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"loading loading-spinner loading-sm"}),l.export.exporting]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),l.export.button]})})}function be(){const e=f(a=>a.voucherConfig.language),t=f(a=>a.setLanguage),n=a=>{t(a)};return r.jsxs("div",{className:"join",children:[r.jsx("button",{className:`join-item btn btn-sm ${e==="de"?"btn-active btn-primary":"btn-ghost"}`,onClick:()=>n("de"),children:"DE"}),r.jsx("button",{className:`join-item btn btn-sm ${e==="en"?"btn-active btn-primary":"btn-ghost"}`,onClick:()=>n("en"),children:"EN"})]})}function Ze(){const e=f(n=>n.voucherConfig.language),t=R(e);return r.jsxs("div",{className:"navbar bg-currency-green text-currency-cream shadow-lg",children:[r.jsx("div",{className:"navbar-start",children:r.jsx("a",{className:"btn btn-ghost text-xl font-currency font-bold",children:t.header.title})}),r.jsx("div",{className:"navbar-center hidden sm:flex",children:r.jsx("span",{className:"text-sm opacity-80",children:t.header.subtitle})}),r.jsx("div",{className:"navbar-end",children:r.jsx(be,{})})]})}const z="/",Xe={id:"time-voucher-classic-de",name:"Zeitgutschein Classic",type:"time-voucher",category:"classic",images:{front:`${z}templates/front_hdpi_de.jpg`,back:`${z}templates/back_hdpi_de.jpg`,width:6144,height:4096},fields:[{id:"name",type:"text",label:{de:"Name",en:"Name"},required:!0,validation:{minLength:1,maxLength:50}},{id:"hours",type:"select",label:{de:"Stunden",en:"Hours"},required:!0,options:["1","5","10"]},{id:"portrait",type:"image",label:{de:"Portrait",en:"Portrait"},required:!1},{id:"email",type:"text",label:{de:"E-Mail",en:"Email"},required:!1},{id:"phone",type:"text",label:{de:"Telefon",en:"Phone"},required:!1},{id:"description",type:"textarea",label:{de:"Beschreibung",en:"Description"},required:!1,validation:{maxLength:200}}],layout:{front:{portrait:T.front.portrait,name:T.front.namePlate},back:{name:T.back.namePlate,contactInfo:T.back.contactInfo,description:T.back.description}},languages:["de"]},Je={id:"time-voucher-classic-en",name:"Time Voucher Classic",type:"time-voucher",category:"classic",images:{front:`${z}templates/front_ldpi_en.png`,back:`${z}templates/back_ldpi_en.png`,width:1536,height:1024},fields:[{id:"name",type:"text",label:{de:"Name",en:"Name"},required:!0,validation:{minLength:1,maxLength:50}},{id:"hours",type:"select",label:{de:"Stunden",en:"Hours"},required:!0,options:["1","5","10"]},{id:"portrait",type:"image",label:{de:"Portrait",en:"Portrait"},required:!1},{id:"email",type:"text",label:{de:"E-Mail",en:"Email"},required:!1},{id:"phone",type:"text",label:{de:"Telefon",en:"Phone"},required:!1},{id:"description",type:"textarea",label:{de:"Beschreibung",en:"Description"},required:!1,validation:{maxLength:200}}],layout:{front:{portrait:C.front.portrait,name:C.front.namePlate},back:{name:C.back.namePlate,contactInfo:C.back.contactInfo,description:C.back.description}},languages:["en"]},ae=[Xe,Je],ve={async listTemplates(e){let t=[...ae];return e!=null&&e.type&&(t=t.filter(n=>n.type===e.type)),e!=null&&e.category&&(t=t.filter(n=>n.category===e.category)),e!=null&&e.language&&(t=t.filter(n=>n.languages.includes(e.language))),t},async getTemplate(e){const t=ae.find(n=>n.id===e);if(!t)throw new Error(`Template not found: ${e}`);return t}};function Qe(e){return e==="de"?"time-voucher-classic-de":"time-voucher-classic-en"}let H=ve;function et(e){H=e}function tt(){return H}async function nt(e){return H.listTemplates(e)}async function at(e){return H.getTemplate(e)}exports.ApiKeyModal=ce;exports.BillPreview=Ye;exports.ExportButton=Ge;exports.Header=Ze;exports.LAYOUT_HDPI=T;exports.LAYOUT_LDPI=C;exports.LanguageToggle=be;exports.PersonalInfoForm=_e;exports.PortraitUpload=We;exports.TEMPLATES=de;exports.VoucherConfig=qe;exports.applyEngravingEffect=re;exports.downloadBlob=ge;exports.drawContactInfo=pe;exports.drawMultilineText=me;exports.drawOvalPortrait=ue;exports.drawTemplate=G;exports.drawText=Z;exports.enhancePortrait=Ke;exports.exportBillAsPDF=fe;exports.formatDescription=q;exports.generateBillPDF=he;exports.getApiKey=F;exports.getDefaultTemplateId=Qe;exports.getLayout=Y;exports.getRemoveBackgroundEndpoint=Ue;exports.getTemplate=V;exports.getTemplateById=at;exports.getTemplateProvider=tt;exports.hasApiKey=W;exports.hasCustomEndpoint=Me;exports.listTemplates=nt;exports.loadImage=M;exports.removeBackground=le;exports.renderBackSide=J;exports.renderFrontSide=X;exports.setApiKey=se;exports.setRemoveBackgroundEndpoint=$e;exports.setTemplateProvider=et;exports.staticTemplateProvider=ve;exports.t=R;exports.useBillCanvasRefs=Ve;exports.useBillStore=f;
package/dist/index.d.ts CHANGED
@@ -393,7 +393,16 @@ persist: {
393
393
  setOptions: (options: Partial<PersistOptions<BillState & BillActions, {
394
394
  personalInfo: PersonalInfo;
395
395
  voucherConfig: VoucherConfigType;
396
- portrait: PortraitState;
396
+ portrait: {
397
+ original: null;
398
+ enhanced: null;
399
+ useEnhanced: boolean;
400
+ zoom: number;
401
+ rawImage: null;
402
+ bgRemovedImage: null;
403
+ bgRemoved: boolean;
404
+ engravingIntensity: number;
405
+ };
397
406
  }, unknown>>) => void;
398
407
  clearStorage: () => void;
399
408
  rehydrate: () => Promise<void> | void;
@@ -403,7 +412,16 @@ onFinishHydration: (fn: (state: BillState & BillActions) => void) => () => void;
403
412
  getOptions: () => Partial<PersistOptions<BillState & BillActions, {
404
413
  personalInfo: PersonalInfo;
405
414
  voucherConfig: VoucherConfigType;
406
- portrait: PortraitState;
415
+ portrait: {
416
+ original: null;
417
+ enhanced: null;
418
+ useEnhanced: boolean;
419
+ zoom: number;
420
+ rawImage: null;
421
+ bgRemovedImage: null;
422
+ bgRemoved: boolean;
423
+ engravingIntensity: number;
424
+ };
407
425
  }, unknown>>;
408
426
  };
409
427
  }>;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { jsxs as u, jsx as s, Fragment as K } from "react/jsx-runtime";
2
- import { create as ve } from "zustand";
3
- import { persist as we } from "zustand/middleware";
4
- import { useState as A, useCallback as T, useRef as L, useEffect as O } from "react";
5
- import ye from "jspdf";
1
+ import { jsxs as u, jsx as s, Fragment as Y } from "react/jsx-runtime";
2
+ import { create as we } from "zustand";
3
+ import { persist as ye } from "zustand/middleware";
4
+ import { useState as R, useEffect as H, useCallback as C, useRef as A } from "react";
5
+ import Ie from "jspdf";
6
6
  const X = {
7
7
  personalInfo: {
8
8
  name: "",
@@ -27,8 +27,8 @@ const X = {
27
27
  currentSide: "front",
28
28
  isEnhancing: !1,
29
29
  isExporting: !1
30
- }, v = ve()(
31
- we(
30
+ }, b = we()(
31
+ ye(
32
32
  (e) => ({
33
33
  ...X,
34
34
  setPersonalInfo: (t) => e((n) => ({
@@ -104,7 +104,22 @@ const X = {
104
104
  partialize: (e) => ({
105
105
  personalInfo: e.personalInfo,
106
106
  voucherConfig: e.voucherConfig,
107
- portrait: e.portrait
107
+ // Only persist small settings, NOT image data (too large for localStorage)
108
+ portrait: {
109
+ original: null,
110
+ // Don't persist - too large
111
+ enhanced: null,
112
+ // Don't persist - too large
113
+ useEnhanced: e.portrait.useEnhanced,
114
+ zoom: e.portrait.zoom,
115
+ rawImage: null,
116
+ // Don't persist - too large
117
+ bgRemovedImage: null,
118
+ // Don't persist - too large
119
+ bgRemoved: !1,
120
+ // Reset to false since we don't persist the image
121
+ engravingIntensity: e.portrait.engravingIntensity
122
+ }
108
123
  })
109
124
  }
110
125
  )
@@ -155,7 +170,7 @@ const X = {
155
170
  bill: {
156
171
  descriptionText: "Für diesen Schein erhältst du {hours} {hourLabel} meiner Zeit oder ein gleichwertiges Dankeschön"
157
172
  }
158
- }, Ie = {
173
+ }, ke = {
159
174
  header: {
160
175
  title: "Money Generator",
161
176
  subtitle: "Create your personal time voucher"
@@ -202,18 +217,18 @@ const X = {
202
217
  bill: {
203
218
  descriptionText: "This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"
204
219
  }
205
- }, ke = { de: xe, en: Ie };
206
- function M(e) {
207
- return ke[e];
220
+ }, Ee = { de: xe, en: ke };
221
+ function z(e) {
222
+ return Ee[e];
208
223
  }
209
- function ee(e, t, n) {
224
+ function te(e, t, n) {
210
225
  if (n && n.trim())
211
226
  return n;
212
- const a = M(e), r = t === 1 ? a.form.voucher.hourLabel : a.form.voucher.hoursLabel;
227
+ const a = z(e), r = t === 1 ? a.form.voucher.hourLabel : a.form.voucher.hoursLabel;
213
228
  return a.bill.descriptionText.replace("{hours}", t.toString()).replace("{hourLabel}", r);
214
229
  }
215
230
  function Xe() {
216
- const e = v((r) => r.voucherConfig.language), t = v((r) => r.personalInfo), n = v((r) => r.setPersonalInfo), a = M(e);
231
+ const e = b((r) => r.voucherConfig.language), t = b((r) => r.personalInfo), n = b((r) => r.setPersonalInfo), a = z(e);
217
232
  return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
218
233
  /* @__PURE__ */ u("div", { className: "form-control", children: [
219
234
  /* @__PURE__ */ s("label", { className: "label", children: /* @__PURE__ */ s("span", { className: "label-text font-medium", children: a.form.personalInfo.name }) }),
@@ -268,18 +283,18 @@ async function Pe(e, t = 0.5) {
268
283
  o.width = r.width, o.height = r.height, c.drawImage(r, 0, 0);
269
284
  const l = c.getImageData(0, 0, o.width, o.height), i = l.data, d = 1 + t * 0.8;
270
285
  for (let h = 0; h < i.length; h += 4) {
271
- const f = i[h], g = i[h + 1], b = i[h + 2];
286
+ const f = i[h], g = i[h + 1], v = i[h + 2];
272
287
  if (i[h + 3] === 0) continue;
273
- let x = (((0.299 * f + 0.587 * g + 0.114 * b) / 255 - 0.5) * d + 0.5) * 255;
288
+ let x = (((0.299 * f + 0.587 * g + 0.114 * v) / 255 - 0.5) * d + 0.5) * 255;
274
289
  x = Math.max(0, Math.min(255, x));
275
- const I = Math.min(255, x * 0.9 + 25), R = Math.min(255, x * 0.78 + 15), y = Math.min(255, x * 0.55 + 5);
276
- i[h] = Math.round(f * (1 - t) + I * t), i[h + 1] = Math.round(g * (1 - t) + R * t), i[h + 2] = Math.round(b * (1 - t) + y * t);
290
+ const k = Math.min(255, x * 0.9 + 25), T = Math.min(255, x * 0.78 + 15), y = Math.min(255, x * 0.55 + 5);
291
+ i[h] = Math.round(f * (1 - t) + k * t), i[h + 1] = Math.round(g * (1 - t) + T * t), i[h + 2] = Math.round(v * (1 - t) + y * t);
277
292
  }
278
293
  c.putImageData(l, 0, 0), n(o.toDataURL("image/png"));
279
294
  }, r.onerror = () => a(new Error("Failed to load image")), r.src = e;
280
295
  });
281
296
  }
282
- const Ee = "https://api.stability.ai/v1/generation", Ne = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", te = "stability_api_key";
297
+ const Ne = "https://api.stability.ai/v1/generation", Se = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", ne = "stability_api_key";
283
298
  let $ = null;
284
299
  function Je(e) {
285
300
  $ = e;
@@ -290,7 +305,7 @@ function Qe() {
290
305
  function et() {
291
306
  return $ !== null;
292
307
  }
293
- const Se = {
308
+ const Ce = {
294
309
  vintage: "portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",
295
310
  engraved: "portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",
296
311
  currency: "portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"
@@ -305,7 +320,7 @@ const Se = {
305
320
  { width: 832, height: 1216 },
306
321
  { width: 896, height: 1152 }
307
322
  ];
308
- function Ce(e, t) {
323
+ function Te(e, t) {
309
324
  const n = e / t;
310
325
  let a = J[0], r = 1 / 0;
311
326
  for (const o of J) {
@@ -314,11 +329,11 @@ function Ce(e, t) {
314
329
  }
315
330
  return a;
316
331
  }
317
- function Te(e) {
332
+ function Re(e) {
318
333
  return new Promise((t, n) => {
319
334
  const a = new Image();
320
335
  a.onload = () => {
321
- const r = Ce(a.width, a.height), o = document.createElement("canvas");
336
+ const r = Te(a.width, a.height), o = document.createElement("canvas");
322
337
  o.width = r.width, o.height = r.height;
323
338
  const c = o.getContext("2d");
324
339
  if (!c) {
@@ -331,31 +346,31 @@ function Te(e) {
331
346
  }, a.onerror = () => n(new Error("Failed to load image")), a.src = e;
332
347
  });
333
348
  }
334
- function ne(e) {
349
+ function ae(e) {
335
350
  var c;
336
351
  const t = e.split(","), n = ((c = t[0].match(/:(.*?);/)) == null ? void 0 : c[1]) || "image/png", a = atob(t[1]), r = a.length, o = new Uint8Array(r);
337
352
  for (let l = 0; l < r; l++)
338
353
  o[l] = a.charCodeAt(l);
339
354
  return new Blob([o], { type: n });
340
355
  }
341
- function q() {
356
+ function V() {
342
357
  var t;
343
358
  const e = typeof import.meta < "u" && "sk-7mEKklrqaltdtgbX0VoZbkA8E1cl939Spn75jSIYRvp1BW0b" || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_STABILITY_API_KEY);
344
- return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(te) : null;
359
+ return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(ne) : null;
345
360
  }
346
- function Re(e) {
347
- localStorage.setItem(te, e);
361
+ function Ae(e) {
362
+ localStorage.setItem(ne, e);
348
363
  }
349
- function Ae() {
350
- return $ ? !0 : q() !== null;
364
+ function Q() {
365
+ return $ ? !0 : V() !== null;
351
366
  }
352
367
  async function tt(e) {
353
- const t = q();
368
+ const t = V();
354
369
  if (!t)
355
370
  throw new Error("No Stability AI API key configured");
356
- const { imageDataUrl: n, style: a, strength: r = 0.35 } = e, o = await Te(n), c = ne(o), l = new FormData();
357
- l.append("init_image", c, "portrait.png"), l.append("init_image_mode", "IMAGE_STRENGTH"), l.append("image_strength", String(1 - r)), l.append("text_prompts[0][text]", Se[a]), l.append("text_prompts[0][weight]", "1"), l.append("cfg_scale", "7"), l.append("samples", "1"), l.append("steps", "30");
358
- const d = await fetch(`${Ee}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
371
+ const { imageDataUrl: n, style: a, strength: r = 0.35 } = e, o = await Re(n), c = ae(o), l = new FormData();
372
+ l.append("init_image", c, "portrait.png"), l.append("init_image_mode", "IMAGE_STRENGTH"), l.append("image_strength", String(1 - r)), l.append("text_prompts[0][text]", Ce[a]), l.append("text_prompts[0][weight]", "1"), l.append("cfg_scale", "7"), l.append("samples", "1"), l.append("steps", "30");
373
+ const d = await fetch(`${Ne}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
359
374
  method: "POST",
360
375
  headers: {
361
376
  Authorization: `Bearer ${t}`,
@@ -387,12 +402,12 @@ async function Le(e) {
387
402
  }
388
403
  return (await c.json()).imageDataUrl;
389
404
  }
390
- const t = q();
405
+ const t = V();
391
406
  if (!t)
392
407
  throw new Error("No Stability AI API key configured");
393
- const n = ne(e), a = new FormData();
408
+ const n = ae(e), a = new FormData();
394
409
  a.append("image", n, "image.png"), a.append("output_format", "png");
395
- const r = await fetch(Ne, {
410
+ const r = await fetch(Se, {
396
411
  method: "POST",
397
412
  headers: {
398
413
  Authorization: `Bearer ${t}`,
@@ -411,13 +426,17 @@ async function Le(e) {
411
426
  });
412
427
  }
413
428
  function De() {
414
- const [e, t] = A(!1), [n, a] = A(!1), [r, o] = A(null), [c, l] = A(Ae()), i = T(() => o(null), []), d = T((g) => {
415
- Re(g), l(!0), o(null);
416
- }, []), h = T(
417
- async (g, b = 0.5) => {
429
+ const [e, t] = R(!1), [n, a] = R(!1), [r, o] = R(null), [c, l] = R(() => Q());
430
+ H(() => {
431
+ l(Q());
432
+ }, []);
433
+ const i = C(() => o(null), []), d = C((g) => {
434
+ Ae(g), l(!0), o(null);
435
+ }, []), h = C(
436
+ async (g, v = 0.5) => {
418
437
  t(!0), o(null);
419
438
  try {
420
- return await Pe(g, b);
439
+ return await Pe(g, v);
421
440
  } catch (p) {
422
441
  const S = p instanceof Error ? p.message : "Enhancement failed";
423
442
  throw o(S), p;
@@ -426,14 +445,14 @@ function De() {
426
445
  }
427
446
  },
428
447
  []
429
- ), f = T(
448
+ ), f = C(
430
449
  async (g) => {
431
450
  a(!0), o(null);
432
451
  try {
433
452
  return await Le(g);
434
- } catch (b) {
435
- const p = b instanceof Error ? b.message : "Background removal failed";
436
- throw o(p), b;
453
+ } catch (v) {
454
+ const p = v instanceof Error ? v.message : "Background removal failed";
455
+ throw o(p), v;
437
456
  } finally {
438
457
  a(!1);
439
458
  }
@@ -452,7 +471,7 @@ function De() {
452
471
  };
453
472
  }
454
473
  function _e({ isOpen: e, onClose: t, onSubmit: n }) {
455
- const a = v((d) => d.voucherConfig.language), [r, o] = A("");
474
+ const a = b((d) => d.voucherConfig.language), [r, o] = R("");
456
475
  if (!e) return null;
457
476
  const c = (d) => {
458
477
  d.preventDefault(), r.trim() && (n(r.trim()), o(""), t());
@@ -503,90 +522,96 @@ function _e({ isOpen: e, onClose: t, onSubmit: n }) {
503
522
  ] });
504
523
  }
505
524
  function nt() {
506
- const e = v((m) => m.voucherConfig.language), t = v((m) => m.portrait), n = v((m) => m.setPortrait), a = v((m) => m.setPortraitZoom), r = v((m) => m.setPortraitRawImage), o = v((m) => m.setPortraitBgRemoved), c = v((m) => m.setPortraitEngravingIntensity), { enhance: l, removeBg: i, isEnhancing: d, isRemovingBg: h, error: f, hasKey: g, setApiKey: b } = De(), p = M(e), S = L(null), [x, I] = A(!1), [R, y] = A(!1), P = L(null), k = t.rawImage, z = t.bgRemovedImage, D = t.bgRemoved, C = t.engravingIntensity;
507
- O(() => () => {
525
+ const e = b((m) => m.voucherConfig.language), t = b((m) => m.portrait), n = b((m) => m.setPortrait), a = b((m) => m.setPortraitZoom), r = b((m) => m.setPortraitRawImage), o = b((m) => m.setPortraitBgRemoved), c = b((m) => m.setPortraitEngravingIntensity), { enhance: l, removeBg: i, isEnhancing: d, isRemovingBg: h, error: f, hasKey: g, setApiKey: v } = De(), p = z(e), S = A(null), [x, k] = R(!1), [T, y] = R(!1), P = A(null), E = t.rawImage, M = t.bgRemovedImage, L = t.bgRemoved, D = t.engravingIntensity;
526
+ H(() => {
527
+ t.original && !t.rawImage && r(t.original);
528
+ }, [t.original, t.rawImage, r]), H(() => () => {
508
529
  P.current && clearTimeout(P.current);
509
530
  }, []);
510
- const W = T(
531
+ const K = C(
511
532
  async (m) => {
512
533
  if (!m.type.startsWith("image/"))
513
534
  return;
514
535
  const w = new FileReader();
515
- w.onload = async (E) => {
536
+ w.onload = async (I) => {
516
537
  var Z;
517
- const G = (Z = E.target) == null ? void 0 : Z.result;
518
- r(G), n(G), o(!1, null), c(0);
538
+ const F = (Z = I.target) == null ? void 0 : Z.result;
539
+ r(F), n(F), o(!1, null), c(0);
519
540
  }, w.readAsDataURL(m);
520
541
  },
521
542
  [n, r, o, c]
522
- ), ce = T(
543
+ ), de = C(
523
544
  (m) => {
524
- m.preventDefault(), I(!1);
545
+ m.preventDefault(), k(!1);
525
546
  const w = m.dataTransfer.files[0];
526
- w && W(w);
547
+ w && K(w);
527
548
  },
528
- [W]
529
- ), de = T((m) => {
530
- m.preventDefault(), I(!0);
531
- }, []), he = T((m) => {
532
- m.preventDefault(), I(!1);
533
- }, []), me = () => {
549
+ [K]
550
+ ), he = C((m) => {
551
+ m.preventDefault(), k(!0);
552
+ }, []), me = C((m) => {
553
+ m.preventDefault(), k(!1);
554
+ }, []), pe = () => {
534
555
  var m;
535
556
  (m = S.current) == null || m.click();
536
- }, pe = (m) => {
537
- var E;
538
- const w = (E = m.target.files) == null ? void 0 : E[0];
539
- w && W(w);
540
- }, H = T(async (m, w) => {
557
+ }, ue = (m) => {
558
+ var I;
559
+ const w = (I = m.target.files) == null ? void 0 : I[0];
560
+ w && K(w);
561
+ }, U = C(async (m, w) => {
541
562
  try {
542
563
  return await l(m, w);
543
- } catch (E) {
544
- return console.error("Enhancement failed:", E), m;
564
+ } catch (I) {
565
+ return console.error("Enhancement failed:", I), m;
545
566
  }
546
- }, [l]), V = T(async (m) => {
567
+ }, [l]), G = C(async (m) => {
547
568
  try {
548
569
  const w = await i(m);
549
570
  return o(!0, w), w;
550
571
  } catch (w) {
551
572
  return console.error("Background removal failed:", w), m;
552
573
  }
553
- }, [i, o]), ue = async () => {
554
- if (!k) return;
555
- if (!D && !g) {
574
+ }, [i, o]), ge = async () => {
575
+ if (!E) return;
576
+ if (!L && !g) {
556
577
  y(!0);
557
578
  return;
558
579
  }
559
- if (!D) {
560
- const w = await V(k);
561
- if (C > 0) {
562
- const E = await H(w, C);
563
- n(E);
580
+ if (!L) {
581
+ const w = await G(E), I = b.getState().portrait.engravingIntensity;
582
+ if (I > 0) {
583
+ const F = await U(w, I);
584
+ n(F);
564
585
  } else
565
586
  n(w);
566
- } else if (o(!1, null), C > 0) {
567
- const w = await H(k, C);
568
- n(w);
569
- } else
570
- n(k);
571
- }, ge = (m) => {
572
- c(m), P.current && clearTimeout(P.current), k && (P.current = setTimeout(async () => {
573
- const w = D && z ? z : k;
587
+ } else {
588
+ o(!1, null);
589
+ const w = b.getState().portrait.engravingIntensity;
590
+ if (w > 0) {
591
+ const I = await U(E, w);
592
+ n(I);
593
+ } else
594
+ n(E);
595
+ }
596
+ }, fe = (m) => {
597
+ c(m), P.current && clearTimeout(P.current), E && (P.current = setTimeout(async () => {
598
+ const w = L && M ? M : E;
574
599
  if (m === 0)
575
600
  n(w);
576
601
  else {
577
- const E = await H(w, m);
578
- n(E);
602
+ const I = await U(w, m);
603
+ n(I);
579
604
  }
580
605
  }, 150));
581
- }, fe = async (m) => {
582
- if (b(m), !k) return;
583
- const w = await V(k);
584
- if (C > 0) {
585
- const E = await H(w, C);
586
- n(E);
606
+ }, be = async (m) => {
607
+ if (v(m), !E) return;
608
+ const w = await G(E);
609
+ if (D > 0) {
610
+ const I = await U(w, D);
611
+ n(I);
587
612
  } else
588
613
  n(w);
589
- }, be = () => {
614
+ }, ve = () => {
590
615
  n(null), r(null), o(!1, null), c(0);
591
616
  };
592
617
  return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
@@ -605,7 +630,7 @@ function nt() {
605
630
  "button",
606
631
  {
607
632
  className: "btn btn-circle btn-xs btn-error absolute -top-1 -right-1",
608
- onClick: be,
633
+ onClick: ve,
609
634
  children: /* @__PURE__ */ s(
610
635
  "svg",
611
636
  {
@@ -652,11 +677,11 @@ function nt() {
652
677
  /* @__PURE__ */ u("div", { className: "form-control w-full max-w-xs", children: [
653
678
  /* @__PURE__ */ u("label", { className: "label", children: [
654
679
  /* @__PURE__ */ u("span", { className: "label-text flex items-center gap-2", children: [
655
- e === "de" ? "Gravur-Effekt" : "Engraving effect",
680
+ e === "de" ? "Sepia-Effekt" : "Sepia effect",
656
681
  d && /* @__PURE__ */ s("span", { className: "loading loading-spinner loading-xs" })
657
682
  ] }),
658
683
  /* @__PURE__ */ u("span", { className: "label-text-alt", children: [
659
- Math.round(C * 100),
684
+ Math.round(D * 100),
660
685
  "%"
661
686
  ] })
662
687
  ] }),
@@ -667,10 +692,10 @@ function nt() {
667
692
  min: "0",
668
693
  max: "1",
669
694
  step: "0.05",
670
- value: C,
671
- onChange: (m) => ge(parseFloat(m.target.value)),
695
+ value: D,
696
+ onChange: (m) => fe(parseFloat(m.target.value)),
672
697
  className: "range range-secondary range-sm",
673
- disabled: d || !k
698
+ disabled: d || !E
674
699
  }
675
700
  )
676
701
  ] }),
@@ -680,13 +705,13 @@ function nt() {
680
705
  {
681
706
  type: "checkbox",
682
707
  className: `toggle toggle-primary ${h ? "opacity-50" : ""}`,
683
- checked: D,
684
- onChange: ue,
685
- disabled: h || !k
708
+ checked: L,
709
+ onChange: ge,
710
+ disabled: h || !E
686
711
  }
687
712
  ),
688
713
  /* @__PURE__ */ u("span", { className: "label-text flex items-center gap-2", children: [
689
- h ? /* @__PURE__ */ u(K, { children: [
714
+ h ? /* @__PURE__ */ u(Y, { children: [
690
715
  /* @__PURE__ */ s("span", { className: "loading loading-spinner loading-xs" }),
691
716
  e === "de" ? "Hintergrund wird entfernt..." : "Removing background..."
692
717
  ] }) : e === "de" ? "Hintergrund entfernen" : "Remove background",
@@ -701,10 +726,10 @@ function nt() {
701
726
  "div",
702
727
  {
703
728
  className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${h ? "border-primary bg-primary/10 pointer-events-none" : x ? "border-primary bg-primary/10" : "border-base-300 hover:border-primary hover:bg-base-200"}`,
704
- onDrop: ce,
705
- onDragOver: de,
706
- onDragLeave: he,
707
- onClick: me,
729
+ onDrop: de,
730
+ onDragOver: he,
731
+ onDragLeave: me,
732
+ onClick: pe,
708
733
  children: [
709
734
  /* @__PURE__ */ s(
710
735
  "input",
@@ -713,7 +738,7 @@ function nt() {
713
738
  type: "file",
714
739
  accept: "image/*",
715
740
  className: "hidden",
716
- onChange: pe
741
+ onChange: ue
717
742
  }
718
743
  ),
719
744
  h ? /* @__PURE__ */ u("div", { className: "flex flex-col items-center gap-2", children: [
@@ -748,9 +773,9 @@ function nt() {
748
773
  /* @__PURE__ */ s(
749
774
  _e,
750
775
  {
751
- isOpen: R,
776
+ isOpen: T,
752
777
  onClose: () => y(!1),
753
- onSubmit: fe
778
+ onSubmit: be
754
779
  }
755
780
  )
756
781
  ] });
@@ -892,22 +917,22 @@ const N = typeof import.meta < "u" && "/" || "/", Be = {
892
917
  }
893
918
  }
894
919
  };
895
- function ae(e) {
920
+ function re(e) {
896
921
  return e === "de" ? B : _;
897
922
  }
898
- function re(e, t) {
923
+ function oe(e, t) {
899
924
  return Be[e][t];
900
925
  }
901
- const j = /* @__PURE__ */ new Map();
902
- async function Y(e) {
903
- return j.has(e) ? j.get(e) : new Promise((t, n) => {
926
+ const O = /* @__PURE__ */ new Map();
927
+ async function q(e) {
928
+ return O.has(e) ? O.get(e) : new Promise((t, n) => {
904
929
  const a = new Image();
905
930
  a.crossOrigin = "anonymous", a.onload = () => {
906
- j.set(e, a), t(a);
931
+ O.set(e, a), t(a);
907
932
  }, a.onerror = n, a.src = e;
908
933
  });
909
934
  }
910
- function oe(e, t, n, a) {
935
+ function ie(e, t, n, a) {
911
936
  e.drawImage(t, 0, 0, n, a);
912
937
  }
913
938
  function $e(e, t, n, a, r, o, c = 1) {
@@ -915,13 +940,13 @@ function $e(e, t, n, a, r, o, c = 1) {
915
940
  const l = t.width / t.height, i = r / o, d = r * 2, h = o * 2;
916
941
  let f, g;
917
942
  l > i ? (g = h, f = h * l) : (f = d, g = d / l), f *= c, g *= c;
918
- const b = n - f / 2, p = a - g / 2;
919
- e.drawImage(t, b, p, f, g), e.restore();
943
+ const v = n - f / 2, p = a - g / 2;
944
+ e.drawImage(t, v, p, f, g), e.restore();
920
945
  }
921
- function ie(e, t, n, a = "#2a3a2a") {
946
+ function se(e, t, n, a = "#2a3a2a") {
922
947
  e.save(), e.font = `${n.fontSize}px "Times New Roman", serif`, e.textAlign = n.align || "center", e.textBaseline = "middle", e.fillStyle = a, n.maxWidth ? e.fillText(t, n.x, n.y, n.maxWidth) : e.fillText(t, n.x, n.y), e.restore();
923
948
  }
924
- function Me(e, t, n, a = "#2a3a2a") {
949
+ function ze(e, t, n, a = "#2a3a2a") {
925
950
  e.save(), e.font = `${n.fontSize}px "Times New Roman", serif`, e.textAlign = n.align || "center", e.textBaseline = "top", e.fillStyle = a;
926
951
  const r = n.maxWidth || 400, o = n.lineHeight || n.fontSize * 1.4, c = t.split(" "), l = [];
927
952
  let i = "";
@@ -936,7 +961,7 @@ function Me(e, t, n, a = "#2a3a2a") {
936
961
  e.fillText(f, n.x, h), h += o;
937
962
  e.restore();
938
963
  }
939
- function ze(e, t, n, a, r, o = "#2a3a2a") {
964
+ function Me(e, t, n, a, r, o = "#2a3a2a") {
940
965
  e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle = o;
941
966
  const c = r.lineHeight || r.fontSize * 1.8, l = [t, n, a].filter(Boolean), i = (l.length - 1) * c;
942
967
  let d = r.y - i / 2;
@@ -944,14 +969,14 @@ function ze(e, t, n, a, r, o = "#2a3a2a") {
944
969
  h && (e.fillText(h, r.x, d), d += c);
945
970
  e.restore();
946
971
  }
947
- async function se(e, t, n, a, r, o, c, l = 1) {
972
+ async function le(e, t, n, a, r, o, c, l = 1) {
948
973
  const i = e.getContext("2d");
949
974
  if (!i) return;
950
975
  e.width = o, e.height = c, i.clearRect(0, 0, o, c);
951
- const d = await Y(t);
952
- if (oe(i, d, o, c), n)
976
+ const d = await q(t);
977
+ if (ie(i, d, o, c), n)
953
978
  try {
954
- const h = await Y(n);
979
+ const h = await q(n);
955
980
  $e(
956
981
  i,
957
982
  h,
@@ -964,46 +989,46 @@ async function se(e, t, n, a, r, o, c, l = 1) {
964
989
  } catch (h) {
965
990
  console.error("Failed to load portrait:", h);
966
991
  }
967
- a && ie(i, a, r.namePlate);
992
+ a && se(i, a, r.namePlate);
968
993
  }
969
- async function le(e, t, n, a, r, o, c, l, i) {
994
+ async function ce(e, t, n, a, r, o, c, l, i) {
970
995
  const d = e.getContext("2d");
971
996
  if (!d) return;
972
997
  e.width = l, e.height = i, d.clearRect(0, 0, l, i);
973
- const h = await Y(t);
974
- oe(d, h, l, i), c.contactInfo && (n || a || r) && ze(d, n, a, r, c.contactInfo), c.description && o && Me(d, o, c.description), n && ie(d, n, c.namePlate);
998
+ const h = await q(t);
999
+ ie(d, h, l, i), c.contactInfo && (n || a || r) && Me(d, n, a, r, c.contactInfo), c.description && o && ze(d, o, c.description), n && se(d, n, c.namePlate);
975
1000
  }
976
1001
  function rt() {
977
- const e = v((y) => y.voucherConfig.language), t = v((y) => y.voucherConfig.hours), n = v((y) => y.voucherConfig.description), a = v((y) => y.personalInfo), r = v((y) => y.portrait), o = v((y) => y.currentSide), c = v((y) => y.flipSide), l = M(e), i = L(null), d = L(null), h = L(null), [f, g] = A(!1), b = re(e, t), p = ae(e), S = r.useEnhanced && r.enhanced ? r.enhanced : r.original, x = ee(e, t, n);
978
- O(() => {
979
- i.current && se(
1002
+ const e = b((y) => y.voucherConfig.language), t = b((y) => y.voucherConfig.hours), n = b((y) => y.voucherConfig.description), a = b((y) => y.personalInfo), r = b((y) => y.portrait), o = b((y) => y.currentSide), c = b((y) => y.flipSide), l = z(e), i = A(null), d = A(null), h = A(null), [f, g] = R(!1), v = oe(e, t), p = re(e), S = r.useEnhanced && r.enhanced ? r.enhanced : r.original, x = te(e, t, n);
1003
+ H(() => {
1004
+ i.current && le(
980
1005
  i.current,
981
- b.front,
1006
+ v.front,
982
1007
  S,
983
1008
  a.name,
984
1009
  p.front,
985
- b.width,
986
- b.height,
1010
+ v.width,
1011
+ v.height,
987
1012
  r.zoom
988
1013
  );
989
- }, [b, S, a.name, p, r.zoom]), O(() => {
990
- d.current && le(
1014
+ }, [v, S, a.name, p, r.zoom]), H(() => {
1015
+ d.current && ce(
991
1016
  d.current,
992
- b.back,
1017
+ v.back,
993
1018
  a.name,
994
1019
  a.email,
995
1020
  a.phone,
996
1021
  x,
997
1022
  p.back,
998
- b.width,
999
- b.height
1023
+ v.width,
1024
+ v.height
1000
1025
  );
1001
- }, [b, a, x, p]);
1002
- const I = () => {
1026
+ }, [v, a, x, p]);
1027
+ const k = () => {
1003
1028
  g(!0), setTimeout(() => {
1004
1029
  c(), g(!1);
1005
1030
  }, 150);
1006
- }, R = b.width / b.height;
1031
+ }, T = v.width / v.height;
1007
1032
  return /* @__PURE__ */ u("div", { className: "space-y-4", children: [
1008
1033
  /* @__PURE__ */ u("div", { className: "flex justify-between items-center", children: [
1009
1034
  /* @__PURE__ */ u("div", { className: "tabs tabs-boxed bg-base-200", children: [
@@ -1011,7 +1036,7 @@ function rt() {
1011
1036
  "button",
1012
1037
  {
1013
1038
  className: `tab ${o === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
1014
- onClick: () => o !== "front" && I(),
1039
+ onClick: () => o !== "front" && k(),
1015
1040
  children: l.preview.front
1016
1041
  }
1017
1042
  ),
@@ -1019,12 +1044,12 @@ function rt() {
1019
1044
  "button",
1020
1045
  {
1021
1046
  className: `tab ${o === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
1022
- onClick: () => o !== "back" && I(),
1047
+ onClick: () => o !== "back" && k(),
1023
1048
  children: l.preview.back
1024
1049
  }
1025
1050
  )
1026
1051
  ] }),
1027
- /* @__PURE__ */ u("button", { className: "btn btn-ghost btn-sm", onClick: I, children: [
1052
+ /* @__PURE__ */ u("button", { className: "btn btn-ghost btn-sm", onClick: k, children: [
1028
1053
  /* @__PURE__ */ s(
1029
1054
  "svg",
1030
1055
  {
@@ -1052,7 +1077,7 @@ function rt() {
1052
1077
  {
1053
1078
  ref: h,
1054
1079
  className: "relative w-full overflow-hidden shadow-lg",
1055
- style: { aspectRatio: R },
1080
+ style: { aspectRatio: T },
1056
1081
  children: [
1057
1082
  /* @__PURE__ */ s(
1058
1083
  "canvas",
@@ -1074,7 +1099,7 @@ function rt() {
1074
1099
  ] });
1075
1100
  }
1076
1101
  function ot() {
1077
- const e = L(null), t = L(null);
1102
+ const e = A(null), t = A(null);
1078
1103
  return { frontCanvasRef: e, backCanvasRef: t };
1079
1104
  }
1080
1105
  async function He(e) {
@@ -1090,22 +1115,22 @@ async function He(e) {
1090
1115
  email: d,
1091
1116
  phone: h,
1092
1117
  description: f
1093
- } = e, g = document.createElement("canvas"), b = document.createElement("canvas");
1118
+ } = e, g = document.createElement("canvas"), v = document.createElement("canvas");
1094
1119
  await Promise.all([
1095
- se(g, t, c, i, o.front, a, r, l),
1096
- le(b, n, i, d, h, f, o.back, a, r)
1120
+ le(g, t, c, i, o.front, a, r, l),
1121
+ ce(v, n, i, d, h, f, o.back, a, r)
1097
1122
  ]);
1098
- const p = new ye({
1123
+ const p = new Ie({
1099
1124
  orientation: "landscape",
1100
1125
  unit: "mm",
1101
1126
  format: "a4"
1102
- }), S = 297, x = 210, I = 10, R = a / r;
1103
- let y = S - I * 2, P = y / R;
1104
- P > x - I * 2 && (P = x - I * 2, y = P * R);
1105
- const k = (S - y) / 2, z = (x - P) / 2, D = g.toDataURL("image/jpeg", 0.95);
1106
- p.addImage(D, "JPEG", k, z, y, P), p.addPage();
1107
- const C = b.toDataURL("image/jpeg", 0.95);
1108
- return p.addImage(C, "JPEG", k, z, y, P), p.output("blob");
1127
+ }), S = 297, x = 210, k = 10, T = a / r;
1128
+ let y = S - k * 2, P = y / T;
1129
+ P > x - k * 2 && (P = x - k * 2, y = P * T);
1130
+ const E = (S - y) / 2, M = (x - P) / 2, L = g.toDataURL("image/jpeg", 0.95);
1131
+ p.addImage(L, "JPEG", E, M, y, P), p.addPage();
1132
+ const D = v.toDataURL("image/jpeg", 0.95);
1133
+ return p.addImage(D, "JPEG", E, M, y, P), p.output("blob");
1109
1134
  }
1110
1135
  function Ue(e, t) {
1111
1136
  const n = URL.createObjectURL(e), a = document.createElement("a");
@@ -1116,7 +1141,7 @@ async function Fe(e) {
1116
1141
  Ue(t, e.filename);
1117
1142
  }
1118
1143
  function it() {
1119
- const e = v((p) => p.voucherConfig.language), t = v((p) => p.voucherConfig.hours), n = v((p) => p.voucherConfig.description), a = v((p) => p.personalInfo), r = v((p) => p.portrait), o = v((p) => p.isExporting), c = v((p) => p.setIsExporting), l = M(e), i = re(e, t), d = ae(e), h = r.useEnhanced && r.enhanced ? r.enhanced : r.original, f = ee(e, t, n), g = a.name.trim().length > 0 && a.email.trim().length > 0 && a.phone.trim().length > 0 && r.original !== null;
1144
+ const e = b((p) => p.voucherConfig.language), t = b((p) => p.voucherConfig.hours), n = b((p) => p.voucherConfig.description), a = b((p) => p.personalInfo), r = b((p) => p.portrait), o = b((p) => p.isExporting), c = b((p) => p.setIsExporting), l = z(e), i = oe(e, t), d = re(e), h = r.useEnhanced && r.enhanced ? r.enhanced : r.original, f = te(e, t, n), g = a.name.trim().length > 0 && a.email.trim().length > 0 && a.phone.trim().length > 0 && r.original !== null;
1120
1145
  return /* @__PURE__ */ s(
1121
1146
  "button",
1122
1147
  {
@@ -1148,10 +1173,10 @@ function it() {
1148
1173
  }
1149
1174
  },
1150
1175
  disabled: !g || o,
1151
- children: o ? /* @__PURE__ */ u(K, { children: [
1176
+ children: o ? /* @__PURE__ */ u(Y, { children: [
1152
1177
  /* @__PURE__ */ s("span", { className: "loading loading-spinner loading-sm" }),
1153
1178
  l.export.exporting
1154
- ] }) : /* @__PURE__ */ u(K, { children: [
1179
+ ] }) : /* @__PURE__ */ u(Y, { children: [
1155
1180
  /* @__PURE__ */ s(
1156
1181
  "svg",
1157
1182
  {
@@ -1177,7 +1202,7 @@ function it() {
1177
1202
  );
1178
1203
  }
1179
1204
  function We() {
1180
- const e = v((a) => a.voucherConfig.language), t = v((a) => a.setLanguage), n = (a) => {
1205
+ const e = b((a) => a.voucherConfig.language), t = b((a) => a.setLanguage), n = (a) => {
1181
1206
  t(a);
1182
1207
  };
1183
1208
  return /* @__PURE__ */ u("div", { className: "join", children: [
@@ -1200,21 +1225,21 @@ function We() {
1200
1225
  ] });
1201
1226
  }
1202
1227
  function st() {
1203
- const e = v((n) => n.voucherConfig.language), t = M(e);
1228
+ const e = b((n) => n.voucherConfig.language), t = z(e);
1204
1229
  return /* @__PURE__ */ u("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
1205
1230
  /* @__PURE__ */ s("div", { className: "navbar-start", children: /* @__PURE__ */ s("a", { className: "btn btn-ghost text-xl font-currency font-bold", children: t.header.title }) }),
1206
1231
  /* @__PURE__ */ s("div", { className: "navbar-center hidden sm:flex", children: /* @__PURE__ */ s("span", { className: "text-sm opacity-80", children: t.header.subtitle }) }),
1207
1232
  /* @__PURE__ */ s("div", { className: "navbar-end", children: /* @__PURE__ */ s(We, {}) })
1208
1233
  ] });
1209
1234
  }
1210
- const U = "/", je = {
1235
+ const W = "/", je = {
1211
1236
  id: "time-voucher-classic-de",
1212
1237
  name: "Zeitgutschein Classic",
1213
1238
  type: "time-voucher",
1214
1239
  category: "classic",
1215
1240
  images: {
1216
- front: `${U}templates/front_hdpi_de.jpg`,
1217
- back: `${U}templates/back_hdpi_de.jpg`,
1241
+ front: `${W}templates/front_hdpi_de.jpg`,
1242
+ back: `${W}templates/back_hdpi_de.jpg`,
1218
1243
  width: 6144,
1219
1244
  height: 4096
1220
1245
  },
@@ -1277,8 +1302,8 @@ const U = "/", je = {
1277
1302
  type: "time-voucher",
1278
1303
  category: "classic",
1279
1304
  images: {
1280
- front: `${U}templates/front_ldpi_en.png`,
1281
- back: `${U}templates/back_ldpi_en.png`,
1305
+ front: `${W}templates/front_ldpi_en.png`,
1306
+ back: `${W}templates/back_ldpi_en.png`,
1282
1307
  width: 1536,
1283
1308
  height: 1024
1284
1309
  },
@@ -1335,16 +1360,16 @@ const U = "/", je = {
1335
1360
  }
1336
1361
  },
1337
1362
  languages: ["en"]
1338
- }, Q = [
1363
+ }, ee = [
1339
1364
  je,
1340
1365
  Ke
1341
1366
  ], Oe = {
1342
1367
  async listTemplates(e) {
1343
- let t = [...Q];
1368
+ let t = [...ee];
1344
1369
  return e != null && e.type && (t = t.filter((n) => n.type === e.type)), e != null && e.category && (t = t.filter((n) => n.category === e.category)), e != null && e.language && (t = t.filter((n) => n.languages.includes(e.language))), t;
1345
1370
  },
1346
1371
  async getTemplate(e) {
1347
- const t = Q.find((n) => n.id === e);
1372
+ const t = ee.find((n) => n.id === e);
1348
1373
  if (!t)
1349
1374
  throw new Error(`Template not found: ${e}`);
1350
1375
  return t;
@@ -1353,18 +1378,18 @@ const U = "/", je = {
1353
1378
  function lt(e) {
1354
1379
  return e === "de" ? "time-voucher-classic-de" : "time-voucher-classic-en";
1355
1380
  }
1356
- let F = Oe;
1381
+ let j = Oe;
1357
1382
  function ct(e) {
1358
- F = e;
1383
+ j = e;
1359
1384
  }
1360
1385
  function dt() {
1361
- return F;
1386
+ return j;
1362
1387
  }
1363
1388
  async function ht(e) {
1364
- return F.listTemplates(e);
1389
+ return j.listTemplates(e);
1365
1390
  }
1366
1391
  async function mt(e) {
1367
- return F.getTemplate(e);
1392
+ return j.getTemplate(e);
1368
1393
  }
1369
1394
  export {
1370
1395
  _e as ApiKeyModal,
@@ -1380,34 +1405,34 @@ export {
1380
1405
  at as VoucherConfig,
1381
1406
  Pe as applyEngravingEffect,
1382
1407
  Ue as downloadBlob,
1383
- ze as drawContactInfo,
1384
- Me as drawMultilineText,
1408
+ Me as drawContactInfo,
1409
+ ze as drawMultilineText,
1385
1410
  $e as drawOvalPortrait,
1386
- oe as drawTemplate,
1387
- ie as drawText,
1411
+ ie as drawTemplate,
1412
+ se as drawText,
1388
1413
  tt as enhancePortrait,
1389
1414
  Fe as exportBillAsPDF,
1390
- ee as formatDescription,
1415
+ te as formatDescription,
1391
1416
  He as generateBillPDF,
1392
- q as getApiKey,
1417
+ V as getApiKey,
1393
1418
  lt as getDefaultTemplateId,
1394
- ae as getLayout,
1419
+ re as getLayout,
1395
1420
  Qe as getRemoveBackgroundEndpoint,
1396
- re as getTemplate,
1421
+ oe as getTemplate,
1397
1422
  mt as getTemplateById,
1398
1423
  dt as getTemplateProvider,
1399
- Ae as hasApiKey,
1424
+ Q as hasApiKey,
1400
1425
  et as hasCustomEndpoint,
1401
1426
  ht as listTemplates,
1402
- Y as loadImage,
1427
+ q as loadImage,
1403
1428
  Le as removeBackground,
1404
- le as renderBackSide,
1405
- se as renderFrontSide,
1406
- Re as setApiKey,
1429
+ ce as renderBackSide,
1430
+ le as renderFrontSide,
1431
+ Ae as setApiKey,
1407
1432
  Je as setRemoveBackgroundEndpoint,
1408
1433
  ct as setTemplateProvider,
1409
1434
  Oe as staticTemplateProvider,
1410
- M as t,
1435
+ z as t,
1411
1436
  ot as useBillCanvasRefs,
1412
- v as useBillStore
1437
+ b as useBillStore
1413
1438
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antontranelis/money-printer",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Create personalized time vouchers that look like real currency. React components for voucher generation with PDF export.",
5
5
  "type": "module",
6
6
  "license": "MIT",