zumly 0.92.4 → 0.92.5
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/README.md +7 -1
- package/dist/zumly.cjs +7 -0
- package/dist/zumly.css +1 -3
- package/dist/zumly.js +2 -2
- package/dist/zumly.min.css +1 -1
- package/dist/zumly.mjs +2 -2
- package/docs/DRIVER_API.md +1 -1
- package/package.json +10 -6
- package/src/drivers/anime-transition.js +185 -0
- package/src/drivers/css-transition.js +261 -0
- package/src/drivers/driver-helpers.d.ts +23 -0
- package/src/drivers/gsap-transition.js +149 -0
- package/src/drivers/motion-transition.js +178 -0
- package/src/drivers/none-transition.js +54 -0
- package/src/drivers/waapi-transition.js +243 -0
- package/types/zumly.d.ts +4 -4
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ await app.init();
|
|
|
131
131
|
| `transitions` | object | No | Duration, ease, cover, driver, effects, stagger, hideTrigger for zoom transitions. |
|
|
132
132
|
| `deferred` | boolean | No | Defer content rendering until after animation completes (default: `false`). |
|
|
133
133
|
| `debug` | boolean | No | Enable debug messages (default: `false`). |
|
|
134
|
-
| `lateralNav` | boolean \| object | No | Lateral navigation UI: `{ mode, arrows, dots, keepAlive, position }`. |
|
|
134
|
+
| `lateralNav` | boolean \| object | No | Lateral navigation UI: `{ mode, arrows, dots, keepAlive, position, siblings }`. |
|
|
135
135
|
| `depthNav` | boolean \| object | No | Depth back button: `{ position }`. Default: `'bottom-left'`. |
|
|
136
136
|
| `inputs` | boolean \| object | No | Input methods: `{ click, keyboard, wheel, touch }`. |
|
|
137
137
|
| `componentContext` | object | No | Context passed to component-style views. |
|
|
@@ -165,6 +165,8 @@ transitions: {
|
|
|
165
165
|
| `'motion'` | [Motion](https://motion.dev/) — requires global `Motion` (load from CDN before use). |
|
|
166
166
|
| `function(spec, onComplete)` | Custom driver. Receives `{ type, currentView, previousView, lastView, currentStage, duration, ease }` and must call `onComplete()` when done. |
|
|
167
167
|
|
|
168
|
+
> Note: only the `css` and `waapi` drivers animate **lateral** navigation with a slide; `anime`, `gsap`, `motion` and `none` perform lateral moves instantly.
|
|
169
|
+
|
|
168
170
|
Example with instant transitions (e.g. for tests):
|
|
169
171
|
|
|
170
172
|
```js
|
|
@@ -184,6 +186,8 @@ lateralNav: false // disabled
|
|
|
184
186
|
lateralNav: { mode: 'always' } // always show when siblings exist
|
|
185
187
|
lateralNav: { mode: 'auto', dots: false } // auto mode, no dots
|
|
186
188
|
lateralNav: { position: 'top-center' } // top instead of bottom
|
|
189
|
+
lateralNav: { siblings: ['today', 'tomorrow', 'week'] } // declared sibling order
|
|
190
|
+
lateralNav: { siblings: { home: ['today', 'tomorrow', 'week'] } } // per-parent groups
|
|
187
191
|
```
|
|
188
192
|
|
|
189
193
|
| Mode | Description |
|
|
@@ -193,6 +197,8 @@ lateralNav: { position: 'top-center' } // top instead of bottom
|
|
|
193
197
|
|
|
194
198
|
Position: `'bottom-center'` (default) or `'top-center'`.
|
|
195
199
|
|
|
200
|
+
`siblings` declares the sibling order for lateral navigation. It takes precedence over inferring the order (and slide direction) from trigger positions in the parent view — non-adjacent jumps slide proportionally further. Use an array for a single lateral group, or a map keyed by parent view name for per-parent groups.
|
|
201
|
+
|
|
196
202
|
**Depth navigation (back button):**
|
|
197
203
|
|
|
198
204
|
```js
|
package/dist/zumly.cjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* zumly
|
|
3
|
+
* v.0.92.5
|
|
4
|
+
* Author Juan Martin Muda - Zumerlab
|
|
5
|
+
* License MIT
|
|
6
|
+
*/
|
|
7
|
+
var Et=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var ze=Object.prototype.hasOwnProperty;var ke=(s,t)=>{for(var e in t)Et(s,e,{get:t[e],enumerable:!0})},Ce=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Le(t))!ze.call(s,n)&&n!==e&&Et(s,n,{get:()=>t[n],enumerable:!(r=xe(t,n))||r.enumerable});return s};var Oe=s=>Ce(Et({},"__esModule",{value:!0}),s);var ts={};ke(ts,{Zumly:()=>Q,ZumlyRouter:()=>Ot,default:()=>Je});module.exports=Oe(ts);var ft=class{#t={};constructor(t={}){this.#t=t}#e(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 resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(this.#t,t)){let n=this.#t[t];return this.resolve(n,e)}switch(this.#e(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")}}};async function et(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 T(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 Ht(s,t){if(t.isValid=!1,!s||typeof s!="object"){T(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){T(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){T(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){T(!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&&T(!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&&T(!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&&T(!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 m=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=m.includes(c)?c:"css",m.includes(c)||T(!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 h=e&&e.stagger;typeof h=="number"&&h>0?t.stagger=h:(t.stagger=0,h!=null&&h!==0&&T(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0;let u=s.lateralNav;if(u===!1)t.lateralNav=!1;else if(u&&typeof u=="object"){let m=typeof u.mode=="string"?u.mode.toLowerCase():null,g=m==="auto"||m==="always";m&&!g&&T(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let w=null;if(Array.isArray(u.siblings))w=u.siblings.filter(y=>typeof y=="string"&&y),w.length<2&&(T(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),w=null);else if(u.siblings&&typeof u.siblings=="object"){w={};for(let[y,b]of Object.entries(u.siblings))if(Array.isArray(b)){let _=b.filter(C=>typeof C=="string"&&C);_.length>=2&&(w[y]=_)}Object.keys(w).length===0&&(w=null)}else u.siblings!==void 0&&T(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:g?m:"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:w}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let d=s.depthNav;if(d===!1)t.depthNav=!1;else if(d&&typeof d=="object"){let m=typeof d.position=="string"?d.position.toLowerCase():null,g=m==="bottom-left"||m==="top-left";m&&!g&&T(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:g?m:"bottom-left"}}else t.depthNav={position:"bottom-left"};let v=s.lateralNav&&typeof s.lateralNav=="object"?s.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let m=v==="bottom-center"||v==="top-center";v&&!m&&T(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=m?v:"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 jt(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 Rt(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 qt(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 Bt(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 Vt(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 Xt({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,h=s.width/2-e.width/2-e.x,u=s.height/2-e.height/2-e.y,d=h+(r.x-n.x)+o.x-c+(o.width-n.width)/2,v=u+(r.y-n.y)+o.y-f+(o.height-n.height)/2,p=1-Math.min(l*2,.9);return`translate(${d*p}px, ${v*p}px) scale(${i*a})`}function Yt(s,t,e,r,n){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*n})`}function ht(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function st(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 rt(s){let t=st(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 ut(s,t,e,r,n,o,i,a,l,c){let f=t.x-e.x*(1-o)-r,h=t.y-e.y*(1-o)-n,u=t.width/o,d=t.height/o,v=f+e.x+(s.x-f-e.x-r)/o,p=h+e.y+(s.y-h-e.y-n)/o,m=s.width/o,g=s.height/o,w=f+i.x+a+c*(v-f-i.x),y=h+i.y+l+c*(p-h-i.y),b=m*c,_=g*c;return{x:w,y,width:b,height:_,left:w,top:y,right:w+b,bottom:y+_}}function nt(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function Ut(s){return{detachedNode:s}}function Wt(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 Kt(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var dt=class{#t=new Map;set(t,e,r=null){this.#t.set(t,{node:e,expires:r?Date.now()+r:null})}get(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>e.expires?(this.#t.delete(t),null):e.node.cloneNode(!0):null}has(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>e.expires?(this.#t.delete(t),!1):!0:!1}invalidate(t){this.#t.delete(t)}clear(){this.#t.clear()}};var Ae=300*1e3,Pe=/^https?:\/\/|^\/|\.html$|\.php$/i,mt=class{#t;#e;#r;#s=new Map;constructor(t={}){this.#r=t,this.#t=new ft(t),this.#e=new dt}#n(t){return typeof this.#r[t]=="string"}#o(t){return Pe.test(t)?Ae:null}async get(t,e=null){if(this.#n(t)){let r=this.#e.get(t);if(r)return r;if(this.#s.has(t))return this.#s.get(t);let n=(async()=>{try{let o=await this.#t.resolve(t,e),i=this.#r[t],a=this.#o(i);return this.#e.set(t,o,a),o}finally{this.#s.delete(t)}})();return this.#s.set(t,n),n}return this.#t.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))})}};function U(s){s&&(s.style.contentVisibility="hidden")}function B(s){s&&(s.style.contentVisibility="visible")}function N(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 pt(s){return N(s)/1e3}function E(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 O(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 A(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 z(s,t){try{t&&t.removeChild(s)}catch{try{s.parentElement&&t.removeChild(s.parentElement)}catch{}}}function x(...s){for(let t of s)t&&(t.classList.remove("hide"),B(t))}function D(s,t){let{currentView:e,previousView:r,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:f}=s,h=c.views[0];x(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=l||h.forwardState.transform,n&&o&&(n.style.transform=o.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||z(r,f),t()}var F=150;function H(s,t){let e=!1,r=setTimeout(()=>{e||(e=!0,s())},t);return{finish(){e||(e=!0,clearTimeout(r),s())},safetyTimer:r}}function Gt(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function Ie(s){if(!s||s==="none")return Gt();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}:Gt()}function K(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function W(s,t,e){return s+(t-s)*e}function G(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:W(s.a,t.a,r),b:W(s.b,t.b,r),c:W(s.c,t.c,r),d:W(s.d,t.d,r),e:W(s.e,t.e,r),f:W(s.f,t.f,r)}}function P(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return Ie(getComputedStyle(s).transform)}function Qt(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"?$e(s,t):e==="zoomIn"?Ze(r,n,o,i,a,l,t):e==="zoomOut"?Ne(r,n,o,i,a,l,c,t):t()}function $e(s,t){let{currentView:e,previousView:r,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:f,outgoingTransformEnd:h,currentStage:u,duration:d,ease:v,canvas:p}=s,m=N(d),g=u.views[0];x(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&&(I(n,d,v,{"--lateral-from":o.transformStart,"--lateral-to":o.transformEnd}),n.classList.add("zoom-lateral-back")),i&&a&&(I(i,d,v,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(I(r,d,v,{"--lateral-out-from":f,"--lateral-out-to":h}),r.classList.add("zoom-lateral-out")),I(e,d,v,{"--lateral-in-from":l,"--lateral-in-to":c}),e.classList.add("zoom-lateral-in");let w=s.keepAlive==="visible"?[e]:[r,e];n&&o&&w.push(n),i&&a&&w.push(i);let y=w.length,{finish:b}=H(()=>{Tt(w,_),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):z(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()},m+F);function _(C){let $=C?.target;$&&$.removeEventListener("animationend",_),y--,y<=0&&b()}w.forEach(C=>C.addEventListener("animationend",_))}function Ze(s,t,e,r,n,o,i){x(s,t,e);let a=r.stagger||0;I(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"),I(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&&(I(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=N(n),h=e?a*2:a,{finish:u}=H(()=>{Tt(l,d),l.forEach(v=>v.style.removeProperty("animation-delay")),i()},f+h+F);function d(v){let p=v?.target;if(p&&p.removeEventListener("animationend",d),p?.isConnected)try{E(p,r)}catch{}c--,c<=0&&u()}l.forEach(v=>v.addEventListener("animationend",d))}function Ne(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,h=r.stagger||0;I(s,n,o,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),h>0&&s.style.setProperty("animation-delay","0ms"),I(t,n,o,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),h>0&&t.style.setProperty("animation-delay",`${h}ms`),e&&f&&(I(e,n,o,{"--last-view-transform-start":f.backwardState.transform,"--last-view-transform-end":f.forwardState.transform}),h>0&&e.style.setProperty("animation-delay",`${h*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 u=e?[s,t,e]:[s,t],d=u.length,v=N(n),p=e?h*2:h,{finish:m}=H(()=>{Tt(u,g),u.forEach(w=>w.style.removeProperty("animation-delay")),a()},v+p+F);function g(w){let y=w?.target;if(y&&y.removeEventListener("animationend",g),y?.isConnected)try{Me(y,r,i)}catch{}d--,d<=0&&m()}u.forEach(w=>w.addEventListener("animationend",g))}function Me(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){z(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){O(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&A(s,t.views[2].backwardState)}function I(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 Tt(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function Jt(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"){D(s,t);return}if(e==="zoomIn"){x(r,n,o),E(r,i),E(n,i),o&&E(o,i),t();return}if(e==="zoomOut"){z(r,a),x(n,o),O(n,i.views[1].backwardState),o&&A(o,i.views[2].backwardState),t();return}t()}function te(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=N(a);if(e==="lateral"){He(s,f,l,t);return}if(e==="zoomIn"){De(r,n,o,i,f,l,t);return}if(e==="zoomOut"){Fe(r,n,o,i,f,l,c,t);return}t()}function De(s,t,e,r,n,o,i){x(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,h=[];h.push(s.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:n,easing:o,fill:"forwards"})),h.push(t.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:n,delay:f,easing:o,fill:"forwards"})),c&&h.push(e.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:n,delay:f*2,easing:o,fill:"forwards"}));let u=c?f*2:f,{finish:d}=H(()=>{xt(h);try{E(s,r),E(t,r),e&&E(e,r)}catch{}i()},n+u+F);Promise.all(h.map(v=>v.finished)).then(d).catch(d)}function Fe(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,h=c.backwardState,u=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 d=t.style.transform||getComputedStyle(t).transform||c.forwardState.transform,v=e&&f?e.style.transform||getComputedStyle(e).transform||f.forwardState.transform:null,p=r.stagger||0,m=[];m.push(s.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:n,easing:o,fill:"forwards"})),m.push(t.animate([{transform:d},{transform:h.transform}],{duration:n,delay:p,easing:o,fill:"both"})),e&&u&&m.push(e.animate([{transform:v},{transform:u.transform}],{duration:n,delay:p*2,easing:o,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let g=e&&u?p*2:p,{finish:w}=H(()=>{xt(m);try{z(s,i),O(t,h),e&&u&&A(e,u)}catch{}a()},n+g+F);Promise.all(m.map(y=>y.finished)).then(w).catch(w)})})}function He(s,t,e,r){let{currentView:n,previousView:o,backView:i,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:f,incomingTransformEnd:h,outgoingTransform:u,outgoingTransformEnd:d,currentStage:v,canvas:p}=s,m=v.views[0];x(n),n.classList.replace("is-new-current-view","is-current-view"),n.classList.remove("zoom-current-view","has-no-events"),n.style.transformOrigin=m.forwardState.origin;let g=[];g.push(n.animate([{transform:f,opacity:0},{transform:h,opacity:1}],{duration:t,easing:e,fill:"forwards"})),s.keepAlive!=="visible"&&g.push(o.animate([{transform:u,opacity:1},{transform:d,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:w}=H(()=>{xt(g),n.style.transform=h||m.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),s.keepAlive?(o.style.opacity="",o.style.transform=d):z(o,p),r()},t+F);Promise.all(g.map(y=>y.finished)).then(w).catch(w)}function xt(s){for(let t of s)try{t.cancel()}catch{}}function ee(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 h=N(l);r==="lateral"?D(s,t):r==="zoomIn"?je(e,n,o,i,a,h,c,t):r==="zoomOut"?Re(e,n,o,i,a,h,c,f,t):t()}function je(s,t,e,r,n,o,i,a){x(t,e,r);let l=n.views[0],c=n.views[1],f=r&&n.views[2]?n.views[2]:null,h=se([{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");re(h,0);let u=n.stagger||0,d=o+(f?u*2:u),v={value:0};s({targets:v,value:1,duration:d,easing:oe(i),update:()=>{let p=v.value*d;ne(h,p,o,u)},complete:()=>{E(t,n),E(e,n),r&&E(r,n),a()}})}function Re(s,t,e,r,n,o,i,a,l){let c=n.views[0],f=n.views[1],h=r&&n.views[2]?n.views[2]:null,u=f.backwardState,d=h?h.backwardState:null,v=se([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:f.backwardState,forward:f.forwardState},...h?[{el:r,backward:h.backwardState,forward:h.forwardState}]:[]],"backward");re(v,0);let p=n.stagger||0,m=o+(h?p*2:p),g={value:0};s({targets:g,value:1,duration:m,easing:oe(i),update:()=>{let w=g.value*m;ne(v,w,o,p)},complete:()=>{z(t,a),O(e,u),r&&d&&A(r,d),l()}})}function se(s,t){return s.map(({el:e,backward:r,forward:n})=>{if(t==="forward"){let o=P(e,r.origin,r.transform),i=P(e,r.origin,n.transform);return{el:e,from:o,to:i}}else{let o=P(e,n.origin,n.transform),i=P(e,n.origin,r.transform);return{el:e,from:o,to:i}}})}function re(s,t){for(let{el:e,from:r,to:n}of s)e.style.transform=K(G(r,n,t))}function ne(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=K(G(i,a,f))}}function oe(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 ie(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 h=pt(l);r==="lateral"?D(s,t):r==="zoomIn"?qe(e,n,o,i,a,h,c,t):r==="zoomOut"?Be(e,n,o,i,a,h,c,f,t):t()}function qe(s,t,e,r,n,o,i,a){x(t,e,r);let l=n.views[0],c=n.views[1],f=r&&n.views[2]?n.views[2]:null;vt(t,l.backwardState),vt(e,c.backwardState),f&&vt(r,f.backwardState);let h=s.timeline({onComplete:()=>{E(t,n),E(e,n),r&&E(r,n),a()}}),u=ae(i),d=(n.stagger||0)/1e3;h.to(t,{transform:l.forwardState.transform,duration:o,ease:u},0),h.to(e,{transform:c.forwardState.transform,duration:o,ease:u},d),f&&h.to(r,{transform:f.forwardState.transform,duration:o,ease:u},d*2)}function Be(s,t,e,r,n,o,i,a,l){let c=n.views[0],f=n.views[1],h=r&&n.views[2]?n.views[2]:null,u=f.backwardState,d=h?h.backwardState:null;vt(t,c.forwardState);let v=e.style.transform||getComputedStyle(e).transform||f.forwardState.transform,p=r&&h?r.style.transform||getComputedStyle(r).transform||h.forwardState.transform:null;e.style.transformOrigin=f.forwardState.origin,r&&h&&(r.style.transformOrigin=h.forwardState.origin);let m=ae(i),g=s.timeline({onComplete:()=>{z(t,a),O(e,u),r&&d&&A(r,d),l()}}),w=(n.stagger||0)/1e3;s.set(e,{transform:v}),r&&p&&s.set(r,{transform:p}),g.fromTo(t,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:o,ease:m},0),g.fromTo(e,{transform:v},{transform:u.transform,duration:o,ease:m},w),r&&d&&g.fromTo(r,{transform:p},{transform:d.transform,duration:o,ease:m},w*2)}function vt(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function ae(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 le(s,t){let e=Ye();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 h=pt(l);r==="lateral"?D(s,t):r==="zoomIn"?Ve(e,n,o,i,a,h,c,t):r==="zoomOut"?Xe(e,n,o,i,a,h,c,f,t):t()}function Ve(s,t,e,r,n,o,i,a){x(t,e,r);let l=ce(t,e,r,n,"forward");fe(l,0);let c=n.stagger||0,f=c/1e3,h=o*1e3,u=o+(l.length>2?f*2:f);s(0,1,{duration:u,ease:ue(i),onUpdate:v=>{let p=v*u*1e3;he(l,p,h,c)}}).then(()=>{E(t,n),E(e,n),r&&E(r,n),a()}).catch(()=>a())}function Xe(s,t,e,r,n,o,i,a,l){let c=n.views[1],f=r&&n.views[2]?n.views[2]:null,h=c.backwardState,u=f?f.backwardState:null,d=ce(t,e,r,n,"backward");fe(d,0);let v=n.stagger||0,p=v/1e3,m=o*1e3,g=o+(d.length>2?p*2:p);s(0,1,{duration:g,ease:ue(i),onUpdate:y=>{let b=y*g*1e3;he(d,b,m,v)}}).then(()=>{z(t,a),O(e,h),r&&u&&A(r,u),l()}).catch(()=>l())}function ce(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:h})=>n==="forward"?{el:c,from:P(c,f.origin,f.transform),to:P(c,f.origin,h.transform)}:{el:c,from:P(c,h.origin,h.transform),to:P(c,h.origin,f.transform)})}function fe(s,t){for(let{el:e,from:r,to:n}of s)e.style.transform=K(G(r,n,t))}function he(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=K(G(i,a,f))}}function Ye(){let s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return s.motion?.animate||s.Motion?.animate||s.animate}function ue(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 de={css:Qt,waapi:te,none:Jt,anime:ee,gsap:ie,motion:le};function me(s){if(typeof s=="function")return{runTransition(r,n){s(r,n)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:de[t]||de.css}}function Ue(s){if(typeof s!="string"||s.trim()==="")return{tx:0,ty:0,rest:""};let t=st(s);return t.matched?{tx:t.tx,ty:t.ty,rest:t.rest}:null}function Lt(s,t,e){let r=Ue(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 We(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 zt(s,t,e){let r=We(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function kt(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 d of s.storedViews){let v=d.views;if(Array.isArray(v))for(let p=0;p<v.length;p++){let m=v[p];!m||m.detachedNode||(m.backwardState&&(m.backwardState.transform=Lt(m.backwardState.transform,o,i),m.backwardState.origin!=null&&(m.backwardState.origin=zt(m.backwardState.origin,o,i))),m.forwardState&&(m.forwardState.transform=Lt(m.forwardState.transform,o,i),m.forwardState.origin!=null&&(m.forwardState.origin=zt(m.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"),h=a.querySelector(".is-new-current-view"),u=[l,c,f,h].filter(Boolean);for(let d of u){if(!d.style)continue;let v=d.style.transform;v!=null&&v!==""&&(d.style.transform=Lt(v,o,i));let p=d.style.transformOrigin;p!=null&&p!==""&&(d.style.transformOrigin=zt(p,o,i))}}var Ke=8e3,Q=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=[],Ht(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=me(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 mt(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()}},Ke)}_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 T(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}kt(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)&&kt(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){return typeof e!="function"?this:((this._hooks[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 et(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??{}},h=n?.dataset?.deferred!==void 0?!0:this.deferred,u,d=null;try{if(h){let S=await this.prefetcher.get(t,f);if(this._destroyed)return;for(d=document.createDocumentFragment();S.firstChild;)d.appendChild(S.firstChild);u=await et(S,t,r,!1,{},this.componentContext)}else{let S=await this.prefetcher.get(t,f);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(S,f),u=await et(S,t,r,!1,this.views,this.componentContext)}}catch(S){this.notify(`zoomIn aborted: failed to resolve view "${t}": ${S.message}`,"error");return}if(!u)return;h||this._emit("viewMounted",{viewName:t,node:u}),n&&n.classList.add("zoomed");let v=n?(()=>{let S=n.getBoundingClientRect();return{x:S.x,y:S.y,width:S.width,height:S.height}})():e.rect,p=n?n.dataset.withDuration||this.duration:e.duration??this.duration,m=n?n.dataset.withEase||this.ease:e.ease??this.ease,g=n?n.dataset.withCover||this.cover:e.cover??this.cover,w=n?parseInt(n.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,y=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),_=r.querySelector(".is-last-view");if(!y){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(u)}catch{}return}U(u),U(y),U(b),_&&(U(_),r.removeChild(_));let C,$,j,M,J,it,R,tt=y.style.transform,L=y.style.transformOrigin,Z=b?b.style.transform:null,k=b?b.style.transformOrigin:null;try{y.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let S=u.getBoundingClientRect(),q=y.getBoundingClientRect(),bt=null,At=null,lt=null;b&&(bt=b.getBoundingClientRect(),lt=b.querySelector(".zoomed"),At=lt&<.getBoundingClientRect?lt.getBoundingClientRect():bt);let ct={left:i,top:a},Pt={width:o.width,height:o.height},It={width:S.width,height:S.height},$t=jt(v.width,v.height,S.width,S.height,g);R=$t.scale;let _e=$t.scaleInv;C=Rt(v,ct,It,_e),j=y.style.transform;let Zt=Bt(v,q);M=Vt(Pt,v,q,R,this.parallax);let Nt=ht(L||"0 0"),X=rt(j||""),Mt=ht(Zt),Y=rt(M.transform),Dt=v;if(n&&(Dt=ut(v,q,Nt,X.tx,X.ty,X.scale,Mt,Y.tx,Y.ty,Y.scale)),$=qt(Dt,ct,It),b){J=b.style.transform;let Se=ut(q,q,Nt,X.tx,X.ty,X.scale,Mt,Y.tx,Y.ty,Y.scale),Ee=Yt(M.x,M.y,ct,R,c),Ft=ht(k||"0 0"),_t=rt(J||""),St=rt(Ee),Te=ut(At,bt,Ft,_t.tx,_t.ty,_t.scale,Ft,St.tx,St.ty,St.scale);it=Xt({canvasRect:Pt,canvasOffset:ct,triggerRect:v,previousViewRectAtBaseTransform:q,lastViewZoomedElementRect:Te,previousViewRectWithPreviousAtEndTransform:Se,scale:R,preScale:c,parallax:this.parallax})}u.style.transform=C,y.style.transformOrigin=Zt}catch(S){this.notify(`zoomIn geometry computation failed: ${S.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",S),y.style.transform=tt,y.style.transformOrigin=L,y.classList.contains("is-previous-view")&&y.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=Z,b.style.transformOrigin=k,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(u)}catch{}n&&n.classList.remove("zoomed"),B(y),B(b);return}let V=nt(u.dataset.viewName,{origin:u.style.transformOrigin,duration:p,ease:m,transform:C},{origin:u.style.transformOrigin,duration:p,ease:m,transform:$}),ve=nt(y.dataset.viewName,{origin:y.style.transformOrigin,duration:p,ease:m,transform:j},{origin:y.style.transformOrigin,duration:p,ease:m,transform:M.transform}),ye=b?nt(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:m,transform:J},{origin:b.style.transformOrigin,duration:p,ease:m,transform:it}):null,we=_?Ut(_):null,at=Wt(this.storedViews.length,V,ve,ye,we);at.scale=R,at.stagger=w||0,this.storeViews(at),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let ge=this._resolveEffects(n);this._applyEffects(y,b,ge,p,m);let wt=this._resolveHideTrigger(n);this._applyHideTrigger(n,u,wt,p,m),wt&&(at.hideTriggerMode=wt),this._setBlockEvents();let be={type:"zoomIn",currentView:u,previousView:y,lastView:b,currentStage:this.currentStage,duration:p,ease:m},gt=async()=>{this._pendingTransitionComplete===gt&&(this._pendingTransitionComplete=null,!this._destroyed&&(h&&d&&u&&(u.appendChild(d),this.prefetcher.scanAndPrefetch(u,f),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function"&&await this.views[t].mounted(),this._emit("viewMounted",{viewName:t,node:u})),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended")))};this._pendingTransitionComplete=gt,this.transitionDriver.runTransition(be,gt)}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 L=this.storedViews[this.storedViews.length-1];a={name:o,entry:L.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"),h=this.canvas.querySelector(".is-last-view"),u=0,d=0,v=this._declaredSiblings(),p=v?v.indexOf(o):-1,m=v?v.indexOf(t):-1;if(p!==-1&&m!==-1){let L=this.canvas.getBoundingClientRect();u=(p-m)*L.width*.15}else if(f){let L=f.querySelector(`.zoom-me[data-to="${o}"]`),Z=f.querySelector(`.zoom-me[data-to="${t}"]`);if(L&&Z){let k=L.getBoundingClientRect(),V=Z.getBoundingClientRect();u=k.left+k.width/2-(V.left+V.width/2),d=k.top+k.height/2-(V.top+V.height/2)}else u=this.canvas.getBoundingClientRect().width*.15}let g=null,w=null;if(i&&(e&&r.keepAliveNode?w=r.keepAliveNode:w=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),w){if(w.style.display="",w.style.opacity="",w.classList.remove("is-lateral-hidden","zoom-lateral-out"),w.classList.add("is-new-current-view","has-no-events"),g=w,!e&&this.lateralHistory){let L=this.lateralHistory.findIndex(Z=>Z.node===w);L!==-1&&this.lateralHistory.splice(L,1)}}else{let L=()=>{e&&this.lateralHistory.push({name:t,entry:r.savedEntry,node:r.keepAliveNode??null})},Z={target:document.createElement("div"),context:this.componentContext,props:r.props??{}};try{let k=await this.prefetcher.get(t,Z);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(k,Z),g=await et(k,t,this.canvas,!1,this.views,this.componentContext)}catch(k){this.notify(`lateral navigation aborted: failed to resolve view "${t}": ${k.message}`,"error"),L();return}if(!g){L();return}this._emit("viewMounted",{viewName:t,node:g})}a&&this.lateralHistory.push(a),U(g);let y=n.style.transform||"",b=n.style.transformOrigin||"0 0";g.style.transform=y,g.style.transformOrigin=b;let _=this.storedViews[this.storedViews.length-1],C=e&&r.savedEntry?{...r.savedEntry,viewName:t}:nt(t,{origin:b,duration:l,ease:c,transform:y},{origin:b,duration:l,ease:c,transform:y});_.views[0]=C,this.currentStage=_;let $=f?{transformStart:f.style.transform||"",transformEnd:this._computeLateralBackTransform(f.style.transform||"",u,d)}:null,j=h&&_.views[2]?{transformStart:h.style.transform||"",transformEnd:this._computeLateralBackTransform(h.style.transform||"",u*.7,d*.7)}:null;$&&_.views[1]&&(_.views[1].forwardState={..._.views[1].forwardState,transform:$.transformEnd}),j&&_.views[2]&&(_.views[2].forwardState={..._.views[2].forwardState,transform:j.transformEnd});let M=y,J=this._computeLateralBackTransform(M,-u,-d),it=this._computeLateralBackTransform(y,u,d);this._setBlockEvents();let R={type:"lateral",currentView:g,previousView:n,lastView:h||null,backView:f||null,backViewState:$,lastViewState:j,incomingTransformStart:J,incomingTransformEnd:M,outgoingTransform:y,outgoingTransformEnd:it,currentStage:this.currentStage,duration:l,ease:c,canvas:this.canvas,slideDeltaX:u,slideDeltaY:d,keepAlive:i&&!e?i:!1},tt=()=>{this._pendingTransitionComplete===tt&&(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=y,n.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:o,isBack:e}),this.tracing("ended")))};this._pendingTransitionComplete=tt,this.transitionDriver.runTransition(R,tt)}_computeLateralBackTransform(t,e,r){let n=st(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"),B(n));let c=Kt(this.currentStage);if(c){t.prepend(c);let u=t.querySelector(".z-view:first-child");u&&(B(u),u.classList.add("hide"))}let f={type:"zoomOut",currentView:e,previousView:r,lastView:n,currentStage:this.currentStage,duration:o,ease:i,canvas:t},h=()=>{this._pendingTransitionComplete===h&&(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=h,this.transitionDriver.runTransition(f,h)}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="‹",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="‹",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=>h=>{h.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="›",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 Ge={separator:"/",prefix:"/"};function pe(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 Qe(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 Ot={install(s,t){let e=Object.assign({},Ge,t),r=e.separator,n=e.prefix,o=!1;function i(f){if(o)return;let h=pe(s,r),u="#"+n+h;window.location.hash!==u&&(o=!0,window.history[f](null,"",u),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=Qe(n,r),h=pe(s,r).split(r).filter(Boolean);if(f.join(r)===h.join(r)){o=!1;return}if(f.length<h.length){let u=h.length-f.length;for(let d=0;d<u;d++)s.zoomOut()}else if(f.length===h.length&&f.length>0){let u=f[f.length-1];u!==h[h.length-1]&&s.goTo(u,{mode:"lateral"})}else f.length>h.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)})}};Q.Router=Ot;var Je=Q;
|
package/dist/zumly.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
.z-view {
|
|
18
18
|
position: absolute;
|
|
19
19
|
contain: strict;
|
|
20
|
+
content-visibility: auto;
|
|
20
21
|
}
|
|
21
22
|
.z-view.is-current-view {
|
|
22
23
|
cursor: default;
|
|
@@ -27,9 +28,6 @@
|
|
|
27
28
|
pointer-events: none;
|
|
28
29
|
user-select: none;
|
|
29
30
|
}
|
|
30
|
-
.z-view {
|
|
31
|
-
content-visibility: auto;
|
|
32
|
-
}
|
|
33
31
|
.zoom-current-view,
|
|
34
32
|
.zoom-current-view-reverse,
|
|
35
33
|
.zoom-previous-view,
|
package/dist/zumly.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* zumly
|
|
3
|
-
* v.0.92.
|
|
3
|
+
* v.0.92.5
|
|
4
4
|
* Author Juan Martin Muda - Zumerlab
|
|
5
5
|
* License MIT
|
|
6
6
|
*/
|
|
7
|
-
(()=>{var Ut=s=>{throw TypeError(s)};var At=(s,t,e)=>t.has(s)||Ut("Cannot "+e);var S=(s,t,e)=>(At(s,t,"read from private field"),e?e.call(s):t.get(s)),I=(s,t,e)=>t.has(s)?Ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),G=(s,t,e,r)=>(At(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),lt=(s,t,e)=>(At(s,t,"access private method"),e);var Q,gt,Wt,wt=class{constructor(t={}){I(this,gt);I(this,Q,{});G(this,Q,t)}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(S(this,Q),t)){let o=S(this,Q)[t];return this.resolve(o,e)}switch(lt(this,gt,Wt).call(this,t)){case"html":{let o=document.createElement("div");o.innerHTML=t.trim();let n=o.firstElementChild;if(!n)throw new Error("Zumly: view produced no element (html)");return n}case"url":{let o=new AbortController,n=setTimeout(()=>o.abort(),1e4),i;try{i=await fetch(t,{signal:o.signal})}finally{clearTimeout(n)}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 o=e&&e.target||document.createElement("div"),n=await t({...e,target:o});if(typeof n=="string")return this.resolve(n,e);if(n instanceof HTMLElement)return n;let i=o.firstElementChild||o;return i.classList.contains("z-view")||i.classList.add("z-view"),i}case"object":{let o=await t.render(e);if(typeof o!="string")throw new Error("Zumly: view render() must return string");return this.resolve(o,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")}}};Q=new WeakMap,gt=new WeakSet,Wt=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 ct(s,t,e,r,o,n){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 o[t]=="object"&&typeof o[t].mounted=="function"&&await o[t].mounted(),s}function T(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 Kt(s,t){if(t.isValid=!1,!s||typeof s!="object"){T(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){T(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){T(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){T(!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,o=typeof r=="string"?r.toLowerCase():null,n=o==="width"||o==="height";t.cover=n?o:"width",!n&&e&&r!==void 0&&T(!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&&T(!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&&T(!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,u=typeof l=="function"?l:null;if(c!==null){let y=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=y.includes(c)?c:"css",y.includes(c)||T(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${l}". Falling back to "css".`,"warn")}else u!==null?t.transitionDriver=u:t.transitionDriver="css";let f=e&&e.stagger;typeof f=="number"&&f>0?t.stagger=f:(t.stagger=0,f!=null&&f!==0&&T(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0,t.threshold=null;let h=e&&e.threshold;h&&typeof h=="object"&&h.enabled&&(t.threshold={duration:typeof h.duration=="number"&&h.duration>0?h.duration:300,commitAt:typeof h.commitAt=="number"&&h.commitAt>0&&h.commitAt<=1?h.commitAt:.5});let d=s.lateralNav;if(d===!1)t.lateralNav=!1;else if(d&&typeof d=="object"){let y=typeof d.mode=="string"?d.mode.toLowerCase():null,b=y==="auto"||y==="always";y&&!b&&T(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let w=null;if(Array.isArray(d.siblings))w=d.siblings.filter(g=>typeof g=="string"&&g),w.length<2&&(T(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),w=null);else if(d.siblings&&typeof d.siblings=="object"){w={};for(let[g,L]of Object.entries(d.siblings))if(Array.isArray(L)){let C=L.filter(O=>typeof O=="string"&&O);C.length>=2&&(w[g]=C)}Object.keys(w).length===0&&(w=null)}else d.siblings!==void 0&&T(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:b?y:"auto",arrows:typeof d.arrows=="boolean"?d.arrows:!0,dots:typeof d.dots=="boolean"?d.dots:!0,keepAlive:d.keepAlive===!0||d.keepAlive==="visible"?d.keepAlive:!1,siblings:w}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let p=s.depthNav;if(p===!1)t.depthNav=!1;else if(p&&typeof p=="object"){let y=typeof p.position=="string"?p.position.toLowerCase():null,b=y==="bottom-left"||y==="top-left";y&&!b&&T(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:b?y:"bottom-left"}}else t.depthNav={position:"bottom-left"};let v=s.lateralNav&&typeof s.lateralNav=="object"?s.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let y=v==="bottom-center"||v==="top-center";v&&!y&&T(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=y?v:"bottom-center"}let m=s.inputs;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 Gt(s,t,e,r,o){let n=e/s,i=r/t;return o==="height"?{scale:i,scaleInv:1/i}:{scale:n,scaleInv:1/n}}function Qt(s,t,e,r){let o=t.left,n=t.top,i=s.x-o+(s.width-e.width*r)/2,a=s.y-n+(s.height-e.height*r)/2;return`translate(${i}px, ${a}px) scale(${r})`}function Jt(s,t,e){let r=t.left,o=t.top,n=s.x-r+(s.width-e.width)/2,i=s.y-o+(s.height-e.height)/2;return`translate(${n}px, ${i}px)`}function te(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 ee(s,t,e,r,o=0){let n=s.width/2-t.width/2-t.x+e.x,i=s.height/2-t.height/2-t.y+e.y,a=1-o,l=n*a,c=i*a;return{x:n,y:i,transform:`translate(${l}px, ${c}px) scale(${r})`}}function se({canvasRect:s,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:r,lastViewZoomedElementRect:o,previousViewRectWithPreviousAtEndTransform:n,scale:i,preScale:a,parallax:l=0}){let c=t.left,u=t.top,f=s.width/2-e.width/2-e.x,h=s.height/2-e.height/2-e.y,d=f+(r.x-o.x)+n.x-c+(n.width-o.width)/2,p=h+(r.y-o.y)+n.y-u+(n.height-o.height)/2,v=1-Math.min(l*2,.9);return`translate(${d*v}px, ${p*v}px) scale(${i*a})`}function re(s,t,e,r,o){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*o})`}function bt(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function ft(s){let t=s.match(/translate\(\s*([-\d.]+)px[,\s]+([-\d.]+)px\s*\)/),e=s.match(/scale\(\s*([-\d.]+)\s*\)/);return{tx:t?parseFloat(t[1]):0,ty:t?parseFloat(t[2]):0,scale:e?parseFloat(e[1]):1}}function St(s,t,e,r,o,n,i,a,l,c){let u=t.x-e.x*(1-n)-r,f=t.y-e.y*(1-n)-o,h=t.width/n,d=t.height/n,p=u+e.x+(s.x-u-e.x-r)/n,v=f+e.y+(s.y-f-e.y-o)/n,m=s.width/n,y=s.height/n,b=u+i.x+a+c*(p-u-i.x),w=f+i.y+l+c*(v-f-i.y),g=m*c,L=y*c;return{x:b,y:w,width:g,height:L,left:b,top:w,right:b+g,bottom:w+L}}function ut(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function oe(s){return{detachedNode:s}}function ne(s,t,e,r,o){let n=[];return t!==null&&n.push(t),e!==null&&n.push(e),r!==null&&n.push(r),o!==null&&n.push(o),{zoomLevel:s,views:n}}function ie(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var N,Et=class{constructor(){I(this,N,new Map)}set(t,e,r=null){S(this,N).set(t,{node:e,expires:r?Date.now()+r:null})}get(t){let e=S(this,N).get(t);return e?e.expires!==null&&Date.now()>e.expires?(S(this,N).delete(t),null):e.node.cloneNode(!0):null}has(t){let e=S(this,N).get(t);return e?e.expires!==null&&Date.now()>e.expires?(S(this,N).delete(t),!1):!0:!1}invalidate(t){S(this,N).delete(t)}clear(){S(this,N).clear()}};N=new WeakMap;var De=300*1e3,He=/^https?:\/\/|^\/|\.html$|\.php$/i,J,tt,et,V,st,ae,le,_t=class{constructor(t={}){I(this,st);I(this,J);I(this,tt);I(this,et);I(this,V,new Map);G(this,et,t),G(this,J,new wt(t)),G(this,tt,new Et)}async get(t,e=null){if(lt(this,st,ae).call(this,t)){let r=S(this,tt).get(t);if(r)return r;if(S(this,V).has(t))return S(this,V).get(t);let o=(async()=>{let n=await S(this,J).resolve(t,e),i=S(this,et)[t],a=lt(this,st,le).call(this,i);return S(this,tt).set(t,n,a),S(this,V).delete(t),n})();return S(this,V).set(t,o),o}return S(this,J).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(o=>{let n=o.dataset.to;n&&(o.hasAttribute("role")||o.setAttribute("role","button"),o.hasAttribute("aria-label")||o.setAttribute("aria-label",`Zoom to ${n}`),this.prefetch(n,e))})}};J=new WeakMap,tt=new WeakMap,et=new WeakMap,V=new WeakMap,st=new WeakSet,ae=function(t){return typeof S(this,et)[t]=="string"},le=function(t){return He.test(t)?De:null};function rt(s){s&&(s.style.contentVisibility="hidden")}function X(s){s&&(s.style.contentVisibility="visible")}function M(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 xt(s){return M(s)/1e3}function E(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 A(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 P(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 k(s,t){try{t&&t.removeChild(s)}catch{try{s.parentElement&&t.removeChild(s.parentElement)}catch{}}}function z(...s){for(let t of s)t&&(t.classList.remove("hide"),X(t))}function H(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:u}=s,f=c.views[0];z(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=f.forwardState.origin,e.style.transform=l||f.forwardState.transform,o&&n&&(o.style.transform=n.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||k(r,u),t()}var j=150;function R(s,t){let e=!1,r=setTimeout(()=>{e||(e=!0,s())},t);return{finish(){e||(e=!0,clearTimeout(r),s())},safetyTimer:r}}function ce(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function je(s){if(!s||s==="none")return ce();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}:ce()}function nt(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function ot(s,t,e){return s+(t-s)*e}function it(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:ot(s.a,t.a,r),b:ot(s.b,t.b,r),c:ot(s.c,t.c,r),d:ot(s.d,t.d,r),e:ot(s.e,t.e,r),f:ot(s.f,t.f,r)}}function Z(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return je(getComputedStyle(s).transform)}function fe(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:l,canvas:c}=s;if(!r||!o||!i){t();return}e==="lateral"?Re(s,t):e==="zoomIn"?qe(r,o,n,i,a,l,t):e==="zoomOut"?Be(r,o,n,i,a,l,c,t):t()}function Re(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:u,outgoingTransformEnd:f,currentStage:h,duration:d,ease:p,canvas:v}=s,m=M(d),y=h.views[0];z(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,o&&n&&($(o,d,p,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),o.classList.add("zoom-lateral-back")),i&&a&&($(i,d,p,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&($(r,d,p,{"--lateral-out-from":u,"--lateral-out-to":f}),r.classList.add("zoom-lateral-out")),$(e,d,p,{"--lateral-in-from":l,"--lateral-in-to":c}),e.classList.add("zoom-lateral-in");let b=s.keepAlive==="visible"?[e]:[r,e];o&&n&&b.push(o),i&&a&&b.push(i);let w=b.length,{finish:g}=R(()=>{Pt(b,L),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):k(r,v),o&&(o.classList.remove("zoom-lateral-back"),o.style.transform=n?.transformEnd||o.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()},m+j);function L(C){let O=C?.target;O&&O.removeEventListener("animationend",L),w--,w<=0&&g()}b.forEach(C=>C.addEventListener("animationend",L))}function qe(s,t,e,r,o,n,i){z(s,t,e);let a=r.stagger||0;$(s,o,n,{"--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"),$(t,o,n,{"--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&&($(e,o,n,{"--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,u=M(o),f=e?a*2:a,{finish:h}=R(()=>{Pt(l,d),l.forEach(p=>p.style.removeProperty("animation-delay")),i()},u+f+j);function d(p){let v=p?.target;if(v&&v.removeEventListener("animationend",d),v?.isConnected)try{E(v,r)}catch{}c--,c<=0&&h()}l.forEach(p=>p.addEventListener("animationend",d))}function Be(s,t,e,r,o,n,i,a){let l=r.views[0],c=r.views[1],u=e&&r.views[2]?r.views[2]:null,f=r.stagger||0;$(s,o,n,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),f>0&&s.style.setProperty("animation-delay","0ms"),$(t,o,n,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),f>0&&t.style.setProperty("animation-delay",`${f}ms`),e&&u&&($(e,o,n,{"--last-view-transform-start":u.backwardState.transform,"--last-view-transform-end":u.forwardState.transform}),f>0&&e.style.setProperty("animation-delay",`${f*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],d=h.length,p=M(o),v=e?f*2:f,{finish:m}=R(()=>{Pt(h,y),h.forEach(b=>b.style.removeProperty("animation-delay")),a()},p+v+j);function y(b){let w=b?.target;if(w&&w.removeEventListener("animationend",y),w?.isConnected)try{Ve(w,r,i)}catch{}d--,d<=0&&m()}h.forEach(b=>b.addEventListener("animationend",y))}function Ve(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){k(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){A(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&P(s,t.views[2].backwardState)}function $(s,t,e,r){s.style.setProperty("--zoom-duration",t),s.style.setProperty("--zoom-ease",e);for(let[o,n]of Object.entries(r))s.style.setProperty(o,n)}function Pt(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function ue(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,canvas:a}=s;if(!r||!o||!i){t();return}if(e==="lateral"){H(s,t);return}if(e==="zoomIn"){z(r,o,n),E(r,i),E(o,i),n&&E(n,i),t();return}if(e==="zoomOut"){k(r,a),z(o,n),A(o,i.views[1].backwardState),n&&P(n,i.views[2].backwardState),t();return}t()}function he(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:l,canvas:c}=s;if(!r||!o||!i){t();return}let u=M(a);if(e==="lateral"){Ue(s,u,l,t);return}if(e==="zoomIn"){Xe(r,o,n,i,u,l,t);return}if(e==="zoomOut"){Ye(r,o,n,i,u,l,c,t);return}t()}function Xe(s,t,e,r,o,n,i){z(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 u=r.stagger||0,f=[];f.push(s.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:o,easing:n,fill:"forwards"})),f.push(t.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:o,delay:u,easing:n,fill:"forwards"})),c&&f.push(e.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:o,delay:u*2,easing:n,fill:"forwards"}));let h=c?u*2:u,{finish:d}=R(()=>{It(f);try{E(s,r),E(t,r),e&&E(e,r)}catch{}i()},o+h+j);Promise.all(f.map(p=>p.finished)).then(d).catch(d)}function Ye(s,t,e,r,o,n,i,a){let l=r.views[0],c=r.views[1],u=e&&r.views[2]?r.views[2]:null,f=c.backwardState,h=u?u.backwardState:null;s.style.transformOrigin=l.forwardState.origin,s.style.transform=l.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=c.forwardState.origin,e&&u&&(e.style.transformOrigin=u.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||c.forwardState.transform,p=e&&u?e.style.transform||getComputedStyle(e).transform||u.forwardState.transform:null,v=r.stagger||0,m=[];m.push(s.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:o,easing:n,fill:"forwards"})),m.push(t.animate([{transform:d},{transform:f.transform}],{duration:o,delay:v,easing:n,fill:"both"})),e&&h&&m.push(e.animate([{transform:p},{transform:h.transform}],{duration:o,delay:v*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&h?v*2:v,{finish:b}=R(()=>{It(m);try{k(s,i),A(t,f),e&&h&&P(e,h)}catch{}a()},o+y+j);Promise.all(m.map(w=>w.finished)).then(b).catch(b)})})}function Ue(s,t,e,r){let{currentView:o,previousView:n,backView:i,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:u,incomingTransformEnd:f,outgoingTransform:h,outgoingTransformEnd:d,currentStage:p,canvas:v}=s,m=p.views[0];z(o),o.classList.replace("is-new-current-view","is-current-view"),o.classList.remove("zoom-current-view","has-no-events"),o.style.transformOrigin=m.forwardState.origin;let y=[];y.push(o.animate([{transform:u,opacity:0},{transform:f,opacity:1}],{duration:t,easing:e,fill:"forwards"})),s.keepAlive!=="visible"&&y.push(n.animate([{transform:h,opacity:1},{transform:d,opacity:0}],{duration:t,easing:e,fill:"forwards"})),i&&a&&y.push(i.animate([{transform:a.transformStart},{transform:a.transformEnd}],{duration:t,easing:e,fill:"forwards"})),l&&c&&y.push(l.animate([{transform:c.transformStart},{transform:c.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:b}=R(()=>{It(y),o.style.transform=f||m.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),s.keepAlive?(n.style.opacity="",n.style.transform=d):k(n,v),r()},t+j);Promise.all(y.map(w=>w.finished)).then(b).catch(b)}function It(s){for(let t of s)try{t.cancel()}catch{}}function de(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:o,previousView:n,lastView:i,currentStage:a,duration:l,ease:c,canvas:u}=s;if(!o||!n||!a){t();return}let f=M(l);r==="lateral"?H(s,t):r==="zoomIn"?We(e,o,n,i,a,f,c,t):r==="zoomOut"?Ke(e,o,n,i,a,f,c,u,t):t()}function We(s,t,e,r,o,n,i,a){z(t,e,r);let l=o.views[0],c=o.views[1],u=r&&o.views[2]?o.views[2]:null,f=me([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:c.backwardState,forward:c.forwardState},...u?[{el:r,backward:u.backwardState,forward:u.forwardState}]:[]],"forward");pe(f,0);let h=o.stagger||0,d=n+(u?h*2:h),p={value:0};s({targets:p,value:1,duration:d,easing:ye(i),update:()=>{let v=p.value*d;ve(f,v,n,h)},complete:()=>{E(t,o),E(e,o),r&&E(r,o),a()}})}function Ke(s,t,e,r,o,n,i,a,l){let c=o.views[0],u=o.views[1],f=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null,p=me([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:u.backwardState,forward:u.forwardState},...f?[{el:r,backward:f.backwardState,forward:f.forwardState}]:[]],"backward");pe(p,0);let v=o.stagger||0,m=n+(f?v*2:v),y={value:0};s({targets:y,value:1,duration:m,easing:ye(i),update:()=>{let b=y.value*m;ve(p,b,n,v)},complete:()=>{k(t,a),A(e,h),r&&d&&P(r,d),l()}})}function me(s,t){return s.map(({el:e,backward:r,forward:o})=>{if(t==="forward"){let n=Z(e,r.origin,r.transform),i=Z(e,r.origin,o.transform);return{el:e,from:n,to:i}}else{let n=Z(e,o.origin,o.transform),i=Z(e,o.origin,r.transform);return{el:e,from:n,to:i}}})}function pe(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=nt(it(r,o,t))}function ve(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],l=o*r,c=Math.max(0,t-l),u=e>0?Math.min(1,c/e):1;n.style.transform=nt(it(i,a,u))}}function ye(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 we(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:o,previousView:n,lastView:i,currentStage:a,duration:l,ease:c,canvas:u}=s;if(!o||!n||!a){t();return}let f=xt(l);r==="lateral"?H(s,t):r==="zoomIn"?Ge(e,o,n,i,a,f,c,t):r==="zoomOut"?Qe(e,o,n,i,a,f,c,u,t):t()}function Ge(s,t,e,r,o,n,i,a){z(t,e,r);let l=o.views[0],c=o.views[1],u=r&&o.views[2]?o.views[2]:null;Lt(t,l.backwardState),Lt(e,c.backwardState),u&&Lt(r,u.backwardState);let f=s.timeline({onComplete:()=>{E(t,o),E(e,o),r&&E(r,o),a()}}),h=ge(i),d=(o.stagger||0)/1e3;f.to(t,{transform:l.forwardState.transform,duration:n,ease:h},0),f.to(e,{transform:c.forwardState.transform,duration:n,ease:h},d),u&&f.to(r,{transform:u.forwardState.transform,duration:n,ease:h},d*2)}function Qe(s,t,e,r,o,n,i,a,l){let c=o.views[0],u=o.views[1],f=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null;Lt(t,c.forwardState);let p=e.style.transform||getComputedStyle(e).transform||u.forwardState.transform,v=r&&f?r.style.transform||getComputedStyle(r).transform||f.forwardState.transform:null;e.style.transformOrigin=u.forwardState.origin,r&&f&&(r.style.transformOrigin=f.forwardState.origin);let m=ge(i),y=s.timeline({onComplete:()=>{k(t,a),A(e,h),r&&d&&P(r,d),l()}}),b=(o.stagger||0)/1e3;s.set(e,{transform:p}),r&&v&&s.set(r,{transform:v}),y.fromTo(t,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:n,ease:m},0),y.fromTo(e,{transform:p},{transform:h.transform,duration:n,ease:m},b),r&&d&&y.fromTo(r,{transform:v},{transform:d.transform,duration:n,ease:m},b*2)}function Lt(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function ge(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 be(s,t){let e=es();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:o,previousView:n,lastView:i,currentStage:a,duration:l,ease:c,canvas:u}=s;if(!o||!n||!a){t();return}let f=xt(l);r==="lateral"?H(s,t):r==="zoomIn"?Je(e,o,n,i,a,f,c,t):r==="zoomOut"?ts(e,o,n,i,a,f,c,u,t):t()}function Je(s,t,e,r,o,n,i,a){z(t,e,r);let l=Se(t,e,r,o,"forward");Ee(l,0);let c=o.stagger||0,u=c/1e3,f=n*1e3,h=n+(l.length>2?u*2:u);s(0,1,{duration:h,ease:xe(i),onUpdate:p=>{let v=p*h*1e3;_e(l,v,f,c)}}).then(()=>{E(t,o),E(e,o),r&&E(r,o),a()}).catch(()=>a())}function ts(s,t,e,r,o,n,i,a,l){let c=o.views[1],u=r&&o.views[2]?o.views[2]:null,f=c.backwardState,h=u?u.backwardState:null,d=Se(t,e,r,o,"backward");Ee(d,0);let p=o.stagger||0,v=p/1e3,m=n*1e3,y=n+(d.length>2?v*2:v);s(0,1,{duration:y,ease:xe(i),onUpdate:w=>{let g=w*y*1e3;_e(d,g,m,p)}}).then(()=>{k(t,a),A(e,f),r&&h&&P(r,h),l()}).catch(()=>l())}function Se(s,t,e,r,o){let n=r.views[0],i=r.views[1],a=e&&r.views[2]?r.views[2]:null,l=[{el:s,backward:n.backwardState,forward:n.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:u,forward:f})=>o==="forward"?{el:c,from:Z(c,u.origin,u.transform),to:Z(c,u.origin,f.transform)}:{el:c,from:Z(c,f.origin,f.transform),to:Z(c,f.origin,u.transform)})}function Ee(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=nt(it(r,o,t))}function _e(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],l=o*r,c=Math.max(0,t-l),u=e>0?Math.min(1,c/e):1;n.style.transform=nt(it(i,a,u))}}function es(){let s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return s.motion?.animate||s.Motion?.animate||s.animate}function xe(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 Le={css:fe,waapi:he,none:ue,anime:de,gsap:we,motion:be};function Te(s){if(typeof s=="function")return{runTransition(r,o){s(r,o)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:Le[t]||Le.css}}function ss(s){if(typeof s!="string"||s.trim()==="")return{tx:0,ty:0,rest:""};let t=s.match(/translate\s*\(\s*([-\d.eE]+)px\s*,\s*([-\d.eE]+)px\s*\)/);if(!t)return null;let e=parseFloat(t[1]),r=parseFloat(t[2]),o=s.replace(/translate\s*\([^)]+\)\s*/,"").trim();return{tx:e,ty:r,rest:o}}function Nt(s,t,e){let r=ss(s);if(r===null)return s;let o=r.tx*t,n=r.ty*e,i=r.rest?` ${r.rest}`:"";return`translate(${o}px, ${n}px)${i}`.trim()}function rs(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 Zt(s,t,e){let r=rs(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function $t(s,t,e,r,o){if(!s.storedViews?.length||!s.canvas||t<=0||e<=0)return;let n=r/t,i=o/e;for(let d of s.storedViews){let p=d.views;if(Array.isArray(p))for(let v=0;v<p.length;v++){let m=p[v];!m||m.detachedNode||(m.backwardState&&(m.backwardState.transform=Nt(m.backwardState.transform,n,i),m.backwardState.origin!=null&&(m.backwardState.origin=Zt(m.backwardState.origin,n,i))),m.forwardState&&(m.forwardState.transform=Nt(m.forwardState.transform,n,i),m.forwardState.origin!=null&&(m.forwardState.origin=Zt(m.forwardState.origin,n,i))))}}let a=s.canvas,l=a.querySelector(".is-current-view"),c=a.querySelector(".is-previous-view"),u=a.querySelector(".is-last-view"),f=a.querySelector(".is-new-current-view"),h=[l,c,u,f].filter(Boolean);for(let d of h){if(!d.style)continue;let p=d.style.transform;p!=null&&p!==""&&(d.style.transform=Nt(p,n,i));let v=d.style.transformOrigin;v!=null&&v!==""&&(d.style.transformOrigin=Zt(v,n,i))}}var os=8e3,dt=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._hooks={},this._plugins=[],Kt(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=Te(this.transitionDriver),this._onZoom=this.onZoom.bind(this),this._onTouchStart=this.onTouchStart.bind(this),this._onTouchEnd=this.onTouchEnd.bind(this),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 _t(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("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("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(()=>{this.blockEvents&&!this._destroyed&&(this.notify("blockEvents safety timeout: driver did not call onComplete. Force-resetting.","warn"),this.blockEvents=!1,this._onTransitionComplete())},os)}_clearBlockEventsSafety(){this._blockEventsSafetyTimer!==null&&(clearTimeout(this._blockEventsSafetyTimer),this._blockEventsSafetyTimer=null)}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,o)=>`${o===0?`Instance ${this.instance}: ${r}`:`${r}`}`).join(" > ");this.notify(e),this.trace=[]}else this.trace.push(t)}notify(t,e){return T(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}$t(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)&&$t(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(o=>o.trim());return[r[0]||"none",r[1]||r[0]||"none"]}return this.effects}_applyEffects(t,e,r,o,n){!r||r[0]==="none"&&r[1]==="none"||(t&&r[0]!=="none"&&(t.style.setProperty("--z-effect-filter",r[0]),t.style.setProperty("--zoom-duration",o),t.style.setProperty("--zoom-ease",n),t.classList.add("has-effect")),e&&r[1]!=="none"&&(e.style.setProperty("--z-effect-filter",r[1]),e.style.setProperty("--zoom-duration",o),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 r=t.style.getPropertyValue("--zoom-duration");setTimeout(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,o,n){!r||!t||(r==="fade"?(t.style.setProperty("--zoom-duration",o),t.style.setProperty("--zoom-ease",n),t.classList.add("z-trigger-fade"),e.style.setProperty("--zoom-duration",o),e.style.setProperty("--zoom-ease",n),e.classList.add("z-view-fade-in"),e.offsetHeight,e.classList.remove("hide")):t.classList.add("z-trigger-hidden"))}_restoreHideTrigger(t,e,r,o){if(!(!e||!t))if(e==="fade"){t.classList.remove("z-trigger-fade"),t.style.setProperty("--zoom-duration",r),t.style.setProperty("--zoom-ease",o),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}),setTimeout(n,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(o){this.notify(`plugin install error: ${o.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 o of r)try{o(e)}catch(n){this.debug&&console.error(`Zumly hook "${t}" threw:`,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}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,o=t&&typeof t=="object"?t.node:void 0;return this._doLateral(e,!0,{savedEntry:r,keepAliveNode:o})}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 o=this.canvas.getBoundingClientRect(),n=Math.max(40,o.width*.1),i=Math.max(40,o.height*.1),l={rect:{x:o.left+(o.width-n)/2,y:o.top+(o.height-i)/2,width:n,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);let t=await this.prefetcher.get(this.initialView,null),e=await ct(t,this.initialView,this.canvas,!0,this.views,this.componentContext);this._emit("viewMounted",{viewName:this.initialView,node:e}),this.prefetcher.scanAndPrefetch(e,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 r of this._plugins)this._installPlugin(r)}destroy(){this._destroyed||(this._emit("destroy"),this._destroyed=!0,this._clearBlockEventsSafety(),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,o=e.el;this._resetCanvasScroll(r);let n=r.getBoundingClientRect(),i=n.left,a=n.top,c=(this.storedViews.length>0?this.storedViews[this.storedViews.length-1]:null)?.scale??1;this.tracing("getView()");let u=o?{trigger:o,target:document.createElement("div"),context:this.componentContext,props:Object.assign({},o.dataset)}:{target:document.createElement("div"),context:this.componentContext,props:e.props??{}},f=o?.dataset?.deferred!==void 0?!0:this.deferred,h,d=null;if(f){let _=await this.prefetcher.get(t,u);if(this._destroyed)return;for(d=document.createDocumentFragment();_.firstChild;)d.appendChild(_.firstChild);h=await ct(_,t,r,!1,{},this.componentContext)}else{let _=await this.prefetcher.get(t,u);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(_,u),h=await ct(_,t,r,!1,this.views,this.componentContext)}if(!h)return;f||this._emit("viewMounted",{viewName:t,node:h}),o&&o.classList.add("zoomed");let p=o?(()=>{let _=o.getBoundingClientRect();return{x:_.x,y:_.y,width:_.width,height:_.height}})():e.rect,v=o?o.dataset.withDuration||this.duration:e.duration??this.duration,m=o?o.dataset.withEase||this.ease:e.ease??this.ease,y=o?o.dataset.withCover||this.cover:e.cover??this.cover,b=o?parseInt(o.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=r.querySelector(".is-current-view"),g=r.querySelector(".is-previous-view"),L=r.querySelector(".is-last-view");rt(h),rt(w),rt(g),L&&(rt(L),r.removeChild(L));let C,O,Y,q,at,mt,x,F=w.style.transform,D=w.style.transformOrigin,U=g?g.style.transform:null,Mt=g?g.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),g&&g.classList.replace("is-previous-view","is-last-view");let _=h.getBoundingClientRect(),B=w.getBoundingClientRect(),kt=null,Dt=null,vt=null;g&&(kt=g.getBoundingClientRect(),vt=g.querySelector(".zoomed"),Dt=vt&&vt.getBoundingClientRect?vt.getBoundingClientRect():kt);let yt={left:i,top:a},Ht={width:n.width,height:n.height},jt={width:_.width,height:_.height},Rt=Gt(p.width,p.height,_.width,_.height,y);x=Rt.scale;let Ze=Rt.scaleInv;C=Qt(p,yt,jt,Ze),Y=w.style.transform;let qt=te(p,B);q=ee(Ht,p,B,x,this.parallax);let Bt=bt(D||"0 0"),W=ft(Y||""),Vt=bt(qt),K=ft(q.transform),Xt=p;if(o&&(Xt=St(p,B,Bt,W.tx,W.ty,W.scale,Vt,K.tx,K.ty,K.scale)),O=Jt(Xt,yt,jt),g){at=g.style.transform;let $e=St(B,B,Bt,W.tx,W.ty,W.scale,Vt,K.tx,K.ty,K.scale),Fe=re(q.x,q.y,yt,x,c),Yt=bt(Mt||"0 0"),Ct=ft(at||""),Ot=ft(Fe),Me=St(Dt,kt,Yt,Ct.tx,Ct.ty,Ct.scale,Yt,Ot.tx,Ot.ty,Ot.scale);mt=se({canvasRect:Ht,canvasOffset:yt,triggerRect:p,previousViewRectAtBaseTransform:B,lastViewZoomedElementRect:Me,previousViewRectWithPreviousAtEndTransform:$e,scale:x,preScale:c,parallax:this.parallax})}h.style.transform=C,w.style.transformOrigin=qt}catch(_){this.notify(`zoomIn geometry computation failed: ${_.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",_),w.style.transform=F,w.style.transformOrigin=D,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),g&&(g.style.transform=U,g.style.transformOrigin=Mt,g.classList.contains("is-last-view")&&g.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(h)}catch{}X(w),X(g);return}let Ce=ut(h.dataset.viewName,{origin:h.style.transformOrigin,duration:v,ease:m,transform:C},{origin:h.style.transformOrigin,duration:v,ease:m,transform:O}),Oe=ut(w.dataset.viewName,{origin:w.style.transformOrigin,duration:v,ease:m,transform:Y},{origin:w.style.transformOrigin,duration:v,ease:m,transform:q.transform}),Ae=g?ut(g.dataset.viewName,{origin:g.style.transformOrigin,duration:v,ease:m,transform:at},{origin:g.style.transformOrigin,duration:v,ease:m,transform:mt}):null,Pe=L?oe(L):null,pt=ne(this.storedViews.length,Ce,Oe,Ae,Pe);pt.scale=x,pt.stagger=b||0,this.storeViews(pt),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let Ie=this._resolveEffects(o);this._applyEffects(w,g,Ie,v,m);let zt=this._resolveHideTrigger(o);this._applyHideTrigger(o,h,zt,v,m),zt&&(pt.hideTriggerMode=zt),this._setBlockEvents();let Ne={type:"zoomIn",currentView:h,previousView:w,lastView:g,currentStage:this.currentStage,duration:v,ease:m};this.transitionDriver.runTransition(Ne,async()=>{f&&d&&h&&!this._destroyed&&(h.appendChild(d),this.prefetcher.scanAndPrefetch(h,u),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")})}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 o=this.canvas.querySelector(".is-current-view");if(!o)return;let n=o.dataset?.viewName;if(n===t)return;this._emit("beforeLateral",{viewName:t,from:n,isBack:e});let i=this.lateralNav&&this.lateralNav.keepAlive;if(!e){this.lateralHistory=this.lateralHistory||[];let x=this.storedViews[this.storedViews.length-1];this.lateralHistory.push({name:n,entry:x.views[0],node:i?o:null})}this.tracing("lateral()");let a=r.duration??this.duration,l=r.ease??this.ease,c=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),f=0,h=0,d=this._declaredSiblings(),p=d?d.indexOf(n):-1,v=d?d.indexOf(t):-1;if(p!==-1&&v!==-1){let x=this.canvas.getBoundingClientRect();f=(p-v)*x.width*.15}else if(c){let x=c.querySelector(`.zoom-me[data-to="${n}"]`),F=c.querySelector(`.zoom-me[data-to="${t}"]`);if(x&&F){let D=x.getBoundingClientRect(),U=F.getBoundingClientRect();f=D.left+D.width/2-(U.left+U.width/2),h=D.top+D.height/2-(U.top+U.height/2)}else f=this.canvas.getBoundingClientRect().width*.15}let m=null,y=null;if(i&&(e&&r.keepAliveNode?y=r.keepAliveNode:y=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),y){if(y.style.display="",y.style.opacity="",y.classList.remove("is-lateral-hidden","zoom-lateral-out"),y.classList.add("is-new-current-view","has-no-events"),m=y,!e&&this.lateralHistory){let x=this.lateralHistory.findIndex(F=>F.node===y);x!==-1&&this.lateralHistory.splice(x,1)}}else{let x={target:document.createElement("div"),context:this.componentContext,props:r.props??{}},F=await this.prefetcher.get(t,x);if(this._destroyed||(this.prefetcher.scanAndPrefetch(F,x),m=await ct(F,t,this.canvas,!1,this.views,this.componentContext),!m))return;this._emit("viewMounted",{viewName:t,node:m})}rt(m);let b=o.style.transform||"",w=o.style.transformOrigin||"0 0";m.style.transform=b,m.style.transformOrigin=w;let g=this.storedViews[this.storedViews.length-1],L=e&&r.savedEntry?{...r.savedEntry,viewName:t}:ut(t,{origin:w,duration:a,ease:l,transform:b},{origin:w,duration:a,ease:l,transform:b});g.views[0]=L,this.currentStage=g;let C=c?{transformStart:c.style.transform||"",transformEnd:this._computeLateralBackTransform(c.style.transform||"",f,h)}:null,O=u&&g.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",f*.7,h*.7)}:null;C&&g.views[1]&&(g.views[1].forwardState={...g.views[1].forwardState,transform:C.transformEnd}),O&&g.views[2]&&(g.views[2].forwardState={...g.views[2].forwardState,transform:O.transformEnd});let Y=b,q=this._computeLateralBackTransform(Y,-f,-h),at=this._computeLateralBackTransform(b,f,h);this._setBlockEvents();let mt={type:"lateral",currentView:m,previousView:o,lastView:u||null,backView:c||null,backViewState:C,lastViewState:O,incomingTransformStart:q,incomingTransformEnd:Y,outgoingTransform:b,outgoingTransformEnd:at,currentStage:this.currentStage,duration:a,ease:l,canvas:this.canvas,slideDeltaX:f,slideDeltaY:h,keepAlive:i&&!e?i:!1};this.transitionDriver.runTransition(mt,()=>{i&&!e&&(o.classList.remove("is-current-view","is-new-current-view","has-no-events"),o.classList.add("is-lateral-hidden"),i!=="visible"?o.style.display="none":(o.style.transform=b,o.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:n,isBack:e}),this.tracing("ended")})}_computeLateralBackTransform(t,e,r){let o=t.match(/translate\s*\(\s*([-\d.eE]+)px\s*,\s*([-\d.eE]+)px\s*\)/);if(o){let n=parseFloat(o[1])+e,i=parseFloat(o[2])+r,a=t.replace(/translate\s*\([^)]+\)\s*/,"");return`translate(${n}px, ${i}px) ${a}`.trim()}return`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 o=t.querySelector(".is-last-view");this.tracing("setCSSVariables()");let n=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,n,i),l==="fade"?(e.classList.remove("z-view-fade-in"),e.style.setProperty("--zoom-duration",n),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"),o!==null&&(o.classList.contains("has-effect")&&this.effects[0]!=="none"&&o.style.setProperty("--z-effect-filter",this.effects[0]),o.classList.replace("is-last-view","is-previous-view"),o.classList.remove("hide"),X(o));let c=ie(this.currentStage);if(c){t.prepend(c);let f=t.querySelector(".z-view:first-child");f&&(X(f),f.classList.add("hide"))}let u={type:"zoomOut",currentView:e,previousView:r,lastView:o,currentStage:this.currentStage,duration:n,ease:i,canvas:t};this.transitionDriver.runTransition(u,()=>{this.blockEvents=!1,this._onTransitionComplete(),this.storedViews.pop(),this._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")})}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 o=e.classList.contains("zoom-me")?e:e.closest(".zoom-me");this.zoomIn(o);return}if(this.storedViews.length>1&&!this.blockEvents&&!r&&!this.touching){let o=this.canvas.querySelector(".is-current-view");if(o&&o.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 r=this.canvas.querySelector(".is-previous-view");if(!r)return null;let n=this.canvas.querySelector(".is-current-view")?.dataset?.viewName;if(!n)return null;let i=r.querySelectorAll(".zoom-me[data-to]");for(let a of i){if(a.dataset.to===n)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 o=this.canvas.querySelector(".is-previous-view");if(!o)return{siblings:[],currentIndex:-1};let n=o.querySelectorAll(".zoom-me[data-to]"),i=[];for(let l of n)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",o=document.createElement("div");o.className="z-depth-nav z-depth-nav--"+r;let n=document.createElement("button");n.className="z-nav-back",n.setAttribute("aria-label","Zoom out (go back)"),n.innerHTML="‹",n.addEventListener("mouseup",i=>{i.stopPropagation(),!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),o.appendChild(n),this.canvas.appendChild(o)}_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:o}=e,n=this.lateralNav.position||"bottom-center",i=document.createElement("div");if(i.className="z-lateral-nav z-lateral-nav--"+n,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="‹",a.disabled=o<=0,a.addEventListener("mouseup",l=>{l.stopPropagation(),o>0&&this._doLateral(r[o-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===o?" is-active":""),c.setAttribute("aria-label",`Go to ${r[l]}`),c.dataset.to=r[l],c.addEventListener("mouseup",(u=>f=>{f.stopPropagation(),u!==o&&this._doLateral(r[u])})(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="›",a.disabled=o>=r.length-1,a.addEventListener("mouseup",l=>{l.stopPropagation(),o<r.length-1&&this._doLateral(r[o+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,setTimeout(()=>{this._wheelCooldown=!1},500),this.zoomOut())))}_isInsideScrollable(t,e){let r=t,o=this.canvas.querySelector(".is-current-view");for(;r&&r!==this.canvas;){if(r===o||o&&o.contains(r)){let{overflowY:n}=window.getComputedStyle(r);if((n==="auto"||n==="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)))}handleGesture(t){t.stopPropagation(),this.tracing("handleGesture()");let e=this.touchendX-this.touchstartX,r=this.touchendY-this.touchstartY,o=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 n=t.target.classList.contains("zoom-me")?t.target:t.target.closest(".zoom-me");o&&!this.blockEvents&&n&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(n)),o&&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 ns={separator:"/",prefix:"/"};function ze(s,t){let e=[];for(let r of s.storedViews){let o=r.views&&r.views[0];o&&o.viewName&&e.push(o.viewName)}return e.join(t)}function is(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 ke={install(s,t){let e=Object.assign({},ns,t),r=e.separator,o=e.prefix,n=!1;function i(u){if(n)return;let f=ze(s,r),h="#"+o+f;window.location.hash!==h&&(n=!0,window.history[u](null,"",h),n=!1)}function a(){i("pushState")}function l(){i("replaceState")}s.on("afterZoomIn",a),s.on("afterLateral",a),s.on("afterZoomOut",l);function c(){if(n)return;n=!0;let u=is(o,r),f=ze(s,r).split(r).filter(Boolean);if(u.join(r)===f.join(r)){n=!1;return}if(u.length<f.length){let h=f.length-u.length;for(let d=0;d<h;d++)s.zoomOut()}else if(u.length===f.length&&u.length>0){let h=u[u.length-1];h!==f[f.length-1]&&s.goTo(h,{mode:"lateral"})}else u.length>f.length&&window.history.back();n=!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)})}};dt.Router=ke;window.Zumly=dt;})();
|
|
7
|
+
(()=>{var Gt=s=>{throw TypeError(s)};var $t=(s,t,e)=>t.has(s)||Gt("Cannot "+e);var E=(s,t,e)=>($t(s,t,"read from private field"),e?e.call(s):t.get(s)),I=(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),Q=(s,t,e,r)=>($t(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),ft=(s,t,e)=>($t(s,t,"access private method"),e);var J,St,Qt,_t=class{constructor(t={}){I(this,St);I(this,J,{});Q(this,J,t)}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(E(this,J),t)){let n=E(this,J)[t];return this.resolve(n,e)}switch(ft(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")}}};J=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 x(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"){x(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){x(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){x(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){x(!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&&x(!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&&x(!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&&x(!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 m=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=m.includes(c)?c:"css",m.includes(c)||x(!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 h=e&&e.stagger;typeof h=="number"&&h>0?t.stagger=h:(t.stagger=0,h!=null&&h!==0&&x(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0;let u=s.lateralNav;if(u===!1)t.lateralNav=!1;else if(u&&typeof u=="object"){let m=typeof u.mode=="string"?u.mode.toLowerCase():null,g=m==="auto"||m==="always";m&&!g&&x(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let w=null;if(Array.isArray(u.siblings))w=u.siblings.filter(y=>typeof y=="string"&&y),w.length<2&&(x(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),w=null);else if(u.siblings&&typeof u.siblings=="object"){w={};for(let[y,b]of Object.entries(u.siblings))if(Array.isArray(b)){let _=b.filter(O=>typeof O=="string"&&O);_.length>=2&&(w[y]=_)}Object.keys(w).length===0&&(w=null)}else u.siblings!==void 0&&x(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:g?m:"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:w}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let d=s.depthNav;if(d===!1)t.depthNav=!1;else if(d&&typeof d=="object"){let m=typeof d.position=="string"?d.position.toLowerCase():null,g=m==="bottom-left"||m==="top-left";m&&!g&&x(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:g?m:"bottom-left"}}else t.depthNav={position:"bottom-left"};let v=s.lateralNav&&typeof s.lateralNav=="object"?s.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let m=v==="bottom-center"||v==="top-center";v&&!m&&x(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=m?v:"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,h=s.width/2-e.width/2-e.x,u=s.height/2-e.height/2-e.y,d=h+(r.x-n.x)+o.x-c+(o.width-n.width)/2,v=u+(r.y-n.y)+o.y-f+(o.height-n.height)/2,p=1-Math.min(l*2,.9);return`translate(${d*p}px, ${v*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 Et(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function ut(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 dt(s){let t=ut(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 Tt(s,t,e,r,n,o,i,a,l,c){let f=t.x-e.x*(1-o)-r,h=t.y-e.y*(1-o)-n,u=t.width/o,d=t.height/o,v=f+e.x+(s.x-f-e.x-r)/o,p=h+e.y+(s.y-h-e.y-n)/o,m=s.width/o,g=s.height/o,w=f+i.x+a+c*(v-f-i.x),y=h+i.y+l+c*(p-h-i.y),b=m*c,_=g*c;return{x:w,y,width:b,height:_,left:w,top:y,right:w+b,bottom:y+_}}function mt(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 Z,xt=class{constructor(){I(this,Z,new Map)}set(t,e,r=null){E(this,Z).set(t,{node:e,expires:r?Date.now()+r:null})}get(t){let e=E(this,Z).get(t);return e?e.expires!==null&&Date.now()>e.expires?(E(this,Z).delete(t),null):e.node.cloneNode(!0):null}has(t){let e=E(this,Z).get(t);return e?e.expires!==null&&Date.now()>e.expires?(E(this,Z).delete(t),!1):!0:!1}invalidate(t){E(this,Z).delete(t)}clear(){E(this,Z).clear()}};Z=new WeakMap;var je=300*1e3,Re=/^https?:\/\/|^\/|\.html$|\.php$/i,tt,et,st,Y,rt,fe,he,Lt=class{constructor(t={}){I(this,rt);I(this,tt);I(this,et);I(this,st);I(this,Y,new Map);Q(this,st,t),Q(this,tt,new _t(t)),Q(this,et,new xt)}async get(t,e=null){if(ft(this,rt,fe).call(this,t)){let r=E(this,et).get(t);if(r)return r;if(E(this,Y).has(t))return E(this,Y).get(t);let n=(async()=>{try{let o=await E(this,tt).resolve(t,e),i=E(this,st)[t],a=ft(this,rt,he).call(this,i);return E(this,et).set(t,o,a),o}finally{E(this,Y).delete(t)}})();return E(this,Y).set(t,n),n}return E(this,tt).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))})}};tt=new WeakMap,et=new WeakMap,st=new WeakMap,Y=new WeakMap,rt=new WeakSet,fe=function(t){return typeof E(this,st)[t]=="string"},he=function(t){return Re.test(t)?je:null};function nt(s){s&&(s.style.contentVisibility="hidden")}function U(s){s&&(s.style.contentVisibility="visible")}function F(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 F(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 A(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 P(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 k(s,t){try{t&&t.removeChild(s)}catch{try{s.parentElement&&t.removeChild(s.parentElement)}catch{}}}function L(...s){for(let t of s)t&&(t.classList.remove("hide"),U(t))}function j(s,t){let{currentView:e,previousView:r,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:f}=s,h=c.views[0];L(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=l||h.forwardState.transform,n&&o&&(n.style.transform=o.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||k(r,f),t()}var R=150;function q(s,t){let e=!1,r=setTimeout(()=>{e||(e=!0,s())},t);return{finish(){e||(e=!0,clearTimeout(r),s())},safetyTimer:r}}function ue(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function qe(s){if(!s||s==="none")return ue();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}:ue()}function it(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function ot(s,t,e){return s+(t-s)*e}function at(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:ot(s.a,t.a,r),b:ot(s.b,t.b,r),c:ot(s.c,t.c,r),d:ot(s.d,t.d,r),e:ot(s.e,t.e,r),f:ot(s.f,t.f,r)}}function $(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return qe(getComputedStyle(s).transform)}function de(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"?Be(s,t):e==="zoomIn"?Ve(r,n,o,i,a,l,t):e==="zoomOut"?Xe(r,n,o,i,a,l,c,t):t()}function Be(s,t){let{currentView:e,previousView:r,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:f,outgoingTransformEnd:h,currentStage:u,duration:d,ease:v,canvas:p}=s,m=F(d),g=u.views[0];L(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&&(N(n,d,v,{"--lateral-from":o.transformStart,"--lateral-to":o.transformEnd}),n.classList.add("zoom-lateral-back")),i&&a&&(N(i,d,v,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(N(r,d,v,{"--lateral-out-from":f,"--lateral-out-to":h}),r.classList.add("zoom-lateral-out")),N(e,d,v,{"--lateral-in-from":l,"--lateral-in-to":c}),e.classList.add("zoom-lateral-in");let w=s.keepAlive==="visible"?[e]:[r,e];n&&o&&w.push(n),i&&a&&w.push(i);let y=w.length,{finish:b}=q(()=>{Nt(w,_),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):k(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()},m+R);function _(O){let M=O?.target;M&&M.removeEventListener("animationend",_),y--,y<=0&&b()}w.forEach(O=>O.addEventListener("animationend",_))}function Ve(s,t,e,r,n,o,i){L(s,t,e);let a=r.stagger||0;N(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"),N(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&&(N(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=F(n),h=e?a*2:a,{finish:u}=q(()=>{Nt(l,d),l.forEach(v=>v.style.removeProperty("animation-delay")),i()},f+h+R);function d(v){let p=v?.target;if(p&&p.removeEventListener("animationend",d),p?.isConnected)try{T(p,r)}catch{}c--,c<=0&&u()}l.forEach(v=>v.addEventListener("animationend",d))}function Xe(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,h=r.stagger||0;N(s,n,o,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),h>0&&s.style.setProperty("animation-delay","0ms"),N(t,n,o,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),h>0&&t.style.setProperty("animation-delay",`${h}ms`),e&&f&&(N(e,n,o,{"--last-view-transform-start":f.backwardState.transform,"--last-view-transform-end":f.forwardState.transform}),h>0&&e.style.setProperty("animation-delay",`${h*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 u=e?[s,t,e]:[s,t],d=u.length,v=F(n),p=e?h*2:h,{finish:m}=q(()=>{Nt(u,g),u.forEach(w=>w.style.removeProperty("animation-delay")),a()},v+p+R);function g(w){let y=w?.target;if(y&&y.removeEventListener("animationend",g),y?.isConnected)try{Ye(y,r,i)}catch{}d--,d<=0&&m()}u.forEach(w=>w.addEventListener("animationend",g))}function Ye(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){k(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){A(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&P(s,t.views[2].backwardState)}function N(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 Nt(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function me(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"){j(s,t);return}if(e==="zoomIn"){L(r,n,o),T(r,i),T(n,i),o&&T(o,i),t();return}if(e==="zoomOut"){k(r,a),L(n,o),A(n,i.views[1].backwardState),o&&P(o,i.views[2].backwardState),t();return}t()}function pe(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=F(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){L(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,h=[];h.push(s.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:n,easing:o,fill:"forwards"})),h.push(t.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:n,delay:f,easing:o,fill:"forwards"})),c&&h.push(e.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:n,delay:f*2,easing:o,fill:"forwards"}));let u=c?f*2:f,{finish:d}=q(()=>{Mt(h);try{T(s,r),T(t,r),e&&T(e,r)}catch{}i()},n+u+R);Promise.all(h.map(v=>v.finished)).then(d).catch(d)}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,h=c.backwardState,u=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 d=t.style.transform||getComputedStyle(t).transform||c.forwardState.transform,v=e&&f?e.style.transform||getComputedStyle(e).transform||f.forwardState.transform:null,p=r.stagger||0,m=[];m.push(s.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:n,easing:o,fill:"forwards"})),m.push(t.animate([{transform:d},{transform:h.transform}],{duration:n,delay:p,easing:o,fill:"both"})),e&&u&&m.push(e.animate([{transform:v},{transform:u.transform}],{duration:n,delay:p*2,easing:o,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let g=e&&u?p*2:p,{finish:w}=q(()=>{Mt(m);try{k(s,i),A(t,h),e&&u&&P(e,u)}catch{}a()},n+g+R);Promise.all(m.map(y=>y.finished)).then(w).catch(w)})})}function Ke(s,t,e,r){let{currentView:n,previousView:o,backView:i,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:f,incomingTransformEnd:h,outgoingTransform:u,outgoingTransformEnd:d,currentStage:v,canvas:p}=s,m=v.views[0];L(n),n.classList.replace("is-new-current-view","is-current-view"),n.classList.remove("zoom-current-view","has-no-events"),n.style.transformOrigin=m.forwardState.origin;let g=[];g.push(n.animate([{transform:f,opacity:0},{transform:h,opacity:1}],{duration:t,easing:e,fill:"forwards"})),s.keepAlive!=="visible"&&g.push(o.animate([{transform:u,opacity:1},{transform:d,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:w}=q(()=>{Mt(g),n.style.transform=h||m.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),s.keepAlive?(o.style.opacity="",o.style.transform=d):k(o,p),r()},t+R);Promise.all(g.map(y=>y.finished)).then(w).catch(w)}function Mt(s){for(let t of s)try{t.cancel()}catch{}}function ve(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 h=F(l);r==="lateral"?j(s,t):r==="zoomIn"?Ge(e,n,o,i,a,h,c,t):r==="zoomOut"?Qe(e,n,o,i,a,h,c,f,t):t()}function Ge(s,t,e,r,n,o,i,a){L(t,e,r);let l=n.views[0],c=n.views[1],f=r&&n.views[2]?n.views[2]:null,h=ye([{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");we(h,0);let u=n.stagger||0,d=o+(f?u*2:u),v={value:0};s({targets:v,value:1,duration:d,easing:be(i),update:()=>{let p=v.value*d;ge(h,p,o,u)},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],h=r&&n.views[2]?n.views[2]:null,u=f.backwardState,d=h?h.backwardState:null,v=ye([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:f.backwardState,forward:f.forwardState},...h?[{el:r,backward:h.backwardState,forward:h.forwardState}]:[]],"backward");we(v,0);let p=n.stagger||0,m=o+(h?p*2:p),g={value:0};s({targets:g,value:1,duration:m,easing:be(i),update:()=>{let w=g.value*m;ge(v,w,o,p)},complete:()=>{k(t,a),A(e,u),r&&d&&P(r,d),l()}})}function ye(s,t){return s.map(({el:e,backward:r,forward:n})=>{if(t==="forward"){let o=$(e,r.origin,r.transform),i=$(e,r.origin,n.transform);return{el:e,from:o,to:i}}else{let o=$(e,n.origin,n.transform),i=$(e,n.origin,r.transform);return{el:e,from:o,to:i}}})}function we(s,t){for(let{el:e,from:r,to:n}of s)e.style.transform=it(at(r,n,t))}function ge(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=it(at(i,a,f))}}function be(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 _e(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 h=zt(l);r==="lateral"?j(s,t):r==="zoomIn"?Je(e,n,o,i,a,h,c,t):r==="zoomOut"?ts(e,n,o,i,a,h,c,f,t):t()}function Je(s,t,e,r,n,o,i,a){L(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 h=s.timeline({onComplete:()=>{T(t,n),T(e,n),r&&T(r,n),a()}}),u=Se(i),d=(n.stagger||0)/1e3;h.to(t,{transform:l.forwardState.transform,duration:o,ease:u},0),h.to(e,{transform:c.forwardState.transform,duration:o,ease:u},d),f&&h.to(r,{transform:f.forwardState.transform,duration:o,ease:u},d*2)}function ts(s,t,e,r,n,o,i,a,l){let c=n.views[0],f=n.views[1],h=r&&n.views[2]?n.views[2]:null,u=f.backwardState,d=h?h.backwardState:null;kt(t,c.forwardState);let v=e.style.transform||getComputedStyle(e).transform||f.forwardState.transform,p=r&&h?r.style.transform||getComputedStyle(r).transform||h.forwardState.transform:null;e.style.transformOrigin=f.forwardState.origin,r&&h&&(r.style.transformOrigin=h.forwardState.origin);let m=Se(i),g=s.timeline({onComplete:()=>{k(t,a),A(e,u),r&&d&&P(r,d),l()}}),w=(n.stagger||0)/1e3;s.set(e,{transform:v}),r&&p&&s.set(r,{transform:p}),g.fromTo(t,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:o,ease:m},0),g.fromTo(e,{transform:v},{transform:u.transform,duration:o,ease:m},w),r&&d&&g.fromTo(r,{transform:p},{transform:d.transform,duration:o,ease:m},w*2)}function kt(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function Se(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 h=zt(l);r==="lateral"?j(s,t):r==="zoomIn"?es(e,n,o,i,a,h,c,t):r==="zoomOut"?ss(e,n,o,i,a,h,c,f,t):t()}function es(s,t,e,r,n,o,i,a){L(t,e,r);let l=Te(t,e,r,n,"forward");xe(l,0);let c=n.stagger||0,f=c/1e3,h=o*1e3,u=o+(l.length>2?f*2:f);s(0,1,{duration:u,ease:ze(i),onUpdate:v=>{let p=v*u*1e3;Le(l,p,h,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,h=c.backwardState,u=f?f.backwardState:null,d=Te(t,e,r,n,"backward");xe(d,0);let v=n.stagger||0,p=v/1e3,m=o*1e3,g=o+(d.length>2?p*2:p);s(0,1,{duration:g,ease:ze(i),onUpdate:y=>{let b=y*g*1e3;Le(d,b,m,v)}}).then(()=>{k(t,a),A(e,h),r&&u&&P(r,u),l()}).catch(()=>l())}function Te(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:h})=>n==="forward"?{el:c,from:$(c,f.origin,f.transform),to:$(c,f.origin,h.transform)}:{el:c,from:$(c,h.origin,h.transform),to:$(c,h.origin,f.transform)})}function xe(s,t){for(let{el:e,from:r,to:n}of s)e.style.transform=it(at(r,n,t))}function Le(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=it(at(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 ze(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 ke={css:de,waapi:pe,none:me,anime:ve,gsap:_e,motion:Ee};function Ce(s){if(typeof s=="function")return{runTransition(r,n){s(r,n)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:ke[t]||ke.css}}function ns(s){if(typeof s!="string"||s.trim()==="")return{tx:0,ty:0,rest:""};let t=ut(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 d of s.storedViews){let v=d.views;if(Array.isArray(v))for(let p=0;p<v.length;p++){let m=v[p];!m||m.detachedNode||(m.backwardState&&(m.backwardState.transform=Dt(m.backwardState.transform,o,i),m.backwardState.origin!=null&&(m.backwardState.origin=Ft(m.backwardState.origin,o,i))),m.forwardState&&(m.forwardState.transform=Dt(m.forwardState.transform,o,i),m.forwardState.origin!=null&&(m.forwardState.origin=Ft(m.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"),h=a.querySelector(".is-new-current-view"),u=[l,c,f,h].filter(Boolean);for(let d of u){if(!d.style)continue;let v=d.style.transform;v!=null&&v!==""&&(d.style.transform=Dt(v,o,i));let p=d.style.transformOrigin;p!=null&&p!==""&&(d.style.transformOrigin=Ft(p,o,i))}}var is=8e3,vt=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=Ce(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 x(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??{}},h=n?.dataset?.deferred!==void 0?!0:this.deferred,u,d=null;try{if(h){let S=await this.prefetcher.get(t,f);if(this._destroyed)return;for(d=document.createDocumentFragment();S.firstChild;)d.appendChild(S.firstChild);u=await ht(S,t,r,!1,{},this.componentContext)}else{let S=await this.prefetcher.get(t,f);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(S,f),u=await ht(S,t,r,!1,this.views,this.componentContext)}}catch(S){this.notify(`zoomIn aborted: failed to resolve view "${t}": ${S.message}`,"error");return}if(!u)return;h||this._emit("viewMounted",{viewName:t,node:u}),n&&n.classList.add("zoomed");let v=n?(()=>{let S=n.getBoundingClientRect();return{x:S.x,y:S.y,width:S.width,height:S.height}})():e.rect,p=n?n.dataset.withDuration||this.duration:e.duration??this.duration,m=n?n.dataset.withEase||this.ease:e.ease??this.ease,g=n?n.dataset.withCover||this.cover:e.cover??this.cover,w=n?parseInt(n.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,y=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),_=r.querySelector(".is-last-view");if(!y){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(u)}catch{}return}nt(u),nt(y),nt(b),_&&(nt(_),r.removeChild(_));let O,M,B,H,lt,yt,V,ct=y.style.transform,z=y.style.transformOrigin,D=b?b.style.transform:null,C=b?b.style.transformOrigin:null;try{y.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let S=u.getBoundingClientRect(),X=y.getBoundingClientRect(),Pt=null,Rt=null,gt=null;b&&(Pt=b.getBoundingClientRect(),gt=b.querySelector(".zoomed"),Rt=gt&>.getBoundingClientRect?gt.getBoundingClientRect():Pt);let bt={left:i,top:a},qt={width:o.width,height:o.height},Bt={width:S.width,height:S.height},Vt=te(v.width,v.height,S.width,S.height,g);V=Vt.scale;let Me=Vt.scaleInv;O=ee(v,bt,Bt,Me),B=y.style.transform;let Xt=re(v,X);H=ne(qt,v,X,V,this.parallax);let Yt=Et(z||"0 0"),K=dt(B||""),Ut=Et(Xt),G=dt(H.transform),Wt=v;if(n&&(Wt=Tt(v,X,Yt,K.tx,K.ty,K.scale,Ut,G.tx,G.ty,G.scale)),M=se(Wt,bt,Bt),b){lt=b.style.transform;let De=Tt(X,X,Yt,K.tx,K.ty,K.scale,Ut,G.tx,G.ty,G.scale),Fe=ie(H.x,H.y,bt,V,c),Kt=Et(C||"0 0"),It=dt(lt||""),Zt=dt(Fe),He=Tt(Rt,Pt,Kt,It.tx,It.ty,It.scale,Kt,Zt.tx,Zt.ty,Zt.scale);yt=oe({canvasRect:qt,canvasOffset:bt,triggerRect:v,previousViewRectAtBaseTransform:X,lastViewZoomedElementRect:He,previousViewRectWithPreviousAtEndTransform:De,scale:V,preScale:c,parallax:this.parallax})}u.style.transform=O,y.style.transformOrigin=Xt}catch(S){this.notify(`zoomIn geometry computation failed: ${S.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",S),y.style.transform=ct,y.style.transformOrigin=z,y.classList.contains("is-previous-view")&&y.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=D,b.style.transformOrigin=C,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(u)}catch{}n&&n.classList.remove("zoomed"),U(y),U(b);return}let W=mt(u.dataset.viewName,{origin:u.style.transformOrigin,duration:p,ease:m,transform:O},{origin:u.style.transformOrigin,duration:p,ease:m,transform:M}),Pe=mt(y.dataset.viewName,{origin:y.style.transformOrigin,duration:p,ease:m,transform:B},{origin:y.style.transformOrigin,duration:p,ease:m,transform:H.transform}),Ie=b?mt(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:m,transform:lt},{origin:b.style.transformOrigin,duration:p,ease:m,transform:yt}):null,Ze=_?ae(_):null,wt=le(this.storedViews.length,W,Pe,Ie,Ze);wt.scale=V,wt.stagger=w||0,this.storeViews(wt),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let $e=this._resolveEffects(n);this._applyEffects(y,b,$e,p,m);let Ot=this._resolveHideTrigger(n);this._applyHideTrigger(n,u,Ot,p,m),Ot&&(wt.hideTriggerMode=Ot),this._setBlockEvents();let Ne={type:"zoomIn",currentView:u,previousView:y,lastView:b,currentStage:this.currentStage,duration:p,ease:m},At=async()=>{this._pendingTransitionComplete===At&&(this._pendingTransitionComplete=null,!this._destroyed&&(h&&d&&u&&(u.appendChild(d),this.prefetcher.scanAndPrefetch(u,f),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function"&&await this.views[t].mounted(),this._emit("viewMounted",{viewName:t,node:u})),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended")))};this._pendingTransitionComplete=At,this.transitionDriver.runTransition(Ne,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 z=this.storedViews[this.storedViews.length-1];a={name:o,entry:z.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"),h=this.canvas.querySelector(".is-last-view"),u=0,d=0,v=this._declaredSiblings(),p=v?v.indexOf(o):-1,m=v?v.indexOf(t):-1;if(p!==-1&&m!==-1){let z=this.canvas.getBoundingClientRect();u=(p-m)*z.width*.15}else if(f){let z=f.querySelector(`.zoom-me[data-to="${o}"]`),D=f.querySelector(`.zoom-me[data-to="${t}"]`);if(z&&D){let C=z.getBoundingClientRect(),W=D.getBoundingClientRect();u=C.left+C.width/2-(W.left+W.width/2),d=C.top+C.height/2-(W.top+W.height/2)}else u=this.canvas.getBoundingClientRect().width*.15}let g=null,w=null;if(i&&(e&&r.keepAliveNode?w=r.keepAliveNode:w=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),w){if(w.style.display="",w.style.opacity="",w.classList.remove("is-lateral-hidden","zoom-lateral-out"),w.classList.add("is-new-current-view","has-no-events"),g=w,!e&&this.lateralHistory){let z=this.lateralHistory.findIndex(D=>D.node===w);z!==-1&&this.lateralHistory.splice(z,1)}}else{let z=()=>{e&&this.lateralHistory.push({name:t,entry:r.savedEntry,node:r.keepAliveNode??null})},D={target:document.createElement("div"),context:this.componentContext,props:r.props??{}};try{let C=await this.prefetcher.get(t,D);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(C,D),g=await ht(C,t,this.canvas,!1,this.views,this.componentContext)}catch(C){this.notify(`lateral navigation aborted: failed to resolve view "${t}": ${C.message}`,"error"),z();return}if(!g){z();return}this._emit("viewMounted",{viewName:t,node:g})}a&&this.lateralHistory.push(a),nt(g);let y=n.style.transform||"",b=n.style.transformOrigin||"0 0";g.style.transform=y,g.style.transformOrigin=b;let _=this.storedViews[this.storedViews.length-1],O=e&&r.savedEntry?{...r.savedEntry,viewName:t}:mt(t,{origin:b,duration:l,ease:c,transform:y},{origin:b,duration:l,ease:c,transform:y});_.views[0]=O,this.currentStage=_;let M=f?{transformStart:f.style.transform||"",transformEnd:this._computeLateralBackTransform(f.style.transform||"",u,d)}:null,B=h&&_.views[2]?{transformStart:h.style.transform||"",transformEnd:this._computeLateralBackTransform(h.style.transform||"",u*.7,d*.7)}:null;M&&_.views[1]&&(_.views[1].forwardState={..._.views[1].forwardState,transform:M.transformEnd}),B&&_.views[2]&&(_.views[2].forwardState={..._.views[2].forwardState,transform:B.transformEnd});let H=y,lt=this._computeLateralBackTransform(H,-u,-d),yt=this._computeLateralBackTransform(y,u,d);this._setBlockEvents();let V={type:"lateral",currentView:g,previousView:n,lastView:h||null,backView:f||null,backViewState:M,lastViewState:B,incomingTransformStart:lt,incomingTransformEnd:H,outgoingTransform:y,outgoingTransformEnd:yt,currentStage:this.currentStage,duration:l,ease:c,canvas:this.canvas,slideDeltaX:u,slideDeltaY:d,keepAlive:i&&!e?i:!1},ct=()=>{this._pendingTransitionComplete===ct&&(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=y,n.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:o,isBack:e}),this.tracing("ended")))};this._pendingTransitionComplete=ct,this.transitionDriver.runTransition(V,ct)}_computeLateralBackTransform(t,e,r){let n=ut(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"),U(n));let c=ce(this.currentStage);if(c){t.prepend(c);let u=t.querySelector(".z-view:first-child");u&&(U(u),u.classList.add("hide"))}let f={type:"zoomOut",currentView:e,previousView:r,lastView:n,currentStage:this.currentStage,duration:o,ease:i,canvas:t},h=()=>{this._pendingTransitionComplete===h&&(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=h,this.transitionDriver.runTransition(f,h)}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="‹",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="‹",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=>h=>{h.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="›",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 Oe(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 Ae={install(s,t){let e=Object.assign({},as,t),r=e.separator,n=e.prefix,o=!1;function i(f){if(o)return;let h=Oe(s,r),u="#"+n+h;window.location.hash!==u&&(o=!0,window.history[f](null,"",u),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),h=Oe(s,r).split(r).filter(Boolean);if(f.join(r)===h.join(r)){o=!1;return}if(f.length<h.length){let u=h.length-f.length;for(let d=0;d<u;d++)s.zoomOut()}else if(f.length===h.length&&f.length>0){let u=f[f.length-1];u!==h[h.length-1]&&s.goTo(u,{mode:"lateral"})}else f.length>h.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)})}};vt.Router=Ae;window.Zumly=vt;})();
|
package/dist/zumly.min.css
CHANGED
|
@@ -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}.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}.
|
|
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)}
|