aptechka 0.71.11 → 0.71.12
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/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +121 -120
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Gt=Object.defineProperty,Jt=Object.defineProperties;var Qt=Object.getOwnPropertyDescriptors;var Dt=Object.getOwnPropertySymbols;var Zt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var Ut=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),It=r=>{throw TypeError(r)};var zt=(r,t,s)=>t in r?Gt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,dt=(r,t)=>{for(var s in t||(t={}))Zt.call(t,s)&&zt(r,s,t[s]);if(Dt)for(var s of Dt(t))_t.call(t,s)&&zt(r,s,t[s]);return r},vt=(r,t)=>Jt(r,Qt(t));var St=(r,t,s)=>t.has(r)||It("Cannot "+s);var e=(r,t,s)=>(St(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?It("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(St(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(St(r,t,"access private method"),s);var B=(r,t,s)=>new Promise((i,d)=>{var w=v=>{try{E(s.next(v))}catch(V){d(V)}},b=v=>{try{E(s.throw(v))}catch(V){d(V)}},E=v=>v.done?i(v.value):Promise.resolve(v.value).then(w,b);E((s=s.apply(r,t)).next())});var Vt=(r,t,s)=>(t=r[Ut("asyncIterator")])?t.call(r):(r=r[Ut("iterator")](),t={},s=(i,d)=>(d=r[i])&&(t[i]=w=>new Promise((b,E,v)=>(w=d.call(r,w),v=w.done,Promise.resolve(w.value).then(V=>b({value:V,done:v}),E)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("../index-DekP7OZe.cjs"),C=require("../events-KVanG9sR.cjs"),te=require("../polyfills-Df4r-ETT.cjs"),Ot=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),ee=require("../css-value-parser/index.cjs");class Wt 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)}}Bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Wt);var H,h,N,nt,G;class wt{constructor(t,s){o(this,H);o(this,h);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,h).hasAttribute("data-back")&&e(this,H).previousURL)history.back();else{n(this,N,e(this,h).getAttribute("href")||"/");const d=e(this,h).getAttribute("data-history-action")||"push",w=e(this,h).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),E=b?ee.cssValueParser.parse(b):void 0,v=e(this,h).hasAttribute("data-revalidate"),V=e(this,h).hasAttribute("data-keep-search-parameters"),l=(i=e(this,h).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ht=>ht.trim()),lt=e(this,h).hasAttribute("data-clear-state");e(this,H).navigate(e(this,N),{historyAction:d,centerScroll:w,offsetScroll:E,revalidate:v,keepSearchParameters:V,submorph:l,clearState:lt})}});o(this,G,()=>{const t=e(this,h).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,N),t),e(this,h).removeEventListener("pointerenter",e(this,G))});n(this,H,s),n(this,h,t),n(this,N,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,G))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,H).normalizePath(t),i=e(this,H).normalizePath(e(this,N));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,nt)),e(this,h).removeEventListener("pointerenter",e(this,G)),e(this,h).classList.remove("current")}}H=new WeakMap,h=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const se=new DOMParser;var M,W,y,P,X,q,J,Y,D,Q,rt;class Ft{constructor(t,s){o(this,M);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,X,null);o(this,q,null);o(this,J,null);o(this,Y,null);o(this,D,null);o(this,Q);o(this,rt);n(this,M,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}get document(){return e(this,q)}setHeaders(t){n(this,rt,t)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,Y))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s,i){return B(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!i||e(this,Q)!==t)||e(this,P)&&e(this,M).isPopstateNavigation?e(this,D):(n(this,Q,t),n(this,D,new Promise(d=>B(this,null,function*(){try{n(this,Y,new AbortController);const b=yield(yield fetch(t,{signal:e(this,Y).signal,headers:dt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":s,"X-MORPH-NEW-PATH":t},e(this,rt))})).text(),E=se.parseFromString(b,"text/html");this.setInitialDocument(E)}catch(w){console.warn(w)}finally{n(this,Y,null),n(this,D,null),d()}}))),e(this,D))})}cloneDocument(){n(this,q,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,M).scrollValue.left,e(this,y).y=e(this,M).scrollValue.top)}restoreScrollPosition(){e(this,M).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,M).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,J,t)}clearState(){const t=e(this,J);return n(this,J,null),t}}M=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,X=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakMap,D=new WeakMap,Q=new WeakMap,rt=new WeakMap;var A,Z,g,U,u,j,z,I,L,at,R,K,_,tt,c,Lt,ot,mt,bt,Xt,Pt,At,kt,Ct,ft,et;const it=class it{constructor(t){o(this,c);o(this,A,null);o(this,Z,null);o(this,g,[]);o(this,U);o(this,u,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,at,!1);o(this,R,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,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,ft,t=>B(this,null,function*(){t.preventDefault(),n(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),n(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),d=t-e(this,_);n(this,tt,s),n(this,_,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",d>0),document.documentElement.classList.toggle("scroll-x-backward",d<0),C.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Bt.isBrowser&&!it.instance){it.instance=this,n(this,A,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!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,Z,p(this,c,bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,u,s);const i=new Ft(this,e(this,u).pathname);i.setInitialDocument(document),e(this,R).set(e(this,u).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,u).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ft)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new Wt),p(this,c,kt).call(this,document)}}get currentURL(){return e(this,u)}get previousURL(){return e(this,j)}get links(){return e(this,g)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,R).get(e(this,u).path);s&&s.saveState(t)}getState(){const t=e(this,R).get(e(this,u).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return B(this,null,function*(){if(e(this,z).length)return;const i=p(this,c,mt).call(this,t);i==null||i.fetch(t,e(this,u).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate(V){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:d,revalidate:w,keepSearchParameters:b,submorph:E,clearState:v}={}){var lt,ht,Ht,Mt;if(e(this,z).length)return;const l=this.normalizePath(((lt=this.pathnameModifier)==null?void 0:lt.call(this,t))||t);if(((ht=e(this,U))==null?void 0:ht.pathname)===l.pathname||e(this,u).pathname===l.pathname){p(this,c,Ct).call(this,l.hash||0,{centerScroll:i,offsetScroll:d,behavior:"smooth"}),C.dispatchEvent(document,"morphSamePath",{custom:!0}),((Ht=e(this,u))==null?void 0:Ht.parameters)!==l.parameters&&(n(this,j,e(this,u)),n(this,u,l),st.changeHistory({action:((Mt=e(this,u))==null?void 0:Mt.hash)!==l.hash?"replace":s,pathname:l.pathname,searchParameters:l.parameters,hash:l.hash}),C.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,u),previousURL:e(this,j)}}));return}n(this,U,l),e(this,g).forEach($=>{$.checkCurrent(l.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:l,resolve:a,reject:k,submorph:E})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==l.pathname){e(this,g).forEach(a=>{a.checkCurrent(e(this,u).pathname)});return}const Rt={url:l,submorph:E};C.dispatchEvent(document,"morphNavigation",{detail:Rt});const pt=p(this,c,mt).call(this,e(this,u).pathname),f=p(this,c,mt).call(this,l.pathname);if(e(this,R).forEach(a=>{a.pathname!==l.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,e(this,u).path,w),e(this,U).pathname!==l.pathname){e(this,g).forEach(a=>{a.checkCurrent(e(this,u).path)});return}pt.clearState(),pt.saveScrollState(),pt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),v&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const Et=vt(dt({},Rt),{document:f.document});C.dispatchEvent(document,"morphStart",{detail:Et});const Tt=Array.from(document.head.children),xt=Array.from(f.document.head.children),Nt=p(this,c,Xt).call(this,Tt,xt),Yt=p(this,c,Pt).call(this,Tt,Nt),ct=p(this,c,Pt).call(this,xt,Nt).filter(a=>!this.excludeHeadChild(a));ct.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ct[k]=p(this,c,Lt).call(this,a))}),ct.forEach(a=>{document.head.appendChild(a)});const gt=ct.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,c,At).call(this,a))return!0});e(this,A).waitForHeadToLoad&>.length&&(yield new Promise(a=>B(this,null,function*(){let k=0;try{for(var T=Vt(gt),Kt,O,F;Kt=!(O=yield T.next()).done;Kt=!1){const ut=O.value;ut.onload=()=>{k++,k===gt.length&&a()}}}catch(O){F=[O]}finally{try{Kt&&(O=T.return)&&(yield O.call(T))}finally{if(F)throw F[0]}}}))),yield Ot.wait(10);const qt=[];Yt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,c,At).call(this,a)?qt.push(a):a.remove())});const jt=p(this,c,bt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,c,kt).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",l.pathname),document.documentElement.setAttribute("data-current-leaf",l.leaf),st.changeHistory({action:s,pathname:l.pathname,searchParameters:l.parameters||(b?location.search:""),hash:l.hash}),e(this,K).remove(),n(this,j,e(this,u)),n(this,u,l),e(this,Z).forEach((a,k)=>{const T=jt[k],Kt=getComputedStyle(a).getPropertyValue("--morph-duration");let O=[],F=[];E?E.forEach(m=>{const S=a.querySelector(m),x=T.querySelector(m);S&&x&&(F.push(S),O.push(x))}):(O.push(...T.childNodes),F.push(...a.childNodes)),F.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"))}),O.forEach(m=>{m instanceof HTMLElement&&(this.findNewLinks(m),m.classList.add("new"))}),E?O.forEach((m,S)=>{var x;(x=F[S].parentElement)==null||x.insertBefore(m,F[S])}):a.prepend(...O),te.requestIdleCallback(()=>{F.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var S;m instanceof HTMLElement&&((S=m.parentElement)==null||S.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})});const ut=vt(dt({},Et),{morphElement:a});C.dispatchEvent(document,"morphNewChildrenAdded",{detail:ut});const $t=new Promise(m=>{setTimeout(()=>{F.forEach(S=>S.remove()),O.forEach(S=>{var x;S instanceof HTMLElement&&((x=S.parentElement)==null||x.style.removeProperty("--new-content-height"),S.classList.remove("new-idle","new"))}),C.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ut}),m()},(parseFloat(Kt)||0)*1e3+10)});e(this,z).push($t)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),C.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),l.hash?(f.clearScrollState(),p(this,c,Ct).call(this,l.hash,{centerScroll:i,offsetScroll:d})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),qt.forEach(a=>a.remove()),n(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,c,Lt).call(this,T))})}),C.dispatchEvent(document,"morphComplete",{detail:Et}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}n(this,U,void 0)})}addLink(t){e(this,g).push(new wt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,g,e(this,g).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,g,e(this,g).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,ot));e(this,g).push(...s.map(i=>new wt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,ot));e(this,g).forEach(s=>s.destroy()),n(this,g,t.map(s=>new wt(s,this)))}};A=new WeakMap,Z=new WeakMap,g=new WeakMap,U=new WeakMap,u=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,at=new WeakMap,R=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,c=new WeakSet,Lt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const d=t.attributes[i];s.setAttribute(d.name,d.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},ot=new WeakMap,mt=function(t){const s=this.normalizePath(t);let i=e(this,R).get(s.pathname);return i||(i=new Ft(this,s.pathname),e(this,R).set(s.pathname,i)),i},bt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Xt=function(t,s){return t.filter(i=>s.find(d=>d.outerHTML===i.outerHTML))},Pt=function(t,s){return t.filter(i=>!s.find(d=>d.outerHTML===i.outerHTML))},At=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},kt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),n(this,tt,0),n(this,_,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,at,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Ct=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ot.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ft=new WeakMap,et=new WeakMap,it.instance=null;let yt=it;exports.Morph=yt;
|
|
1
|
+
"use strict";var Gt=Object.defineProperty,Jt=Object.defineProperties;var Qt=Object.getOwnPropertyDescriptors;var Dt=Object.getOwnPropertySymbols;var Zt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var Ut=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),It=r=>{throw TypeError(r)};var zt=(r,t,s)=>t in r?Gt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,dt=(r,t)=>{for(var s in t||(t={}))Zt.call(t,s)&&zt(r,s,t[s]);if(Dt)for(var s of Dt(t))_t.call(t,s)&&zt(r,s,t[s]);return r},vt=(r,t)=>Jt(r,Qt(t));var St=(r,t,s)=>t.has(r)||It("Cannot "+s);var e=(r,t,s)=>(St(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?It("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(St(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(St(r,t,"access private method"),s);var B=(r,t,s)=>new Promise((i,u)=>{var E=S=>{try{g(s.next(S))}catch(V){u(V)}},b=S=>{try{g(s.throw(S))}catch(V){u(V)}},g=S=>S.done?i(S.value):Promise.resolve(S.value).then(E,b);g((s=s.apply(r,t)).next())});var Vt=(r,t,s)=>(t=r[Ut("asyncIterator")])?t.call(r):(r=r[Ut("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=E=>new Promise((b,g,S)=>(E=u.call(r,E),S=E.done,Promise.resolve(E.value).then(V=>b({value:V,done:S}),g)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("../index-DekP7OZe.cjs"),C=require("../events-KVanG9sR.cjs"),te=require("../polyfills-Df4r-ETT.cjs"),Ot=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),ee=require("../css-value-parser/index.cjs");class Wt 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)}}Bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Wt);var H,l,N,nt,G;class wt{constructor(t,s){o(this,H);o(this,l);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,H).previousURL)history.back();else{n(this,N,e(this,l).getAttribute("href")||"/");const u=e(this,l).getAttribute("data-history-action")||"push",E=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),g=b?ee.cssValueParser.parse(b):void 0,S=e(this,l).hasAttribute("data-revalidate"),V=e(this,l).hasAttribute("data-keep-search-parameters"),h=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ht=>ht.trim()),lt=e(this,l).hasAttribute("data-clear-state");e(this,H).navigate(e(this,N),{historyAction:u,centerScroll:E,offsetScroll:g,revalidate:S,keepSearchParameters:V,submorph:h,clearState:lt})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,N),t),e(this,l).removeEventListener("pointerenter",e(this,G))});n(this,H,s),n(this,l,t),n(this,N,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,G))}get element(){return e(this,l)}checkCurrent(t){var u;const s=e(this,H).normalizePath(t),i=e(this,H).normalizePath(e(this,N));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"):(u=e(this,l).getAttribute("data-associated-paths"))!=null&&u.split(",").find(E=>E.includes(s.pathname))?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,nt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current")}}H=new WeakMap,l=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const se=new DOMParser;var M,W,y,P,X,q,J,Y,D,Q,rt;class Ft{constructor(t,s){o(this,M);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,X,null);o(this,q,null);o(this,J,null);o(this,Y,null);o(this,D,null);o(this,Q);o(this,rt);n(this,M,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}get document(){return e(this,q)}setHeaders(t){n(this,rt,t)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,Y))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s,i){return B(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!i||e(this,Q)!==t)||e(this,P)&&e(this,M).isPopstateNavigation?e(this,D):(n(this,Q,t),n(this,D,new Promise(u=>B(this,null,function*(){try{n(this,Y,new AbortController);const b=yield(yield fetch(t,{signal:e(this,Y).signal,headers:dt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":s,"X-MORPH-NEW-PATH":t},e(this,rt))})).text(),g=se.parseFromString(b,"text/html");this.setInitialDocument(g)}catch(E){console.warn(E)}finally{n(this,Y,null),n(this,D,null),u()}}))),e(this,D))})}cloneDocument(){n(this,q,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,M).scrollValue.left,e(this,y).y=e(this,M).scrollValue.top)}restoreScrollPosition(){e(this,M).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,M).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,J,t)}clearState(){const t=e(this,J);return n(this,J,null),t}}M=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,X=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakMap,D=new WeakMap,Q=new WeakMap,rt=new WeakMap;var A,Z,v,U,d,j,z,I,L,at,R,K,_,tt,c,Lt,ot,mt,bt,Xt,Pt,At,kt,Ct,ft,et;const it=class it{constructor(t){o(this,c);o(this,A,null);o(this,Z,null);o(this,v,[]);o(this,U);o(this,d,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,at,!1);o(this,R,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,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,ft,t=>B(this,null,function*(){t.preventDefault(),n(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),n(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),u=t-e(this,_);n(this,tt,s),n(this,_,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",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),C.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Bt.isBrowser&&!it.instance){it.instance=this,n(this,A,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!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,Z,p(this,c,bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,d,s);const i=new Ft(this,e(this,d).pathname);i.setInitialDocument(document),e(this,R).set(e(this,d).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,d).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ft)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new Wt),p(this,c,kt).call(this,document)}}get currentURL(){return e(this,d)}get previousURL(){return e(this,j)}get links(){return e(this,v)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,R).get(e(this,d).path);s&&s.saveState(t)}getState(){const t=e(this,R).get(e(this,d).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return B(this,null,function*(){if(e(this,z).length)return;const i=p(this,c,mt).call(this,t);i==null||i.fetch(t,e(this,d).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate(V){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:E,keepSearchParameters:b,submorph:g,clearState:S}={}){var lt,ht,Ht,Mt;if(e(this,z).length)return;const h=this.normalizePath(((lt=this.pathnameModifier)==null?void 0:lt.call(this,t))||t);if(((ht=e(this,U))==null?void 0:ht.pathname)===h.pathname||e(this,d).pathname===h.pathname){p(this,c,Ct).call(this,h.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"}),C.dispatchEvent(document,"morphSamePath",{custom:!0}),((Ht=e(this,d))==null?void 0:Ht.parameters)!==h.parameters&&(n(this,j,e(this,d)),n(this,d,h),st.changeHistory({action:((Mt=e(this,d))==null?void 0:Mt.hash)!==h.hash?"replace":s,pathname:h.pathname,searchParameters:h.parameters,hash:h.hash}),C.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,d),previousURL:e(this,j)}}));return}n(this,U,h),e(this,v).forEach($=>{$.checkCurrent(h.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:h,resolve:a,reject:k,submorph:g})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==h.pathname){e(this,v).forEach(a=>{a.checkCurrent(e(this,d).pathname)});return}const Rt={url:h,submorph:g};C.dispatchEvent(document,"morphNavigation",{detail:Rt});const pt=p(this,c,mt).call(this,e(this,d).pathname),f=p(this,c,mt).call(this,h.pathname);if(e(this,R).forEach(a=>{a.pathname!==h.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,e(this,d).path,E),e(this,U).pathname!==h.pathname){e(this,v).forEach(a=>{a.checkCurrent(e(this,d).path)});return}pt.clearState(),pt.saveScrollState(),pt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),S&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const Et=vt(dt({},Rt),{document:f.document});C.dispatchEvent(document,"morphStart",{detail:Et});const Tt=Array.from(document.head.children),xt=Array.from(f.document.head.children),Nt=p(this,c,Xt).call(this,Tt,xt),Yt=p(this,c,Pt).call(this,Tt,Nt),ct=p(this,c,Pt).call(this,xt,Nt).filter(a=>!this.excludeHeadChild(a));ct.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ct[k]=p(this,c,Lt).call(this,a))}),ct.forEach(a=>{document.head.appendChild(a)});const gt=ct.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,c,At).call(this,a))return!0});e(this,A).waitForHeadToLoad&>.length&&(yield new Promise(a=>B(this,null,function*(){let k=0;try{for(var T=Vt(gt),Kt,O,F;Kt=!(O=yield T.next()).done;Kt=!1){const ut=O.value;ut.onload=()=>{k++,k===gt.length&&a()}}}catch(O){F=[O]}finally{try{Kt&&(O=T.return)&&(yield O.call(T))}finally{if(F)throw F[0]}}}))),yield Ot.wait(10);const qt=[];Yt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,c,At).call(this,a)?qt.push(a):a.remove())});const jt=p(this,c,bt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,c,kt).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",h.pathname),document.documentElement.setAttribute("data-current-leaf",h.leaf),st.changeHistory({action:s,pathname:h.pathname,searchParameters:h.parameters||(b?location.search:""),hash:h.hash}),e(this,K).remove(),n(this,j,e(this,d)),n(this,d,h),e(this,Z).forEach((a,k)=>{const T=jt[k],Kt=getComputedStyle(a).getPropertyValue("--morph-duration");let O=[],F=[];g?g.forEach(m=>{const w=a.querySelector(m),x=T.querySelector(m);w&&x&&(F.push(w),O.push(x))}):(O.push(...T.childNodes),F.push(...a.childNodes)),F.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"))}),O.forEach(m=>{m instanceof HTMLElement&&(this.findNewLinks(m),m.classList.add("new"))}),g?O.forEach((m,w)=>{var x;(x=F[w].parentElement)==null||x.insertBefore(m,F[w])}):a.prepend(...O),te.requestIdleCallback(()=>{F.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var w;m instanceof HTMLElement&&((w=m.parentElement)==null||w.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})});const ut=vt(dt({},Et),{morphElement:a});C.dispatchEvent(document,"morphNewChildrenAdded",{detail:ut});const $t=new Promise(m=>{setTimeout(()=>{F.forEach(w=>w.remove()),O.forEach(w=>{var x;w instanceof HTMLElement&&((x=w.parentElement)==null||x.style.removeProperty("--new-content-height"),w.classList.remove("new-idle","new"))}),C.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ut}),m()},(parseFloat(Kt)||0)*1e3+10)});e(this,z).push($t)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),C.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),h.hash?(f.clearScrollState(),p(this,c,Ct).call(this,h.hash,{centerScroll:i,offsetScroll:u})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),qt.forEach(a=>a.remove()),n(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,c,Lt).call(this,T))})}),C.dispatchEvent(document,"morphComplete",{detail:Et}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}n(this,U,void 0)})}addLink(t){e(this,v).push(new wt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,v,e(this,v).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,v,e(this,v).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,ot));e(this,v).push(...s.map(i=>new wt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,ot));e(this,v).forEach(s=>s.destroy()),n(this,v,t.map(s=>new wt(s,this)))}};A=new WeakMap,Z=new WeakMap,v=new WeakMap,U=new WeakMap,d=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,at=new WeakMap,R=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,c=new WeakSet,Lt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const u=t.attributes[i];s.setAttribute(u.name,u.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},ot=new WeakMap,mt=function(t){const s=this.normalizePath(t);let i=e(this,R).get(s.pathname);return i||(i=new Ft(this,s.pathname),e(this,R).set(s.pathname,i)),i},bt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Xt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},Pt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},At=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},kt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),n(this,tt,0),n(this,_,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,at,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Ct=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ot.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ft=new WeakMap,et=new WeakMap,it.instance=null;let yt=it;exports.Morph=yt;
|
package/lib/morph/index.js
CHANGED
|
@@ -15,23 +15,23 @@ var zt = (n, t, s) => t in n ? $t(n, t, { enumerable: !0, configurable: !0, writ
|
|
|
15
15
|
}, gt = (n, t) => Gt(n, Jt(t));
|
|
16
16
|
var St = (n, t, s) => t.has(n) || It("Cannot " + s);
|
|
17
17
|
var e = (n, t, s) => (St(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? It("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), r = (n, t, s, i) => (St(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), p = (n, t, s) => (St(n, t, "access private method"), s);
|
|
18
|
-
var W = (n, t, s) => new Promise((i,
|
|
19
|
-
var
|
|
18
|
+
var W = (n, t, s) => new Promise((i, u) => {
|
|
19
|
+
var E = (w) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
g(s.next(w));
|
|
22
22
|
} catch (q) {
|
|
23
|
-
|
|
23
|
+
u(q);
|
|
24
24
|
}
|
|
25
|
-
}, b = (
|
|
25
|
+
}, b = (w) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
g(s.throw(w));
|
|
28
28
|
} catch (q) {
|
|
29
|
-
|
|
29
|
+
u(q);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, g = (w) => w.done ? i(w.value) : Promise.resolve(w.value).then(E, b);
|
|
32
|
+
g((s = s.apply(n, t)).next());
|
|
33
33
|
});
|
|
34
|
-
var Vt = (n, t, s) => (t = n[Ut("asyncIterator")]) ? t.call(n) : (n = n[Ut("iterator")](), t = {}, s = (i,
|
|
34
|
+
var Vt = (n, t, s) => (t = n[Ut("asyncIterator")]) ? t.call(n) : (n = n[Ut("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (E) => new Promise((b, g, w) => (E = u.call(n, E), w = E.done, Promise.resolve(E.value).then((q) => b({ value: q, done: w }), g)))), s("next"), s("return"), t);
|
|
35
35
|
import { i as Ft } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as C } from "../events-CsVF98U6.js";
|
|
37
37
|
import { r as _t } from "../polyfills-DJrTJQky.js";
|
|
@@ -51,59 +51,60 @@ class Wt extends HTMLElement {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
Ft && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Wt);
|
|
54
|
-
var H,
|
|
55
|
-
class
|
|
54
|
+
var H, l, N, it, G;
|
|
55
|
+
class Lt {
|
|
56
56
|
constructor(t, s) {
|
|
57
57
|
o(this, H);
|
|
58
|
-
o(this,
|
|
58
|
+
o(this, l);
|
|
59
59
|
o(this, N);
|
|
60
60
|
o(this, it, (t) => {
|
|
61
61
|
var i;
|
|
62
|
-
if (t.preventDefault(), e(this,
|
|
62
|
+
if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, H).previousURL)
|
|
63
63
|
history.back();
|
|
64
64
|
else {
|
|
65
|
-
r(this, N, e(this,
|
|
66
|
-
const
|
|
65
|
+
r(this, N, e(this, l).getAttribute("href") || "/");
|
|
66
|
+
const u = e(this, l).getAttribute(
|
|
67
67
|
"data-history-action"
|
|
68
|
-
) || "push",
|
|
68
|
+
) || "push", E = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), g = b ? re.parse(b) : void 0, w = e(this, l).hasAttribute("data-revalidate"), q = e(this, l).hasAttribute(
|
|
69
69
|
"data-keep-search-parameters"
|
|
70
|
-
),
|
|
70
|
+
), h = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((lt) => lt.trim()), ot = e(this, l).hasAttribute("data-clear-state");
|
|
71
71
|
e(this, H).navigate(e(this, N), {
|
|
72
|
-
historyAction:
|
|
73
|
-
centerScroll:
|
|
74
|
-
offsetScroll:
|
|
75
|
-
revalidate:
|
|
72
|
+
historyAction: u,
|
|
73
|
+
centerScroll: E,
|
|
74
|
+
offsetScroll: g,
|
|
75
|
+
revalidate: w,
|
|
76
76
|
keepSearchParameters: q,
|
|
77
|
-
submorph:
|
|
77
|
+
submorph: h,
|
|
78
78
|
clearState: ot
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
o(this, G, () => {
|
|
83
|
-
const t = e(this,
|
|
84
|
-
e(this, H).prefetch(e(this, N), t), e(this,
|
|
83
|
+
const t = e(this, l).hasAttribute("data-revalidate");
|
|
84
|
+
e(this, H).prefetch(e(this, N), t), e(this, l).removeEventListener("pointerenter", e(this, G));
|
|
85
85
|
});
|
|
86
|
-
r(this, H, s), r(this,
|
|
86
|
+
r(this, H, s), r(this, l, t), r(this, N, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, it)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, G));
|
|
87
87
|
}
|
|
88
88
|
get element() {
|
|
89
|
-
return e(this,
|
|
89
|
+
return e(this, l);
|
|
90
90
|
}
|
|
91
91
|
checkCurrent(t) {
|
|
92
|
+
var u;
|
|
92
93
|
const s = e(this, H).normalizePath(t), i = e(this, H).normalizePath(e(this, N));
|
|
93
|
-
e(this,
|
|
94
|
+
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") : (u = e(this, l).getAttribute("data-associated-paths")) != null && u.split(",").find((E) => E.includes(s.pathname)) ? e(this, l).classList.add("current") : e(this, l).classList.remove("current");
|
|
94
95
|
}
|
|
95
96
|
destroy() {
|
|
96
|
-
e(this,
|
|
97
|
+
e(this, l).removeEventListener("click", e(this, it)), e(this, l).removeEventListener("pointerenter", e(this, G)), e(this, l).classList.remove("current");
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
H = new WeakMap(),
|
|
100
|
+
H = new WeakMap(), l = new WeakMap(), N = new WeakMap(), it = new WeakMap(), G = new WeakMap();
|
|
100
101
|
const ne = new DOMParser();
|
|
101
|
-
var R, X,
|
|
102
|
+
var R, X, v, P, B, D, J, Y, U, Q, rt;
|
|
102
103
|
class qt {
|
|
103
104
|
constructor(t, s) {
|
|
104
105
|
o(this, R);
|
|
105
106
|
o(this, X);
|
|
106
|
-
o(this,
|
|
107
|
+
o(this, v, { x: 0, y: 0 });
|
|
107
108
|
o(this, P, null);
|
|
108
109
|
o(this, B, null);
|
|
109
110
|
o(this, D, null);
|
|
@@ -118,7 +119,7 @@ class qt {
|
|
|
118
119
|
return e(this, X);
|
|
119
120
|
}
|
|
120
121
|
get scrollState() {
|
|
121
|
-
return e(this,
|
|
122
|
+
return e(this, v);
|
|
122
123
|
}
|
|
123
124
|
get document() {
|
|
124
125
|
return e(this, D);
|
|
@@ -137,7 +138,7 @@ class qt {
|
|
|
137
138
|
}
|
|
138
139
|
fetch(t, s, i) {
|
|
139
140
|
return W(this, null, function* () {
|
|
140
|
-
return e(this, U) || e(this, P) && e(this, P).documentElement.hasAttribute("data-cache") && (!i || e(this, Q) !== t) || e(this, P) && e(this, R).isPopstateNavigation ? e(this, U) : (r(this, Q, t), r(this, U, new Promise((
|
|
141
|
+
return e(this, U) || e(this, P) && e(this, P).documentElement.hasAttribute("data-cache") && (!i || e(this, Q) !== t) || e(this, P) && e(this, R).isPopstateNavigation ? e(this, U) : (r(this, Q, t), r(this, U, new Promise((u) => W(this, null, function* () {
|
|
141
142
|
try {
|
|
142
143
|
r(this, Y, new AbortController());
|
|
143
144
|
const b = yield (yield fetch(t, {
|
|
@@ -147,12 +148,12 @@ class qt {
|
|
|
147
148
|
"X-MORPH-CURRENT-PATH": s,
|
|
148
149
|
"X-MORPH-NEW-PATH": t
|
|
149
150
|
}, e(this, rt))
|
|
150
|
-
})).text(),
|
|
151
|
-
this.setInitialDocument(
|
|
152
|
-
} catch (
|
|
153
|
-
console.warn(
|
|
151
|
+
})).text(), g = ne.parseFromString(b, "text/html");
|
|
152
|
+
this.setInitialDocument(g);
|
|
153
|
+
} catch (E) {
|
|
154
|
+
console.warn(E);
|
|
154
155
|
} finally {
|
|
155
|
-
r(this, Y, null), r(this, U, null),
|
|
156
|
+
r(this, Y, null), r(this, U, null), u();
|
|
156
157
|
}
|
|
157
158
|
}))), e(this, U));
|
|
158
159
|
});
|
|
@@ -171,7 +172,7 @@ class qt {
|
|
|
171
172
|
return t;
|
|
172
173
|
}
|
|
173
174
|
clearScrollState() {
|
|
174
|
-
e(this,
|
|
175
|
+
e(this, v).x = 0, e(this, v).y = 0;
|
|
175
176
|
}
|
|
176
177
|
clearDocumentState() {
|
|
177
178
|
r(this, B, null);
|
|
@@ -179,12 +180,12 @@ class qt {
|
|
|
179
180
|
saveScrollState() {
|
|
180
181
|
e(this, P).documentElement.hasAttribute(
|
|
181
182
|
"data-no-scroll-restoration"
|
|
182
|
-
) ? (e(this,
|
|
183
|
+
) ? (e(this, v).x = 0, e(this, v).y = 0) : (e(this, v).x = e(this, R).scrollValue.left, e(this, v).y = e(this, R).scrollValue.top);
|
|
183
184
|
}
|
|
184
185
|
restoreScrollPosition() {
|
|
185
186
|
e(this, R).scrollElement.scroll({
|
|
186
|
-
top: e(this,
|
|
187
|
-
left: e(this,
|
|
187
|
+
top: e(this, v).y,
|
|
188
|
+
left: e(this, v).x,
|
|
188
189
|
behavior: "instant"
|
|
189
190
|
});
|
|
190
191
|
}
|
|
@@ -208,16 +209,16 @@ class qt {
|
|
|
208
209
|
return r(this, J, null), t;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
R = new WeakMap(), X = new WeakMap(),
|
|
212
|
-
var A, Z,
|
|
212
|
+
R = new WeakMap(), X = new WeakMap(), v = new WeakMap(), P = new WeakMap(), B = new WeakMap(), D = new WeakMap(), J = new WeakMap(), Y = new WeakMap(), U = new WeakMap(), Q = new WeakMap(), rt = new WeakMap();
|
|
213
|
+
var A, Z, S, z, d, j, I, V, y, nt, T, K, _, tt, c, vt, at, dt, yt, Xt, bt, Pt, At, kt, mt, et;
|
|
213
214
|
const st = class st {
|
|
214
215
|
constructor(t) {
|
|
215
216
|
o(this, c);
|
|
216
217
|
o(this, A, null);
|
|
217
218
|
o(this, Z, null);
|
|
218
|
-
o(this,
|
|
219
|
+
o(this, S, []);
|
|
219
220
|
o(this, z);
|
|
220
|
-
o(this,
|
|
221
|
+
o(this, d, null);
|
|
221
222
|
o(this, j);
|
|
222
223
|
o(this, I, []);
|
|
223
224
|
o(this, V, !1);
|
|
@@ -237,7 +238,7 @@ const st = class st {
|
|
|
237
238
|
}), r(this, V, !1);
|
|
238
239
|
}));
|
|
239
240
|
o(this, et, () => {
|
|
240
|
-
const { left: t, top: s } = this.scrollValue, i = s - e(this, tt),
|
|
241
|
+
const { left: t, top: s } = this.scrollValue, i = s - e(this, tt), u = t - e(this, _);
|
|
241
242
|
r(this, tt, s), r(this, _, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
|
|
242
243
|
"scroll-y-forward",
|
|
243
244
|
i > 0
|
|
@@ -246,10 +247,10 @@ const st = class st {
|
|
|
246
247
|
i < 0
|
|
247
248
|
), document.documentElement.classList.toggle(
|
|
248
249
|
"scroll-x-forward",
|
|
249
|
-
|
|
250
|
+
u > 0
|
|
250
251
|
), document.documentElement.classList.toggle(
|
|
251
252
|
"scroll-x-backward",
|
|
252
|
-
|
|
253
|
+
u < 0
|
|
253
254
|
), C(document, "morphScroll", {
|
|
254
255
|
detail: {
|
|
255
256
|
left: t,
|
|
@@ -268,11 +269,11 @@ const st = class st {
|
|
|
268
269
|
const s = this.normalizePath(
|
|
269
270
|
location.pathname + location.hash + location.search
|
|
270
271
|
);
|
|
271
|
-
r(this,
|
|
272
|
-
const i = new qt(this, e(this,
|
|
273
|
-
i.setInitialDocument(document), e(this, T).set(e(this,
|
|
272
|
+
r(this, d, s);
|
|
273
|
+
const i = new qt(this, e(this, d).pathname);
|
|
274
|
+
i.setInitialDocument(document), e(this, T).set(e(this, d).pathname, i), document.documentElement.setAttribute(
|
|
274
275
|
"data-current-pathname",
|
|
275
|
-
e(this,
|
|
276
|
+
e(this, d).pathname
|
|
276
277
|
), document.documentElement.setAttribute(
|
|
277
278
|
"data-current-leaf",
|
|
278
279
|
s.leaf
|
|
@@ -285,13 +286,13 @@ const st = class st {
|
|
|
285
286
|
}
|
|
286
287
|
}
|
|
287
288
|
get currentURL() {
|
|
288
|
-
return e(this,
|
|
289
|
+
return e(this, d);
|
|
289
290
|
}
|
|
290
291
|
get previousURL() {
|
|
291
292
|
return e(this, j);
|
|
292
293
|
}
|
|
293
294
|
get links() {
|
|
294
|
-
return e(this,
|
|
295
|
+
return e(this, S);
|
|
295
296
|
}
|
|
296
297
|
get scrollElement() {
|
|
297
298
|
return e(this, y);
|
|
@@ -304,11 +305,11 @@ const st = class st {
|
|
|
304
305
|
return e(this, nt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, y).scrollTop, s = e(this, y).scrollLeft), { top: t, left: s };
|
|
305
306
|
}
|
|
306
307
|
saveState(t) {
|
|
307
|
-
const s = e(this, T).get(e(this,
|
|
308
|
+
const s = e(this, T).get(e(this, d).path);
|
|
308
309
|
s && s.saveState(t);
|
|
309
310
|
}
|
|
310
311
|
getState() {
|
|
311
|
-
const t = e(this, T).get(e(this,
|
|
312
|
+
const t = e(this, T).get(e(this, d).path);
|
|
312
313
|
return t == null ? void 0 : t.clearState();
|
|
313
314
|
}
|
|
314
315
|
normalizePath(t) {
|
|
@@ -322,7 +323,7 @@ const st = class st {
|
|
|
322
323
|
if (e(this, I).length)
|
|
323
324
|
return;
|
|
324
325
|
const i = p(this, c, dt).call(this, t);
|
|
325
|
-
i == null || i.fetch(t, e(this,
|
|
326
|
+
i == null || i.fetch(t, e(this, d).path, s);
|
|
326
327
|
});
|
|
327
328
|
}
|
|
328
329
|
excludeHeadChild(t) {
|
|
@@ -334,40 +335,40 @@ const st = class st {
|
|
|
334
335
|
return W(this, arguments, function* (t, {
|
|
335
336
|
historyAction: s = "push",
|
|
336
337
|
centerScroll: i,
|
|
337
|
-
offsetScroll:
|
|
338
|
-
revalidate:
|
|
338
|
+
offsetScroll: u,
|
|
339
|
+
revalidate: E,
|
|
339
340
|
keepSearchParameters: b,
|
|
340
|
-
submorph:
|
|
341
|
-
clearState:
|
|
341
|
+
submorph: g,
|
|
342
|
+
clearState: w
|
|
342
343
|
} = {}) {
|
|
343
344
|
var ot, lt, Ct, Ht;
|
|
344
345
|
if (e(this, I).length)
|
|
345
346
|
return;
|
|
346
|
-
const
|
|
347
|
+
const h = this.normalizePath(
|
|
347
348
|
((ot = this.pathnameModifier) == null ? void 0 : ot.call(this, t)) || t
|
|
348
349
|
);
|
|
349
|
-
if (((lt = e(this, z)) == null ? void 0 : lt.pathname) ===
|
|
350
|
-
p(this, c, kt).call(this,
|
|
350
|
+
if (((lt = e(this, z)) == null ? void 0 : lt.pathname) === h.pathname || e(this, d).pathname === h.pathname) {
|
|
351
|
+
p(this, c, kt).call(this, h.hash || 0, {
|
|
351
352
|
centerScroll: i,
|
|
352
|
-
offsetScroll:
|
|
353
|
+
offsetScroll: u,
|
|
353
354
|
behavior: "smooth"
|
|
354
355
|
}), C(document, "morphSamePath", {
|
|
355
356
|
custom: !0
|
|
356
|
-
}), ((Ct = e(this,
|
|
357
|
-
action: ((Ht = e(this,
|
|
358
|
-
pathname:
|
|
359
|
-
searchParameters:
|
|
360
|
-
hash:
|
|
357
|
+
}), ((Ct = e(this, d)) == null ? void 0 : Ct.parameters) !== h.parameters && (r(this, j, e(this, d)), r(this, d, h), wt({
|
|
358
|
+
action: ((Ht = e(this, d)) == null ? void 0 : Ht.hash) !== h.hash ? "replace" : s,
|
|
359
|
+
pathname: h.pathname,
|
|
360
|
+
searchParameters: h.parameters,
|
|
361
|
+
hash: h.hash
|
|
361
362
|
}), C(document, "morphURLParametersChange", {
|
|
362
363
|
detail: {
|
|
363
|
-
newURL: e(this,
|
|
364
|
+
newURL: e(this, d),
|
|
364
365
|
previousURL: e(this, j)
|
|
365
366
|
}
|
|
366
367
|
}));
|
|
367
368
|
return;
|
|
368
369
|
}
|
|
369
|
-
r(this, z,
|
|
370
|
-
$.checkCurrent(
|
|
370
|
+
r(this, z, h), e(this, S).forEach(($) => {
|
|
371
|
+
$.checkCurrent(h.pathname);
|
|
371
372
|
});
|
|
372
373
|
try {
|
|
373
374
|
let $ = !0;
|
|
@@ -376,38 +377,38 @@ const st = class st {
|
|
|
376
377
|
yield new Promise((a, k) => {
|
|
377
378
|
var M;
|
|
378
379
|
(M = this.preprocessor) == null || M.call(this, {
|
|
379
|
-
url:
|
|
380
|
+
url: h,
|
|
380
381
|
resolve: a,
|
|
381
382
|
reject: k,
|
|
382
|
-
submorph:
|
|
383
|
+
submorph: g
|
|
383
384
|
});
|
|
384
385
|
});
|
|
385
386
|
} catch (a) {
|
|
386
387
|
a ? console.error(a) : console.log("Route change canceled"), $ = !1;
|
|
387
388
|
}
|
|
388
|
-
if (!$ || e(this, z).pathname !==
|
|
389
|
-
e(this,
|
|
390
|
-
a.checkCurrent(e(this,
|
|
389
|
+
if (!$ || e(this, z).pathname !== h.pathname) {
|
|
390
|
+
e(this, S).forEach((a) => {
|
|
391
|
+
a.checkCurrent(e(this, d).pathname);
|
|
391
392
|
});
|
|
392
393
|
return;
|
|
393
394
|
}
|
|
394
395
|
const Rt = {
|
|
395
|
-
url:
|
|
396
|
-
submorph:
|
|
396
|
+
url: h,
|
|
397
|
+
submorph: g
|
|
397
398
|
};
|
|
398
399
|
C(document, "morphNavigation", {
|
|
399
400
|
detail: Rt
|
|
400
401
|
});
|
|
401
|
-
const ft = p(this, c, dt).call(this, e(this,
|
|
402
|
+
const ft = p(this, c, dt).call(this, e(this, d).pathname), f = p(this, c, dt).call(this, h.pathname);
|
|
402
403
|
if (e(this, T).forEach((a) => {
|
|
403
|
-
a.pathname !==
|
|
404
|
-
}), yield f == null ? void 0 : f.fetch(t, e(this,
|
|
405
|
-
e(this,
|
|
406
|
-
a.checkCurrent(e(this,
|
|
404
|
+
a.pathname !== h.pathname && a.abort();
|
|
405
|
+
}), yield f == null ? void 0 : f.fetch(t, e(this, d).path, E), e(this, z).pathname !== h.pathname) {
|
|
406
|
+
e(this, S).forEach((a) => {
|
|
407
|
+
a.checkCurrent(e(this, d).path);
|
|
407
408
|
});
|
|
408
409
|
return;
|
|
409
410
|
}
|
|
410
|
-
ft.clearState(), ft.saveScrollState(), ft.saveDocumentState(), e(this, V) || (f.clearScrollState(), f.clearDocumentState()),
|
|
411
|
+
ft.clearState(), ft.saveScrollState(), ft.saveDocumentState(), e(this, V) || (f.clearScrollState(), f.clearDocumentState()), w && f.clearState(), f.cloneDocument(), e(this, K).textContent = f.title, document.body.appendChild(e(this, K));
|
|
411
412
|
const pt = gt(ut({}, Rt), {
|
|
412
413
|
document: f.document
|
|
413
414
|
});
|
|
@@ -416,7 +417,7 @@ const st = class st {
|
|
|
416
417
|
});
|
|
417
418
|
const Tt = Array.from(document.head.children), Mt = Array.from(f.document.head.children), xt = p(this, c, Xt).call(this, Tt, Mt), Bt = p(this, c, bt).call(this, Tt, xt), ht = p(this, c, bt).call(this, Mt, xt).filter((a) => !this.excludeHeadChild(a));
|
|
418
419
|
ht.forEach((a, k) => {
|
|
419
|
-
a.tagName === "SCRIPT" && (ht[k] = p(this, c,
|
|
420
|
+
a.tagName === "SCRIPT" && (ht[k] = p(this, c, vt).call(this, a));
|
|
420
421
|
}), ht.forEach((a) => {
|
|
421
422
|
document.head.appendChild(a);
|
|
422
423
|
});
|
|
@@ -453,37 +454,37 @@ const st = class st {
|
|
|
453
454
|
const Yt = p(this, c, yt).call(this, f.document.body);
|
|
454
455
|
e(this, A).morphInsideScrollContainer || p(this, c, At).call(this, f.document), document.documentElement.setAttribute(
|
|
455
456
|
"data-current-pathname",
|
|
456
|
-
|
|
457
|
+
h.pathname
|
|
457
458
|
), document.documentElement.setAttribute(
|
|
458
459
|
"data-current-leaf",
|
|
459
|
-
|
|
460
|
+
h.leaf
|
|
460
461
|
), wt({
|
|
461
462
|
action: s,
|
|
462
|
-
pathname:
|
|
463
|
-
searchParameters:
|
|
464
|
-
hash:
|
|
465
|
-
}), e(this, K).remove(), r(this, j, e(this,
|
|
463
|
+
pathname: h.pathname,
|
|
464
|
+
searchParameters: h.parameters || (b ? location.search : ""),
|
|
465
|
+
hash: h.hash
|
|
466
|
+
}), e(this, K).remove(), r(this, j, e(this, d)), r(this, d, h), e(this, Z).forEach((a, k) => {
|
|
466
467
|
const M = Yt[k], jt = getComputedStyle(a).getPropertyValue("--morph-duration");
|
|
467
468
|
let O = [], F = [];
|
|
468
|
-
|
|
469
|
-
const
|
|
470
|
-
|
|
469
|
+
g ? g.forEach((m) => {
|
|
470
|
+
const L = a.querySelector(m), x = M.querySelector(m);
|
|
471
|
+
L && x && (F.push(L), O.push(x));
|
|
471
472
|
}) : (O.push(...M.childNodes), F.push(...a.childNodes)), F.forEach((m) => {
|
|
472
473
|
m instanceof HTMLElement && (this.destroyOldLinks(m), m.classList.add("old"));
|
|
473
474
|
}), O.forEach((m) => {
|
|
474
475
|
m instanceof HTMLElement && (this.findNewLinks(m), m.classList.add("new"));
|
|
475
|
-
}),
|
|
476
|
+
}), g ? O.forEach((m, L) => {
|
|
476
477
|
var x;
|
|
477
|
-
(x = F[
|
|
478
|
+
(x = F[L].parentElement) == null || x.insertBefore(
|
|
478
479
|
m,
|
|
479
|
-
F[
|
|
480
|
+
F[L]
|
|
480
481
|
);
|
|
481
482
|
}) : a.prepend(...O), _t(() => {
|
|
482
483
|
F.forEach((m) => {
|
|
483
484
|
m instanceof HTMLElement && m.classList.add("old-idle");
|
|
484
485
|
}), O.forEach((m) => {
|
|
485
|
-
var
|
|
486
|
-
m instanceof HTMLElement && ((
|
|
486
|
+
var L;
|
|
487
|
+
m instanceof HTMLElement && ((L = m.parentElement) == null || L.style.setProperty(
|
|
487
488
|
"--new-content-height",
|
|
488
489
|
m.offsetHeight + "px"
|
|
489
490
|
), m.classList.add("new-idle"));
|
|
@@ -497,11 +498,11 @@ const st = class st {
|
|
|
497
498
|
});
|
|
498
499
|
const Kt = new Promise((m) => {
|
|
499
500
|
setTimeout(() => {
|
|
500
|
-
F.forEach((
|
|
501
|
+
F.forEach((L) => L.remove()), O.forEach((L) => {
|
|
501
502
|
var x;
|
|
502
|
-
|
|
503
|
+
L instanceof HTMLElement && ((x = L.parentElement) == null || x.style.removeProperty(
|
|
503
504
|
"--new-content-height"
|
|
504
|
-
),
|
|
505
|
+
), L.classList.remove("new-idle", "new"));
|
|
505
506
|
}), C(document, "morphOldChildrenRemoved", {
|
|
506
507
|
detail: ct
|
|
507
508
|
}), m();
|
|
@@ -516,12 +517,12 @@ const st = class st {
|
|
|
516
517
|
this.scrollValue.top + "px"
|
|
517
518
|
), C(document, "morphBeforeNavigationScroll", {
|
|
518
519
|
detail: f.scrollState
|
|
519
|
-
}),
|
|
520
|
+
}), h.hash ? (f.clearScrollState(), p(this, c, kt).call(this, h.hash, {
|
|
520
521
|
centerScroll: i,
|
|
521
|
-
offsetScroll:
|
|
522
|
+
offsetScroll: u
|
|
522
523
|
})) : e(this, V) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, I)), Nt.forEach((a) => a.remove()), r(this, I, []), e(this, Z).forEach((a) => {
|
|
523
524
|
a.querySelectorAll("script").forEach((M) => {
|
|
524
|
-
M.replaceWith(p(this, c,
|
|
525
|
+
M.replaceWith(p(this, c, vt).call(this, M));
|
|
525
526
|
});
|
|
526
527
|
}), C(document, "morphComplete", {
|
|
527
528
|
detail: pt
|
|
@@ -535,7 +536,7 @@ const st = class st {
|
|
|
535
536
|
});
|
|
536
537
|
}
|
|
537
538
|
addLink(t) {
|
|
538
|
-
e(this,
|
|
539
|
+
e(this, S).push(new Lt(t, this));
|
|
539
540
|
}
|
|
540
541
|
addLinks(t) {
|
|
541
542
|
t.forEach((s) => {
|
|
@@ -543,31 +544,31 @@ const st = class st {
|
|
|
543
544
|
});
|
|
544
545
|
}
|
|
545
546
|
removeLink(t) {
|
|
546
|
-
r(this,
|
|
547
|
+
r(this, S, e(this, S).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
|
|
547
548
|
}
|
|
548
549
|
destroyOldLinks(t) {
|
|
549
|
-
r(this,
|
|
550
|
+
r(this, S, e(this, S).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
550
551
|
}
|
|
551
552
|
findNewLinks(t) {
|
|
552
553
|
const s = [...t.querySelectorAll("a")].filter(
|
|
553
554
|
e(this, at)
|
|
554
555
|
);
|
|
555
|
-
e(this,
|
|
556
|
-
...s.map((i) => new
|
|
556
|
+
e(this, S).push(
|
|
557
|
+
...s.map((i) => new Lt(i, this))
|
|
557
558
|
);
|
|
558
559
|
}
|
|
559
560
|
findLinks() {
|
|
560
561
|
const t = [
|
|
561
562
|
...document.documentElement.querySelectorAll("a")
|
|
562
563
|
].filter(e(this, at));
|
|
563
|
-
e(this,
|
|
564
|
+
e(this, S).forEach((s) => s.destroy()), r(this, S, t.map((s) => new Lt(s, this)));
|
|
564
565
|
}
|
|
565
566
|
};
|
|
566
|
-
A = new WeakMap(), Z = new WeakMap(),
|
|
567
|
+
A = new WeakMap(), Z = new WeakMap(), S = new WeakMap(), z = new WeakMap(), d = new WeakMap(), j = new WeakMap(), I = new WeakMap(), V = new WeakMap(), y = new WeakMap(), nt = new WeakMap(), T = new WeakMap(), K = new WeakMap(), _ = new WeakMap(), tt = new WeakMap(), c = new WeakSet(), vt = function(t) {
|
|
567
568
|
const s = document.createElement("script");
|
|
568
569
|
for (let i = 0; i < t.attributes.length; i++) {
|
|
569
|
-
const
|
|
570
|
-
s.setAttribute(
|
|
570
|
+
const u = t.attributes[i];
|
|
571
|
+
s.setAttribute(u.name, u.value);
|
|
571
572
|
}
|
|
572
573
|
return t.hasAttribute("src") || (s.innerHTML = t.innerHTML), s;
|
|
573
574
|
}, at = new WeakMap(), dt = function(t) {
|
|
@@ -580,13 +581,13 @@ A = new WeakMap(), Z = new WeakMap(), g = new WeakMap(), z = new WeakMap(), u =
|
|
|
580
581
|
}, Xt = function(t, s) {
|
|
581
582
|
return t.filter(
|
|
582
583
|
(i) => s.find(
|
|
583
|
-
(
|
|
584
|
+
(u) => u.outerHTML === i.outerHTML
|
|
584
585
|
)
|
|
585
586
|
);
|
|
586
587
|
}, bt = function(t, s) {
|
|
587
588
|
return t.filter(
|
|
588
589
|
(i) => !s.find(
|
|
589
|
-
(
|
|
590
|
+
(u) => u.outerHTML === i.outerHTML
|
|
590
591
|
)
|
|
591
592
|
);
|
|
592
593
|
}, Pt = function(t) {
|