// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later
import{PopStateHandlers as b,setURLParam as I}from"../utils/utils.js";let o="bigint";try{BigInt(69)}catch(t){BigInt=Number,o="number"}const E=document.getElementById("output"),i=[document.getElementById("euro"),document.getElementById("mark"),document.getElementById("ost"),document.getElementById("schwarz")],g=[BigInt(1),BigInt(2),BigInt(4),BigInt(20)],y=/^(?:\d+|(?:\d+)?[,.]\d{1,2}|\d+[,.](?:\d{1,2})?)?$/,s=t=>/^0*$/.test(t);function a(t){if(typeof t=="string"&&(t=m(t)),typeof t!==o)return alert("Ungültiger Wert ".concat(t," mit type ").concat(typeof t)),null;typeof t=="number"&&(t=Math.floor(t));let n=t.toString();if(o==="number"&&n.includes("e")){const[l,u]=n.split("e");if(u.startsWith("-"))return"0";let[p,r]=l.split(".");r=r!=null?r:"",n=p+r+"0".repeat(parseInt(u)-r.length)}if(s(n))return"0";const e=n.slice(-2);return(n.slice(0,-2)||"0")+(s(e)?"":","+(e.length===1?"0":"")+e)}function m(t){if(s(t))return BigInt(0);let[n,e]=[t,"00"];return t.includes(",")?[n,e]=t.split(","):t.includes(".")&&([n,e]=t.split(".")),e.length!==2&&(e=(e+"00").slice(0,2)),BigInt(n+e)}b.currencyConverter=t=>{f(m(t.state.euro.toString()))};const c=(t,n)=>I("euro",t,{euro:t},"currencyConverter",n);function f(t,n=null){var e;c((e=a(t))!=null?e:"null",!1);for(let l=0;l<4;l++){const u=a(t*g[l]);i[l].placeholder=u!=null?u:"null",l!==n&&(i[l].value=u!=null?u:"null")}}const d=()=>{E.value=i[0].value+" Euro, das sind ja "+i[1].value+" Mark; "+i[2].value+" Ostmark und "+i[3].value+" Ostmark auf dem Schwarzmarkt!"};function B(t){var n;t.preventDefault();for(const e of i)e.value=(n=a(e.value))!=null?n:"null";c(i[0].value,!0),d()}for(let t=0;t<4;t++)i[t].oninput=()=>{for(const n of i)n.className="";if(!y.test(i[t].value)){i[t].className="invalid";return}f(m(i[t].value)/g[t],t),d()};for(const t of i)t.value=t.placeholder;document.getElementById("form").onsubmit=B;// @license-end
//# sourceMappingURL=converter.js.map
