import { Button, Card, Code, Window } from "@fefade/svelte"
let elCode: HTMLElement | undefined = $state()
let copied = $state(false)
function selectText(el: HTMLElement) {
const range = document.createRange()
range.selectNodeContents(el)
const sel = window.getSelection()
async function copyText(el: HTMLElement) {
await navigator.clipboard.writeText(String(el.textContent))
async function handleTextCopy() {
setTimeout(() => (copied = false), 2000)
<Window style="display: flex; flex-direction: column; gap: 1rem;">
<Card variant="contained">
<Code style="max-height: 200px;">
{@const contentFiltered = "content"
.filter((l) => l.trim() !== "")}
{#each contentFiltered as text, i (`${text}-${i}`)}
{@const isComment = text.startsWith("--")}
{@const muted = isComment ? "text-muted" : ""}
<Code.Item lineNumber={i} class={muted}>{text}</Code.Item>
style="align-self: flex-end;"
xmlns="http://www.w3.org/2000/svg"
<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
xmlns="http://www.w3.org/2000/svg"
d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"