{
  "version": 3,
  "sources": ["/cdn/shop/t/5/assets/creator-showcase.js?x=1"],
  "sourcesContent": ["/**\n * <creator-showcase> \u2014 zeigt mehrere Creator mit ihren YouTube-Channels.\n *\n * - Tab-Navigation oben, ein Creator-Panel sichtbar.\n * - Automatischer Wechsel nach einstellbarem Intervall (Pause bei Hover/Fokus).\n * - Profilbild + genaue Abonnentenzahl je Channel.\n *\n * Die Daten kommen aus einer statischen JSON-Datei (assets/creator-data.json),\n * die st\u00FCndlich per GitHub Action serverseitig aktualisiert wird. Dadurch ist\n * KEIN API-Key im Frontend sichtbar und es gibt zur Laufzeit keine YouTube-Aufrufe.\n */\n(() => {\n  /* Muss identisch zur Normalisierung im Fetch-Skript sein */\n  const normalizeKey = (raw) => {\n    if (!raw) return '';\n    let url = String(raw).trim();\n    if (url.startsWith('@')) return url.toLowerCase();\n    if (!/^https?:\\/\\//i.test(url)) url = 'https://' + url;\n    try {\n      const u = new URL(url);\n      return (u.hostname.replace(/^www\\./i, '') + u.pathname.replace(/\\/+$/, '')).toLowerCase();\n    } catch (e) {\n      return url.replace(/\\/+$/, '').toLowerCase();\n    }\n  };\n\n  /* Immer die genaue Zahl mit Tausendertrennzeichen */\n  const formatExact = (count) => {\n    const n = Number(count);\n    if (!isFinite(n)) return '\u2014';\n    return Math.round(n).toLocaleString('de-DE');\n  };\n\n  const prefersReduced = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n  class CreatorShowcase extends HTMLElement {\n    connectedCallback() {\n      if (this.initialized) return;\n      this.initialized = true;\n\n      this.dataUrl = this.dataset.dataUrl;\n      this.autoplay = this.dataset.autoplay === 'true';\n      this.interval = parseInt(this.dataset.interval, 10) || 6000;\n\n      this.cards = Array.from(this.querySelectorAll('[data-channel-url]'));\n      this.tabs = Array.from(this.querySelectorAll('[data-tab]'));\n      this.panels = Array.from(this.querySelectorAll('[data-panel]'));\n      this.current = 0;\n      this.timer = null;\n      this.paused = false;\n\n      this.bindTabs();\n      this.bindPause();\n      this.load();\n\n      // Autoplay erst starten, wenn die Section sichtbar ist\n      if ('IntersectionObserver' in window) {\n        this.io = new IntersectionObserver((entries) => {\n          this.inView = entries[0].isIntersecting;\n          this.inView ? this.startAutoplay() : this.stopAutoplay();\n        }, { threshold: 0.2 });\n        this.io.observe(this);\n      } else {\n        this.inView = true;\n        this.startAutoplay();\n      }\n\n      // Erstes Panel aktivieren (f\u00FCllt Karten/Z\u00E4hler)\n      this.activate(0, false);\n    }\n\n    bindTabs() {\n      this.tabs.forEach((tab) => {\n        tab.addEventListener('click', () => {\n          this.activate(Number(tab.dataset.tab), true);\n          this.restartAutoplay();\n        });\n      });\n    }\n\n    bindPause() {\n      const pause = () => { this.paused = true; this.stopAutoplay(); };\n      const resume = () => { this.paused = false; this.startAutoplay(); };\n      this.addEventListener('mouseenter', pause);\n      this.addEventListener('mouseleave', resume);\n      this.addEventListener('focusin', pause);\n      this.addEventListener('focusout', resume);\n    }\n\n    activate(index, animate) {\n      if (index < 0 || index >= this.panels.length) return;\n      this.current = index;\n\n      this.tabs.forEach((tab, i) => {\n        const active = i === index;\n        tab.classList.toggle('is-active', active);\n        tab.setAttribute('aria-selected', active ? 'true' : 'false');\n        if (active) this.retriggerProgress(tab);\n      });\n\n      this.panels.forEach((panel, i) => {\n        const active = i === index;\n        panel.classList.toggle('is-active', active);\n        if (active) panel.removeAttribute('hidden');\n        else panel.setAttribute('hidden', '');\n      });\n\n      this.revealPanel(this.panels[index]);\n    }\n\n    /* Fortschrittsbalken des aktiven Tabs neu starten (CSS-Animation) */\n    retriggerProgress(tab) {\n      const bar = tab.querySelector('.creator-tab__progress');\n      if (!bar) return;\n      bar.style.animation = 'none';\n      // Reflow erzwingen, damit die Animation neu startet\n      void bar.offsetWidth;\n      bar.style.animation = '';\n    }\n\n    /* Karten des Panels einblenden + Z\u00E4hler animieren */\n    revealPanel(panel) {\n      if (!panel) return;\n      const cards = Array.from(panel.querySelectorAll('[data-reveal]'));\n      cards.forEach((card) => {\n        card.classList.add('is-visible');\n        const subs = card.querySelector('[data-subs]');\n        const target = card._subsTarget;\n        if (subs && typeof target === 'number') this.countUp(subs, target);\n      });\n    }\n\n    async load() {\n      if (!this.dataUrl) return this.cards.forEach((c) => this.renderError(c));\n\n      let channels = {};\n      try {\n        const res = await fetch(this.dataUrl, { cache: 'no-cache' });\n        const data = await res.json();\n        channels = (data && data.channels) || {};\n      } catch (e) {\n        return this.cards.forEach((c) => this.renderError(c));\n      }\n\n      this.cards.forEach((card) => {\n        const info = channels[normalizeKey(card.dataset.channelUrl)];\n        if (info) this.renderChannel(card, info);\n        else this.renderError(card);\n      });\n\n      // Z\u00E4hler des aktuell sichtbaren Panels starten\n      this.revealPanel(this.panels[this.current]);\n    }\n\n    renderChannel(card, info) {\n      card.classList.remove('is-error');\n      card.classList.add('is-loaded');\n\n      const avatar = card.querySelector('[data-avatar]');\n      if (avatar && info.avatar) {\n        const img = document.createElement('img');\n        img.alt = info.title || '';\n        img.decoding = 'async';\n        img.referrerPolicy = 'no-referrer';\n        img.addEventListener('load', () => avatar.classList.add('has-image'));\n        img.addEventListener('error', () => card.classList.add('is-error'));\n        avatar.innerHTML = '';\n        avatar.appendChild(img);\n        img.src = info.avatar;\n      }\n\n      const name = card.querySelector('[data-name]');\n      if (name && info.title) name.textContent = info.title;\n\n      const subs = card.querySelector('[data-subs]');\n      if (subs) {\n        if (info.subscribers == null) {\n          subs.textContent = '\u2014';\n        } else {\n          card._subsTarget = Number(info.subscribers);\n          subs.textContent = formatExact(card._subsTarget);\n        }\n      }\n    }\n\n    renderError(card) {\n      card.classList.add('is-error', 'is-loaded');\n      const subs = card.querySelector('[data-subs]');\n      if (subs && subs.textContent === '') subs.textContent = '\u2014';\n    }\n\n    /* Animierte Hochz\u00E4hlung zur genauen Zahl */\n    countUp(el, target) {\n      if (prefersReduced()) {\n        el.textContent = formatExact(target);\n        return;\n      }\n      if (el._raf) cancelAnimationFrame(el._raf);\n      const duration = 1400;\n      const start = performance.now();\n      const step = (t) => {\n        const p = Math.min((t - start) / duration, 1);\n        const eased = 1 - Math.pow(1 - p, 3);\n        el.textContent = formatExact(Math.round(target * eased));\n        if (p < 1) el._raf = requestAnimationFrame(step);\n        else el.textContent = formatExact(target);\n      };\n      el._raf = requestAnimationFrame(step);\n    }\n\n    startAutoplay() {\n      this.stopAutoplay();\n      if (!this.autoplay || this.paused || !this.inView || this.panels.length < 2) return;\n      this.timer = setInterval(() => {\n        this.activate((this.current + 1) % this.panels.length, true);\n      }, this.interval);\n    }\n\n    stopAutoplay() {\n      if (this.timer) { clearInterval(this.timer); this.timer = null; }\n    }\n\n    restartAutoplay() {\n      this.startAutoplay();\n    }\n  }\n\n  if (!customElements.get('creator-showcase')) {\n    customElements.define('creator-showcase', CreatorShowcase);\n  }\n})();\n"],
  "mappings": "CAWC,IAAM,CAEL,MAAM,aAAgB,KAAQ,CAC5B,GAAI,CAAC,IAAK,MAAO,GACjB,IAAI,IAAM,OAAO,GAAG,EAAE,KAAK,EAC3B,GAAI,IAAI,WAAW,GAAG,EAAG,OAAO,IAAI,YAAY,EAC3C,gBAAgB,KAAK,GAAG,IAAG,IAAM,WAAa,KACnD,GAAI,CACF,MAAM,EAAI,IAAI,IAAI,GAAG,EACrB,OAAQ,EAAE,SAAS,QAAQ,UAAW,EAAE,EAAI,EAAE,SAAS,QAAQ,OAAQ,EAAE,GAAG,YAAY,CAC1F,MAAY,CACV,OAAO,IAAI,QAAQ,OAAQ,EAAE,EAAE,YAAY,CAC7C,CACF,EAGM,YAAe,OAAU,CAC7B,MAAM,EAAI,OAAO,KAAK,EACtB,OAAK,SAAS,CAAC,EACR,KAAK,MAAM,CAAC,EAAE,eAAe,OAAO,EADlB,QAE3B,EAEM,eAAiB,IAAM,OAAO,WAAW,kCAAkC,EAAE,QAEnF,MAAM,wBAAwB,WAAY,CACxC,mBAAoB,CACd,KAAK,cACT,KAAK,YAAc,GAEnB,KAAK,QAAU,KAAK,QAAQ,QAC5B,KAAK,SAAW,KAAK,QAAQ,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