zumly 0.92.6 → 0.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/zumly.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * zumly
3
- * v.0.92.6
3
+ * v.0.97.0
4
4
  * Author Juan Martin Muda - Zumerlab
5
5
  * License MIT
6
6
  */
7
- (()=>{var Gt=s=>{throw TypeError(s)};var Zt=(s,t,e)=>t.has(s)||Gt("Cannot "+e);var x=(s,t,e)=>(Zt(s,t,"read from private field"),e?e.call(s):t.get(s)),M=(s,t,e)=>t.has(s)?Gt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),tt=(s,t,e,r)=>(Zt(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),ut=(s,t,e)=>(Zt(s,t,"access private method"),e);var et,St,Qt,_t=class{constructor(t={}){M(this,St);M(this,et,{});tt(this,et,t)}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(x(this,et),t)){let n=x(this,et)[t];return this.resolve(n,e)}switch(ut(this,St,Qt).call(this,t)){case"html":{let n=document.createElement("div");n.innerHTML=t.trim();let o=n.firstElementChild;if(!o)throw new Error("Zumly: view produced no element (html)");return o}case"url":{let n=new AbortController,o=setTimeout(()=>n.abort(),1e4),i;try{i=await fetch(t,{signal:n.signal})}finally{clearTimeout(o)}if(!i.ok)throw new Error(`Zumly: fetch failed for "${t}" (${i.status})`);let a=await i.text(),l=document.createElement("div");l.innerHTML=a.trim();let c=l.firstElementChild;if(!c)throw new Error("Zumly: view produced no element (url)");return c}case"function":{let n=e&&e.target||document.createElement("div"),o=await t({...e,target:n});if(typeof o=="string")return this.resolve(o,e);if(o instanceof HTMLElement)return o;let i=n.firstElementChild||n;return i.classList.contains("z-view")||i.classList.add("z-view"),i}case"object":{let n=await t.render(e);if(typeof n!="string")throw new Error("Zumly: view render() must return string");return this.resolve(n,e)}case"element":return t.cloneNode(!0);case"webcomponent":return await customElements.whenDefined(t),document.createElement(t);default:throw new Error("Zumly: unknown view type for source")}}};et=new WeakMap,St=new WeakSet,Qt=function(t){return typeof t=="function"?"function":t instanceof HTMLElement?"element":typeof t=="object"&&t!==null&&typeof t.render=="function"?"object":typeof t!="string"?"unknown":/^https?:\/\/|^\/|\.html$|\.php$/i.test(t)?"url":t.includes("<")?"html":t.includes("-")?"webcomponent":"unknown"};async function ht(s,t,e,r,n,o){if(!s||!s.classList){let i=document.createElement("div");i.classList.add("z-view"),s&&i.appendChild(s),s=i}else s.classList.contains("z-view")||s.classList.add("z-view");return s.dataset.viewName=t,s.getAttribute("aria-label")||s.setAttribute("aria-label",`View: ${t}`),s.style.transformOrigin="0 0",s.style.position="absolute",r?s.classList.add("is-current-view"):s.classList.add("is-new-current-view","has-no-events","hide"),e.append(s),typeof n[t]=="object"&&typeof n[t].mounted=="function"&&await n[t].mounted(),s}function z(s,t,e){t&&e==="welcome"&&console.info(`%c Zumly %c ${t}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),t&&s&&(e==="info"||e===void 0)&&console.info(`%c Zumly %c ${t}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),t&&e==="warn"&&console.warn(`%c Zumly %c ${t}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),t&&e==="error"&&console.error(`%c Zumly %c ${t}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function Jt(s,t){if(t.isValid=!1,!s||typeof s!="object"){z(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){z(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){z(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){z(!1,"'views' must be an object","error");return}t.views=s.views,t.isValid=!0,t.preload=Array.isArray(s.preload)?s.preload:[],t.debug=typeof s.debug=="boolean"?s.debug:!1,t.componentContext=s.componentContext&&typeof s.componentContext=="object"?s.componentContext:new Map;let e=s.transitions&&typeof s.transitions=="object"?s.transitions:null,r=e&&e.cover,n=typeof r=="string"?r.toLowerCase():null,o=n==="width"||n==="height";t.cover=o?n:"width",!o&&e&&r!==void 0&&z(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),t.duration=e&&typeof e.duration=="string"?e.duration:"1s",t.ease=e&&typeof e.ease=="string"?e.ease:"ease-in-out",t.deferred=typeof s.deferred=="boolean"?s.deferred:!1;let i=e&&e.hideTrigger;i===!0||i==="fade"?t.hideTrigger=i:(t.hideTrigger=!1,i!=null&&i!==!1&&z(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=e&&e.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?t.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?t.effects=[a[0],a[0]]:(t.effects=["none","none"],a!=null&&z(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let l=e&&e.driver,c=typeof l=="string"?l.toLowerCase():null,f=typeof l=="function"?l:null;if(c!==null){let d=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=d.includes(c)?c:"css",d.includes(c)||z(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${l}". Falling back to "css".`,"warn")}else f!==null?t.transitionDriver=f:t.transitionDriver="css";let u=e&&e.stagger;typeof u=="number"&&u>0?t.stagger=u:(t.stagger=0,u!=null&&u!==0&&z(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0;let h=s.lateralNav;if(h===!1)t.lateralNav=!1;else if(h&&typeof h=="object"){let d=typeof h.mode=="string"?h.mode.toLowerCase():null,g=d==="auto"||d==="always";d&&!g&&z(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let v=null;if(Array.isArray(h.siblings))v=h.siblings.filter(w=>typeof w=="string"&&w),v.length<2&&(z(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),v=null);else if(h.siblings&&typeof h.siblings=="object"){v={};for(let[w,b]of Object.entries(h.siblings))if(Array.isArray(b)){let _=b.filter(S=>typeof S=="string"&&S);_.length>=2&&(v[w]=_)}Object.keys(v).length===0&&(v=null)}else h.siblings!==void 0&&z(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:g?d:"auto",arrows:typeof h.arrows=="boolean"?h.arrows:!0,dots:typeof h.dots=="boolean"?h.dots:!0,keepAlive:h.keepAlive===!0||h.keepAlive==="visible"?h.keepAlive:!1,siblings:v}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let m=s.depthNav;if(m===!1)t.depthNav=!1;else if(m&&typeof m=="object"){let d=typeof m.position=="string"?m.position.toLowerCase():null,g=d==="bottom-left"||d==="top-left";d&&!g&&z(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:g?d:"bottom-left"}}else t.depthNav={position:"bottom-left"};let y=s.lateralNav&&typeof s.lateralNav=="object"?s.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let d=y==="bottom-center"||y==="top-center";y&&!d&&z(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=d?y:"bottom-center"}let p=s.inputs;p&&typeof p=="object"?t.inputs={wheel:typeof p.wheel=="boolean"?p.wheel:!0,keyboard:typeof p.keyboard=="boolean"?p.keyboard:!0,click:typeof p.click=="boolean"?p.click:!0,touch:typeof p.touch=="boolean"?p.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function te(s,t,e,r,n){let o=e/s,i=r/t;return n==="height"?{scale:i,scaleInv:1/i}:{scale:o,scaleInv:1/o}}function ee(s,t,e,r){let n=t.left,o=t.top,i=s.x-n+(s.width-e.width*r)/2,a=s.y-o+(s.height-e.height*r)/2;return`translate(${i}px, ${a}px) scale(${r})`}function se(s,t,e){let r=t.left,n=t.top,o=s.x-r+(s.width-e.width)/2,i=s.y-n+(s.height-e.height)/2;return`translate(${o}px, ${i}px)`}function re(s,t){let e=s.x+s.width/2-t.x,r=s.y+s.height/2-t.y;return`${e}px ${r}px`}function ne(s,t,e,r,n=0){let o=s.width/2-t.width/2-t.x+e.x,i=s.height/2-t.height/2-t.y+e.y,a=1-n,l=o*a,c=i*a;return{x:o,y:i,transform:`translate(${l}px, ${c}px) scale(${r})`}}function oe({canvasRect:s,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:r,lastViewZoomedElementRect:n,previousViewRectWithPreviousAtEndTransform:o,scale:i,preScale:a,parallax:l=0}){let c=t.left,f=t.top,u=s.width/2-e.width/2-e.x,h=s.height/2-e.height/2-e.y,m=u+(r.x-n.x)+o.x-c+(o.width-n.width)/2,y=h+(r.y-n.y)+o.y-f+(o.height-n.height)/2,p=1-Math.min(l*2,.9);return`translate(${m*p}px, ${y*p}px) scale(${i*a})`}function ie(s,t,e,r,n){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*n})`}function Tt(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function dt(s){let t=typeof s=="string"?s:"",e=t.match(/translate\s*\(\s*([-+\d.eE]+)px\s*,\s*([-+\d.eE]+)px\s*\)/);if(!e)return{tx:0,ty:0,rest:t.trim(),matched:!1};let r=t.replace(/translate\s*\([^)]+\)\s*/,"").trim();return{tx:parseFloat(e[1]),ty:parseFloat(e[2]),rest:r,matched:!0}}function mt(s){let t=dt(s),e=s.match(/scale\s*\(\s*([-+\d.eE]+)\s*\)/);return{tx:t.matched?t.tx:0,ty:t.matched?t.ty:0,scale:e?parseFloat(e[1]):1}}function Et(s,t,e,r,n,o,i,a,l,c){let f=t.x-e.x*(1-o)-r,u=t.y-e.y*(1-o)-n,h=t.width/o,m=t.height/o,y=f+e.x+(s.x-f-e.x-r)/o,p=u+e.y+(s.y-u-e.y-n)/o,d=s.width/o,g=s.height/o,v=f+i.x+a+c*(y-f-i.x),w=u+i.y+l+c*(p-u-i.y),b=d*c,_=g*c;return{x:v,y:w,width:b,height:_,left:v,top:w,right:v+b,bottom:w+_}}function pt(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function ae(s){return{detachedNode:s}}function le(s,t,e,r,n){let o=[];return t!==null&&o.push(t),e!==null&&o.push(e),r!==null&&o.push(r),n!==null&&o.push(n),{zoomLevel:s,views:o}}function ce(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var D,xt=class{constructor(){M(this,D,new Map)}set(t,e,r=null){x(this,D).set(t,{node:e,expires:r?Date.now()+r:null})}get(t){let e=x(this,D).get(t);return e?e.expires!==null&&Date.now()>e.expires?(x(this,D).delete(t),null):e.node.cloneNode(!0):null}has(t){let e=x(this,D).get(t);return e?e.expires!==null&&Date.now()>e.expires?(x(this,D).delete(t),!1):!0:!1}invalidate(t){x(this,D).delete(t)}clear(){x(this,D).clear()}};D=new WeakMap;var Re=300*1e3,qe=/^https?:\/\/|^\/|\.html$|\.php$/i,st,rt,nt,W,ot,fe,ue,Lt=class{constructor(t={}){M(this,ot);M(this,st);M(this,rt);M(this,nt);M(this,W,new Map);tt(this,nt,t),tt(this,st,new _t(t)),tt(this,rt,new xt)}async get(t,e=null){if(ut(this,ot,fe).call(this,t)){let r=x(this,rt).get(t);if(r)return r;if(x(this,W).has(t))return x(this,W).get(t);let n=(async()=>{try{let o=await x(this,st).resolve(t,e),i=x(this,nt)[t],a=ut(this,ot,ue).call(this,i);return x(this,rt).set(t,o,a),o}finally{x(this,W).delete(t)}})();return x(this,W).set(t,n),n}return x(this,st).resolve(t,e)}async preloadEager(t,e=null){!Array.isArray(t)||t.length===0||await Promise.all(t.map(r=>this.get(r,e)))}prefetch(t,e=null){this.get(t,e).catch(()=>{})}prefetchOnHover(t,e=null){this.prefetch(t,e)}scanAndPrefetch(t,e=null){if(!t||!t.querySelectorAll)return;t.querySelectorAll(".zoom-me[data-to]").forEach(n=>{let o=n.dataset.to;o&&(n.hasAttribute("role")||n.setAttribute("role","button"),n.hasAttribute("aria-label")||n.setAttribute("aria-label",`Zoom to ${o}`),this.prefetch(o,e))})}};st=new WeakMap,rt=new WeakMap,nt=new WeakMap,W=new WeakMap,ot=new WeakSet,fe=function(t){return typeof x(this,nt)[t]=="string"},ue=function(t){return qe.test(t)?Re:null};function it(s){s&&(s.style.contentVisibility="hidden")}function K(s){s&&(s.style.contentVisibility="visible")}function R(s){if(typeof s=="number"&&!Number.isNaN(s))return Math.max(0,s);let t=String(s).trim(),e=t.match(/^(\d*\.?\d+)\s*(ms|s)?$/i);if(!e)return typeof console<"u"&&console.warn(`[zumly] Could not parse duration "${t}" \u2014 falling back to 500ms.`),500;let r=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,r):Math.max(0,r*1e3)}function zt(s){return R(s)/1e3}function T(s,t){if(s.classList.contains("is-new-current-view")){let e=t.views[0].forwardState;s.classList.replace("is-new-current-view","is-current-view"),s.classList.remove("zoom-current-view","has-no-events"),s.style.transformOrigin=e.origin,s.style.transform=e.transform;return}if(s.classList.contains("is-previous-view")){let e=t.views[1].forwardState;s.classList.remove("zoom-previous-view","has-no-events"),s.style.transformOrigin=e.origin,s.style.transform=e.transform;return}if(s.classList.contains("is-last-view")){let e=t.views[2].forwardState;s.classList.remove("zoom-last-view","has-no-events"),s.style.transformOrigin=e.origin,s.style.transform=e.transform}}function Z(s,t){s.classList.remove("zoom-previous-view-reverse","has-no-events","has-effect","has-effect-reverse"),s.style.removeProperty("--z-effect-filter"),s.style.transformOrigin="0 0",s.style.transform=t.transform}function $(s,t){s.classList.remove("zoom-last-view-reverse","has-no-events","has-effect","has-effect-reverse"),s.style.removeProperty("--z-effect-filter"),s.style.transformOrigin=t.origin,s.style.transform=t.transform}function O(s,t){try{t&&t.removeChild(s)}catch{try{s.parentElement&&t.removeChild(s.parentElement)}catch{}}}function k(...s){for(let t of s)t&&(t.classList.remove("hide"),K(t))}function q(s,t){let{currentView:e,previousView:r,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:f}=s,u=c.views[0];k(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=u.forwardState.origin,e.style.transform=l||u.forwardState.transform,n&&o&&(n.style.transform=o.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||O(r,f),t()}var B=150;function V(s,t){let e=!1,r=setTimeout(()=>{e||(e=!0,s())},t);return{finish(){e||(e=!0,clearTimeout(r),s())},extend(n){e||(clearTimeout(r),r=setTimeout(()=>{e||(e=!0,s())},n))},safetyTimer:r}}function he(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function Be(s){if(!s||s==="none")return he();let t=String(s).match(/matrix\(([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+)\)/);return t?{a:parseFloat(t[1])||1,b:parseFloat(t[2])||0,c:parseFloat(t[3])||0,d:parseFloat(t[4])||1,e:parseFloat(t[5])||0,f:parseFloat(t[6])||0}:he()}function lt(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function at(s,t,e){return s+(t-s)*e}function ct(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:at(s.a,t.a,r),b:at(s.b,t.b,r),c:at(s.c,t.c,r),d:at(s.d,t.d,r),e:at(s.e,t.e,r),f:at(s.f,t.f,r)}}function F(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return Be(getComputedStyle(s).transform)}function me(s,t){let{type:e,currentView:r,previousView:n,lastView:o,currentStage:i,duration:a,ease:l,canvas:c}=s;if(!r||!n||!i){t();return}e==="lateral"?Ve(s,t):e==="zoomIn"?Xe(r,n,o,i,a,l,t):e==="zoomOut"?Ye(r,n,o,i,a,l,c,t):t()}function Ve(s,t){let{currentView:e,previousView:r,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:f,outgoingTransformEnd:u,currentStage:h,duration:m,ease:y,canvas:p}=s,d=R(m),g=h.views[0];k(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=g.forwardState.origin,n&&o&&(H(n,m,y,{"--lateral-from":o.transformStart,"--lateral-to":o.transformEnd}),n.classList.add("zoom-lateral-back")),i&&a&&(H(i,m,y,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(H(r,m,y,{"--lateral-out-from":f,"--lateral-out-to":u}),r.classList.add("zoom-lateral-out")),H(e,m,y,{"--lateral-in-from":l,"--lateral-in-to":c}),e.classList.add("zoom-lateral-in");let v=s.keepAlive==="visible"?[e]:[r,e];n&&o&&v.push(n),i&&a&&v.push(i);let w=v.length,b=d+B,_=new Set(["zoom-lateral-in","zoom-lateral-out","zoom-lateral-back"]),{finish:S,extend:A}=V(()=>{$t(v,N,I),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):O(r,p),n&&(n.classList.remove("zoom-lateral-back"),n.style.transform=o?.transformEnd||n.style.transform),i&&(i.classList.remove("zoom-lateral-back"),i.style.transform=a?.transformEnd||i.style.transform),e.classList.remove("zoom-lateral-in"),e.style.transform=c,t()},b);function I(L){L.target!==L.currentTarget||!_.has(L.animationName)||A(b)}function N(L){if(L.target!==L.currentTarget||!_.has(L.animationName))return;let X=L.currentTarget;X.removeEventListener("animationend",N),X.removeEventListener("animationstart",I),w--,w<=0&&S()}v.forEach(L=>{L.addEventListener("animationstart",I),L.addEventListener("animationend",N)})}function Xe(s,t,e,r,n,o,i){k(s,t,e);let a=r.stagger||0;H(s,n,o,{"--current-view-transform-start":r.views[0].backwardState.transform,"--current-view-transform-end":r.views[0].forwardState.transform}),a>0&&s.style.setProperty("animation-delay","0ms"),H(t,n,o,{"--previous-view-transform-start":r.views[1].backwardState.transform,"--previous-view-transform-end":r.views[1].forwardState.transform}),a>0&&t.style.setProperty("animation-delay",`${a}ms`),e&&(H(e,n,o,{"--last-view-transform-start":r.views[2].backwardState.transform,"--last-view-transform-end":r.views[2].forwardState.transform}),a>0&&e.style.setProperty("animation-delay",`${a*2}ms`)),s.classList.add("zoom-current-view"),t.classList.add("zoom-previous-view"),e&&e.classList.add("zoom-last-view");let l=e?[s,t,e]:[s,t],c=l.length,f=R(n),u=e?a*2:a,h=f+u+B,m=new Set(["zoom-current-view","zoom-previous-view","zoom-last-view"]),{finish:y,extend:p}=V(()=>{$t(l,g,d),l.forEach(v=>v.style.removeProperty("animation-delay")),l.forEach(v=>{if(v?.isConnected)try{T(v,r)}catch{}}),i()},h);function d(v){v.target!==v.currentTarget||!m.has(v.animationName)||p(h)}function g(v){if(v.target!==v.currentTarget||!m.has(v.animationName))return;let w=v.currentTarget;if(w.removeEventListener("animationend",g),w.removeEventListener("animationstart",d),w.isConnected)try{T(w,r)}catch{}c--,c<=0&&y()}l.forEach(v=>{v.addEventListener("animationstart",d),v.addEventListener("animationend",g)})}function Ye(s,t,e,r,n,o,i,a){let l=r.views[0],c=r.views[1],f=e&&r.views[2]?r.views[2]:null,u=r.stagger||0;H(s,n,o,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),u>0&&s.style.setProperty("animation-delay","0ms"),H(t,n,o,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),u>0&&t.style.setProperty("animation-delay",`${u}ms`),e&&f&&(H(e,n,o,{"--last-view-transform-start":f.backwardState.transform,"--last-view-transform-end":f.forwardState.transform}),u>0&&e.style.setProperty("animation-delay",`${u*2}ms`)),s.classList.add("zoom-current-view-reverse"),t.classList.add("zoom-previous-view-reverse"),e&&e.classList.add("zoom-last-view-reverse");let h=e?[s,t,e]:[s,t],m=h.length,y=R(n),p=e?u*2:u,d=y+p+B,g=new Set(["zoom-current-view-reverse","zoom-previous-view-reverse","zoom-last-view-reverse"]),{finish:v,extend:w}=V(()=>{$t(h,_,b),h.forEach(S=>S.style.removeProperty("animation-delay")),h.forEach(S=>{if(S?.isConnected)try{de(S,r,i)}catch{}}),a()},d);function b(S){S.target!==S.currentTarget||!g.has(S.animationName)||w(d)}function _(S){if(S.target!==S.currentTarget||!g.has(S.animationName))return;let A=S.currentTarget;if(A.removeEventListener("animationend",_),A.removeEventListener("animationstart",b),A.isConnected)try{de(A,r,i)}catch{}m--,m<=0&&v()}h.forEach(S=>{S.addEventListener("animationstart",b),S.addEventListener("animationend",_)})}function de(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){O(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){Z(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&$(s,t.views[2].backwardState)}function H(s,t,e,r){s.style.setProperty("--zoom-duration",t),s.style.setProperty("--zoom-ease",e);for(let[n,o]of Object.entries(r))s.style.setProperty(n,o)}function $t(s,t,e){for(let r of s)r?.removeEventListener&&(r.removeEventListener("animationend",t),r.removeEventListener("animationstart",e))}function pe(s,t){let{type:e,currentView:r,previousView:n,lastView:o,currentStage:i,canvas:a}=s;if(!r||!n||!i){t();return}if(e==="lateral"){q(s,t);return}if(e==="zoomIn"){k(r,n,o),T(r,i),T(n,i),o&&T(o,i),t();return}if(e==="zoomOut"){O(r,a),k(n,o),Z(n,i.views[1].backwardState),o&&$(o,i.views[2].backwardState),t();return}t()}function ve(s,t){let{type:e,currentView:r,previousView:n,lastView:o,currentStage:i,duration:a,ease:l,canvas:c}=s;if(!r||!n||!i){t();return}let f=R(a);if(e==="lateral"){Ke(s,f,l,t);return}if(e==="zoomIn"){Ue(r,n,o,i,f,l,t);return}if(e==="zoomOut"){We(r,n,o,i,f,l,c,t);return}t()}function Ue(s,t,e,r,n,o,i){k(s,t,e);let a=r.views[0],l=r.views[1],c=e&&r.views[2]?r.views[2]:null;s.style.transformOrigin=a.backwardState.origin,s.style.transform=a.backwardState.transform,t.style.transformOrigin=l.backwardState.origin,t.style.transform=l.backwardState.transform,c&&(e.style.transformOrigin=c.backwardState.origin,e.style.transform=c.backwardState.transform);let f=r.stagger||0,u=[];u.push(s.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:n,easing:o,fill:"forwards"})),u.push(t.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:n,delay:f,easing:o,fill:"forwards"})),c&&u.push(e.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:n,delay:f*2,easing:o,fill:"forwards"}));let h=c?f*2:f,{finish:m}=V(()=>{Mt(u);try{T(s,r),T(t,r),e&&T(e,r)}catch{}i()},n+h+B);Promise.all(u.map(y=>y.finished)).then(m).catch(m)}function We(s,t,e,r,n,o,i,a){let l=r.views[0],c=r.views[1],f=e&&r.views[2]?r.views[2]:null,u=c.backwardState,h=f?f.backwardState:null;s.style.transformOrigin=l.forwardState.origin,s.style.transform=l.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=c.forwardState.origin,e&&f&&(e.style.transformOrigin=f.forwardState.origin);let m=t.style.transform||getComputedStyle(t).transform||c.forwardState.transform,y=e&&f?e.style.transform||getComputedStyle(e).transform||f.forwardState.transform:null,p=r.stagger||0,d=[];d.push(s.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:n,easing:o,fill:"forwards"})),d.push(t.animate([{transform:m},{transform:u.transform}],{duration:n,delay:p,easing:o,fill:"both"})),e&&h&&d.push(e.animate([{transform:y},{transform:h.transform}],{duration:n,delay:p*2,easing:o,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let g=e&&h?p*2:p,{finish:v}=V(()=>{Mt(d);try{O(s,i),Z(t,u),e&&h&&$(e,h)}catch{}a()},n+g+B);Promise.all(d.map(w=>w.finished)).then(v).catch(v)})})}function Ke(s,t,e,r){let{currentView:n,previousView:o,backView:i,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:f,incomingTransformEnd:u,outgoingTransform:h,outgoingTransformEnd:m,currentStage:y,canvas:p}=s,d=y.views[0];k(n),n.classList.replace("is-new-current-view","is-current-view"),n.classList.remove("zoom-current-view","has-no-events"),n.style.transformOrigin=d.forwardState.origin;let g=[];g.push(n.animate([{transform:f,opacity:0},{transform:u,opacity:1}],{duration:t,easing:e,fill:"forwards"})),s.keepAlive!=="visible"&&g.push(o.animate([{transform:h,opacity:1},{transform:m,opacity:0}],{duration:t,easing:e,fill:"forwards"})),i&&a&&g.push(i.animate([{transform:a.transformStart},{transform:a.transformEnd}],{duration:t,easing:e,fill:"forwards"})),l&&c&&g.push(l.animate([{transform:c.transformStart},{transform:c.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:v}=V(()=>{Mt(g),n.style.transform=u||d.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),s.keepAlive?(o.style.opacity="",o.style.transform=m):O(o,p),r()},t+B);Promise.all(g.map(w=>w.finished)).then(v).catch(v)}function Mt(s){for(let t of s)try{t.cancel()}catch{}}function ye(s,t){let e=typeof globalThis<"u"&&globalThis.anime;if(!e||typeof e!="function"){console.warn('Zumly anime driver: Anime.js not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.2/anime.min.js"><\/script>'),t();return}let{type:r,currentView:n,previousView:o,lastView:i,currentStage:a,duration:l,ease:c,canvas:f}=s;if(!n||!o||!a){t();return}let u=R(l);r==="lateral"?q(s,t):r==="zoomIn"?Ge(e,n,o,i,a,u,c,t):r==="zoomOut"?Qe(e,n,o,i,a,u,c,f,t):t()}function Ge(s,t,e,r,n,o,i,a){k(t,e,r);let l=n.views[0],c=n.views[1],f=r&&n.views[2]?n.views[2]:null,u=we([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:c.backwardState,forward:c.forwardState},...f?[{el:r,backward:f.backwardState,forward:f.forwardState}]:[]],"forward");ge(u,0);let h=n.stagger||0,m=o+(f?h*2:h),y={value:0};s({targets:y,value:1,duration:m,easing:_e(i),update:()=>{let p=y.value*m;be(u,p,o,h)},complete:()=>{T(t,n),T(e,n),r&&T(r,n),a()}})}function Qe(s,t,e,r,n,o,i,a,l){let c=n.views[0],f=n.views[1],u=r&&n.views[2]?n.views[2]:null,h=f.backwardState,m=u?u.backwardState:null,y=we([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:f.backwardState,forward:f.forwardState},...u?[{el:r,backward:u.backwardState,forward:u.forwardState}]:[]],"backward");ge(y,0);let p=n.stagger||0,d=o+(u?p*2:p),g={value:0};s({targets:g,value:1,duration:d,easing:_e(i),update:()=>{let v=g.value*d;be(y,v,o,p)},complete:()=>{O(t,a),Z(e,h),r&&m&&$(r,m),l()}})}function we(s,t){return s.map(({el:e,backward:r,forward:n})=>{if(t==="forward"){let o=F(e,r.origin,r.transform),i=F(e,r.origin,n.transform);return{el:e,from:o,to:i}}else{let o=F(e,n.origin,n.transform),i=F(e,n.origin,r.transform);return{el:e,from:o,to:i}}})}function ge(s,t){for(let{el:e,from:r,to:n}of s)e.style.transform=lt(ct(r,n,t))}function be(s,t,e,r){for(let n=0;n<s.length;n++){let{el:o,from:i,to:a}=s[n],l=n*r,c=Math.max(0,t-l),f=e>0?Math.min(1,c/e):1;o.style.transform=lt(ct(i,a,f))}}function _e(s){if(typeof s!="string")return"easeInOutQuad";let t=s.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOutQuad":t.includes("ease-in")?"easeInQuad":t.includes("ease-out")?"easeOutQuad":t}function Se(s,t){let e=typeof globalThis<"u"&&globalThis.gsap;if(!e||typeof e.to!="function"){console.warn('Zumly GSAP driver: GSAP not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"><\/script>'),t();return}let{type:r,currentView:n,previousView:o,lastView:i,currentStage:a,duration:l,ease:c,canvas:f}=s;if(!n||!o||!a){t();return}let u=zt(l);r==="lateral"?q(s,t):r==="zoomIn"?Je(e,n,o,i,a,u,c,t):r==="zoomOut"?ts(e,n,o,i,a,u,c,f,t):t()}function Je(s,t,e,r,n,o,i,a){k(t,e,r);let l=n.views[0],c=n.views[1],f=r&&n.views[2]?n.views[2]:null;kt(t,l.backwardState),kt(e,c.backwardState),f&&kt(r,f.backwardState);let u=s.timeline({onComplete:()=>{T(t,n),T(e,n),r&&T(r,n),a()}}),h=Te(i),m=(n.stagger||0)/1e3;u.to(t,{transform:l.forwardState.transform,duration:o,ease:h},0),u.to(e,{transform:c.forwardState.transform,duration:o,ease:h},m),f&&u.to(r,{transform:f.forwardState.transform,duration:o,ease:h},m*2)}function ts(s,t,e,r,n,o,i,a,l){let c=n.views[0],f=n.views[1],u=r&&n.views[2]?n.views[2]:null,h=f.backwardState,m=u?u.backwardState:null;kt(t,c.forwardState);let y=e.style.transform||getComputedStyle(e).transform||f.forwardState.transform,p=r&&u?r.style.transform||getComputedStyle(r).transform||u.forwardState.transform:null;e.style.transformOrigin=f.forwardState.origin,r&&u&&(r.style.transformOrigin=u.forwardState.origin);let d=Te(i),g=s.timeline({onComplete:()=>{O(t,a),Z(e,h),r&&m&&$(r,m),l()}}),v=(n.stagger||0)/1e3;s.set(e,{transform:y}),r&&p&&s.set(r,{transform:p}),g.fromTo(t,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:o,ease:d},0),g.fromTo(e,{transform:y},{transform:h.transform,duration:o,ease:d},v),r&&m&&g.fromTo(r,{transform:p},{transform:m.transform,duration:o,ease:d},v*2)}function kt(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function Te(s){if(typeof s!="string")return"power2.inOut";let t=s.toLowerCase();return t==="linear"?"none":t.includes("ease-in-out")?"power2.inOut":t.includes("ease-in")?"power2.in":t.includes("ease-out")?"power2.out":t}function Ee(s,t){let e=rs();if(!e||typeof e!="function"){console.warn('Zumly Motion driver: Motion not loaded. Add <script src="https://cdn.jsdelivr.net/npm/motion@11/dist/motion.min.js"><\/script>'),t();return}let{type:r,currentView:n,previousView:o,lastView:i,currentStage:a,duration:l,ease:c,canvas:f}=s;if(!n||!o||!a){t();return}let u=zt(l);r==="lateral"?q(s,t):r==="zoomIn"?es(e,n,o,i,a,u,c,t):r==="zoomOut"?ss(e,n,o,i,a,u,c,f,t):t()}function es(s,t,e,r,n,o,i,a){k(t,e,r);let l=xe(t,e,r,n,"forward");Le(l,0);let c=n.stagger||0,f=c/1e3,u=o*1e3,h=o+(l.length>2?f*2:f);s(0,1,{duration:h,ease:ke(i),onUpdate:y=>{let p=y*h*1e3;ze(l,p,u,c)}}).then(()=>{T(t,n),T(e,n),r&&T(r,n),a()}).catch(()=>a())}function ss(s,t,e,r,n,o,i,a,l){let c=n.views[1],f=r&&n.views[2]?n.views[2]:null,u=c.backwardState,h=f?f.backwardState:null,m=xe(t,e,r,n,"backward");Le(m,0);let y=n.stagger||0,p=y/1e3,d=o*1e3,g=o+(m.length>2?p*2:p);s(0,1,{duration:g,ease:ke(i),onUpdate:w=>{let b=w*g*1e3;ze(m,b,d,y)}}).then(()=>{O(t,a),Z(e,u),r&&h&&$(r,h),l()}).catch(()=>l())}function xe(s,t,e,r,n){let o=r.views[0],i=r.views[1],a=e&&r.views[2]?r.views[2]:null,l=[{el:s,backward:o.backwardState,forward:o.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&l.push({el:e,backward:a.backwardState,forward:a.forwardState}),l.map(({el:c,backward:f,forward:u})=>n==="forward"?{el:c,from:F(c,f.origin,f.transform),to:F(c,f.origin,u.transform)}:{el:c,from:F(c,u.origin,u.transform),to:F(c,u.origin,f.transform)})}function Le(s,t){for(let{el:e,from:r,to:n}of s)e.style.transform=lt(ct(r,n,t))}function ze(s,t,e,r){for(let n=0;n<s.length;n++){let{el:o,from:i,to:a}=s[n],l=n*r,c=Math.max(0,t-l),f=e>0?Math.min(1,c/e):1;o.style.transform=lt(ct(i,a,f))}}function rs(){let s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return s.motion?.animate||s.Motion?.animate||s.animate}function ke(s){if(typeof s!="string")return"easeInOut";let t=s.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOut":t.includes("ease-in")?"easeIn":t.includes("ease-out")?"easeOut":s}var Ce={css:me,waapi:ve,none:pe,anime:ye,gsap:Se,motion:Ee};function Oe(s){if(typeof s=="function")return{runTransition(r,n){s(r,n)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:Ce[t]||Ce.css}}function ns(s){if(typeof s!="string"||s.trim()==="")return{tx:0,ty:0,rest:""};let t=dt(s);return t.matched?{tx:t.tx,ty:t.ty,rest:t.rest}:null}function Dt(s,t,e){let r=ns(s);if(r===null)return s;let n=r.tx*t,o=r.ty*e,i=r.rest?` ${r.rest}`:"";return`translate(${n}px, ${o}px)${i}`.trim()}function os(s){if(typeof s!="string"||!s.trim())return null;let t=s.trim().match(/^([-\d.eE]+)px\s+([-\d.eE]+)px$/);return t?{x:parseFloat(t[1]),y:parseFloat(t[2])}:null}function Ft(s,t,e){let r=os(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function Ht(s,t,e,r,n){if(!s.storedViews?.length||!s.canvas||t<=0||e<=0)return;let o=r/t,i=n/e;for(let m of s.storedViews){let y=m.views;if(Array.isArray(y))for(let p=0;p<y.length;p++){let d=y[p];!d||d.detachedNode||(d.backwardState&&(d.backwardState.transform=Dt(d.backwardState.transform,o,i),d.backwardState.origin!=null&&(d.backwardState.origin=Ft(d.backwardState.origin,o,i))),d.forwardState&&(d.forwardState.transform=Dt(d.forwardState.transform,o,i),d.forwardState.origin!=null&&(d.forwardState.origin=Ft(d.forwardState.origin,o,i))))}}let a=s.canvas,l=a.querySelector(".is-current-view"),c=a.querySelector(".is-previous-view"),f=a.querySelector(".is-last-view"),u=a.querySelector(".is-new-current-view"),h=[l,c,f,u].filter(Boolean);for(let m of h){if(!m.style)continue;let y=m.style.transform;y!=null&&y!==""&&(m.style.transform=Dt(y,o,i));let p=m.style.transformOrigin;p!=null&&p!==""&&(m.style.transformOrigin=Ft(p,o,i))}}var is=8e3,yt=class{constructor(t){if(this.storedViews=[],this.currentStage=null,this.debug=!1,this.trace=[],this.blockEvents=!1,this._blockEventsSafetyTimer=null,this.touchstartX=0,this.touchstartY=0,this.touchendX=0,this.touchendY=0,this.touching=!1,this.lateralHistory=[],this._lastCanvasWidth=0,this._lastCanvasHeight=0,this._pendingResizeCorrection=!1,this._destroyed=!1,this._trackedTimers=new Set,this._pendingTransitionComplete=null,this._hooks={},this._plugins=[],Jt(t,this),!this.isValid){this.notify("is unable to start: invalid or missing required options (mount, initialView, views).","error");return}if(this.canvas=document.querySelector(this.mount),!this.canvas){this.notify(`mount selector "${this.mount}" did not match any element.`,"error"),this.isValid=!1;return}this.transitionDriver=Oe(this.transitionDriver),this._onZoom=this.onZoom.bind(this),this._onTouchStart=this.onTouchStart.bind(this),this._onTouchEnd=this.onTouchEnd.bind(this),this._onTouchCancel=()=>{this.touching=!1},this._onKeyUp=this.onKeyUp.bind(this),this._onWheel=this.onWheel.bind(this),this._wheelCooldown=!1,this._onPrefetchTrigger=e=>{e.target.classList.contains("zoom-me")&&e.target.dataset.to&&this.prefetcher.prefetch(e.target.dataset.to,{trigger:e.target,...e.target.dataset})},this._onResize=this._handleResize.bind(this),this._resizeDebounceTimer=null,this._RESIZE_DEBOUNCE_MS=80,this.prefetcher=new Lt(this.views),this._bindEvents()}_bindEvents(){let t=this.canvas;t&&(t.setAttribute("tabindex","0"),t.setAttribute("role","application"),t.setAttribute("aria-roledescription","zoomable interface"),t.setAttribute("aria-live","polite"),t.addEventListener("mouseup",this._onZoom,!1),t.addEventListener("touchend",this._onZoom,!1),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,!1),t.addEventListener("touchcancel",this._onTouchCancel,{passive:!0}),t.addEventListener("keyup",this._onKeyUp,!1),t.addEventListener("wheel",this._onWheel,{passive:!1}),t.addEventListener("mouseover",this._onPrefetchTrigger,{passive:!0}),t.addEventListener("focusin",this._onPrefetchTrigger,{passive:!0}),window.addEventListener("resize",this._onResize,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._handleResize()),this._resizeObserver.observe(t)))}_unbindEvents(){let t=this.canvas;t&&(t.removeEventListener("mouseup",this._onZoom,!1),t.removeEventListener("touchend",this._onZoom,!1),t.removeEventListener("touchstart",this._onTouchStart),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchCancel),t.removeEventListener("keyup",this._onKeyUp,!1),t.removeEventListener("wheel",this._onWheel),t.removeEventListener("mouseover",this._onPrefetchTrigger),t.removeEventListener("focusin",this._onPrefetchTrigger)),window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}_resetCanvasScroll(t){if(t&&((t.scrollLeft!==0||t.scrollTop!==0)&&(this.notify(`canvas had a residual scroll (${t.scrollLeft}, ${t.scrollTop}) \u2014 resetting. Something scrolled the canvas mid-transition.`,"warn"),t.scrollLeft=0,t.scrollTop=0),!this._warnedScrolledAncestor)){for(let e=t.parentElement;e&&e!==document.body;e=e.parentElement)if(e.scrollLeft!==0||e.scrollTop!==0){let r=e.className?`.${String(e.className).trim().split(/\s+/).join(".")}`:e.tagName.toLowerCase();this.notify(`an ancestor of the canvas (${r}) is scrolled (${e.scrollLeft}, ${e.scrollTop}): all zooms will land displaced. Use 'overflow: clip' (not 'hidden') on containers around the canvas.`,"warn"),this._warnedScrolledAncestor=!0;break}}}_setBlockEvents(){this.blockEvents=!0,this._clearBlockEventsSafety(),this._blockEventsSafetyTimer=setTimeout(()=>{if(this.blockEvents&&!this._destroyed){this.notify("blockEvents safety timeout: driver did not call onComplete. Force-resetting.","warn"),this.blockEvents=!1;let t=this._pendingTransitionComplete;t?t():this._onTransitionComplete()}},is)}_clearBlockEventsSafety(){this._blockEventsSafetyTimer!==null&&(clearTimeout(this._blockEventsSafetyTimer),this._blockEventsSafetyTimer=null)}_setTrackedTimeout(t,e){let r=setTimeout(()=>{this._trackedTimers.delete(r),!this._destroyed&&t()},e);return this._trackedTimers.add(r),r}_clearTrackedTimeouts(){for(let t of this._trackedTimers)clearTimeout(t);this._trackedTimers.clear()}storeViews(t){this.tracing("storedViews()"),this.storedViews.push(t),this.debug&&console.debug("Zumly storedViews",t)}tracing(t){if(this.debug)if(t==="ended"){let e=this.trace.map((r,n)=>`${n===0?`Instance ${this.mount}: ${r}`:`${r}`}`).join(" > ");this.notify(e),this.trace=[]}else this.trace.push(t)}notify(t,e){return z(this.debug,t,e)}_recordCanvasSize(){if(!this.canvas)return;let t=this.canvas.getBoundingClientRect();this._lastCanvasWidth=t.width,this._lastCanvasHeight=t.height}_handleResize(){this._destroyed||(this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=setTimeout(()=>{if(this._resizeDebounceTimer=null,!this.isValid||!this.canvas||this._lastCanvasWidth===0)return;let t=this.canvas.getBoundingClientRect(),e=t.width,r=t.height;if(!(e===this._lastCanvasWidth&&r===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}Ht(this,this._lastCanvasWidth,this._lastCanvasHeight,e,r),this._lastCanvasWidth=e,this._lastCanvasHeight=r}},this._RESIZE_DEBOUNCE_MS))}_onTransitionComplete(){if(this._clearBlockEventsSafety(),this._pendingResizeCorrection&&!this.blockEvents){this._pendingResizeCorrection=!1;let t=this.canvas?.getBoundingClientRect();if(t&&this._lastCanvasWidth>0){let e=t.width,r=t.height;(e!==this._lastCanvasWidth||r!==this._lastCanvasHeight)&&Ht(this,this._lastCanvasWidth,this._lastCanvasHeight,e,r),this._lastCanvasWidth=e,this._lastCanvasHeight=r}}else this._recordCanvasSize();this._manageFocus()}_manageFocus(){if(!this.canvas)return;let t=this.canvas.querySelector(".is-current-view");if(!t)return;let e=t.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');e?e.focus({preventScroll:!0}):(t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}_resolveEffects(t){let e=t?.dataset?.withEffects;if(e&&typeof e=="string"){let r=e.split("|").map(n=>n.trim());return[r[0]||"none",r[1]||r[0]||"none"]}return this.effects}_applyEffects(t,e,r,n,o){!r||r[0]==="none"&&r[1]==="none"||(t&&r[0]!=="none"&&(t.style.setProperty("--z-effect-filter",r[0]),t.style.setProperty("--zoom-duration",n),t.style.setProperty("--zoom-ease",o),t.classList.add("has-effect")),e&&r[1]!=="none"&&(e.style.setProperty("--z-effect-filter",r[1]),e.style.setProperty("--zoom-duration",n),e.style.setProperty("--zoom-ease",o),e.classList.add("has-effect")))}_removeEffect(t){if(!t||!t.classList.contains("has-effect"))return;t.classList.remove("has-effect"),t.classList.add("has-effect-reverse");let e=()=>{t.classList.remove("has-effect-reverse"),t.style.removeProperty("--z-effect-filter"),t.removeEventListener("transitionend",e)};t.addEventListener("transitionend",e,{once:!0});let r=t.style.getPropertyValue("--zoom-duration");this._setTrackedTimeout(e,r?parseFloat(r)*(r.includes("ms")?1:1e3)+100:1100)}_resolveHideTrigger(t){return t?.dataset?.hideTrigger!==void 0?t.dataset.hideTrigger==="fade"?"fade":!0:this.hideTrigger}_applyHideTrigger(t,e,r,n,o){!r||!t||(r==="fade"?(t.style.setProperty("--zoom-duration",n),t.style.setProperty("--zoom-ease",o),t.classList.add("z-trigger-fade"),e.style.setProperty("--zoom-duration",n),e.style.setProperty("--zoom-ease",o),e.classList.add("z-view-fade-in"),e.offsetHeight,e.classList.remove("hide")):t.classList.add("z-trigger-hidden"))}_restoreHideTrigger(t,e,r,n){if(!(!e||!t))if(e==="fade"){t.classList.remove("z-trigger-fade"),t.style.setProperty("--zoom-duration",r),t.style.setProperty("--zoom-ease",n),t.classList.add("z-trigger-fade-reverse");let o=()=>{t.classList.remove("z-trigger-fade-reverse"),t.style.removeProperty("--zoom-duration"),t.style.removeProperty("--zoom-ease"),t.removeEventListener("transitionend",o)};t.addEventListener("transitionend",o,{once:!0}),this._setTrackedTimeout(o,parseFloat(r)*(r.includes("ms")?1:1e3)+100)}else t.classList.remove("z-trigger-hidden")}on(t,e){var r;return typeof e!="function"?this:(((r=this._hooks)[t]||(r[t]=[])).push(e),this)}use(t,e){if(!t)return this;let r={plugin:t,options:e};return this._plugins.push(r),this._initialized&&this._installPlugin(r),this}_installPlugin(t){let{plugin:e,options:r}=t;try{typeof e=="function"?e(this,r):typeof e.install=="function"&&e.install(this,r)}catch(n){this.notify(`plugin install error: ${n.message}`,"error")}}off(t,e){return e?this._hooks[t]&&(this._hooks[t]=this._hooks[t].filter(r=>r!==e)):delete this._hooks[t],this}_emit(t,e={}){let r=this._hooks[t];if(!(!r||r.length===0))for(let n of r)try{n(e)}catch(o){this.debug&&console.error(`Zumly hook "${t}" threw:`,o)}}zoomLevel(){return this.storedViews.length}getZoomLevel(){return this.zoomLevel()}getCurrentViewName(){return!this.storedViews||this.storedViews.length===0?null:this.storedViews[this.storedViews.length-1]?.views?.[0]?.viewName??null}back(){if(!this._destroyed){if(this.blockEvents){this.notify("back ignored: a transition is already running.","warn");return}if(this.lateralHistory&&this.lateralHistory.length>0){let t=this.lateralHistory.pop(),e=t&&typeof t=="object"?t.name:t,r=t&&typeof t=="object"?t.entry:void 0,n=t&&typeof t=="object"?t.node:void 0;return this._doLateral(e,!0,{savedEntry:r,keepAliveNode:n})}this.zoomOut()}}async goTo(t,e={}){return this._destroyed?void 0:(e.mode==="lateral"?"lateral":"depth")==="depth"?this.zoomTo(t,e):this._doLateral(t,!1,e)}async zoomTo(t,e={}){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("zoomTo() cannot run: instance is invalid or canvas not found.","error");return}if(typeof t!="string"||!t){this.notify("zoomTo() requires a non-empty view name.","warn");return}if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`zoomTo("${t}"): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}if(this.getCurrentViewName()===t)return;let n=this.canvas.getBoundingClientRect(),o=Math.max(40,n.width*.1),i=Math.max(40,n.height*.1),l={rect:{x:n.left+(n.width-o)/2,y:n.top+(n.height-i)/2,width:o,height:i},duration:e.duration??this.duration,ease:e.ease??this.ease,props:e.props??{}};await this._doZoomIn(t,l)}async init(){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("init() cannot run: instance is invalid or canvas element was not found.","error");return}this.tracing("init()"),this.preload&&this.preload.length&&await this.prefetcher.preloadEager(this.preload,null).catch(e=>{this.notify(`preload failed: ${e.message}`,"warn")});let t;try{let e=await this.prefetcher.get(this.initialView,null);t=await ht(e,this.initialView,this.canvas,!0,this.views,this.componentContext)}catch(e){this.notify(`init() failed to resolve initial view "${this.initialView}": ${e.message}`,"error");return}this._emit("viewMounted",{viewName:this.initialView,node:t}),this.prefetcher.scanAndPrefetch(t,null),this.storeViews({zoomLevel:this.storedViews.length,scale:1,views:[{viewName:this.initialView,backwardState:{origin:"0 0",transform:""}}]}),this.currentStage=this.storedViews[this.storedViews.length-1],this._recordCanvasSize(),this._initialized=!0;for(let e of this._plugins)this._installPlugin(e)}destroy(){this._destroyed||(this._emit("destroy"),this._destroyed=!0,this._clearBlockEventsSafety(),this._clearTrackedTimeouts(),this._pendingTransitionComplete=null,this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._unbindEvents(),this._removeNav(),this._cleanupLateralKeepAlive(),this.blockEvents=!1,this.storedViews=[],this.currentStage=null,this.lateralHistory=[],this.trace=[],this._hooks={},this.prefetcher=null,this.transitionDriver=null,this.canvas&&(this.canvas.removeAttribute("tabindex"),this.canvas.removeAttribute("role"),this.canvas.removeAttribute("aria-roledescription"),this.canvas.removeAttribute("aria-live")),this.isValid=!1)}async _doZoomIn(t,e){if(this._destroyed)return;if(this.blockEvents){this.notify("zoomIn ignored: a transition is already running.","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let r=this.canvas,n=e.el;this._resetCanvasScroll(r);let o=r.getBoundingClientRect(),i=o.left,a=o.top,c=(this.storedViews.length>0?this.storedViews[this.storedViews.length-1]:null)?.scale??1;this.tracing("getView()");let f=n?{trigger:n,target:document.createElement("div"),context:this.componentContext,props:Object.assign({},n.dataset)}:{target:document.createElement("div"),context:this.componentContext,props:e.props??{}},u=n?.dataset?.deferred!==void 0?!0:this.deferred,h,m=null;try{if(u){let E=await this.prefetcher.get(t,f);if(this._destroyed)return;for(m=document.createDocumentFragment();E.firstChild;)m.appendChild(E.firstChild);h=await ht(E,t,r,!1,{},this.componentContext)}else{let E=await this.prefetcher.get(t,f);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(E,f),h=await ht(E,t,r,!1,this.views,this.componentContext)}}catch(E){this.notify(`zoomIn aborted: failed to resolve view "${t}": ${E.message}`,"error");return}if(!h)return;u||this._emit("viewMounted",{viewName:t,node:h}),n&&n.classList.add("zoomed");let y=n?(()=>{let E=n.getBoundingClientRect();return{x:E.x,y:E.y,width:E.width,height:E.height}})():e.rect,p=n?n.dataset.withDuration||this.duration:e.duration??this.duration,d=n?n.dataset.withEase||this.ease:e.ease??this.ease,g=n?n.dataset.withCover||this.cover:e.cover??this.cover,v=n?parseInt(n.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),_=r.querySelector(".is-last-view");if(!w){this.notify("zoomIn aborted: no current view found in canvas. Call init() before navigating and keep Zumly view classes intact.","error"),n&&n.classList.remove("zoomed");try{r.removeChild(h)}catch{}return}it(h),it(w),it(b),_&&(it(_),r.removeChild(_));let S,A,I,N,L,X,Y,ft=w.style.transform,C=w.style.transformOrigin,j=b?b.style.transform:null,P=b?b.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let E=h.getBoundingClientRect(),U=w.getBoundingClientRect(),Pt=null,Rt=null,gt=null;b&&(Pt=b.getBoundingClientRect(),gt=b.querySelector(".zoomed"),Rt=gt&&gt.getBoundingClientRect?gt.getBoundingClientRect():Pt);let bt={left:i,top:a},qt={width:o.width,height:o.height},Bt={width:E.width,height:E.height},Vt=te(y.width,y.height,E.width,E.height,g);Y=Vt.scale;let De=Vt.scaleInv;S=ee(y,bt,Bt,De),I=w.style.transform;let Xt=re(y,U);N=ne(qt,y,U,Y,this.parallax);let Yt=Tt(C||"0 0"),Q=mt(I||""),Ut=Tt(Xt),J=mt(N.transform),Wt=y;if(n&&(Wt=Et(y,U,Yt,Q.tx,Q.ty,Q.scale,Ut,J.tx,J.ty,J.scale)),A=se(Wt,bt,Bt),b){L=b.style.transform;let Fe=Et(U,U,Yt,Q.tx,Q.ty,Q.scale,Ut,J.tx,J.ty,J.scale),He=ie(N.x,N.y,bt,Y,c),Kt=Tt(P||"0 0"),It=mt(L||""),Nt=mt(He),je=Et(Rt,Pt,Kt,It.tx,It.ty,It.scale,Kt,Nt.tx,Nt.ty,Nt.scale);X=oe({canvasRect:qt,canvasOffset:bt,triggerRect:y,previousViewRectAtBaseTransform:U,lastViewZoomedElementRect:je,previousViewRectWithPreviousAtEndTransform:Fe,scale:Y,preScale:c,parallax:this.parallax})}h.style.transform=S,w.style.transformOrigin=Xt}catch(E){this.notify(`zoomIn geometry computation failed: ${E.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",E),w.style.transform=ft,w.style.transformOrigin=C,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=j,b.style.transformOrigin=P,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(h)}catch{}n&&n.classList.remove("zoomed"),K(w),K(b);return}let G=pt(h.dataset.viewName,{origin:h.style.transformOrigin,duration:p,ease:d,transform:S},{origin:h.style.transformOrigin,duration:p,ease:d,transform:A}),Ie=pt(w.dataset.viewName,{origin:w.style.transformOrigin,duration:p,ease:d,transform:I},{origin:w.style.transformOrigin,duration:p,ease:d,transform:N.transform}),Ne=b?pt(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:d,transform:L},{origin:b.style.transformOrigin,duration:p,ease:d,transform:X}):null,Ze=_?ae(_):null,wt=le(this.storedViews.length,G,Ie,Ne,Ze);wt.scale=Y,wt.stagger=v||0,this.storeViews(wt),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let $e=this._resolveEffects(n);this._applyEffects(w,b,$e,p,d);let Ot=this._resolveHideTrigger(n);this._applyHideTrigger(n,h,Ot,p,d),Ot&&(wt.hideTriggerMode=Ot),this._setBlockEvents();let Me={type:"zoomIn",currentView:h,previousView:w,lastView:b,currentStage:this.currentStage,duration:p,ease:d},At=async()=>{this._pendingTransitionComplete===At&&(this._pendingTransitionComplete=null,!this._destroyed&&(u&&m&&h&&(h.appendChild(m),this.prefetcher.scanAndPrefetch(h,f),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function"&&await this.views[t].mounted(),this._emit("viewMounted",{viewName:t,node:h})),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended")))};this._pendingTransitionComplete=At,this.transitionDriver.runTransition(Me,At)}async zoomIn(t){this._destroyed||t?.dataset?.to&&await this._doZoomIn(t.dataset.to,{el:t})}async _doLateral(t,e=!1,r={}){if(this._destroyed)return;if(this.blockEvents){this.notify("lateral navigation ignored: a transition is already running.","warn");return}if(!this.isValid||!this.canvas)return;if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`goTo("${t}", { mode: 'lateral' }): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}let n=this.canvas.querySelector(".is-current-view");if(!n)return;let o=n.dataset?.viewName;if(o===t)return;this._emit("beforeLateral",{viewName:t,from:o,isBack:e});let i=this.lateralNav&&this.lateralNav.keepAlive,a=null;if(!e){this.lateralHistory=this.lateralHistory||[];let C=this.storedViews[this.storedViews.length-1];a={name:o,entry:C.views[0],node:i?n:null}}this.tracing("lateral()");let l=r.duration??this.duration,c=r.ease??this.ease,f=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),h=0,m=0,y=this._declaredSiblings(),p=y?y.indexOf(o):-1,d=y?y.indexOf(t):-1;if(p!==-1&&d!==-1){let C=this.canvas.getBoundingClientRect();h=(p-d)*C.width*.15}else if(f){let C=f.querySelector(`.zoom-me[data-to="${o}"]`),j=f.querySelector(`.zoom-me[data-to="${t}"]`);if(C&&j){let P=C.getBoundingClientRect(),G=j.getBoundingClientRect();h=P.left+P.width/2-(G.left+G.width/2),m=P.top+P.height/2-(G.top+G.height/2)}else h=this.canvas.getBoundingClientRect().width*.15}let g=null,v=null;if(i&&(e&&r.keepAliveNode?v=r.keepAliveNode:v=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),v){if(v.style.display="",v.style.opacity="",v.classList.remove("is-lateral-hidden","zoom-lateral-out"),v.classList.add("is-new-current-view","has-no-events"),g=v,!e&&this.lateralHistory){let C=this.lateralHistory.findIndex(j=>j.node===v);C!==-1&&this.lateralHistory.splice(C,1)}}else{let C=()=>{e&&this.lateralHistory.push({name:t,entry:r.savedEntry,node:r.keepAliveNode??null})},j={target:document.createElement("div"),context:this.componentContext,props:r.props??{}};try{let P=await this.prefetcher.get(t,j);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(P,j),g=await ht(P,t,this.canvas,!1,this.views,this.componentContext)}catch(P){this.notify(`lateral navigation aborted: failed to resolve view "${t}": ${P.message}`,"error"),C();return}if(!g){C();return}this._emit("viewMounted",{viewName:t,node:g})}a&&this.lateralHistory.push(a),it(g);let w=n.style.transform||"",b=n.style.transformOrigin||"0 0";g.style.transform=w,g.style.transformOrigin=b;let _=this.storedViews[this.storedViews.length-1],S=e&&r.savedEntry?{...r.savedEntry,viewName:t}:pt(t,{origin:b,duration:l,ease:c,transform:w},{origin:b,duration:l,ease:c,transform:w});_.views[0]=S,this.currentStage=_;let A=f?{transformStart:f.style.transform||"",transformEnd:this._computeLateralBackTransform(f.style.transform||"",h,m)}:null,I=u&&_.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",h*.7,m*.7)}:null;A&&_.views[1]&&(_.views[1].forwardState={..._.views[1].forwardState,transform:A.transformEnd}),I&&_.views[2]&&(_.views[2].forwardState={..._.views[2].forwardState,transform:I.transformEnd});let N=w,L=this._computeLateralBackTransform(N,-h,-m),X=this._computeLateralBackTransform(w,h,m);this._setBlockEvents();let Y={type:"lateral",currentView:g,previousView:n,lastView:u||null,backView:f||null,backViewState:A,lastViewState:I,incomingTransformStart:L,incomingTransformEnd:N,outgoingTransform:w,outgoingTransformEnd:X,currentStage:this.currentStage,duration:l,ease:c,canvas:this.canvas,slideDeltaX:h,slideDeltaY:m,keepAlive:i&&!e?i:!1},ft=()=>{this._pendingTransitionComplete===ft&&(this._pendingTransitionComplete=null,!this._destroyed&&(i&&!e&&(n.classList.remove("is-current-view","is-new-current-view","has-no-events"),n.classList.add("is-lateral-hidden"),i!=="visible"?n.style.display="none":(n.style.transform=w,n.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:o,isBack:e}),this.tracing("ended")))};this._pendingTransitionComplete=ft,this.transitionDriver.runTransition(Y,ft)}_computeLateralBackTransform(t,e,r){let n=dt(t);return n.matched?`translate(${n.tx+e}px, ${n.ty+r}px) ${n.rest}`.trim():`translate(${e}px, ${r}px) ${t}`.trim()}zoomOut(){if(this._destroyed)return;if(this.blockEvents){this.notify("zoomOut ignored: a transition is already running.","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas;this._resetCanvasScroll(t);let e=t.querySelector(".is-current-view"),r=t.querySelector(".is-previous-view");if(!e||!r){this.notify("zoomOut: current or previous view not found (animation may still be running)","warn");return}this._setBlockEvents(),this.currentStage=this.storedViews[this.storedViews.length-1];let n=t.querySelector(".is-last-view");this.tracing("setCSSVariables()");let o=this.currentStage.views[0]?.forwardState?.duration??this.duration,i=this.currentStage.views[0]?.forwardState?.ease??this.ease,a=r.querySelector(".zoomed");a&&a.classList.remove("zoomed");let l=this.currentStage.hideTriggerMode;l&&a&&this._restoreHideTrigger(a,l,o,i),l==="fade"?(e.classList.remove("z-view-fade-in"),e.style.setProperty("--zoom-duration",o),e.style.setProperty("--zoom-ease",i),e.classList.add("z-view-fade-out")):(e.classList.remove("z-view-fade-in"),e.style.removeProperty("opacity")),this._removeEffect(r),r.classList.replace("is-previous-view","is-current-view"),n!==null&&(n.classList.contains("has-effect")&&this.effects[0]!=="none"&&n.style.setProperty("--z-effect-filter",this.effects[0]),n.classList.replace("is-last-view","is-previous-view"),n.classList.remove("hide"),K(n));let c=ce(this.currentStage);if(c){t.prepend(c);let h=t.querySelector(".z-view:first-child");h&&(K(h),h.classList.add("hide"))}let f={type:"zoomOut",currentView:e,previousView:r,lastView:n,currentStage:this.currentStage,duration:o,ease:i,canvas:t},u=()=>{this._pendingTransitionComplete===u&&(this._pendingTransitionComplete=null,!this._destroyed&&(this.blockEvents=!1,this._onTransitionComplete(),this.storedViews.pop(),this._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")))};this._pendingTransitionComplete=u,this.transitionDriver.runTransition(f,u)}onZoom(t){if(this._destroyed||t.type==="mouseup"&&!this.inputs.click||t.type==="touchend"&&!this.inputs.touch)return;let e=t.target;if(e.closest(".z-depth-nav")||e.closest(".z-lateral-nav"))return;let r=e.classList.contains("zoom-me")||e.closest(".zoom-me");if(!this.blockEvents&&r&&!this.touching){this.tracing("onZoom() \u2192 zoomIn"),t.stopPropagation();let n=e.classList.contains("zoom-me")?e:e.closest(".zoom-me");this.zoomIn(n);return}if(this.storedViews.length>1&&!this.blockEvents&&!r&&!this.touching){let n=this.canvas.querySelector(".is-current-view");if(n&&n.contains(e))return;let o=this._findSiblingTriggerAtPoint(t.clientX,t.clientY);if(o){this.tracing("onZoom() \u2192 lateral"),t.stopPropagation(),this._doLateral(o.dataset.to);return}this.tracing("onZoom() \u2192 zoomOut"),t.stopPropagation(),this.zoomOut()}}_findSiblingTriggerAtPoint(t,e){let r=this.canvas.querySelector(".is-previous-view");if(!r)return null;let o=this.canvas.querySelector(".is-current-view")?.dataset?.viewName;if(!o)return null;let i=r.querySelectorAll(".zoom-me[data-to]");for(let a of i){if(a.dataset.to===o)continue;let l=a.getBoundingClientRect();if(t>=l.left&&t<=l.right&&e>=l.top&&e<=l.bottom)return a}return null}_getSiblings(){let e=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,r=this._declaredSiblings();if(r&&r.indexOf(e)!==-1)return{siblings:r,currentIndex:r.indexOf(e)};let n=this.canvas.querySelector(".is-previous-view");if(!n)return{siblings:[],currentIndex:-1};let o=n.querySelectorAll(".zoom-me[data-to]"),i=[];for(let l of o)l.dataset.to&&i.push(l.dataset.to);let a=i.indexOf(e);return{siblings:i,currentIndex:a}}_declaredSiblings(){let t=this.lateralNav&&typeof this.lateralNav=="object"?this.lateralNav.siblings:null;if(!t)return null;if(Array.isArray(t))return t;let e=this.canvas.querySelector(".is-previous-view")?.dataset?.viewName;return e&&Array.isArray(t[e])?t[e]:null}_updateNav(){this._destroyed||(this._removeNav(),this._updateDepthNav(),this._updateLateralNav())}_updateDepthNav(){if(!this.depthNav||this.storedViews.length-1<1)return;let e=this.canvas.querySelector(".z-view.is-current-view");if(e&&e.querySelector(".z-depth-nav"))return;let r=this.depthNav.position||"bottom-left",n=document.createElement("div");n.className="z-depth-nav z-depth-nav--"+r;let o=document.createElement("button");o.className="z-nav-back",o.setAttribute("aria-label","Zoom out (go back)"),o.innerHTML="&#8249;",o.addEventListener("mouseup",i=>{i.stopPropagation(),!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),n.appendChild(o),this.canvas.appendChild(n)}_updateLateralNav(){if(!this.lateralNav)return;let t=this.storedViews.length-1,e=this._getSiblings();if(e.siblings.length<2)return;if(this.lateralNav.mode==="auto"&&t>=1){let a=this.canvas.querySelector(".z-view.is-current-view");if(a&&a.offsetWidth>=this.canvas.offsetWidth&&a.offsetHeight>=this.canvas.offsetHeight)return}let{siblings:r,currentIndex:n}=e,o=this.lateralNav.position||"bottom-center",i=document.createElement("div");if(i.className="z-lateral-nav z-lateral-nav--"+o,this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-prev",a.setAttribute("aria-label","Previous sibling view"),a.innerHTML="&#8249;",a.disabled=n<=0,a.addEventListener("mouseup",l=>{l.stopPropagation(),n>0&&this._doLateral(r[n-1])}),i.appendChild(a)}if(this.lateralNav.dots){let a=document.createElement("div");a.className="z-nav-lateral-dots";for(let l=0;l<r.length;l++){let c=document.createElement("button");c.className="z-nav-dot z-nav-lat-dot"+(l===n?" is-active":""),c.setAttribute("aria-label",`Go to ${r[l]}`),c.dataset.to=r[l],c.addEventListener("mouseup",(f=>u=>{u.stopPropagation(),f!==n&&this._doLateral(r[f])})(l)),a.appendChild(c)}i.appendChild(a)}if(this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-next",a.setAttribute("aria-label","Next sibling view"),a.innerHTML="&#8250;",a.disabled=n>=r.length-1,a.addEventListener("mouseup",l=>{l.stopPropagation(),n<r.length-1&&this._doLateral(r[n+1])}),i.appendChild(a)}this.canvas.appendChild(i)}_removeNav(){this.canvas&&this.canvas.querySelectorAll(".z-depth-nav, .z-lateral-nav").forEach(t=>t.remove())}_cleanupLateralKeepAlive(){if(!this.canvas)return;let t=this.canvas.querySelectorAll(".is-lateral-hidden");for(let e of t)e.remove()}onKeyUp(t){this._destroyed||this.inputs.keyboard&&(this.tracing("onKeyUp()"),(t.key==="ArrowLeft"||t.key==="ArrowDown")&&(t.preventDefault(),this.storedViews.length>1&&!this.blockEvents?this.zoomOut():this.notify(`is on level zero. Can't zoom out. Trigger: ${t.key}`,"warn")),(t.key==="ArrowRight"||t.key==="ArrowUp")&&(t.preventDefault(),this.notify(t.key+" has no actions defined")))}onWheel(t){this._destroyed||this.inputs.wheel&&(this._isInsideScrollable(t.target,t.deltaY)||(t.preventDefault(),!(this.blockEvents||this._wheelCooldown)&&t.deltaY>0&&this.storedViews.length>1&&(this.tracing("onWheel() \u2192 zoomOut"),this._wheelCooldown=!0,this._setTrackedTimeout(()=>{this._wheelCooldown=!1},500),this.zoomOut())))}_isInsideScrollable(t,e){let r=t,n=this.canvas.querySelector(".is-current-view");for(;r&&r!==this.canvas;){if(r===n||n&&n.contains(r)){let{overflowY:o}=window.getComputedStyle(r);if((o==="auto"||o==="scroll")&&(e>0?r.scrollTop+r.clientHeight<r.scrollHeight-1:r.scrollTop>0))return!0}r=r.parentElement}return!1}onTouchStart(t){this._destroyed||this.inputs.touch&&(this.tracing("onTouchStart()"),this.touching=!0,this.touchstartX=t.changedTouches[0].screenX,this.touchstartY=t.changedTouches[0].screenY)}onTouchEnd(t){this._destroyed||this.inputs.touch&&(this.blockEvents||(this.tracing("onTouchEnd()"),this.touchendX=t.changedTouches[0].screenX,this.touchendY=t.changedTouches[0].screenY,this.handleGesture(t)),this.touching=!1)}handleGesture(t){t.stopPropagation(),this.tracing("handleGesture()");let e=this.touchendX-this.touchstartX,r=this.touchendY-this.touchstartY,n=Math.abs(e)<10&&Math.abs(r)<10;e<-30&&(this.storedViews.length>1&&!this.blockEvents?(this.tracing("swipe left"),this.zoomOut()):this.notify("is on level zero. Can't zoom out. Trigger: Swipe left","warn"));let o=t.target.classList.contains("zoom-me")?t.target:t.target.closest(".zoom-me");n&&!this.blockEvents&&o&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(o)),n&&this.storedViews.length>1&&!this.blockEvents&&!o&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}};var as={separator:"/",prefix:"/"};function Ae(s,t){let e=[];for(let r of s.storedViews){let n=r.views&&r.views[0];n&&n.viewName&&e.push(n.viewName)}return e.join(t)}function ls(s,t){let e=window.location.hash.slice(1);return e.startsWith(s)&&(e=e.slice(s.length)),e?e.split(t).filter(Boolean):[]}var Pe={install(s,t){let e=Object.assign({},as,t),r=e.separator,n=e.prefix,o=!1;function i(f){if(o)return;let u=Ae(s,r),h="#"+n+u;window.location.hash!==h&&(o=!0,window.history[f](null,"",h),o=!1)}function a(){i("pushState")}function l(){i("replaceState")}s.on("afterZoomIn",a),s.on("afterLateral",a),s.on("afterZoomOut",l);function c(){if(o)return;o=!0;let f=ls(n,r),u=Ae(s,r).split(r).filter(Boolean);if(f.join(r)===u.join(r)){o=!1;return}if(f.length<u.length){let h=u.length-f.length;for(let m=0;m<h;m++)s.zoomOut()}else if(f.length===u.length&&f.length>0){let h=f[f.length-1];h!==u[u.length-1]&&s.goTo(h,{mode:"lateral"})}else f.length>u.length&&window.history.back();o=!1}window.addEventListener("popstate",c),l(),s.on("destroy",function(){s.off("afterZoomIn",a),s.off("afterLateral",a),s.off("afterZoomOut",l),window.removeEventListener("popstate",c)})}};yt.Router=Pe;window.Zumly=yt;})();
7
+ (()=>{var Le=r=>{throw TypeError(r)};var le=(r,t,e)=>t.has(r)||Le("Cannot "+e);var w=(r,t,e)=>(le(r,t,"read from private field"),e?e.call(r):t.get(r)),N=(r,t,e)=>t.has(r)?Le("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),$=(r,t,e,s)=>(le(r,t,"write to private field"),s?s.call(r,e):t.set(r,e),e),Z=(r,t,e)=>(le(r,t,"access private method"),e);var ce=(r,t,e,s)=>({set _(i){$(r,t,i,e)},get _(){return w(r,t,s)}});var yt=Symbol.for("zumly.viewLifecycles");function Ce(r){try{let t=r();t&&typeof t.then=="function"&&t.catch(e=>console.error("Zumly: view cleanup failed:",e))}catch(t){console.error("Zumly: view cleanup failed:",t)}}function Oe(){let r=!1,t=[],e={onCleanup(s){if(typeof s!="function")throw new TypeError("Zumly: onCleanup expects a function");r?Ce(s):t.push(s)},attach(s){let i=s[yt];i||(i=new Set,Object.defineProperty(s,yt,{value:i,configurable:!0})),i.add(e)},dispose(){if(!r){r=!0;for(let s of t.splice(0).reverse())Ce(s)}}};return e}function A(r){if(!r)return;let t=[];r[yt]&&t.push(r);let s=(r.ownerDocument||r).createTreeWalker(r,1),i;for(;i=s.nextNode();)i[yt]&&t.push(i);for(let n=t.length-1;n>=0;n--){let o=t[n],a=o[yt];if(a){for(let c of a)c.dispose();delete o[yt]}}}var ys=1e4,gt,Bt,Ne,jt=class{constructor(t={}){N(this,Bt);N(this,gt,{});$(this,gt,t)}async resolve(t,e=null){let s=new Set;for(;typeof t=="string"&&Object.prototype.hasOwnProperty.call(w(this,gt),t);){if(s.has(t))throw new Error(`Zumly: circular view alias "${t}"`);s.add(t),t=w(this,gt)[t]}let i=Z(this,Bt,Ne).call(this,t);switch(i){case"html":{let n=document.createElement("div");n.innerHTML=t.trim();let o=n.firstElementChild;if(!o)throw new Error("Zumly: view produced no element (html)");return o}case"url":{let n=new AbortController,o=setTimeout(()=>n.abort(),ys),a;try{let f=await fetch(t,{signal:n.signal});if(!f.ok)throw new Error(`Zumly: fetch failed for "${t}" (${f.status})`);a=await f.text()}finally{clearTimeout(o)}let c=document.createElement("div");c.innerHTML=a.trim();let l=c.firstElementChild;if(!l)throw new Error("Zumly: view produced no element (url)");return l}case"function":case"object":{let n=Oe(),o=e?.target||document.createElement("div");n.attach(o);let a={...e,target:o,props:e?.props||{},context:e?.context||new Map,onCleanup:n.onCleanup};try{let c=await(i==="function"?t(a):t.render(a)),l;if(typeof c=="string")l=await this.resolve(c,a);else if(c instanceof HTMLElement)l=c;else if(i==="function")l=o,o.classList.length||(o.style.width||(o.style.width="100%"),o.style.height||(o.style.height="100%"));else throw new Error("Zumly: view render() must return a string or HTMLElement");return n.attach(l),l}catch(c){throw n.dispose(),c}}case"element":return t.cloneNode(!0);case"webcomponent":return await customElements.whenDefined(t),document.createElement(t);default:throw new Error("Zumly: unknown view type for source")}}};gt=new WeakMap,Bt=new WeakSet,Ne=function(t){return typeof t=="function"?"function":t instanceof HTMLElement?"element":typeof t=="object"&&t!==null&&typeof t.render=="function"?"object":typeof t!="string"?"unknown":/^https?:\/\/|^\/|\.(?:html|php)(?:[?#].*)?$/i.test(t)?"url":t.includes("<")?"html":t.includes("-")?"webcomponent":"unknown"};async function Ot(r,t,e,s,i,n){if(!r||!r.classList){let o=document.createElement("div");o.classList.add("z-view"),r&&o.appendChild(r),r=o}else r.classList.contains("z-view")||r.classList.add("z-view");r.dataset.viewName=t,r.getAttribute("aria-label")||r.setAttribute("aria-label",`View: ${t}`),r.style.transformOrigin="0 0",r.style.position="absolute",s?r.classList.add("is-current-view"):r.classList.add("is-new-current-view","has-no-events","hide"),e.append(r);try{i[t]&&typeof i[t]=="object"&&typeof i[t].mounted=="function"&&await i[t].mounted()}catch(o){throw A(r),r.remove(),o}return r}function V(r,t,e){t&&e==="welcome"&&console.info(`%c Zumly %c ${t}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),t&&r&&(e==="info"||e===void 0)&&console.info(`%c Zumly %c ${t}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),t&&e==="warn"&&console.warn(`%c Zumly %c ${t}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),t&&e==="error"&&console.error(`%c Zumly %c ${t}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function Ae(r,t){if(t.isValid=!1,!r||typeof r!="object"){V(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof r.mount!="string"){V(!1,"'mount' must be a string selector","error");return}if(t.mount=r.mount,typeof r.initialView!="string"){V(!1,"'initialView' must be a string","error");return}if(t.initialView=r.initialView,!r.views||typeof r.views!="object"){V(!1,"'views' must be an object","error");return}t.views=r.views,t.isValid=!0,t.preload=Array.isArray(r.preload)?r.preload:[],t.debug=typeof r.debug=="boolean"?r.debug:!1,t.componentContext=r.componentContext&&typeof r.componentContext=="object"?r.componentContext:new Map;let e=r.transitions&&typeof r.transitions=="object"?r.transitions:null,s=e&&e.cover,i=typeof s=="string"?s.toLowerCase():null,n=i==="width"||i==="height";t.cover=n?i:"width",!n&&e&&s!==void 0&&V(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),t.duration=e&&typeof e.duration=="string"?e.duration:"1s",t.ease=e&&typeof e.ease=="string"?e.ease:"ease-in-out",t.deferred=typeof r.deferred=="boolean"?r.deferred:!1;let o=e&&e.hideTrigger;o===!0||o==="fade"?t.hideTrigger=o:(t.hideTrigger=!1,o!=null&&o!==!1&&V(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=e&&e.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?t.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?t.effects=[a[0],a[0]]:(t.effects=["none","none"],a!=null&&V(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let c=e&&e.driver,l=typeof c=="string"?c.toLowerCase():null,f=typeof c=="function"?c:null;if(l!==null){let p=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=p.includes(l)?l:"css",p.includes(l)||V(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${c}". Falling back to "css".`,"warn")}else f!==null?t.transitionDriver=f:t.transitionDriver="css";let h=e&&e.stagger;typeof h=="number"&&h>0?t.stagger=h:(t.stagger=0,h!=null&&h!==0&&V(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0;let u=r.lateralNav;if(u===!1)t.lateralNav=!1;else if(u&&typeof u=="object"){let p=typeof u.mode=="string"?u.mode.toLowerCase():null,y=p==="auto"||p==="always";p&&!y&&V(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let g=null;if(Array.isArray(u.siblings))g=u.siblings.filter(S=>typeof S=="string"&&S),g.length<2&&(V(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),g=null);else if(u.siblings&&typeof u.siblings=="object"){g={};for(let[S,_]of Object.entries(u.siblings))if(Array.isArray(_)){let x=_.filter(T=>typeof T=="string"&&T);x.length>=2&&(g[S]=x)}Object.keys(g).length===0&&(g=null)}else u.siblings!==void 0&&V(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:y?p:"auto",arrows:typeof u.arrows=="boolean"?u.arrows:!0,dots:typeof u.dots=="boolean"?u.dots:!0,keepAlive:u.keepAlive===!0||u.keepAlive==="visible"?u.keepAlive:!1,siblings:g}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let d=r.depthNav;if(d===!1)t.depthNav=!1;else if(d&&typeof d=="object"){let p=typeof d.position=="string"?d.position.toLowerCase():null,y=p==="bottom-left"||p==="top-left";p&&!y&&V(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:y?p:"bottom-left"}}else t.depthNav={position:"bottom-left"};let v=r.lateralNav&&typeof r.lateralNav=="object"?r.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let p=v==="bottom-center"||v==="top-center";v&&!p&&V(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=p?v:"bottom-center"}let m=r.inputs;m===!1?t.inputs={wheel:!1,keyboard:!1,click:!1,touch:!1}:m&&typeof m=="object"?t.inputs={wheel:typeof m.wheel=="boolean"?m.wheel:!0,keyboard:typeof m.keyboard=="boolean"?m.keyboard:!0,click:typeof m.click=="boolean"?m.click:!0,touch:typeof m.touch=="boolean"?m.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function Rt(r,t,e,s,i){let n=e/r,o=s/t;return i==="height"?{scale:o,scaleInv:1/o}:{scale:n,scaleInv:1/n}}function fe(r,t,e,s){let i=t.left,n=t.top,o=r.x-i+(r.width-e.width*s)/2,a=r.y-n+(r.height-e.height*s)/2;return`translate(${o}px, ${a}px) scale(${s})`}function Pe(r,t,e){let s=t.left,i=t.top,n=r.x-s+(r.width-e.width)/2,o=r.y-i+(r.height-e.height)/2;return`translate(${n}px, ${o}px)`}function Ie(r,t){let e=r.x+r.width/2-t.x,s=r.y+r.height/2-t.y;return`${e}px ${s}px`}function $e(r,t,e,s,i=0){let n=r.width/2-t.width/2-t.x+e.x,o=r.height/2-t.height/2-t.y+e.y,a=1-i,c=n*a,l=o*a;return{x:n,y:o,transform:`translate(${c}px, ${l}px) scale(${s})`}}function Ze({canvasRect:r,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:s,lastViewZoomedElementRect:i,previousViewRectWithPreviousAtEndTransform:n,scale:o,preScale:a,parallax:c=0}){let l=t.left,f=t.top,h=r.width/2-e.width/2-e.x,u=r.height/2-e.height/2-e.y,d=h+(s.x-i.x)+n.x-l+(n.width-i.width)/2,v=u+(s.y-i.y)+n.y-f+(n.height-i.height)/2,m=1-Math.min(c*2,.9);return`translate(${d*m}px, ${v*m}px) scale(${o*a})`}function Me(r,t,e,s,i){return`translate(${r-e.left}px, ${t-e.top}px) scale(${s*i})`}function wt(r){let t=r.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function ut(r){let t=typeof r=="string"?r:"",e=t.match(/translate\s*\(\s*([-+\d.eE]+)px\s*,\s*([-+\d.eE]+)px\s*\)/);if(!e)return{tx:0,ty:0,rest:t.trim(),matched:!1};let s=t.replace(/translate\s*\([^)]+\)\s*/,"").trim();return{tx:parseFloat(e[1]),ty:parseFloat(e[2]),rest:s,matched:!0}}function rt(r){let t=ut(r),e=r.match(/scale\s*\(\s*([-+\d.eE]+)\s*\)/);return{tx:t.matched?t.tx:0,ty:t.matched?t.ty:0,scale:e?parseFloat(e[1]):1}}function Nt(r,t,e,s,i,n,o,a,c,l){let f=t.x-e.x*(1-n)-s,h=t.y-e.y*(1-n)-i,u=t.width/n,d=t.height/n,v=f+e.x+(r.x-f-e.x-s)/n,m=h+e.y+(r.y-h-e.y-i)/n,p=r.width/n,y=r.height/n,g=f+o.x+a+l*(v-f-o.x),S=h+o.y+c+l*(m-h-o.y),_=p*l,x=y*l;return{x:g,y:S,width:_,height:x,left:g,top:S,right:g+_,bottom:S+x}}function At(r,t,e){return{viewName:r,backwardState:t,forwardState:e}}function He(r){return{detachedNode:r}}function De(r,t,e,s,i){let n=[];return t!==null&&n.push(t),e!==null&&n.push(e),s!==null&&n.push(s),i!==null&&n.push(i),{zoomLevel:r,views:n}}function he(r){let t=r.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var M,dt,qt=class{constructor({maxEntries:t=64}={}){N(this,M,new Map);N(this,dt);$(this,dt,Number.isInteger(t)&&t>=0?t:64)}set(t,e,s=null){w(this,dt)!==0&&this.adopt(t,e.cloneNode(!0),s)}adopt(t,e,s=null){let i=Date.now();for(let[n,o]of w(this,M))o.expires!==null&&i>=o.expires&&w(this,M).delete(n);if(w(this,dt)!==0)for(w(this,M).delete(t),w(this,M).set(t,{node:e,expires:s===null?null:i+s});w(this,M).size>w(this,dt);)w(this,M).delete(w(this,M).keys().next().value)}get(t){let e=w(this,M).get(t);return e?e.expires!==null&&Date.now()>=e.expires?(w(this,M).delete(t),null):(w(this,M).delete(t),w(this,M).set(t,e),e.node.cloneNode(!0)):null}has(t){let e=w(this,M).get(t);return e?e.expires!==null&&Date.now()>=e.expires?(w(this,M).delete(t),!1):!0:!1}invalidate(t){w(this,M).delete(t)}clear(){w(this,M).clear()}};M=new WeakMap,dt=new WeakMap;var gs="button, input, select, textarea, a[href], summary";function Xt(r){return r?.matches?.(gs)||!1}function ue(r){return!!r?.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="combobox"], [role="slider"], [role="spinbutton"]')}function Fe(r){let t=r.querySelectorAll(".zoom-me[data-to]");return t.forEach(e=>{Xt(e)||(e.hasAttribute("role")||e.setAttribute("role","button"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","0")),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")&&!e.textContent.trim()&&e.setAttribute("aria-label",`Zoom to ${e.dataset.to}`)}),t}var Wt=class{constructor(){this.backgrounds=new Map}sync(t){for(let e of t.children)e.classList.contains("z-view")&&(e.classList.contains("is-current-view")?this.restore(e):(this.backgrounds.has(e)||this.backgrounds.set(e,{inert:e.inert,hidden:e.getAttribute("aria-hidden")}),e.inert=!0,e.setAttribute("aria-hidden","true")));for(let e of this.backgrounds.keys())t.contains(e)||this.restore(e)}restore(t){let e=this.backgrounds.get(t);e&&(t.inert=e.inert,e.hidden===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",e.hidden),this.backgrounds.delete(t))}destroy(){for(let t of this.backgrounds.keys())this.restore(t)}};var ws=300*1e3,Ve=/^https?:\/\/|^\/|\.(?:html|php)(?:[?#].*)?$/i,bt,it,_t,at,R,Y,xt,It,St,G,mt,z,Yt,je,de,Kt,me,Pt,Ut=class{constructor(t={},{maxCacheEntries:e=64,prefetchConcurrency:s=2,maxPendingPrefetch:i=32}={}){N(this,z);N(this,bt);N(this,it);N(this,_t);N(this,at,new Map);N(this,R,new Map);N(this,Y,null);N(this,xt,0);N(this,It);N(this,St);N(this,G,!1);N(this,mt,!1);$(this,_t,t),$(this,bt,new jt(t)),$(this,it,new qt({maxEntries:e})),$(this,It,Number.isInteger(s)&&s>0?s:2),$(this,St,Number.isInteger(i)&&i>=0?i:32)}async get(t,e=null){if(w(this,G))throw new Error("Zumly: view prefetcher has been destroyed");w(this,R).delete(t);let s=Z(this,z,Yt).call(this,t);if(s!==null){let i=w(this,it).get(t);return i||(await Z(this,z,de).call(this,t,s,e)).cloneNode(!0)}return w(this,bt).resolve(t,e)}async preloadEager(t,e=null){!Array.isArray(t)||t.length===0||await Promise.all([...new Set(t)].map(s=>Z(this,z,Kt).call(this,s,e)))}prefetch(t,e=null){if(w(this,mt)){Z(this,z,me).call(this,t,e);return}Z(this,z,Kt).call(this,t,e).catch(()=>{})}prefetchOnHover(t,e=null){this.prefetch(t,e)}scanAndPrefetch(t,e=null){if(w(this,G)||!t||!t.querySelectorAll)return;let s=Fe(t);w(this,R).clear();let i=new Set;for(let n of s){let o=n.dataset.to;if(!(!o||i.has(o))){if(i.add(o),w(this,R).size>=w(this,St))break;Z(this,z,me).call(this,o,e)}}Z(this,z,Pt).call(this)}pause(){$(this,mt,!0),w(this,Y)!==null&&clearTimeout(w(this,Y)),$(this,Y,null)}resume(){$(this,mt,!1),Z(this,z,Pt).call(this)}destroy(){$(this,G,!0),w(this,Y)!==null&&clearTimeout(w(this,Y)),$(this,Y,null),w(this,R).clear(),w(this,it).clear()}};bt=new WeakMap,it=new WeakMap,_t=new WeakMap,at=new WeakMap,R=new WeakMap,Y=new WeakMap,xt=new WeakMap,It=new WeakMap,St=new WeakMap,G=new WeakMap,mt=new WeakMap,z=new WeakSet,Yt=function(t){let e=new Set;for(;typeof t=="string"&&Object.prototype.hasOwnProperty.call(w(this,_t),t);){if(e.has(t))return null;e.add(t),t=w(this,_t)[t]}return typeof t=="string"&&(t.includes("<")||Ve.test(t))?t:null},je=function(t){return Ve.test(t)?ws:null},de=function(t,e,s){if(w(this,at).has(t))return w(this,at).get(t);let i=(async()=>{try{let n=await w(this,bt).resolve(t,s);return w(this,G)||w(this,it).adopt(t,n,Z(this,z,je).call(this,e)),n}finally{w(this,at).delete(t)}})();return w(this,at).set(t,i),i},Kt=async function(t,e){if(w(this,G))return;w(this,R).delete(t);let s=Z(this,z,Yt).call(this,t);s===null||w(this,it).has(t)||await Z(this,z,de).call(this,t,s,e)},me=function(t,e){w(this,G)||w(this,R).size>=w(this,St)||w(this,R).has(t)||Z(this,z,Yt).call(this,t)===null||w(this,it).has(t)||w(this,at).has(t)||w(this,R).set(t,e)},Pt=function(){w(this,G)||w(this,mt)||w(this,Y)!==null||w(this,R).size===0||w(this,xt)>=w(this,It)||$(this,Y,setTimeout(()=>{if($(this,Y,null),w(this,G)||w(this,R).size===0)return;let[t,e]=w(this,R).entries().next().value;w(this,R).delete(t),ce(this,xt)._++,Z(this,z,Kt).call(this,t,e).catch(()=>{}).finally(()=>{ce(this,xt)._--,Z(this,z,Pt).call(this)}),Z(this,z,Pt).call(this)},0))};var Gt=Symbol.for("zumly.viewVisibility");function Be(r){r[Gt]||Object.defineProperty(r,Gt,{configurable:!0,value:{value:r.style.getPropertyValue("content-visibility"),priority:r.style.getPropertyPriority("content-visibility")}})}function Qt(r){r&&(Be(r),r.style.contentVisibility="hidden")}function $t(r){r&&(Be(r),r.style.contentVisibility="visible")}function Zt(r){let t=r?.[Gt];t&&(t.value?r.style.setProperty("content-visibility",t.value,t.priority):r.style.removeProperty("content-visibility"),delete r[Gt])}function nt(r){if(typeof r=="number"&&!Number.isNaN(r))return Math.max(0,r);let t=String(r).trim(),e=t.match(/^(\d*\.?\d+)\s*(ms|s)?$/i);if(!e)return typeof console<"u"&&console.warn(`[zumly] Could not parse duration "${t}" \u2014 falling back to 500ms.`),500;let s=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,s):Math.max(0,s*1e3)}function te(r){return nt(r)/1e3}function L(r,t){if(r.classList.contains("is-new-current-view")){let e=t.views[0].forwardState;r.classList.replace("is-new-current-view","is-current-view"),r.classList.remove("zoom-current-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform;return}if(r.classList.contains("is-previous-view")){let e=t.views[1].forwardState;r.classList.remove("zoom-previous-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform;return}if(r.classList.contains("is-last-view")){let e=t.views[2].forwardState;r.classList.remove("zoom-last-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform}}function K(r,t){r.classList.remove("zoom-previous-view-reverse","has-no-events","has-effect","has-effect-reverse"),r.style.removeProperty("--z-effect-filter"),r.style.transformOrigin="0 0",r.style.transform=t.transform}function U(r,t){r.classList.remove("zoom-last-view-reverse","has-no-events","has-effect","has-effect-reverse"),r.style.removeProperty("--z-effect-filter"),r.style.transformOrigin=t.origin,r.style.transform=t.transform}function q(r,t){A(r);try{t&&t.removeChild(r)}catch{try{r?.parentElement&&t&&(A(r.parentElement),t.removeChild(r.parentElement))}catch{}}}function j(...r){for(let t of r)t&&(t.classList.remove("hide"),$t(t))}function lt(r,t){let{currentView:e,previousView:s,backView:i,backViewState:n,lastView:o,lastViewState:a,incomingTransformEnd:c,currentStage:l,canvas:f}=r,h=l.views[0];j(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=h.forwardState.origin,e.style.transform=c||h.forwardState.transform,i&&n&&(i.style.transform=n.transformEnd),o&&a&&(o.style.transform=a.transformEnd),r.keepAlive||q(s,f),t()}var ct=150;function ft(r,t){let e=!1,s=setTimeout(()=>{e||(e=!0,r())},t);return{finish(){e||(e=!0,clearTimeout(s),r())},extend(i){e||(clearTimeout(s),s=setTimeout(()=>{e||(e=!0,r())},i))},safetyTimer:s}}function Jt(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function bs(r){if(!r||r==="none")return Jt();let t=String(r).match(/matrix\(([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+)\)/);return t?{a:parseFloat(t[1]),b:parseFloat(t[2])||0,c:parseFloat(t[3])||0,d:parseFloat(t[4]),e:parseFloat(t[5])||0,f:parseFloat(t[6])||0}:Jt()}function Et(r){return`matrix(${r.a}, ${r.b}, ${r.c}, ${r.d}, ${r.e}, ${r.f})`}function Tt(r,t,e){return r+(t-r)*e}function kt(r,t,e){let s=Math.max(0,Math.min(1,e));return{a:Tt(r.a,t.a,s),b:Tt(r.b,t.b,s),c:Tt(r.c,t.c,s),d:Tt(r.d,t.d,s),e:Tt(r.e,t.e,s),f:Tt(r.f,t.f,s)}}function Re(r,t,e){r.style.transformOrigin=t,r.style.transform=e;try{r.getBoundingClientRect()}catch{}return bs(getComputedStyle(r).transform)}function We(r,t){let{type:e,currentView:s,previousView:i,lastView:n,currentStage:o,duration:a,ease:c,canvas:l}=r;if(!s||!i||!o){t();return}e==="lateral"?_s(r,t):e==="zoomIn"?xs(s,i,n,o,a,c,t):e==="zoomOut"?Ss(s,i,n,o,a,c,l,t):t()}function _s(r,t){let{currentView:e,previousView:s,backView:i,backViewState:n,lastView:o,lastViewState:a,incomingTransformStart:c,incomingTransformEnd:l,outgoingTransform:f,outgoingTransformEnd:h,currentStage:u,duration:d,ease:v,canvas:m}=r,p=nt(d),y=u.views[0];j(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=y.forwardState.origin,i&&n&&(J(i,d,v,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),i.classList.add("zoom-lateral-back")),o&&a&&(J(o,d,v,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),o.classList.add("zoom-lateral-back")),r.keepAlive!=="visible"&&(J(s,d,v,{"--lateral-out-from":f,"--lateral-out-to":h}),s.classList.add("zoom-lateral-out")),J(e,d,v,{"--lateral-in-from":c,"--lateral-in-to":l}),e.classList.add("zoom-lateral-in");let g=r.keepAlive==="visible"?[e]:[s,e];i&&n&&g.push(i),o&&a&&g.push(o);let S=g.length,_=p+ct,x=new Set(["zoom-lateral-in","zoom-lateral-out","zoom-lateral-back"]),{finish:T,extend:P}=ft(()=>{pe(g,k,H),r.keepAlive?(s.classList.remove("zoom-lateral-out"),s.style.opacity=""):q(s,m),i&&(i.classList.remove("zoom-lateral-back"),i.style.transform=n?.transformEnd||i.style.transform),o&&(o.classList.remove("zoom-lateral-back"),o.style.transform=a?.transformEnd||o.style.transform),e.classList.remove("zoom-lateral-in"),e.style.transform=l,t()},_);function H(E){E.target!==E.currentTarget||!x.has(E.animationName)||P(_)}function k(E){if(E.target!==E.currentTarget||!x.has(E.animationName))return;let D=E.currentTarget;D.removeEventListener("animationend",k),D.removeEventListener("animationstart",H),S--,S<=0&&T()}g.forEach(E=>{E.addEventListener("animationstart",H),E.addEventListener("animationend",k)})}function xs(r,t,e,s,i,n,o){j(r,t,e);let a=s.stagger||0;J(r,i,n,{"--current-view-transform-start":s.views[0].backwardState.transform,"--current-view-transform-end":s.views[0].forwardState.transform}),a>0&&r.style.setProperty("animation-delay","0ms"),J(t,i,n,{"--previous-view-transform-start":s.views[1].backwardState.transform,"--previous-view-transform-end":s.views[1].forwardState.transform}),a>0&&t.style.setProperty("animation-delay",`${a}ms`),e&&(J(e,i,n,{"--last-view-transform-start":s.views[2].backwardState.transform,"--last-view-transform-end":s.views[2].forwardState.transform}),a>0&&e.style.setProperty("animation-delay",`${a*2}ms`)),r.classList.add("zoom-current-view"),t.classList.add("zoom-previous-view"),e&&e.classList.add("zoom-last-view");let c=e?[r,t,e]:[r,t],l=c.length,f=nt(i),h=e?a*2:a,u=f+h+ct,d=new Set(["zoom-current-view","zoom-previous-view","zoom-last-view"]),{finish:v,extend:m}=ft(()=>{pe(c,y,p),c.forEach(g=>g.style.removeProperty("animation-delay")),c.forEach(g=>{if(g?.isConnected)try{L(g,s)}catch{}}),o()},u);function p(g){g.target!==g.currentTarget||!d.has(g.animationName)||m(u)}function y(g){if(g.target!==g.currentTarget||!d.has(g.animationName))return;let S=g.currentTarget;if(S.removeEventListener("animationend",y),S.removeEventListener("animationstart",p),S.isConnected)try{L(S,s)}catch{}l--,l<=0&&v()}c.forEach(g=>{g.addEventListener("animationstart",p),g.addEventListener("animationend",y)})}function Ss(r,t,e,s,i,n,o,a){let c=s.views[0],l=s.views[1],f=e&&s.views[2]?s.views[2]:null,h=s.stagger||0;J(r,i,n,{"--current-view-transform-start":c.backwardState.transform,"--current-view-transform-end":c.forwardState.transform}),h>0&&r.style.setProperty("animation-delay","0ms"),J(t,i,n,{"--previous-view-transform-start":l.backwardState.transform,"--previous-view-transform-end":l.forwardState.transform}),h>0&&t.style.setProperty("animation-delay",`${h}ms`),e&&f&&(J(e,i,n,{"--last-view-transform-start":f.backwardState.transform,"--last-view-transform-end":f.forwardState.transform}),h>0&&e.style.setProperty("animation-delay",`${h*2}ms`)),r.classList.add("zoom-current-view-reverse"),t.classList.add("zoom-previous-view-reverse"),e&&e.classList.add("zoom-last-view-reverse");let u=e?[r,t,e]:[r,t],d=u.length,v=nt(i),m=e?h*2:h,p=v+m+ct,y=new Set(["zoom-current-view-reverse","zoom-previous-view-reverse","zoom-last-view-reverse"]),{finish:g,extend:S}=ft(()=>{pe(u,x,_),u.forEach(T=>T.style.removeProperty("animation-delay")),u.forEach(T=>{if(T?.isConnected)try{qe(T,s,o)}catch{}}),a()},p);function _(T){T.target!==T.currentTarget||!y.has(T.animationName)||S(p)}function x(T){if(T.target!==T.currentTarget||!y.has(T.animationName))return;let P=T.currentTarget;if(P.removeEventListener("animationend",x),P.removeEventListener("animationstart",_),P.isConnected)try{qe(P,s,o)}catch{}d--,d<=0&&g()}u.forEach(T=>{T.addEventListener("animationstart",_),T.addEventListener("animationend",x)})}function qe(r,t,e){if(r.classList.contains("zoom-current-view-reverse")){q(r,e);return}if(r.classList.contains("zoom-previous-view-reverse")){K(r,t.views[1].backwardState);return}r.classList.contains("zoom-last-view-reverse")&&U(r,t.views[2].backwardState)}function J(r,t,e,s){r.style.setProperty("--zoom-duration",t),r.style.setProperty("--zoom-ease",e);for(let[i,n]of Object.entries(s))r.style.setProperty(i,n)}function pe(r,t,e){for(let s of r)s?.removeEventListener&&(s.removeEventListener("animationend",t),s.removeEventListener("animationstart",e))}function Xe(r,t){let{type:e,currentView:s,previousView:i,lastView:n,currentStage:o,canvas:a}=r;if(!s||!i||!o){t();return}if(e==="lateral"){lt(r,t);return}if(e==="zoomIn"){j(s,i,n),L(s,o),L(i,o),n&&L(n,o),t();return}if(e==="zoomOut"){q(s,a),j(i,n),K(i,o.views[1].backwardState),n&&U(n,o.views[2].backwardState),t();return}t()}function Ye(r,t){let{type:e,currentView:s,previousView:i,lastView:n,currentStage:o,duration:a,ease:c,canvas:l}=r;if(!s||!i||!o){t();return}let f=nt(a);if(e==="lateral"){ks(r,f,c,t);return}if(e==="zoomIn"){Ts(s,i,n,o,f,c,t);return}if(e==="zoomOut"){Es(s,i,n,o,f,c,l,t);return}t()}function Ts(r,t,e,s,i,n,o){j(r,t,e);let a=s.views[0],c=s.views[1],l=e&&s.views[2]?s.views[2]:null;r.style.transformOrigin=a.backwardState.origin,r.style.transform=a.backwardState.transform,t.style.transformOrigin=c.backwardState.origin,t.style.transform=c.backwardState.transform,l&&(e.style.transformOrigin=l.backwardState.origin,e.style.transform=l.backwardState.transform);let f=s.stagger||0,h=[];h.push(r.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:i,easing:n,fill:"forwards"})),h.push(t.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:i,delay:f,easing:n,fill:"forwards"})),l&&h.push(e.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:i,delay:f*2,easing:n,fill:"forwards"}));let u=l?f*2:f,{finish:d}=ft(()=>{ve(h);try{L(r,s),L(t,s),e&&L(e,s)}catch{}o()},i+u+ct);Promise.all(h.map(v=>v.finished)).then(d).catch(d)}function Es(r,t,e,s,i,n,o,a){let c=s.views[0],l=s.views[1],f=e&&s.views[2]?s.views[2]:null,h=l.backwardState,u=f?f.backwardState:null;r.style.transformOrigin=c.forwardState.origin,r.style.transform=c.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=l.forwardState.origin,e&&f&&(e.style.transformOrigin=f.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||l.forwardState.transform,v=e&&f?e.style.transform||getComputedStyle(e).transform||f.forwardState.transform:null,m=s.stagger||0,p=[];p.push(r.animate([{transform:c.forwardState.transform},{transform:c.backwardState.transform}],{duration:i,easing:n,fill:"forwards"})),p.push(t.animate([{transform:d},{transform:h.transform}],{duration:i,delay:m,easing:n,fill:"both"})),e&&u&&p.push(e.animate([{transform:v},{transform:u.transform}],{duration:i,delay:m*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&u?m*2:m,{finish:g}=ft(()=>{ve(p);try{q(r,o),K(t,h),e&&u&&U(e,u)}catch{}a()},i+y+ct);Promise.all(p.map(S=>S.finished)).then(g).catch(g)})})}function ks(r,t,e,s){let{currentView:i,previousView:n,backView:o,backViewState:a,lastView:c,lastViewState:l,incomingTransformStart:f,incomingTransformEnd:h,outgoingTransform:u,outgoingTransformEnd:d,currentStage:v,canvas:m}=r,p=v.views[0];j(i),i.classList.replace("is-new-current-view","is-current-view"),i.classList.remove("zoom-current-view","has-no-events"),i.style.transformOrigin=p.forwardState.origin;let y=[];y.push(i.animate([{transform:f,opacity:0},{transform:h,opacity:1}],{duration:t,easing:e,fill:"forwards"})),r.keepAlive!=="visible"&&y.push(n.animate([{transform:u,opacity:1},{transform:d,opacity:0}],{duration:t,easing:e,fill:"forwards"})),o&&a&&y.push(o.animate([{transform:a.transformStart},{transform:a.transformEnd}],{duration:t,easing:e,fill:"forwards"})),c&&l&&y.push(c.animate([{transform:l.transformStart},{transform:l.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:g}=ft(()=>{ve(y),i.style.transform=h||p.forwardState.transform,o&&a&&(o.style.transform=a.transformEnd),c&&l&&(c.style.transform=l.transformEnd),r.keepAlive?(n.style.opacity="",n.style.transform=d):q(n,m),s()},t+ct);Promise.all(y.map(S=>S.finished)).then(g).catch(g)}function ve(r){for(let t of r)try{t.cancel()}catch{}}var Ue="[-+]?(?:\\d*\\.\\d+|\\d+)(?:[eE][-+]?\\d+)?",Ke=`(${Ue})(px)?`,zs=new RegExp(`^(?:translate\\(\\s*${Ke}\\s*,\\s*${Ke}\\s*\\)\\s*)?(?:scale\\(\\s*(${Ue})\\s*\\))?$`);function Ls(r){if(typeof r!="string")return null;let t=r.trim();if(t==="none")return Jt();if(!t)return null;let e=t.match(zs);if(!e)return null;let s=Number(e[1]??0),i=Number(e[3]??0),n=Number(e[5]??1);return s!==0&&!e[2]||i!==0&&!e[4]||![s,i,n].every(Number.isFinite)?null:{a:n,b:0,c:0,d:n,e:s,f:i}}function tt(r,t,e){let s=Ls(e);return s?(r.style.transformOrigin=t,r.style.transform=e,s):Re(r,t,e)}function Ge(r,t){let e=typeof globalThis<"u"&&globalThis.anime;if(!e||typeof e!="function"){console.warn('Zumly anime driver: Anime.js not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.2/anime.min.js"><\/script>'),t();return}let{type:s,currentView:i,previousView:n,lastView:o,currentStage:a,duration:c,ease:l,canvas:f}=r;if(!i||!n||!a){t();return}let h=nt(c);s==="lateral"?lt(r,t):s==="zoomIn"?Cs(e,i,n,o,a,h,l,t):s==="zoomOut"?Os(e,i,n,o,a,h,l,f,t):t()}function Cs(r,t,e,s,i,n,o,a){j(t,e,s);let c=i.views[0],l=i.views[1],f=s&&i.views[2]?i.views[2]:null,h=Qe([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:l.backwardState,forward:l.forwardState},...f?[{el:s,backward:f.backwardState,forward:f.forwardState}]:[]],"forward");Je(h,0);let u=i.stagger||0,d=n+(f?u*2:u),v={value:0};r({targets:v,value:1,duration:d,easing:es(o),update:()=>{let m=v.value*d;ts(h,m,n,u)},complete:()=>{L(t,i),L(e,i),s&&L(s,i),a()}})}function Os(r,t,e,s,i,n,o,a,c){let l=i.views[0],f=i.views[1],h=s&&i.views[2]?i.views[2]:null,u=f.backwardState,d=h?h.backwardState:null,v=Qe([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:f.backwardState,forward:f.forwardState},...h?[{el:s,backward:h.backwardState,forward:h.forwardState}]:[]],"backward");Je(v,0);let m=i.stagger||0,p=n+(h?m*2:m),y={value:0};r({targets:y,value:1,duration:p,easing:es(o),update:()=>{let g=y.value*p;ts(v,g,n,m)},complete:()=>{q(t,a),K(e,u),s&&d&&U(s,d),c()}})}function Qe(r,t){return r.map(({el:e,backward:s,forward:i})=>{if(t==="forward"){let n=tt(e,s.origin,s.transform),o=tt(e,s.origin,i.transform);return{el:e,from:n,to:o}}else{let n=tt(e,i.origin,i.transform),o=tt(e,i.origin,s.transform);return{el:e,from:n,to:o}}})}function Je(r,t){for(let{el:e,from:s,to:i}of r)e.style.transform=Et(kt(s,i,t))}function ts(r,t,e,s){for(let i=0;i<r.length;i++){let{el:n,from:o,to:a}=r[i],c=i*s,l=Math.max(0,t-c),f=e>0?Math.min(1,l/e):1;n.style.transform=Et(kt(o,a,f))}}function es(r){if(typeof r!="string")return"easeInOutQuad";let t=r.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOutQuad":t.includes("ease-in")?"easeInQuad":t.includes("ease-out")?"easeOutQuad":t}function ss(r,t){let e=typeof globalThis<"u"&&globalThis.gsap;if(!e||typeof e.to!="function"){console.warn('Zumly GSAP driver: GSAP not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"><\/script>'),t();return}let{type:s,currentView:i,previousView:n,lastView:o,currentStage:a,duration:c,ease:l,canvas:f}=r;if(!i||!n||!a){t();return}let h=te(c);s==="lateral"?lt(r,t):s==="zoomIn"?Ns(e,i,n,o,a,h,l,t):s==="zoomOut"?As(e,i,n,o,a,h,l,f,t):t()}function Ns(r,t,e,s,i,n,o,a){j(t,e,s);let c=i.views[0],l=i.views[1],f=s&&i.views[2]?i.views[2]:null;ee(t,c.backwardState),ee(e,l.backwardState),f&&ee(s,f.backwardState);let h=r.timeline({onComplete:()=>{L(t,i),L(e,i),s&&L(s,i),a()}}),u=rs(o),d=(i.stagger||0)/1e3;h.to(t,{transform:c.forwardState.transform,duration:n,ease:u},0),h.to(e,{transform:l.forwardState.transform,duration:n,ease:u},d),f&&h.to(s,{transform:f.forwardState.transform,duration:n,ease:u},d*2)}function As(r,t,e,s,i,n,o,a,c){let l=i.views[0],f=i.views[1],h=s&&i.views[2]?i.views[2]:null,u=f.backwardState,d=h?h.backwardState:null;ee(t,l.forwardState);let v=e.style.transform||getComputedStyle(e).transform||f.forwardState.transform,m=s&&h?s.style.transform||getComputedStyle(s).transform||h.forwardState.transform:null;e.style.transformOrigin=f.forwardState.origin,s&&h&&(s.style.transformOrigin=h.forwardState.origin);let p=rs(o),y=r.timeline({onComplete:()=>{q(t,a),K(e,u),s&&d&&U(s,d),c()}}),g=(i.stagger||0)/1e3;r.set(e,{transform:v}),s&&m&&r.set(s,{transform:m}),y.fromTo(t,{transform:l.forwardState.transform},{transform:l.backwardState.transform,duration:n,ease:p},0),y.fromTo(e,{transform:v},{transform:u.transform,duration:n,ease:p},g),s&&d&&y.fromTo(s,{transform:m},{transform:d.transform,duration:n,ease:p},g*2)}function ee(r,t){r.style.transformOrigin=t.origin,r.style.transform=t.transform}function rs(r){if(typeof r!="string")return"power2.inOut";let t=r.toLowerCase();return t==="linear"?"none":t.includes("ease-in-out")?"power2.inOut":t.includes("ease-in")?"power2.in":t.includes("ease-out")?"power2.out":t}function is(r,t){let e=$s();if(!e||typeof e!="function"){console.warn('Zumly Motion driver: Motion not loaded. Add <script src="https://cdn.jsdelivr.net/npm/motion@11/dist/motion.min.js"><\/script>'),t();return}let{type:s,currentView:i,previousView:n,lastView:o,currentStage:a,duration:c,ease:l,canvas:f}=r;if(!i||!n||!a){t();return}let h=te(c);s==="lateral"?lt(r,t):s==="zoomIn"?Ps(e,i,n,o,a,h,l,t):s==="zoomOut"?Is(e,i,n,o,a,h,l,f,t):t()}function Ps(r,t,e,s,i,n,o,a){j(t,e,s);let c=ns(t,e,s,i,"forward");os(c,0);let l=i.stagger||0,f=l/1e3,h=n*1e3,u=n+(c.length>2?f*2:f);r(0,1,{duration:u,ease:ls(o),onUpdate:v=>{let m=v*u*1e3;as(c,m,h,l)}}).then(()=>{L(t,i),L(e,i),s&&L(s,i),a()}).catch(()=>a())}function Is(r,t,e,s,i,n,o,a,c){let l=i.views[1],f=s&&i.views[2]?i.views[2]:null,h=l.backwardState,u=f?f.backwardState:null,d=ns(t,e,s,i,"backward");os(d,0);let v=i.stagger||0,m=v/1e3,p=n*1e3,y=n+(d.length>2?m*2:m);r(0,1,{duration:y,ease:ls(o),onUpdate:S=>{let _=S*y*1e3;as(d,_,p,v)}}).then(()=>{q(t,a),K(e,h),s&&u&&U(s,u),c()}).catch(()=>c())}function ns(r,t,e,s,i){let n=s.views[0],o=s.views[1],a=e&&s.views[2]?s.views[2]:null,c=[{el:r,backward:n.backwardState,forward:n.forwardState},{el:t,backward:o.backwardState,forward:o.forwardState}];return a&&c.push({el:e,backward:a.backwardState,forward:a.forwardState}),c.map(({el:l,backward:f,forward:h})=>i==="forward"?{el:l,from:tt(l,f.origin,f.transform),to:tt(l,f.origin,h.transform)}:{el:l,from:tt(l,h.origin,h.transform),to:tt(l,h.origin,f.transform)})}function os(r,t){for(let{el:e,from:s,to:i}of r)e.style.transform=Et(kt(s,i,t))}function as(r,t,e,s){for(let i=0;i<r.length;i++){let{el:n,from:o,to:a}=r[i],c=i*s,l=Math.max(0,t-c),f=e>0?Math.min(1,l/e):1;n.style.transform=Et(kt(o,a,f))}}function $s(){let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r.motion?.animate||r.Motion?.animate||r.animate}function ls(r){if(typeof r!="string")return"easeInOut";let t=r.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOut":t.includes("ease-in")?"easeIn":t.includes("ease-out")?"easeOut":r}var cs={css:We,waapi:Ye,none:Xe,anime:Ge,gsap:ss,motion:is};function se(r){if(typeof r=="function")return{runTransition(s,i){r(s,i)}};let t=typeof r=="string"?r.toLowerCase():"css";return{runTransition:cs[t]||cs.css}}function Zs(r){if(typeof r!="string"||r.trim()==="")return{tx:0,ty:0,rest:""};let t=ut(r);return t.matched?{tx:t.tx,ty:t.ty,rest:t.rest}:null}function fs(r,t,e){let s=Zs(r);if(s===null)return r;let i=s.tx*t,n=s.ty*e,o=s.rest?` ${s.rest}`:"";return`translate(${i}px, ${n}px)${o}`.trim()}function Ms(r){if(typeof r!="string"||!r.trim())return null;let t=r.trim().match(/^([-\d.eE]+)px\s+([-\d.eE]+)px$/);return t?{x:parseFloat(t[1]),y:parseFloat(t[2])}:null}function hs(r,t,e){let s=Ms(r);return s===null?r:`${s.x*t}px ${s.y*e}px`}function ye(r,t,e,s,i){if(!r.storedViews?.length||!r.canvas||t<=0||e<=0)return;let n=s/t,o=i/e,a=new Set,c=p=>{if(!(!p||p.detachedNode))for(let y of[p.backwardState,p.forwardState])!y||a.has(y)||(a.add(y),y.transform=fs(y.transform,n,o),y.origin!=null&&(y.origin=hs(y.origin,n,o)))},l=[...r.storedViews];for(let p of r.lateralHistory||[])p.stage&&l.push(p.stage),c(p.entry);for(let p of l)Array.isArray(p.views)&&p.views.forEach(c);let f=r.canvas,h=f.querySelector(".is-current-view"),u=f.querySelector(".is-previous-view"),d=f.querySelector(".is-last-view"),v=f.querySelector(".is-new-current-view"),m=[h,u,d,v].filter(Boolean);for(let p of m){if(!p.style)continue;let y=p.style.transform;y!=null&&y!==""&&(p.style.transform=fs(y,n,o));let g=p.style.transformOrigin;g!=null&&g!==""&&(p.style.transformOrigin=hs(g,n,o))}}var Hs=8e3,Ht=class{constructor(t){if(this.storedViews=[],this.currentStage=null,this.debug=!1,this.trace=[],this.blockEvents=!1,this._blockEventsSafetyTimer=null,this.touchstartX=0,this.touchstartY=0,this.touchendX=0,this.touchendY=0,this.touching=!1,this.lateralHistory=[],this._lastCanvasWidth=0,this._lastCanvasHeight=0,this._pendingResizeCorrection=!1,this._destroyed=!1,this._trackedTimers=new Set,this._pendingTransitionComplete=null,this._navigationTask=null,this._initPromise=null,this._accessibility=new Wt,this._hooks={},this._plugins=[],Ae(t,this),!this.isValid){this.notify("is unable to start: invalid or missing required options (mount, initialView, views).","error");return}if(this.canvas=document.querySelector(this.mount),!this.canvas){this.notify(`mount selector "${this.mount}" did not match any element.`,"error"),this.isValid=!1;return}this.transitionDriver=se(this.transitionDriver),this._onZoom=this.onZoom.bind(this),this._onTouchStart=this.onTouchStart.bind(this),this._onTouchEnd=this.onTouchEnd.bind(this),this._onTouchCancel=()=>{this.touching=!1},this._onKeyUp=this.onKeyUp.bind(this),this._onKeyDown=this.onKeyDown.bind(this),this._onKeyboardClick=e=>{e.target.closest?.(".zoom-me[data-to]")&&((e.detail===0?!this.inputs.keyboard:!this.inputs.click)||(e.preventDefault(),e.detail===0&&this.onZoom(e)))},this._onWheel=this.onWheel.bind(this),this._wheelCooldown=!1,this._onPrefetchTrigger=e=>{let s=e.target.closest?.(".zoom-me[data-to]");!this._destroyed&&s&&this.canvas.contains(s)&&this.prefetcher.prefetch(s.dataset.to,{trigger:s,context:this.componentContext,props:{...s.dataset}})},this._onResize=this._handleResize.bind(this),this._resizeDebounceTimer=null,this._RESIZE_DEBOUNCE_MS=80,this.prefetcher=new Ut(this.views),this._bindEvents()}_bindEvents(){let t=this.canvas;t&&(this._canvasAttributes=new Map(["tabindex","role","aria-roledescription","aria-live"].map(e=>[e,t.getAttribute(e)])),t.setAttribute("tabindex","0"),t.setAttribute("role","application"),t.setAttribute("aria-roledescription","zoomable interface"),t.setAttribute("aria-live","polite"),t.addEventListener("mouseup",this._onZoom,!1),t.addEventListener("touchend",this._onZoom,!1),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,!1),t.addEventListener("touchcancel",this._onTouchCancel,{passive:!0}),t.addEventListener("keyup",this._onKeyUp,!1),t.addEventListener("keydown",this._onKeyDown,!1),t.addEventListener("click",this._onKeyboardClick,!1),t.addEventListener("wheel",this._onWheel,{passive:!1}),t.addEventListener("mouseover",this._onPrefetchTrigger,{passive:!0}),t.addEventListener("focusin",this._onPrefetchTrigger,{passive:!0}),window.addEventListener("resize",this._onResize,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._handleResize()),this._resizeObserver.observe(t)))}_unbindEvents(){let t=this.canvas;t&&(t.removeEventListener("mouseup",this._onZoom,!1),t.removeEventListener("touchend",this._onZoom,!1),t.removeEventListener("touchstart",this._onTouchStart),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchCancel),t.removeEventListener("keyup",this._onKeyUp,!1),t.removeEventListener("keydown",this._onKeyDown,!1),t.removeEventListener("click",this._onKeyboardClick,!1),t.removeEventListener("wheel",this._onWheel),t.removeEventListener("mouseover",this._onPrefetchTrigger),t.removeEventListener("focusin",this._onPrefetchTrigger)),window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}_resetCanvasScroll(t){if(t&&((t.scrollLeft!==0||t.scrollTop!==0)&&(this.notify(`canvas had a residual scroll (${t.scrollLeft}, ${t.scrollTop}) \u2014 resetting. Something scrolled the canvas mid-transition.`,"warn"),t.scrollLeft=0,t.scrollTop=0),!this._warnedScrolledAncestor)){for(let e=t.parentElement;e&&e!==document.body;e=e.parentElement)if(e.scrollLeft!==0||e.scrollTop!==0){let s=e.className?`.${String(e.className).trim().split(/\s+/).join(".")}`:e.tagName.toLowerCase();this.notify(`an ancestor of the canvas (${s}) is scrolled (${e.scrollLeft}, ${e.scrollTop}): all zooms will land displaced. Use 'overflow: clip' (not 'hidden') on containers around the canvas.`,"warn"),this._warnedScrolledAncestor=!0;break}}}_setBlockEvents(){this.blockEvents=!0,this._clearBlockEventsSafety(),this._blockEventsSafetyTimer=setTimeout(()=>{if(this.blockEvents&&!this._destroyed){this.notify("blockEvents safety timeout: driver did not call onComplete. Force-resetting.","warn"),this.blockEvents=!1;let t=this._pendingTransitionComplete;t?t():this._onTransitionComplete()}},Hs)}_clearBlockEventsSafety(){this._blockEventsSafetyTimer!==null&&(clearTimeout(this._blockEventsSafetyTimer),this._blockEventsSafetyTimer=null)}_setTrackedTimeout(t,e){let s=setTimeout(()=>{this._trackedTimers.delete(s),!this._destroyed&&t()},e);return this._trackedTimers.add(s),s}_clearTrackedTimeouts(){for(let t of this._trackedTimers)clearTimeout(t);this._trackedTimers.clear()}storeViews(t){this.tracing("storedViews()"),this.storedViews.push(t),this.debug&&console.debug("Zumly storedViews",t)}tracing(t){if(this.debug)if(t==="ended"){let e=this.trace.map((s,i)=>`${i===0?`Instance ${this.mount}: ${s}`:`${s}`}`).join(" > ");this.notify(e),this.trace=[]}else this.trace.push(t)}notify(t,e){return V(this.debug,t,e)}_recordCanvasSize(){this.canvas&&(this._lastCanvasWidth=this.canvas.offsetWidth,this._lastCanvasHeight=this.canvas.offsetHeight)}_handleResize(){this._destroyed||(this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=setTimeout(()=>{if(this._resizeDebounceTimer=null,!this.isValid||!this.canvas||this._lastCanvasWidth===0)return;let t=this.canvas.offsetWidth,e=this.canvas.offsetHeight;if(!(t===this._lastCanvasWidth&&e===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}ye(this,this._lastCanvasWidth,this._lastCanvasHeight,t,e),this._lastCanvasWidth=t,this._lastCanvasHeight=e}},this._RESIZE_DEBOUNCE_MS))}_onTransitionComplete(){if(this._clearBlockEventsSafety(),this._pendingResizeCorrection&&!this.blockEvents){if(this._pendingResizeCorrection=!1,this.canvas&&this._lastCanvasWidth>0){let e=this.canvas.offsetWidth,s=this.canvas.offsetHeight;(e!==this._lastCanvasWidth||s!==this._lastCanvasHeight)&&ye(this,this._lastCanvasWidth,this._lastCanvasHeight,e,s),this._lastCanvasWidth=e,this._lastCanvasHeight=s}}else this._recordCanvasSize();for(let e of this.canvas?.children||[])e.classList.contains("z-view")&&Zt(e);let t=this.canvas?.querySelector(".is-current-view");t&&this._accessibility.restore(t),this._manageFocus(),this.canvas&&this._accessibility.sync(this.canvas)}_manageFocus(){if(!this.canvas)return;let t=this.canvas.querySelector(".is-current-view");if(!t)return;let e='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',s=n=>!n||n.closest("[inert], [hidden]")?!1:(n.focus({preventScroll:!0}),document.activeElement===n||n.contains(document.activeElement)),i=t.querySelector(e);if(!s(i)){for(let n of t.querySelectorAll(e))if(n!==i&&s(n))return;t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})}}_prefersReducedMotion(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}_resolveEffects(t){if(this._prefersReducedMotion())return["none","none"];let e=t?.dataset?.withEffects;if(e&&typeof e=="string"){let s=e.split("|").map(i=>i.trim());return[s[0]||"none",s[1]||s[0]||"none"]}return this.effects}_applyEffects(t,e,s,i,n){!s||s[0]==="none"&&s[1]==="none"||(t&&s[0]!=="none"&&(t.style.setProperty("--z-effect-filter",s[0]),t.style.setProperty("--zoom-duration",i),t.style.setProperty("--zoom-ease",n),t.classList.add("has-effect")),e&&s[1]!=="none"&&(e.style.setProperty("--z-effect-filter",s[1]),e.style.setProperty("--zoom-duration",i),e.style.setProperty("--zoom-ease",n),e.classList.add("has-effect")))}_removeEffect(t){if(!t||!t.classList.contains("has-effect"))return;t.classList.remove("has-effect"),t.classList.add("has-effect-reverse");let e=()=>{t.classList.remove("has-effect-reverse"),t.style.removeProperty("--z-effect-filter"),t.removeEventListener("transitionend",e)};t.addEventListener("transitionend",e,{once:!0});let s=t.style.getPropertyValue("--zoom-duration");this._setTrackedTimeout(e,s?parseFloat(s)*(s.includes("ms")?1:1e3)+100:1100)}_resolveHideTrigger(t){return t?.dataset?.hideTrigger!==void 0?t.dataset.hideTrigger==="fade"?"fade":!0:this.hideTrigger}_applyHideTrigger(t,e,s,i,n,o=!0){if(!(!s||!t))if(s==="fade"){if(t.style.setProperty("--zoom-duration",i),t.style.setProperty("--zoom-ease",n),t.classList.add("z-trigger-fade"),!o)return;e.style.setProperty("--zoom-duration",i),e.style.setProperty("--zoom-ease",n),e.classList.add("z-view-fade-in"),e.offsetHeight,e.classList.remove("hide")}else t.classList.add("z-trigger-hidden")}_restoreHideTrigger(t,e,s,i){if(!(!e||!t))if(e==="fade"){t.classList.remove("z-trigger-fade"),t.style.setProperty("--zoom-duration",s),t.style.setProperty("--zoom-ease",i),t.classList.add("z-trigger-fade-reverse");let n=()=>{t.classList.remove("z-trigger-fade-reverse"),t.style.removeProperty("--zoom-duration"),t.style.removeProperty("--zoom-ease"),t.removeEventListener("transitionend",n)};t.addEventListener("transitionend",n,{once:!0}),this._setTrackedTimeout(n,parseFloat(s)*(s.includes("ms")?1:1e3)+100)}else t.classList.remove("z-trigger-hidden")}on(t,e){var s;return typeof e!="function"?this:(((s=this._hooks)[t]||(s[t]=[])).push(e),this)}use(t,e){if(!t)return this;let s={plugin:t,options:e};return this._plugins.push(s),this._initialized&&this._installPlugin(s),this}_installPlugin(t){let{plugin:e,options:s}=t;try{typeof e=="function"?e(this,s):typeof e.install=="function"&&e.install(this,s)}catch(i){this.notify(`plugin install error: ${i.message}`,"error")}}off(t,e){return e?this._hooks[t]&&(this._hooks[t]=this._hooks[t].filter(s=>s!==e)):delete this._hooks[t],this}_emit(t,e={}){let s=this._hooks[t];if(!(!s||s.length===0))for(let i of s)try{i(e)}catch(n){this.debug&&console.error(`Zumly hook "${t}" threw:`,n)}}_runNavigation(t){if(this._destroyed||this.blockEvents)return Promise.resolve();let e={pendingViews:new Set};e.promise=new Promise(i=>{e.resolve=i}),this._navigationTask=e,this.blockEvents=!0,this.prefetcher?.pause();let s=()=>{this._navigationTask===e&&(this._navigationTask=null,this.blockEvents=!1,this._clearBlockEventsSafety(),this.prefetcher?.resume()),e.resolve()};try{Promise.resolve(t()).then(s,i=>{this.notify(`navigation aborted: ${i.message}`,"error"),s()})}catch(i){this.notify(`navigation aborted: ${i.message}`,"error"),s()}return e.promise}_cancelNavigation(){let t=this._navigationTask;if(this._navigationTask=null,this._pendingTransitionComplete=null,this._clearBlockEventsSafety(),this.blockEvents=!1,t){for(let e of t.pendingViews)A(e);t.pendingViews.clear(),t.releaseTransition?.(),t.resolve()}}_createViewContext(t={},e){let s={target:document.createElement("div"),context:this.componentContext,props:t};return e&&(s.trigger=e),this._navigationTask?.pendingViews.add(s.target),s}_runNavigationTransition(t,e){if(this._destroyed)return Promise.resolve();let s=this._navigationTask;return new Promise(i=>{s&&(s.releaseTransition=i);let n=()=>{if(this._pendingTransitionComplete===n){if(this._pendingTransitionComplete=null,this._destroyed){i();return}try{Promise.resolve(e()).then(i,l=>{this.notify(`transition completion failed: ${l.message}`,"error"),i()})}catch(l){this.notify(`transition completion failed: ${l.message}`,"error"),i()}}};this._setBlockEvents(),this._pendingTransitionComplete=n;let o=this._prefersReducedMotion?.(),a=o?se("none"):this.transitionDriver,c=o?{...t,duration:"0s",currentStage:{...t.currentStage,stagger:0}}:t;try{a.runTransition(c,n)}catch(l){this.notify(`transition driver failed: ${l.message}. Finishing without animation.`,"error");try{se("none").runTransition(c,n)}catch{n()}}})}zoomLevel(){return this.storedViews.length}getZoomLevel(){return this.zoomLevel()}getCurrentViewName(){return!this.storedViews||this.storedViews.length===0?null:this.storedViews[this.storedViews.length-1]?.views?.[0]?.viewName??null}async back(){if(!this._destroyed){if(this.blockEvents){this.notify("back ignored: a transition is already running.","warn");return}if(this.lateralHistory&&this.lateralHistory.length>0){let t=this.lateralHistory.pop(),e=t&&typeof t=="object"?t.name:t,s=t&&typeof t=="object"?t.entry:void 0,i=t&&typeof t=="object"?t.node:void 0;return this._doLateral(e,!0,{savedEntry:s,keepAliveNode:i,savedStage:t?.stage})}return this.zoomOut()}}async goTo(t,e={}){return this._destroyed?void 0:(e.mode==="lateral"?"lateral":"depth")==="depth"?this.zoomTo(t,e):this._doLateral(t,!1,e)}async zoomTo(t,e={}){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("zoomTo() cannot run: instance is invalid or canvas not found.","error");return}if(typeof t!="string"||!t){this.notify("zoomTo() requires a non-empty view name.","warn");return}if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`zoomTo("${t}"): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}if(this.getCurrentViewName()===t)return;let i=this.canvas.getBoundingClientRect(),n=Math.max(40,i.width*.1),o=Math.max(40,i.height*.1),c={rect:{x:i.left+(i.width-n)/2,y:i.top+(i.height-o)/2,width:n,height:o},duration:e.duration??this.duration,ease:e.ease??this.ease,props:e.props??{}};await this._doZoomIn(t,c)}init(){return this._destroyed||this._initialized?Promise.resolve():this._initPromise?this._initPromise:!this.isValid||!this.canvas?(this.notify("init() cannot run: instance is invalid or canvas element was not found.","error"),Promise.resolve()):(this._initPromise=this._runNavigation(()=>this._initialize()).finally(()=>{this._initPromise=null}),this._initPromise)}async _initialize(){this.tracing("init()");let t=this.prefetcher,e=this._createViewContext();if(this.preload&&this.preload.length&&(await t.preloadEager(this.preload,null).catch(i=>{this.notify(`preload failed: ${i.message}`,"warn")}),this._destroyed))return;let s;try{let i=await t.get(this.initialView,e);if(this._destroyed){A(i);return}if(s=await Ot(i,this.initialView,this.canvas,!0,this.views,this.componentContext),this._destroyed){A(s),s.remove();return}}catch(i){this.notify(`init() failed to resolve initial view "${this.initialView}": ${i.message}`,"error");return}if(this._emit("viewMounted",{viewName:this.initialView,node:s}),!this._destroyed){t.scanAndPrefetch(s,e),this.storeViews({zoomLevel:this.storedViews.length,scale:1,views:[{viewName:this.initialView,backwardState:{origin:"0 0",transform:""}}]}),this.currentStage=this.storedViews[this.storedViews.length-1],this._recordCanvasSize(),this._accessibility.sync(this.canvas),this._initialized=!0;for(let i of this._plugins)this._installPlugin(i)}}destroy(){if(!this._destroyed){this._destroyed=!0,this._emit("destroy"),this._cancelNavigation(),this._clearBlockEventsSafety(),this._clearTrackedTimeouts(),this._pendingTransitionComplete=null,this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._unbindEvents(),this._removeNav(),this._cleanupLateralKeepAlive(),this._accessibility.destroy(),this.canvas&&A(this.canvas);for(let t of this.storedViews){let e=he(t);e&&A(e)}if(this.blockEvents=!1,this.storedViews=[],this.currentStage=null,this.lateralHistory=[],this.trace=[],this._hooks={},this.prefetcher?.destroy(),this.prefetcher=null,this.transitionDriver=null,this.canvas)for(let[t,e]of this._canvasAttributes||[])e===null?this.canvas.removeAttribute(t):this.canvas.setAttribute(t,e);this.isValid=!1}}async _doZoomIn(t,e){return this._runNavigation(()=>this._performZoomIn(t,e))}async _performZoomIn(t,e){if(this._emit("beforeZoomIn",{viewName:t}),this._destroyed)return;this.tracing("zoomIn()");let s=this.canvas,i=e.el;this._resetCanvasScroll(s);let o=(this.storedViews.length>0?this.storedViews[this.storedViews.length-1]:null)?.scale??1;this.tracing("getView()");let a=this._createViewContext(i?{...i.dataset}:e.props??{},i),c=i?.dataset?.deferred!==void 0?!0:this.deferred,l,f=null,h=()=>{A(f),A(l),l?.remove()};try{if(c){let b=await this.prefetcher.get(t,a);if(this._destroyed){A(b);return}for(f=document.createDocumentFragment();b.firstChild;)f.appendChild(b.firstChild);l=await Ot(b,t,s,!1,{},this.componentContext)}else{let b=await this.prefetcher.get(t,a);if(this._destroyed){A(b);return}this.prefetcher.scanAndPrefetch(b,a),l=await Ot(b,t,s,!1,this.views,this.componentContext)}}catch(b){h(),this.notify(`zoomIn aborted: failed to resolve view "${t}": ${b.message}`,"error");return}if(!l){h();return}if(this._destroyed){h();return}if(c||this._emit("viewMounted",{viewName:t,node:l}),this._destroyed)return;i&&i.classList.add("zoomed");let u=s.getBoundingClientRect(),d=u.left,v=u.top,m=i?(()=>{let b=i.getBoundingClientRect();return{x:b.x,y:b.y,width:b.width,height:b.height}})():e.rect,p=i?i.dataset.withDuration||this.duration:e.duration??this.duration,y=i?i.dataset.withEase||this.ease:e.ease??this.ease,g=i?i.dataset.withCover||this.cover:e.cover??this.cover,S=i?parseInt(i.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,_=s.querySelector(".is-current-view"),x=s.querySelector(".is-previous-view"),T=s.querySelector(".is-last-view");if(!_){this.notify("zoomIn aborted: no current view found in canvas. Call init() before navigating and keep Zumly view classes intact.","error"),i&&i.classList.remove("zoomed"),h();return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],Qt(l),T&&(Qt(T),s.removeChild(T));let P,H,k,E,D,Q,C,W=_.style.transform,I=_.style.transformOrigin,F=x?x.style.transform:null,X=x?x.style.transformOrigin:null;try{_.classList.replace("is-current-view","is-previous-view"),x&&x.classList.replace("is-previous-view","is-last-view");let b=l.getBoundingClientRect(),O=_.getBoundingClientRect(),st=null,we=null,Ft=null;x&&(st=x.getBoundingClientRect(),Ft=x.querySelector(".zoomed"),we=Ft&&Ft.getBoundingClientRect?Ft.getBoundingClientRect():st);let Vt={left:d,top:v},be={width:u.width,height:u.height},_e={width:b.width,height:b.height},xe=Rt(m.width,m.height,b.width,b.height,g);C=xe.scale;let ds=xe.scaleInv;P=fe(m,Vt,_e,ds),k=_.style.transform;let Se=Ie(m,O);E=$e(be,m,O,C,this.parallax);let Te=wt(I||"0 0"),pt=rt(k||""),Ee=wt(Se),vt=rt(E.transform),ke=m;if(i&&(ke=Nt(m,O,Te,pt.tx,pt.ty,pt.scale,Ee,vt.tx,vt.ty,vt.scale)),H=Pe(ke,Vt,_e),x){D=x.style.transform;let ms=Nt(O,O,Te,pt.tx,pt.ty,pt.scale,Ee,vt.tx,vt.ty,vt.scale),ps=Me(E.x,E.y,Vt,C,o),ze=wt(X||"0 0"),oe=rt(D||""),ae=rt(ps),vs=Nt(we,st,ze,oe.tx,oe.ty,oe.scale,ze,ae.tx,ae.ty,ae.scale);Q=Ze({canvasRect:be,canvasOffset:Vt,triggerRect:m,previousViewRectAtBaseTransform:O,lastViewZoomedElementRect:vs,previousViewRectWithPreviousAtEndTransform:ms,scale:C,preScale:o,parallax:this.parallax})}l.style.transform=P,_.style.transformOrigin=Se}catch(b){this.notify(`zoomIn geometry computation failed: ${b.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",b),_.style.transform=W,_.style.transformOrigin=I,_.classList.contains("is-previous-view")&&_.classList.replace("is-previous-view","is-current-view"),x&&(x.style.transform=F,x.style.transformOrigin=X,x.classList.contains("is-last-view")&&x.classList.replace("is-last-view","is-previous-view")),h(),T&&s.prepend(T),i&&i.classList.remove("zoomed"),Zt(_),Zt(x),Zt(T);return}let B=At(l.dataset.viewName,{origin:l.style.transformOrigin,duration:p,ease:y,transform:P},{origin:l.style.transformOrigin,duration:p,ease:y,transform:H}),Dt=At(_.dataset.viewName,{origin:_.style.transformOrigin,duration:p,ease:y,transform:k},{origin:_.style.transformOrigin,duration:p,ease:y,transform:E.transform}),Lt=x?At(x.dataset.viewName,{origin:x.style.transformOrigin,duration:p,ease:y,transform:D},{origin:x.style.transformOrigin,duration:p,ease:y,transform:Q}):null,ot=T?He(T):null,et=De(this.storedViews.length,B,Dt,Lt,ot);et.scale=C,et.stagger=S||0,this.storeViews(et),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let re=this._resolveEffects(i);this._applyEffects(_,x,re,p,y);let Ct=this._resolveHideTrigger(i);this._applyHideTrigger(i,l,Ct,p,y),Ct&&(et.hideTriggerMode=Ct);let ie={type:"zoomIn",currentView:l,previousView:_,lastView:x,currentStage:this.currentStage,duration:p,ease:y},ne=async()=>{if(c&&f&&l){if(l.appendChild(f),this.prefetcher.scanAndPrefetch(l,a),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function")try{await this.views[t].mounted()}catch(b){this.notify(`deferred view mounted() failed: ${b.message}`,"error")}if(this._destroyed)return;this._emit("viewMounted",{viewName:t,node:l})}this._destroyed||(this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended"))};await this._runNavigationTransition(ie,ne),this._destroyed&&f&&A(f)}async zoomIn(t){this._destroyed||t?.dataset?.to&&await this._doZoomIn(t.dataset.to,{el:t})}async _doLateral(t,e=!1,s={}){return this._runNavigation(()=>this._performLateral(t,e,s))}async _performLateral(t,e=!1,s={}){if(!this.isValid||!this.canvas)return;if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`goTo("${t}", { mode: 'lateral' }): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}let i=this.canvas.querySelector(".is-current-view");if(!i)return;let n=i.dataset?.viewName;if(n===t||(this._emit("beforeLateral",{viewName:t,from:n,isBack:e}),this._destroyed))return;let o=this.lateralNav&&this.lateralNav.keepAlive,a=null;if(!e){this.lateralHistory=this.lateralHistory||[];let b=this.storedViews[this.storedViews.length-1];a={name:n,stage:this._copyLateralStage(b),node:o?i:null},a.entry=a.stage.views[0]}this.tracing("lateral()");let c=s.duration??this.duration,l=s.ease??this.ease,f=this.canvas.querySelector(".is-previous-view"),h=this.canvas.querySelector(".is-last-view"),u=null,d=null;if(o&&(e&&s.keepAliveNode?d=s.keepAliveNode:d=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),d){if(d.style.display="",d.style.opacity="",d.classList.remove("is-lateral-hidden","zoom-lateral-out"),d.classList.add("is-new-current-view","has-no-events"),u=d,!e&&this.lateralHistory){let b=this.lateralHistory.findIndex(O=>O.node===d);b!==-1&&this.lateralHistory.splice(b,1)}}else{let b=()=>{e&&this.lateralHistory.push({name:t,entry:s.savedEntry,stage:s.savedStage,node:s.keepAliveNode??null})},O=this._createViewContext(s.props??{});try{let st=await this.prefetcher.get(t,O);if(this._destroyed){A(st);return}this.prefetcher.scanAndPrefetch(st,O),u=await Ot(st,t,this.canvas,!1,this.views,this.componentContext)}catch(st){this.notify(`lateral navigation aborted: failed to resolve view "${t}": ${st.message}`,"error"),b();return}if(!u){b();return}if(this._destroyed){A(u),u.remove();return}if(this._emit("viewMounted",{viewName:t,node:u}),this._destroyed)return}let v=i.style.transform||"",m=this.storedViews[this.storedViews.length-1];u.style.transform="",u.style.transformOrigin="0 0";let p=new Map,y=b=>(p.has(b)||p.set(b,b.getBoundingClientRect()),p.get(b)),g=y(u),S=y(i),_=y(this.canvas),x=_.width/this.canvas.offsetWidth||1,T=_.height/this.canvas.offsetHeight||1,P=f?f.querySelectorAll(".zoom-me[data-to]"):[],H,k;for(let b of P)if(!H&&b.dataset.to===n&&(H=b),!k&&b.dataset.to===t&&(k=b),H&&k)break;let E=0,D=0,Q=this._declaredSiblings(),C=Q?Q.indexOf(n):-1,W=Q?Q.indexOf(t):-1;if(C!==-1&&W!==-1)E=(C-W)*_.width*.15;else if(f)if(H&&k){let b=y(H),O=y(k);E=b.left+b.width/2-(O.left+O.width/2),D=b.top+b.height/2-(O.top+O.height/2)}else E=_.width*.15;let I=f?{transformStart:f.style.transform||"",transformEnd:this._computeLateralBackTransform(f.style.transform||"",E,D)}:null,F=h&&m.views[2]?{transformStart:h.style.transform||"",transformEnd:this._computeLateralBackTransform(h.style.transform||"",E*.7,D*.7)}:null,X=m.views[0],B=this._computeLateralBackTransform("",(S.x-g.x+(S.width-g.width)/2)/x,(S.y-g.y+(S.height-g.height)/2)/T),Dt=rt(X.backwardState.transform||"").scale,Lt=this._computeLateralBackTransform(X.backwardState.transform||"",(S.width-g.width)*Dt/(2*x),(S.height-g.height)*Dt/(2*T)),ot=f?.querySelector(".zoomed");if(k&&I&&!(e&&s.savedStage)){let b=this._lateralTargetGeometry(u,k,f,h,m,{measure:y,outgoingView:i,canvasRect:_,sx:x,sy:T});b&&(B=b.currentEnd,Lt=b.currentBack,I.transformEnd=b.previousEnd,F&&b.lastEnd&&(F.transformEnd=b.lastEnd),m.scale=b.scale)}if(e&&s.savedStage){Object.assign(m,this._copyLateralStage(s.savedStage)),B=m.views[0].forwardState?.transform||"",Lt=m.views[0].backwardState.transform,I&&(I.transformEnd=m.views[1].forwardState.transform),F&&(F.transformEnd=m.views[2].forwardState.transform);let b=ut(I?.transformStart||v),O=ut(I?.transformEnd||B);E=O.tx-b.tx,D=O.ty-b.ty}else m.views[0]=At(t,{origin:"0 0",duration:c,ease:l,transform:Lt},{origin:"0 0",duration:c,ease:l,transform:B});this.currentStage=m,a&&this.lateralHistory.push(a),ot?.classList.remove("zoomed");let et=k?this._resolveHideTrigger(k):!1;m.hideTriggerMode=et,k&&(k.classList.add("zoomed"),this._applyHideTrigger(k,u,et,c,l,!1),et&&k.classList.add("z-trigger-hidden")),Qt(u),I&&m.views[1]&&(m.views[1].forwardState={...m.views[1].forwardState,transform:I.transformEnd}),F&&m.views[2]&&(m.views[2].forwardState={...m.views[2].forwardState,transform:F.transformEnd});let re=this._computeLateralBackTransform(B,-E,-D),Ct=this._computeLateralBackTransform(v,E,D),ie={type:"lateral",currentView:u,previousView:i,lastView:h||null,backView:f||null,backViewState:I,lastViewState:F,incomingTransformStart:re,incomingTransformEnd:B,outgoingTransform:v,outgoingTransformEnd:Ct,currentStage:this.currentStage,duration:c,ease:l,canvas:this.canvas,slideDeltaX:E,slideDeltaY:D,keepAlive:o&&!e?o:!1},ne=()=>{ot&&ot!==k&&(ot.classList.remove("z-trigger-hidden","z-trigger-fade","z-trigger-fade-reverse"),ot.style.removeProperty("--zoom-duration"),ot.style.removeProperty("--zoom-ease")),et==="fade"&&k.classList.remove("z-trigger-hidden"),o&&!e&&(i.classList.remove("is-current-view","is-new-current-view","has-no-events"),i.classList.add("is-lateral-hidden"),o!=="visible"?i.style.display="none":(i.style.transform=v,i.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:n,isBack:e}),this.tracing("ended")};return this._runNavigationTransition(ie,ne)}_copyLateralStage(t){return{...t,views:t.views.map(e=>({...e,...e.backwardState&&{backwardState:{...e.backwardState}},...(e.forwardState||e.backwardState)&&{forwardState:{...e.forwardState||e.backwardState}}}))}}_lateralTargetGeometry(t,e,s,i,n,o){let{measure:a,outgoingView:c,canvasRect:l,sx:f,sy:h}=o,u=C=>{let W=a(C);return{x:(W.x-l.x)/f,y:(W.y-l.y)/h,width:W.width/f,height:W.height/h}},d=u(t),v=u(c),m=u(s),p=u(e);if(!d.width||!d.height||!p.width||!p.height)return null;let y=rt(s.style.transform||""),g=wt(s.style.transformOrigin||"0 0"),S=e.dataset.withCover||this.cover,_=Rt(p.width,p.height,d.width,d.height,S).scale,x=y.scale*_,T=(C,W,I,F,X,B)=>Nt(C,W,I,F.tx,F.ty,F.scale,X,B.tx,B.ty,B.scale),P=T(p,m,g,y,g,{...y,scale:x}),H={tx:y.tx+v.x+v.width/2-P.x-P.width/2,ty:y.ty+v.y+v.height/2-P.y-P.height/2,scale:x},k=C=>`translate(${C.tx}px, ${C.ty}px) scale(${C.scale})`,E=T(p,m,g,y,{x:0,y:0},rt(n.views[1].backwardState.transform||"")),D=Rt(E.width,E.height,d.width,d.height,S).scaleInv,Q={currentEnd:`translate(${v.x-d.x+(v.width-d.width)/2}px, ${v.y-d.y+(v.height-d.height)/2}px)`,currentBack:fe(E,{left:d.x,top:d.y},d,D),previousEnd:k(H),scale:x};if(i&&n.views[2]){let C=u(i),W=wt(i.style.transformOrigin||"0 0"),I=rt(i.style.transform||""),F=T(m,m,g,y,g,H),X={...I,scale:I.scale*_},B=T(C,C,W,I,W,X);X.tx+=F.x+_*(C.x-m.x)-B.x,X.ty+=F.y+_*(C.y-m.y)-B.y,Q.lastEnd=k(X)}return Q}_computeLateralBackTransform(t,e,s){let i=ut(t);return i.matched?`translate(${i.tx+e}px, ${i.ty+s}px) ${i.rest}`.trim():`translate(${e}px, ${s}px) ${t}`.trim()}zoomOut(){return this._runNavigation(()=>this._performZoomOut())}_performZoomOut(){if(this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this._destroyed)return;this.tracing("zoomOut()");let t=this.canvas;this._resetCanvasScroll(t);let e=t.querySelector(".is-current-view"),s=t.querySelector(".is-previous-view");if(!e||!s){this.notify("zoomOut: current or previous view not found (animation may still be running)","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this.currentStage=this.storedViews[this.storedViews.length-1];let i=t.querySelector(".is-last-view");this.tracing("setCSSVariables()");let n=this.currentStage.views[0]?.forwardState?.duration??this.duration,o=this.currentStage.views[0]?.forwardState?.ease??this.ease,a=s.querySelector(".zoomed");a&&a.classList.remove("zoomed");let c=this.currentStage.hideTriggerMode;c&&a&&this._restoreHideTrigger(a,c,n,o),c==="fade"?(e.classList.remove("z-view-fade-in"),e.style.setProperty("--zoom-duration",n),e.style.setProperty("--zoom-ease",o),e.classList.add("z-view-fade-out")):(e.classList.remove("z-view-fade-in"),e.style.removeProperty("opacity")),this._removeEffect(s),s.classList.replace("is-previous-view","is-current-view"),i!==null&&(i.classList.contains("has-effect")&&this.effects[0]!=="none"&&i.style.setProperty("--z-effect-filter",this.effects[0]),i.classList.replace("is-last-view","is-previous-view"),i.classList.remove("hide"),$t(i));let l=he(this.currentStage);if(l){t.prepend(l);let u=t.querySelector(".z-view:first-child");u&&($t(u),u.classList.add("hide"))}let f={type:"zoomOut",currentView:e,previousView:s,lastView:i,currentStage:this.currentStage,duration:n,ease:o,canvas:t},h=()=>{this.blockEvents=!1,this._onTransitionComplete(),this.storedViews.pop(),this._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")};return this._runNavigationTransition(f,h)}onZoom(t){if(this._destroyed||t.type==="mouseup"&&t.button!==0||t.type==="click"&&!this.inputs.keyboard||t.type==="mouseup"&&!this.inputs.click||t.type==="touchend"&&!this.inputs.touch)return;let e=t.target;if(e.closest?.("[inert]")||e.closest(".z-depth-nav")||e.closest(".z-lateral-nav"))return;let s=e.classList.contains("zoom-me")||e.closest(".zoom-me");if(!this.blockEvents&&s&&!this.touching){this.tracing("onZoom() \u2192 zoomIn"),t.preventDefault(),t.stopPropagation();let i=e.classList.contains("zoom-me")?e:e.closest(".zoom-me");this.zoomIn(i);return}if(this.storedViews.length>1&&!this.blockEvents&&!s&&!this.touching){let i=this.canvas.querySelector(".is-current-view");if(i&&i.contains(e))return;let n=this._findSiblingTriggerAtPoint(t.clientX,t.clientY);if(n){this.tracing("onZoom() \u2192 lateral"),t.stopPropagation(),this._doLateral(n.dataset.to);return}this.tracing("onZoom() \u2192 zoomOut"),t.stopPropagation(),this.zoomOut()}}_findSiblingTriggerAtPoint(t,e){let s=this.canvas.querySelector(".is-previous-view");if(!s)return null;let n=this.canvas.querySelector(".is-current-view")?.dataset?.viewName;if(!n)return null;let o=s.querySelectorAll(".zoom-me[data-to]");for(let a of o){if(a.dataset.to===n)continue;let c=a.getBoundingClientRect();if(t>=c.left&&t<=c.right&&e>=c.top&&e<=c.bottom)return a}return null}_getSiblings(){let e=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,s=this._declaredSiblings();if(s&&s.indexOf(e)!==-1)return{siblings:s,currentIndex:s.indexOf(e)};let i=this.canvas.querySelector(".is-previous-view");if(!i)return{siblings:[],currentIndex:-1};let n=i.querySelectorAll(".zoom-me[data-to]"),o=[];for(let c of n)c.dataset.to&&o.push(c.dataset.to);let a=o.indexOf(e);return{siblings:o,currentIndex:a}}_declaredSiblings(){let t=this.lateralNav&&typeof this.lateralNav=="object"?this.lateralNav.siblings:null;if(!t)return null;if(Array.isArray(t))return t;let e=this.canvas.querySelector(".is-previous-view")?.dataset?.viewName;return e&&Array.isArray(t[e])?t[e]:null}_updateNav(){if(this._destroyed)return;let t=this.storedViews.length-1,e=this.canvas.querySelector(":scope > .z-view.is-current-view"),s=!!this.depthNav&&t>=1&&!e?.querySelector(".z-depth-nav"),i=this.lateralNav?this._getSiblings():null;i?.siblings.length<2&&(i=null),i&&this.lateralNav.mode==="auto"&&t>=1&&e&&e.offsetWidth>=this.canvas.offsetWidth&&e.offsetHeight>=this.canvas.offsetHeight&&(i=null),this._updateDepthNav(s),this._updateLateralNav(i)}_updateDepthNav(t){if(t===void 0){let n=this.canvas.querySelector(":scope > .z-view.is-current-view");t=!!this.depthNav&&this.storedViews.length>1&&!n?.querySelector(".z-depth-nav")}if(!t){this._depthNavElement?.remove();return}let e=this.depthNav.position||"bottom-left",s=this._depthNavElement;if(!s){s=document.createElement("div");let n=document.createElement("button");n.className="z-nav-back",n.setAttribute("aria-label","Zoom out (go back)"),n.innerHTML="&#8249;",n.type="button",n.addEventListener("click",o=>{o.stopPropagation(),!this._destroyed&&s.parentNode===this.canvas&&!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),s.appendChild(n),this._depthNavElement=s}let i="z-depth-nav z-depth-nav--"+e;s.className!==i&&(s.className=i),s.parentNode!==this.canvas&&this.canvas.appendChild(s)}_updateLateralNav(t){if(t===void 0&&(t=this.lateralNav?this._getSiblings():null,t?.siblings.length<2&&(t=null),t&&this.lateralNav.mode==="auto"&&this.storedViews.length>1)){let l=this.canvas.querySelector(":scope > .z-view.is-current-view");l&&l.offsetWidth>=this.canvas.offsetWidth&&l.offsetHeight>=this.canvas.offsetHeight&&(t=null)}if(!t){this._lateralNavState?.element.remove();return}let{siblings:e,currentIndex:s}=t,i=this.lateralNav.position||"bottom-center",n=!!this.lateralNav.arrows,o=!!this.lateralNav.dots,a=this._lateralNavState;if(!a||a.arrows!==n||a.dots!==o||a.siblings.length!==e.length||a.siblings.some((l,f)=>l!==e[f])){a?.element.remove();let l=document.createElement("div");a={element:l,siblings:[...e],currentIndex:-1,arrows:n,dots:o,dotButtons:[]};let f=(h,u,d)=>{let v=document.createElement("button");return v.className="z-nav-arrow z-nav-"+h,v.setAttribute("aria-label",u),v.innerHTML=d,v.type="button",v};if(n&&(a.prevButton=f("prev","Previous sibling view","&#8249;"),l.appendChild(a.prevButton)),o){let h=document.createElement("div");h.className="z-nav-lateral-dots";for(let u of e){let d=document.createElement("button");d.className="z-nav-dot z-nav-lat-dot",d.setAttribute("aria-label",`Go to ${u}`),d.dataset.to=u,d.type="button",a.dotButtons.push(d),h.appendChild(d)}l.appendChild(h)}n&&(a.nextButton=f("next","Next sibling view","&#8250;"),l.appendChild(a.nextButton)),l.addEventListener("click",h=>{let u=h.target.closest?.("button");if(!u||!l.contains(u))return;h.stopPropagation();let d=this._lateralNavState;if(this._destroyed||this.blockEvents||d?.element!==l||l.parentNode!==this.canvas)return;let v=u===d.prevButton?d.currentIndex-1:u===d.nextButton?d.currentIndex+1:d.dotButtons.indexOf(u);v>=0&&v<d.siblings.length&&v!==d.currentIndex&&this._doLateral(d.siblings[v])}),this._lateralNavState=a}if(a.currentIndex!==s){let l=a.dotButtons[a.currentIndex];l?.classList.remove("is-active"),l?.removeAttribute("aria-current");let f=a.dotButtons[s];f?.classList.add("is-active"),f?.setAttribute("aria-current","true"),a.currentIndex=s}a.prevButton&&a.prevButton.disabled!==s<=0&&(a.prevButton.disabled=s<=0),a.nextButton&&a.nextButton.disabled!==s>=e.length-1&&(a.nextButton.disabled=s>=e.length-1);let c="z-lateral-nav z-lateral-nav--"+i;a.element.className!==c&&(a.element.className=c),a.element.parentNode!==this.canvas&&this.canvas.appendChild(a.element)}_removeNav(){this._depthNavElement?.remove(),this._lateralNavState?.element.remove(),this._depthNavElement=null,this._lateralNavState=null}_cleanupLateralKeepAlive(){if(!this.canvas)return;let t=this.canvas.querySelectorAll(".is-lateral-hidden");for(let e of t)this._accessibility.restore(e),A(e),e.remove()}onKeyDown(t){if(this._destroyed||!this.inputs.keyboard||t.defaultPrevented||ue(t.target))return;let e=t.target.closest?.(".zoom-me[data-to]");!e||Xt(e)||e.closest("[inert]")||(t.key===" "||t.key==="Enter")&&(t.preventDefault(),t.key==="Enter"&&!t.repeat&&!this.blockEvents&&this.zoomIn(e))}onKeyUp(t){if(this._destroyed||!this.inputs.keyboard||t.defaultPrevented||ue(t.target)||t.target.closest?.("[inert]"))return;let e=t.target.closest?.(".zoom-me[data-to]");if(t.key===" "&&e&&!Xt(e)){t.preventDefault(),this.blockEvents||this.zoomIn(e);return}this.tracing("onKeyUp()"),(t.key==="ArrowLeft"||t.key==="ArrowDown")&&(t.preventDefault(),this.storedViews.length>1&&!this.blockEvents?this.zoomOut():this.notify(`is on level zero. Can't zoom out. Trigger: ${t.key}`,"warn"))}onWheel(t){this._destroyed||this.inputs.wheel&&(this._isInsideScrollable(t.target,t.deltaY)||(t.preventDefault(),!(this.blockEvents||this._wheelCooldown)&&t.deltaY>0&&this.storedViews.length>1&&(this.tracing("onWheel() \u2192 zoomOut"),this._wheelCooldown=!0,this._setTrackedTimeout(()=>{this._wheelCooldown=!1},500),this.zoomOut())))}_isInsideScrollable(t,e){let s=t,i=this.canvas.querySelector(".is-current-view");for(;s&&s!==this.canvas;){if(s===i||i&&i.contains(s)){let{overflowY:n}=window.getComputedStyle(s);if((n==="auto"||n==="scroll")&&(e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:s.scrollTop>0))return!0}s=s.parentElement}return!1}onTouchStart(t){this._destroyed||this.inputs.touch&&(this.tracing("onTouchStart()"),this.touching=!0,this.touchstartX=t.changedTouches[0].screenX,this.touchstartY=t.changedTouches[0].screenY)}onTouchEnd(t){this._destroyed||this.inputs.touch&&(this.blockEvents||(this.tracing("onTouchEnd()"),this.touchendX=t.changedTouches[0].screenX,this.touchendY=t.changedTouches[0].screenY,this.handleGesture(t)),this.touching=!1)}handleGesture(t){if(t.target.closest?.(".z-depth-nav, .z-lateral-nav"))return;t.stopPropagation(),this.tracing("handleGesture()");let e=this.touchendX-this.touchstartX,s=this.touchendY-this.touchstartY,i=Math.abs(e)<10&&Math.abs(s)<10;e<-30&&(this.storedViews.length>1&&!this.blockEvents?(this.tracing("swipe left"),this.zoomOut()):this.notify("is on level zero. Can't zoom out. Trigger: Swipe left","warn"));let n=t.target.classList.contains("zoom-me")?t.target:t.target.closest(".zoom-me");i&&!this.blockEvents&&n&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(n)),i&&this.storedViews.length>1&&!this.blockEvents&&!n&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}};var Ds={separator:"/",prefix:"/"};function ge(r,t){let e=[];for(let s of r.storedViews){let i=s.views&&s.views[0];i&&i.viewName&&e.push(i.viewName)}return e.join(t)}function Fs(r,t){let e=window.location.hash.slice(1);return e.startsWith(r)&&(e=e.slice(r.length)),e?e.split(t).filter(Boolean):[]}var us={install(r,t){let e=Object.assign({},Ds,t),s=e.separator,i=e.prefix,n=!1,o=!1,a=null,c=!1;function l(v){if(n)return;let m=ge(r,s),p="#"+i+m;window.location.hash!==p&&(n=!0,window.history[v](null,"",p),n=!1)}function f(){l("pushState")}function h(){l("replaceState")}r.on("afterZoomIn",f),r.on("afterLateral",f),r.on("afterZoomOut",h);async function u(){if(!(o||c)){o=!0,n=!0;try{for(;a&&!c;){let v=a;if(a=null,await r._navigationTask?.promise,c)return;if(a)continue;let m=ge(r,s).split(s).filter(Boolean);if(v.join(s)!==m.join(s)){if(v.length>m.length){window.history.back();continue}for(;m.length>v.length&&m.length>1;){let p=m.length;if(await r.zoomOut(),c)return;if(m=ge(r,s).split(s).filter(Boolean),a||m.length>=p)break}if(!a&&v.length===m.length&&v.length>0){let p=v[v.length-1];if(p!==m[m.length-1]){let y=r.lateralHistory||[],g=_=>typeof _=="object"?_?.name:_,S=y.map(g).lastIndexOf(p);if(S!==-1)for(;r.lateralHistory.length>S;){let _=r.lateralHistory.length;if(await r.back(),c||a||r.lateralHistory.length>=_)break}else await r.goTo(p,{mode:"lateral"})}}}}}finally{n=!1,o=!1}}}function d(){c||(a=Fs(i,s),u())}window.addEventListener("popstate",d),h(),r.on("destroy",function(){c=!0,a=null,r.off("afterZoomIn",f),r.off("afterLateral",f),r.off("afterZoomOut",h),window.removeEventListener("popstate",d)})}};Ht.Router=us;window.Zumly=Ht;})();
@@ -1 +1 @@
1
- .zumly-canvas{position:absolute;width:100%;height:100%;overflow:hidden;overflow:clip;margin:0;padding:0;perspective:1000px;cursor:zoom-out;contain:strict}.zumly-canvas:focus{outline:none}.z-view{position:absolute;contain:strict;content-visibility:auto}.z-view.is-current-view{cursor:default}.z-view.is-previous-view,.z-view.is-last-view,.z-view.has-no-events{pointer-events:none;user-select:none}.zoom-current-view,.zoom-current-view-reverse,.zoom-previous-view,.zoom-previous-view-reverse,.zoom-last-view,.zoom-last-view-reverse,.zoom-lateral-back,.zoom-lateral-out,.zoom-lateral-in{will-change:transform,opacity,filter}.z-view.has-effect{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:var(--z-effect-filter, none)}.z-view.has-effect-reverse{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:none}.z-view.hide{opacity:0}.zoom-me.z-trigger-hidden{visibility:hidden}.zoom-me.z-trigger-fade{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me.z-trigger-fade-reverse,.z-view.z-view-fade-in{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:1}.z-view.z-view-fade-out{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me{cursor:zoom-in}.zoom-me[role=button]{-webkit-tap-highlight-color:transparent}.zoom-current-view-reverse{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-current-view{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-current-view{0%{transform:var(--current-view-transform-start)}to{transform:var(--current-view-transform-end)}}.zoom-previous-view{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}.zoom-previous-view-reverse{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}@keyframes zoom-previous-view{0%{transform:var(--previous-view-transform-start)}to{transform:var(--previous-view-transform-end)}}.zoom-last-view-reverse{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-last-view{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-last-view{0%{transform:var(--last-view-transform-start)}to{transform:var(--last-view-transform-end)}}.zoom-lateral-back{animation:zoom-lateral-back var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-back{0%{transform:var(--lateral-from)}to{transform:var(--lateral-to)}}.zoom-lateral-out{animation:zoom-lateral-out var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-out{0%{transform:var(--lateral-out-from);opacity:1}to{transform:var(--lateral-out-to);opacity:0}}.zoom-lateral-in{animation:zoom-lateral-in var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-in{0%{transform:var(--lateral-in-from);opacity:0}to{transform:var(--lateral-in-to);opacity:1}}.z-depth-nav{position:absolute;z-index:10;pointer-events:none}.z-depth-nav>*{pointer-events:auto}.z-depth-nav--bottom-left{bottom:20px;left:20px}.z-depth-nav--top-left{top:20px;left:20px}.z-nav-back{width:32px;height:32px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#00000080;backdrop-filter:blur(12px);color:#fff;font-size:1.1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-back:hover{background:#ffffff2e;border-color:#fff6}.z-lateral-nav{position:absolute;z-index:10;display:flex;align-items:center;gap:0;pointer-events:none;background:#00000080;backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.12);border-radius:100px;padding:6px 10px}.z-lateral-nav>*{pointer-events:auto}.z-lateral-nav--bottom-center{bottom:20px;left:50%;transform:translate(-50%)}.z-lateral-nav--top-center{top:20px;left:50%;transform:translate(-50%)}.z-nav-arrow{width:28px;height:28px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#ffffff14;color:#fff;font-size:1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-arrow:hover:not(:disabled){background:#ffffff2e;border-color:#fff6}.z-nav-arrow:disabled{opacity:.2;cursor:default}.z-nav-lateral-dots{display:flex;align-items:center;gap:5px}.z-nav-dot{width:7px;height:7px;border-radius:50%;border:1px solid rgba(255,255,255,.3);background:#ffffff26;padding:0;cursor:default;transition:background .2s,transform .2s,border-color .2s}.z-nav-lat-dot{cursor:pointer}.z-nav-lat-dot:hover{background:#fff6}.z-nav-dot.is-active{background:#fff;border-color:#fff;transform:scale(1.35)}
1
+ .zumly-canvas{position:absolute;width:100%;height:100%;overflow:hidden;overflow:clip;margin:0;padding:0;perspective:1000px;cursor:zoom-out;contain:strict}.zumly-canvas:focus{outline:none}.zumly-canvas:focus-visible,.zumly-canvas .zoom-me:focus-visible{outline:2px solid currentColor;outline-offset:3px}@media(prefers-reduced-motion:reduce){.zumly-canvas .z-view,.zumly-canvas .zoom-me,.zumly-canvas .z-nav-dot{transition-duration:0s!important;animation-duration:0s!important;animation-delay:0s!important}}.z-view{position:absolute;contain:strict;content-visibility:auto}.z-view.is-current-view{cursor:default;content-visibility:visible}.z-view.is-previous-view,.z-view.is-last-view,.z-view.has-no-events{pointer-events:none;user-select:none}.zoom-current-view,.zoom-current-view-reverse,.zoom-previous-view,.zoom-previous-view-reverse,.zoom-last-view,.zoom-last-view-reverse,.zoom-lateral-back,.zoom-lateral-out,.zoom-lateral-in{will-change:transform,opacity,filter}.z-view.has-effect{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:var(--z-effect-filter, none)}.z-view.has-effect-reverse{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:none}.z-view.hide{opacity:0}.zoom-me.z-trigger-hidden{visibility:hidden}.zoom-me.z-trigger-fade{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me.z-trigger-fade-reverse,.z-view.z-view-fade-in{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:1}.z-view.z-view-fade-out{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me{cursor:zoom-in}.zoom-me[role=button]{-webkit-tap-highlight-color:transparent}.zoom-current-view-reverse{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-current-view{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-current-view{0%{transform:var(--current-view-transform-start)}to{transform:var(--current-view-transform-end)}}.zoom-previous-view{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}.zoom-previous-view-reverse{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}@keyframes zoom-previous-view{0%{transform:var(--previous-view-transform-start)}to{transform:var(--previous-view-transform-end)}}.zoom-last-view-reverse{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-last-view{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-last-view{0%{transform:var(--last-view-transform-start)}to{transform:var(--last-view-transform-end)}}.zoom-lateral-back{animation:zoom-lateral-back var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-back{0%{transform:var(--lateral-from)}to{transform:var(--lateral-to)}}.zoom-lateral-out{animation:zoom-lateral-out var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-out{0%{transform:var(--lateral-out-from);opacity:1}to{transform:var(--lateral-out-to);opacity:0}}.zoom-lateral-in{animation:zoom-lateral-in var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-in{0%{transform:var(--lateral-in-from);opacity:0}to{transform:var(--lateral-in-to);opacity:1}}.z-depth-nav{position:absolute;z-index:10;pointer-events:none}.z-depth-nav>*{pointer-events:auto}.z-depth-nav--bottom-left{bottom:20px;left:20px}.z-depth-nav--top-left{top:20px;left:20px}.z-nav-back{width:32px;height:32px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#00000080;backdrop-filter:blur(12px);color:#fff;font-size:1.1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-back:hover{background:#ffffff2e;border-color:#fff6}.z-lateral-nav{position:absolute;z-index:10;display:flex;align-items:center;gap:0;pointer-events:none;background:#00000080;backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.12);border-radius:100px;padding:6px 10px}.z-lateral-nav>*{pointer-events:auto}.z-lateral-nav--bottom-center{bottom:20px;left:50%;transform:translate(-50%)}.z-lateral-nav--top-center{top:20px;left:50%;transform:translate(-50%)}.z-nav-arrow{width:28px;height:28px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#ffffff14;color:#fff;font-size:1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-arrow:hover:not(:disabled){background:#ffffff2e;border-color:#fff6}.z-nav-arrow:disabled{opacity:.2;cursor:default}.z-nav-lateral-dots{display:flex;align-items:center;gap:5px}.z-nav-dot{width:7px;height:7px;border-radius:50%;border:1px solid rgba(255,255,255,.3);background:#ffffff26;padding:0;cursor:default;transition:background .2s,transform .2s,border-color .2s}.z-nav-lat-dot{cursor:pointer}.z-nav-lat-dot:hover{background:#fff6}.z-nav-dot.is-active{background:#fff;border-color:#fff;transform:scale(1.35)}