import { SlIcon } from "./chunk.UZYAV5H6.js"; import { watch } from "./chunk.FA5RT4K4.js"; import { ShoelaceElement, e, n, r } from "./chunk.SEXBCYCU.js"; import { animated_image_styles_default } from "./chunk.RHRCOKU6.js"; import { x } from "./chunk.CXZZ2LVK.js"; import { __decorateClass } from "./chunk.KIILAQWQ.js"; // src/components/animated-image/animated-image.component.ts var SlAnimatedImage = class extends ShoelaceElement { constructor() { super(...arguments); this.isLoaded = false; } handleClick() { this.play = !this.play; } handleLoad() { const canvas = document.createElement("canvas"); const { width, height } = this.animatedImage; canvas.width = width; canvas.height = height; canvas.getContext("2d").drawImage(this.animatedImage, 0, 0, width, height); this.frozenFrame = canvas.toDataURL("image/gif"); if (!this.isLoaded) { this.emit("sl-load"); this.isLoaded = true; } } handleError() { this.emit("sl-error"); } handlePlayChange() { if (this.play) { this.animatedImage.src = ""; this.animatedImage.src = this.src; } } handleSrcChange() { this.isLoaded = false; } render() { return x`