import{i as e,r as t}from"./main-v4-cG-pE7B4.js";import{t as a}from"./toast-DgCSlJPv.js";document.addEventListener("click",e=>{const t=e.target.closest(".tab");t&&(t.parentElement.querySelectorAll(".tab").forEach(e=>e.classList.remove("active")),t.classList.add("active"))});var n=document.getElementById("demo-pagination");n&&n.addEventListener("click",e=>{const t=e.target.closest(".page-btn");if(!t||t.disabled)return;e.stopPropagation(),e.preventDefault();const a=n.querySelectorAll('.page-btn[data-page]:not([data-page="prev"]):not([data-page="next"])');let o=Array.from(a).findIndex(e=>e.classList.contains("active"));o="prev"===t.dataset.page?Math.max(0,o-1):"next"===t.dataset.page?Math.min(a.length-1,o+1):Array.from(a).indexOf(t),a.forEach(e=>e.classList.remove("active")),a[o]&&a[o].classList.add("active"),n.querySelector('[data-page="prev"]').disabled=0===o,n.querySelector('[data-page="next"]').disabled=o===a.length-1});var o=document.getElementById("rating-demo"),r=document.getElementById("rating-label");function s(e){o.dataset.value=e,o.querySelectorAll("button").forEach(t=>{t.classList.toggle("on",parseInt(t.dataset.i,10)<=e)}),r&&(r.textContent=`${e} of 5 stars`)}s(parseInt(o.dataset.value,10)),o.addEventListener("click",e=>{const t=e.target.closest("button");t&&(e.stopPropagation(),s(parseInt(t.dataset.i,10)))}),document.getElementById("loading-btn").addEventListener("click",e=>{e.stopPropagation();const t=e.currentTarget;if("true"===t.getAttribute("aria-busy"))return;const n=t.querySelector(".btn-spinner"),o=t.querySelector("span:not(.btn-spinner)");t.setAttribute("aria-busy","true"),n.hidden=!1;const r=o.textContent;o.textContent="Saving…",setTimeout(()=>{t.setAttribute("aria-busy","false"),n.hidden=!0,o.textContent=r,a("Saved ✓",{variant:"success"})},1600)}),["dropdown-btn","open-dropdown-demo"].forEach(t=>{document.getElementById(t).addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),e(t.currentTarget,[{label:"Edit",action:()=>a("Edit")},{label:"Duplicate",action:()=>a("Duplicated")},{label:"Archive",action:()=>a("Archived")},"-",{label:"Delete",action:()=>a("Deleted",{variant:"error"})}])})}),document.getElementById("show-toast-demo").addEventListener("click",e=>{e.stopPropagation(),a("Hello! This is a default toast.")}),document.getElementById("show-toast-success").addEventListener("click",e=>{e.stopPropagation(),a("Saved successfully",{variant:"success"})}),document.getElementById("show-toast-error").addEventListener("click",e=>{e.stopPropagation(),a("Something went wrong",{variant:"error"})}),document.getElementById("open-modal-demo").addEventListener("click",e=>{e.stopPropagation(),t({title:"Confirm action",body:'<p style="font-size:13px;color:var(--text-secondary);line-height:1.6;margin:0">Modals support <strong>any HTML</strong>, focus trap, click-outside dismiss, Escape to close, and reduced-motion preferences. Try Tab and Shift+Tab to see focus stay inside.</p>',actions:[{label:"Cancel",variant:"outline"},{label:"Confirm",variant:"primary",action:()=>a("Confirmed",{variant:"success"})}]})});var i=document.getElementById("demo-drawer-backdrop"),d=document.getElementById("demo-drawer-right"),c=document.getElementById("demo-drawer-left"),l=e=>{e.classList.add("open"),e.setAttribute("aria-hidden","false"),i.classList.add("open")},p=()=>{[d,c].forEach(e=>{e.classList.remove("open"),e.setAttribute("aria-hidden","true")}),i.classList.remove("open")};document.getElementById("open-drawer-right").addEventListener("click",e=>{e.stopPropagation(),l(d)}),document.getElementById("open-drawer-left").addEventListener("click",e=>{e.stopPropagation(),l(c)}),i.addEventListener("click",p),document.addEventListener("click",e=>{e.target.closest("[data-drawer-close]")&&p()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&(d.classList.contains("open")||c.classList.contains("open"))&&p()}),document.querySelectorAll(".drawer .tag-input").forEach(e=>{const t=e.querySelector("input");e.addEventListener("click",a=>{a.target===e&&t.focus();const n=a.target.closest(".tag-pill button");n&&n.closest(".tag-pill").remove()})});