aptechka 0.66.3 → 0.66.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ export interface MorphEvents {
43
43
  morphNewChildrenAdded: CustomEvent<MorphChildrenActionEntry>;
44
44
  morphOldChildrenRemoved: CustomEvent<MorphChildrenActionEntry>;
45
45
  morphScroll: CustomEvent<MorphScrollDetail>;
46
- morphNavigationScroll: CustomEvent<MorphRouteScrollState>;
46
+ morphBeforeNavigationScroll: CustomEvent<MorphRouteScrollState>;
47
47
  }
48
48
  export interface MorphGetRouteOptions {
49
49
  searchParameters?: string;
@@ -1 +1 @@
1
- "use strict";var Mt=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),xt=a=>{throw TypeError(a)};var pt=(a,t,s)=>t.has(a)||xt("Cannot "+s);var e=(a,t,s)=>(pt(a,t,"read from private field"),s?s.call(a):t.get(a)),o=(a,t,s)=>t.has(a)?xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),n=(a,t,s,i)=>(pt(a,t,"write to private field"),i?i.call(a,s):t.set(a,s),s),m=(a,t,s)=>(pt(a,t,"access private method"),s);var V=(a,t,s)=>new Promise((i,h)=>{var v=E=>{try{S(s.next(E))}catch(R){h(R)}},b=E=>{try{S(s.throw(E))}catch(R){h(R)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(a,t)).next())});var Ht=(a,t,s)=>(t=a[Mt("asyncIterator")])?t.call(a):(a=a[Mt("iterator")](),t={},s=(i,h)=>(h=a[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=h.call(a,v),E=v.done,Promise.resolve(v.value).then(R=>b({value:R,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Dt=require("../index-DekP7OZe.cjs"),I=require("../events-KVanG9sR.cjs"),Wt=require("../polyfills-Df4r-ETT.cjs"),Nt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ot=require("../url-lnBE_6yf.cjs"),Yt=require("../css-value-parser/index.cjs");class Rt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Dt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Rt);var C,l,x,et,U;class Et{constructor(t,s){o(this,C);o(this,l);o(this,x);o(this,et,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,x,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Yt.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),R=e(this,l).hasAttribute("data-keep-search-parameters"),ut=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(Y=>Y.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,x),{historyAction:h,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:R,submorph:ut,clearState:f})}});o(this,U,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,x),t),e(this,l).removeEventListener("pointerenter",e(this,U))});n(this,C,s),n(this,l,t),n(this,x,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,et)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,U))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,x));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,et)),e(this,l).removeEventListener("pointerenter",e(this,U)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,x=new WeakMap,et=new WeakMap,U=new WeakMap;var H,$,L,O,B,N,K;class qt{constructor(t,s,i){o(this,H);o(this,$);o(this,L,{x:0,y:0});o(this,O);o(this,B,null);o(this,N,null);o(this,K,null);n(this,H,t),n(this,$,s),n(this,O,i.cloneNode(!0))}get pathname(){return e(this,$)}get scrollState(){return e(this,L)}get document(){return e(this,N)}cloneDocument(){n(this,N,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,N).title)t=e(this,N).title;else{const s=e(this,N).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,$)}return t}clearScrollState(){e(this,L).x=0,e(this,L).y=0}clearDocumentState(){n(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,H).scrollValue.left,e(this,L).y=e(this,H).scrollValue.top)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?n(this,B,null):n(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,K,t)}clearState(){const t=e(this,K);return n(this,K,null),t}}H=new WeakMap,$=new WeakMap,L=new WeakMap,O=new WeakMap,B=new WeakMap,N=new WeakMap,K=new WeakMap;var A,G,p,ct,q,d,st,F,T,P,it,D,W,J,Q,rt,c,lt,zt,St,Vt,vt,wt,yt,Lt,ht,Z;const tt=class tt{constructor(t){o(this,c);o(this,A,null);o(this,G,null);o(this,p,[]);o(this,ct,new DOMParser);o(this,q);o(this,d,null);o(this,st);o(this,F,[]);o(this,T,!1);o(this,P,null);o(this,it,!1);o(this,D,new Map);o(this,W,null);o(this,J,0);o(this,Q,0);o(this,rt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});o(this,ht,t=>V(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,T,!1))}));o(this,Z,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Q),h=t-e(this,J);n(this,Q,s),n(this,J,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),I.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Dt.isBrowser&&!tt.instance){tt.instance=this,n(this,A,{base:ot.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,G,m(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);n(this,d,s.pathname),e(this,D).set(e(this,d),new qt(this,e(this,d),document)),document.documentElement.setAttribute("data-current-pathname",e(this,d)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ht)),ot.changeHistory({action:"replace",pathname:e(this,d),searchParameters:s.parameters||location.search,hash:s.hash}),n(this,W,new Rt),m(this,c,yt).call(this,document)}}get currentPathname(){return e(this,d)}get previousPathname(){return e(this,st)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}get scrollValue(){let t=0,s=0;return e(this,it)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,D).get(e(this,d));s&&s.saveState(t)}getState(){const t=e(this,D).get(e(this,d));return t==null?void 0:t.clearState()}normalizePath(t){return ot.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return V(this,null,function*(){const i=this.normalizePath(t);m(this,c,lt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(R){return V(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var Pt;if(e(this,F).length)return;const ut=this.normalizePath(((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,t))||t);let{pathname:f,hash:Y,parameters:bt,leaf:It}=ut;if(e(this,q)===f||e(this,d)===f){e(this,T)||m(this,c,Lt).call(this,Y||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,q,f),e(this,p).forEach(X=>{X.checkCurrent(f)});try{let X=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:k,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),X=!1}if(!X||e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}const dt={pathname:f,submorph:S};I.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=yield m(this,c,lt).call(this,e(this,d)),w=yield m(this,c,lt).call(this,f,{searchParameters:bt,revalidate:v});if(e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,T)||(w.clearScrollState(),w.clearDocumentState()),E&&w.clearState(),w.cloneDocument(),e(this,W).textContent=w.title,document.body.appendChild(e(this,W)),I.dispatchEvent(document,"morphStart",{detail:dt});const At=Array.from(document.head.children),kt=Array.from(w.document.head.children),Ct=m(this,c,Vt).call(this,At,kt),Ot=m(this,c,vt).call(this,At,Ct),nt=m(this,c,vt).call(this,kt,Ct);nt.forEach((r,k)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),nt[k]=y}}),nt.forEach(r=>{document.head.appendChild(r)});const ft=nt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,wt).call(this,r))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(r=>V(this,null,function*(){let k=0;try{for(var y=Ht(ft),_,z,j;_=!(z=yield y.next()).done;_=!1){const at=z.value;at.onload=()=>{k++,k===ft.length&&r()}}}catch(z){j=[z]}finally{try{_&&(z=y.return)&&(yield z.call(y))}finally{if(j)throw j[0]}}}))),yield Nt.wait(10);const Tt=[];Ot.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,wt).call(this,r)?Tt.push(r):r.remove())});const Bt=m(this,c,St).call(this,w.document.body);e(this,A).morphInsideScrollContainer||m(this,c,yt).call(this,w.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",It),ot.changeHistory({action:s,pathname:f,searchParameters:bt||(b?location.search:""),hash:Y}),e(this,W).remove(),n(this,st,e(this,d)),n(this,d,f),e(this,G).forEach((r,k)=>{const y=Bt[k],_=getComputedStyle(r).getPropertyValue("--morph-duration");let z=[],j=[];S?S.forEach(u=>{const g=r.querySelector(u),M=y.querySelector(u);g&&M&&(j.push(g),z.push(M))}):(z.push(...y.childNodes),j.push(...r.childNodes)),j.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),z.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),S?z.forEach((u,g)=>{var M;(M=j[g].parentElement)==null||M.insertBefore(u,j[g])}):r.prepend(...z),Wt.requestIdleCallback(()=>{z.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("in"))})});const at={morphElement:r,pathname:f};I.dispatchEvent(document,"morphNewChildrenAdded",{detail:at});const Ft=new Promise(u=>{setTimeout(()=>{j.forEach(g=>g.remove()),z.forEach(g=>{var M;g instanceof HTMLElement&&((M=g.parentElement)==null||M.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),I.dispatchEvent(document,"morphOldChildrenRemoved",{detail:at}),u()},(parseFloat(_)||0)*1e3+10)});e(this,F).push(Ft)}),Y?(w.clearScrollState(),m(this,c,Lt).call(this,Y,{centerScroll:i,offsetScroll:h})):e(this,T)?w.restoreScrollPosition():w.renewScrollPosition(),I.dispatchEvent(document,"morphNavigationScroll",{detail:w.scrollState}),yield Promise.all(e(this,F)),Tt.forEach(r=>r.remove()),n(this,F,[]),e(this,G).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const _=document.createElement("script");_.type="module",_.src=y.getAttribute("src"),y.replaceWith(_)})}),I.dispatchEvent(document,"morphComplete",{detail:dt}),window.dispatchEvent(new Event("resize"))}catch(X){console.error(X)}n(this,q,void 0)})}addLink(t){e(this,p).push(new Et(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,rt));e(this,p).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,rt));e(this,p).forEach(s=>s.destroy()),n(this,p,t.map(s=>new Et(s,this)))}};A=new WeakMap,G=new WeakMap,p=new WeakMap,ct=new WeakMap,q=new WeakMap,d=new WeakMap,st=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,it=new WeakMap,D=new WeakMap,W=new WeakMap,J=new WeakMap,Q=new WeakMap,rt=new WeakMap,c=new WeakSet,lt=function(t,s){return V(this,null,function*(){let i=e(this,D).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,zt).call(this,t,s==null?void 0:s.searchParameters)),i})},zt=function(t,s){return V(this,null,function*(){const h=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,ct).parseFromString(h,"text/html"),b=new qt(this,t,v);return e(this,D).set(t,b),b})},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Vt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Z)),n(this,Q,0),n(this,J,0),n(this,P,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,it,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Z)),e(this,Z).call(this)},Lt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Nt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ht=new WeakMap,Z=new WeakMap,tt.instance=null;let gt=tt;exports.Morph=gt;
1
+ "use strict";var Tt=(o,t)=>(t=Symbol[o])?t:Symbol.for("Symbol."+o),Mt=o=>{throw TypeError(o)};var pt=(o,t,s)=>t.has(o)||Mt("Cannot "+s);var e=(o,t,s)=>(pt(o,t,"read from private field"),s?s.call(o):t.get(o)),a=(o,t,s)=>t.has(o)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,s),n=(o,t,s,i)=>(pt(o,t,"write to private field"),i?i.call(o,s):t.set(o,s),s),m=(o,t,s)=>(pt(o,t,"access private method"),s);var z=(o,t,s)=>new Promise((i,h)=>{var w=E=>{try{S(s.next(E))}catch(R){h(R)}},b=E=>{try{S(s.throw(E))}catch(R){h(R)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(w,b);S((s=s.apply(o,t)).next())});var Ht=(o,t,s)=>(t=o[Tt("asyncIterator")])?t.call(o):(o=o[Tt("iterator")](),t={},s=(i,h)=>(h=o[i])&&(t[i]=w=>new Promise((b,S,E)=>(w=h.call(o,w),E=w.done,Promise.resolve(w.value).then(R=>b({value:R,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Dt=require("../index-DekP7OZe.cjs"),I=require("../events-KVanG9sR.cjs"),Wt=require("../polyfills-Df4r-ETT.cjs"),Nt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const at=require("../url-lnBE_6yf.cjs"),Yt=require("../css-value-parser/index.cjs");class Rt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Dt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Rt);var C,l,M,et,U;class Et{constructor(t,s){a(this,C);a(this,l);a(this,M);a(this,et,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{n(this,M,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",w=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Yt.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),R=e(this,l).hasAttribute("data-keep-search-parameters"),ut=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(Y=>Y.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,M),{historyAction:h,centerScroll:w,offsetScroll:S,revalidate:E,keepSearchParameters:R,submorph:ut,clearState:f})}});a(this,U,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,M),t),e(this,l).removeEventListener("pointerenter",e(this,U))});n(this,C,s),n(this,l,t),n(this,M,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,et)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,U))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,M));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,et)),e(this,l).removeEventListener("pointerenter",e(this,U)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,M=new WeakMap,et=new WeakMap,U=new WeakMap;var H,$,L,B,O,N,K;class qt{constructor(t,s,i){a(this,H);a(this,$);a(this,L,{x:0,y:0});a(this,B);a(this,O,null);a(this,N,null);a(this,K,null);n(this,H,t),n(this,$,s),n(this,B,i.cloneNode(!0))}get pathname(){return e(this,$)}get scrollState(){return e(this,L)}get document(){return e(this,N)}cloneDocument(){n(this,N,(e(this,O)||e(this,B)).cloneNode(!0))}get title(){let t="";if(e(this,N).title)t=e(this,N).title;else{const s=e(this,N).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,$)}return t}clearScrollState(){e(this,L).x=0,e(this,L).y=0}clearDocumentState(){n(this,O,null)}saveScrollState(){e(this,B).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,H).scrollValue.left,e(this,L).y=e(this,H).scrollValue.top)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,B).documentElement.hasAttribute("data-no-page-restoration")?n(this,O,null):n(this,O,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,K,t)}clearState(){const t=e(this,K);return n(this,K,null),t}}H=new WeakMap,$=new WeakMap,L=new WeakMap,B=new WeakMap,O=new WeakMap,N=new WeakMap,K=new WeakMap;var A,G,p,ct,q,d,st,F,x,P,it,D,W,J,Q,rt,c,lt,Vt,St,zt,vt,wt,yt,Lt,ht,Z;const tt=class tt{constructor(t){a(this,c);a(this,A,null);a(this,G,null);a(this,p,[]);a(this,ct,new DOMParser);a(this,q);a(this,d,null);a(this,st);a(this,F,[]);a(this,x,!1);a(this,P,null);a(this,it,!1);a(this,D,new Map);a(this,W,null);a(this,J,0);a(this,Q,0);a(this,rt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ht,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,x,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,x,!1))}));a(this,Z,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Q),h=t-e(this,J);n(this,Q,s),n(this,J,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),I.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Dt.isBrowser&&!tt.instance){tt.instance=this,n(this,A,{base:at.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,G,m(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);n(this,d,s.pathname),e(this,D).set(e(this,d),new qt(this,e(this,d),document)),document.documentElement.setAttribute("data-current-pathname",e(this,d)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ht)),at.changeHistory({action:"replace",pathname:e(this,d),searchParameters:s.parameters||location.search,hash:s.hash}),n(this,W,new Rt),m(this,c,yt).call(this,document)}}get currentPathname(){return e(this,d)}get previousPathname(){return e(this,st)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,x)}get scrollValue(){let t=0,s=0;return e(this,it)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,D).get(e(this,d));s&&s.saveState(t)}getState(){const t=e(this,D).get(e(this,d));return t==null?void 0:t.clearState()}normalizePath(t){return at.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,lt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(R){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:w,keepSearchParameters:b,submorph:S,clearState:E}={}){var Pt;if(e(this,F).length)return;const ut=this.normalizePath(((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,t))||t);let{pathname:f,hash:Y,parameters:bt,leaf:It}=ut;if(e(this,q)===f||e(this,d)===f){e(this,x)||m(this,c,Lt).call(this,Y||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,q,f),e(this,p).forEach(X=>{X.checkCurrent(f)});try{let X=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:k,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),X=!1}if(!X||e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}const dt={pathname:f,submorph:S};I.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=yield m(this,c,lt).call(this,e(this,d)),v=yield m(this,c,lt).call(this,f,{searchParameters:bt,revalidate:w});if(e(this,q)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,x)||(v.clearScrollState(),v.clearDocumentState()),E&&v.clearState(),v.cloneDocument(),e(this,W).textContent=v.title,document.body.appendChild(e(this,W)),I.dispatchEvent(document,"morphStart",{detail:dt});const At=Array.from(document.head.children),kt=Array.from(v.document.head.children),Ct=m(this,c,zt).call(this,At,kt),Bt=m(this,c,vt).call(this,At,Ct),nt=m(this,c,vt).call(this,kt,Ct);nt.forEach((r,k)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),nt[k]=y}}),nt.forEach(r=>{document.head.appendChild(r)});const ft=nt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,wt).call(this,r))return!0});e(this,A).waitForHeadToLoad&&ft.length&&(yield new Promise(r=>z(this,null,function*(){let k=0;try{for(var y=Ht(ft),_,V,j;_=!(V=yield y.next()).done;_=!1){const ot=V.value;ot.onload=()=>{k++,k===ft.length&&r()}}}catch(V){j=[V]}finally{try{_&&(V=y.return)&&(yield V.call(y))}finally{if(j)throw j[0]}}}))),yield Nt.wait(10);const xt=[];Bt.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,wt).call(this,r)?xt.push(r):r.remove())});const Ot=m(this,c,St).call(this,v.document.body);e(this,A).morphInsideScrollContainer||m(this,c,yt).call(this,v.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",It),at.changeHistory({action:s,pathname:f,searchParameters:bt||(b?location.search:""),hash:Y}),e(this,W).remove(),n(this,st,e(this,d)),n(this,d,f),e(this,G).forEach((r,k)=>{const y=Ot[k],_=getComputedStyle(r).getPropertyValue("--morph-duration");let V=[],j=[];S?S.forEach(u=>{const g=r.querySelector(u),T=y.querySelector(u);g&&T&&(j.push(g),V.push(T))}):(V.push(...y.childNodes),j.push(...r.childNodes)),j.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),V.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),S?V.forEach((u,g)=>{var T;(T=j[g].parentElement)==null||T.insertBefore(u,j[g])}):r.prepend(...V),Wt.requestIdleCallback(()=>{V.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("in"))})});const ot={morphElement:r,pathname:f};I.dispatchEvent(document,"morphNewChildrenAdded",{detail:ot});const Ft=new Promise(u=>{setTimeout(()=>{j.forEach(g=>g.remove()),V.forEach(g=>{var T;g instanceof HTMLElement&&((T=g.parentElement)==null||T.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),I.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ot}),u()},(parseFloat(_)||0)*1e3+10)});e(this,F).push(Ft)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-v.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),I.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:v.scrollState}),Y?(v.clearScrollState(),m(this,c,Lt).call(this,Y,{centerScroll:i,offsetScroll:h})):e(this,x)?v.restoreScrollPosition():v.renewScrollPosition(),yield Promise.all(e(this,F)),xt.forEach(r=>r.remove()),n(this,F,[]),e(this,G).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const _=document.createElement("script");_.type="module",_.src=y.getAttribute("src"),y.replaceWith(_)})}),I.dispatchEvent(document,"morphComplete",{detail:dt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(X){console.error(X)}n(this,q,void 0)})}addLink(t){e(this,p).push(new Et(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,rt));e(this,p).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,rt));e(this,p).forEach(s=>s.destroy()),n(this,p,t.map(s=>new Et(s,this)))}};A=new WeakMap,G=new WeakMap,p=new WeakMap,ct=new WeakMap,q=new WeakMap,d=new WeakMap,st=new WeakMap,F=new WeakMap,x=new WeakMap,P=new WeakMap,it=new WeakMap,D=new WeakMap,W=new WeakMap,J=new WeakMap,Q=new WeakMap,rt=new WeakMap,c=new WeakSet,lt=function(t,s){return z(this,null,function*(){let i=e(this,D).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,Vt).call(this,t,s==null?void 0:s.searchParameters)),i})},Vt=function(t,s){return z(this,null,function*(){const h=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),w=e(this,ct).parseFromString(h,"text/html"),b=new qt(this,t,w);return e(this,D).set(t,b),b})},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},zt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Z)),n(this,Q,0),n(this,J,0),n(this,P,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,it,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Z)),e(this,Z).call(this)},Lt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Nt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ht=new WeakMap,Z=new WeakMap,tt.instance=null;let gt=tt;exports.Morph=gt;
@@ -1,29 +1,29 @@
1
- var Ct = (a, t) => (t = Symbol[a]) ? t : Symbol.for("Symbol." + a), Tt = (a) => {
2
- throw TypeError(a);
1
+ var Ct = (o, t) => (t = Symbol[o]) ? t : Symbol.for("Symbol." + o), xt = (o) => {
2
+ throw TypeError(o);
3
3
  };
4
- var ft = (a, t, s) => t.has(a) || Tt("Cannot " + s);
5
- var e = (a, t, s) => (ft(a, t, "read from private field"), s ? s.call(a) : t.get(a)), o = (a, t, s) => t.has(a) ? Tt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, s), n = (a, t, s, i) => (ft(a, t, "write to private field"), i ? i.call(a, s) : t.set(a, s), s), m = (a, t, s) => (ft(a, t, "access private method"), s);
6
- var I = (a, t, s) => new Promise((i, h) => {
7
- var w = (E) => {
4
+ var ft = (o, t, s) => t.has(o) || xt("Cannot " + s);
5
+ var e = (o, t, s) => (ft(o, t, "read from private field"), s ? s.call(o) : t.get(o)), a = (o, t, s) => t.has(o) ? xt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, s), n = (o, t, s, i) => (ft(o, t, "write to private field"), i ? i.call(o, s) : t.set(o, s), s), m = (o, t, s) => (ft(o, t, "access private method"), s);
6
+ var z = (o, t, s) => new Promise((i, h) => {
7
+ var v = (E) => {
8
8
  try {
9
9
  S(s.next(E));
10
- } catch (q) {
11
- h(q);
10
+ } catch (V) {
11
+ h(V);
12
12
  }
13
13
  }, b = (E) => {
14
14
  try {
15
15
  S(s.throw(E));
16
- } catch (q) {
17
- h(q);
16
+ } catch (V) {
17
+ h(V);
18
18
  }
19
- }, S = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(w, b);
20
- S((s = s.apply(a, t)).next());
19
+ }, S = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(v, b);
20
+ S((s = s.apply(o, t)).next());
21
21
  });
22
- var xt = (a, t, s) => (t = a[Ct("asyncIterator")]) ? t.call(a) : (a = a[Ct("iterator")](), t = {}, s = (i, h) => (h = a[i]) && (t[i] = (w) => new Promise((b, S, E) => (w = h.call(a, w), E = w.done, Promise.resolve(w.value).then((q) => b({ value: q, done: E }), S)))), s("next"), s("return"), t);
22
+ var Tt = (o, t, s) => (t = o[Ct("asyncIterator")]) ? t.call(o) : (o = o[Ct("iterator")](), t = {}, s = (i, h) => (h = o[i]) && (t[i] = (v) => new Promise((b, S, E) => (v = h.call(o, v), E = v.done, Promise.resolve(v.value).then((V) => b({ value: V, done: E }), S)))), s("next"), s("return"), t);
23
23
  import { i as Dt } from "../index-Bv9zgfdb.js";
24
- import { d as V } from "../events-CsVF98U6.js";
25
- import { r as Wt } from "../polyfills-DJrTJQky.js";
26
- import { w as Bt, s as Yt } from "../scroll-DPkCFTxg.js";
24
+ import { d as I } from "../events-CsVF98U6.js";
25
+ import { r as Ot } from "../polyfills-DJrTJQky.js";
26
+ import { w as Wt, s as Yt } from "../scroll-DPkCFTxg.js";
27
27
  import "construct-style-sheets-polyfill";
28
28
  import { n as Xt, c as Mt, s as Ut } from "../url-Cc-RVfii.js";
29
29
  import { cssValueParser as $t } from "../css-value-parser/index.js";
@@ -42,10 +42,10 @@ Dt && !customElements.get("morph-announcer") && customElements.define("morph-ann
42
42
  var C, l, M, et, $;
43
43
  class pt {
44
44
  constructor(t, s) {
45
- o(this, C);
46
- o(this, l);
47
- o(this, M);
48
- o(this, et, (t) => {
45
+ a(this, C);
46
+ a(this, l);
47
+ a(this, M);
48
+ a(this, et, (t) => {
49
49
  var i;
50
50
  if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, C).previousPathname)
51
51
  history.back();
@@ -53,21 +53,21 @@ class pt {
53
53
  n(this, M, e(this, l).getAttribute("href") || "/");
54
54
  const h = e(this, l).getAttribute(
55
55
  "data-history-action"
56
- ) || "push", w = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? $t.parse(b) : void 0, E = e(this, l).hasAttribute("data-revalidate"), q = e(this, l).hasAttribute(
56
+ ) || "push", v = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? $t.parse(b) : void 0, E = e(this, l).hasAttribute("data-revalidate"), V = e(this, l).hasAttribute(
57
57
  "data-keep-search-parameters"
58
58
  ), ht = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((Y) => Y.trim()), f = e(this, l).hasAttribute("data-clear-state");
59
59
  e(this, C).navigate(e(this, M), {
60
60
  historyAction: h,
61
- centerScroll: w,
61
+ centerScroll: v,
62
62
  offsetScroll: S,
63
63
  revalidate: E,
64
- keepSearchParameters: q,
64
+ keepSearchParameters: V,
65
65
  submorph: ht,
66
66
  clearState: f
67
67
  });
68
68
  }
69
69
  });
70
- o(this, $, () => {
70
+ a(this, $, () => {
71
71
  const t = e(this, l).hasAttribute("data-revalidate");
72
72
  e(this, C).prefetch(e(this, M), t), e(this, l).removeEventListener("pointerenter", e(this, $));
73
73
  });
@@ -85,17 +85,17 @@ class pt {
85
85
  }
86
86
  }
87
87
  C = new WeakMap(), l = new WeakMap(), M = new WeakMap(), et = new WeakMap(), $ = new WeakMap();
88
- var H, j, L, F, O, N, K;
89
- class Ht {
88
+ var N, j, L, B, F, H, K;
89
+ class Nt {
90
90
  constructor(t, s, i) {
91
- o(this, H);
92
- o(this, j);
93
- o(this, L, { x: 0, y: 0 });
94
- o(this, F);
95
- o(this, O, null);
96
- o(this, N, null);
97
- o(this, K, null);
98
- n(this, H, t), n(this, j, s), n(this, F, i.cloneNode(!0));
91
+ a(this, N);
92
+ a(this, j);
93
+ a(this, L, { x: 0, y: 0 });
94
+ a(this, B);
95
+ a(this, F, null);
96
+ a(this, H, null);
97
+ a(this, K, null);
98
+ n(this, N, t), n(this, j, s), n(this, B, i.cloneNode(!0));
99
99
  }
100
100
  get pathname() {
101
101
  return e(this, j);
@@ -104,17 +104,17 @@ class Ht {
104
104
  return e(this, L);
105
105
  }
106
106
  get document() {
107
- return e(this, N);
107
+ return e(this, H);
108
108
  }
109
109
  cloneDocument() {
110
- n(this, N, (e(this, O) || e(this, F)).cloneNode(!0));
110
+ n(this, H, (e(this, F) || e(this, B)).cloneNode(!0));
111
111
  }
112
112
  get title() {
113
113
  let t = "";
114
- if (e(this, N).title)
115
- t = e(this, N).title;
114
+ if (e(this, H).title)
115
+ t = e(this, H).title;
116
116
  else {
117
- const s = e(this, N).querySelector("h1");
117
+ const s = e(this, H).querySelector("h1");
118
118
  t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, j);
119
119
  }
120
120
  return t;
@@ -123,27 +123,27 @@ class Ht {
123
123
  e(this, L).x = 0, e(this, L).y = 0;
124
124
  }
125
125
  clearDocumentState() {
126
- n(this, O, null);
126
+ n(this, F, null);
127
127
  }
128
128
  saveScrollState() {
129
- e(this, F).documentElement.hasAttribute(
129
+ e(this, B).documentElement.hasAttribute(
130
130
  "data-no-scroll-restoration"
131
- ) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, H).scrollValue.left, e(this, L).y = e(this, H).scrollValue.top);
131
+ ) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, N).scrollValue.left, e(this, L).y = e(this, N).scrollValue.top);
132
132
  }
133
133
  restoreScrollPosition() {
134
- e(this, H).scrollElement.scroll({
134
+ e(this, N).scrollElement.scroll({
135
135
  top: e(this, L).y,
136
136
  left: e(this, L).x,
137
137
  behavior: "instant"
138
138
  });
139
139
  }
140
140
  saveDocumentState() {
141
- e(this, F).documentElement.hasAttribute(
141
+ e(this, B).documentElement.hasAttribute(
142
142
  "data-no-page-restoration"
143
- ) ? n(this, O, null) : n(this, O, document.cloneNode(!0));
143
+ ) ? n(this, F, null) : n(this, F, document.cloneNode(!0));
144
144
  }
145
145
  renewScrollPosition() {
146
- e(this, H).scrollElement.scroll({
146
+ e(this, N).scrollElement.scroll({
147
147
  top: 0,
148
148
  left: 0,
149
149
  behavior: "instant"
@@ -157,35 +157,35 @@ class Ht {
157
157
  return n(this, K, null), t;
158
158
  }
159
159
  }
160
- H = new WeakMap(), j = new WeakMap(), L = new WeakMap(), F = new WeakMap(), O = new WeakMap(), N = new WeakMap(), K = new WeakMap();
161
- var A, G, p, lt, D, d, st, W, T, P, it, R, B, J, Q, rt, c, ot, qt, Et, zt, gt, St, wt, vt, ct, Z;
160
+ N = new WeakMap(), j = new WeakMap(), L = new WeakMap(), B = new WeakMap(), F = new WeakMap(), H = new WeakMap(), K = new WeakMap();
161
+ var A, G, p, lt, D, d, st, O, x, P, it, R, W, J, Q, rt, c, at, Vt, Et, qt, gt, St, wt, vt, ct, Z;
162
162
  const tt = class tt {
163
163
  constructor(t) {
164
- o(this, c);
165
- o(this, A, null);
166
- o(this, G, null);
167
- o(this, p, []);
168
- o(this, lt, new DOMParser());
169
- o(this, D);
170
- o(this, d, null);
171
- o(this, st);
172
- o(this, W, []);
173
- o(this, T, !1);
174
- o(this, P, null);
175
- o(this, it, !1);
176
- o(this, R, /* @__PURE__ */ new Map());
177
- o(this, B, null);
178
- o(this, J, 0);
179
- o(this, Q, 0);
180
- o(this, rt, (t) => {
164
+ a(this, c);
165
+ a(this, A, null);
166
+ a(this, G, null);
167
+ a(this, p, []);
168
+ a(this, lt, new DOMParser());
169
+ a(this, D);
170
+ a(this, d, null);
171
+ a(this, st);
172
+ a(this, O, []);
173
+ a(this, x, !1);
174
+ a(this, P, null);
175
+ a(this, it, !1);
176
+ a(this, R, /* @__PURE__ */ new Map());
177
+ a(this, W, null);
178
+ a(this, J, 0);
179
+ a(this, Q, 0);
180
+ a(this, rt, (t) => {
181
181
  var s;
182
182
  return ((s = t.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !t.hasAttribute("download") && !t.hasAttribute("data-morph-skip") && !t.closest("[data-morph-skip]") && t.getAttribute("target") !== "_blank";
183
183
  });
184
- o(this, ct, (t) => I(this, null, function* () {
184
+ a(this, ct, (t) => z(this, null, function* () {
185
185
  var s;
186
- (s = t.state) != null && s.path && (t.preventDefault(), n(this, T, !0), yield this.navigate(t.state.path, { historyAction: "none" }), n(this, T, !1));
186
+ (s = t.state) != null && s.path && (t.preventDefault(), n(this, x, !0), yield this.navigate(t.state.path, { historyAction: "none" }), n(this, x, !1));
187
187
  }));
188
- o(this, Z, () => {
188
+ a(this, Z, () => {
189
189
  const { left: t, top: s } = this.scrollValue, i = s - e(this, Q), h = t - e(this, J);
190
190
  n(this, Q, s), n(this, J, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
191
191
  "scroll-y-forward",
@@ -199,7 +199,7 @@ const tt = class tt {
199
199
  ), document.documentElement.classList.toggle(
200
200
  "scroll-x-backward",
201
201
  h < 0
202
- ), V(document, "morphScroll", {
202
+ ), I(document, "morphScroll", {
203
203
  detail: {
204
204
  left: t,
205
205
  top: s
@@ -220,7 +220,7 @@ const tt = class tt {
220
220
  );
221
221
  n(this, d, s.pathname), e(this, R).set(
222
222
  e(this, d),
223
- new Ht(this, e(this, d), document)
223
+ new Nt(this, e(this, d), document)
224
224
  ), document.documentElement.setAttribute(
225
225
  "data-current-pathname",
226
226
  e(this, d)
@@ -232,7 +232,7 @@ const tt = class tt {
232
232
  pathname: e(this, d),
233
233
  searchParameters: s.parameters || location.search,
234
234
  hash: s.hash
235
- }), n(this, B, new Rt()), m(this, c, wt).call(this, document);
235
+ }), n(this, W, new Rt()), m(this, c, wt).call(this, document);
236
236
  }
237
237
  }
238
238
  get currentPathname() {
@@ -248,7 +248,7 @@ const tt = class tt {
248
248
  return e(this, P);
249
249
  }
250
250
  get isPopstateNavigation() {
251
- return e(this, T);
251
+ return e(this, x);
252
252
  }
253
253
  get scrollValue() {
254
254
  let t = 0, s = 0;
@@ -269,31 +269,31 @@ const tt = class tt {
269
269
  });
270
270
  }
271
271
  prefetch(t, s) {
272
- return I(this, null, function* () {
272
+ return z(this, null, function* () {
273
273
  const i = this.normalizePath(t);
274
- m(this, c, ot).call(this, i.pathname, {
274
+ m(this, c, at).call(this, i.pathname, {
275
275
  searchParameters: i.parameters,
276
276
  revalidate: s
277
277
  });
278
278
  });
279
279
  }
280
- navigate(q) {
281
- return I(this, arguments, function* (t, {
280
+ navigate(V) {
281
+ return z(this, arguments, function* (t, {
282
282
  historyAction: s = "push",
283
283
  centerScroll: i,
284
284
  offsetScroll: h,
285
- revalidate: w,
285
+ revalidate: v,
286
286
  keepSearchParameters: b,
287
287
  submorph: S,
288
288
  clearState: E
289
289
  } = {}) {
290
290
  var Lt;
291
- if (e(this, W).length)
291
+ if (e(this, O).length)
292
292
  return;
293
293
  const ht = this.normalizePath(((Lt = this.pathnameModifier) == null ? void 0 : Lt.call(this, t)) || t);
294
- let { pathname: f, hash: Y, parameters: yt, leaf: It } = ht;
294
+ let { pathname: f, hash: Y, parameters: yt, leaf: zt } = ht;
295
295
  if (e(this, D) === f || e(this, d) === f) {
296
- e(this, T) || m(this, c, vt).call(this, Y || 0, {
296
+ e(this, x) || m(this, c, vt).call(this, Y || 0, {
297
297
  centerScroll: i,
298
298
  offsetScroll: h,
299
299
  behavior: "smooth"
@@ -329,12 +329,12 @@ const tt = class tt {
329
329
  pathname: f,
330
330
  submorph: S
331
331
  };
332
- V(document, "morphNavigation", {
332
+ I(document, "morphNavigation", {
333
333
  detail: ut
334
334
  });
335
- const dt = yield m(this, c, ot).call(this, e(this, d)), v = yield m(this, c, ot).call(this, f, {
335
+ const dt = yield m(this, c, at).call(this, e(this, d)), w = yield m(this, c, at).call(this, f, {
336
336
  searchParameters: yt,
337
- revalidate: w
337
+ revalidate: v
338
338
  });
339
339
  if (e(this, D) !== f) {
340
340
  e(this, p).forEach((r) => {
@@ -342,10 +342,10 @@ const tt = class tt {
342
342
  });
343
343
  return;
344
344
  }
345
- dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, T) || (v.clearScrollState(), v.clearDocumentState()), E && v.clearState(), v.cloneDocument(), e(this, B).textContent = v.title, document.body.appendChild(e(this, B)), V(document, "morphStart", {
345
+ dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, x) || (w.clearScrollState(), w.clearDocumentState()), E && w.clearState(), w.cloneDocument(), e(this, W).textContent = w.title, document.body.appendChild(e(this, W)), I(document, "morphStart", {
346
346
  detail: ut
347
347
  });
348
- const bt = Array.from(document.head.children), Pt = Array.from(v.document.head.children), At = m(this, c, zt).call(this, bt, Pt), Vt = m(this, c, gt).call(this, bt, At), nt = m(this, c, gt).call(this, Pt, At);
348
+ const bt = Array.from(document.head.children), Pt = Array.from(w.document.head.children), At = m(this, c, qt).call(this, bt, Pt), It = m(this, c, gt).call(this, bt, At), nt = m(this, c, gt).call(this, Pt, At);
349
349
  nt.forEach((r, k) => {
350
350
  if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
351
351
  const y = document.createElement("script");
@@ -360,54 +360,54 @@ const tt = class tt {
360
360
  if (m(this, c, St).call(this, r))
361
361
  return !0;
362
362
  });
363
- e(this, A).waitForHeadToLoad && mt.length && (yield new Promise((r) => I(this, null, function* () {
363
+ e(this, A).waitForHeadToLoad && mt.length && (yield new Promise((r) => z(this, null, function* () {
364
364
  let k = 0;
365
365
  try {
366
- for (var y = xt(mt), _, z, U; _ = !(z = yield y.next()).done; _ = !1) {
367
- const at = z.value;
368
- at.onload = () => {
366
+ for (var y = Tt(mt), _, q, U; _ = !(q = yield y.next()).done; _ = !1) {
367
+ const ot = q.value;
368
+ ot.onload = () => {
369
369
  k++, k === mt.length && r();
370
370
  };
371
371
  }
372
- } catch (z) {
373
- U = [z];
372
+ } catch (q) {
373
+ U = [q];
374
374
  } finally {
375
375
  try {
376
- _ && (z = y.return) && (yield z.call(y));
376
+ _ && (q = y.return) && (yield q.call(y));
377
377
  } finally {
378
378
  if (U)
379
379
  throw U[0];
380
380
  }
381
381
  }
382
- }))), yield Bt(10);
382
+ }))), yield Wt(10);
383
383
  const kt = [];
384
- Vt.forEach((r) => {
384
+ It.forEach((r) => {
385
385
  r.hasAttribute("data-permanent") || (m(this, c, St).call(this, r) ? kt.push(r) : r.remove());
386
386
  });
387
- const Ft = m(this, c, Et).call(this, v.document.body);
388
- e(this, A).morphInsideScrollContainer || m(this, c, wt).call(this, v.document), document.documentElement.setAttribute("data-current-pathname", f), document.documentElement.setAttribute("data-current-leaf", It), Mt({
387
+ const Bt = m(this, c, Et).call(this, w.document.body);
388
+ e(this, A).morphInsideScrollContainer || m(this, c, wt).call(this, w.document), document.documentElement.setAttribute("data-current-pathname", f), document.documentElement.setAttribute("data-current-leaf", zt), Mt({
389
389
  action: s,
390
390
  pathname: f,
391
391
  searchParameters: yt || (b ? location.search : ""),
392
392
  hash: Y
393
- }), e(this, B).remove(), n(this, st, e(this, d)), n(this, d, f), e(this, G).forEach((r, k) => {
394
- const y = Ft[k], _ = getComputedStyle(r).getPropertyValue("--morph-duration");
395
- let z = [], U = [];
393
+ }), e(this, W).remove(), n(this, st, e(this, d)), n(this, d, f), e(this, G).forEach((r, k) => {
394
+ const y = Bt[k], _ = getComputedStyle(r).getPropertyValue("--morph-duration");
395
+ let q = [], U = [];
396
396
  S ? S.forEach((u) => {
397
- const g = r.querySelector(u), x = y.querySelector(u);
398
- g && x && (U.push(g), z.push(x));
399
- }) : (z.push(...y.childNodes), U.push(...r.childNodes)), U.forEach((u) => {
397
+ const g = r.querySelector(u), T = y.querySelector(u);
398
+ g && T && (U.push(g), q.push(T));
399
+ }) : (q.push(...y.childNodes), U.push(...r.childNodes)), U.forEach((u) => {
400
400
  u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
401
- }), z.forEach((u) => {
401
+ }), q.forEach((u) => {
402
402
  u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
403
- }), S ? z.forEach((u, g) => {
404
- var x;
405
- (x = U[g].parentElement) == null || x.insertBefore(
403
+ }), S ? q.forEach((u, g) => {
404
+ var T;
405
+ (T = U[g].parentElement) == null || T.insertBefore(
406
406
  u,
407
407
  U[g]
408
408
  );
409
- }) : r.prepend(...z), Wt(() => {
410
- z.forEach((u) => {
409
+ }) : r.prepend(...q), Ot(() => {
410
+ q.forEach((u) => {
411
411
  var g;
412
412
  u instanceof HTMLElement && ((g = u.parentElement) == null || g.style.setProperty(
413
413
  "--new-content-height",
@@ -415,36 +415,44 @@ const tt = class tt {
415
415
  ), u.classList.add("in"));
416
416
  });
417
417
  });
418
- const at = {
418
+ const ot = {
419
419
  morphElement: r,
420
420
  pathname: f
421
421
  };
422
- V(document, "morphNewChildrenAdded", {
423
- detail: at
422
+ I(document, "morphNewChildrenAdded", {
423
+ detail: ot
424
424
  });
425
- const Ot = new Promise((u) => {
425
+ const Ft = new Promise((u) => {
426
426
  setTimeout(() => {
427
- U.forEach((g) => g.remove()), z.forEach((g) => {
428
- var x;
429
- g instanceof HTMLElement && ((x = g.parentElement) == null || x.style.removeProperty(
427
+ U.forEach((g) => g.remove()), q.forEach((g) => {
428
+ var T;
429
+ g instanceof HTMLElement && ((T = g.parentElement) == null || T.style.removeProperty(
430
430
  "--new-content-height"
431
431
  ), g.classList.remove("in", "new"));
432
- }), V(document, "morphOldChildrenRemoved", {
433
- detail: at
432
+ }), I(document, "morphOldChildrenRemoved", {
433
+ detail: ot
434
434
  }), u();
435
435
  }, (parseFloat(_) || 0) * 1e3 + 10);
436
436
  });
437
- e(this, W).push(Ot);
438
- }), Y ? (v.clearScrollState(), m(this, c, vt).call(this, Y, { centerScroll: i, offsetScroll: h })) : e(this, T) ? v.restoreScrollPosition() : v.renewScrollPosition(), V(document, "morphNavigationScroll", {
439
- detail: v.scrollState
440
- }), yield Promise.all(e(this, W)), kt.forEach((r) => r.remove()), n(this, W, []), e(this, G).forEach((r) => {
437
+ e(this, O).push(Ft);
438
+ }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
439
+ "--new-document-scroll-position",
440
+ (this.scrollValue.top - w.scrollState.y) * 1 + "px"
441
+ ) : document.documentElement.style.setProperty(
442
+ "--new-document-scroll-position",
443
+ this.scrollValue.top + "px"
444
+ ), I(document, "morphBeforeNavigationScroll", {
445
+ detail: w.scrollState
446
+ }), Y ? (w.clearScrollState(), m(this, c, vt).call(this, Y, { centerScroll: i, offsetScroll: h })) : e(this, x) ? w.restoreScrollPosition() : w.renewScrollPosition(), yield Promise.all(e(this, O)), kt.forEach((r) => r.remove()), n(this, O, []), e(this, G).forEach((r) => {
441
447
  r.querySelectorAll("script").forEach((y) => {
442
448
  const _ = document.createElement("script");
443
449
  _.type = "module", _.src = y.getAttribute("src"), y.replaceWith(_);
444
450
  });
445
- }), V(document, "morphComplete", {
451
+ }), I(document, "morphComplete", {
446
452
  detail: ut
447
- }), window.dispatchEvent(new Event("resize"));
453
+ }), document.documentElement.style.removeProperty(
454
+ "--new-document-scroll-position"
455
+ ), window.dispatchEvent(new Event("resize"));
448
456
  } catch (X) {
449
457
  console.error(X);
450
458
  }
@@ -480,22 +488,22 @@ const tt = class tt {
480
488
  e(this, p).forEach((s) => s.destroy()), n(this, p, t.map((s) => new pt(s, this)));
481
489
  }
482
490
  };
483
- A = new WeakMap(), G = new WeakMap(), p = new WeakMap(), lt = new WeakMap(), D = new WeakMap(), d = new WeakMap(), st = new WeakMap(), W = new WeakMap(), T = new WeakMap(), P = new WeakMap(), it = new WeakMap(), R = new WeakMap(), B = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), rt = new WeakMap(), c = new WeakSet(), ot = function(t, s) {
484
- return I(this, null, function* () {
491
+ A = new WeakMap(), G = new WeakMap(), p = new WeakMap(), lt = new WeakMap(), D = new WeakMap(), d = new WeakMap(), st = new WeakMap(), O = new WeakMap(), x = new WeakMap(), P = new WeakMap(), it = new WeakMap(), R = new WeakMap(), W = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), rt = new WeakMap(), c = new WeakSet(), at = function(t, s) {
492
+ return z(this, null, function* () {
485
493
  let i = e(this, R).get(t);
486
- return (!i || s != null && s.revalidate) && (i = yield m(this, c, qt).call(this, t, s == null ? void 0 : s.searchParameters)), i;
494
+ return (!i || s != null && s.revalidate) && (i = yield m(this, c, Vt).call(this, t, s == null ? void 0 : s.searchParameters)), i;
487
495
  });
488
- }, qt = function(t, s) {
489
- return I(this, null, function* () {
496
+ }, Vt = function(t, s) {
497
+ return z(this, null, function* () {
490
498
  const h = yield (yield fetch(
491
499
  `${t}${s ? "?" + s : ""}`
492
- )).text(), w = e(this, lt).parseFromString(h, "text/html"), b = new Ht(this, t, w);
500
+ )).text(), v = e(this, lt).parseFromString(h, "text/html"), b = new Nt(this, t, v);
493
501
  return e(this, R).set(t, b), b;
494
502
  });
495
503
  }, Et = function(t) {
496
504
  const s = [...t.querySelectorAll("[data-morph]")];
497
505
  return s.length ? s : [t];
498
- }, zt = function(t, s) {
506
+ }, qt = function(t, s) {
499
507
  return t.filter(
500
508
  (i) => s.find(
501
509
  (h) => h.outerHTML === i.outerHTML
@@ -524,7 +532,7 @@ A = new WeakMap(), G = new WeakMap(), p = new WeakMap(), lt = new WeakMap(), D =
524
532
  offset: s == null ? void 0 : s.offsetScroll
525
533
  });
526
534
  }, ct = new WeakMap(), Z = new WeakMap(), tt.instance = null;
527
- let Nt = tt;
535
+ let Ht = tt;
528
536
  export {
529
- Nt as Morph
537
+ Ht as Morph
530
538
  };
@@ -1 +1 @@
1
- "use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var r=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-D_YeNqsI.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const b=require("../index-DekP7OZe.cjs"),p=require("../events-KVanG9sR.cjs");require("construct-style-sheets-polyfill");const o=require("../ticker/index.cjs");var i,a,n;class d extends E.SourceElement{constructor(){super(...arguments);u(this,i,0);u(this,a,!1);u(this,n,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>r(this,i)&&c(this,i,t),p.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:r(this,i)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(r(this,n)),r(this,a)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,a,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,a,!0)),o.ticker.subscribe(r(this,n))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("release-pause")&&this.consumerElement.pause(),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(r(this,n)),c(this,i,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.hasAttribute("volume")&&(this.consumerElement.volume=parseFloat(this.getAttribute("volume")||"1"))}}i=new WeakMap,a=new WeakMap,n=new WeakMap;b.isBrowser&&!customElements.get("e-video")&&customElements.define("e-video",d);exports.VideoElement=d;
1
+ "use strict";var h=e=>{throw TypeError(e)};var m=(e,s,t)=>s.has(e)||h("Cannot "+t);var i=(e,s,t)=>(m(e,s,"read from private field"),t?t.call(e):s.get(e)),u=(e,s,t)=>s.has(e)?h("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,t),c=(e,s,t,l)=>(m(e,s,"write to private field"),l?l.call(e,t):s.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../SourceElement-D_YeNqsI.cjs");require("../window-resizer/index.cjs");require("../Store-Cd1GlEmZ.cjs");const p=require("../index-DekP7OZe.cjs"),b=require("../events-KVanG9sR.cjs");require("construct-style-sheets-polyfill");const o=require("../ticker/index.cjs");var r,n,a;class d extends E.SourceElement{constructor(){super(...arguments);u(this,r,0);u(this,n,!1);u(this,a,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>i(this,r)&&c(this,r,t),b.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:i(this,r)}}),this.consumerElement.readyState===4&&(o.ticker.unsubscribe(i(this,a)),i(this,n)&&this.sourceManager.current&&this.consumerElement.play())})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{c(this,n,!1),this.hasAttribute("capture-autoplay")&&(this.sourceManager.current?this.consumerElement.play():c(this,n,!0)),o.ticker.subscribe(i(this,a))}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("release-pause")&&this.consumerElement.pause(),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")}),this.addEventListener("click",()=>{this.hasAttribute("click-controls")&&(this.consumerElement.paused?this.consumerElement.play():this.consumerElement.pause())})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(i(this,a)),c(this,r,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.hasAttribute("volume")&&(this.consumerElement.volume=parseFloat(this.getAttribute("volume")||"1"))}}r=new WeakMap,n=new WeakMap,a=new WeakMap;p.isBrowser&&!customElements.get("e-video")&&customElements.define("e-video",d);exports.VideoElement=d;
@@ -1,8 +1,8 @@
1
- var h = (e) => {
1
+ var l = (e) => {
2
2
  throw TypeError(e);
3
3
  };
4
- var l = (e, s, t) => s.has(e) || h("Cannot " + t);
5
- var i = (e, s, t) => (l(e, s, "read from private field"), t ? t.call(e) : s.get(e)), c = (e, s, t) => s.has(e) ? h("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), n = (e, s, t, m) => (l(e, s, "write to private field"), m ? m.call(e, t) : s.set(e, t), t);
4
+ var h = (e, s, t) => s.has(e) || l("Cannot " + t);
5
+ var i = (e, s, t) => (h(e, s, "read from private field"), t ? t.call(e) : s.get(e)), c = (e, s, t) => s.has(e) ? l("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), o = (e, s, t, m) => (h(e, s, "write to private field"), m ? m.call(e, t) : s.set(e, t), t);
6
6
  import { a as d } from "../SourceElement-jbviggZp.js";
7
7
  import "../window-resizer/index.js";
8
8
  import "../Store-0BVty6AZ.js";
@@ -10,26 +10,26 @@ import { i as p } from "../index-Bv9zgfdb.js";
10
10
  import { d as E } from "../events-CsVF98U6.js";
11
11
  import "construct-style-sheets-polyfill";
12
12
  import { ticker as u } from "../ticker/index.js";
13
- var r, a, o;
13
+ var r, a, n;
14
14
  class f extends d {
15
15
  constructor() {
16
16
  super(...arguments);
17
17
  c(this, r, 0);
18
18
  c(this, a, !1);
19
- c(this, o, () => {
19
+ c(this, n, () => {
20
20
  this.classList.add(`state-${this.consumerElement.readyState}`);
21
21
  const t = this.consumerElement.readyState / 4;
22
- t > i(this, r) && n(this, r, t), E(this, "videoReadyStateChange", {
22
+ t > i(this, r) && o(this, r, t), E(this, "videoReadyStateChange", {
23
23
  detail: {
24
24
  readyState: this.consumerElement.readyState,
25
25
  progress: i(this, r)
26
26
  }
27
- }), this.consumerElement.readyState === 4 && (u.unsubscribe(i(this, o)), i(this, a) && this.sourceManager.current && this.consumerElement.play());
27
+ }), this.consumerElement.readyState === 4 && (u.unsubscribe(i(this, n)), i(this, a) && this.sourceManager.current && this.consumerElement.play());
28
28
  });
29
29
  }
30
30
  connectedCallback() {
31
31
  super.connectedCallback(), this.addEventListener("sourceCapture", () => {
32
- n(this, a, !1), this.hasAttribute("capture-autoplay") && (this.sourceManager.current ? this.consumerElement.play() : n(this, a, !0)), u.subscribe(i(this, o));
32
+ o(this, a, !1), this.hasAttribute("capture-autoplay") && (this.sourceManager.current ? this.consumerElement.play() : o(this, a, !0)), u.subscribe(i(this, n));
33
33
  }), this.addEventListener("sourceRelease", () => {
34
34
  this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("release-pause") && this.consumerElement.pause(), this.hasAttribute("reload-source") && this.classList.remove(
35
35
  "state-0",
@@ -38,10 +38,12 @@ class f extends d {
38
38
  "state-3",
39
39
  "state-4"
40
40
  );
41
+ }), this.addEventListener("click", () => {
42
+ this.hasAttribute("click-controls") && (this.consumerElement.paused ? this.consumerElement.play() : this.consumerElement.pause());
41
43
  });
42
44
  }
43
45
  disconnectedCallback() {
44
- super.disconnectedCallback(), u.unsubscribe(i(this, o)), n(this, r, 0);
46
+ super.disconnectedCallback(), u.unsubscribe(i(this, n)), o(this, r, 0);
45
47
  }
46
48
  createConsumer() {
47
49
  return document.createElement("video");
@@ -52,7 +54,7 @@ class f extends d {
52
54
  ));
53
55
  }
54
56
  }
55
- r = new WeakMap(), a = new WeakMap(), o = new WeakMap();
57
+ r = new WeakMap(), a = new WeakMap(), n = new WeakMap();
56
58
  p && !customElements.get("e-video") && customElements.define("e-video", f);
57
59
  export {
58
60
  f as VideoElement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.66.3",
3
+ "version": "0.66.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"