zumly 0.92.0 → 0.92.2

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 CHANGED
@@ -5,7 +5,8 @@
5
5
  </a>
6
6
  </p>
7
7
 
8
- <h1 align="center">Z over XY</h1>
8
+ <h1 align="center">ZUMLY</h1>
9
+ <p align="center"><em>Z over XY</em></p>
9
10
 
10
11
  <p align="center"><strong>Focus-driven navigation.</strong></p>
11
12
  <p align="center"><strong>Zoom into what matters.</strong></p>
@@ -128,9 +129,8 @@ await app.init();
128
129
  | `transitions` | object | No | Duration, ease, cover, driver, effects, stagger, hideTrigger for zoom transitions. |
129
130
  | `deferred` | boolean | No | Defer content rendering until after animation completes (default: `false`). |
130
131
  | `debug` | boolean | No | Enable debug messages (default: `false`). |
131
- | `lateralNav` | boolean \| object | No | Lateral navigation UI: `{ mode, arrows, dots, keepAlive }`. |
132
- | `depthNav` | boolean \| object | No | Depth navigation UI: `{ button, indicator }`. |
133
- | `navPosition` | string | No | Nav bar position preset (default: `'bottom-center'`). |
132
+ | `lateralNav` | boolean \| object | No | Lateral navigation UI: `{ mode, arrows, dots, keepAlive, position }`. |
133
+ | `depthNav` | boolean \| object | No | Depth back button: `{ position }`. Default: `'bottom-left'`. |
134
134
  | `inputs` | boolean \| object | No | Input methods: `{ click, keyboard, wheel, touch }`. |
135
135
  | `componentContext` | object | No | Context passed to component-style views. |
136
136
 
@@ -174,13 +174,14 @@ const app = new Zumly({
174
174
  });
175
175
  ```
176
176
 
177
- **Lateral navigation:**
177
+ **Lateral navigation (arrows + dots bar):**
178
178
 
179
179
  ```js
180
- lateralNav: true // mode: 'auto' (default)
180
+ lateralNav: true // mode: 'auto' (default), bottom-center
181
181
  lateralNav: false // disabled
182
182
  lateralNav: { mode: 'always' } // always show when siblings exist
183
183
  lateralNav: { mode: 'auto', dots: false } // auto mode, no dots
184
+ lateralNav: { position: 'top-center' } // top instead of bottom
184
185
  ```
185
186
 
186
187
  | Mode | Description |
@@ -188,26 +189,17 @@ lateralNav: { mode: 'auto', dots: false } // auto mode, no dots
188
189
  | `'auto'` (default) | Shows lateral nav only when the current view doesn't cover the full canvas — preserving spatial context. |
189
190
  | `'always'` | Always shows lateral nav when siblings exist, regardless of coverage. |
190
191
 
191
- In `'auto'` mode, when a view covers 100% of the canvas the user perceives a new independent space, so the lateral nav is suppressed to avoid a floating control with no visual context.
192
+ Position: `'bottom-center'` (default) or `'top-center'`.
192
193
 
193
- **Navigation position (`navPosition`):**
194
+ **Depth navigation (back button):**
194
195
 
195
196
  ```js
