@antontranelis/money-printer 1.0.4 → 1.0.5
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 +1 -1
- package/dist/index.js +427 -426
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),ke=require("zustand"),Ie=require("zustand/middleware"),x=require("react"),Pe=require("jspdf");var T=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},currentSide:"front",isEnhancing:!1,isExporting:!1},b=ke.create()(Ie.persist(e=>({...ee,setPersonalInfo:t=>e(a=>({personalInfo:{...a.personalInfo,...t}})),setVoucherConfig:t=>e(a=>({voucherConfig:{...a.voucherConfig,...t}})),setPortrait:(t,a=null)=>e({portrait:{original:t,enhanced:a,useEnhanced:!1,zoom:1}}),setEnhancedPortrait:t=>e(a=>({portrait:{...a.portrait,enhanced:t,useEnhanced:t!==null}})),toggleUseEnhanced:()=>e(t=>({portrait:{...t.portrait,useEnhanced:t.portrait.enhanced?!t.portrait.useEnhanced:!1}})),setPortraitZoom:t=>e(a=>({portrait:{...a.portrait,zoom: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(a=>({voucherConfig:{...a.voucherConfig,language:t}})),setHours:t=>e(a=>({voucherConfig:{...a.voucherConfig,hours:t}})),reset:()=>e(ee)}),{name:"money-generator-storage",partialize:e=>({personalInfo:e.personalInfo,voucherConfig:e.voucherConfig})})),je={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"}},Ee={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"}},Se={de:je,en:Ee};function C(e){return Se[e]}function q(e,t,a){if(a&&a.trim())return a;const n=C(e),o=t===1?n.form.voucher.hourLabel:n.form.voucher.hoursLabel;return n.bill.descriptionText.replace("{hours}",t.toString()).replace("{hourLabel}",o)}function Ne(){const e=b(o=>o.voucherConfig.language),t=b(o=>o.personalInfo),a=b(o=>o.setPersonalInfo),n=C(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:n.form.personalInfo.name})}),r.jsx("input",{type:"text",placeholder:n.form.personalInfo.namePlaceholder,className:"input input-bordered w-full",value:t.name,onChange:o=>a({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:n.form.personalInfo.email})}),r.jsx("input",{type:"email",placeholder:n.form.personalInfo.emailPlaceholder,className:"input input-bordered w-full",value:t.email,onChange:o=>a({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:n.form.personalInfo.phone})}),r.jsx("input",{type:"tel",placeholder:n.form.personalInfo.phonePlaceholder,className:"input input-bordered w-full",value:t.phone,onChange:o=>a({phone:o.target.value})})]})]})}const H={},Ce="https://api.stability.ai/v1/generation",Te="https://api.stability.ai/v2beta/stable-image/edit/remove-background",ae="stability_api_key",Ae={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 Le(e,t){const a=e/t;let n=te[0],o=1/0;for(const i of te){const d=i.width/i.height,l=Math.abs(a-d);l<o&&(o=l,n=i)}return n}function _e(e){return new Promise((t,a)=>{const n=new Image;n.onload=()=>{const o=Le(n.width,n.height),i=document.createElement("canvas");i.width=o.width,i.height=o.height;const d=i.getContext("2d");if(!d){a(new Error("Failed to get canvas context"));return}const l=n.width/n.height,s=o.width/o.height;let c=0,m=0,g=n.width,f=n.height;l>s?(g=n.height*s,c=(n.width-g)/2):(f=n.width/s,m=(n.height-f)/2),d.drawImage(n,c,m,g,f,0,0,o.width,o.height),t(i.toDataURL("image/png"))},n.onerror=()=>a(new Error("Failed to load image")),n.src=e})}function re(e){var d;const t=e.split(","),a=((d=t[0].match(/:(.*?);/))==null?void 0:d[1])||"image/png",n=atob(t[1]),o=n.length,i=new Uint8Array(o);for(let l=0;l<o;l++)i[l]=n.charCodeAt(l);return new Blob([i],{type:a})}function B(){var t;const e=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:T&&T.tagName.toUpperCase()==="SCRIPT"&&T.src||new URL("index.cjs",document.baseURI).href}<"u"&&(H==null?void 0:H.VITE_STABILITY_API_KEY)||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(ae):null}function oe(e){localStorage.setItem(ae,e)}function O(){return B()!==null}async function ie(e){const t=B();if(!t)throw new Error("No Stability AI API key configured");const{imageDataUrl:a,style:n,strength:o=.35}=e,i=await _e(a),d=re(i),l=new FormData;l.append("init_image",d,"portrait.png"),l.append("init_image_mode","IMAGE_STRENGTH"),l.append("image_strength",String(1-o)),l.append("text_prompts[0][text]",Ae[n]),l.append("text_prompts[0][weight]","1"),l.append("cfg_scale","7"),l.append("samples","1"),l.append("steps","30");const c=await fetch(`${Ce}/stable-diffusion-xl-1024-v1-0/image-to-image`,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},body:l});if(!c.ok){const g=await c.text();throw console.error("Stability AI error:",g),c.status===401?new Error("Invalid API key"):c.status===402?new Error("Insufficient credits"):c.status===429?new Error("Rate limit exceeded. Please try again later."):new Error(`API error: ${c.status}`)}const m=await c.json();if(!m.artifacts||m.artifacts.length===0)throw new Error("No image generated");return`data:image/png;base64,${m.artifacts[0].base64}`}async function se(e){const t=B();if(!t)throw new Error("No Stability AI API key configured");const a=re(e),n=new FormData;n.append("image",a,"image.png"),n.append("output_format","png");const o=await fetch(Te,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"image/*"},body:n});if(!o.ok){const d=await o.text();throw console.error("Stability AI remove background error:",d),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((d,l)=>{const s=new FileReader;s.onload=()=>d(s.result),s.onerror=()=>l(new Error("Failed to read result")),s.readAsDataURL(i)})}async function W(e){return new Promise((t,a)=>{const n=new Image;n.onload=()=>{const o=document.createElement("canvas"),i=o.getContext("2d");if(!i){a(new Error("Failed to get canvas context"));return}o.width=n.width,o.height=n.height,i.filter="sepia(0.3) contrast(1.1) saturate(0.9)",i.drawImage(n,0,0),t(o.toDataURL("image/png"))},n.onerror=()=>a(new Error("Failed to load image")),n.src=e})}function De(){const[e,t]=x.useState(!1),[a,n]=x.useState(!1),[o,i]=x.useState(null),[d,l]=x.useState(O()),s=x.useCallback(()=>i(null),[]),c=x.useCallback(f=>{oe(f),l(!0),i(null)},[]),m=x.useCallback(async(f,p="vintage")=>{t(!0),i(null);try{return O()?await ie({imageDataUrl:f,style:p,strength:.35}):await W(f)}catch(h){const k=h instanceof Error?h.message:"Enhancement failed";if(i(k),k.includes("API")||k.includes("key"))try{return await W(f)}catch{throw h}throw h}finally{t(!1)}},[]),g=x.useCallback(async f=>{n(!0),i(null);try{return await se(f)}catch(p){const h=p instanceof Error?p.message:"Background removal failed";throw i(h),p}finally{n(!1)}},[]);return{enhance:m,removeBg:g,isEnhancing:e,isRemovingBg:a,error:o,hasKey:d,setApiKey:c,clearError:s}}function le({isOpen:e,onClose:t,onSubmit:a}){const n=b(c=>c.voucherConfig.language),[o,i]=x.useState("");if(!e)return null;const d=c=>{c.preventDefault(),o.trim()&&(a(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."}}[n];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:d,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:c=>i(c.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 Re(){const e=b(u=>u.voucherConfig.language),t=b(u=>u.portrait),a=b(u=>u.setPortrait),n=b(u=>u.setEnhancedPortrait),o=b(u=>u.toggleUseEnhanced),i=b(u=>u.setPortraitZoom),{enhance:d,removeBg:l,isEnhancing:s,isRemovingBg:c,error:m,hasKey:g,setApiKey:f}=De(),p=C(e),h=x.useRef(null),[k,I]=x.useState(!1),[P,E]=x.useState(!1),w=x.useCallback(async u=>{if(!u.type.startsWith("image/"))return;const y=new FileReader;y.onload=async _=>{var Q;const z=(Q=_.target)==null?void 0:Q.result;if(g)try{const M=await l(z);a(M)}catch(M){console.error("Background removal failed, using original:",M),a(z)}else a(z)},y.readAsDataURL(u)},[a,g,l]),j=x.useCallback(u=>{u.preventDefault(),I(!1);const y=u.dataTransfer.files[0];y&&w(y)},[w]),A=x.useCallback(u=>{u.preventDefault(),I(!0)},[]),L=x.useCallback(u=>{u.preventDefault(),I(!1)},[]),$=()=>{var u;(u=h.current)==null||u.click()},F=u=>{var _;const y=(_=u.target.files)==null?void 0:_[0];y&&w(y)},xe=async()=>{if(t.original){if(!g){E(!0);return}try{const u=await d(t.original,"vintage");n(u)}catch(u){console.error("Enhancement failed:",u)}}},we=async u=>{if(f(u),t.original)try{const y=await d(t.original,"vintage");n(y)}catch(y){console.error("Enhancement failed:",y)}},ye=()=>{a(null)},ve=t.useEnhanced&&t.enhanced?t.enhanced:t.original;return r.jsxs("div",{className:"space-y-4",children:[t.original?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-center",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:ve||"",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:ye,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",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:u=>i(parseFloat(u.target.value)),className:"range range-primary range-sm"})]}),g&&r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("button",{className:`btn btn-secondary ${s?"loading":""}`,onClick:xe,disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"loading loading-spinner loading-sm"}),p.form.portrait.enhancing]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),p.form.portrait.enhance]})}),m&&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:m})]}),t.enhanced&&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",checked:t.useEnhanced,onChange:o}),r.jsx("span",{className:"label-text",children:t.useEnhanced?p.form.portrait.useEnhanced:p.form.portrait.useOriginal})]})})]})]}):r.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${c?"border-primary bg-primary/10 pointer-events-none":k?"border-primary bg-primary/10":"border-base-300 hover:border-primary hover:bg-base-200"}`,onDrop:j,onDragOver:A,onDragLeave:L,onClick:$,children:[r.jsx("input",{ref:h,type:"file",accept:"image/*",className:"hidden",onChange:F}),c?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(le,{isOpen:P,onClose:()=>E(!1),onSubmit:we})]})}function Be(){return null}const v=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:T&&T.tagName.toUpperCase()==="SCRIPT"&&T.src||new URL("index.cjs",document.baseURI).href}<"u"&&"/"||"/",ce={en:{1:{front:`${v}templates/front_ldpi_en.png`,back:`${v}templates/back_ldpi_en.png`,width:1536,height:1024},5:{front:`${v}templates/front_ldpi_en.png`,back:`${v}templates/back_ldpi_en.png`,width:1536,height:1024},10:{front:`${v}templates/front_ldpi_en.png`,back:`${v}templates/back_ldpi_en.png`,width:1536,height:1024}},de:{1:{front:`${v}templates/front_hdpi_de.webp`,back:`${v}templates/back_hdpi_de.webp`,width:6144,height:3200},5:{front:`${v}templates/front_hdpi_de.webp`,back:`${v}templates/back_hdpi_de.webp`,width:6144,height:3200},10:{front:`${v}templates/front_hdpi_de.webp`,back:`${v}templates/back_hdpi_de.webp`,width:6144,height:3200}}},S={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"}}},N={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"?N:S}function V(e,t){return ce[e][t]}const K=new Map;async function D(e){return K.has(e)?K.get(e):new Promise((t,a)=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>{K.set(e,n),t(n)},n.onerror=a,n.src=e})}function G(e,t,a,n){e.drawImage(t,0,0,a,n)}function de(e,t,a,n,o,i,d=1){e.save(),e.beginPath(),e.ellipse(a,n,o,i,0,0,Math.PI*2),e.closePath(),e.clip();const l=t.width/t.height,s=o/i,c=o*2,m=i*2;let g,f;l>s?(f=m,g=m*l):(g=c,f=c/l),g*=d,f*=d;const p=a-g/2,h=n-f/2;e.drawImage(t,p,h,g,f),e.restore()}function Z(e,t,a,n="#2a3a2a"){e.save(),e.font=`${a.fontSize}px "Times New Roman", serif`,e.textAlign=a.align||"center",e.textBaseline="middle",e.fillStyle=n,a.maxWidth?e.fillText(t,a.x,a.y,a.maxWidth):e.fillText(t,a.x,a.y),e.restore()}function he(e,t,a,n="#2a3a2a"){e.save(),e.font=`${a.fontSize}px "Times New Roman", serif`,e.textAlign=a.align||"center",e.textBaseline="top",e.fillStyle=n;const o=a.maxWidth||400,i=a.lineHeight||a.fontSize*1.4,d=t.split(" "),l=[];let s="";for(const g of d){const f=s?`${s} ${g}`:g;e.measureText(f).width>o&&s?(l.push(s),s=g):s=f}s&&l.push(s);const c=l.length*i;let m=a.y-c/2;for(const g of l)e.fillText(g,a.x,m),m+=i;e.restore()}function ue(e,t,a,n,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 d=o.lineHeight||o.fontSize*1.8,l=[t,a,n].filter(Boolean),s=(l.length-1)*d;let c=o.y-s/2;for(const m of l)m&&(e.fillText(m,o.x,c),c+=d);e.restore()}async function X(e,t,a,n,o,i,d,l=1){const s=e.getContext("2d");if(!s)return;e.width=i,e.height=d,s.clearRect(0,0,i,d);const c=await D(t);if(G(s,c,i,d),a)try{const m=await D(a);de(s,m,o.portrait.x,o.portrait.y,o.portrait.radiusX,o.portrait.radiusY,l)}catch(m){console.error("Failed to load portrait:",m)}n&&Z(s,n,o.namePlate)}async function J(e,t,a,n,o,i,d,l,s){const c=e.getContext("2d");if(!c)return;e.width=l,e.height=s,c.clearRect(0,0,l,s);const m=await D(t);G(c,m,l,s),d.contactInfo&&(a||n||o)&&ue(c,a,n,o,d.contactInfo),d.description&&i&&he(c,i,d.description),a&&Z(c,a,d.namePlate)}function Ue(){const e=b(w=>w.voucherConfig.language),t=b(w=>w.voucherConfig.hours),a=b(w=>w.voucherConfig.description),n=b(w=>w.personalInfo),o=b(w=>w.portrait),i=b(w=>w.currentSide),d=b(w=>w.flipSide),l=C(e),s=x.useRef(null),c=x.useRef(null),m=x.useRef(null),[g,f]=x.useState(!1),p=V(e,t),h=Y(e),k=o.useEnhanced&&o.enhanced?o.enhanced:o.original,I=q(e,t,a);x.useEffect(()=>{s.current&&X(s.current,p.front,k,n.name,h.front,p.width,p.height,o.zoom)},[p,k,n.name,h,o.zoom]),x.useEffect(()=>{c.current&&J(c.current,p.back,n.name,n.email,n.phone,I,h.back,p.width,p.height)},[p,n,I,h]);const P=()=>{f(!0),setTimeout(()=>{d(),f(!1)},150)},E=p.width/p.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"&&P(),children:l.preview.front}),r.jsx("button",{className:`tab ${i==="back"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>i!=="back"&&P(),children:l.preview.back})]}),r.jsxs("button",{className:"btn btn-ghost btn-sm",onClick:P,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:m,className:"relative w-full overflow-hidden shadow-lg",style:{aspectRatio:E},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:c,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 $e(){const e=x.useRef(null),t=x.useRef(null);return{frontCanvasRef:e,backCanvasRef:t}}async function pe(e){const{frontTemplateSrc:t,backTemplateSrc:a,templateWidth:n,templateHeight:o,layout:i,portrait:d,portraitZoom:l=1,name:s,email:c,phone:m,description:g}=e,f=document.createElement("canvas"),p=document.createElement("canvas");await Promise.all([X(f,t,d,s,i.front,n,o,l),J(p,a,s,c,m,g,i.back,n,o)]);const h=new Pe({orientation:"landscape",unit:"mm",format:"a4"}),k=297,I=210,P=10,E=n/o;let w=k-P*2,j=w/E;j>I-P*2&&(j=I-P*2,w=j*E);const A=(k-w)/2,L=(I-j)/2,$=f.toDataURL("image/jpeg",.95);h.addImage($,"JPEG",A,L,w,j),h.addPage();const F=p.toDataURL("image/jpeg",.95);return h.addImage(F,"JPEG",A,L,w,j),h.output("blob")}function me(e,t){const a=URL.createObjectURL(e),n=document.createElement("a");n.href=a,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(a)}async function ge(e){const t=await pe(e);me(t,e.filename)}function Fe(){const e=b(h=>h.voucherConfig.language),t=b(h=>h.voucherConfig.hours),a=b(h=>h.voucherConfig.description),n=b(h=>h.personalInfo),o=b(h=>h.portrait),i=b(h=>h.isExporting),d=b(h=>h.setIsExporting),l=C(e),s=V(e,t),c=Y(e),m=o.useEnhanced&&o.enhanced?o.enhanced:o.original,g=q(e,t,a),f=n.name.trim().length>0&&n.email.trim().length>0&&n.phone.trim().length>0&&o.original!==null,p=async()=>{if(!(!f||i)){d(!0);try{const h=`zeitgutschein-${t}h-${n.name.replace(/\s+/g,"-").toLowerCase()}.pdf`;await ge({frontTemplateSrc:s.front,backTemplateSrc:s.back,templateWidth:s.width,templateHeight:s.height,layout:c,portrait:m,portraitZoom:o.zoom,name:n.name,email:n.email,phone:n.phone,description:g,filename:h})}catch(h){console.error("PDF export failed:",h)}finally{d(!1)}}};return r.jsx("button",{className:`btn btn-primary flex-1 ${i?"loading":""}`,onClick:p,disabled:!f||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 fe(){const e=b(n=>n.voucherConfig.language),t=b(n=>n.setLanguage),a=n=>{t(n)};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:()=>a("de"),children:"DE"}),r.jsx("button",{className:`join-item btn btn-sm ${e==="en"?"btn-active btn-primary":"btn-ghost"}`,onClick:()=>a("en"),children:"EN"})]})}function ze(){const e=b(a=>a.voucherConfig.language),t=C(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(fe,{})})]})}const R="/",Me={id:"time-voucher-classic-de",name:"Zeitgutschein Classic",type:"time-voucher",category:"classic",images:{front:`${R}templates/front_hdpi_de.jpg`,back:`${R}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:N.front.portrait,name:N.front.namePlate},back:{name:N.back.namePlate,contactInfo:N.back.contactInfo,description:N.back.description}},languages:["de"]},He={id:"time-voucher-classic-en",name:"Time Voucher Classic",type:"time-voucher",category:"classic",images:{front:`${R}templates/front_ldpi_en.png`,back:`${R}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:S.front.portrait,name:S.front.namePlate},back:{name:S.back.namePlate,contactInfo:S.back.contactInfo,description:S.back.description}},languages:["en"]},ne=[Me,He],be={async listTemplates(e){let t=[...ne];return e!=null&&e.type&&(t=t.filter(a=>a.type===e.type)),e!=null&&e.category&&(t=t.filter(a=>a.category===e.category)),e!=null&&e.language&&(t=t.filter(a=>a.languages.includes(e.language))),t},async getTemplate(e){const t=ne.find(a=>a.id===e);if(!t)throw new Error(`Template not found: ${e}`);return t}};function Ke(e){return e==="de"?"time-voucher-classic-de":"time-voucher-classic-en"}let U=be;function Oe(e){U=e}function We(){return U}async function qe(e){return U.listTemplates(e)}async function Ye(e){return U.getTemplate(e)}exports.ApiKeyModal=le;exports.BillPreview=Ue;exports.ExportButton=Fe;exports.Header=ze;exports.LAYOUT_HDPI=N;exports.LAYOUT_LDPI=S;exports.LanguageToggle=fe;exports.PersonalInfoForm=Ne;exports.PortraitUpload=Re;exports.TEMPLATES=ce;exports.VoucherConfig=Be;exports.downloadBlob=me;exports.drawContactInfo=ue;exports.drawMultilineText=he;exports.drawOvalPortrait=de;exports.drawTemplate=G;exports.drawText=Z;exports.enhancePortrait=ie;exports.enhancePortraitFallback=W;exports.exportBillAsPDF=ge;exports.formatDescription=q;exports.generateBillPDF=pe;exports.getApiKey=B;exports.getDefaultTemplateId=Ke;exports.getLayout=Y;exports.getTemplate=V;exports.getTemplateById=Ye;exports.getTemplateProvider=We;exports.hasApiKey=O;exports.listTemplates=qe;exports.loadImage=D;exports.removeBackground=se;exports.renderBackSide=J;exports.renderFrontSide=X;exports.setApiKey=oe;exports.setTemplateProvider=Oe;exports.staticTemplateProvider=be;exports.t=C;exports.useBillCanvasRefs=$e;exports.useBillStore=b;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),ve=require("zustand"),ke=require("zustand/middleware"),y=require("react"),Ie=require("jspdf");var T=typeof document<"u"?document.currentScript:null;const J={personalInfo:{name:"",email:"",phone:""},voucherConfig:{hours:1,description:"",language:"de"},portrait:{original:null,enhanced:null,useEnhanced:!1,zoom:1},currentSide:"front",isEnhancing:!1,isExporting:!1},b=ve.create()(ke.persist(e=>({...J,setPersonalInfo:t=>e(a=>({personalInfo:{...a.personalInfo,...t}})),setVoucherConfig:t=>e(a=>({voucherConfig:{...a.voucherConfig,...t}})),setPortrait:(t,a=null)=>e({portrait:{original:t,enhanced:a,useEnhanced:!1,zoom:1}}),setEnhancedPortrait:t=>e(a=>({portrait:{...a.portrait,enhanced:t,useEnhanced:t!==null}})),toggleUseEnhanced:()=>e(t=>({portrait:{...t.portrait,useEnhanced:t.portrait.enhanced?!t.portrait.useEnhanced:!1}})),setPortraitZoom:t=>e(a=>({portrait:{...a.portrait,zoom: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(a=>({voucherConfig:{...a.voucherConfig,language:t}})),setHours:t=>e(a=>({voucherConfig:{...a.voucherConfig,hours:t}})),reset:()=>e(J)}),{name:"money-generator-storage",partialize:e=>({personalInfo:e.personalInfo,voucherConfig:e.voucherConfig})})),je={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"}},Pe={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"}},Ee={de:je,en:Pe};function C(e){return Ee[e]}function O(e,t,a){if(a&&a.trim())return a;const n=C(e),o=t===1?n.form.voucher.hourLabel:n.form.voucher.hoursLabel;return n.bill.descriptionText.replace("{hours}",t.toString()).replace("{hourLabel}",o)}function Se(){const e=b(o=>o.voucherConfig.language),t=b(o=>o.personalInfo),a=b(o=>o.setPersonalInfo),n=C(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:n.form.personalInfo.name})}),r.jsx("input",{type:"text",placeholder:n.form.personalInfo.namePlaceholder,className:"input input-bordered w-full",value:t.name,onChange:o=>a({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:n.form.personalInfo.email})}),r.jsx("input",{type:"email",placeholder:n.form.personalInfo.emailPlaceholder,className:"input input-bordered w-full",value:t.email,onChange:o=>a({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:n.form.personalInfo.phone})}),r.jsx("input",{type:"tel",placeholder:n.form.personalInfo.phonePlaceholder,className:"input input-bordered w-full",value:t.phone,onChange:o=>a({phone:o.target.value})})]})]})}const H={},Ne="https://api.stability.ai/v1/generation",Ce="https://api.stability.ai/v2beta/stable-image/edit/remove-background",te="stability_api_key",Te={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"},Q=[{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 Le(e,t){const a=e/t;let n=Q[0],o=1/0;for(const s of Q){const c=s.width/s.height,l=Math.abs(a-c);l<o&&(o=l,n=s)}return n}function Ae(e){return new Promise((t,a)=>{const n=new Image;n.onload=()=>{const o=Le(n.width,n.height),s=document.createElement("canvas");s.width=o.width,s.height=o.height;const c=s.getContext("2d");if(!c){a(new Error("Failed to get canvas context"));return}const l=n.width/n.height,i=o.width/o.height;let d=0,u=0,g=n.width,f=n.height;l>i?(g=n.height*i,d=(n.width-g)/2):(f=n.width/i,u=(n.height-f)/2),c.drawImage(n,d,u,g,f,0,0,o.width,o.height),t(s.toDataURL("image/png"))},n.onerror=()=>a(new Error("Failed to load image")),n.src=e})}function ne(e){var c;const t=e.split(","),a=((c=t[0].match(/:(.*?);/))==null?void 0:c[1])||"image/png",n=atob(t[1]),o=n.length,s=new Uint8Array(o);for(let l=0;l<o;l++)s[l]=n.charCodeAt(l);return new Blob([s],{type:a})}function R(){var t;const e=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:T&&T.tagName.toUpperCase()==="SCRIPT"&&T.src||new URL("index.cjs",document.baseURI).href}<"u"&&(H==null?void 0:H.VITE_STABILITY_API_KEY)||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(te):null}function ae(e){localStorage.setItem(te,e)}function re(){return R()!==null}async function De(e){const t=R();if(!t)throw new Error("No Stability AI API key configured");const{imageDataUrl:a,style:n,strength:o=.35}=e,s=await Ae(a),c=ne(s),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]",Te[n]),l.append("text_prompts[0][weight]","1"),l.append("cfg_scale","7"),l.append("samples","1"),l.append("steps","30");const d=await fetch(`${Ne}/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 oe(e){const t=R();if(!t)throw new Error("No Stability AI API key configured");const a=ne(e),n=new FormData;n.append("image",a,"image.png"),n.append("output_format","png");const o=await fetch(Ce,{method:"POST",headers:{Authorization:`Bearer ${t}`,Accept:"image/*"},body:n});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 s=await o.blob();return new Promise((c,l)=>{const i=new FileReader;i.onload=()=>c(i.result),i.onerror=()=>l(new Error("Failed to read result")),i.readAsDataURL(s)})}async function ie(e){return new Promise((t,a)=>{const n=new Image;n.onload=()=>{const o=document.createElement("canvas"),s=o.getContext("2d");if(!s){a(new Error("Failed to get canvas context"));return}o.width=n.width,o.height=n.height,s.drawImage(n,0,0);const c=s.getImageData(0,0,o.width,o.height),l=c.data;for(let i=0;i<l.length;i+=4){const d=l[i],u=l[i+1],g=l[i+2];if(l[i+3]===0)continue;const p=.299*d+.587*u+.114*g,h=1.4;let w=259*(h*255+255)/(255*(259-h*255))*(p-128)+128;w=Math.max(0,Math.min(255,w));const I=Math.min(255,w*1.1+20),P=Math.min(255,w*.95+10),x=Math.min(255,w*.8);l[i]=I,l[i+1]=P,l[i+2]=x}s.putImageData(c,0,0),t(o.toDataURL("image/png"))},n.onerror=()=>a(new Error("Failed to load image")),n.src=e})}function _e(){const[e,t]=y.useState(!1),[a,n]=y.useState(!1),[o,s]=y.useState(null),[c,l]=y.useState(re()),i=y.useCallback(()=>s(null),[]),d=y.useCallback(f=>{ae(f),l(!0),s(null)},[]),u=y.useCallback(async(f,p="vintage")=>{t(!0),s(null);try{return await ie(f)}catch(h){const j=h instanceof Error?h.message:"Enhancement failed";throw s(j),h}finally{t(!1)}},[]),g=y.useCallback(async f=>{n(!0),s(null);try{return await oe(f)}catch(p){const h=p instanceof Error?p.message:"Background removal failed";throw s(h),p}finally{n(!1)}},[]);return{enhance:u,removeBg:g,isEnhancing:e,isRemovingBg:a,error:o,hasKey:c,setApiKey:d,clearError:i}}function se({isOpen:e,onClose:t,onSubmit:a}){const n=b(d=>d.voucherConfig.language),[o,s]=y.useState("");if(!e)return null;const c=d=>{d.preventDefault(),o.trim()&&(a(o.trim()),s(""),t())},i={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."}}[n];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:i.title}),r.jsx("p",{className:"py-4 text-sm opacity-80",children:i.description}),r.jsxs("form",{onSubmit:c,children:[r.jsxs("div",{className:"form-control",children:[r.jsx("input",{type:"password",placeholder:i.placeholder,className:"input input-bordered w-full",value:o,onChange:d=>s(d.target.value),autoFocus:!0}),r.jsx("label",{className:"label",children:r.jsx("span",{className:"label-text-alt",children:i.hint})})]}),r.jsxs("div",{className:"modal-action",children:[r.jsx("button",{type:"button",className:"btn btn-ghost",onClick:t,children:i.cancel}),r.jsx("button",{type:"submit",className:"btn btn-primary",disabled:!o.trim(),children:i.submit})]})]})]}),r.jsx("form",{method:"dialog",className:"modal-backdrop",children:r.jsx("button",{onClick:t,children:"close"})})]})}function Be(){const e=b(m=>m.voucherConfig.language),t=b(m=>m.portrait),a=b(m=>m.setPortrait),n=b(m=>m.setEnhancedPortrait),o=b(m=>m.toggleUseEnhanced),s=b(m=>m.setPortraitZoom),{enhance:c,removeBg:l,isEnhancing:i,isRemovingBg:d,error:u,hasKey:g,setApiKey:f}=_e(),p=C(e),h=y.useRef(null),[j,w]=y.useState(!1),[I,P]=y.useState(!1),x=y.useCallback(async m=>{if(!m.type.startsWith("image/"))return;const v=new FileReader;v.onload=async D=>{var X;const F=(X=D.target)==null?void 0:X.result;if(g)try{const z=await l(F);a(z)}catch(z){console.error("Background removal failed, using original:",z),a(F)}else a(F)},v.readAsDataURL(m)},[a,g,l]),E=y.useCallback(m=>{m.preventDefault(),w(!1);const v=m.dataTransfer.files[0];v&&x(v)},[x]),L=y.useCallback(m=>{m.preventDefault(),w(!0)},[]),A=y.useCallback(m=>{m.preventDefault(),w(!1)},[]),$=()=>{var m;(m=h.current)==null||m.click()},M=m=>{var D;const v=(D=m.target.files)==null?void 0:D[0];v&&x(v)},be=async()=>{if(t.original){if(!g){P(!0);return}try{const m=await c(t.original,"vintage");n(m)}catch(m){console.error("Enhancement failed:",m)}}},xe=async m=>{if(f(m),t.original)try{const v=await c(t.original,"vintage");n(v)}catch(v){console.error("Enhancement failed:",v)}},ye=()=>{a(null)},we=t.useEnhanced&&t.enhanced?t.enhanced:t.original;return r.jsxs("div",{className:"space-y-4",children:[t.original?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex justify-center",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:we||"",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:ye,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",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=>s(parseFloat(m.target.value)),className:"range range-primary range-sm"})]}),g&&r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("button",{className:`btn btn-secondary ${i?"loading":""}`,onClick:be,disabled:i,children:i?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"loading loading-spinner loading-sm"}),p.form.portrait.enhancing]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),p.form.portrait.enhance]})}),u&&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:u})]}),t.enhanced&&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",checked:t.useEnhanced,onChange:o}),r.jsx("span",{className:"label-text",children:t.useEnhanced?p.form.portrait.useEnhanced:p.form.portrait.useOriginal})]})})]})]}):r.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${d?"border-primary bg-primary/10 pointer-events-none":j?"border-primary bg-primary/10":"border-base-300 hover:border-primary hover:bg-base-200"}`,onDrop:E,onDragOver:L,onDragLeave:A,onClick:$,children:[r.jsx("input",{ref:h,type:"file",accept:"image/*",className:"hidden",onChange:M}),d?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(se,{isOpen:I,onClose:()=>P(!1),onSubmit:xe})]})}function Re(){return null}const k=typeof{url:typeof document>"u"?require("url").pathToFileURL(__filename).href:T&&T.tagName.toUpperCase()==="SCRIPT"&&T.src||new URL("index.cjs",document.baseURI).href}<"u"&&"/"||"/",le={en:{1:{front:`${k}templates/front_ldpi_en.png`,back:`${k}templates/back_ldpi_en.png`,width:1536,height:1024},5:{front:`${k}templates/front_ldpi_en.png`,back:`${k}templates/back_ldpi_en.png`,width:1536,height:1024},10:{front:`${k}templates/front_ldpi_en.png`,back:`${k}templates/back_ldpi_en.png`,width:1536,height:1024}},de:{1:{front:`${k}templates/front_hdpi_de.webp`,back:`${k}templates/back_hdpi_de.webp`,width:6144,height:3200},5:{front:`${k}templates/front_hdpi_de.webp`,back:`${k}templates/back_hdpi_de.webp`,width:6144,height:3200},10:{front:`${k}templates/front_hdpi_de.webp`,back:`${k}templates/back_hdpi_de.webp`,width:6144,height:3200}}},S={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"}}},N={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"?N:S}function q(e,t){return le[e][t]}const K=new Map;async function _(e){return K.has(e)?K.get(e):new Promise((t,a)=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>{K.set(e,n),t(n)},n.onerror=a,n.src=e})}function Y(e,t,a,n){e.drawImage(t,0,0,a,n)}function ce(e,t,a,n,o,s,c=1){e.save(),e.beginPath(),e.ellipse(a,n,o,s,0,0,Math.PI*2),e.closePath(),e.clip();const l=t.width/t.height,i=o/s,d=o*2,u=s*2;let g,f;l>i?(f=u,g=u*l):(g=d,f=d/l),g*=c,f*=c;const p=a-g/2,h=n-f/2;e.drawImage(t,p,h,g,f),e.restore()}function V(e,t,a,n="#2a3a2a"){e.save(),e.font=`${a.fontSize}px "Times New Roman", serif`,e.textAlign=a.align||"center",e.textBaseline="middle",e.fillStyle=n,a.maxWidth?e.fillText(t,a.x,a.y,a.maxWidth):e.fillText(t,a.x,a.y),e.restore()}function de(e,t,a,n="#2a3a2a"){e.save(),e.font=`${a.fontSize}px "Times New Roman", serif`,e.textAlign=a.align||"center",e.textBaseline="top",e.fillStyle=n;const o=a.maxWidth||400,s=a.lineHeight||a.fontSize*1.4,c=t.split(" "),l=[];let i="";for(const g of c){const f=i?`${i} ${g}`:g;e.measureText(f).width>o&&i?(l.push(i),i=g):i=f}i&&l.push(i);const d=l.length*s;let u=a.y-d/2;for(const g of l)e.fillText(g,a.x,u),u+=s;e.restore()}function he(e,t,a,n,o,s="#2a3a2a"){e.save(),e.font=`${o.fontSize}px "Times New Roman", serif`,e.textAlign=o.align||"center",e.textBaseline="middle",e.fillStyle=s;const c=o.lineHeight||o.fontSize*1.8,l=[t,a,n].filter(Boolean),i=(l.length-1)*c;let d=o.y-i/2;for(const u of l)u&&(e.fillText(u,o.x,d),d+=c);e.restore()}async function G(e,t,a,n,o,s,c,l=1){const i=e.getContext("2d");if(!i)return;e.width=s,e.height=c,i.clearRect(0,0,s,c);const d=await _(t);if(Y(i,d,s,c),a)try{const u=await _(a);ce(i,u,o.portrait.x,o.portrait.y,o.portrait.radiusX,o.portrait.radiusY,l)}catch(u){console.error("Failed to load portrait:",u)}n&&V(i,n,o.namePlate)}async function Z(e,t,a,n,o,s,c,l,i){const d=e.getContext("2d");if(!d)return;e.width=l,e.height=i,d.clearRect(0,0,l,i);const u=await _(t);Y(d,u,l,i),c.contactInfo&&(a||n||o)&&he(d,a,n,o,c.contactInfo),c.description&&s&&de(d,s,c.description),a&&V(d,a,c.namePlate)}function Ue(){const e=b(x=>x.voucherConfig.language),t=b(x=>x.voucherConfig.hours),a=b(x=>x.voucherConfig.description),n=b(x=>x.personalInfo),o=b(x=>x.portrait),s=b(x=>x.currentSide),c=b(x=>x.flipSide),l=C(e),i=y.useRef(null),d=y.useRef(null),u=y.useRef(null),[g,f]=y.useState(!1),p=q(e,t),h=W(e),j=o.useEnhanced&&o.enhanced?o.enhanced:o.original,w=O(e,t,a);y.useEffect(()=>{i.current&&G(i.current,p.front,j,n.name,h.front,p.width,p.height,o.zoom)},[p,j,n.name,h,o.zoom]),y.useEffect(()=>{d.current&&Z(d.current,p.back,n.name,n.email,n.phone,w,h.back,p.width,p.height)},[p,n,w,h]);const I=()=>{f(!0),setTimeout(()=>{c(),f(!1)},150)},P=p.width/p.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 ${s==="front"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>s!=="front"&&I(),children:l.preview.front}),r.jsx("button",{className:`tab ${s==="back"?"tab-active bg-primary text-primary-content font-semibold":""}`,onClick:()=>s!=="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:P},children:[r.jsx("canvas",{ref:i,className:`absolute inset-0 w-full h-full transition-all duration-300 ${s==="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 ${s==="back"?g?"opacity-0 scale-95":"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"}`})]})]})}function $e(){const e=y.useRef(null),t=y.useRef(null);return{frontCanvasRef:e,backCanvasRef:t}}async function ue(e){const{frontTemplateSrc:t,backTemplateSrc:a,templateWidth:n,templateHeight:o,layout:s,portrait:c,portraitZoom:l=1,name:i,email:d,phone:u,description:g}=e,f=document.createElement("canvas"),p=document.createElement("canvas");await Promise.all([G(f,t,c,i,s.front,n,o,l),Z(p,a,i,d,u,g,s.back,n,o)]);const h=new Ie({orientation:"landscape",unit:"mm",format:"a4"}),j=297,w=210,I=10,P=n/o;let x=j-I*2,E=x/P;E>w-I*2&&(E=w-I*2,x=E*P);const L=(j-x)/2,A=(w-E)/2,$=f.toDataURL("image/jpeg",.95);h.addImage($,"JPEG",L,A,x,E),h.addPage();const M=p.toDataURL("image/jpeg",.95);return h.addImage(M,"JPEG",L,A,x,E),h.output("blob")}function pe(e,t){const a=URL.createObjectURL(e),n=document.createElement("a");n.href=a,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(a)}async function me(e){const t=await ue(e);pe(t,e.filename)}function Me(){const e=b(h=>h.voucherConfig.language),t=b(h=>h.voucherConfig.hours),a=b(h=>h.voucherConfig.description),n=b(h=>h.personalInfo),o=b(h=>h.portrait),s=b(h=>h.isExporting),c=b(h=>h.setIsExporting),l=C(e),i=q(e,t),d=W(e),u=o.useEnhanced&&o.enhanced?o.enhanced:o.original,g=O(e,t,a),f=n.name.trim().length>0&&n.email.trim().length>0&&n.phone.trim().length>0&&o.original!==null,p=async()=>{if(!(!f||s)){c(!0);try{const h=`zeitgutschein-${t}h-${n.name.replace(/\s+/g,"-").toLowerCase()}.pdf`;await me({frontTemplateSrc:i.front,backTemplateSrc:i.back,templateWidth:i.width,templateHeight:i.height,layout:d,portrait:u,portraitZoom:o.zoom,name:n.name,email:n.email,phone:n.phone,description:g,filename:h})}catch(h){console.error("PDF export failed:",h)}finally{c(!1)}}};return r.jsx("button",{className:`btn btn-primary flex-1 ${s?"loading":""}`,onClick:p,disabled:!f||s,children:s?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 ge(){const e=b(n=>n.voucherConfig.language),t=b(n=>n.setLanguage),a=n=>{t(n)};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:()=>a("de"),children:"DE"}),r.jsx("button",{className:`join-item btn btn-sm ${e==="en"?"btn-active btn-primary":"btn-ghost"}`,onClick:()=>a("en"),children:"EN"})]})}function Fe(){const e=b(a=>a.voucherConfig.language),t=C(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(ge,{})})]})}const B="/",ze={id:"time-voucher-classic-de",name:"Zeitgutschein Classic",type:"time-voucher",category:"classic",images:{front:`${B}templates/front_hdpi_de.jpg`,back:`${B}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:N.front.portrait,name:N.front.namePlate},back:{name:N.back.namePlate,contactInfo:N.back.contactInfo,description:N.back.description}},languages:["de"]},He={id:"time-voucher-classic-en",name:"Time Voucher Classic",type:"time-voucher",category:"classic",images:{front:`${B}templates/front_ldpi_en.png`,back:`${B}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:S.front.portrait,name:S.front.namePlate},back:{name:S.back.namePlate,contactInfo:S.back.contactInfo,description:S.back.description}},languages:["en"]},ee=[ze,He],fe={async listTemplates(e){let t=[...ee];return e!=null&&e.type&&(t=t.filter(a=>a.type===e.type)),e!=null&&e.category&&(t=t.filter(a=>a.category===e.category)),e!=null&&e.language&&(t=t.filter(a=>a.languages.includes(e.language))),t},async getTemplate(e){const t=ee.find(a=>a.id===e);if(!t)throw new Error(`Template not found: ${e}`);return t}};function Ke(e){return e==="de"?"time-voucher-classic-de":"time-voucher-classic-en"}let U=fe;function Oe(e){U=e}function We(){return U}async function qe(e){return U.listTemplates(e)}async function Ye(e){return U.getTemplate(e)}exports.ApiKeyModal=se;exports.BillPreview=Ue;exports.ExportButton=Me;exports.Header=Fe;exports.LAYOUT_HDPI=N;exports.LAYOUT_LDPI=S;exports.LanguageToggle=ge;exports.PersonalInfoForm=Se;exports.PortraitUpload=Be;exports.TEMPLATES=le;exports.VoucherConfig=Re;exports.downloadBlob=pe;exports.drawContactInfo=he;exports.drawMultilineText=de;exports.drawOvalPortrait=ce;exports.drawTemplate=Y;exports.drawText=V;exports.enhancePortrait=De;exports.enhancePortraitFallback=ie;exports.exportBillAsPDF=me;exports.formatDescription=O;exports.generateBillPDF=ue;exports.getApiKey=R;exports.getDefaultTemplateId=Ke;exports.getLayout=W;exports.getTemplate=q;exports.getTemplateById=Ye;exports.getTemplateProvider=We;exports.hasApiKey=re;exports.listTemplates=qe;exports.loadImage=_;exports.removeBackground=oe;exports.renderBackSide=Z;exports.renderFrontSide=G;exports.setApiKey=ae;exports.setTemplateProvider=Oe;exports.staticTemplateProvider=fe;exports.t=C;exports.useBillCanvasRefs=$e;exports.useBillStore=b;
|