/**
* fsm/classic-menu — mobile hamburger toggle.
*
* The classic menu output doesn't include the wp-block-navigation
* responsive container, so we wire our own tiny toggle: click the
* hamburger to open/close the panel, Escape to dismiss. Pure
* progressive enhancement — without JS, the panel stays visible
* (CSS handles the desktop-default-visible state).
*/
( function () {
'use strict';
function init( root ) {
var toggle = root.querySelector( '[data-fsm-classic-menu-toggle]' );
var panel = root.querySelector( '[data-fsm-classic-menu-panel]' );
if ( ! toggle || ! panel ) {
return;
}
// Default to closed on init. CSS shows the panel on desktop
// regardless of this attribute; aria-hidden only carries meaning
// once the toggle is visible (mobile).
panel.setAttribute( 'aria-hidden', 'true' );
toggle.addEventListener( 'click', function ( e ) {
e.preventDefault();
var isOpen = root.classList.toggle( 'is-open' );
toggle.setAttribute( 'aria-expanded', isOpen ? 'true' : 'false' );
panel.setAttribute( 'aria-hidden', isOpen ? 'false' : 'true' );
} );
// Escape closes the menu and restores focus to the toggle.
document.addEventListener( 'keydown', function ( e ) {
if ( e.key === 'Escape' && root.classList.contains( 'is-open' ) ) {
root.classList.remove( 'is-open' );
toggle.setAttribute( 'aria-expanded', 'false' );
panel.setAttribute( 'aria-hidden', 'true' );
toggle.focus();
}
} );
// Click outside the menu closes it.
document.addEventListener( 'click', function ( e ) {
if ( ! root.classList.contains( 'is-open' ) ) {
return;
}
if ( root.contains( e.target ) ) {
return;
}
root.classList.remove( 'is-open' );
toggle.setAttribute( 'aria-expanded', 'false' );
panel.setAttribute( 'aria-hidden', 'true' );
} );
}
function boot() {
document.querySelectorAll( '[data-fsm-classic-menu]' ).forEach( init );
}
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', boot );
} else {
boot();
}
}() );
;
/**
* fsm/gallery-slideshow — frontend interactivity.
*
* Wires up the photo-gallery carousel rendered server-side by
* render_gallery_slideshow(): prev/next arrows, thumbnail clicks,
* caption sync, keyboard arrow-key nav, and the Fullscreen API.
*
* Progressive enhancement: without this script the viewport is still a
* usable scroll-snap slideshow. The script adds control-driven nav on top.
*
* Vanilla JS — no framework, no build step. Runs once on DOMContentLoaded.
*/
( function () {
'use strict';
function init( root ) {
var viewport = root.querySelector( '[data-fsm-gallery-viewport]' );
var slides = Array.prototype.slice.call( root.querySelectorAll( '.fsm-gallery__slide' ) );
var thumbs = Array.prototype.slice.call( root.querySelectorAll( '[data-fsm-gallery-thumb]' ) );
var captionEl = root.querySelector( '[data-fsm-gallery-caption]' );
var prevBtn = root.querySelector( '[data-fsm-gallery-prev]' );
var nextBtn = root.querySelector( '[data-fsm-gallery-next]' );
var fsBtn = root.querySelector( '[data-fsm-gallery-fullscreen]' );
var counterEl = root.querySelector( '[data-fsm-gallery-current]' );
var thumbsTrack = root.querySelector( '[data-fsm-gallery-thumbs]' );
var thumbsPrev = root.querySelector( '[data-fsm-gallery-thumbs-prev]' );
var thumbsNext = root.querySelector( '[data-fsm-gallery-thumbs-next]' );
if ( ! viewport || slides.length === 0 ) {
return;
}
var current = 0;
function updateActiveState( index ) {
current = index;
thumbs.forEach( function ( t, i ) {
var isActive = ( i === index );
if ( t.parentElement ) {
t.parentElement.classList.toggle( 'is-active', isActive );
}
t.setAttribute( 'aria-selected', isActive ? 'true' : 'false' );
} );
if ( captionEl && slides[ index ] ) {
// data-caption is sanitized server-side (wp_kses, safe inline
// tags only), so innerHTML renders
/ rather than
// printing them as text.
captionEl.innerHTML = slides[ index ].dataset.caption || '';
}
if ( counterEl ) {
counterEl.textContent = String( index + 1 );
}
// Keep the active thumb visible inside the thumbs strip.
var activeThumb = thumbs[ index ];
if ( activeThumb && thumbsTrack ) {
var thumbRect = activeThumb.getBoundingClientRect();
var trackRect = thumbsTrack.getBoundingClientRect();
if ( thumbRect.left < trackRect.left || thumbRect.right > trackRect.right ) {
activeThumb.scrollIntoView( { behavior: 'smooth', inline: 'center', block: 'nearest' } );
}
}
}
function scrollToSlide( index ) {
var target = slides[ index ];
if ( ! target ) {
return;
}
// Use scrollIntoView with inline:start — most reliable across browsers
// when the viewport is a horizontal scroller.
viewport.scrollTo( {
left: target.offsetLeft - viewport.offsetLeft,
behavior: 'smooth',
} );
}
function goTo( index ) {
if ( index < 0 ) {
index = slides.length - 1;
}
if ( index >= slides.length ) {
index = 0;
}
scrollToSlide( index );
updateActiveState( index );
}
// Arrow buttons.
if ( prevBtn ) {
prevBtn.addEventListener( 'click', function () { goTo( current - 1 ); } );
}
if ( nextBtn ) {
nextBtn.addEventListener( 'click', function () { goTo( current + 1 ); } );
}
// Thumbnail clicks.
thumbs.forEach( function ( btn ) {
btn.addEventListener( 'click', function () {
var idx = parseInt( btn.getAttribute( 'data-fsm-gallery-thumb' ), 10 );
if ( ! isNaN( idx ) ) {
goTo( idx );
}
} );
} );
// Thumb track scroll buttons.
if ( thumbsPrev && thumbsTrack ) {
thumbsPrev.addEventListener( 'click', function () {
thumbsTrack.scrollBy( { left: -240, behavior: 'smooth' } );
} );
}
if ( thumbsNext && thumbsTrack ) {
thumbsNext.addEventListener( 'click', function () {
thumbsTrack.scrollBy( { left: 240, behavior: 'smooth' } );
} );
}
// Fullscreen toggle.
if ( fsBtn ) {
fsBtn.addEventListener( 'click', function () {
if ( document.fullscreenElement === root ) {
document.exitFullscreen && document.exitFullscreen();
return;
}
if ( root.requestFullscreen ) {
root.requestFullscreen();
} else if ( root.webkitRequestFullscreen ) {
root.webkitRequestFullscreen();
}
} );
document.addEventListener( 'fullscreenchange', function () {
root.classList.toggle( 'is-fullscreen', document.fullscreenElement === root );
} );
}
// Keyboard: arrow keys when the gallery has focus.
root.addEventListener( 'keydown', function ( e ) {
if ( e.key === 'ArrowLeft' ) {
e.preventDefault();
goTo( current - 1 );
} else if ( e.key === 'ArrowRight' ) {
e.preventDefault();
goTo( current + 1 );
} else if ( e.key === 'Home' ) {
e.preventDefault();
goTo( 0 );
} else if ( e.key === 'End' ) {
e.preventDefault();
goTo( slides.length - 1 );
}
} );
// Keep active state in sync when the user scrolls/swipes the main
// viewport directly (touch, trackpad, native scroll-snap). Debounced.
var scrollTimer = null;
viewport.addEventListener( 'scroll', function () {
if ( scrollTimer ) {
clearTimeout( scrollTimer );
}
scrollTimer = setTimeout( function () {
var width = viewport.clientWidth;
if ( width === 0 ) {
return;
}
var index = Math.round( viewport.scrollLeft / width );
if ( index !== current && index >= 0 && index < slides.length ) {
updateActiveState( index );
}
}, 120 );
} );
// Initial paint — ensure caption/counter reflect slide 0 even if the
// server already rendered it. (Harmless no-op when already correct.)
updateActiveState( 0 );
}
function boot() {
var galleries = document.querySelectorAll( '[data-fsm-gallery]' );
galleries.forEach( init );
}
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', boot );
} else {
boot();
}
}() );
;
/*! This file is auto-generated */
(function() {
"use strict";var wp;(wp||={}).hooks=(()=>{var v=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var s in n)v(e,s,{get:n[s],enumerable:!0})},D=(e,n,s,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of g(n))!I.call(e,t)&&t!==s&&v(e,t,{get:()=>n[t],enumerable:!(r=S(n,t))||r.enumerable});return e};var T=e=>D(v({},"__esModule",{value:!0}),e);var le={};w(le,{actions:()=>ae,addAction:()=>J,addFilter:()=>K,applyFilters:()=>N,applyFiltersAsync:()=>ee,createHooks:()=>F,currentAction:()=>te,currentFilter:()=>re,defaultHooks:()=>b,didAction:()=>ie,didFilter:()=>se,doAction:()=>X,doActionAsync:()=>Y,doingAction:()=>ne,doingFilter:()=>oe,filters:()=>ce,hasAction:()=>P,hasFilter:()=>Q,removeAction:()=>L,removeAllActions:()=>U,removeAllFilters:()=>W,removeFilter:()=>M});function z(e){return typeof e!="string"||e===""?(console.error("The namespace must be a non-empty string."),!1):/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)?!0:(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}var m=z;function E(e){return typeof e!="string"||e===""?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)?!0:(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}var f=E;function Z(e,n){return function(r,t,a,i=10){let c=e[n];if(!f(r)||!m(t))return;if(typeof a!="function"){console.error("The hook callback must be a function.");return}if(typeof i!="number"){console.error("If specified, the hook priority must be a number.");return}let l={callback:a,priority:i,namespace:t};if(c[r]){let o=c[r].handlers,d;for(d=o.length;d>0&&!(i>=o[d-1].priority);d--);d===o.length?o[d]=l:o.splice(d,0,l),c.__current.forEach(h=>{h.name===r&&h.currentIndex>=d&&h.currentIndex++})}else c[r]={handlers:[l],runs:0};r!=="hookAdded"&&e.doAction("hookAdded",r,t,a,i)}}var H=Z;function C(e,n,s=!1){return function(t,a){let i=e[n];if(!f(t)||!s&&!m(a))return;if(!i[t])return 0;let c=0;if(s)c=i[t].handlers.length,i[t]={runs:i[t].runs,handlers:[]};else{let l=i[t].handlers;for(let o=l.length-1;o>=0;o--)l[o].namespace===a&&(l.splice(o,1),c++,i.__current.forEach(d=>{d.name===t&&d.currentIndex>=o&&d.currentIndex--}))}return t!=="hookRemoved"&&e.doAction("hookRemoved",t,a),c}}var p=C;function O(e,n){return function(r,t){let a=e[n];return typeof t<"u"?r in a&&a[r].handlers.some(i=>i.namespace===t):r in a}}var _=O;function j(e,n,s,r){return function(a,...i){let c=e[n];c[a]||(c[a]={handlers:[],runs:0}),c[a].runs++;let l=c[a].handlers;if(!l||!l.length)return s?i[0]:void 0;let o={name:a,currentIndex:0};async function d(){try{c.__current.add(o);let u=s?i[0]:void 0;for(;o.currentIndex"u"?t.__current.size>0:Array.from(t.__current).some(a=>a.name===r)}}var k=V;function q(e,n){return function(r){let t=e[n];if(f(r))return t[r]&&t[r].runs?t[r].runs:0}}var x=q;var B=class{actions;filters;addAction;addFilter;removeAction;removeFilter;hasAction;hasFilter;removeAllActions;removeAllFilters;doAction;doActionAsync;applyFilters;applyFiltersAsync;currentAction;currentFilter;doingAction;doingFilter;didAction;didFilter;constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=H(this,"actions"),this.addFilter=H(this,"filters"),this.removeAction=p(this,"actions"),this.removeFilter=p(this,"filters"),this.hasAction=_(this,"actions"),this.hasFilter=_(this,"filters"),this.removeAllActions=p(this,"actions",!0),this.removeAllFilters=p(this,"filters",!0),this.doAction=A(this,"actions",!1,!1),this.doActionAsync=A(this,"actions",!1,!0),this.applyFilters=A(this,"filters",!0,!1),this.applyFiltersAsync=A(this,"filters",!0,!0),this.currentAction=y(this,"actions"),this.currentFilter=y(this,"filters"),this.doingAction=k(this,"actions"),this.doingFilter=k(this,"filters"),this.didAction=x(this,"actions"),this.didFilter=x(this,"filters")}};function G(){return new B}var F=G;var b=F(),{addAction:J,addFilter:K,removeAction:L,removeFilter:M,hasAction:P,hasFilter:Q,removeAllActions:U,removeAllFilters:W,doAction:X,doActionAsync:Y,applyFilters:N,applyFiltersAsync:ee,currentAction:te,currentFilter:re,doingAction:ne,doingFilter:oe,didAction:ie,didFilter:se,actions:ae,filters:ce}=b;return T(le);})();
(window.wp ||= {}).hooks = wp.hooks;
})();
;