{"version":3,"file":"client.mjs","names":["styles","html","_typeof","o","Symbol","iterator","constructor","prototype","toPropertyKey","t","i","r","e","toPrimitive","call","TypeError","String","Number","_defineProperty","Object","defineProperty","value","enumerable","configurable","writable","CreditTileBlackWeek","HTMLElement","_args","super","this","attachShadow","mode","window","matchMedia","_ref","_this$assignedSlot$pa","_this$assignedSlot","_this$parentElement","slotWidth","assignedSlot","parentElement","clientWidth","breakpoint","matches","setAttribute","removeAttribute","connectedCallback","root","innerHTML","updateLayout","addEventListener","updateCountdown","disconnectedCallback","removeEventListener","clearTimeout","timer","_countdown$boldDate","now","Date","text","querySelector","date","countdown","getFullYear","getMonth","getDate","boldDate","getCountdown","textContent","midnight","setTimeout","getTime","customElements","define"],"sources":["../app/countdown.ts","../app/client.ts"],"sourcesContent":["/** Campaign dates use the visitor's local calendar, like the existing campaign teaser. */\ninterface Countdown {\n  text: string;\n  boldDate?: string;\n}\n\nexport function getCountdown(now = new Date()): Countdown {\n  if (now.getFullYear() === 2026 && now.getMonth() === 10) {\n    switch (now.getDate()) {\n      case 28: return { text: \"Nur noch 3 Tage\" };\n      case 29: return { text: \"Nur noch heute & morgen\" };\n      case 30: return { text: \"Nur noch heute\" };\n    }\n  }\n  return { text: \"Nur bis \", boldDate: \"30.11.\" };\n}\n","import { getCountdown } from \"./countdown\";\nimport html from \"./kredite-teaser-widget.html?raw\";\nimport styles from \"./kredite-teaser-widget.scss?inline\";\n\nclass CreditTileBlackWeek extends HTMLElement {\n  private readonly root = this.attachShadow({ mode: \"closed\" });\n  private timer: ReturnType<typeof setTimeout> | undefined;\n  private readonly breakpoint = window.matchMedia(\"(min-width: 769px)\");\n  private readonly updateLayout = () => {\n    const slotWidth = this.assignedSlot?.parentElement?.clientWidth ??\n      this.parentElement?.clientWidth ?? this.clientWidth;\n    if (this.breakpoint.matches && slotWidth >= 400 && slotWidth <= 559) {\n      this.setAttribute(\"data-promotion\", \"top\");\n    } else {\n      this.removeAttribute(\"data-promotion\");\n    }\n  };\n\n  connectedCallback(): void {\n    this.root.innerHTML = `<style>${styles}</style>${html}`;\n    this.updateLayout();\n    window.addEventListener(\"resize\", this.updateLayout);\n    this.breakpoint.addEventListener(\"change\", this.updateLayout);\n    this.updateCountdown();\n  }\n\n  disconnectedCallback(): void {\n    window.removeEventListener(\"resize\", this.updateLayout);\n    this.breakpoint.removeEventListener(\"change\", this.updateLayout);\n    clearTimeout(this.timer);\n  }\n\n  private updateCountdown(): void {\n    const now = new Date();\n    const text = this.root.querySelector(\".countdown span\");\n    const date = this.root.querySelector(\".countdown strong\");\n    const countdown = getCountdown(now);\n    if (text) text.textContent = countdown.text;\n    if (date) date.textContent = countdown.boldDate ?? \"\";\n    const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);\n    this.timer = setTimeout(() => this.updateCountdown(), midnight.getTime() - now.getTime() + 50);\n  }\n}\n\ncustomElements.define(\"credit-tile-black-week\", CreditTileBlackWeek);\nexport default CreditTileBlackWeek;\n"],"mappings":"A,0pBCIA,IAAMyB,EAAN,cAAkCC,Y,8BAChCR,EAAAW,KAAA,OAAwBA,KAAKC,aAAa,CAAEC,KAAM,YAClDb,EAAAW,KAAA,aAAA,GACAX,EAAAW,KAAA,aAA8BG,OAAOC,WAAW,uBAChDf,EAAAW,KAAA,eAAA,K,YACE,MAAMS,EACgB,QADhBJ,EAA8C,QAA9CC,EAAiB,QAAjBC,EAAYP,KAAKU,oBAAA,IAAAH,GAAc,QAAdA,EAAAA,EAAcI,qBAAA,IAAAJ,OAAA,EAAAA,EAAeK,mBAAA,IAAAN,EAAAA,EAC7C,QAD6CE,EAClDR,KAAKW,qBAAA,IAAAH,OAAA,EAAAA,EAAeI,mBAAA,IAAAP,EAAAA,EAAeL,KAAKY,YACtCZ,KAAKa,WAAWC,SAAWL,GAAa,KAAOA,GAAa,IAC9DT,KAAKe,aAAa,iBAAkB,OAEpCf,KAAKgB,gBAAgB,mB,CAIzB,iBAAAC,GACEjB,KAAKkB,KAAKC,UAAY,8jC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