196
- navPosition: 'bottom-center' // default
197
+ depthNav: true // default: back button at bottom-left
198
+ depthNav: false // disabled
199
+ depthNav: { position: 'top-left' } // top instead of bottom
197
200
  ```
198
201
 
199
- | Preset | Position | Layout |
200
- |--------|----------|--------|
201
- | `'bottom-center'` | Bottom center | Horizontal |
202
- | `'bottom-left'` | Bottom left | Horizontal |
203
- | `'bottom-right'` | Bottom right | Horizontal |
204
- | `'top-center'` | Top center | Horizontal |
205
- | `'top-left'` | Top left | Horizontal |
206
- | `'top-right'` | Top right | Horizontal |
207
- | `'middle-left'` | Left center | Vertical |
208
- | `'middle-right'` | Right center | Vertical |
209
-
210
- The `'middle-left'` and `'middle-right'` presets render the nav bar vertically with rotated arrows.
202
+ Position: `'bottom-left'` (default) or `'top-left'`. The depth and lateral nav are separate, independently positioned components.
211
203
 
212
204
  **Zoomable elements:**
213
205
 
@@ -428,8 +420,8 @@ See [CHANGELOG.md](CHANGELOG.md) for version history.
428
420
 
429
421
  **Done:**
430
422
  - Depth and lateral navigation (`zoomIn`, `zoomOut`, `goTo`, `back`, `zoomTo`)
431
- - Lateral nav UI (`lateralNav`: `mode` auto/always, arrows, dots, `keepAlive`)
432
- - Depth nav UI (`depthNav`) and `navPosition` presets
423
+ - Lateral nav bar (`lateralNav`: `mode` auto/always, arrows, dots, `keepAlive`, `position`)
424
+ - Depth back button (`depthNav`: `position` bottom-left/top-left)
433
425
  - Inputs toggles (`inputs`: wheel, keyboard, click, touch)
434
426
  - Plugin system (`use()`), router plugin (hash sync, back, forward blocked)
435
427
  - Resize correction (translate/origin scaling; deferred while transitioning)
package/dist/zumly.css CHANGED
@@ -179,7 +179,44 @@
179
179
  opacity: 1;
180
180
  }
181
181
  }
182
- .z-nav {
182
+ .z-depth-nav {
183
+ position: absolute;
184
+ z-index: 10;
185
+ pointer-events: none;
186
+ }
187
+ .z-depth-nav > * {
188
+ pointer-events: auto;
189
+ }
190
+ .z-depth-nav--bottom-left {
191
+ bottom: 20px;
192
+ left: 20px;
193
+ }
194
+ .z-depth-nav--top-left {
195
+ top: 20px;
196
+ left: 20px;
197
+ }
198
+ .z-nav-back {
199
+ width: 32px;
200
+ height: 32px;
201
+ border-radius: 50%;
202
+ border: 1px solid rgba(255, 255, 255, 0.25);
203
+ background: rgba(0, 0, 0, 0.5);
204
+ backdrop-filter: blur(12px);
205
+ color: #fff;
206
+ font-size: 1.1rem;
207
+ line-height: 1;
208
+ cursor: pointer;
209
+ display: flex;
210
+ align-items: center;
211
+ justify-content: center;
212
+ transition: background 0.15s, border-color 0.15s;
213
+ padding: 0;
214
+ }
215
+ .z-nav-back:hover {
216
+ background: rgba(255, 255, 255, 0.18);
217
+ border-color: rgba(255, 255, 255, 0.4);
218
+ }
219
+ .z-lateral-nav {
183
220
  position: absolute;
184
221
  z-index: 10;
185
222
  display: flex;
@@ -192,94 +229,19 @@
192
229
  border-radius: 100px;
193
230
  padding: 6px 10px;
194
231
  }
195
- .z-nav--bottom-center {
232
+ .z-lateral-nav > * {
233
+ pointer-events: auto;
234
+ }
235
+ .z-lateral-nav--bottom-center {
196
236
  bottom: 20px;
197
237
  left: 50%;
198
238
  transform: translateX(-50%);
199
239
  }
200
- .z-nav--bottom-left {
201
- bottom: 20px;
202
- left: 20px;
203
- }
204
- .z-nav--bottom-right {
205
- bottom: 20px;
206
- right: 20px;
207
- }
208
- .z-nav--top-center {
240
+ .z-lateral-nav--top-center {
209
241
  top: 20px;
210
242
  left: 50%;
211
243
  transform: translateX(-50%);
212
244
  }
213
- .z-nav--top-left {
214
- top: 20px;
215
- left: 20px;
216
- }
217
- .z-nav--top-right {
218
- top: 20px;
219
- right: 20px;
220
- }
221
- .z-nav--middle-left {
222
- top: 50%;
223
- left: 16px;
224
- transform: translateY(-50%);
225
- flex-direction: column;
226
- }
227
- .z-nav--middle-right {
228
- top: 50%;
229
- right: 16px;
230
- transform: translateY(-50%);
231
- flex-direction: column;
232
- }
233
- .z-nav > * {
234
- pointer-events: auto;
235
- }
236
- .z-nav-depth,
237
- .z-nav-lateral {
238
- display: flex;
239
- align-items: center;
240
- gap: 8px;
241
- }
242
- .z-nav-sep {
243
- width: 1px;
244
- height: 18px;
245
- background: rgba(255, 255, 255, 0.15);
246
- margin: 0 8px;
247
- flex-shrink: 0;
248
- }
249
- .z-nav--middle-left .z-nav-depth,
250
- .z-nav--middle-left .z-nav-lateral,
251
- .z-nav--middle-right .z-nav-depth,
252
- .z-nav--middle-right .z-nav-lateral {
253
- flex-direction: column;
254
- }
255
- .z-nav--middle-left .z-nav-depth-dots,
256
- .z-nav--middle-left .z-nav-lateral-dots,
257
- .z-nav--middle-right .z-nav-depth-dots,
258
- .z-nav--middle-right .z-nav-lateral-dots {
259
- flex-direction: column;
260
- }
261
- .z-nav--middle-left .z-nav-sep,
262
- .z-nav--middle-right .z-nav-sep {
263
- width: 18px;
264
- height: 1px;
265
- margin: 8px 0;
266
- }
267
- .z-nav--middle-left .z-nav-back,
268
- .z-nav--middle-right .z-nav-back {
269
- transform: rotate(180deg);
270
- }
271
- .z-nav--middle-left .z-nav-prev,
272
- .z-nav--middle-right .z-nav-prev {
273
- transform: rotate(90deg);
274
- }
275
- .z-nav--middle-left .z-nav-next,
276
- .z-nav--middle-right .z-nav-next {
277
- transform: rotate(90deg);
278
- }
279
- .z-nav-back {
280
- transform: rotate(90deg);
281
- }
282
- .z-nav-back,
283
245
  .z-nav-arrow {
284
246
  width: 28px;
285
247
  height: 28px;
@@ -296,7 +258,6 @@
296
258
  transition: background 0.15s, border-color 0.15s;
297
259
  padding: 0;
298
260
  }
299
- .z-nav-back:hover,
300
261
  .z-nav-arrow:hover:not(:disabled) {
301
262
  background: rgba(255, 255, 255, 0.18);
302
263
  border-color: rgba(255, 255, 255, 0.4);
@@ -305,7 +266,6 @@
305
266
  opacity: 0.2;
306
267
  cursor: default;
307
268
  }
308
- .z-nav-depth-dots,
309
269
  .z-nav-lateral-dots {
310
270
  display: flex;
311
271
  align-items: center;
package/dist/zumly.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * zumly
3
- * v.0.92.0
3
+ * v.0.92.2
4
4
  * Author Juan Martin Muda - Zumerlab
5
5
  * License MIT
6
6
  */
7
- var Xt=s=>{throw TypeError(s)};var kt=(s,t,e)=>t.has(s)||Xt("Cannot "+e);var S=(s,t,e)=>(kt(s,t,"read from private field"),e?e.call(s):t.get(s)),P=(s,t,e)=>t.has(s)?Xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),W=(s,t,e,r)=>(kt(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),it=(s,t,e)=>(kt(s,t,"access private method"),e);var K,vt,Yt,pt=class{constructor(t={}){P(this,vt);P(this,K,{});W(this,K,t)}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(S(this,K),t)){let o=S(this,K)[t];return this.resolve(o,e)}switch(it(this,vt,Yt).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(),f=document.createElement("div");f.innerHTML=a.trim();let l=f.firstElementChild;if(!l)throw new Error("Zumly: view produced no element (url)");return l}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")}}};K=new WeakMap,vt=new WeakSet,Yt=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 at(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 k(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 Ut(s,t){if(t.isValid=!1,!s||typeof s!="object"){k(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){k(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){k(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){k(!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&&k(!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&&k(!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&&k(!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 f=e&&e.driver,l=typeof f=="string"?f.toLowerCase():null,u=typeof f=="function"?f:null;if(l!==null){let g=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=g.includes(l)?l:"css",g.includes(l)||k(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${f}". Falling back to "css".`,"warn")}else u!==null?t.transitionDriver=u:t.transitionDriver="css";let c=e&&e.stagger;typeof c=="number"&&c>0?t.stagger=c:(t.stagger=0,c!=null&&c!==0&&k(!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 g=typeof d.mode=="string"?d.mode.toLowerCase():null,w=g==="auto"||g==="always";g&&!w&&k(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn"),t.lateralNav={mode:w?g:"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}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1};let m=s.depthNav;m===!1?t.depthNav=!1:m&&typeof m=="object"?t.depthNav={button:typeof m.button=="boolean"?m.button:!0,indicator:typeof m.indicator=="boolean"?m.indicator:!0}:t.depthNav={button:!0,indicator:!0};let p=s.navPosition,v=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right","middle-left","middle-right"];typeof p=="string"&&v.includes(p)?t.navPosition=p:(t.navPosition="bottom-center",p!=null&&k(!1,`'navPosition' must be one of: ${v.join(", ")}. Falling back to "bottom-center".`,"warn"));let y=s.inputs;y&&typeof y=="object"?t.inputs={wheel:typeof y.wheel=="boolean"?y.wheel:!0,keyboard:typeof y.keyboard=="boolean"?y.keyboard:!0,click:typeof y.click=="boolean"?y.click:!0,touch:typeof y.touch=="boolean"?y.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function Wt(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 Kt(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 Gt(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 Qt(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 Jt(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,f=n*a,l=i*a;return{x:n,y:i,transform:`translate(${f}px, ${l}px) scale(${r})`}}function te({canvasRect:s,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:r,lastViewZoomedElementRect:o,previousViewRectWithPreviousAtEndTransform:n,scale:i,preScale:a,parallax:f=0}){let l=t.left,u=t.top,c=s.width/2-e.width/2-e.x,h=s.height/2-e.height/2-e.y,d=c+(r.x-o.x)+n.x-l+(n.width-o.width)/2,m=h+(r.y-o.y)+n.y-u+(n.height-o.height)/2,p=1-Math.min(f*2,.9);return`translate(${d*p}px, ${m*p}px) scale(${i*a})`}function ee(s,t,e,r,o){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*o})`}function yt(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function lt(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 wt(s,t,e,r,o,n,i,a,f,l){let u=t.x-e.x*(1-n)-r,c=t.y-e.y*(1-n)-o,h=t.width/n,d=t.height/n,m=u+e.x+(s.x-u-e.x-r)/n,p=c+e.y+(s.y-c-e.y-o)/n,v=s.width/n,y=s.height/n,g=u+i.x+a+l*(m-u-i.x),w=c+i.y+f+l*(p-c-i.y),b=v*l,T=y*l;return{x:g,y:w,width:b,height:T,left:g,top:w,right:g+b,bottom:w+T}}function ct(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function se(s){return{detachedNode:s}}function re(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 oe(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var Z,gt=class{constructor(){P(this,Z,new Map)}set(t,e,r=null){S(this,Z).set(t,{node:e,expires:r?Date.now()+r:null})}get(t){let e=S(this,Z).get(t);return e?e.expires!==null&&Date.now()>e.expires?(S(this,Z).delete(t),null):e.node.cloneNode(!0):null}has(t){let e=S(this,Z).get(t);return e?e.expires!==null&&Date.now()>e.expires?(S(this,Z).delete(t),!1):!0:!1}invalidate(t){S(this,Z).delete(t)}clear(){S(this,Z).clear()}};Z=new WeakMap;var De=300*1e3,He=/^https?:\/\/|^\/|\.html$|\.php$/i,G,Q,J,V,tt,ne,ie,bt=class{constructor(t={}){P(this,tt);P(this,G);P(this,Q);P(this,J);P(this,V,new Map);W(this,J,t),W(this,G,new pt(t)),W(this,Q,new gt)}async get(t,e=null){if(it(this,tt,ne).call(this,t)){let r=S(this,Q).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,G).resolve(t,e),i=S(this,J)[t],a=it(this,tt,ie).call(this,i);return S(this,Q).set(t,n,a),S(this,V).delete(t),n})();return S(this,V).set(t,o),o}return S(this,G).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))})}};G=new WeakMap,Q=new WeakMap,J=new WeakMap,V=new WeakMap,tt=new WeakSet,ne=function(t){return typeof S(this,J)[t]=="string"},ie=function(t){return He.test(t)?De:null};function et(s){s&&(s.style.contentVisibility="hidden")}function X(s){s&&(s.style.contentVisibility="visible")}function F(s){if(typeof s=="number"&&!Number.isNaN(s))return Math.max(0,s);let e=String(s).match(/^(\d+(?:\.\d+)?)\s*(ms|s)?$/i);if(!e)return 500;let r=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,r):Math.max(0,r*1e3)}function St(s){return F(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 C(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 O(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 L(...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:f,currentStage:l,canvas:u}=s,c=l.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=c.forwardState.origin,e.style.transform=f||c.forwardState.transform,o&&n&&(o.style.transform=n.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||z(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 ae(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function je(s){if(!s||s==="none")return ae();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}:ae()}function rt(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function st(s,t,e){return s+(t-s)*e}function ot(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:st(s.a,t.a,r),b:st(s.b,t.b,r),c:st(s.c,t.c,r),d:st(s.d,t.d,r),e:st(s.e,t.e,r),f:st(s.f,t.f,r)}}function $(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return je(getComputedStyle(s).transform)}function le(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:f,canvas:l}=s;if(!r||!o||!i){t();return}e==="lateral"?Re(s,t):e==="zoomIn"?qe(r,o,n,i,a,f,t):e==="zoomOut"?Be(r,o,n,i,a,f,l,t):t()}function Re(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformStart:f,incomingTransformEnd:l,outgoingTransform:u,outgoingTransformEnd:c,currentStage:h,duration:d,ease:m,canvas:p}=s,v=F(d),y=h.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=y.forwardState.origin,o&&n&&(N(o,d,m,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),o.classList.add("zoom-lateral-back")),i&&a&&(N(i,d,m,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(N(r,d,m,{"--lateral-out-from":u,"--lateral-out-to":c}),r.classList.add("zoom-lateral-out")),N(e,d,m,{"--lateral-in-from":f,"--lateral-in-to":l}),e.classList.add("zoom-lateral-in");let g=s.keepAlive==="visible"?[e]:[r,e];o&&n&&g.push(o),i&&a&&g.push(i);let w=g.length,{finish:b}=R(()=>{Ct(g,T),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):z(r,p),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=l,t()},v+j);function T(M){let q=M?.target;q&&q.removeEventListener("animationend",T),w--,w<=0&&b()}g.forEach(M=>M.addEventListener("animationend",T))}function qe(s,t,e,r,o,n,i){L(s,t,e);let a=r.stagger||0;N(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"),N(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&&(N(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 f=e?[s,t,e]:[s,t],l=f.length,u=F(o),c=e?a*2:a,{finish:h}=R(()=>{Ct(f,d),f.forEach(m=>m.style.removeProperty("animation-delay")),i()},u+c+j);function d(m){let p=m?.target;if(p&&p.removeEventListener("animationend",d),p?.isConnected)try{E(p,r)}catch{}l--,l<=0&&h()}f.forEach(m=>m.addEventListener("animationend",d))}function Be(s,t,e,r,o,n,i,a){let f=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,c=r.stagger||0;N(s,o,n,{"--current-view-transform-start":f.backwardState.transform,"--current-view-transform-end":f.forwardState.transform}),c>0&&s.style.setProperty("animation-delay","0ms"),N(t,o,n,{"--previous-view-transform-start":l.backwardState.transform,"--previous-view-transform-end":l.forwardState.transform}),c>0&&t.style.setProperty("animation-delay",`${c}ms`),e&&u&&(N(e,o,n,{"--last-view-transform-start":u.backwardState.transform,"--last-view-transform-end":u.forwardState.transform}),c>0&&e.style.setProperty("animation-delay",`${c*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,m=F(o),p=e?c*2:c,{finish:v}=R(()=>{Ct(h,y),h.forEach(g=>g.style.removeProperty("animation-delay")),a()},m+p+j);function y(g){let w=g?.target;if(w&&w.removeEventListener("animationend",y),w?.isConnected)try{Ve(w,r,i)}catch{}d--,d<=0&&v()}h.forEach(g=>g.addEventListener("animationend",y))}function Ve(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){z(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){C(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&O(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[o,n]of Object.entries(r))s.style.setProperty(o,n)}function Ct(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function ce(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"){L(r,o,n),E(r,i),E(o,i),n&&E(n,i),t();return}if(e==="zoomOut"){z(r,a),L(o,n),C(o,i.views[1].backwardState),n&&O(n,i.views[2].backwardState),t();return}t()}function fe(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:f,canvas:l}=s;if(!r||!o||!i){t();return}let u=F(a);if(e==="lateral"){Ue(s,u,f,t);return}if(e==="zoomIn"){Xe(r,o,n,i,u,f,t);return}if(e==="zoomOut"){Ye(r,o,n,i,u,f,l,t);return}t()}function Xe(s,t,e,r,o,n,i){L(s,t,e);let a=r.views[0],f=r.views[1],l=e&&r.views[2]?r.views[2]:null;s.style.transformOrigin=a.backwardState.origin,s.style.transform=a.backwardState.transform,t.style.transformOrigin=f.backwardState.origin,t.style.transform=f.backwardState.transform,l&&(e.style.transformOrigin=l.backwardState.origin,e.style.transform=l.backwardState.transform);let u=r.stagger||0,c=[];c.push(s.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:o,easing:n,fill:"forwards"})),c.push(t.animate([{transform:f.backwardState.transform},{transform:f.forwardState.transform}],{duration:o,delay:u,easing:n,fill:"forwards"})),l&&c.push(e.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:o,delay:u*2,easing:n,fill:"forwards"}));let h=l?u*2:u,{finish:d}=R(()=>{Ot(c);try{E(s,r),E(t,r),e&&E(e,r)}catch{}i()},o+h+j);Promise.all(c.map(m=>m.finished)).then(d).catch(d)}function Ye(s,t,e,r,o,n,i,a){let f=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,c=l.backwardState,h=u?u.backwardState:null;s.style.transformOrigin=f.forwardState.origin,s.style.transform=f.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=l.forwardState.origin,e&&u&&(e.style.transformOrigin=u.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||l.forwardState.transform,m=e&&u?e.style.transform||getComputedStyle(e).transform||u.forwardState.transform:null,p=r.stagger||0,v=[];v.push(s.animate([{transform:f.forwardState.transform},{transform:f.backwardState.transform}],{duration:o,easing:n,fill:"forwards"})),v.push(t.animate([{transform:d},{transform:c.transform}],{duration:o,delay:p,easing:n,fill:"both"})),e&&h&&v.push(e.animate([{transform:m},{transform:h.transform}],{duration:o,delay:p*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&h?p*2:p,{finish:g}=R(()=>{Ot(v);try{z(s,i),C(t,c),e&&h&&O(e,h)}catch{}a()},o+y+j);Promise.all(v.map(w=>w.finished)).then(g).catch(g)})})}function Ue(s,t,e,r){let{currentView:o,previousView:n,backView:i,backViewState:a,lastView:f,lastViewState:l,incomingTransformStart:u,incomingTransformEnd:c,outgoingTransform:h,outgoingTransformEnd:d,currentStage:m,canvas:p}=s,v=m.views[0];L(o),o.classList.replace("is-new-current-view","is-current-view"),o.classList.remove("zoom-current-view","has-no-events"),o.style.transformOrigin=v.forwardState.origin;let y=[];y.push(o.animate([{transform:u,opacity:0},{transform:c,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"})),f&&l&&y.push(f.animate([{transform:l.transformStart},{transform:l.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:g}=R(()=>{Ot(y),o.style.transform=c||v.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),f&&l&&(f.style.transform=l.transformEnd),s.keepAlive?(n.style.opacity="",n.style.transform=d):z(n,p),r()},t+j);Promise.all(y.map(w=>w.finished)).then(g).catch(g)}function Ot(s){for(let t of s)try{t.cancel()}catch{}}function ue(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:f,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let c=F(f);r==="lateral"?H(s,t):r==="zoomIn"?We(e,o,n,i,a,c,l,t):r==="zoomOut"?Ke(e,o,n,i,a,c,l,u,t):t()}function We(s,t,e,r,o,n,i,a){L(t,e,r);let f=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null,c=he([{el:t,backward:f.backwardState,forward:f.forwardState},{el:e,backward:l.backwardState,forward:l.forwardState},...u?[{el:r,backward:u.backwardState,forward:u.forwardState}]:[]],"forward");de(c,0);let h=o.stagger||0,d=n+(u?h*2:h),m={value:0};s({targets:m,value:1,duration:d,easing:pe(i),update:()=>{let p=m.value*d;me(c,p,n,h)},complete:()=>{E(t,o),E(e,o),r&&E(r,o),a()}})}function Ke(s,t,e,r,o,n,i,a,f){let l=o.views[0],u=o.views[1],c=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=c?c.backwardState:null,m=he([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:u.backwardState,forward:u.forwardState},...c?[{el:r,backward:c.backwardState,forward:c.forwardState}]:[]],"backward");de(m,0);let p=o.stagger||0,v=n+(c?p*2:p),y={value:0};s({targets:y,value:1,duration:v,easing:pe(i),update:()=>{let g=y.value*v;me(m,g,n,p)},complete:()=>{z(t,a),C(e,h),r&&d&&O(r,d),f()}})}function he(s,t){return s.map(({el:e,backward:r,forward:o})=>{if(t==="forward"){let n=$(e,r.origin,r.transform),i=$(e,r.origin,o.transform);return{el:e,from:n,to:i}}else{let n=$(e,o.origin,o.transform),i=$(e,o.origin,r.transform);return{el:e,from:n,to:i}}})}function de(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=rt(ot(r,o,t))}function me(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],f=o*r,l=Math.max(0,t-f),u=e>0?Math.min(1,l/e):1;n.style.transform=rt(ot(i,a,u))}}function pe(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 ve(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:f,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let c=St(f);r==="lateral"?H(s,t):r==="zoomIn"?Ge(e,o,n,i,a,c,l,t):r==="zoomOut"?Qe(e,o,n,i,a,c,l,u,t):t()}function Ge(s,t,e,r,o,n,i,a){L(t,e,r);let f=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null;Et(t,f.backwardState),Et(e,l.backwardState),u&&Et(r,u.backwardState);let c=s.timeline({onComplete:()=>{E(t,o),E(e,o),r&&E(r,o),a()}}),h=ye(i),d=(o.stagger||0)/1e3;c.to(t,{transform:f.forwardState.transform,duration:n,ease:h},0),c.to(e,{transform:l.forwardState.transform,duration:n,ease:h},d),u&&c.to(r,{transform:u.forwardState.transform,duration:n,ease:h},d*2)}function Qe(s,t,e,r,o,n,i,a,f){let l=o.views[0],u=o.views[1],c=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=c?c.backwardState:null;Et(t,l.forwardState);let m=e.style.transform||getComputedStyle(e).transform||u.forwardState.transform,p=r&&c?r.style.transform||getComputedStyle(r).transform||c.forwardState.transform:null;e.style.transformOrigin=u.forwardState.origin,r&&c&&(r.style.transformOrigin=c.forwardState.origin);let v=ye(i),y=s.timeline({onComplete:()=>{z(t,a),C(e,h),r&&d&&O(r,d),f()}}),g=(o.stagger||0)/1e3;s.set(e,{transform:m}),r&&p&&s.set(r,{transform:p}),y.fromTo(t,{transform:l.forwardState.transform},{transform:l.backwardState.transform,duration:n,ease:v},0),y.fromTo(e,{transform:m},{transform:h.transform,duration:n,ease:v},g),r&&d&&y.fromTo(r,{transform:p},{transform:d.transform,duration:n,ease:v},g*2)}function Et(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function ye(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 we(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:f,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let c=St(f);r==="lateral"?H(s,t):r==="zoomIn"?Je(e,o,n,i,a,c,l,t):r==="zoomOut"?ts(e,o,n,i,a,c,l,u,t):t()}function Je(s,t,e,r,o,n,i,a){L(t,e,r);let f=ge(t,e,r,o,"forward");be(f,0);let l=o.stagger||0,u=l/1e3,c=n*1e3,h=n+(f.length>2?u*2:u);s(0,1,{duration:h,ease:Ee(i),onUpdate:m=>{let p=m*h*1e3;Se(f,p,c,l)}}).then(()=>{E(t,o),E(e,o),r&&E(r,o),a()}).catch(()=>a())}function ts(s,t,e,r,o,n,i,a,f){let l=o.views[1],u=r&&o.views[2]?o.views[2]:null,c=l.backwardState,h=u?u.backwardState:null,d=ge(t,e,r,o,"backward");be(d,0);let m=o.stagger||0,p=m/1e3,v=n*1e3,y=n+(d.length>2?p*2:p);s(0,1,{duration:y,ease:Ee(i),onUpdate:w=>{let b=w*y*1e3;Se(d,b,v,m)}}).then(()=>{z(t,a),C(e,c),r&&h&&O(r,h),f()}).catch(()=>f())}function ge(s,t,e,r,o){let n=r.views[0],i=r.views[1],a=e&&r.views[2]?r.views[2]:null,f=[{el:s,backward:n.backwardState,forward:n.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&f.push({el:e,backward:a.backwardState,forward:a.forwardState}),f.map(({el:l,backward:u,forward:c})=>o==="forward"?{el:l,from:$(l,u.origin,u.transform),to:$(l,u.origin,c.transform)}:{el:l,from:$(l,c.origin,c.transform),to:$(l,c.origin,u.transform)})}function be(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=rt(ot(r,o,t))}function Se(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],f=o*r,l=Math.max(0,t-f),u=e>0?Math.min(1,l/e):1;n.style.transform=rt(ot(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 Ee(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 _e={css:le,waapi:fe,none:ce,anime:ue,gsap:ve,motion:we};function xe(s){if(typeof s=="function")return{runTransition(r,o){s(r,o)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:_e[t]||_e.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 At(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 Pt(s,t,e){let r=rs(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function It(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 m=d.views;if(Array.isArray(m))for(let p=0;p<m.length;p++){let v=m[p];!v||v.detachedNode||(v.backwardState&&(v.backwardState.transform=At(v.backwardState.transform,n,i),v.backwardState.origin!=null&&(v.backwardState.origin=Pt(v.backwardState.origin,n,i))),v.forwardState&&(v.forwardState.transform=At(v.forwardState.transform,n,i),v.forwardState.origin!=null&&(v.forwardState.origin=Pt(v.forwardState.origin,n,i))))}}let a=s.canvas,f=a.querySelector(".is-current-view"),l=a.querySelector(".is-previous-view"),u=a.querySelector(".is-last-view"),c=a.querySelector(".is-new-current-view"),h=[f,l,u,c].filter(Boolean);for(let d of h){if(!d.style)continue;let m=d.style.transform;m!=null&&m!==""&&(d.style.transform=At(m,n,i));let p=d.style.transformOrigin;p!=null&&p!==""&&(d.style.transformOrigin=Pt(p,n,i))}}var os=8e3,ut=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=[],Ut(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=xe(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 bt(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)}_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 k(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}It(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)&&It(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.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),f={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,f)}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 at(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;this._removeNav(),this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let r=this.canvas,o=e.el,n=r.getBoundingClientRect(),i=n.left,a=n.top,l=(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??{}},c=o?.dataset?.deferred!==void 0?!0:this.deferred,h,d=null;if(c){let _=await this.prefetcher.get(t,u);if(this._destroyed)return;for(d=document.createDocumentFragment();_.firstChild;)d.appendChild(_.firstChild);h=await at(_,t,r,!1,{},this.componentContext)}else{let _=await this.prefetcher.get(t,u);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(_,u),h=await at(_,t,r,!1,this.views,this.componentContext)}if(!h)return;c||this._emit("viewMounted",{viewName:t,node:h}),o&&o.classList.add("zoomed");let m=o?(()=>{let _=o.getBoundingClientRect();return{x:_.x,y:_.y,width:_.width,height:_.height}})():e.rect,p=o?o.dataset.withDuration||this.duration:e.duration??this.duration,v=o?o.dataset.withEase||this.ease:e.ease??this.ease,y=o?o.dataset.withCover||this.cover:e.cover??this.cover,g=o?parseInt(o.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),T=r.querySelector(".is-last-view");et(h),et(w),et(b),T&&(et(T),r.removeChild(T));let M,q,nt,x,A,D,I,ze=w.style.transform,$t=w.style.transformOrigin,ke=b?b.style.transform:null,Nt=b?b.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let _=h.getBoundingClientRect(),B=w.getBoundingClientRect(),Lt=null,Mt=null,dt=null;b&&(Lt=b.getBoundingClientRect(),dt=b.querySelector(".zoomed"),Mt=dt&&dt.getBoundingClientRect?dt.getBoundingClientRect():Lt);let mt={left:i,top:a},Ft={width:n.width,height:n.height},Dt={width:_.width,height:_.height},Ht=Wt(m.width,m.height,_.width,_.height,y);I=Ht.scale;let $e=Ht.scaleInv;M=Kt(m,mt,Dt,$e),nt=w.style.transform;let jt=Qt(m,B);x=Jt(Ft,m,B,I,this.parallax);let Rt=yt($t||"0 0"),Y=lt(nt||""),qt=yt(jt),U=lt(x.transform),Bt=m;if(o&&(Bt=wt(m,B,Rt,Y.tx,Y.ty,Y.scale,qt,U.tx,U.ty,U.scale)),q=Gt(Bt,mt,Dt),b){A=b.style.transform;let Ne=wt(B,B,Rt,Y.tx,Y.ty,Y.scale,qt,U.tx,U.ty,U.scale),Me=ee(x.x,x.y,mt,I,l),Vt=yt(Nt||"0 0"),Tt=lt(A||""),zt=lt(Me),Fe=wt(Mt,Lt,Vt,Tt.tx,Tt.ty,Tt.scale,Vt,zt.tx,zt.ty,zt.scale);D=te({canvasRect:Ft,canvasOffset:mt,triggerRect:m,previousViewRectAtBaseTransform:B,lastViewZoomedElementRect:Fe,previousViewRectWithPreviousAtEndTransform:Ne,scale:I,preScale:l,parallax:this.parallax})}h.style.transform=M,w.style.transformOrigin=jt}catch(_){this.notify(`zoomIn geometry computation failed: ${_.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",_),w.style.transform=ze,w.style.transformOrigin=$t,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=ke,b.style.transformOrigin=Nt,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(h)}catch{}X(w),X(b);return}let Ce=ct(h.dataset.viewName,{origin:h.style.transformOrigin,duration:p,ease:v,transform:M},{origin:h.style.transformOrigin,duration:p,ease:v,transform:q}),Oe=ct(w.dataset.viewName,{origin:w.style.transformOrigin,duration:p,ease:v,transform:nt},{origin:w.style.transformOrigin,duration:p,ease:v,transform:x.transform}),Ae=b?ct(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:v,transform:A},{origin:b.style.transformOrigin,duration:p,ease:v,transform:D}):null,Pe=T?se(T):null,ht=re(this.storedViews.length,Ce,Oe,Ae,Pe);ht.scale=I,ht.stagger=g||0,this.storeViews(ht),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let Ie=this._resolveEffects(o);this._applyEffects(w,b,Ie,p,v);let xt=this._resolveHideTrigger(o);this._applyHideTrigger(o,h,xt,p,v),xt&&(ht.hideTriggerMode=xt),this._setBlockEvents();let Ze={type:"zoomIn",currentView:h,previousView:w,lastView:b,currentStage:this.currentStage,duration:p,ease:v};this.transitionDriver.runTransition(Ze,async()=>{c&&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||(this._removeNav(),!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,f=r.ease??this.ease,l=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),c=0,h=0;if(l){let x=l.querySelector(`.zoom-me[data-to="${n}"]`),A=l.querySelector(`.zoom-me[data-to="${t}"]`);if(x&&A){let D=x.getBoundingClientRect(),I=A.getBoundingClientRect();c=D.left+D.width/2-(I.left+I.width/2),h=D.top+D.height/2-(I.top+I.height/2)}else c=this.canvas.getBoundingClientRect().width*.15}let d=null,m=null;if(i&&(e&&r.keepAliveNode?m=r.keepAliveNode:m=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),m){if(m.style.display="",m.style.opacity="",m.classList.remove("is-lateral-hidden","zoom-lateral-out"),m.classList.add("is-new-current-view","has-no-events"),d=m,!e&&this.lateralHistory){let x=this.lateralHistory.findIndex(A=>A.node===m);x!==-1&&this.lateralHistory.splice(x,1)}}else{let x={target:document.createElement("div"),context:this.componentContext,props:r.props??{}},A=await this.prefetcher.get(t,x);if(this._destroyed||(this.prefetcher.scanAndPrefetch(A,x),d=await at(A,t,this.canvas,!1,this.views,this.componentContext),!d))return;this._emit("viewMounted",{viewName:t,node:d})}et(d);let p=o.style.transform||"",v=o.style.transformOrigin||"0 0";d.style.transform=p,d.style.transformOrigin=v;let y=this.storedViews[this.storedViews.length-1],g=e&&r.savedEntry?{...r.savedEntry,viewName:t}:ct(t,{origin:v,duration:a,ease:f,transform:p},{origin:v,duration:a,ease:f,transform:p});y.views[0]=g,this.currentStage=y;let w=l?{transformStart:l.style.transform||"",transformEnd:this._computeLateralBackTransform(l.style.transform||"",c,h)}:null,b=u&&y.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",c*.7,h*.7)}:null;w&&y.views[1]&&(y.views[1].forwardState={...y.views[1].forwardState,transform:w.transformEnd}),b&&y.views[2]&&(y.views[2].forwardState={...y.views[2].forwardState,transform:b.transformEnd});let T=p,M=this._computeLateralBackTransform(T,-c,-h),q=this._computeLateralBackTransform(p,c,h);this._setBlockEvents();let nt={type:"lateral",currentView:d,previousView:o,lastView:u||null,backView:l||null,backViewState:w,lastViewState:b,incomingTransformStart:M,incomingTransformEnd:T,outgoingTransform:p,outgoingTransformEnd:q,currentStage:this.currentStage,duration:a,ease:f,canvas:this.canvas,slideDeltaX:c,slideDeltaY:h,keepAlive:i&&!e?i:!1};this.transitionDriver.runTransition(nt,()=>{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=p,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;this._removeNav(),this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas,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 f=this.currentStage.hideTriggerMode;f&&a&&this._restoreHideTrigger(a,f,n,i),f==="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 l=oe(this.currentStage);if(l){t.prepend(l);let c=t.querySelector(".z-view:first-child");c&&(X(c),c.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._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")}),this.storedViews.pop()}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-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 f=a.getBoundingClientRect();if(t>=f.left&&t<=f.right&&e>=f.top&&e<=f.bottom)return a}return null}_getSiblings(){let t=this.canvas.querySelector(".is-previous-view");if(!t)return{siblings:[],currentIndex:-1};let r=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,o=t.querySelectorAll(".zoom-me[data-to]"),n=[];for(let a of o)a.dataset.to&&n.push(a.dataset.to);let i=n.indexOf(r);return{siblings:n,currentIndex:i}}_updateNav(){if(this._destroyed)return;this._removeNav();let t=this.storedViews.length-1,e=this.depthNav&&t>=1,r=this.lateralNav,o=null;if(r&&(o=this._getSiblings(),o.siblings.length<2&&(o=null),o&&this.lateralNav.mode==="auto"&&t>=1)){let i=this.canvas.querySelector(".z-view.is-current-view");i&&i.offsetWidth>=this.canvas.offsetWidth&&i.offsetHeight>=this.canvas.offsetHeight&&(o=null)}if(!e&&!o)return;let n=document.createElement("div");if(n.className="z-nav z-nav--"+this.navPosition,e){let i=document.createElement("div");if(i.className="z-nav-depth",this.depthNav.button!==!1){let a=document.createElement("button");a.className="z-nav-back",a.setAttribute("aria-label","Zoom out (go back)"),a.innerHTML="&#8249;",a.addEventListener("mouseup",f=>{f.stopPropagation(),!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),i.appendChild(a)}if(this.depthNav.indicator){let a=document.createElement("div");a.className="z-nav-depth-dots";for(let f=0;f<=t;f++){let l=document.createElement("span");l.className="z-nav-dot"+(f===t?" is-active":""),a.appendChild(l)}i.appendChild(a)}n.appendChild(i)}if(e&&o){let i=document.createElement("div");i.className="z-nav-sep",n.appendChild(i)}if(o){let{siblings:i,currentIndex:a}=o,f=document.createElement("div");if(f.className="z-nav-lateral",this.lateralNav.arrows){let l=document.createElement("button");l.className="z-nav-arrow z-nav-prev",l.setAttribute("aria-label","Previous sibling view"),l.innerHTML="&#8249;",l.disabled=a<=0,l.addEventListener("mouseup",u=>{u.stopPropagation(),a>0&&this._doLateral(i[a-1])}),f.appendChild(l)}if(this.lateralNav.dots){let l=document.createElement("div");l.className="z-nav-lateral-dots";for(let u=0;u<i.length;u++){let c=document.createElement("button");c.className="z-nav-dot z-nav-lat-dot"+(u===a?" is-active":""),c.setAttribute("aria-label",`Go to ${i[u]}`),c.dataset.to=i[u],c.addEventListener("mouseup",(h=>d=>{d.stopPropagation(),h!==a&&this._doLateral(i[h])})(u)),l.appendChild(c)}f.appendChild(l)}if(this.lateralNav.arrows){let l=document.createElement("button");l.className="z-nav-arrow z-nav-next",l.setAttribute("aria-label","Next sibling view"),l.innerHTML="&#8250;",l.disabled=a>=i.length-1,l.addEventListener("mouseup",u=>{u.stopPropagation(),a<i.length-1&&this._doLateral(i[a+1])}),f.appendChild(l)}n.appendChild(f)}this.canvas.appendChild(n)}_removeNav(){this.canvas&&this.canvas.querySelectorAll(".z-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")),o&&!this.blockEvents&&t.target.classList.contains("zoom-me")&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(t.target)),o&&this.storedViews.length>1&&!this.blockEvents&&!t.target.classList.contains("zoom-me")&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}};var ns={separator:"/",prefix:"/"};function Le(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 Te={install(s,t){let e=Object.assign({},ns,t),r=e.separator,o=e.prefix,n=!1;function i(u){if(n)return;let c=Le(s,r),h="#"+o+c;window.location.hash!==h&&(n=!0,window.history[u](null,"",h),n=!1)}function a(){i("pushState")}function f(){i("replaceState")}s.on("afterZoomIn",a),s.on("afterLateral",a),s.on("afterZoomOut",f);function l(){if(n)return;n=!0;let u=is(o,r),c=Le(s,r).split(r).filter(Boolean);if(u.join(r)===c.join(r)){n=!1;return}if(u.length<c.length){let h=c.length-u.length;for(let d=0;d<h;d++)s.zoomOut()}else if(u.length===c.length&&u.length>0){let h=u[u.length-1];h!==c[c.length-1]&&s.goTo(h,{mode:"lateral"})}else u.length>c.length&&window.history.back();n=!1}window.addEventListener("popstate",l),f(),s.on("destroy",function(){s.off("afterZoomIn",a),s.off("afterLateral",a),s.off("afterZoomOut",f),window.removeEventListener("popstate",l)})}};ut.Router=Te;window.Zumly=ut;
7
+ var Xt=s=>{throw TypeError(s)};var kt=(s,t,e)=>t.has(s)||Xt("Cannot "+e);var S=(s,t,e)=>(kt(s,t,"read from private field"),e?e.call(s):t.get(s)),P=(s,t,e)=>t.has(s)?Xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),W=(s,t,e,r)=>(kt(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),it=(s,t,e)=>(kt(s,t,"access private method"),e);var K,vt,Yt,pt=class{constructor(t={}){P(this,vt);P(this,K,{});W(this,K,t)}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(S(this,K),t)){let o=S(this,K)[t];return this.resolve(o,e)}switch(it(this,vt,Yt).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(),c=document.createElement("div");c.innerHTML=a.trim();let l=c.firstElementChild;if(!l)throw new Error("Zumly: view produced no element (url)");return l}case"function":{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")}}};K=new WeakMap,vt=new WeakSet,Yt=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 at(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 k(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 Ut(s,t){if(t.isValid=!1,!s||typeof s!="object"){k(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){k(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){k(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){k(!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&&k(!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&&k(!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&&k(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let c=e&&e.driver,l=typeof c=="string"?c.toLowerCase():null,u=typeof c=="function"?c:null;if(l!==null){let y=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=y.includes(l)?l:"css",y.includes(l)||k(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${c}". 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&&k(!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,g=y==="auto"||y==="always";y&&!g&&k(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn"),t.lateralNav={mode:g?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}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1};let m=s.depthNav;if(m===!1)t.depthNav=!1;else if(m&&typeof m=="object"){let y=typeof m.position=="string"?m.position.toLowerCase():null,g=y==="bottom-left"||y==="top-left";y&&!g&&k(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:g?y:"bottom-left"}}else t.depthNav={position:"bottom-left"};let p=s.lateralNav&&typeof s.lateralNav=="object"?s.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let y=p==="bottom-center"||p==="top-center";p&&!y&&k(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=y?p:"bottom-center"}let v=s.inputs;v&&typeof v=="object"?t.inputs={wheel:typeof v.wheel=="boolean"?v.wheel:!0,keyboard:typeof v.keyboard=="boolean"?v.keyboard:!0,click:typeof v.click=="boolean"?v.click:!0,touch:typeof v.touch=="boolean"?v.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function Wt(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 Kt(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 Gt(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 Qt(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 Jt(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,c=n*a,l=i*a;return{x:n,y:i,transform:`translate(${c}px, ${l}px) scale(${r})`}}function te({canvasRect:s,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:r,lastViewZoomedElementRect:o,previousViewRectWithPreviousAtEndTransform:n,scale:i,preScale:a,parallax:c=0}){let l=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-l+(n.width-o.width)/2,m=h+(r.y-o.y)+n.y-u+(n.height-o.height)/2,p=1-Math.min(c*2,.9);return`translate(${d*p}px, ${m*p}px) scale(${i*a})`}function ee(s,t,e,r,o){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*o})`}function yt(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function lt(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 wt(s,t,e,r,o,n,i,a,c,l){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,m=u+e.x+(s.x-u-e.x-r)/n,p=f+e.y+(s.y-f-e.y-o)/n,v=s.width/n,y=s.height/n,g=u+i.x+a+l*(m-u-i.x),w=f+i.y+c+l*(p-f-i.y),b=v*l,T=y*l;return{x:g,y:w,width:b,height:T,left:g,top:w,right:g+b,bottom:w+T}}function ct(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function se(s){return{detachedNode:s}}function re(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 oe(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var Z,gt=class{constructor(){P(this,Z,new Map)}set(t,e,r=null){S(this,Z).set(t,{node:e,expires:r?Date.now()+r:null})}get(t){let e=S(this,Z).get(t);return e?e.expires!==null&&Date.now()>e.expires?(S(this,Z).delete(t),null):e.node.cloneNode(!0):null}has(t){let e=S(this,Z).get(t);return e?e.expires!==null&&Date.now()>e.expires?(S(this,Z).delete(t),!1):!0:!1}invalidate(t){S(this,Z).delete(t)}clear(){S(this,Z).clear()}};Z=new WeakMap;var De=300*1e3,He=/^https?:\/\/|^\/|\.html$|\.php$/i,G,Q,J,V,tt,ne,ie,bt=class{constructor(t={}){P(this,tt);P(this,G);P(this,Q);P(this,J);P(this,V,new Map);W(this,J,t),W(this,G,new pt(t)),W(this,Q,new gt)}async get(t,e=null){if(it(this,tt,ne).call(this,t)){let r=S(this,Q).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,G).resolve(t,e),i=S(this,J)[t],a=it(this,tt,ie).call(this,i);return S(this,Q).set(t,n,a),S(this,V).delete(t),n})();return S(this,V).set(t,o),o}return S(this,G).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))})}};G=new WeakMap,Q=new WeakMap,J=new WeakMap,V=new WeakMap,tt=new WeakSet,ne=function(t){return typeof S(this,J)[t]=="string"},ie=function(t){return He.test(t)?De:null};function et(s){s&&(s.style.contentVisibility="hidden")}function X(s){s&&(s.style.contentVisibility="visible")}function F(s){if(typeof s=="number"&&!Number.isNaN(s))return Math.max(0,s);let e=String(s).match(/^(\d+(?:\.\d+)?)\s*(ms|s)?$/i);if(!e)return 500;let r=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,r):Math.max(0,r*1e3)}function St(s){return F(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 C(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 O(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 L(...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:c,currentStage:l,canvas:u}=s,f=l.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=f.forwardState.origin,e.style.transform=c||f.forwardState.transform,o&&n&&(o.style.transform=n.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||z(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 ae(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function je(s){if(!s||s==="none")return ae();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}:ae()}function rt(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function st(s,t,e){return s+(t-s)*e}function ot(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:st(s.a,t.a,r),b:st(s.b,t.b,r),c:st(s.c,t.c,r),d:st(s.d,t.d,r),e:st(s.e,t.e,r),f:st(s.f,t.f,r)}}function $(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return je(getComputedStyle(s).transform)}function le(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:c,canvas:l}=s;if(!r||!o||!i){t();return}e==="lateral"?Re(s,t):e==="zoomIn"?qe(r,o,n,i,a,c,t):e==="zoomOut"?Be(r,o,n,i,a,c,l,t):t()}function Re(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformStart:c,incomingTransformEnd:l,outgoingTransform:u,outgoingTransformEnd:f,currentStage:h,duration:d,ease:m,canvas:p}=s,v=F(d),y=h.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=y.forwardState.origin,o&&n&&(N(o,d,m,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),o.classList.add("zoom-lateral-back")),i&&a&&(N(i,d,m,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(N(r,d,m,{"--lateral-out-from":u,"--lateral-out-to":f}),r.classList.add("zoom-lateral-out")),N(e,d,m,{"--lateral-in-from":c,"--lateral-in-to":l}),e.classList.add("zoom-lateral-in");let g=s.keepAlive==="visible"?[e]:[r,e];o&&n&&g.push(o),i&&a&&g.push(i);let w=g.length,{finish:b}=R(()=>{Ct(g,T),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):z(r,p),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=l,t()},v+j);function T(M){let q=M?.target;q&&q.removeEventListener("animationend",T),w--,w<=0&&b()}g.forEach(M=>M.addEventListener("animationend",T))}function qe(s,t,e,r,o,n,i){L(s,t,e);let a=r.stagger||0;N(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"),N(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&&(N(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 c=e?[s,t,e]:[s,t],l=c.length,u=F(o),f=e?a*2:a,{finish:h}=R(()=>{Ct(c,d),c.forEach(m=>m.style.removeProperty("animation-delay")),i()},u+f+j);function d(m){let p=m?.target;if(p&&p.removeEventListener("animationend",d),p?.isConnected)try{E(p,r)}catch{}l--,l<=0&&h()}c.forEach(m=>m.addEventListener("animationend",d))}function Be(s,t,e,r,o,n,i,a){let c=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,f=r.stagger||0;N(s,o,n,{"--current-view-transform-start":c.backwardState.transform,"--current-view-transform-end":c.forwardState.transform}),f>0&&s.style.setProperty("animation-delay","0ms"),N(t,o,n,{"--previous-view-transform-start":l.backwardState.transform,"--previous-view-transform-end":l.forwardState.transform}),f>0&&t.style.setProperty("animation-delay",`${f}ms`),e&&u&&(N(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,m=F(o),p=e?f*2:f,{finish:v}=R(()=>{Ct(h,y),h.forEach(g=>g.style.removeProperty("animation-delay")),a()},m+p+j);function y(g){let w=g?.target;if(w&&w.removeEventListener("animationend",y),w?.isConnected)try{Ve(w,r,i)}catch{}d--,d<=0&&v()}h.forEach(g=>g.addEventListener("animationend",y))}function Ve(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){z(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){C(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&O(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[o,n]of Object.entries(r))s.style.setProperty(o,n)}function Ct(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function ce(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"){L(r,o,n),E(r,i),E(o,i),n&&E(n,i),t();return}if(e==="zoomOut"){z(r,a),L(o,n),C(o,i.views[1].backwardState),n&&O(n,i.views[2].backwardState),t();return}t()}function fe(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:c,canvas:l}=s;if(!r||!o||!i){t();return}let u=F(a);if(e==="lateral"){Ue(s,u,c,t);return}if(e==="zoomIn"){Xe(r,o,n,i,u,c,t);return}if(e==="zoomOut"){Ye(r,o,n,i,u,c,l,t);return}t()}function Xe(s,t,e,r,o,n,i){L(s,t,e);let a=r.views[0],c=r.views[1],l=e&&r.views[2]?r.views[2]:null;s.style.transformOrigin=a.backwardState.origin,s.style.transform=a.backwardState.transform,t.style.transformOrigin=c.backwardState.origin,t.style.transform=c.backwardState.transform,l&&(e.style.transformOrigin=l.backwardState.origin,e.style.transform=l.backwardState.transform);let 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:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:o,delay:u,easing:n,fill:"forwards"})),l&&f.push(e.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:o,delay:u*2,easing:n,fill:"forwards"}));let h=l?u*2:u,{finish:d}=R(()=>{Ot(f);try{E(s,r),E(t,r),e&&E(e,r)}catch{}i()},o+h+j);Promise.all(f.map(m=>m.finished)).then(d).catch(d)}function Ye(s,t,e,r,o,n,i,a){let c=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,f=l.backwardState,h=u?u.backwardState:null;s.style.transformOrigin=c.forwardState.origin,s.style.transform=c.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=l.forwardState.origin,e&&u&&(e.style.transformOrigin=u.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||l.forwardState.transform,m=e&&u?e.style.transform||getComputedStyle(e).transform||u.forwardState.transform:null,p=r.stagger||0,v=[];v.push(s.animate([{transform:c.forwardState.transform},{transform:c.backwardState.transform}],{duration:o,easing:n,fill:"forwards"})),v.push(t.animate([{transform:d},{transform:f.transform}],{duration:o,delay:p,easing:n,fill:"both"})),e&&h&&v.push(e.animate([{transform:m},{transform:h.transform}],{duration:o,delay:p*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&h?p*2:p,{finish:g}=R(()=>{Ot(v);try{z(s,i),C(t,f),e&&h&&O(e,h)}catch{}a()},o+y+j);Promise.all(v.map(w=>w.finished)).then(g).catch(g)})})}function Ue(s,t,e,r){let{currentView:o,previousView:n,backView:i,backViewState:a,lastView:c,lastViewState:l,incomingTransformStart:u,incomingTransformEnd:f,outgoingTransform:h,outgoingTransformEnd:d,currentStage:m,canvas:p}=s,v=m.views[0];L(o),o.classList.replace("is-new-current-view","is-current-view"),o.classList.remove("zoom-current-view","has-no-events"),o.style.transformOrigin=v.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"})),c&&l&&y.push(c.animate([{transform:l.transformStart},{transform:l.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:g}=R(()=>{Ot(y),o.style.transform=f||v.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),c&&l&&(c.style.transform=l.transformEnd),s.keepAlive?(n.style.opacity="",n.style.transform=d):z(n,p),r()},t+j);Promise.all(y.map(w=>w.finished)).then(g).catch(g)}function Ot(s){for(let t of s)try{t.cancel()}catch{}}function ue(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:c,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let f=F(c);r==="lateral"?H(s,t):r==="zoomIn"?We(e,o,n,i,a,f,l,t):r==="zoomOut"?Ke(e,o,n,i,a,f,l,u,t):t()}function We(s,t,e,r,o,n,i,a){L(t,e,r);let c=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null,f=he([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:l.backwardState,forward:l.forwardState},...u?[{el:r,backward:u.backwardState,forward:u.forwardState}]:[]],"forward");de(f,0);let h=o.stagger||0,d=n+(u?h*2:h),m={value:0};s({targets:m,value:1,duration:d,easing:pe(i),update:()=>{let p=m.value*d;me(f,p,n,h)},complete:()=>{E(t,o),E(e,o),r&&E(r,o),a()}})}function Ke(s,t,e,r,o,n,i,a,c){let l=o.views[0],u=o.views[1],f=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null,m=he([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:u.backwardState,forward:u.forwardState},...f?[{el:r,backward:f.backwardState,forward:f.forwardState}]:[]],"backward");de(m,0);let p=o.stagger||0,v=n+(f?p*2:p),y={value:0};s({targets:y,value:1,duration:v,easing:pe(i),update:()=>{let g=y.value*v;me(m,g,n,p)},complete:()=>{z(t,a),C(e,h),r&&d&&O(r,d),c()}})}function he(s,t){return s.map(({el:e,backward:r,forward:o})=>{if(t==="forward"){let n=$(e,r.origin,r.transform),i=$(e,r.origin,o.transform);return{el:e,from:n,to:i}}else{let n=$(e,o.origin,o.transform),i=$(e,o.origin,r.transform);return{el:e,from:n,to:i}}})}function de(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=rt(ot(r,o,t))}function me(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],c=o*r,l=Math.max(0,t-c),u=e>0?Math.min(1,l/e):1;n.style.transform=rt(ot(i,a,u))}}function pe(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 ve(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:c,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let f=St(c);r==="lateral"?H(s,t):r==="zoomIn"?Ge(e,o,n,i,a,f,l,t):r==="zoomOut"?Qe(e,o,n,i,a,f,l,u,t):t()}function Ge(s,t,e,r,o,n,i,a){L(t,e,r);let c=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null;Et(t,c.backwardState),Et(e,l.backwardState),u&&Et(r,u.backwardState);let f=s.timeline({onComplete:()=>{E(t,o),E(e,o),r&&E(r,o),a()}}),h=ye(i),d=(o.stagger||0)/1e3;f.to(t,{transform:c.forwardState.transform,duration:n,ease:h},0),f.to(e,{transform:l.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,c){let l=o.views[0],u=o.views[1],f=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null;Et(t,l.forwardState);let m=e.style.transform||getComputedStyle(e).transform||u.forwardState.transform,p=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 v=ye(i),y=s.timeline({onComplete:()=>{z(t,a),C(e,h),r&&d&&O(r,d),c()}}),g=(o.stagger||0)/1e3;s.set(e,{transform:m}),r&&p&&s.set(r,{transform:p}),y.fromTo(t,{transform:l.forwardState.transform},{transform:l.backwardState.transform,duration:n,ease:v},0),y.fromTo(e,{transform:m},{transform:h.transform,duration:n,ease:v},g),r&&d&&y.fromTo(r,{transform:p},{transform:d.transform,duration:n,ease:v},g*2)}function Et(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function ye(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 we(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:c,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let f=St(c);r==="lateral"?H(s,t):r==="zoomIn"?Je(e,o,n,i,a,f,l,t):r==="zoomOut"?ts(e,o,n,i,a,f,l,u,t):t()}function Je(s,t,e,r,o,n,i,a){L(t,e,r);let c=ge(t,e,r,o,"forward");be(c,0);let l=o.stagger||0,u=l/1e3,f=n*1e3,h=n+(c.length>2?u*2:u);s(0,1,{duration:h,ease:Ee(i),onUpdate:m=>{let p=m*h*1e3;Se(c,p,f,l)}}).then(()=>{E(t,o),E(e,o),r&&E(r,o),a()}).catch(()=>a())}function ts(s,t,e,r,o,n,i,a,c){let l=o.views[1],u=r&&o.views[2]?o.views[2]:null,f=l.backwardState,h=u?u.backwardState:null,d=ge(t,e,r,o,"backward");be(d,0);let m=o.stagger||0,p=m/1e3,v=n*1e3,y=n+(d.length>2?p*2:p);s(0,1,{duration:y,ease:Ee(i),onUpdate:w=>{let b=w*y*1e3;Se(d,b,v,m)}}).then(()=>{z(t,a),C(e,f),r&&h&&O(r,h),c()}).catch(()=>c())}function ge(s,t,e,r,o){let n=r.views[0],i=r.views[1],a=e&&r.views[2]?r.views[2]:null,c=[{el:s,backward:n.backwardState,forward:n.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&c.push({el:e,backward:a.backwardState,forward:a.forwardState}),c.map(({el:l,backward:u,forward:f})=>o==="forward"?{el:l,from:$(l,u.origin,u.transform),to:$(l,u.origin,f.transform)}:{el:l,from:$(l,f.origin,f.transform),to:$(l,f.origin,u.transform)})}function be(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=rt(ot(r,o,t))}function Se(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],c=o*r,l=Math.max(0,t-c),u=e>0?Math.min(1,l/e):1;n.style.transform=rt(ot(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 Ee(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 _e={css:le,waapi:fe,none:ce,anime:ue,gsap:ve,motion:we};function xe(s){if(typeof s=="function")return{runTransition(r,o){s(r,o)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:_e[t]||_e.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 At(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 Pt(s,t,e){let r=rs(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function It(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 m=d.views;if(Array.isArray(m))for(let p=0;p<m.length;p++){let v=m[p];!v||v.detachedNode||(v.backwardState&&(v.backwardState.transform=At(v.backwardState.transform,n,i),v.backwardState.origin!=null&&(v.backwardState.origin=Pt(v.backwardState.origin,n,i))),v.forwardState&&(v.forwardState.transform=At(v.forwardState.transform,n,i),v.forwardState.origin!=null&&(v.forwardState.origin=Pt(v.forwardState.origin,n,i))))}}let a=s.canvas,c=a.querySelector(".is-current-view"),l=a.querySelector(".is-previous-view"),u=a.querySelector(".is-last-view"),f=a.querySelector(".is-new-current-view"),h=[c,l,u,f].filter(Boolean);for(let d of h){if(!d.style)continue;let m=d.style.transform;m!=null&&m!==""&&(d.style.transform=At(m,n,i));let p=d.style.transformOrigin;p!=null&&p!==""&&(d.style.transformOrigin=Pt(p,n,i))}}var os=8e3,ut=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=[],Ut(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=xe(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 bt(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)}_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 k(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}It(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)&&It(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.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),c={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,c)}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 at(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;this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let r=this.canvas,o=e.el,n=r.getBoundingClientRect(),i=n.left,a=n.top,l=(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 at(_,t,r,!1,{},this.componentContext)}else{let _=await this.prefetcher.get(t,u);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(_,u),h=await at(_,t,r,!1,this.views,this.componentContext)}if(!h)return;f||this._emit("viewMounted",{viewName:t,node:h}),o&&o.classList.add("zoomed");let m=o?(()=>{let _=o.getBoundingClientRect();return{x:_.x,y:_.y,width:_.width,height:_.height}})():e.rect,p=o?o.dataset.withDuration||this.duration:e.duration??this.duration,v=o?o.dataset.withEase||this.ease:e.ease??this.ease,y=o?o.dataset.withCover||this.cover:e.cover??this.cover,g=o?parseInt(o.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),T=r.querySelector(".is-last-view");et(h),et(w),et(b),T&&(et(T),r.removeChild(T));let M,q,nt,x,A,D,I,ze=w.style.transform,$t=w.style.transformOrigin,ke=b?b.style.transform:null,Nt=b?b.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let _=h.getBoundingClientRect(),B=w.getBoundingClientRect(),Lt=null,Mt=null,dt=null;b&&(Lt=b.getBoundingClientRect(),dt=b.querySelector(".zoomed"),Mt=dt&&dt.getBoundingClientRect?dt.getBoundingClientRect():Lt);let mt={left:i,top:a},Ft={width:n.width,height:n.height},Dt={width:_.width,height:_.height},Ht=Wt(m.width,m.height,_.width,_.height,y);I=Ht.scale;let $e=Ht.scaleInv;M=Kt(m,mt,Dt,$e),nt=w.style.transform;let jt=Qt(m,B);x=Jt(Ft,m,B,I,this.parallax);let Rt=yt($t||"0 0"),Y=lt(nt||""),qt=yt(jt),U=lt(x.transform),Bt=m;if(o&&(Bt=wt(m,B,Rt,Y.tx,Y.ty,Y.scale,qt,U.tx,U.ty,U.scale)),q=Gt(Bt,mt,Dt),b){A=b.style.transform;let Ne=wt(B,B,Rt,Y.tx,Y.ty,Y.scale,qt,U.tx,U.ty,U.scale),Me=ee(x.x,x.y,mt,I,l),Vt=yt(Nt||"0 0"),Tt=lt(A||""),zt=lt(Me),Fe=wt(Mt,Lt,Vt,Tt.tx,Tt.ty,Tt.scale,Vt,zt.tx,zt.ty,zt.scale);D=te({canvasRect:Ft,canvasOffset:mt,triggerRect:m,previousViewRectAtBaseTransform:B,lastViewZoomedElementRect:Fe,previousViewRectWithPreviousAtEndTransform:Ne,scale:I,preScale:l,parallax:this.parallax})}h.style.transform=M,w.style.transformOrigin=jt}catch(_){this.notify(`zoomIn geometry computation failed: ${_.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",_),w.style.transform=ze,w.style.transformOrigin=$t,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=ke,b.style.transformOrigin=Nt,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(h)}catch{}X(w),X(b);return}let Ce=ct(h.dataset.viewName,{origin:h.style.transformOrigin,duration:p,ease:v,transform:M},{origin:h.style.transformOrigin,duration:p,ease:v,transform:q}),Oe=ct(w.dataset.viewName,{origin:w.style.transformOrigin,duration:p,ease:v,transform:nt},{origin:w.style.transformOrigin,duration:p,ease:v,transform:x.transform}),Ae=b?ct(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:v,transform:A},{origin:b.style.transformOrigin,duration:p,ease:v,transform:D}):null,Pe=T?se(T):null,ht=re(this.storedViews.length,Ce,Oe,Ae,Pe);ht.scale=I,ht.stagger=g||0,this.storeViews(ht),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let Ie=this._resolveEffects(o);this._applyEffects(w,b,Ie,p,v);let xt=this._resolveHideTrigger(o);this._applyHideTrigger(o,h,xt,p,v),xt&&(ht.hideTriggerMode=xt),this._setBlockEvents();let Ze={type:"zoomIn",currentView:h,previousView:w,lastView:b,currentStage:this.currentStage,duration:p,ease:v};this.transitionDriver.runTransition(Ze,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||!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,c=r.ease??this.ease,l=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),f=0,h=0;if(l){let x=l.querySelector(`.zoom-me[data-to="${n}"]`),A=l.querySelector(`.zoom-me[data-to="${t}"]`);if(x&&A){let D=x.getBoundingClientRect(),I=A.getBoundingClientRect();f=D.left+D.width/2-(I.left+I.width/2),h=D.top+D.height/2-(I.top+I.height/2)}else f=this.canvas.getBoundingClientRect().width*.15}let d=null,m=null;if(i&&(e&&r.keepAliveNode?m=r.keepAliveNode:m=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),m){if(m.style.display="",m.style.opacity="",m.classList.remove("is-lateral-hidden","zoom-lateral-out"),m.classList.add("is-new-current-view","has-no-events"),d=m,!e&&this.lateralHistory){let x=this.lateralHistory.findIndex(A=>A.node===m);x!==-1&&this.lateralHistory.splice(x,1)}}else{let x={target:document.createElement("div"),context:this.componentContext,props:r.props??{}},A=await this.prefetcher.get(t,x);if(this._destroyed||(this.prefetcher.scanAndPrefetch(A,x),d=await at(A,t,this.canvas,!1,this.views,this.componentContext),!d))return;this._emit("viewMounted",{viewName:t,node:d})}et(d);let p=o.style.transform||"",v=o.style.transformOrigin||"0 0";d.style.transform=p,d.style.transformOrigin=v;let y=this.storedViews[this.storedViews.length-1],g=e&&r.savedEntry?{...r.savedEntry,viewName:t}:ct(t,{origin:v,duration:a,ease:c,transform:p},{origin:v,duration:a,ease:c,transform:p});y.views[0]=g,this.currentStage=y;let w=l?{transformStart:l.style.transform||"",transformEnd:this._computeLateralBackTransform(l.style.transform||"",f,h)}:null,b=u&&y.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",f*.7,h*.7)}:null;w&&y.views[1]&&(y.views[1].forwardState={...y.views[1].forwardState,transform:w.transformEnd}),b&&y.views[2]&&(y.views[2].forwardState={...y.views[2].forwardState,transform:b.transformEnd});let T=p,M=this._computeLateralBackTransform(T,-f,-h),q=this._computeLateralBackTransform(p,f,h);this._setBlockEvents();let nt={type:"lateral",currentView:d,previousView:o,lastView:u||null,backView:l||null,backViewState:w,lastViewState:b,incomingTransformStart:M,incomingTransformEnd:T,outgoingTransform:p,outgoingTransformEnd:q,currentStage:this.currentStage,duration:a,ease:c,canvas:this.canvas,slideDeltaX:f,slideDeltaY:h,keepAlive:i&&!e?i:!1};this.transitionDriver.runTransition(nt,()=>{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=p,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;this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas,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 c=this.currentStage.hideTriggerMode;c&&a&&this._restoreHideTrigger(a,c,n,i),c==="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 l=oe(this.currentStage);if(l){t.prepend(l);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 c=a.getBoundingClientRect();if(t>=c.left&&t<=c.right&&e>=c.top&&e<=c.bottom)return a}return null}_getSiblings(){let t=this.canvas.querySelector(".is-previous-view");if(!t)return{siblings:[],currentIndex:-1};let r=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,o=t.querySelectorAll(".zoom-me[data-to]"),n=[];for(let a of o)a.dataset.to&&n.push(a.dataset.to);let i=n.indexOf(r);return{siblings:n,currentIndex:i}}_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="&#8249;",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="&#8249;",a.disabled=o<=0,a.addEventListener("mouseup",c=>{c.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 c=0;c<r.length;c++){let l=document.createElement("button");l.className="z-nav-dot z-nav-lat-dot"+(c===o?" is-active":""),l.setAttribute("aria-label",`Go to ${r[c]}`),l.dataset.to=r[c],l.addEventListener("mouseup",(u=>f=>{f.stopPropagation(),u!==o&&this._doLateral(r[u])})(c)),a.appendChild(l)}i.appendChild(a)}if(this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-next",a.setAttribute("aria-label","Next sibling view"),a.innerHTML="&#8250;",a.disabled=o>=r.length-1,a.addEventListener("mouseup",c=>{c.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 Le(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 Te={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=Le(s,r),h="#"+o+f;window.location.hash!==h&&(n=!0,window.history[u](null,"",h),n=!1)}function a(){i("pushState")}function c(){i("replaceState")}s.on("afterZoomIn",a),s.on("afterLateral",a),s.on("afterZoomOut",c);function l(){if(n)return;n=!0;let u=is(o,r),f=Le(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",l),c(),s.on("destroy",function(){s.off("afterZoomIn",a),s.off("afterLateral",a),s.off("afterZoomOut",c),window.removeEventListener("popstate",l)})}};ut.Router=Te;window.Zumly=ut;
@@ -1 +1 @@
1
- .zumly-canvas{position:absolute;width:100%;height:100%;overflow:hidden;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}.z-view{content-visibility:auto}.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-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-nav--bottom-center{bottom:20px;left:50%;transform:translate(-50%)}.z-nav--bottom-left{bottom:20px;left:20px}.z-nav--bottom-right{bottom:20px;right:20px}.z-nav--top-center{top:20px;left:50%;transform:translate(-50%)}.z-nav--top-left{top:20px;left:20px}.z-nav--top-right{top:20px;right:20px}.z-nav--middle-left{top:50%;left:16px;transform:translateY(-50%);flex-direction:column}.z-nav--middle-right{top:50%;right:16px;transform:translateY(-50%);flex-direction:column}.z-nav>*{pointer-events:auto}.z-nav-depth,.z-nav-lateral{display:flex;align-items:center;gap:8px}.z-nav-sep{width:1px;height:18px;background:#ffffff26;margin:0 8px;flex-shrink:0}.z-nav--middle-left .z-nav-depth,.z-nav--middle-left .z-nav-lateral,.z-nav--middle-right .z-nav-depth,.z-nav--middle-right .z-nav-lateral,.z-nav--middle-left .z-nav-depth-dots,.z-nav--middle-left .z-nav-lateral-dots,.z-nav--middle-right .z-nav-depth-dots,.z-nav--middle-right .z-nav-lateral-dots{flex-direction:column}.z-nav--middle-left .z-nav-sep,.z-nav--middle-right .z-nav-sep{width:18px;height:1px;margin:8px 0}.z-nav--middle-left .z-nav-back,.z-nav--middle-right .z-nav-back{transform:rotate(180deg)}.z-nav--middle-left .z-nav-prev,.z-nav--middle-right .z-nav-prev,.z-nav--middle-left .z-nav-next,.z-nav--middle-right .z-nav-next,.z-nav-back{transform:rotate(90deg)}.z-nav-back,.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-back:hover,.z-nav-arrow:hover:not(:disabled){background:#ffffff2e;border-color:#fff6}.z-nav-arrow:disabled{opacity:.2;cursor:default}.z-nav-depth-dots,.z-nav-lateral-dots{display:flex;align-items:center;gap:5px}.z-nav-dot{width:7px;height:7px;border-radius:50%;border:1px solid rgba(255,255,255,.3);background:#ffffff26;padding:0;cursor:default;transition:background .2s,transform .2s,border-color .2s}.z-nav-lat-dot{cursor:pointer}.z-nav-lat-dot:hover{background:#fff6}.z-nav-dot.is-active{background:#fff;border-color:#fff;transform:scale(1.35)}
1
+ .zumly-canvas{position:absolute;width:100%;height:100%;overflow:hidden;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}.z-view{content-visibility:auto}.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)}
package/dist/zumly.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * zumly
3
- * v.0.92.0
3
+ * v.0.92.2
4
4
  * Author Juan Martin Muda - Zumerlab
5
5
  * License MIT
6
6
  */
7
- var ot=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 o=this.#t[t];return this.resolve(o,e)}switch(this.#e(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(),f=document.createElement("div");f.innerHTML=a.trim();let l=f.firstElementChild;if(!l)throw new Error("Zumly: view produced no element (url)");return l}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")}}};async function K(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 z(s,t,e){t&&e==="welcome"&&console.info(`%c Zumly %c ${t}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),t&&s&&(e==="info"||e===void 0)&&console.info(`%c Zumly %c ${t}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),t&&e==="warn"&&console.warn(`%c Zumly %c ${t}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),t&&e==="error"&&console.error(`%c Zumly %c ${t}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function It(s,t){if(t.isValid=!1,!s||typeof s!="object"){z(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){z(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){z(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){z(!1,"'views' must be an object","error");return}t.views=s.views,t.isValid=!0,t.preload=Array.isArray(s.preload)?s.preload:[],t.debug=typeof s.debug=="boolean"?s.debug:!1,t.componentContext=s.componentContext&&typeof s.componentContext=="object"?s.componentContext:new Map;let e=s.transitions&&typeof s.transitions=="object"?s.transitions:null,r=e&&e.cover,o=typeof r=="string"?r.toLowerCase():null,n=o==="width"||o==="height";t.cover=n?o:"width",!n&&e&&r!==void 0&&z(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),t.duration=e&&typeof e.duration=="string"?e.duration:"1s",t.ease=e&&typeof e.ease=="string"?e.ease:"ease-in-out",t.deferred=typeof s.deferred=="boolean"?s.deferred:!1;let i=e&&e.hideTrigger;i===!0||i==="fade"?t.hideTrigger=i:(t.hideTrigger=!1,i!=null&&i!==!1&&z(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=e&&e.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?t.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?t.effects=[a[0],a[0]]:(t.effects=["none","none"],a!=null&&z(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let f=e&&e.driver,l=typeof f=="string"?f.toLowerCase():null,u=typeof f=="function"?f:null;if(l!==null){let g=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=g.includes(l)?l:"css",g.includes(l)||z(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${f}". Falling back to "css".`,"warn")}else u!==null?t.transitionDriver=u:t.transitionDriver="css";let c=e&&e.stagger;typeof c=="number"&&c>0?t.stagger=c:(t.stagger=0,c!=null&&c!==0&&z(!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 g=typeof d.mode=="string"?d.mode.toLowerCase():null,w=g==="auto"||g==="always";g&&!w&&z(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn"),t.lateralNav={mode:w?g:"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}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1};let m=s.depthNav;m===!1?t.depthNav=!1:m&&typeof m=="object"?t.depthNav={button:typeof m.button=="boolean"?m.button:!0,indicator:typeof m.indicator=="boolean"?m.indicator:!0}:t.depthNav={button:!0,indicator:!0};let p=s.navPosition,v=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right","middle-left","middle-right"];typeof p=="string"&&v.includes(p)?t.navPosition=p:(t.navPosition="bottom-center",p!=null&&z(!1,`'navPosition' must be one of: ${v.join(", ")}. Falling back to "bottom-center".`,"warn"));let y=s.inputs;y&&typeof y=="object"?t.inputs={wheel:typeof y.wheel=="boolean"?y.wheel:!0,keyboard:typeof y.keyboard=="boolean"?y.keyboard:!0,click:typeof y.click=="boolean"?y.click:!0,touch:typeof y.touch=="boolean"?y.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function Zt(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 $t(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 Nt(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 Mt(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 Ft(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,f=n*a,l=i*a;return{x:n,y:i,transform:`translate(${f}px, ${l}px) scale(${r})`}}function Dt({canvasRect:s,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:r,lastViewZoomedElementRect:o,previousViewRectWithPreviousAtEndTransform:n,scale:i,preScale:a,parallax:f=0}){let l=t.left,u=t.top,c=s.width/2-e.width/2-e.x,h=s.height/2-e.height/2-e.y,d=c+(r.x-o.x)+n.x-l+(n.width-o.width)/2,m=h+(r.y-o.y)+n.y-u+(n.height-o.height)/2,p=1-Math.min(f*2,.9);return`translate(${d*p}px, ${m*p}px) scale(${i*a})`}function Ht(s,t,e,r,o){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*o})`}function nt(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function G(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 it(s,t,e,r,o,n,i,a,f,l){let u=t.x-e.x*(1-n)-r,c=t.y-e.y*(1-n)-o,h=t.width/n,d=t.height/n,m=u+e.x+(s.x-u-e.x-r)/n,p=c+e.y+(s.y-c-e.y-o)/n,v=s.width/n,y=s.height/n,g=u+i.x+a+l*(m-u-i.x),w=c+i.y+f+l*(p-c-i.y),b=v*l,L=y*l;return{x:g,y:w,width:b,height:L,left:g,top:w,right:g+b,bottom:w+L}}function Q(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function jt(s){return{detachedNode:s}}function Rt(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 qt(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var at=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 Ee=300*1e3,_e=/^https?:\/\/|^\/|\.html$|\.php$/i,lt=class{#t;#e;#r;#s=new Map;constructor(t={}){this.#r=t,this.#t=new ot(t),this.#e=new at}#o(t){return typeof this.#r[t]=="string"}#n(t){return _e.test(t)?Ee:null}async get(t,e=null){if(this.#o(t)){let r=this.#e.get(t);if(r)return r;if(this.#s.has(t))return this.#s.get(t);let o=(async()=>{let n=await this.#t.resolve(t,e),i=this.#r[t],a=this.#n(i);return this.#e.set(t,n,a),this.#s.delete(t),n})();return this.#s.set(t,o),o}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(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))})}};function V(s){s&&(s.style.contentVisibility="hidden")}function R(s){s&&(s.style.contentVisibility="visible")}function $(s){if(typeof s=="number"&&!Number.isNaN(s))return Math.max(0,s);let e=String(s).match(/^(\d+(?:\.\d+)?)\s*(ms|s)?$/i);if(!e)return 500;let r=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,r):Math.max(0,r*1e3)}function ct(s){return $(s)/1e3}function S(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 k(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 C(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 T(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"),R(t))}function M(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformEnd:f,currentStage:l,canvas:u}=s,c=l.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=c.forwardState.origin,e.style.transform=f||c.forwardState.transform,o&&n&&(o.style.transform=n.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||T(r,u),t()}var F=150;function D(s,t){let e=!1,r=setTimeout(()=>{e||(e=!0,s())},t);return{finish(){e||(e=!0,clearTimeout(r),s())},safetyTimer:r}}function Bt(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function xe(s){if(!s||s==="none")return Bt();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}:Bt()}function Y(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function X(s,t,e){return s+(t-s)*e}function U(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:X(s.a,t.a,r),b:X(s.b,t.b,r),c:X(s.c,t.c,r),d:X(s.d,t.d,r),e:X(s.e,t.e,r),f:X(s.f,t.f,r)}}function P(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return xe(getComputedStyle(s).transform)}function Vt(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:f,canvas:l}=s;if(!r||!o||!i){t();return}e==="lateral"?Le(s,t):e==="zoomIn"?Te(r,o,n,i,a,f,t):e==="zoomOut"?ze(r,o,n,i,a,f,l,t):t()}function Le(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformStart:f,incomingTransformEnd:l,outgoingTransform:u,outgoingTransformEnd:c,currentStage:h,duration:d,ease:m,canvas:p}=s,v=$(d),y=h.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=y.forwardState.origin,o&&n&&(I(o,d,m,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),o.classList.add("zoom-lateral-back")),i&&a&&(I(i,d,m,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(I(r,d,m,{"--lateral-out-from":u,"--lateral-out-to":c}),r.classList.add("zoom-lateral-out")),I(e,d,m,{"--lateral-in-from":f,"--lateral-in-to":l}),e.classList.add("zoom-lateral-in");let g=s.keepAlive==="visible"?[e]:[r,e];o&&n&&g.push(o),i&&a&&g.push(i);let w=g.length,{finish:b}=D(()=>{vt(g,L),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):T(r,p),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=l,t()},v+F);function L(Z){let H=Z?.target;H&&H.removeEventListener("animationend",L),w--,w<=0&&b()}g.forEach(Z=>Z.addEventListener("animationend",L))}function Te(s,t,e,r,o,n,i){x(s,t,e);let a=r.stagger||0;I(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"),I(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&&(I(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 f=e?[s,t,e]:[s,t],l=f.length,u=$(o),c=e?a*2:a,{finish:h}=D(()=>{vt(f,d),f.forEach(m=>m.style.removeProperty("animation-delay")),i()},u+c+F);function d(m){let p=m?.target;if(p&&p.removeEventListener("animationend",d),p?.isConnected)try{S(p,r)}catch{}l--,l<=0&&h()}f.forEach(m=>m.addEventListener("animationend",d))}function ze(s,t,e,r,o,n,i,a){let f=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,c=r.stagger||0;I(s,o,n,{"--current-view-transform-start":f.backwardState.transform,"--current-view-transform-end":f.forwardState.transform}),c>0&&s.style.setProperty("animation-delay","0ms"),I(t,o,n,{"--previous-view-transform-start":l.backwardState.transform,"--previous-view-transform-end":l.forwardState.transform}),c>0&&t.style.setProperty("animation-delay",`${c}ms`),e&&u&&(I(e,o,n,{"--last-view-transform-start":u.backwardState.transform,"--last-view-transform-end":u.forwardState.transform}),c>0&&e.style.setProperty("animation-delay",`${c*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,m=$(o),p=e?c*2:c,{finish:v}=D(()=>{vt(h,y),h.forEach(g=>g.style.removeProperty("animation-delay")),a()},m+p+F);function y(g){let w=g?.target;if(w&&w.removeEventListener("animationend",y),w?.isConnected)try{ke(w,r,i)}catch{}d--,d<=0&&v()}h.forEach(g=>g.addEventListener("animationend",y))}function ke(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){T(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){k(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&C(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[o,n]of Object.entries(r))s.style.setProperty(o,n)}function vt(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function Xt(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"){M(s,t);return}if(e==="zoomIn"){x(r,o,n),S(r,i),S(o,i),n&&S(n,i),t();return}if(e==="zoomOut"){T(r,a),x(o,n),k(o,i.views[1].backwardState),n&&C(n,i.views[2].backwardState),t();return}t()}function Yt(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:f,canvas:l}=s;if(!r||!o||!i){t();return}let u=$(a);if(e==="lateral"){Ae(s,u,f,t);return}if(e==="zoomIn"){Ce(r,o,n,i,u,f,t);return}if(e==="zoomOut"){Oe(r,o,n,i,u,f,l,t);return}t()}function Ce(s,t,e,r,o,n,i){x(s,t,e);let a=r.views[0],f=r.views[1],l=e&&r.views[2]?r.views[2]:null;s.style.transformOrigin=a.backwardState.origin,s.style.transform=a.backwardState.transform,t.style.transformOrigin=f.backwardState.origin,t.style.transform=f.backwardState.transform,l&&(e.style.transformOrigin=l.backwardState.origin,e.style.transform=l.backwardState.transform);let u=r.stagger||0,c=[];c.push(s.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:o,easing:n,fill:"forwards"})),c.push(t.animate([{transform:f.backwardState.transform},{transform:f.forwardState.transform}],{duration:o,delay:u,easing:n,fill:"forwards"})),l&&c.push(e.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:o,delay:u*2,easing:n,fill:"forwards"}));let h=l?u*2:u,{finish:d}=D(()=>{yt(c);try{S(s,r),S(t,r),e&&S(e,r)}catch{}i()},o+h+F);Promise.all(c.map(m=>m.finished)).then(d).catch(d)}function Oe(s,t,e,r,o,n,i,a){let f=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,c=l.backwardState,h=u?u.backwardState:null;s.style.transformOrigin=f.forwardState.origin,s.style.transform=f.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=l.forwardState.origin,e&&u&&(e.style.transformOrigin=u.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||l.forwardState.transform,m=e&&u?e.style.transform||getComputedStyle(e).transform||u.forwardState.transform:null,p=r.stagger||0,v=[];v.push(s.animate([{transform:f.forwardState.transform},{transform:f.backwardState.transform}],{duration:o,easing:n,fill:"forwards"})),v.push(t.animate([{transform:d},{transform:c.transform}],{duration:o,delay:p,easing:n,fill:"both"})),e&&h&&v.push(e.animate([{transform:m},{transform:h.transform}],{duration:o,delay:p*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&h?p*2:p,{finish:g}=D(()=>{yt(v);try{T(s,i),k(t,c),e&&h&&C(e,h)}catch{}a()},o+y+F);Promise.all(v.map(w=>w.finished)).then(g).catch(g)})})}function Ae(s,t,e,r){let{currentView:o,previousView:n,backView:i,backViewState:a,lastView:f,lastViewState:l,incomingTransformStart:u,incomingTransformEnd:c,outgoingTransform:h,outgoingTransformEnd:d,currentStage:m,canvas:p}=s,v=m.views[0];x(o),o.classList.replace("is-new-current-view","is-current-view"),o.classList.remove("zoom-current-view","has-no-events"),o.style.transformOrigin=v.forwardState.origin;let y=[];y.push(o.animate([{transform:u,opacity:0},{transform:c,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"})),f&&l&&y.push(f.animate([{transform:l.transformStart},{transform:l.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:g}=D(()=>{yt(y),o.style.transform=c||v.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),f&&l&&(f.style.transform=l.transformEnd),s.keepAlive?(n.style.opacity="",n.style.transform=d):T(n,p),r()},t+F);Promise.all(y.map(w=>w.finished)).then(g).catch(g)}function yt(s){for(let t of s)try{t.cancel()}catch{}}function Ut(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:f,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let c=$(f);r==="lateral"?M(s,t):r==="zoomIn"?Pe(e,o,n,i,a,c,l,t):r==="zoomOut"?Ie(e,o,n,i,a,c,l,u,t):t()}function Pe(s,t,e,r,o,n,i,a){x(t,e,r);let f=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null,c=Wt([{el:t,backward:f.backwardState,forward:f.forwardState},{el:e,backward:l.backwardState,forward:l.forwardState},...u?[{el:r,backward:u.backwardState,forward:u.forwardState}]:[]],"forward");Kt(c,0);let h=o.stagger||0,d=n+(u?h*2:h),m={value:0};s({targets:m,value:1,duration:d,easing:Qt(i),update:()=>{let p=m.value*d;Gt(c,p,n,h)},complete:()=>{S(t,o),S(e,o),r&&S(r,o),a()}})}function Ie(s,t,e,r,o,n,i,a,f){let l=o.views[0],u=o.views[1],c=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=c?c.backwardState:null,m=Wt([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:u.backwardState,forward:u.forwardState},...c?[{el:r,backward:c.backwardState,forward:c.forwardState}]:[]],"backward");Kt(m,0);let p=o.stagger||0,v=n+(c?p*2:p),y={value:0};s({targets:y,value:1,duration:v,easing:Qt(i),update:()=>{let g=y.value*v;Gt(m,g,n,p)},complete:()=>{T(t,a),k(e,h),r&&d&&C(r,d),f()}})}function Wt(s,t){return s.map(({el:e,backward:r,forward:o})=>{if(t==="forward"){let n=P(e,r.origin,r.transform),i=P(e,r.origin,o.transform);return{el:e,from:n,to:i}}else{let n=P(e,o.origin,o.transform),i=P(e,o.origin,r.transform);return{el:e,from:n,to:i}}})}function Kt(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=Y(U(r,o,t))}function Gt(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],f=o*r,l=Math.max(0,t-f),u=e>0?Math.min(1,l/e):1;n.style.transform=Y(U(i,a,u))}}function Qt(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 Jt(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:f,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let c=ct(f);r==="lateral"?M(s,t):r==="zoomIn"?Ze(e,o,n,i,a,c,l,t):r==="zoomOut"?$e(e,o,n,i,a,c,l,u,t):t()}function Ze(s,t,e,r,o,n,i,a){x(t,e,r);let f=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null;ft(t,f.backwardState),ft(e,l.backwardState),u&&ft(r,u.backwardState);let c=s.timeline({onComplete:()=>{S(t,o),S(e,o),r&&S(r,o),a()}}),h=te(i),d=(o.stagger||0)/1e3;c.to(t,{transform:f.forwardState.transform,duration:n,ease:h},0),c.to(e,{transform:l.forwardState.transform,duration:n,ease:h},d),u&&c.to(r,{transform:u.forwardState.transform,duration:n,ease:h},d*2)}function $e(s,t,e,r,o,n,i,a,f){let l=o.views[0],u=o.views[1],c=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=c?c.backwardState:null;ft(t,l.forwardState);let m=e.style.transform||getComputedStyle(e).transform||u.forwardState.transform,p=r&&c?r.style.transform||getComputedStyle(r).transform||c.forwardState.transform:null;e.style.transformOrigin=u.forwardState.origin,r&&c&&(r.style.transformOrigin=c.forwardState.origin);let v=te(i),y=s.timeline({onComplete:()=>{T(t,a),k(e,h),r&&d&&C(r,d),f()}}),g=(o.stagger||0)/1e3;s.set(e,{transform:m}),r&&p&&s.set(r,{transform:p}),y.fromTo(t,{transform:l.forwardState.transform},{transform:l.backwardState.transform,duration:n,ease:v},0),y.fromTo(e,{transform:m},{transform:h.transform,duration:n,ease:v},g),r&&d&&y.fromTo(r,{transform:p},{transform:d.transform,duration:n,ease:v},g*2)}function ft(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function te(s){if(typeof s!="string")return"power2.inOut";let t=s.toLowerCase();return t==="linear"?"none":t.includes("ease-in-out")?"power2.inOut":t.includes("ease-in")?"power2.in":t.includes("ease-out")?"power2.out":t}function ee(s,t){let e=Fe();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:f,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let c=ct(f);r==="lateral"?M(s,t):r==="zoomIn"?Ne(e,o,n,i,a,c,l,t):r==="zoomOut"?Me(e,o,n,i,a,c,l,u,t):t()}function Ne(s,t,e,r,o,n,i,a){x(t,e,r);let f=se(t,e,r,o,"forward");re(f,0);let l=o.stagger||0,u=l/1e3,c=n*1e3,h=n+(f.length>2?u*2:u);s(0,1,{duration:h,ease:ne(i),onUpdate:m=>{let p=m*h*1e3;oe(f,p,c,l)}}).then(()=>{S(t,o),S(e,o),r&&S(r,o),a()}).catch(()=>a())}function Me(s,t,e,r,o,n,i,a,f){let l=o.views[1],u=r&&o.views[2]?o.views[2]:null,c=l.backwardState,h=u?u.backwardState:null,d=se(t,e,r,o,"backward");re(d,0);let m=o.stagger||0,p=m/1e3,v=n*1e3,y=n+(d.length>2?p*2:p);s(0,1,{duration:y,ease:ne(i),onUpdate:w=>{let b=w*y*1e3;oe(d,b,v,m)}}).then(()=>{T(t,a),k(e,c),r&&h&&C(r,h),f()}).catch(()=>f())}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,f=[{el:s,backward:n.backwardState,forward:n.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&f.push({el:e,backward:a.backwardState,forward:a.forwardState}),f.map(({el:l,backward:u,forward:c})=>o==="forward"?{el:l,from:P(l,u.origin,u.transform),to:P(l,u.origin,c.transform)}:{el:l,from:P(l,c.origin,c.transform),to:P(l,c.origin,u.transform)})}function re(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=Y(U(r,o,t))}function oe(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],f=o*r,l=Math.max(0,t-f),u=e>0?Math.min(1,l/e):1;n.style.transform=Y(U(i,a,u))}}function Fe(){let s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return s.motion?.animate||s.Motion?.animate||s.animate}function ne(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 ie={css:Vt,waapi:Yt,none:Xt,anime:Ut,gsap:Jt,motion:ee};function ae(s){if(typeof s=="function")return{runTransition(r,o){s(r,o)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:ie[t]||ie.css}}function De(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 wt(s,t,e){let r=De(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 He(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 gt(s,t,e){let r=He(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function bt(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 m=d.views;if(Array.isArray(m))for(let p=0;p<m.length;p++){let v=m[p];!v||v.detachedNode||(v.backwardState&&(v.backwardState.transform=wt(v.backwardState.transform,n,i),v.backwardState.origin!=null&&(v.backwardState.origin=gt(v.backwardState.origin,n,i))),v.forwardState&&(v.forwardState.transform=wt(v.forwardState.transform,n,i),v.forwardState.origin!=null&&(v.forwardState.origin=gt(v.forwardState.origin,n,i))))}}let a=s.canvas,f=a.querySelector(".is-current-view"),l=a.querySelector(".is-previous-view"),u=a.querySelector(".is-last-view"),c=a.querySelector(".is-new-current-view"),h=[f,l,u,c].filter(Boolean);for(let d of h){if(!d.style)continue;let m=d.style.transform;m!=null&&m!==""&&(d.style.transform=wt(m,n,i));let p=d.style.transformOrigin;p!=null&&p!==""&&(d.style.transformOrigin=gt(p,n,i))}}var je=8e3,tt=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=[],It(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=ae(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 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("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)}_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())},je)}_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 z(this.debug,t,e)}_recordCanvasSize(){if(!this.canvas)return;let t=this.canvas.getBoundingClientRect();this._lastCanvasWidth=t.width,this._lastCanvasHeight=t.height}_handleResize(){this._destroyed||(this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=setTimeout(()=>{if(this._resizeDebounceTimer=null,!this.isValid||!this.canvas||this._lastCanvasWidth===0)return;let t=this.canvas.getBoundingClientRect(),e=t.width,r=t.height;if(!(e===this._lastCanvasWidth&&r===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}bt(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)&&bt(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){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(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.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),f={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,f)}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 K(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;this._removeNav(),this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let r=this.canvas,o=e.el,n=r.getBoundingClientRect(),i=n.left,a=n.top,l=(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??{}},c=o?.dataset?.deferred!==void 0?!0:this.deferred,h,d=null;if(c){let E=await this.prefetcher.get(t,u);if(this._destroyed)return;for(d=document.createDocumentFragment();E.firstChild;)d.appendChild(E.firstChild);h=await K(E,t,r,!1,{},this.componentContext)}else{let E=await this.prefetcher.get(t,u);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(E,u),h=await K(E,t,r,!1,this.views,this.componentContext)}if(!h)return;c||this._emit("viewMounted",{viewName:t,node:h}),o&&o.classList.add("zoomed");let m=o?(()=>{let E=o.getBoundingClientRect();return{x:E.x,y:E.y,width:E.width,height:E.height}})():e.rect,p=o?o.dataset.withDuration||this.duration:e.duration??this.duration,v=o?o.dataset.withEase||this.ease:e.ease??this.ease,y=o?o.dataset.withCover||this.cover:e.cover??this.cover,g=o?parseInt(o.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),L=r.querySelector(".is-last-view");V(h),V(w),V(b),L&&(V(L),r.removeChild(L));let Z,H,W,_,O,N,A,fe=w.style.transform,Et=w.style.transformOrigin,ue=b?b.style.transform:null,_t=b?b.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let E=h.getBoundingClientRect(),j=w.getBoundingClientRect(),dt=null,xt=null,st=null;b&&(dt=b.getBoundingClientRect(),st=b.querySelector(".zoomed"),xt=st&&st.getBoundingClientRect?st.getBoundingClientRect():dt);let rt={left:i,top:a},Lt={width:n.width,height:n.height},Tt={width:E.width,height:E.height},zt=Zt(m.width,m.height,E.width,E.height,y);A=zt.scale;let we=zt.scaleInv;Z=$t(m,rt,Tt,we),W=w.style.transform;let kt=Mt(m,j);_=Ft(Lt,m,j,A,this.parallax);let Ct=nt(Et||"0 0"),q=G(W||""),Ot=nt(kt),B=G(_.transform),At=m;if(o&&(At=it(m,j,Ct,q.tx,q.ty,q.scale,Ot,B.tx,B.ty,B.scale)),H=Nt(At,rt,Tt),b){O=b.style.transform;let ge=it(j,j,Ct,q.tx,q.ty,q.scale,Ot,B.tx,B.ty,B.scale),be=Ht(_.x,_.y,rt,A,l),Pt=nt(_t||"0 0"),mt=G(O||""),pt=G(be),Se=it(xt,dt,Pt,mt.tx,mt.ty,mt.scale,Pt,pt.tx,pt.ty,pt.scale);N=Dt({canvasRect:Lt,canvasOffset:rt,triggerRect:m,previousViewRectAtBaseTransform:j,lastViewZoomedElementRect:Se,previousViewRectWithPreviousAtEndTransform:ge,scale:A,preScale:l,parallax:this.parallax})}h.style.transform=Z,w.style.transformOrigin=kt}catch(E){this.notify(`zoomIn geometry computation failed: ${E.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",E),w.style.transform=fe,w.style.transformOrigin=Et,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=ue,b.style.transformOrigin=_t,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(h)}catch{}R(w),R(b);return}let he=Q(h.dataset.viewName,{origin:h.style.transformOrigin,duration:p,ease:v,transform:Z},{origin:h.style.transformOrigin,duration:p,ease:v,transform:H}),de=Q(w.dataset.viewName,{origin:w.style.transformOrigin,duration:p,ease:v,transform:W},{origin:w.style.transformOrigin,duration:p,ease:v,transform:_.transform}),me=b?Q(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:v,transform:O},{origin:b.style.transformOrigin,duration:p,ease:v,transform:N}):null,pe=L?jt(L):null,et=Rt(this.storedViews.length,he,de,me,pe);et.scale=A,et.stagger=g||0,this.storeViews(et),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let ve=this._resolveEffects(o);this._applyEffects(w,b,ve,p,v);let ht=this._resolveHideTrigger(o);this._applyHideTrigger(o,h,ht,p,v),ht&&(et.hideTriggerMode=ht),this._setBlockEvents();let ye={type:"zoomIn",currentView:h,previousView:w,lastView:b,currentStage:this.currentStage,duration:p,ease:v};this.transitionDriver.runTransition(ye,async()=>{c&&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||(this._removeNav(),!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 _=this.storedViews[this.storedViews.length-1];this.lateralHistory.push({name:n,entry:_.views[0],node:i?o:null})}this.tracing("lateral()");let a=r.duration??this.duration,f=r.ease??this.ease,l=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),c=0,h=0;if(l){let _=l.querySelector(`.zoom-me[data-to="${n}"]`),O=l.querySelector(`.zoom-me[data-to="${t}"]`);if(_&&O){let N=_.getBoundingClientRect(),A=O.getBoundingClientRect();c=N.left+N.width/2-(A.left+A.width/2),h=N.top+N.height/2-(A.top+A.height/2)}else c=this.canvas.getBoundingClientRect().width*.15}let d=null,m=null;if(i&&(e&&r.keepAliveNode?m=r.keepAliveNode:m=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),m){if(m.style.display="",m.style.opacity="",m.classList.remove("is-lateral-hidden","zoom-lateral-out"),m.classList.add("is-new-current-view","has-no-events"),d=m,!e&&this.lateralHistory){let _=this.lateralHistory.findIndex(O=>O.node===m);_!==-1&&this.lateralHistory.splice(_,1)}}else{let _={target:document.createElement("div"),context:this.componentContext,props:r.props??{}},O=await this.prefetcher.get(t,_);if(this._destroyed||(this.prefetcher.scanAndPrefetch(O,_),d=await K(O,t,this.canvas,!1,this.views,this.componentContext),!d))return;this._emit("viewMounted",{viewName:t,node:d})}V(d);let p=o.style.transform||"",v=o.style.transformOrigin||"0 0";d.style.transform=p,d.style.transformOrigin=v;let y=this.storedViews[this.storedViews.length-1],g=e&&r.savedEntry?{...r.savedEntry,viewName:t}:Q(t,{origin:v,duration:a,ease:f,transform:p},{origin:v,duration:a,ease:f,transform:p});y.views[0]=g,this.currentStage=y;let w=l?{transformStart:l.style.transform||"",transformEnd:this._computeLateralBackTransform(l.style.transform||"",c,h)}:null,b=u&&y.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",c*.7,h*.7)}:null;w&&y.views[1]&&(y.views[1].forwardState={...y.views[1].forwardState,transform:w.transformEnd}),b&&y.views[2]&&(y.views[2].forwardState={...y.views[2].forwardState,transform:b.transformEnd});let L=p,Z=this._computeLateralBackTransform(L,-c,-h),H=this._computeLateralBackTransform(p,c,h);this._setBlockEvents();let W={type:"lateral",currentView:d,previousView:o,lastView:u||null,backView:l||null,backViewState:w,lastViewState:b,incomingTransformStart:Z,incomingTransformEnd:L,outgoingTransform:p,outgoingTransformEnd:H,currentStage:this.currentStage,duration:a,ease:f,canvas:this.canvas,slideDeltaX:c,slideDeltaY:h,keepAlive:i&&!e?i:!1};this.transitionDriver.runTransition(W,()=>{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=p,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;this._removeNav(),this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas,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 f=this.currentStage.hideTriggerMode;f&&a&&this._restoreHideTrigger(a,f,n,i),f==="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"),R(o));let l=qt(this.currentStage);if(l){t.prepend(l);let c=t.querySelector(".z-view:first-child");c&&(R(c),c.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._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")}),this.storedViews.pop()}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-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 f=a.getBoundingClientRect();if(t>=f.left&&t<=f.right&&e>=f.top&&e<=f.bottom)return a}return null}_getSiblings(){let t=this.canvas.querySelector(".is-previous-view");if(!t)return{siblings:[],currentIndex:-1};let r=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,o=t.querySelectorAll(".zoom-me[data-to]"),n=[];for(let a of o)a.dataset.to&&n.push(a.dataset.to);let i=n.indexOf(r);return{siblings:n,currentIndex:i}}_updateNav(){if(this._destroyed)return;this._removeNav();let t=this.storedViews.length-1,e=this.depthNav&&t>=1,r=this.lateralNav,o=null;if(r&&(o=this._getSiblings(),o.siblings.length<2&&(o=null),o&&this.lateralNav.mode==="auto"&&t>=1)){let i=this.canvas.querySelector(".z-view.is-current-view");i&&i.offsetWidth>=this.canvas.offsetWidth&&i.offsetHeight>=this.canvas.offsetHeight&&(o=null)}if(!e&&!o)return;let n=document.createElement("div");if(n.className="z-nav z-nav--"+this.navPosition,e){let i=document.createElement("div");if(i.className="z-nav-depth",this.depthNav.button!==!1){let a=document.createElement("button");a.className="z-nav-back",a.setAttribute("aria-label","Zoom out (go back)"),a.innerHTML="&#8249;",a.addEventListener("mouseup",f=>{f.stopPropagation(),!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),i.appendChild(a)}if(this.depthNav.indicator){let a=document.createElement("div");a.className="z-nav-depth-dots";for(let f=0;f<=t;f++){let l=document.createElement("span");l.className="z-nav-dot"+(f===t?" is-active":""),a.appendChild(l)}i.appendChild(a)}n.appendChild(i)}if(e&&o){let i=document.createElement("div");i.className="z-nav-sep",n.appendChild(i)}if(o){let{siblings:i,currentIndex:a}=o,f=document.createElement("div");if(f.className="z-nav-lateral",this.lateralNav.arrows){let l=document.createElement("button");l.className="z-nav-arrow z-nav-prev",l.setAttribute("aria-label","Previous sibling view"),l.innerHTML="&#8249;",l.disabled=a<=0,l.addEventListener("mouseup",u=>{u.stopPropagation(),a>0&&this._doLateral(i[a-1])}),f.appendChild(l)}if(this.lateralNav.dots){let l=document.createElement("div");l.className="z-nav-lateral-dots";for(let u=0;u<i.length;u++){let c=document.createElement("button");c.className="z-nav-dot z-nav-lat-dot"+(u===a?" is-active":""),c.setAttribute("aria-label",`Go to ${i[u]}`),c.dataset.to=i[u],c.addEventListener("mouseup",(h=>d=>{d.stopPropagation(),h!==a&&this._doLateral(i[h])})(u)),l.appendChild(c)}f.appendChild(l)}if(this.lateralNav.arrows){let l=document.createElement("button");l.className="z-nav-arrow z-nav-next",l.setAttribute("aria-label","Next sibling view"),l.innerHTML="&#8250;",l.disabled=a>=i.length-1,l.addEventListener("mouseup",u=>{u.stopPropagation(),a<i.length-1&&this._doLateral(i[a+1])}),f.appendChild(l)}n.appendChild(f)}this.canvas.appendChild(n)}_removeNav(){this.canvas&&this.canvas.querySelectorAll(".z-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")),o&&!this.blockEvents&&t.target.classList.contains("zoom-me")&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(t.target)),o&&this.storedViews.length>1&&!this.blockEvents&&!t.target.classList.contains("zoom-me")&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}};var Re={separator:"/",prefix:"/"};function le(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 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 ce={install(s,t){let e=Object.assign({},Re,t),r=e.separator,o=e.prefix,n=!1;function i(u){if(n)return;let c=le(s,r),h="#"+o+c;window.location.hash!==h&&(n=!0,window.history[u](null,"",h),n=!1)}function a(){i("pushState")}function f(){i("replaceState")}s.on("afterZoomIn",a),s.on("afterLateral",a),s.on("afterZoomOut",f);function l(){if(n)return;n=!0;let u=qe(o,r),c=le(s,r).split(r).filter(Boolean);if(u.join(r)===c.join(r)){n=!1;return}if(u.length<c.length){let h=c.length-u.length;for(let d=0;d<h;d++)s.zoomOut()}else if(u.length===c.length&&u.length>0){let h=u[u.length-1];h!==c[c.length-1]&&s.goTo(h,{mode:"lateral"})}else u.length>c.length&&window.history.back();n=!1}window.addEventListener("popstate",l),f(),s.on("destroy",function(){s.off("afterZoomIn",a),s.off("afterLateral",a),s.off("afterZoomOut",f),window.removeEventListener("popstate",l)})}};tt.Router=ce;var Zs=tt;export{tt as Zumly,ce as ZumlyRouter,Zs as default};
7
+ var ot=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 o=this.#t[t];return this.resolve(o,e)}switch(this.#e(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(),c=document.createElement("div");c.innerHTML=a.trim();let l=c.firstElementChild;if(!l)throw new Error("Zumly: view produced no element (url)");return l}case"function":{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")}}};async function K(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 z(s,t,e){t&&e==="welcome"&&console.info(`%c Zumly %c ${t}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),t&&s&&(e==="info"||e===void 0)&&console.info(`%c Zumly %c ${t}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),t&&e==="warn"&&console.warn(`%c Zumly %c ${t}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),t&&e==="error"&&console.error(`%c Zumly %c ${t}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function It(s,t){if(t.isValid=!1,!s||typeof s!="object"){z(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof s.mount!="string"){z(!1,"'mount' must be a string selector","error");return}if(t.mount=s.mount,typeof s.initialView!="string"){z(!1,"'initialView' must be a string","error");return}if(t.initialView=s.initialView,!s.views||typeof s.views!="object"){z(!1,"'views' must be an object","error");return}t.views=s.views,t.isValid=!0,t.preload=Array.isArray(s.preload)?s.preload:[],t.debug=typeof s.debug=="boolean"?s.debug:!1,t.componentContext=s.componentContext&&typeof s.componentContext=="object"?s.componentContext:new Map;let e=s.transitions&&typeof s.transitions=="object"?s.transitions:null,r=e&&e.cover,o=typeof r=="string"?r.toLowerCase():null,n=o==="width"||o==="height";t.cover=n?o:"width",!n&&e&&r!==void 0&&z(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),t.duration=e&&typeof e.duration=="string"?e.duration:"1s",t.ease=e&&typeof e.ease=="string"?e.ease:"ease-in-out",t.deferred=typeof s.deferred=="boolean"?s.deferred:!1;let i=e&&e.hideTrigger;i===!0||i==="fade"?t.hideTrigger=i:(t.hideTrigger=!1,i!=null&&i!==!1&&z(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=e&&e.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?t.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?t.effects=[a[0],a[0]]:(t.effects=["none","none"],a!=null&&z(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let c=e&&e.driver,l=typeof c=="string"?c.toLowerCase():null,u=typeof c=="function"?c:null;if(l!==null){let y=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=y.includes(l)?l:"css",y.includes(l)||z(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${c}". 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&&z(!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,g=y==="auto"||y==="always";y&&!g&&z(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn"),t.lateralNav={mode:g?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}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1};let m=s.depthNav;if(m===!1)t.depthNav=!1;else if(m&&typeof m=="object"){let y=typeof m.position=="string"?m.position.toLowerCase():null,g=y==="bottom-left"||y==="top-left";y&&!g&&z(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:g?y:"bottom-left"}}else t.depthNav={position:"bottom-left"};let p=s.lateralNav&&typeof s.lateralNav=="object"?s.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let y=p==="bottom-center"||p==="top-center";p&&!y&&z(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=y?p:"bottom-center"}let v=s.inputs;v&&typeof v=="object"?t.inputs={wheel:typeof v.wheel=="boolean"?v.wheel:!0,keyboard:typeof v.keyboard=="boolean"?v.keyboard:!0,click:typeof v.click=="boolean"?v.click:!0,touch:typeof v.touch=="boolean"?v.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function Zt(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 $t(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 Nt(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 Mt(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 Ft(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,c=n*a,l=i*a;return{x:n,y:i,transform:`translate(${c}px, ${l}px) scale(${r})`}}function Dt({canvasRect:s,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:r,lastViewZoomedElementRect:o,previousViewRectWithPreviousAtEndTransform:n,scale:i,preScale:a,parallax:c=0}){let l=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-l+(n.width-o.width)/2,m=h+(r.y-o.y)+n.y-u+(n.height-o.height)/2,p=1-Math.min(c*2,.9);return`translate(${d*p}px, ${m*p}px) scale(${i*a})`}function Ht(s,t,e,r,o){return`translate(${s-e.left}px, ${t-e.top}px) scale(${r*o})`}function nt(s){let t=s.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function G(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 it(s,t,e,r,o,n,i,a,c,l){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,m=u+e.x+(s.x-u-e.x-r)/n,p=f+e.y+(s.y-f-e.y-o)/n,v=s.width/n,y=s.height/n,g=u+i.x+a+l*(m-u-i.x),w=f+i.y+c+l*(p-f-i.y),b=v*l,L=y*l;return{x:g,y:w,width:b,height:L,left:g,top:w,right:g+b,bottom:w+L}}function Q(s,t,e){return{viewName:s,backwardState:t,forwardState:e}}function jt(s){return{detachedNode:s}}function Rt(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 qt(s){let t=s.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var at=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 Ee=300*1e3,_e=/^https?:\/\/|^\/|\.html$|\.php$/i,lt=class{#t;#e;#r;#s=new Map;constructor(t={}){this.#r=t,this.#t=new ot(t),this.#e=new at}#o(t){return typeof this.#r[t]=="string"}#n(t){return _e.test(t)?Ee:null}async get(t,e=null){if(this.#o(t)){let r=this.#e.get(t);if(r)return r;if(this.#s.has(t))return this.#s.get(t);let o=(async()=>{let n=await this.#t.resolve(t,e),i=this.#r[t],a=this.#n(i);return this.#e.set(t,n,a),this.#s.delete(t),n})();return this.#s.set(t,o),o}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(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))})}};function V(s){s&&(s.style.contentVisibility="hidden")}function R(s){s&&(s.style.contentVisibility="visible")}function $(s){if(typeof s=="number"&&!Number.isNaN(s))return Math.max(0,s);let e=String(s).match(/^(\d+(?:\.\d+)?)\s*(ms|s)?$/i);if(!e)return 500;let r=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,r):Math.max(0,r*1e3)}function ct(s){return $(s)/1e3}function S(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 k(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 C(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 T(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"),R(t))}function M(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformEnd:c,currentStage:l,canvas:u}=s,f=l.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=f.forwardState.origin,e.style.transform=c||f.forwardState.transform,o&&n&&(o.style.transform=n.transformEnd),i&&a&&(i.style.transform=a.transformEnd),s.keepAlive||T(r,u),t()}var F=150;function D(s,t){let e=!1,r=setTimeout(()=>{e||(e=!0,s())},t);return{finish(){e||(e=!0,clearTimeout(r),s())},safetyTimer:r}}function Bt(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function xe(s){if(!s||s==="none")return Bt();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}:Bt()}function Y(s){return`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.e}, ${s.f})`}function X(s,t,e){return s+(t-s)*e}function U(s,t,e){let r=Math.max(0,Math.min(1,e));return{a:X(s.a,t.a,r),b:X(s.b,t.b,r),c:X(s.c,t.c,r),d:X(s.d,t.d,r),e:X(s.e,t.e,r),f:X(s.f,t.f,r)}}function P(s,t,e){s.style.transformOrigin=t,s.style.transform=e;try{s.getBoundingClientRect()}catch{}return xe(getComputedStyle(s).transform)}function Vt(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:c,canvas:l}=s;if(!r||!o||!i){t();return}e==="lateral"?Le(s,t):e==="zoomIn"?Te(r,o,n,i,a,c,t):e==="zoomOut"?ze(r,o,n,i,a,c,l,t):t()}function Le(s,t){let{currentView:e,previousView:r,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformStart:c,incomingTransformEnd:l,outgoingTransform:u,outgoingTransformEnd:f,currentStage:h,duration:d,ease:m,canvas:p}=s,v=$(d),y=h.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=y.forwardState.origin,o&&n&&(I(o,d,m,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),o.classList.add("zoom-lateral-back")),i&&a&&(I(i,d,m,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),s.keepAlive!=="visible"&&(I(r,d,m,{"--lateral-out-from":u,"--lateral-out-to":f}),r.classList.add("zoom-lateral-out")),I(e,d,m,{"--lateral-in-from":c,"--lateral-in-to":l}),e.classList.add("zoom-lateral-in");let g=s.keepAlive==="visible"?[e]:[r,e];o&&n&&g.push(o),i&&a&&g.push(i);let w=g.length,{finish:b}=D(()=>{vt(g,L),s.keepAlive?(r.classList.remove("zoom-lateral-out"),r.style.opacity=""):T(r,p),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=l,t()},v+F);function L(Z){let H=Z?.target;H&&H.removeEventListener("animationend",L),w--,w<=0&&b()}g.forEach(Z=>Z.addEventListener("animationend",L))}function Te(s,t,e,r,o,n,i){x(s,t,e);let a=r.stagger||0;I(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"),I(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&&(I(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 c=e?[s,t,e]:[s,t],l=c.length,u=$(o),f=e?a*2:a,{finish:h}=D(()=>{vt(c,d),c.forEach(m=>m.style.removeProperty("animation-delay")),i()},u+f+F);function d(m){let p=m?.target;if(p&&p.removeEventListener("animationend",d),p?.isConnected)try{S(p,r)}catch{}l--,l<=0&&h()}c.forEach(m=>m.addEventListener("animationend",d))}function ze(s,t,e,r,o,n,i,a){let c=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,f=r.stagger||0;I(s,o,n,{"--current-view-transform-start":c.backwardState.transform,"--current-view-transform-end":c.forwardState.transform}),f>0&&s.style.setProperty("animation-delay","0ms"),I(t,o,n,{"--previous-view-transform-start":l.backwardState.transform,"--previous-view-transform-end":l.forwardState.transform}),f>0&&t.style.setProperty("animation-delay",`${f}ms`),e&&u&&(I(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,m=$(o),p=e?f*2:f,{finish:v}=D(()=>{vt(h,y),h.forEach(g=>g.style.removeProperty("animation-delay")),a()},m+p+F);function y(g){let w=g?.target;if(w&&w.removeEventListener("animationend",y),w?.isConnected)try{ke(w,r,i)}catch{}d--,d<=0&&v()}h.forEach(g=>g.addEventListener("animationend",y))}function ke(s,t,e){if(s.classList.contains("zoom-current-view-reverse")){T(s,e);return}if(s.classList.contains("zoom-previous-view-reverse")){k(s,t.views[1].backwardState);return}s.classList.contains("zoom-last-view-reverse")&&C(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[o,n]of Object.entries(r))s.style.setProperty(o,n)}function vt(s,t){for(let e of s)e?.removeEventListener&&e.removeEventListener("animationend",t)}function Xt(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"){M(s,t);return}if(e==="zoomIn"){x(r,o,n),S(r,i),S(o,i),n&&S(n,i),t();return}if(e==="zoomOut"){T(r,a),x(o,n),k(o,i.views[1].backwardState),n&&C(n,i.views[2].backwardState),t();return}t()}function Yt(s,t){let{type:e,currentView:r,previousView:o,lastView:n,currentStage:i,duration:a,ease:c,canvas:l}=s;if(!r||!o||!i){t();return}let u=$(a);if(e==="lateral"){Ae(s,u,c,t);return}if(e==="zoomIn"){Ce(r,o,n,i,u,c,t);return}if(e==="zoomOut"){Oe(r,o,n,i,u,c,l,t);return}t()}function Ce(s,t,e,r,o,n,i){x(s,t,e);let a=r.views[0],c=r.views[1],l=e&&r.views[2]?r.views[2]:null;s.style.transformOrigin=a.backwardState.origin,s.style.transform=a.backwardState.transform,t.style.transformOrigin=c.backwardState.origin,t.style.transform=c.backwardState.transform,l&&(e.style.transformOrigin=l.backwardState.origin,e.style.transform=l.backwardState.transform);let 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:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:o,delay:u,easing:n,fill:"forwards"})),l&&f.push(e.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:o,delay:u*2,easing:n,fill:"forwards"}));let h=l?u*2:u,{finish:d}=D(()=>{yt(f);try{S(s,r),S(t,r),e&&S(e,r)}catch{}i()},o+h+F);Promise.all(f.map(m=>m.finished)).then(d).catch(d)}function Oe(s,t,e,r,o,n,i,a){let c=r.views[0],l=r.views[1],u=e&&r.views[2]?r.views[2]:null,f=l.backwardState,h=u?u.backwardState:null;s.style.transformOrigin=c.forwardState.origin,s.style.transform=c.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=l.forwardState.origin,e&&u&&(e.style.transformOrigin=u.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||l.forwardState.transform,m=e&&u?e.style.transform||getComputedStyle(e).transform||u.forwardState.transform:null,p=r.stagger||0,v=[];v.push(s.animate([{transform:c.forwardState.transform},{transform:c.backwardState.transform}],{duration:o,easing:n,fill:"forwards"})),v.push(t.animate([{transform:d},{transform:f.transform}],{duration:o,delay:p,easing:n,fill:"both"})),e&&h&&v.push(e.animate([{transform:m},{transform:h.transform}],{duration:o,delay:p*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&h?p*2:p,{finish:g}=D(()=>{yt(v);try{T(s,i),k(t,f),e&&h&&C(e,h)}catch{}a()},o+y+F);Promise.all(v.map(w=>w.finished)).then(g).catch(g)})})}function Ae(s,t,e,r){let{currentView:o,previousView:n,backView:i,backViewState:a,lastView:c,lastViewState:l,incomingTransformStart:u,incomingTransformEnd:f,outgoingTransform:h,outgoingTransformEnd:d,currentStage:m,canvas:p}=s,v=m.views[0];x(o),o.classList.replace("is-new-current-view","is-current-view"),o.classList.remove("zoom-current-view","has-no-events"),o.style.transformOrigin=v.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"})),c&&l&&y.push(c.animate([{transform:l.transformStart},{transform:l.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:g}=D(()=>{yt(y),o.style.transform=f||v.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),c&&l&&(c.style.transform=l.transformEnd),s.keepAlive?(n.style.opacity="",n.style.transform=d):T(n,p),r()},t+F);Promise.all(y.map(w=>w.finished)).then(g).catch(g)}function yt(s){for(let t of s)try{t.cancel()}catch{}}function Ut(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:c,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let f=$(c);r==="lateral"?M(s,t):r==="zoomIn"?Pe(e,o,n,i,a,f,l,t):r==="zoomOut"?Ie(e,o,n,i,a,f,l,u,t):t()}function Pe(s,t,e,r,o,n,i,a){x(t,e,r);let c=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null,f=Wt([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:l.backwardState,forward:l.forwardState},...u?[{el:r,backward:u.backwardState,forward:u.forwardState}]:[]],"forward");Kt(f,0);let h=o.stagger||0,d=n+(u?h*2:h),m={value:0};s({targets:m,value:1,duration:d,easing:Qt(i),update:()=>{let p=m.value*d;Gt(f,p,n,h)},complete:()=>{S(t,o),S(e,o),r&&S(r,o),a()}})}function Ie(s,t,e,r,o,n,i,a,c){let l=o.views[0],u=o.views[1],f=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null,m=Wt([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:u.backwardState,forward:u.forwardState},...f?[{el:r,backward:f.backwardState,forward:f.forwardState}]:[]],"backward");Kt(m,0);let p=o.stagger||0,v=n+(f?p*2:p),y={value:0};s({targets:y,value:1,duration:v,easing:Qt(i),update:()=>{let g=y.value*v;Gt(m,g,n,p)},complete:()=>{T(t,a),k(e,h),r&&d&&C(r,d),c()}})}function Wt(s,t){return s.map(({el:e,backward:r,forward:o})=>{if(t==="forward"){let n=P(e,r.origin,r.transform),i=P(e,r.origin,o.transform);return{el:e,from:n,to:i}}else{let n=P(e,o.origin,o.transform),i=P(e,o.origin,r.transform);return{el:e,from:n,to:i}}})}function Kt(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=Y(U(r,o,t))}function Gt(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],c=o*r,l=Math.max(0,t-c),u=e>0?Math.min(1,l/e):1;n.style.transform=Y(U(i,a,u))}}function Qt(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 Jt(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:c,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let f=ct(c);r==="lateral"?M(s,t):r==="zoomIn"?Ze(e,o,n,i,a,f,l,t):r==="zoomOut"?$e(e,o,n,i,a,f,l,u,t):t()}function Ze(s,t,e,r,o,n,i,a){x(t,e,r);let c=o.views[0],l=o.views[1],u=r&&o.views[2]?o.views[2]:null;ft(t,c.backwardState),ft(e,l.backwardState),u&&ft(r,u.backwardState);let f=s.timeline({onComplete:()=>{S(t,o),S(e,o),r&&S(r,o),a()}}),h=te(i),d=(o.stagger||0)/1e3;f.to(t,{transform:c.forwardState.transform,duration:n,ease:h},0),f.to(e,{transform:l.forwardState.transform,duration:n,ease:h},d),u&&f.to(r,{transform:u.forwardState.transform,duration:n,ease:h},d*2)}function $e(s,t,e,r,o,n,i,a,c){let l=o.views[0],u=o.views[1],f=r&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null;ft(t,l.forwardState);let m=e.style.transform||getComputedStyle(e).transform||u.forwardState.transform,p=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 v=te(i),y=s.timeline({onComplete:()=>{T(t,a),k(e,h),r&&d&&C(r,d),c()}}),g=(o.stagger||0)/1e3;s.set(e,{transform:m}),r&&p&&s.set(r,{transform:p}),y.fromTo(t,{transform:l.forwardState.transform},{transform:l.backwardState.transform,duration:n,ease:v},0),y.fromTo(e,{transform:m},{transform:h.transform,duration:n,ease:v},g),r&&d&&y.fromTo(r,{transform:p},{transform:d.transform,duration:n,ease:v},g*2)}function ft(s,t){s.style.transformOrigin=t.origin,s.style.transform=t.transform}function te(s){if(typeof s!="string")return"power2.inOut";let t=s.toLowerCase();return t==="linear"?"none":t.includes("ease-in-out")?"power2.inOut":t.includes("ease-in")?"power2.in":t.includes("ease-out")?"power2.out":t}function ee(s,t){let e=Fe();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:c,ease:l,canvas:u}=s;if(!o||!n||!a){t();return}let f=ct(c);r==="lateral"?M(s,t):r==="zoomIn"?Ne(e,o,n,i,a,f,l,t):r==="zoomOut"?Me(e,o,n,i,a,f,l,u,t):t()}function Ne(s,t,e,r,o,n,i,a){x(t,e,r);let c=se(t,e,r,o,"forward");re(c,0);let l=o.stagger||0,u=l/1e3,f=n*1e3,h=n+(c.length>2?u*2:u);s(0,1,{duration:h,ease:ne(i),onUpdate:m=>{let p=m*h*1e3;oe(c,p,f,l)}}).then(()=>{S(t,o),S(e,o),r&&S(r,o),a()}).catch(()=>a())}function Me(s,t,e,r,o,n,i,a,c){let l=o.views[1],u=r&&o.views[2]?o.views[2]:null,f=l.backwardState,h=u?u.backwardState:null,d=se(t,e,r,o,"backward");re(d,0);let m=o.stagger||0,p=m/1e3,v=n*1e3,y=n+(d.length>2?p*2:p);s(0,1,{duration:y,ease:ne(i),onUpdate:w=>{let b=w*y*1e3;oe(d,b,v,m)}}).then(()=>{T(t,a),k(e,f),r&&h&&C(r,h),c()}).catch(()=>c())}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,c=[{el:s,backward:n.backwardState,forward:n.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&c.push({el:e,backward:a.backwardState,forward:a.forwardState}),c.map(({el:l,backward:u,forward:f})=>o==="forward"?{el:l,from:P(l,u.origin,u.transform),to:P(l,u.origin,f.transform)}:{el:l,from:P(l,f.origin,f.transform),to:P(l,f.origin,u.transform)})}function re(s,t){for(let{el:e,from:r,to:o}of s)e.style.transform=Y(U(r,o,t))}function oe(s,t,e,r){for(let o=0;o<s.length;o++){let{el:n,from:i,to:a}=s[o],c=o*r,l=Math.max(0,t-c),u=e>0?Math.min(1,l/e):1;n.style.transform=Y(U(i,a,u))}}function Fe(){let s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return s.motion?.animate||s.Motion?.animate||s.animate}function ne(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 ie={css:Vt,waapi:Yt,none:Xt,anime:Ut,gsap:Jt,motion:ee};function ae(s){if(typeof s=="function")return{runTransition(r,o){s(r,o)}};let t=typeof s=="string"?s.toLowerCase():"css";return{runTransition:ie[t]||ie.css}}function De(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 wt(s,t,e){let r=De(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 He(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 gt(s,t,e){let r=He(s);return r===null?s:`${r.x*t}px ${r.y*e}px`}function bt(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 m=d.views;if(Array.isArray(m))for(let p=0;p<m.length;p++){let v=m[p];!v||v.detachedNode||(v.backwardState&&(v.backwardState.transform=wt(v.backwardState.transform,n,i),v.backwardState.origin!=null&&(v.backwardState.origin=gt(v.backwardState.origin,n,i))),v.forwardState&&(v.forwardState.transform=wt(v.forwardState.transform,n,i),v.forwardState.origin!=null&&(v.forwardState.origin=gt(v.forwardState.origin,n,i))))}}let a=s.canvas,c=a.querySelector(".is-current-view"),l=a.querySelector(".is-previous-view"),u=a.querySelector(".is-last-view"),f=a.querySelector(".is-new-current-view"),h=[c,l,u,f].filter(Boolean);for(let d of h){if(!d.style)continue;let m=d.style.transform;m!=null&&m!==""&&(d.style.transform=wt(m,n,i));let p=d.style.transformOrigin;p!=null&&p!==""&&(d.style.transformOrigin=gt(p,n,i))}}var je=8e3,tt=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=[],It(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=ae(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 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("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)}_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())},je)}_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 z(this.debug,t,e)}_recordCanvasSize(){if(!this.canvas)return;let t=this.canvas.getBoundingClientRect();this._lastCanvasWidth=t.width,this._lastCanvasHeight=t.height}_handleResize(){this._destroyed||(this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=setTimeout(()=>{if(this._resizeDebounceTimer=null,!this.isValid||!this.canvas||this._lastCanvasWidth===0)return;let t=this.canvas.getBoundingClientRect(),e=t.width,r=t.height;if(!(e===this._lastCanvasWidth&&r===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}bt(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)&&bt(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){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(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.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),c={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,c)}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 K(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;this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let r=this.canvas,o=e.el,n=r.getBoundingClientRect(),i=n.left,a=n.top,l=(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 E=await this.prefetcher.get(t,u);if(this._destroyed)return;for(d=document.createDocumentFragment();E.firstChild;)d.appendChild(E.firstChild);h=await K(E,t,r,!1,{},this.componentContext)}else{let E=await this.prefetcher.get(t,u);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(E,u),h=await K(E,t,r,!1,this.views,this.componentContext)}if(!h)return;f||this._emit("viewMounted",{viewName:t,node:h}),o&&o.classList.add("zoomed");let m=o?(()=>{let E=o.getBoundingClientRect();return{x:E.x,y:E.y,width:E.width,height:E.height}})():e.rect,p=o?o.dataset.withDuration||this.duration:e.duration??this.duration,v=o?o.dataset.withEase||this.ease:e.ease??this.ease,y=o?o.dataset.withCover||this.cover:e.cover??this.cover,g=o?parseInt(o.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=r.querySelector(".is-current-view"),b=r.querySelector(".is-previous-view"),L=r.querySelector(".is-last-view");V(h),V(w),V(b),L&&(V(L),r.removeChild(L));let Z,H,W,_,O,N,A,fe=w.style.transform,Et=w.style.transformOrigin,ue=b?b.style.transform:null,_t=b?b.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let E=h.getBoundingClientRect(),j=w.getBoundingClientRect(),dt=null,xt=null,st=null;b&&(dt=b.getBoundingClientRect(),st=b.querySelector(".zoomed"),xt=st&&st.getBoundingClientRect?st.getBoundingClientRect():dt);let rt={left:i,top:a},Lt={width:n.width,height:n.height},Tt={width:E.width,height:E.height},zt=Zt(m.width,m.height,E.width,E.height,y);A=zt.scale;let we=zt.scaleInv;Z=$t(m,rt,Tt,we),W=w.style.transform;let kt=Mt(m,j);_=Ft(Lt,m,j,A,this.parallax);let Ct=nt(Et||"0 0"),q=G(W||""),Ot=nt(kt),B=G(_.transform),At=m;if(o&&(At=it(m,j,Ct,q.tx,q.ty,q.scale,Ot,B.tx,B.ty,B.scale)),H=Nt(At,rt,Tt),b){O=b.style.transform;let ge=it(j,j,Ct,q.tx,q.ty,q.scale,Ot,B.tx,B.ty,B.scale),be=Ht(_.x,_.y,rt,A,l),Pt=nt(_t||"0 0"),mt=G(O||""),pt=G(be),Se=it(xt,dt,Pt,mt.tx,mt.ty,mt.scale,Pt,pt.tx,pt.ty,pt.scale);N=Dt({canvasRect:Lt,canvasOffset:rt,triggerRect:m,previousViewRectAtBaseTransform:j,lastViewZoomedElementRect:Se,previousViewRectWithPreviousAtEndTransform:ge,scale:A,preScale:l,parallax:this.parallax})}h.style.transform=Z,w.style.transformOrigin=kt}catch(E){this.notify(`zoomIn geometry computation failed: ${E.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",E),w.style.transform=fe,w.style.transformOrigin=Et,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=ue,b.style.transformOrigin=_t,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{r.removeChild(h)}catch{}R(w),R(b);return}let he=Q(h.dataset.viewName,{origin:h.style.transformOrigin,duration:p,ease:v,transform:Z},{origin:h.style.transformOrigin,duration:p,ease:v,transform:H}),de=Q(w.dataset.viewName,{origin:w.style.transformOrigin,duration:p,ease:v,transform:W},{origin:w.style.transformOrigin,duration:p,ease:v,transform:_.transform}),me=b?Q(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:v,transform:O},{origin:b.style.transformOrigin,duration:p,ease:v,transform:N}):null,pe=L?jt(L):null,et=Rt(this.storedViews.length,he,de,me,pe);et.scale=A,et.stagger=g||0,this.storeViews(et),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let ve=this._resolveEffects(o);this._applyEffects(w,b,ve,p,v);let ht=this._resolveHideTrigger(o);this._applyHideTrigger(o,h,ht,p,v),ht&&(et.hideTriggerMode=ht),this._setBlockEvents();let ye={type:"zoomIn",currentView:h,previousView:w,lastView:b,currentStage:this.currentStage,duration:p,ease:v};this.transitionDriver.runTransition(ye,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||!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 _=this.storedViews[this.storedViews.length-1];this.lateralHistory.push({name:n,entry:_.views[0],node:i?o:null})}this.tracing("lateral()");let a=r.duration??this.duration,c=r.ease??this.ease,l=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),f=0,h=0;if(l){let _=l.querySelector(`.zoom-me[data-to="${n}"]`),O=l.querySelector(`.zoom-me[data-to="${t}"]`);if(_&&O){let N=_.getBoundingClientRect(),A=O.getBoundingClientRect();f=N.left+N.width/2-(A.left+A.width/2),h=N.top+N.height/2-(A.top+A.height/2)}else f=this.canvas.getBoundingClientRect().width*.15}let d=null,m=null;if(i&&(e&&r.keepAliveNode?m=r.keepAliveNode:m=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),m){if(m.style.display="",m.style.opacity="",m.classList.remove("is-lateral-hidden","zoom-lateral-out"),m.classList.add("is-new-current-view","has-no-events"),d=m,!e&&this.lateralHistory){let _=this.lateralHistory.findIndex(O=>O.node===m);_!==-1&&this.lateralHistory.splice(_,1)}}else{let _={target:document.createElement("div"),context:this.componentContext,props:r.props??{}},O=await this.prefetcher.get(t,_);if(this._destroyed||(this.prefetcher.scanAndPrefetch(O,_),d=await K(O,t,this.canvas,!1,this.views,this.componentContext),!d))return;this._emit("viewMounted",{viewName:t,node:d})}V(d);let p=o.style.transform||"",v=o.style.transformOrigin||"0 0";d.style.transform=p,d.style.transformOrigin=v;let y=this.storedViews[this.storedViews.length-1],g=e&&r.savedEntry?{...r.savedEntry,viewName:t}:Q(t,{origin:v,duration:a,ease:c,transform:p},{origin:v,duration:a,ease:c,transform:p});y.views[0]=g,this.currentStage=y;let w=l?{transformStart:l.style.transform||"",transformEnd:this._computeLateralBackTransform(l.style.transform||"",f,h)}:null,b=u&&y.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",f*.7,h*.7)}:null;w&&y.views[1]&&(y.views[1].forwardState={...y.views[1].forwardState,transform:w.transformEnd}),b&&y.views[2]&&(y.views[2].forwardState={...y.views[2].forwardState,transform:b.transformEnd});let L=p,Z=this._computeLateralBackTransform(L,-f,-h),H=this._computeLateralBackTransform(p,f,h);this._setBlockEvents();let W={type:"lateral",currentView:d,previousView:o,lastView:u||null,backView:l||null,backViewState:w,lastViewState:b,incomingTransformStart:Z,incomingTransformEnd:L,outgoingTransform:p,outgoingTransformEnd:H,currentStage:this.currentStage,duration:a,ease:c,canvas:this.canvas,slideDeltaX:f,slideDeltaY:h,keepAlive:i&&!e?i:!1};this.transitionDriver.runTransition(W,()=>{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=p,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;this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas,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 c=this.currentStage.hideTriggerMode;c&&a&&this._restoreHideTrigger(a,c,n,i),c==="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"),R(o));let l=qt(this.currentStage);if(l){t.prepend(l);let f=t.querySelector(".z-view:first-child");f&&(R(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 c=a.getBoundingClientRect();if(t>=c.left&&t<=c.right&&e>=c.top&&e<=c.bottom)return a}return null}_getSiblings(){let t=this.canvas.querySelector(".is-previous-view");if(!t)return{siblings:[],currentIndex:-1};let r=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,o=t.querySelectorAll(".zoom-me[data-to]"),n=[];for(let a of o)a.dataset.to&&n.push(a.dataset.to);let i=n.indexOf(r);return{siblings:n,currentIndex:i}}_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="&#8249;",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="&#8249;",a.disabled=o<=0,a.addEventListener("mouseup",c=>{c.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 c=0;c<r.length;c++){let l=document.createElement("button");l.className="z-nav-dot z-nav-lat-dot"+(c===o?" is-active":""),l.setAttribute("aria-label",`Go to ${r[c]}`),l.dataset.to=r[c],l.addEventListener("mouseup",(u=>f=>{f.stopPropagation(),u!==o&&this._doLateral(r[u])})(c)),a.appendChild(l)}i.appendChild(a)}if(this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-next",a.setAttribute("aria-label","Next sibling view"),a.innerHTML="&#8250;",a.disabled=o>=r.length-1,a.addEventListener("mouseup",c=>{c.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 Re={separator:"/",prefix:"/"};function le(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 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 ce={install(s,t){let e=Object.assign({},Re,t),r=e.separator,o=e.prefix,n=!1;function i(u){if(n)return;let f=le(s,r),h="#"+o+f;window.location.hash!==h&&(n=!0,window.history[u](null,"",h),n=!1)}function a(){i("pushState")}function c(){i("replaceState")}s.on("afterZoomIn",a),s.on("afterLateral",a),s.on("afterZoomOut",c);function l(){if(n)return;n=!0;let u=qe(o,r),f=le(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",l),c(),s.on("destroy",function(){s.off("afterZoomIn",a),s.off("afterLateral",a),s.off("afterZoomOut",c),window.removeEventListener("popstate",l)})}};tt.Router=ce;var Zs=tt;export{tt as Zumly,ce as ZumlyRouter,Zs as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zumly",
3
- "version": "0.92.0",
3
+ "version": "0.92.2",
4
4
  "description": "Javascript library for building zooming user interfaces",
5
5
  "type": "module",
6
6
  "author": "Juan Martin Muda - Zumerlab",