{
  "version": 3,
  "sources": ["/cdn/shop/t/20/assets/kalia-motorized-hero.js?cb=23111"],
  "sourcesContent": ["/* Real KALIA installation footage. Load motion only when useful and visible. */\n(() => {\n  'use strict';\n  if (customElements.get('kalia-motorized-hero')) return;\n  class KaliaMotorizedHero extends HTMLElement {\n    connectedCallback() {\n      if (this._connected) return;\n      this._connected = true;\n      this._token = (this._token || 0) + 1;\n      this.video = this.querySelector('video');\n      this.button = this.querySelector('[data-kmh-toggle]');\n      this.label = this.querySelector('[data-kmh-label]');\n      if (!this.video || !this.button) return;\n      this._cleanups = [];\n      this._inView = false;\n      this._manualPause = false;\n      this._explicit = false;\n      this._blocked = false;\n      this._failed = false;\n      this._completed = false;\n      this._pending = false;\n      this._hasFrame = false;\n      this.video.muted = true;\n      this.video.defaultMuted = true;\n      this.video.playsInline = true;\n      this.video.loop = false;\n      this._motion = window.matchMedia('(prefers-reduced-motion: reduce)');\n      this._connection = navigator.connection;\n      const listen = (target, name, callback, options) => {\n        target.addEventListener(name, callback, options);\n        this._cleanups.push(() => target.removeEventListener(name, callback, options));\n      };\n      listen(this.button, 'click', () => {\n        if (this._pending || !this.video.paused) {\n          this._manualPause = true;\n          this._explicit = false;\n          this.stop();\n        } else {\n          this._manualPause = false;\n          this._explicit = true;\n          this._blocked = false;\n          if (this._completed) { this.video.currentTime = 0; this._completed = false; }\n          if (this._failed) { this._failed = false; this.video.load(); }\n          this.sync();\n        }\n      });\n      listen(this.video, 'playing', () => {\n        this._pending = false;\n        if (!this.wanted()) { this.stop(); return; }\n        this._hasFrame = true;\n        this.dataset.kmhFrame = 'true';\n        this.render();\n      });\n      listen(this.video, 'pause', () => this.render());\n      listen(this.video, 'ended', () => {\n        this._completed = true;\n        this._explicit = false;\n        this._pending = false;\n        this.render();\n      });\n      listen(this.video, 'error', () => {\n        this._failed = true;\n        this._blocked = true;\n        this._hasFrame = false;\n        delete this.dataset.kmhFrame;\n        this.stop();\n      });\n      listen(document, 'visibilitychange', () => this.sync());\n      listen(window, 'pageshow', () => this.sync());\n      const preference = () => { if (this.conserve()) this._explicit = false; this.sync(); };\n      if (this._motion.addEventListener) listen(this._motion, 'change', preference);\n      else { this._motion.addListener(preference); this._cleanups.push(() => this._motion.removeListener(preference)); }\n      if (this._connection?.addEventListener) listen(this._connection, 'change', preference);\n      if ('IntersectionObserver' in window) {\n        this._observer = new IntersectionObserver(entries => {\n          for (const entry of entries) if (entry.target === this) {\n            this._inView = entry.isIntersecting && entry.intersectionRatio >= 0.01;\n            this.sync();\n          }\n        }, {threshold: 0.01});\n        this._observer.observe(this);\n      } else {\n        const check = () => {\n          this._scrollTimer = null;\n          const rect = this.getBoundingClientRect();\n          this._inView = rect.bottom > 0 && rect.right > 0 && rect.top < window.innerHeight && rect.left < window.innerWidth;\n          this.sync();\n        };\n        const schedule = () => { if (!this._scrollTimer) this._scrollTimer = window.setTimeout(check, 120); };\n        listen(window, 'scroll', schedule, {passive: true});\n        listen(window, 'resize', schedule);\n        check();\n      }\n      this.button.hidden = false;\n      this.render();\n    }\n    conserve() { return this._motion.matches || Boolean(this._connection?.saveData) || ['slow-2g', '2g'].includes(this._connection?.effectiveType); }\n    wanted() { return this._connected && this._inView && !document.hidden && !this._manualPause && !this._blocked && !this._failed && !this._completed && (this._explicit || !this.conserve()); }\n    stop() {\n      this._token++;\n      this._pending = false;\n      if (!this.video.paused) this.video.pause();\n      this.render();\n    }\n    sync() {\n      if (!this._connected) return;\n      if (!this.wanted()) { this.stop(); return; }\n      if (this._pending || !this.video.paused) return;\n      if (!this.video.getAttribute('src')) {\n        try {\n          const mobile = window.matchMedia('(max-width: 700px)').matches;\n          const slow = this._connection?.effectiveType === '3g' || (this._connection?.downlink > 0 && this._connection.downlink < 1.5);\n          const source = new URL(((mobile || slow) && this.video.dataset.kmhMobileSrc) || this.video.dataset.kmhSrc, document.baseURI);\n          if (source.protocol !== 'https:' && !['localhost', '127.0.0.1'].includes(source.hostname)) throw new Error('invalid-media-source');\n          this.video.src = source.href;\n          this.video.load();\n        } catch (_) { this._failed = true; this.render(); return; }\n      }\n      const token = ++this._token;\n      this._pending = true;\n      this.render();\n      let promise;\n      try { promise = this.video.play(); } catch (error) { promise = Promise.reject(error); }\n      Promise.resolve(promise).then(() => {\n        if (!this._connected || token !== this._token) return;\n        this._pending = false;\n        if (!this.wanted()) this.stop();\n        else this.render();\n      }, () => {\n        if (!this._connected || token !== this._token) return;\n        this._pending = false;\n        this._blocked = true;\n        this.video.pause();\n        this.render();\n      });\n    }\n    render() {\n      if (!this._connected || !this.button) return;\n      const active = this._pending || (!this.video.paused && this.wanted());\n      const action = active ? 'Pause' : this._completed ? 'Replay' : 'Play';\n      this.dataset.kmhState = this._completed ? 'ended' : active ? 'playing' : this._hasFrame ? 'paused' : 'poster';\n      this.button.setAttribute('aria-label', `${action} motorized shade video`);\n      this.button.setAttribute('aria-pressed', String(active));\n      if (this.label) this.label.textContent = action;\n    }\n    disconnectedCallback() {\n      if (!this._connected) return;\n      this.stop();\n      this._connected = false;\n      this._observer?.disconnect();\n      window.clearTimeout(this._scrollTimer);\n      this._cleanups?.forEach(cleanup => cleanup());\n      this.video?.removeAttribute('src');\n      this.video?.load();\n      delete this.dataset.kmhFrame;\n      this.button.hidden = true;\n    }\n  }\n  customElements.define('kalia-motorized-hero', KaliaMotorizedHero);\n})();\n"],
  "mappings": "CACC,IAAM,CACL,aACA,GAAI,eAAe,IAAI,sBAAsB,EAAG,OAChD,MAAM,2BAA2B,WAAY,CAC3C,mBAAoB,CAOlB,GANI,KAAK,aACT,KAAK,WAAa,GAClB,KAAK,QAAU,KAAK,QAAU,GAAK,EACnC,KAAK,MAAQ,KAAK,cAAc,OAAO,EACvC,KAAK,OAAS,KAAK,cAAc,mBAAmB,EACpD,KAAK,MAAQ,KAAK,cAAc,kBAAkB,EAC9C,CAAC,KAAK,OAAS,CAAC,KAAK,QAAQ,OACjC,KAAK,UAAY,CAAC,EAClB,KAAK,QAAU,GACf,KAAK,aAAe,GACpB,KAAK,UAAY,GAC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