PageSourceSearch

https://www.visitcalgary.com/build/assets/SidebarToggle-DgUZaN14.js

js visitcalgary.com collected 2026-09-24 09:29:33 UTC 2,946 bytes, 1 lines download raw bytes

1import{r as l}from"./react-CWhrxVZv.js";import{l as y,c as E,u as d}from"./site-TON8n-Z4.js";import"./vendor-xwdJwoMt.js";import"./utils-6vEGO3Pw.js";function S(){const r=l.useRef(null),n=l.useRef(new Map);return l.useEffect(()=>{const i=document.querySelectorAll("[data-panel]"),u=e=>{e.stopPropagation();const c=e.currentTarget,s=c.dataset.panel,o=document.body;if(!s)return;const t=document.querySelector(`#${s}`);if(!t)return;const h=document.querySelectorAll(".sidebar-panel"),v=o.classList.contains("sidebar-open")&&t.classList.contains("active");if(n.current.forEach(a=>a()),n.current.clear(),h.forEach(a=>{a.classList.remove("active"),a.removeAttribute("data-state")}),v)o.classList.remove("sidebar-open"),d(),t.classList.remove("active"),t.removeAttribute("data-state"),r.current&&(r.current.focus(),r.current=null);else{o.classList.add("sidebar-open"),y(),t.classList.add("active"),t.setAttribute("data-state","open"),r.current=c;const a=E(t);n.current.set(t,a);const p=[...t.querySelectorAll('button:not([hidden]):not([disabled]), input:not([hidden]):not([disabled]), select:not([hidden]):not([disabled]), textarea:not([hidden]):not([disabled]), [href]:not([hidden]), [contenteditable]:not([hidden]), [tabindex]:not([tabindex="-1"]):not([hidden])')];p.length?p[0].focus():t.focus()}},b=e=>{const c=document.body;if(!c.classList.contains("sidebar-open"))return;const s=document.querySelector(".sidebar-panel.active");if(!s)return;const o=e.target;!s.contains(o)&&!Array.from(i).some(t=>t.contains(o))&&!e.target.closest("[data-sidebar-close]")&&(c.classList.remove("sidebar-open"),d(),document.querySelectorAll(".sidebar-panel").forEach(t=>{t.classList.remove("active"),t.removeAttribute("data-state")}),n.current.forEach(t=>t()),n.current.clear(),r.current&&(r.current.focus(),r.current=null))},f=e=>{e.stopPropagation();const c=document.body;if(!c.classList.contains("sidebar-open"))return;if(c.classList.remove("sidebar-open"),d(),document.querySelectorAll(".sidebar-panel").forEach(o=>{o.classList.remove("active"),o.removeAttribute("data-state")}),n.current.forEach(o=>o()),n.current.clear(),r.current&&(r.current.focus(),r.current=null),e.target instanceof Element&&e.target.closest("[data-sidebar-close]")){const o=document.getElementById("explore-archive");o?o.scrollIntoView({behavior:"smooth",block:"start"}):window.scrollTo({top:0,behavior:"smooth"})}},m=e=>{if(e.key.toLowerCase()==="escape"){if(!document.body.classList.contains("sidebar-open"))return;f(e)}};return i.forEach(e=>{e.addEventListener("click",u)}),document.addEventListener("click",b),document.addEventListener("click",e=>{e.target instanceof Element&&e.target.closest("[data-sidebar-close]")&&f(e)}),document.addEventListener("keydown",m),()=>{i.forEach(e=>{e.removeEventListener("click",u)}),document.removeEventListener("click",b),document.removeEventListener("keydown",m),n.current.forEach(e=>e()),n.current.clear()}},[]),null}export{S as SidebarToggle};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.