{"version":3,"file":"warenkorbStore.DF7ICO-v.mjs","names":["__esmMin","init_ssg_sandbox_shims","window","lesen","daten","KEY","p","speichern","positionen","EVENT","hinzufuegen","liste","vorhanden","x","menge","abonnieren","handler","e","callback","euro","FARBEN","init_warenkorbStore","n"],"sources":["https:/framerusercontent.com/modules/USdacz6ylpYBrIaetFm9/AwjZ6bZkD7BeH1P0efL5/warenkorbStore.js"],"sourcesContent":["const KEY=\"liveloud-warenkorb\";const EVENT=\"liveloud-warenkorb\";export function lesen(){if(typeof window===\"undefined\")return[];try{const daten=JSON.parse(window.localStorage.getItem(KEY)||\"[]\");return Array.isArray(daten)?daten.filter(p=>Number.isInteger(p?.rentmanId)&&p.menge>0):[];}catch{return[];}}export function speichern(positionen){if(typeof window===\"undefined\")return;try{window.localStorage.setItem(KEY,JSON.stringify(positionen));}catch{}window.dispatchEvent(new Event(EVENT));}export function hinzufuegen(p,menge=1){const liste=lesen();const vorhanden=liste.find(x=>x.rentmanId===p.rentmanId);if(vorhanden)vorhanden.menge=Math.min(100,vorhanden.menge+menge);else liste.push({...p,menge});speichern(liste);}export function abonnieren(callback){if(typeof window===\"undefined\")return()=>{};const handler=e=>{if(e.type===\"storage\"&&e.key!==KEY)return;callback();};window.addEventListener(EVENT,handler);window.addEventListener(\"storage\",handler);return()=>{window.removeEventListener(EVENT,handler);window.removeEventListener(\"storage\",handler);};}export const euro=n=>n.toLocaleString(\"de-DE\",{minimumFractionDigits:2,maximumFractionDigits:2})+\" €\";export const FARBEN={hintergrund:\"rgb(14, 14, 14)\",linie:\"rgb(51, 51, 51)\",text:\"rgb(255, 255, 255)\",grau:\"rgb(153, 153, 153)\",fehler:\"rgb(255, 120, 120)\"};\nexport const __FramerMetadata__ = {\"exports\":{\"abonnieren\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"euro\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"FARBEN\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hinzufuegen\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"speichern\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"lesen\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Position\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./warenkorbStore.map"],"mappings":"A,oGAAgE,SAAgBG,GAAO,CAAC,GAAUD,IAAS,OAAY,MAAM,CAAC,EAAE,GAAG,CAAC,IAAME,EAAM,KAAK,MAAMF,EAAO,aAAa,QAAQG,CAAG,GAAG,IAAI,EAAE,OAAO,MAAM,QAAQD,CAAK,EAAEA,EAAM,OAAO,GAAG,OAAO,UAAUE,GAAG,SAAS,GAAGA,EAAE,MAAM,CAAC,EAAE,CAAC,CAAE,MAAM,CAAC,MAAM,CAAC,CAAE,CAAC,CAAC,SAAgBC,EAAU,EAAW,CAAC,GAAUL,IAAS,OAAmB,IAAG,CAACA,EAAO,aAAa,QAAQG,EAAI,KAAK,UAAUG,CAAU,CAAC,CAAE,MAAM,CAAC,CAACN,EAAO,cAAc,IAAI,MAAMO,CAAK,CAAC,CAAtC,CAAwC,CAAC,SAAgBC,EAAY,EAAE,EAAM,EAAE,CAAC,IAAMC,EAAMR,EAAM,EAAQS,EAAUD,EAAM,KAAK,GAAGE,EAAE,YAAYP,EAAE,SAAS,EAAKM,EAAU,EAAU,MAAM,KAAK,IAAI,IAAIA,EAAU,MAAME,CAAK,EAAOH,EAAM,KAAK,CAAC,GAAGL,EAAE,OAAK,CAAC,EAAEC,EAAUI,CAAK,CAAE,CAAC,SAAgBI,EAAW,EAAS,CAAC,GAAUb,IAAS,OAAY,UAAU,CAAC,EAAE,IAAMc,EAAQ,GAAG,EAAIC,EAAE,OAAO,WAAWA,EAAE,MAAMZ,IAAWa,EAAS,CAAE,EAAoF,OAAlFhB,EAAO,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