aptechka 0.77.4 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +329 -320
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var pe=Object.defineProperty,fe=Object.defineProperties;var ge=Object.getOwnPropertyDescriptors;var Zt=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var _t=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ee=h=>{throw TypeError(h)};var te=(h,e,s)=>e in h?pe(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,wt=(h,e)=>{for(var s in e||(e={}))Ee.call(e,s)&&te(h,s,e[s]);if(Zt)for(var s of Zt(e))be.call(e,s)&&te(h,s,e[s]);return h},Nt=(h,e)=>fe(h,ge(e));var qt=(h,e,s)=>e.has(h)||ee("Cannot "+s);var t=(h,e,s)=>(qt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(qt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),E=(h,e,s)=>(qt(h,e,"access private method"),s);var j=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{m(s.next(d))}catch(v){n(v)}},f=d=>{try{m(s.throw(d))}catch(v){n(v)}},m=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);m((s=s.apply(h,e)).next())});var se=(h,e,s)=>(e=h[_t("asyncIterator")])?e.call(h):(h=h[_t("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,m,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),m)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("../index-DekP7OZe.cjs"),D=require("../events-KVanG9sR.cjs"),ie=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const dt=require("../url-Dns-01WU.cjs"),ve=require("../math-GDWEqu7y.cjs"),Le=require("../css-value-parser/index.cjs"),Se=require("../string-DUXXtU8v.cjs");class re extends HTMLElement{connectedCallback(){const e={"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,a]of Object.entries(e))this.setAttribute(s,a)}}ne.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",re);var w,i,C,et,Ct,oe,mt,st;class Dt{constructor(e,s){l(this,C);l(this,w);l(this,i);l(this,mt,e=>{e.preventDefault(),E(this,C,oe).call(this)});l(this,st,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,w).prefetch(t(this,C,et),e),t(this,i).removeEventListener("pointerenter",t(this,st))});o(this,w,s),o(this,i,e),t(this,i).addEventListener("click",t(this,mt)),this.checkCurrent(location.href.replace(location.origin,""));const a=E(this,C,Ct).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,st))}get element(){return t(this,i)}checkCurrent(e){var v;const s=t(this,w).normalizePath(e),a=t(this,w).normalizePath(t(this,C,et));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(q=>s.pathname.includes(q))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=t(this,C,et).split("?"),f=new URLSearchParams(b),m=new URLSearchParams(location.search);let d=0;for(const[q]of m)f.has(q)&&m.get(q)===f.get(q)&&d++;d?(t(this,i).classList.toggle("all-params-matched",m.size===d),t(this,i).classList.toggle("some-params-matched",m.size!==d)):!m.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"))}updatePagination(e,s){const a=E(this,C,Ct).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const m=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",m),this.checkCurrent(m)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),m=e+(n?-1:1);f.searchParams.set("page",ve.clamp(m,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?m<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):m>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,mt)),t(this,i).removeEventListener("pointerenter",t(this,st)),t(this,i).classList.remove("current","exact","pagination-current")}}w=new WeakMap,i=new WeakMap,C=new WeakSet,et=function(){const e=new URL(t(this,i).href);return t(this,w).normalizePath(e.pathname+e.search+e.hash).path},Ct=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},oe=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,w).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?Le.cssValueParser.parse(b):void 0,m=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),q=t(this,i).getAttribute("data-scroll-behaviour"),ct=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,Ht=t(this,i).hasAttribute("data-clear-state");let Kt=t(this,C,et);if(t(this,i).hasAttribute("data-toggle-params")){const[c,yt]=t(this,C,et).split("?"),$=new URLSearchParams(yt),W=new URLSearchParams(location.search),tt=new URLSearchParams;for(const[S]of $)(!W.has(S)||W.has(S)&&W.get(S)!==$.get(S))&&tt.append(S,$.get(S));if(t(this,i).hasAttribute("data-merge-params"))for(const[S]of W)$.has(S)||tt.append(S,W.get(S));Kt=`${c}?${tt.toString()}`}const H=E(this,C,Ct).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));H&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,w).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),H.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,w).links.forEach(c=>{c.updatePagination(H.currentPage-1,H.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,w).links.forEach(c=>{c.updatePagination(H.currentPage+1,H.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,w).links.forEach(c=>{c.updatePagination(H.currentPage+1,H.selector)})),t(this,w).navigate(Kt,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:m,keepSearchParameters:d,submorph:ct,clearState:Ht,keepScrollPosition:v,scrollBehaviour:q,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},mt=new WeakMap,st=new WeakMap;const ye=new DOMParser;var z,G,R,I,J,F,it,Q,B,pt;class ae{constructor(e,s){l(this,z);l(this,G);l(this,R,{x:0,y:0});l(this,I,null);l(this,J,null);l(this,F,null);l(this,it,null);l(this,Q,null);l(this,B,null);l(this,pt);o(this,z,e),o(this,G,s)}get pathname(){return t(this,G)}get scrollState(){return t(this,R)}get document(){return t(this,F)}setHeaders(e){o(this,pt,e)}setInitialDocument(e){o(this,I,e.cloneNode(!0))}abort(){var e;return(e=t(this,Q))==null?void 0:e.abort(`[${t(this,G)}] page loading cancelled`)}fetch(e,s,a){return j(this,null,function*(){var n;if(!a){const m=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||m||d)return t(this,B)}return o(this,B,new Promise(b=>j(this,null,function*(){try{o(this,Q,new AbortController);const m=yield(yield fetch(e,{signal:t(this,Q).signal,headers:wt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,pt))})).text(),d=ye.parseFromString(m,"text/html");this.setInitialDocument(d)}catch(f){console.warn(f)}finally{o(this,Q,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,J)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,G)}return e}clearScrollState(){t(this,R).x=0,t(this,R).y=0}clearDocumentState(){o(this,J,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,R).x=0,t(this,R).y=0):(t(this,R).x=t(this,z).scrollValue.left,t(this,R).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,R).y,left:t(this,R).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,J,null):o(this,J,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,it,e)}clearState(){const e=t(this,it);return o(this,it,null),e}}z=new WeakMap,G=new WeakMap,R=new WeakMap,I=new WeakMap,J=new WeakMap,F=new WeakMap,it=new WeakMap,Q=new WeakMap,B=new WeakMap,pt=new WeakMap;var x,at,ft,zt,gt;class Ae{constructor(e){l(this,ft);l(this,x);l(this,at,[]);l(this,gt,()=>{E(this,ft,zt).call(this)});o(this,x,e);for(const s in t(this,x).dataset){const a=Se.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,x).dataset[s];t(this,at).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,gt)),E(this,ft,zt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,gt))}}x=new WeakMap,at=new WeakMap,ft=new WeakSet,zt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,at).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,x).hasAttribute("data-match-no-params")&&(s=!t(this,at).filter(n=>e.has(n.name)).length);const a=t(this,x).getAttribute("data-hide-class");s?a?t(this,x).classList.remove(a):t(this,x).style.display="":a?t(this,x).classList.add(a):t(this,x).style.display="none"},gt=new WeakMap;var N,nt,A,X,g,Z,K,Y,T,Et,V,bt,_,rt,ot,vt,ht,Lt,p,Vt,St,Rt,Wt,he,Ot,Ft,Bt,Xt,xt,lt;const ut=class ut{constructor(e){l(this,p);l(this,N,null);l(this,nt,null);l(this,A,[]);l(this,X);l(this,g,null);l(this,Z);l(this,K,[]);l(this,Y,!1);l(this,T,null);l(this,Et,!1);l(this,V,new Map);l(this,bt,[]);l(this,_,null);l(this,rt,0);l(this,ot,0);l(this,vt);l(this,ht);l(this,Lt);l(this,St,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,xt,e=>j(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ht)?void 0:t(this,vt),revalidate:t(this,ht),keepScrollPosition:t(this,Lt)}),o(this,Y,!1)}));l(this,lt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,ot),n=e-t(this,rt);o(this,ot,s),o(this,rt,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ne.isBrowser&&!ut.instance){ut.instance=this,o(this,N,{base:dt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,nt,E(this,p,Wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,g,s);const a=new ae(this,t(this,g).pathname);a.setInitialDocument(document),t(this,V).set(t(this,g).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,g).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,xt)),dt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,_,new re),E(this,p,Bt).call(this,document)}}get currentURL(){return t(this,g)}get previousURL(){return t(this,Z)}get links(){return t(this,A)}get scrollElement(){return t(this,T)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,Et)?(e=window.scrollY,s=window.scrollX):(e=t(this,T).scrollTop,s=t(this,T).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,V).get(t(this,g).path);s&&s.saveState(e)}getState(){const e=t(this,V).get(t(this,g).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return dt.splitPath(e,{base:t(this,N).base,trailingSlash:t(this,N).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return j(this,null,function*(){var n;if(t(this,K).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=E(this,p,Rt).call(this,e);a==null||a.fetch(e,t(this,g).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(Kt){return j(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:m,submorph:d,submorphAppend:v,clearState:q,keepScrollPosition:ct,mergeParams:Ht}={}){var yt,$,W,tt;if(t(this,K).length)return;o(this,vt,d),o(this,ht,f),o(this,Lt,ct);const H=((yt=this.pathnameModifier)==null?void 0:yt.call(this,e))||e,c=this.normalizePath(H,{mergeParams:Ht});if(!f&&((($=t(this,X))==null?void 0:$.pathname)===c.pathname||t(this,g).pathname===c.pathname)){ct||E(this,p,Xt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((W=t(this,g))==null?void 0:W.parameters)!==c.parameters&&(o(this,Z,t(this,g)),o(this,g,c),dt.changeHistory({action:((tt=t(this,g))==null?void 0:tt.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,g),previousURL:t(this,Z)}})),t(this,A).forEach(S=>{S.checkCurrent(c.path)});return}else t(this,A).forEach(S=>{S.checkCurrent(c.path)});o(this,X,c);try{let S=!0;if(this.preprocessor)try{yield new Promise((r,P)=>{var M;(M=this.preprocessor)==null||M.call(this,{url:c,resolve:r,reject:P,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),S=!1}if(!S||t(this,X).pathname!==c.pathname){t(this,A).forEach(r=>{r.checkCurrent(t(this,g).path)});return}const Yt={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,nt).forEach(r=>{var P,M;(P=r.firstElementChild)==null||P.classList.add("out"),(M=r.firstElementChild)==null||M.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:Yt});const Mt=E(this,p,Rt).call(this,t(this,g).pathname),y=E(this,p,Rt).call(this,c.pathname);if(t(this,V).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield y==null?void 0:y.fetch(H,t(this,g).path,f),t(this,X).pathname!==c.pathname){t(this,A).forEach(r=>{r.checkCurrent(t(this,g).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(y.clearScrollState(),y.clearDocumentState()),q&&y.clearState(),y.cloneDocument(),t(this,_).textContent=y.title,document.body.appendChild(t(this,_));const At=Nt(wt({},Yt),{document:y.document});v||At.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:At});const $t=Array.from(document.head.children),jt=Array.from(y.document.head.children),Gt=E(this,p,he).call(this,$t,jt),le=E(this,p,Ot).call(this,$t,Gt),Pt=E(this,p,Ot).call(this,jt,Gt).filter(r=>!this.excludeHeadChild(r));Pt.forEach((r,P)=>{r.tagName==="SCRIPT"&&(Pt[P]=E(this,p,Vt).call(this,r))}),Pt.forEach(r=>{document.head.appendChild(r)});const Tt=Pt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,p,Ft).call(this,r))return!0});t(this,N).waitForHeadToLoad&&Tt.length&&(yield new Promise(r=>j(this,null,function*(){let P=0;try{for(var M=se(Tt),de,O,U;de=!(O=yield M.next()).done;de=!1){const kt=O.value;kt.onload=()=>{P++,P===Tt.length&&r()}}}catch(O){U=[O]}finally{try{de&&(O=M.return)&&(yield O.call(M))}finally{if(U)throw U[0]}}}))),yield ie.wait(10);const Jt=[];v||le.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,p,Ft).call(this,r)?Jt.push(r):r.remove())});const ce=E(this,p,Wt).call(this,y.document.body);!t(this,N).morphInsideScrollContainer&&!d&&E(this,p,Bt).call(this,y.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),dt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(m?location.search:""),hash:c.hash}),t(this,_).remove(),o(this,Z,t(this,g)),o(this,g,c);const Ut=[];t(this,nt).forEach((r,P)=>{const M=ce[P],de=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],U=[];d?(d.forEach(u=>{const L=r.querySelector(u),k=M.querySelector(u);L&&k&&(U.push(L),O.push(k))}),U.forEach(u=>{u.parentElement&&Ut.push(u.parentElement)})):(O.push(...M.childNodes),U.push(...r.childNodes),Ut.push(r));const kt=[];v||U.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"),u.querySelectorAll("[data-morph-transfer]").forEach(k=>{const me=k.getAttribute("data-morph-transfer");kt.push({element:k.cloneNode(!0),selector:me})}))}),O.forEach(u=>{u instanceof HTMLElement&&(kt.forEach(L=>{const k=u.querySelector(L.selector);k&&k.replaceWith(L.element)}),this.findNewLinks(u),u.classList.add("new"))}),d?v?O.forEach((u,L)=>{U[L]instanceof HTMLElement&&U[L].append(...u.childNodes)}):O.forEach((u,L)=>{var k;(k=U[L].parentElement)==null||k.insertBefore(u,U[L])}):r.prepend(...O),setTimeout(()=>{v||U.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),O.forEach(u=>{var L;u instanceof HTMLElement&&((L=u.parentElement)==null||L.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})},0);const Qt=Nt(wt({},At),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Qt});const ue=new Promise(u=>{setTimeout(()=>{v||U.forEach(L=>{L.remove()}),O.forEach(L=>{var k;L instanceof HTMLElement&&((k=L.parentElement)==null||k.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Qt}),u()},(parseFloat(de)||0)*1e3+10)});t(this,K).push(ue)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-y.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:y.scrollState}),c.hash?(y.clearScrollState(),E(this,p,Xt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?y.restoreScrollPosition():ct||y.renewScrollPosition(),yield Promise.all(t(this,K)),v||Jt.forEach(r=>r.remove()),o(this,K,[]),Ut.forEach(r=>{r.querySelectorAll("script").forEach(M=>{M.replaceWith(E(this,p,Vt).call(this,M))})}),t(this,A).forEach(r=>{r.checkCurrent(t(this,g).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:At}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(S){console.error(S)}o(this,X,void 0)})}addLink(e){t(this,A).push(new Dt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,A,t(this,A).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,A,t(this,A).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,St));t(this,A).push(...s.map(a=>new Dt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,St));t(this,A).forEach(s=>s.destroy()),o(this,A,e.map(s=>new Dt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,bt).forEach(s=>s.destroy()),o(this,bt,e.map(s=>new Ae(s)))}};N=new WeakMap,nt=new WeakMap,A=new WeakMap,X=new WeakMap,g=new WeakMap,Z=new WeakMap,K=new WeakMap,Y=new WeakMap,T=new WeakMap,Et=new WeakMap,V=new WeakMap,bt=new WeakMap,_=new WeakMap,rt=new WeakMap,ot=new WeakMap,vt=new WeakMap,ht=new WeakMap,Lt=new WeakMap,p=new WeakSet,Vt=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},St=new WeakMap,Rt=function(e){const s=this.normalizePath(e);let a=t(this,V).get(s.pathname);return a||(a=new ae(this,s.pathname),t(this,V).set(s.pathname,a)),a},Wt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},he=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Ot=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Ft=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Bt=function(e){var s,a;(s=t(this,T))==null||s.removeEventListener("scroll",t(this,lt)),o(this,ot,0),o(this,rt,0),o(this,T,t(this,N).scrollSelector&&e.querySelector(t(this,N).scrollSelector)||window),o(this,Et,t(this,T)===window),(a=t(this,T))==null||a.addEventListener("scroll",t(this,lt)),t(this,lt).call(this)},Xt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ie.scrollToElement(a,{scrollElement:t(this,T),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},xt=new WeakMap,lt=new WeakMap,ut.instance=null;let It=ut;exports.Morph=It;
|
|
1
|
+
"use strict";var fe=Object.defineProperty,ge=Object.defineProperties;var Ee=Object.getOwnPropertyDescriptors;var Zt=Object.getOwnPropertySymbols;var be=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var _t=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),ee=h=>{throw TypeError(h)};var te=(h,e,s)=>e in h?fe(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Rt=(h,e)=>{for(var s in e||(e={}))be.call(e,s)&&te(h,s,e[s]);if(Zt)for(var s of Zt(e))ve.call(e,s)&&te(h,s,e[s]);return h},qt=(h,e)=>ge(h,Ee(e));var Dt=(h,e,s)=>e.has(h)||ee("Cannot "+s);var t=(h,e,s)=>(Dt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,a)=>(Dt(h,e,"write to private field"),a?a.call(h,s):e.set(h,s),s),E=(h,e,s)=>(Dt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((a,n)=>{var b=d=>{try{u(s.next(d))}catch(v){n(v)}},f=d=>{try{u(s.throw(d))}catch(v){n(v)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(b,f);u((s=s.apply(h,e)).next())});var se=(h,e,s)=>(e=h[_t("asyncIterator")])?e.call(h):(h=h[_t("iterator")](),e={},s=(a,n)=>(n=h[a])&&(e[a]=b=>new Promise((f,u,d)=>(b=n.call(h,b),d=b.done,Promise.resolve(b.value).then(v=>f({value:v,done:d}),u)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ne=require("../index-DekP7OZe.cjs"),D=require("../events-KVanG9sR.cjs"),ie=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const mt=require("../url-Dns-01WU.cjs"),re=require("../string-DUXXtU8v.cjs"),Le=require("../math-GDWEqu7y.cjs"),Se=require("../css-value-parser/index.cjs");class oe extends HTMLElement{connectedCallback(){const e={"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,a]of Object.entries(e))this.setAttribute(s,a)}}ne.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",oe);var R,i,x,at,xt,he,ft,nt;class zt{constructor(e,s){l(this,x);l(this,R);l(this,i);l(this,ft,e=>{e.preventDefault(),E(this,x,he).call(this)});l(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,R).prefetch(t(this,x,at),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});o(this,R,s),o(this,i,e),t(this,i).addEventListener("click",t(this,ft)),this.checkCurrent(location.href.replace(location.origin,""));const a=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));a&&this.updatePagination(a.currentPage,a.selector),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var v,et;const s=t(this,R).normalizePath(e),a=t(this,R).normalizePath(t(this,x,at));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(v=t(this,i).getAttribute("data-associated-paths"))!=null&&v.split(",").find(w=>s.pathname.includes(w))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[n,b]=(et=t(this,x,at).split("#")[0])==null?void 0:et.split("?"),f=new URLSearchParams(b),u=new URLSearchParams(location.search);let d=0;for(const[w]of u)f.has(w)&&u.get(w)===f.get(w)&&d++;d?(t(this,i).classList.toggle("all-params-matched",u.size===d),t(this,i).classList.toggle("some-params-matched",u.size!==d)):!u.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const w in t(this,i).dataset){const st=re.camelToKebab(w);if(st.startsWith("match-param-")){const $=st.split("match-param-")[1],y=t(this,i).dataset[w],c=`param-${$}-matched`;u.has($)&&u.get($)===y||!u.has($)&&(y===""||y==="*"||y==="all"||y==="any"||y==="vse")?t(this,i).classList.add(c):t(this,i).classList.remove(c)}}}updatePagination(e,s){const a=E(this,x,xt).call(this,s);if(a)if(a.element.setAttribute("data-current-page",e.toString()),t(this,i).hasAttribute("data-pagination-more-link"))if(e<a.totalPages){t(this,i).style.display="";const n=t(this,i).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(a.totalPages-e).toString());const b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin);f.searchParams.set("page",(e+1).toString());const u=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",u),this.checkCurrent(u)}else t(this,i).style.display="none";else if(t(this,i).hasAttribute("data-pagination-prev-link")||t(this,i).hasAttribute("data-pagination-next-link")){const n=t(this,i).hasAttribute("data-pagination-prev-link"),b=t(this,i).getAttribute("href"),f=new URL(b,window.location.origin),u=e+(n?-1:1);f.searchParams.set("page",Le.clamp(u,1,a.totalPages).toString());const d=f.href.replace(f.origin,"").toString();t(this,i).setAttribute("href",d),n?u<1?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex")):u>a.totalPages?(t(this,i).classList.add("pagination-disabled"),t(this,i).setAttribute("tabindex","-1")):(t(this,i).classList.remove("pagination-disabled"),t(this,i).removeAttribute("tabindex"))}else t(this,i).hasAttribute("data-pagination-set-link")&&(t(this,i).getAttribute("data-value")===e.toString()?t(this,i).classList.add("pagination-current"):t(this,i).classList.remove("pagination-current"))}destroy(){t(this,i).removeEventListener("click",t(this,ft)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact","pagination-current")}}R=new WeakMap,i=new WeakMap,x=new WeakSet,at=function(){const e=new URL(t(this,i).href);return t(this,R).normalizePath(e.pathname+e.search+e.hash).path},xt=function(e){if(!e)return;const s=document.querySelector(e);if(s){const a=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:a,totalPages:n,selector:e}}},he=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,R).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",n=t(this,i).hasAttribute("data-center-scroll"),b=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),f=b?Se.cssValueParser.parse(b):void 0,u=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),d=t(this,i).hasAttribute("data-keep-search-parameters"),v=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),et=t(this,i).getAttribute("data-scroll-behaviour"),w=((s=t(this,i).getAttribute("data-submorph"))==null?void 0:s.split(",").map(c=>c.trim()))||t(this,i).hasAttribute("data-pagination-more-link")&&[t(this,i).getAttribute("data-pagination-more-link")]||t(this,i).hasAttribute("data-pagination-set-link")&&[t(this,i).getAttribute("data-pagination-set-link")]||t(this,i).hasAttribute("data-pagination-next-link")&&[t(this,i).getAttribute("data-pagination-next-link")]||t(this,i).hasAttribute("data-pagination-prev-link")&&[t(this,i).getAttribute("data-pagination-prev-link")]||void 0,st=t(this,i).hasAttribute("data-clear-state");let $=t(this,x,at);if(t(this,i).hasAttribute("data-toggle-params")){const[c,Pt]=t(this,x,at).split("?"),j=new URLSearchParams(Pt),V=new URLSearchParams(location.search),it=new URLSearchParams;for(const[S]of j)(!V.has(S)||V.has(S)&&V.get(S)!==j.get(S))&&it.append(S,j.get(S));if(t(this,i).hasAttribute("data-merge-params"))for(const[S]of V)j.has(S)||it.append(S,V.get(S));$=`${c}?${it.toString()}`}const y=E(this,x,xt).call(this,t(this,i).getAttribute("data-pagination-set-link")||t(this,i).getAttribute("data-pagination-more-link")||t(this,i).getAttribute("data-pagination-next-link")||t(this,i).getAttribute("data-pagination-prev-link"));y&&(t(this,i).hasAttribute("data-pagination-set-link")?t(this,R).links.forEach(c=>{c.updatePagination(parseInt(t(this,i).getAttribute("data-value")||"1"),y.selector)}):t(this,i).hasAttribute("data-pagination-prev-link")?t(this,R).links.forEach(c=>{c.updatePagination(y.currentPage-1,y.selector)}):t(this,i).hasAttribute("data-pagination-next-link")?t(this,R).links.forEach(c=>{c.updatePagination(y.currentPage+1,y.selector)}):t(this,i).hasAttribute("data-pagination-more-link")&&t(this,R).links.forEach(c=>{c.updatePagination(y.currentPage+1,y.selector)})),t(this,R).navigate($,{historyAction:a,centerScroll:n,offsetScroll:f,revalidate:u,keepSearchParameters:d,submorph:w,clearState:st,keepScrollPosition:v,scrollBehaviour:et,submorphAppend:t(this,i).hasAttribute("data-pagination-more-link"),mergeParams:t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params")})}},ft=new WeakMap,nt=new WeakMap;const ye=new DOMParser;var z,J,H,I,Q,F,rt,Z,B,gt;class ae{constructor(e,s){l(this,z);l(this,J);l(this,H,{x:0,y:0});l(this,I,null);l(this,Q,null);l(this,F,null);l(this,rt,null);l(this,Z,null);l(this,B,null);l(this,gt);o(this,z,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,H)}get document(){return t(this,F)}setHeaders(e){o(this,gt,e)}setInitialDocument(e){o(this,I,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,a){return G(this,null,function*(){var n;if(!a){const u=((n=t(this,I))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,d=t(this,I)&&t(this,z).isPopstateNavigation;if(t(this,B)||u||d)return t(this,B)}return o(this,B,new Promise(b=>G(this,null,function*(){try{o(this,Z,new AbortController);const u=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,gt))})).text(),d=ye.parseFromString(u,"text/html");this.setInitialDocument(d)}catch(f){console.warn(f)}finally{o(this,Z,null),o(this,B,null),b()}}))),t(this,B)})}cloneDocument(){o(this,F,(t(this,Q)||t(this,I)).cloneNode(!0))}get title(){let e="";if(t(this,F).title)e=t(this,F).title;else{const s=t(this,F).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,H).x=0,t(this,H).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,I).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,H).x=0,t(this,H).y=0):(t(this,H).x=t(this,z).scrollValue.left,t(this,H).y=t(this,z).scrollValue.top)}restoreScrollPosition(){t(this,z).scrollElement.scroll({top:t(this,H).y,left:t(this,H).x,behavior:"instant"})}saveDocumentState(){t(this,I).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,z).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,rt,e)}clearState(){const e=t(this,rt);return o(this,rt,null),e}}z=new WeakMap,J=new WeakMap,H=new WeakMap,I=new WeakMap,Q=new WeakMap,F=new WeakMap,rt=new WeakMap,Z=new WeakMap,B=new WeakMap,gt=new WeakMap;var T,ot,Et,It,bt;class Ae{constructor(e){l(this,Et);l(this,T);l(this,ot,[]);l(this,bt,()=>{E(this,Et,It).call(this)});o(this,T,e);for(const s in t(this,T).dataset){const a=re.camelToKebab(s);if(a.startsWith("param-")){const n=a.split("param-")[1],b=t(this,T).dataset[s];t(this,ot).push({name:n,value:b})}}document.addEventListener("morphURLParametersChange",t(this,bt)),E(this,Et,It).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,bt))}}T=new WeakMap,ot=new WeakMap,Et=new WeakSet,It=function(){const e=new URLSearchParams(location.search);let s=!!t(this,ot).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,T).hasAttribute("data-match-no-params")&&(s=!t(this,ot).filter(n=>e.has(n.name)).length);const a=t(this,T).getAttribute("data-hide-class");s?a?t(this,T).classList.remove(a):t(this,T).style.display="":a?t(this,T).classList.add(a):t(this,T).style.display="none"},bt=new WeakMap;var q,ht,P,K,g,_,X,Y,U,vt,W,Lt,tt,lt,ct,St,dt,yt,p,Vt,At,Ht,Ot,le,Ft,Bt,Kt,Xt,Tt,ut;const pt=class pt{constructor(e){l(this,p);l(this,q,null);l(this,ht,null);l(this,P,[]);l(this,K);l(this,g,null);l(this,_);l(this,X,[]);l(this,Y,!1);l(this,U,null);l(this,vt,!1);l(this,W,new Map);l(this,Lt,[]);l(this,tt,null);l(this,lt,0);l(this,ct,0);l(this,St);l(this,dt);l(this,yt);l(this,At,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Tt,e=>G(this,null,function*(){e.preventDefault(),o(this,Y,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,dt)?void 0:t(this,St),revalidate:t(this,dt),keepScrollPosition:t(this,yt)}),o(this,Y,!1)}));l(this,ut,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,ct),n=e-t(this,lt);o(this,ct,s),o(this,lt,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),D.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ne.isBrowser&&!pt.instance){pt.instance=this,o(this,q,{base:mt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,ht,E(this,p,Ot).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,g,s);const a=new ae(this,t(this,g).pathname);a.setInitialDocument(document),t(this,W).set(t(this,g).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,g).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),mt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new oe),E(this,p,Kt).call(this,document)}}get currentURL(){return t(this,g)}get previousURL(){return t(this,_)}get links(){return t(this,P)}get scrollElement(){return t(this,U)}get isPopstateNavigation(){return t(this,Y)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,U).scrollTop,s=t(this,U).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,W).get(t(this,g).path);s&&s.saveState(e)}getState(){const e=t(this,W).get(t(this,g).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return mt.splitPath(e,{base:t(this,q).base,trailingSlash:t(this,q).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,X).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const a=E(this,p,Ht).call(this,e);a==null||a.fetch(e,t(this,g).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate($){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:n,scrollBehaviour:b,revalidate:f,keepSearchParameters:u,submorph:d,submorphAppend:v,clearState:et,keepScrollPosition:w,mergeParams:st}={}){var Pt,j,V,it;if(t(this,X).length)return;o(this,St,d),o(this,dt,f),o(this,yt,w);const y=((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,e))||e,c=this.normalizePath(y,{mergeParams:st});if(!f&&(((j=t(this,K))==null?void 0:j.pathname)===c.pathname||t(this,g).pathname===c.pathname)){w||E(this,p,Xt).call(this,c.hash||0,{centerScroll:a,offsetScroll:n,behavior:"smooth"}),D.dispatchEvent(document,"morphSamePath",{custom:!0}),((V=t(this,g))==null?void 0:V.parameters)!==c.parameters&&(o(this,_,t(this,g)),o(this,g,c),mt.changeHistory({action:((it=t(this,g))==null?void 0:it.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),D.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,g),previousURL:t(this,_)}})),t(this,P).forEach(S=>{S.checkCurrent(c.path)});return}else t(this,P).forEach(S=>{S.checkCurrent(c.path)});o(this,K,c);try{let S=!0;if(this.preprocessor)try{yield new Promise((r,k)=>{var M;(M=this.preprocessor)==null||M.call(this,{url:c,resolve:r,reject:k,submorph:d})})}catch(r){r?console.error(r):console.log("Route change canceled"),S=!1}if(!S||t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}const Yt={url:c,submorph:d};d?v||d.forEach(r=>{document.querySelectorAll(r).forEach(k=>{k.classList.add("out"),k.setAttribute("data-morph-out","")})}):t(this,ht).forEach(r=>{var k,M;(k=r.firstElementChild)==null||k.classList.add("out"),(M=r.firstElementChild)==null||M.setAttribute("data-morph-out","")}),D.dispatchEvent(document,"morphNavigation",{detail:Yt});const Mt=E(this,p,Ht).call(this,t(this,g).pathname),A=E(this,p,Ht).call(this,c.pathname);if(t(this,W).forEach(r=>{r.pathname!==c.pathname&&r.abort()}),yield A==null?void 0:A.fetch(y,t(this,g).path,f),t(this,K).pathname!==c.pathname){t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)});return}Mt.clearState(),Mt.saveScrollState(),Mt.saveDocumentState(),(!t(this,Y)||f)&&(A.clearScrollState(),A.clearDocumentState()),et&&A.clearState(),A.cloneDocument(),t(this,tt).textContent=A.title,document.body.appendChild(t(this,tt));const kt=qt(Rt({},Yt),{document:A.document});v||kt.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),D.dispatchEvent(document,"morphStart",{detail:kt});const $t=Array.from(document.head.children),jt=Array.from(A.document.head.children),Gt=E(this,p,le).call(this,$t,jt),ce=E(this,p,Ft).call(this,$t,Gt),wt=E(this,p,Ft).call(this,jt,Gt).filter(r=>!this.excludeHeadChild(r));wt.forEach((r,k)=>{r.tagName==="SCRIPT"&&(wt[k]=E(this,p,Vt).call(this,r))}),wt.forEach(r=>{document.head.appendChild(r)});const Ut=wt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,p,Bt).call(this,r))return!0});t(this,q).waitForHeadToLoad&&Ut.length&&(yield new Promise(r=>G(this,null,function*(){let k=0;try{for(var M=se(Ut),ue,O,N;ue=!(O=yield M.next()).done;ue=!1){const Ct=O.value;Ct.onload=()=>{k++,k===Ut.length&&r()}}}catch(O){N=[O]}finally{try{ue&&(O=M.return)&&(yield O.call(M))}finally{if(N)throw N[0]}}}))),yield ie.wait(10);const Jt=[];v||ce.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,p,Bt).call(this,r)?Jt.push(r):r.remove())});const de=E(this,p,Ot).call(this,A.document.body);!t(this,q).morphInsideScrollContainer&&!d&&E(this,p,Kt).call(this,A.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),mt.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(u?location.search:""),hash:c.hash}),t(this,tt).remove(),o(this,_,t(this,g)),o(this,g,c);const Nt=[];t(this,ht).forEach((r,k)=>{const M=de[k],ue=getComputedStyle(r).getPropertyValue("--morph-duration");let O=[],N=[];d?(d.forEach(m=>{const L=r.querySelector(m),C=M.querySelector(m);L&&C&&(N.push(L),O.push(C))}),N.forEach(m=>{m.parentElement&&Nt.push(m.parentElement)})):(O.push(...M.childNodes),N.push(...r.childNodes),Nt.push(r));const Ct=[];v||N.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"),m.querySelectorAll("[data-morph-transfer]").forEach(C=>{const pe=C.getAttribute("data-morph-transfer");Ct.push({element:C,selector:pe})}))}),O.forEach(m=>{m instanceof HTMLElement&&(Ct.forEach(L=>{const C=m.querySelector(L.selector);C&&C.replaceWith(A.document.importNode(L.element,!0))}),this.findNewLinks(m),m.classList.add("new"))}),d?v?O.forEach((m,L)=>{N[L]instanceof HTMLElement&&N[L].append(...m.childNodes)}):O.forEach((m,L)=>{var C;(C=N[L].parentElement)==null||C.insertBefore(m,N[L])}):r.prepend(...O),setTimeout(()=>{v||N.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var L;m instanceof HTMLElement&&((L=m.parentElement)==null||L.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})},0);const Qt=qt(Rt({},kt),{morphElement:r});D.dispatchEvent(document,"morphNewChildrenAdded",{detail:Qt});const me=new Promise(m=>{setTimeout(()=>{v||N.forEach(L=>{L.remove()}),O.forEach(L=>{var C;L instanceof HTMLElement&&((C=L.parentElement)==null||C.style.removeProperty("--new-content-height"),L.classList.remove("new-idle","new"))}),v||D.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Qt}),m()},(parseFloat(ue)||0)*1e3+10)});t(this,X).push(me)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-A.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),D.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:A.scrollState}),c.hash?(A.clearScrollState(),E(this,p,Xt).call(this,c.hash,{centerScroll:a,offsetScroll:n,behavior:b})):t(this,Y)?A.restoreScrollPosition():w||A.renewScrollPosition(),yield Promise.all(t(this,X)),v||Jt.forEach(r=>r.remove()),o(this,X,[]),Nt.forEach(r=>{r.querySelectorAll("script").forEach(M=>{M.replaceWith(E(this,p,Vt).call(this,M))})}),t(this,P).forEach(r=>{r.checkCurrent(t(this,g).path)}),this.findParamsDependent(),D.dispatchEvent(document,"morphComplete",{detail:kt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(S){console.error(S)}o(this,K,void 0)})}addLink(e){t(this,P).push(new zt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,P,t(this,P).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,P,t(this,P).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,At));t(this,P).push(...s.map(a=>new zt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,At));t(this,P).forEach(s=>s.destroy()),o(this,P,e.map(s=>new zt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,Lt).forEach(s=>s.destroy()),o(this,Lt,e.map(s=>new Ae(s)))}};q=new WeakMap,ht=new WeakMap,P=new WeakMap,K=new WeakMap,g=new WeakMap,_=new WeakMap,X=new WeakMap,Y=new WeakMap,U=new WeakMap,vt=new WeakMap,W=new WeakMap,Lt=new WeakMap,tt=new WeakMap,lt=new WeakMap,ct=new WeakMap,St=new WeakMap,dt=new WeakMap,yt=new WeakMap,p=new WeakSet,Vt=function(e){const s=document.createElement("script");for(let a=0;a<e.attributes.length;a++){const n=e.attributes[a];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},At=new WeakMap,Ht=function(e){const s=this.normalizePath(e);let a=t(this,W).get(s.pathname);return a||(a=new ae(this,s.pathname),t(this,W).set(s.pathname,a)),a},Ot=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},le=function(e,s){return e.filter(a=>s.find(n=>n.outerHTML===a.outerHTML))},Ft=function(e,s){return e.filter(a=>!s.find(n=>n.outerHTML===a.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Kt=function(e){var s,a;(s=t(this,U))==null||s.removeEventListener("scroll",t(this,ut)),o(this,ct,0),o(this,lt,0),o(this,U,t(this,q).scrollSelector&&e.querySelector(t(this,q).scrollSelector)||window),o(this,vt,t(this,U)===window),(a=t(this,U))==null||a.addEventListener("scroll",t(this,ut)),t(this,ut).call(this)},Xt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ie.scrollToElement(a,{scrollElement:t(this,U),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ut=new WeakMap,pt.instance=null;let Wt=pt;exports.Morph=Wt;
|
package/lib/morph/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var pe = Object.defineProperty, fe = Object.defineProperties;
|
|
2
|
+
var ge = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Qt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var be = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Zt = (h, e) => (e = Symbol[h]) ? e : Symbol.for("Symbol." + h), te = (h) => {
|
|
6
6
|
throw TypeError(h);
|
|
7
7
|
};
|
|
8
|
-
var _t = (h, e, s) => e in h ?
|
|
8
|
+
var _t = (h, e, s) => e in h ? pe(h, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : h[e] = s, Ct = (h, e) => {
|
|
9
9
|
for (var s in e || (e = {}))
|
|
10
|
-
|
|
10
|
+
be.call(e, s) && _t(h, s, e[s]);
|
|
11
11
|
if (Qt)
|
|
12
12
|
for (var s of Qt(e))
|
|
13
13
|
Ee.call(e, s) && _t(h, s, e[s]);
|
|
14
14
|
return h;
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var t = (h, e, s) => (
|
|
18
|
-
var
|
|
19
|
-
var
|
|
15
|
+
}, Nt = (h, e) => fe(h, ge(e));
|
|
16
|
+
var Dt = (h, e, s) => e.has(h) || te("Cannot " + s);
|
|
17
|
+
var t = (h, e, s) => (Dt(h, e, "read from private field"), s ? s.call(h) : e.get(h)), l = (h, e, s) => e.has(h) ? te("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(h) : e.set(h, s), o = (h, e, s, a) => (Dt(h, e, "write to private field"), a ? a.call(h, s) : e.set(h, s), s), b = (h, e, s) => (Dt(h, e, "access private method"), s);
|
|
18
|
+
var G = (h, e, s) => new Promise((a, n) => {
|
|
19
|
+
var E = (d) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
u(s.next(d));
|
|
22
22
|
} catch (v) {
|
|
23
23
|
n(v);
|
|
24
24
|
}
|
|
25
|
-
},
|
|
25
|
+
}, f = (d) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
u(s.throw(d));
|
|
28
28
|
} catch (v) {
|
|
29
29
|
n(v);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, u = (d) => d.done ? a(d.value) : Promise.resolve(d.value).then(E, f);
|
|
32
|
+
u((s = s.apply(h, e)).next());
|
|
33
33
|
});
|
|
34
|
-
var ee = (h, e, s) => (e = h[Zt("asyncIterator")]) ? e.call(h) : (h = h[Zt("iterator")](), e = {}, s = (a, n) => (n = h[a]) && (e[a] = (
|
|
34
|
+
var ee = (h, e, s) => (e = h[Zt("asyncIterator")]) ? e.call(h) : (h = h[Zt("iterator")](), e = {}, s = (a, n) => (n = h[a]) && (e[a] = (E) => new Promise((f, u, d) => (E = n.call(h, E), d = E.done, Promise.resolve(E.value).then((v) => f({ value: v, done: d }), u)))), s("next"), s("return"), e);
|
|
35
35
|
import { i as ae } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as z } from "../events-CsVF98U6.js";
|
|
37
|
-
import { w as
|
|
37
|
+
import { w as ve, s as Le } from "../scroll-DNGJVxa2.js";
|
|
38
38
|
import "construct-style-sheets-polyfill";
|
|
39
|
-
import { n as
|
|
39
|
+
import { n as Se, c as zt, s as ye } from "../url-CBKXmNOi.js";
|
|
40
|
+
import { c as ne } from "../string-BlMQbe8b.js";
|
|
40
41
|
import { c as Ae } from "../math-BOBiC4TN.js";
|
|
41
|
-
import { cssValueParser as
|
|
42
|
-
|
|
43
|
-
class ne extends HTMLElement {
|
|
42
|
+
import { cssValueParser as Pe } from "../css-value-parser/index.js";
|
|
43
|
+
class re extends HTMLElement {
|
|
44
44
|
connectedCallback() {
|
|
45
45
|
const e = {
|
|
46
46
|
"aria-live": "assertive",
|
|
@@ -51,48 +51,55 @@ class ne extends HTMLElement {
|
|
|
51
51
|
this.setAttribute(s, a);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
ae && !customElements.get("morph-announcer") && customElements.define("morph-announcer",
|
|
55
|
-
var
|
|
56
|
-
class
|
|
54
|
+
ae && !customElements.get("morph-announcer") && customElements.define("morph-announcer", re);
|
|
55
|
+
var R, i, x, at, Rt, oe, pt, nt;
|
|
56
|
+
class qt {
|
|
57
57
|
constructor(e, s) {
|
|
58
|
-
l(this,
|
|
59
|
-
l(this,
|
|
58
|
+
l(this, x);
|
|
59
|
+
l(this, R);
|
|
60
60
|
l(this, i);
|
|
61
|
-
l(this,
|
|
62
|
-
e.preventDefault(),
|
|
61
|
+
l(this, pt, (e) => {
|
|
62
|
+
e.preventDefault(), b(this, x, oe).call(this);
|
|
63
63
|
});
|
|
64
|
-
l(this,
|
|
64
|
+
l(this, nt, () => {
|
|
65
65
|
const e = t(this, i).hasAttribute("data-revalidate");
|
|
66
|
-
t(this,
|
|
66
|
+
t(this, R).prefetch(t(this, x, at), e), t(this, i).removeEventListener("pointerenter", t(this, nt));
|
|
67
67
|
});
|
|
68
|
-
o(this,
|
|
69
|
-
const a =
|
|
68
|
+
o(this, R, s), o(this, i, e), t(this, i).addEventListener("click", t(this, pt)), this.checkCurrent(location.href.replace(location.origin, ""));
|
|
69
|
+
const a = b(this, x, Rt).call(this, t(this, i).getAttribute("data-pagination-set-link") || t(this, i).getAttribute("data-pagination-more-link") || t(this, i).getAttribute("data-pagination-next-link") || t(this, i).getAttribute("data-pagination-prev-link"));
|
|
70
70
|
a && this.updatePagination(
|
|
71
71
|
a.currentPage,
|
|
72
72
|
a.selector
|
|
73
|
-
), t(this, i).hasAttribute("data-prefetch") && t(this, i).addEventListener("pointerenter", t(this,
|
|
73
|
+
), t(this, i).hasAttribute("data-prefetch") && t(this, i).addEventListener("pointerenter", t(this, nt));
|
|
74
74
|
}
|
|
75
75
|
get element() {
|
|
76
76
|
return t(this, i);
|
|
77
77
|
}
|
|
78
78
|
checkCurrent(e) {
|
|
79
|
-
var v;
|
|
80
|
-
const s = t(this,
|
|
81
|
-
t(this, i).hasAttribute("data-include") && s.pathname.includes(a.pathname) ? t(this, i).classList.add("current") : a.pathname === s.pathname ? t(this, i).classList.add("current") : (v = t(this, i).getAttribute("data-associated-paths")) != null && v.split(",").find((
|
|
82
|
-
const [n,
|
|
79
|
+
var v, et;
|
|
80
|
+
const s = t(this, R).normalizePath(e), a = t(this, R).normalizePath(t(this, x, at));
|
|
81
|
+
t(this, i).hasAttribute("data-include") && s.pathname.includes(a.pathname) ? t(this, i).classList.add("current") : a.pathname === s.pathname ? t(this, i).classList.add("current") : (v = t(this, i).getAttribute("data-associated-paths")) != null && v.split(",").find((w) => s.pathname.includes(w)) ? t(this, i).classList.add("current") : t(this, i).classList.remove("current"), s.path === a.path ? t(this, i).classList.add("exact") : t(this, i).classList.remove("exact");
|
|
82
|
+
const [n, E] = (et = t(this, x, at).split("#")[0]) == null ? void 0 : et.split("?"), f = new URLSearchParams(E), u = new URLSearchParams(location.search);
|
|
83
83
|
let d = 0;
|
|
84
|
-
for (const [
|
|
85
|
-
|
|
84
|
+
for (const [w] of u)
|
|
85
|
+
f.has(w) && u.get(w) === f.get(w) && d++;
|
|
86
86
|
d ? (t(this, i).classList.toggle(
|
|
87
87
|
"all-params-matched",
|
|
88
|
-
|
|
88
|
+
u.size === d
|
|
89
89
|
), t(this, i).classList.toggle(
|
|
90
90
|
"some-params-matched",
|
|
91
|
-
|
|
92
|
-
)) : !
|
|
91
|
+
u.size !== d
|
|
92
|
+
)) : !u.size && t(this, i).hasAttribute("data-match-no-params") ? t(this, i).classList.add("all-params-matched") : (t(this, i).classList.remove("all-params-matched"), t(this, i).classList.remove("some-params-matched"));
|
|
93
|
+
for (const w in t(this, i).dataset) {
|
|
94
|
+
const st = ne(w);
|
|
95
|
+
if (st.startsWith("match-param-")) {
|
|
96
|
+
const $ = st.split("match-param-")[1], y = t(this, i).dataset[w], c = `param-${$}-matched`;
|
|
97
|
+
u.has($) && u.get($) === y || !u.has($) && (y === "" || y === "*" || y === "all" || y === "any" || y === "vse") ? t(this, i).classList.add(c) : t(this, i).classList.remove(c);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
93
100
|
}
|
|
94
101
|
updatePagination(e, s) {
|
|
95
|
-
const a =
|
|
102
|
+
const a = b(this, x, Rt).call(this, s);
|
|
96
103
|
if (a)
|
|
97
104
|
if (a.element.setAttribute(
|
|
98
105
|
"data-current-page",
|
|
@@ -104,32 +111,32 @@ class zt {
|
|
|
104
111
|
"[data-pagination-more-link-counter]"
|
|
105
112
|
);
|
|
106
113
|
n && (n.textContent = (a.totalPages - e).toString());
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
t(this, i).setAttribute("href",
|
|
114
|
+
const E = t(this, i).getAttribute("href"), f = new URL(E, window.location.origin);
|
|
115
|
+
f.searchParams.set("page", (e + 1).toString());
|
|
116
|
+
const u = f.href.replace(f.origin, "").toString();
|
|
117
|
+
t(this, i).setAttribute("href", u), this.checkCurrent(u);
|
|
111
118
|
} else
|
|
112
119
|
t(this, i).style.display = "none";
|
|
113
120
|
else if (t(this, i).hasAttribute("data-pagination-prev-link") || t(this, i).hasAttribute("data-pagination-next-link")) {
|
|
114
|
-
const n = t(this, i).hasAttribute("data-pagination-prev-link"),
|
|
115
|
-
|
|
121
|
+
const n = t(this, i).hasAttribute("data-pagination-prev-link"), E = t(this, i).getAttribute("href"), f = new URL(E, window.location.origin), u = e + (n ? -1 : 1);
|
|
122
|
+
f.searchParams.set(
|
|
116
123
|
"page",
|
|
117
|
-
Ae(
|
|
124
|
+
Ae(u, 1, a.totalPages).toString()
|
|
118
125
|
);
|
|
119
|
-
const d =
|
|
120
|
-
t(this, i).setAttribute("href", d), n ?
|
|
126
|
+
const d = f.href.replace(f.origin, "").toString();
|
|
127
|
+
t(this, i).setAttribute("href", d), n ? u < 1 ? (t(this, i).classList.add("pagination-disabled"), t(this, i).setAttribute("tabindex", "-1")) : (t(this, i).classList.remove("pagination-disabled"), t(this, i).removeAttribute("tabindex")) : u > a.totalPages ? (t(this, i).classList.add("pagination-disabled"), t(this, i).setAttribute("tabindex", "-1")) : (t(this, i).classList.remove("pagination-disabled"), t(this, i).removeAttribute("tabindex"));
|
|
121
128
|
} else t(this, i).hasAttribute("data-pagination-set-link") && (t(this, i).getAttribute("data-value") === e.toString() ? t(this, i).classList.add("pagination-current") : t(this, i).classList.remove("pagination-current"));
|
|
122
129
|
}
|
|
123
130
|
destroy() {
|
|
124
|
-
t(this, i).removeEventListener("click", t(this,
|
|
131
|
+
t(this, i).removeEventListener("click", t(this, pt)), t(this, i).removeEventListener("pointerenter", t(this, nt)), t(this, i).classList.remove("current", "exact", "pagination-current");
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
|
-
|
|
134
|
+
R = new WeakMap(), i = new WeakMap(), x = new WeakSet(), at = function() {
|
|
128
135
|
const e = new URL(t(this, i).href);
|
|
129
|
-
return t(this,
|
|
136
|
+
return t(this, R).normalizePath(
|
|
130
137
|
e.pathname + e.search + e.hash
|
|
131
138
|
).path;
|
|
132
|
-
},
|
|
139
|
+
}, Rt = function(e) {
|
|
133
140
|
if (!e)
|
|
134
141
|
return;
|
|
135
142
|
const s = document.querySelector(e);
|
|
@@ -146,20 +153,20 @@ w = new WeakMap(), i = new WeakMap(), C = new WeakSet(), et = function() {
|
|
|
146
153
|
selector: e
|
|
147
154
|
};
|
|
148
155
|
}
|
|
149
|
-
},
|
|
156
|
+
}, oe = function() {
|
|
150
157
|
var s;
|
|
151
158
|
if (document.documentElement.classList.contains("click-disabled"))
|
|
152
159
|
return;
|
|
153
|
-
if (t(this, i).hasAttribute("data-back") && t(this,
|
|
160
|
+
if (t(this, i).hasAttribute("data-back") && t(this, R).previousURL)
|
|
154
161
|
history.back();
|
|
155
162
|
else {
|
|
156
163
|
const a = t(this, i).getAttribute(
|
|
157
164
|
"data-history-action"
|
|
158
|
-
) || "push", n = t(this, i).hasAttribute("data-center-scroll"),
|
|
165
|
+
) || "push", n = t(this, i).hasAttribute("data-center-scroll"), E = getComputedStyle(t(this, i)).getPropertyValue("--offset-scroll").trim(), f = E ? Pe.parse(E) : void 0, u = t(this, i).hasAttribute("data-revalidate") || t(this, i).hasAttribute("data-pagination-more-link") || t(this, i).hasAttribute("data-pagination-set-link") || t(this, i).hasAttribute("data-pagination-next-link") || t(this, i).hasAttribute("data-pagination-prev-link"), d = t(this, i).hasAttribute(
|
|
159
166
|
"data-keep-search-parameters"
|
|
160
|
-
), v = t(this, i).hasAttribute("data-keep-scroll-position") || t(this, i).hasAttribute("data-pagination-more-link"),
|
|
167
|
+
), v = t(this, i).hasAttribute("data-keep-scroll-position") || t(this, i).hasAttribute("data-pagination-more-link"), et = t(this, i).getAttribute(
|
|
161
168
|
"data-scroll-behaviour"
|
|
162
|
-
),
|
|
169
|
+
), w = ((s = t(this, i).getAttribute("data-submorph")) == null ? void 0 : s.split(",").map((c) => c.trim())) || t(this, i).hasAttribute("data-pagination-more-link") && [
|
|
163
170
|
t(this, i).getAttribute("data-pagination-more-link")
|
|
164
171
|
] || t(this, i).hasAttribute("data-pagination-set-link") && [
|
|
165
172
|
t(this, i).getAttribute("data-pagination-set-link")
|
|
@@ -167,120 +174,120 @@ w = new WeakMap(), i = new WeakMap(), C = new WeakSet(), et = function() {
|
|
|
167
174
|
t(this, i).getAttribute("data-pagination-next-link")
|
|
168
175
|
] || t(this, i).hasAttribute("data-pagination-prev-link") && [
|
|
169
176
|
t(this, i).getAttribute("data-pagination-prev-link")
|
|
170
|
-
] || void 0,
|
|
171
|
-
let
|
|
177
|
+
] || void 0, st = t(this, i).hasAttribute("data-clear-state");
|
|
178
|
+
let $ = t(this, x, at);
|
|
172
179
|
if (t(this, i).hasAttribute("data-toggle-params")) {
|
|
173
|
-
const [c,
|
|
174
|
-
for (const [S] of
|
|
175
|
-
(!V.has(S) || V.has(S) && V.get(S) !==
|
|
180
|
+
const [c, At] = t(this, x, at).split("?"), j = new URLSearchParams(At), V = new URLSearchParams(location.search), it = new URLSearchParams();
|
|
181
|
+
for (const [S] of j)
|
|
182
|
+
(!V.has(S) || V.has(S) && V.get(S) !== j.get(S)) && it.append(S, j.get(S));
|
|
176
183
|
if (t(this, i).hasAttribute("data-merge-params"))
|
|
177
184
|
for (const [S] of V)
|
|
178
|
-
|
|
179
|
-
|
|
185
|
+
j.has(S) || it.append(S, V.get(S));
|
|
186
|
+
$ = `${c}?${it.toString()}`;
|
|
180
187
|
}
|
|
181
|
-
const
|
|
182
|
-
|
|
188
|
+
const y = b(this, x, Rt).call(this, t(this, i).getAttribute("data-pagination-set-link") || t(this, i).getAttribute("data-pagination-more-link") || t(this, i).getAttribute("data-pagination-next-link") || t(this, i).getAttribute("data-pagination-prev-link"));
|
|
189
|
+
y && (t(this, i).hasAttribute("data-pagination-set-link") ? t(this, R).links.forEach((c) => {
|
|
183
190
|
c.updatePagination(
|
|
184
191
|
parseInt(t(this, i).getAttribute("data-value") || "1"),
|
|
185
|
-
|
|
192
|
+
y.selector
|
|
186
193
|
);
|
|
187
|
-
}) : t(this, i).hasAttribute("data-pagination-prev-link") ? t(this,
|
|
194
|
+
}) : t(this, i).hasAttribute("data-pagination-prev-link") ? t(this, R).links.forEach((c) => {
|
|
188
195
|
c.updatePagination(
|
|
189
|
-
|
|
190
|
-
|
|
196
|
+
y.currentPage - 1,
|
|
197
|
+
y.selector
|
|
191
198
|
);
|
|
192
|
-
}) : t(this, i).hasAttribute("data-pagination-next-link") ? t(this,
|
|
199
|
+
}) : t(this, i).hasAttribute("data-pagination-next-link") ? t(this, R).links.forEach((c) => {
|
|
193
200
|
c.updatePagination(
|
|
194
|
-
|
|
195
|
-
|
|
201
|
+
y.currentPage + 1,
|
|
202
|
+
y.selector
|
|
196
203
|
);
|
|
197
|
-
}) : t(this, i).hasAttribute("data-pagination-more-link") && t(this,
|
|
204
|
+
}) : t(this, i).hasAttribute("data-pagination-more-link") && t(this, R).links.forEach((c) => {
|
|
198
205
|
c.updatePagination(
|
|
199
|
-
|
|
200
|
-
|
|
206
|
+
y.currentPage + 1,
|
|
207
|
+
y.selector
|
|
201
208
|
);
|
|
202
|
-
})), t(this,
|
|
209
|
+
})), t(this, R).navigate($, {
|
|
203
210
|
historyAction: a,
|
|
204
211
|
centerScroll: n,
|
|
205
|
-
offsetScroll:
|
|
206
|
-
revalidate:
|
|
212
|
+
offsetScroll: f,
|
|
213
|
+
revalidate: u,
|
|
207
214
|
keepSearchParameters: d,
|
|
208
|
-
submorph:
|
|
209
|
-
clearState:
|
|
215
|
+
submorph: w,
|
|
216
|
+
clearState: st,
|
|
210
217
|
keepScrollPosition: v,
|
|
211
|
-
scrollBehaviour:
|
|
218
|
+
scrollBehaviour: et,
|
|
212
219
|
submorphAppend: t(this, i).hasAttribute("data-pagination-more-link"),
|
|
213
220
|
mergeParams: t(this, i).hasAttribute("data-merge-params") && !t(this, i).hasAttribute("data-toggle-params")
|
|
214
221
|
});
|
|
215
222
|
}
|
|
216
|
-
},
|
|
223
|
+
}, pt = new WeakMap(), nt = new WeakMap();
|
|
217
224
|
const ke = new DOMParser();
|
|
218
|
-
var q,
|
|
225
|
+
var q, J, H, I, Q, O, rt, Z, B, ft;
|
|
219
226
|
class se {
|
|
220
227
|
constructor(e, s) {
|
|
221
228
|
l(this, q);
|
|
222
|
-
l(this,
|
|
223
|
-
l(this,
|
|
229
|
+
l(this, J);
|
|
230
|
+
l(this, H, { x: 0, y: 0 });
|
|
224
231
|
l(this, I, null);
|
|
225
|
-
l(this, J, null);
|
|
226
|
-
l(this, O, null);
|
|
227
|
-
l(this, it, null);
|
|
228
232
|
l(this, Q, null);
|
|
233
|
+
l(this, O, null);
|
|
234
|
+
l(this, rt, null);
|
|
235
|
+
l(this, Z, null);
|
|
229
236
|
l(this, B, null);
|
|
230
|
-
l(this,
|
|
231
|
-
o(this, q, e), o(this,
|
|
237
|
+
l(this, ft);
|
|
238
|
+
o(this, q, e), o(this, J, s);
|
|
232
239
|
}
|
|
233
240
|
get pathname() {
|
|
234
|
-
return t(this,
|
|
241
|
+
return t(this, J);
|
|
235
242
|
}
|
|
236
243
|
get scrollState() {
|
|
237
|
-
return t(this,
|
|
244
|
+
return t(this, H);
|
|
238
245
|
}
|
|
239
246
|
get document() {
|
|
240
247
|
return t(this, O);
|
|
241
248
|
}
|
|
242
249
|
setHeaders(e) {
|
|
243
|
-
o(this,
|
|
250
|
+
o(this, ft, e);
|
|
244
251
|
}
|
|
245
252
|
setInitialDocument(e) {
|
|
246
253
|
o(this, I, e.cloneNode(!0));
|
|
247
254
|
}
|
|
248
255
|
abort() {
|
|
249
256
|
var e;
|
|
250
|
-
return (e = t(this,
|
|
251
|
-
`[${t(this,
|
|
257
|
+
return (e = t(this, Z)) == null ? void 0 : e.abort(
|
|
258
|
+
`[${t(this, J)}] page loading cancelled`
|
|
252
259
|
);
|
|
253
260
|
}
|
|
254
261
|
fetch(e, s, a) {
|
|
255
|
-
return
|
|
262
|
+
return G(this, null, function* () {
|
|
256
263
|
var n;
|
|
257
264
|
if (!a) {
|
|
258
|
-
const
|
|
259
|
-
if (t(this, B) ||
|
|
265
|
+
const u = ((n = t(this, I)) == null ? void 0 : n.documentElement.getAttribute("data-cache")) && s !== e, d = t(this, I) && t(this, q).isPopstateNavigation;
|
|
266
|
+
if (t(this, B) || u || d)
|
|
260
267
|
return t(this, B);
|
|
261
268
|
}
|
|
262
|
-
return o(this, B, new Promise((
|
|
269
|
+
return o(this, B, new Promise((E) => G(this, null, function* () {
|
|
263
270
|
try {
|
|
264
|
-
o(this,
|
|
265
|
-
const
|
|
266
|
-
signal: t(this,
|
|
267
|
-
headers:
|
|
271
|
+
o(this, Z, new AbortController());
|
|
272
|
+
const u = yield (yield fetch(e, {
|
|
273
|
+
signal: t(this, Z).signal,
|
|
274
|
+
headers: Ct({
|
|
268
275
|
"X-MORPH": "true",
|
|
269
276
|
"X-MORPH-CURRENT-PATH": encodeURIComponent(s),
|
|
270
277
|
"X-MORPH-NEW-PATH": encodeURIComponent(e)
|
|
271
|
-
}, t(this,
|
|
272
|
-
})).text(), d = ke.parseFromString(
|
|
278
|
+
}, t(this, ft))
|
|
279
|
+
})).text(), d = ke.parseFromString(u, "text/html");
|
|
273
280
|
this.setInitialDocument(d);
|
|
274
|
-
} catch (
|
|
275
|
-
console.warn(
|
|
281
|
+
} catch (f) {
|
|
282
|
+
console.warn(f);
|
|
276
283
|
} finally {
|
|
277
|
-
o(this,
|
|
284
|
+
o(this, Z, null), o(this, B, null), E();
|
|
278
285
|
}
|
|
279
286
|
}))), t(this, B);
|
|
280
287
|
});
|
|
281
288
|
}
|
|
282
289
|
cloneDocument() {
|
|
283
|
-
o(this, O, (t(this,
|
|
290
|
+
o(this, O, (t(this, Q) || t(this, I)).cloneNode(!0));
|
|
284
291
|
}
|
|
285
292
|
get title() {
|
|
286
293
|
let e = "";
|
|
@@ -288,32 +295,32 @@ class se {
|
|
|
288
295
|
e = t(this, O).title;
|
|
289
296
|
else {
|
|
290
297
|
const s = t(this, O).querySelector("h1");
|
|
291
|
-
e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this,
|
|
298
|
+
e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this, J);
|
|
292
299
|
}
|
|
293
300
|
return e;
|
|
294
301
|
}
|
|
295
302
|
clearScrollState() {
|
|
296
|
-
t(this,
|
|
303
|
+
t(this, H).x = 0, t(this, H).y = 0;
|
|
297
304
|
}
|
|
298
305
|
clearDocumentState() {
|
|
299
|
-
o(this,
|
|
306
|
+
o(this, Q, null);
|
|
300
307
|
}
|
|
301
308
|
saveScrollState() {
|
|
302
309
|
t(this, I).documentElement.hasAttribute(
|
|
303
310
|
"data-no-scroll-restoration"
|
|
304
|
-
) ? (t(this,
|
|
311
|
+
) ? (t(this, H).x = 0, t(this, H).y = 0) : (t(this, H).x = t(this, q).scrollValue.left, t(this, H).y = t(this, q).scrollValue.top);
|
|
305
312
|
}
|
|
306
313
|
restoreScrollPosition() {
|
|
307
314
|
t(this, q).scrollElement.scroll({
|
|
308
|
-
top: t(this,
|
|
309
|
-
left: t(this,
|
|
315
|
+
top: t(this, H).y,
|
|
316
|
+
left: t(this, H).x,
|
|
310
317
|
behavior: "instant"
|
|
311
318
|
});
|
|
312
319
|
}
|
|
313
320
|
saveDocumentState() {
|
|
314
321
|
t(this, I).documentElement.hasAttribute(
|
|
315
322
|
"data-no-page-restoration"
|
|
316
|
-
) ? o(this,
|
|
323
|
+
) ? o(this, Q, null) : o(this, Q, document.cloneNode(!0));
|
|
317
324
|
}
|
|
318
325
|
renewScrollPosition() {
|
|
319
326
|
t(this, q).scrollElement.scroll({
|
|
@@ -323,90 +330,90 @@ class se {
|
|
|
323
330
|
});
|
|
324
331
|
}
|
|
325
332
|
saveState(e) {
|
|
326
|
-
o(this,
|
|
333
|
+
o(this, rt, e);
|
|
327
334
|
}
|
|
328
335
|
clearState() {
|
|
329
|
-
const e = t(this,
|
|
330
|
-
return o(this,
|
|
336
|
+
const e = t(this, rt);
|
|
337
|
+
return o(this, rt, null), e;
|
|
331
338
|
}
|
|
332
339
|
}
|
|
333
|
-
q = new WeakMap(),
|
|
334
|
-
var
|
|
340
|
+
q = new WeakMap(), J = new WeakMap(), H = new WeakMap(), I = new WeakMap(), Q = new WeakMap(), O = new WeakMap(), rt = new WeakMap(), Z = new WeakMap(), B = new WeakMap(), ft = new WeakMap();
|
|
341
|
+
var U, ot, gt, It, bt;
|
|
335
342
|
class we {
|
|
336
343
|
constructor(e) {
|
|
337
|
-
l(this,
|
|
338
|
-
l(this,
|
|
339
|
-
l(this,
|
|
340
|
-
l(this,
|
|
341
|
-
|
|
344
|
+
l(this, gt);
|
|
345
|
+
l(this, U);
|
|
346
|
+
l(this, ot, []);
|
|
347
|
+
l(this, bt, () => {
|
|
348
|
+
b(this, gt, It).call(this);
|
|
342
349
|
});
|
|
343
|
-
o(this,
|
|
344
|
-
for (const s in t(this,
|
|
345
|
-
const a =
|
|
350
|
+
o(this, U, e);
|
|
351
|
+
for (const s in t(this, U).dataset) {
|
|
352
|
+
const a = ne(s);
|
|
346
353
|
if (a.startsWith("param-")) {
|
|
347
|
-
const n = a.split("param-")[1],
|
|
348
|
-
t(this,
|
|
354
|
+
const n = a.split("param-")[1], E = t(this, U).dataset[s];
|
|
355
|
+
t(this, ot).push({
|
|
349
356
|
name: n,
|
|
350
|
-
value:
|
|
357
|
+
value: E
|
|
351
358
|
});
|
|
352
359
|
}
|
|
353
360
|
}
|
|
354
361
|
document.addEventListener(
|
|
355
362
|
"morphURLParametersChange",
|
|
356
|
-
t(this,
|
|
357
|
-
),
|
|
363
|
+
t(this, bt)
|
|
364
|
+
), b(this, gt, It).call(this);
|
|
358
365
|
}
|
|
359
366
|
destroy() {
|
|
360
367
|
document.removeEventListener(
|
|
361
368
|
"morphURLParametersChange",
|
|
362
|
-
t(this,
|
|
369
|
+
t(this, bt)
|
|
363
370
|
);
|
|
364
371
|
}
|
|
365
372
|
}
|
|
366
|
-
|
|
373
|
+
U = new WeakMap(), ot = new WeakMap(), gt = new WeakSet(), It = function() {
|
|
367
374
|
const e = new URLSearchParams(location.search);
|
|
368
|
-
let s = !!t(this,
|
|
369
|
-
!s && t(this,
|
|
370
|
-
const a = t(this,
|
|
371
|
-
s ? a ? t(this,
|
|
372
|
-
},
|
|
373
|
-
var
|
|
374
|
-
const
|
|
375
|
+
let s = !!t(this, ot).find((n) => e.has(n.name) && (e.get(n.name) === n.value || n.value === "*" || n.value === "all" || n.value === "any" || n.value === "vse" || e.get(n.name) === "*" || e.get(n.name) === "all" || e.get(n.name) === "any" || e.get(n.name) === "vse"));
|
|
376
|
+
!s && t(this, U).hasAttribute("data-match-no-params") && (s = !t(this, ot).filter((n) => e.has(n.name)).length);
|
|
377
|
+
const a = t(this, U).getAttribute("data-hide-class");
|
|
378
|
+
s ? a ? t(this, U).classList.remove(a) : t(this, U).style.display = "" : a ? t(this, U).classList.add(a) : t(this, U).style.display = "none";
|
|
379
|
+
}, bt = new WeakMap();
|
|
380
|
+
var D, ht, P, X, g, _, K, Y, M, Et, W, vt, tt, lt, ct, Lt, dt, St, p, Wt, yt, xt, Vt, he, Ft, Ot, Bt, Xt, Ht, ut;
|
|
381
|
+
const mt = class mt {
|
|
375
382
|
constructor(e) {
|
|
376
|
-
l(this,
|
|
377
|
-
l(this,
|
|
378
|
-
l(this,
|
|
379
|
-
l(this,
|
|
383
|
+
l(this, p);
|
|
384
|
+
l(this, D, null);
|
|
385
|
+
l(this, ht, null);
|
|
386
|
+
l(this, P, []);
|
|
380
387
|
l(this, X);
|
|
381
388
|
l(this, g, null);
|
|
382
|
-
l(this,
|
|
389
|
+
l(this, _);
|
|
383
390
|
l(this, K, []);
|
|
384
391
|
l(this, Y, !1);
|
|
385
|
-
l(this,
|
|
386
|
-
l(this,
|
|
392
|
+
l(this, M, null);
|
|
393
|
+
l(this, Et, !1);
|
|
387
394
|
l(this, W, /* @__PURE__ */ new Map());
|
|
388
|
-
l(this,
|
|
389
|
-
l(this,
|
|
390
|
-
l(this,
|
|
391
|
-
l(this,
|
|
392
|
-
l(this,
|
|
393
|
-
l(this,
|
|
394
|
-
l(this,
|
|
395
|
-
l(this,
|
|
395
|
+
l(this, vt, []);
|
|
396
|
+
l(this, tt, null);
|
|
397
|
+
l(this, lt, 0);
|
|
398
|
+
l(this, ct, 0);
|
|
399
|
+
l(this, Lt);
|
|
400
|
+
l(this, dt);
|
|
401
|
+
l(this, St);
|
|
402
|
+
l(this, yt, (e) => {
|
|
396
403
|
var s, a;
|
|
397
404
|
return (((s = e.getAttribute("href")) == null ? void 0 : s.startsWith("/")) || ((a = e.getAttribute("href")) == null ? void 0 : a.startsWith("?"))) && !e.hasAttribute("download") && !e.hasAttribute("data-morph-skip") && !e.closest("[data-morph-skip]") && e.getAttribute("target") !== "_blank";
|
|
398
405
|
});
|
|
399
|
-
l(this,
|
|
406
|
+
l(this, Ht, (e) => G(this, null, function* () {
|
|
400
407
|
e.preventDefault(), o(this, Y, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
401
408
|
historyAction: "none",
|
|
402
|
-
submorph: t(this,
|
|
403
|
-
revalidate: t(this,
|
|
404
|
-
keepScrollPosition: t(this,
|
|
409
|
+
submorph: t(this, dt) ? void 0 : t(this, Lt),
|
|
410
|
+
revalidate: t(this, dt),
|
|
411
|
+
keepScrollPosition: t(this, St)
|
|
405
412
|
}), o(this, Y, !1);
|
|
406
413
|
}));
|
|
407
|
-
l(this,
|
|
408
|
-
const { left: e, top: s } = this.scrollValue, a = s - t(this,
|
|
409
|
-
o(this,
|
|
414
|
+
l(this, ut, () => {
|
|
415
|
+
const { left: e, top: s } = this.scrollValue, a = s - t(this, ct), n = e - t(this, lt);
|
|
416
|
+
o(this, ct, s), o(this, lt, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
|
|
410
417
|
"scroll-y-forward",
|
|
411
418
|
a > 0
|
|
412
419
|
), document.documentElement.classList.toggle(
|
|
@@ -425,14 +432,14 @@ const dt = class dt {
|
|
|
425
432
|
}
|
|
426
433
|
});
|
|
427
434
|
});
|
|
428
|
-
if (ae && !
|
|
429
|
-
|
|
430
|
-
base:
|
|
435
|
+
if (ae && !mt.instance) {
|
|
436
|
+
mt.instance = this, o(this, D, {
|
|
437
|
+
base: Se(e == null ? void 0 : e.base),
|
|
431
438
|
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
432
439
|
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
433
440
|
scrollSelector: e == null ? void 0 : e.scrollSelector,
|
|
434
441
|
morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
|
|
435
|
-
}), o(this,
|
|
442
|
+
}), o(this, ht, b(this, p, Vt).call(this, document.body));
|
|
436
443
|
const s = this.normalizePath(
|
|
437
444
|
location.pathname + location.search + location.hash
|
|
438
445
|
);
|
|
@@ -444,32 +451,32 @@ const dt = class dt {
|
|
|
444
451
|
), document.documentElement.setAttribute(
|
|
445
452
|
"data-current-leaf",
|
|
446
453
|
s.leaf
|
|
447
|
-
), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", t(this,
|
|
454
|
+
), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", t(this, Ht)), zt({
|
|
448
455
|
action: "replace",
|
|
449
456
|
pathname: s.pathname,
|
|
450
457
|
searchParameters: s.parameters,
|
|
451
458
|
hash: s.hash
|
|
452
|
-
}), o(this,
|
|
459
|
+
}), o(this, tt, new re()), b(this, p, Bt).call(this, document);
|
|
453
460
|
}
|
|
454
461
|
}
|
|
455
462
|
get currentURL() {
|
|
456
463
|
return t(this, g);
|
|
457
464
|
}
|
|
458
465
|
get previousURL() {
|
|
459
|
-
return t(this,
|
|
466
|
+
return t(this, _);
|
|
460
467
|
}
|
|
461
468
|
get links() {
|
|
462
|
-
return t(this,
|
|
469
|
+
return t(this, P);
|
|
463
470
|
}
|
|
464
471
|
get scrollElement() {
|
|
465
|
-
return t(this,
|
|
472
|
+
return t(this, M);
|
|
466
473
|
}
|
|
467
474
|
get isPopstateNavigation() {
|
|
468
475
|
return t(this, Y);
|
|
469
476
|
}
|
|
470
477
|
get scrollValue() {
|
|
471
478
|
let e = 0, s = 0;
|
|
472
|
-
return t(this,
|
|
479
|
+
return t(this, Et) ? (e = window.scrollY, s = window.scrollX) : (e = t(this, M).scrollTop, s = t(this, M).scrollLeft), { top: e, left: s };
|
|
473
480
|
}
|
|
474
481
|
saveState(e) {
|
|
475
482
|
const s = t(this, W).get(t(this, g).path);
|
|
@@ -480,19 +487,19 @@ const dt = class dt {
|
|
|
480
487
|
return e == null ? void 0 : e.clearState();
|
|
481
488
|
}
|
|
482
489
|
normalizePath(e, s) {
|
|
483
|
-
return
|
|
484
|
-
base: t(this,
|
|
485
|
-
trailingSlash: t(this,
|
|
490
|
+
return ye(e, {
|
|
491
|
+
base: t(this, D).base,
|
|
492
|
+
trailingSlash: t(this, D).trailingSlash,
|
|
486
493
|
mergeParams: s != null && s.mergeParams ? location.search : ""
|
|
487
494
|
});
|
|
488
495
|
}
|
|
489
496
|
prefetch(e, s) {
|
|
490
|
-
return
|
|
497
|
+
return G(this, null, function* () {
|
|
491
498
|
var n;
|
|
492
499
|
if (t(this, K).length)
|
|
493
500
|
return;
|
|
494
501
|
e = ((n = this.pathnameModifier) == null ? void 0 : n.call(this, e)) || e;
|
|
495
|
-
const a =
|
|
502
|
+
const a = b(this, p, xt).call(this, e);
|
|
496
503
|
a == null || a.fetch(e, t(this, g).path, s);
|
|
497
504
|
});
|
|
498
505
|
}
|
|
@@ -501,50 +508,50 @@ const dt = class dt {
|
|
|
501
508
|
}
|
|
502
509
|
setHeaders(e) {
|
|
503
510
|
}
|
|
504
|
-
navigate(
|
|
505
|
-
return
|
|
511
|
+
navigate($) {
|
|
512
|
+
return G(this, arguments, function* (e, {
|
|
506
513
|
historyAction: s = "push",
|
|
507
514
|
centerScroll: a,
|
|
508
515
|
offsetScroll: n,
|
|
509
|
-
scrollBehaviour:
|
|
510
|
-
revalidate:
|
|
511
|
-
keepSearchParameters:
|
|
516
|
+
scrollBehaviour: E,
|
|
517
|
+
revalidate: f,
|
|
518
|
+
keepSearchParameters: u,
|
|
512
519
|
submorph: d,
|
|
513
520
|
submorphAppend: v,
|
|
514
|
-
clearState:
|
|
515
|
-
keepScrollPosition:
|
|
516
|
-
mergeParams:
|
|
521
|
+
clearState: et,
|
|
522
|
+
keepScrollPosition: w,
|
|
523
|
+
mergeParams: st
|
|
517
524
|
} = {}) {
|
|
518
|
-
var
|
|
525
|
+
var At, j, V, it;
|
|
519
526
|
if (t(this, K).length)
|
|
520
527
|
return;
|
|
521
|
-
o(this,
|
|
522
|
-
const
|
|
523
|
-
mergeParams:
|
|
528
|
+
o(this, Lt, d), o(this, dt, f), o(this, St, w);
|
|
529
|
+
const y = ((At = this.pathnameModifier) == null ? void 0 : At.call(this, e)) || e, c = this.normalizePath(y, {
|
|
530
|
+
mergeParams: st
|
|
524
531
|
});
|
|
525
|
-
if (!
|
|
526
|
-
|
|
532
|
+
if (!f && (((j = t(this, X)) == null ? void 0 : j.pathname) === c.pathname || t(this, g).pathname === c.pathname)) {
|
|
533
|
+
w || b(this, p, Xt).call(this, c.hash || 0, {
|
|
527
534
|
centerScroll: a,
|
|
528
535
|
offsetScroll: n,
|
|
529
536
|
behavior: "smooth"
|
|
530
537
|
}), z(document, "morphSamePath", {
|
|
531
538
|
custom: !0
|
|
532
|
-
}), ((V = t(this, g)) == null ? void 0 : V.parameters) !== c.parameters && (o(this,
|
|
533
|
-
action: ((
|
|
539
|
+
}), ((V = t(this, g)) == null ? void 0 : V.parameters) !== c.parameters && (o(this, _, t(this, g)), o(this, g, c), zt({
|
|
540
|
+
action: ((it = t(this, g)) == null ? void 0 : it.hash) !== c.hash ? "replace" : s,
|
|
534
541
|
pathname: c.pathname,
|
|
535
542
|
searchParameters: c.parameters,
|
|
536
543
|
hash: c.hash
|
|
537
544
|
}), z(document, "morphURLParametersChange", {
|
|
538
545
|
detail: {
|
|
539
546
|
newURL: t(this, g),
|
|
540
|
-
previousURL: t(this,
|
|
547
|
+
previousURL: t(this, _)
|
|
541
548
|
}
|
|
542
|
-
})), t(this,
|
|
549
|
+
})), t(this, P).forEach((S) => {
|
|
543
550
|
S.checkCurrent(c.path);
|
|
544
551
|
});
|
|
545
552
|
return;
|
|
546
553
|
} else
|
|
547
|
-
t(this,
|
|
554
|
+
t(this, P).forEach((S) => {
|
|
548
555
|
S.checkCurrent(c.path);
|
|
549
556
|
});
|
|
550
557
|
o(this, X, c);
|
|
@@ -552,12 +559,12 @@ const dt = class dt {
|
|
|
552
559
|
let S = !0;
|
|
553
560
|
if (this.preprocessor)
|
|
554
561
|
try {
|
|
555
|
-
yield new Promise((r,
|
|
556
|
-
var
|
|
557
|
-
(
|
|
562
|
+
yield new Promise((r, k) => {
|
|
563
|
+
var T;
|
|
564
|
+
(T = this.preprocessor) == null || T.call(this, {
|
|
558
565
|
url: c,
|
|
559
566
|
resolve: r,
|
|
560
|
-
reject:
|
|
567
|
+
reject: k,
|
|
561
568
|
submorph: d
|
|
562
569
|
});
|
|
563
570
|
});
|
|
@@ -565,7 +572,7 @@ const dt = class dt {
|
|
|
565
572
|
r ? console.error(r) : console.log("Route change canceled"), S = !1;
|
|
566
573
|
}
|
|
567
574
|
if (!S || t(this, X).pathname !== c.pathname) {
|
|
568
|
-
t(this,
|
|
575
|
+
t(this, P).forEach((r) => {
|
|
569
576
|
r.checkCurrent(t(this, g).path);
|
|
570
577
|
});
|
|
571
578
|
return;
|
|
@@ -575,148 +582,150 @@ const dt = class dt {
|
|
|
575
582
|
submorph: d
|
|
576
583
|
};
|
|
577
584
|
d ? v || d.forEach((r) => {
|
|
578
|
-
document.querySelectorAll(r).forEach((
|
|
579
|
-
|
|
585
|
+
document.querySelectorAll(r).forEach((k) => {
|
|
586
|
+
k.classList.add("out"), k.setAttribute("data-morph-out", "");
|
|
580
587
|
});
|
|
581
|
-
}) : t(this,
|
|
582
|
-
var
|
|
583
|
-
(
|
|
588
|
+
}) : t(this, ht).forEach((r) => {
|
|
589
|
+
var k, T;
|
|
590
|
+
(k = r.firstElementChild) == null || k.classList.add("out"), (T = r.firstElementChild) == null || T.setAttribute("data-morph-out", "");
|
|
584
591
|
}), z(document, "morphNavigation", {
|
|
585
592
|
detail: Kt
|
|
586
593
|
});
|
|
587
|
-
const
|
|
594
|
+
const Ut = b(this, p, xt).call(this, t(this, g).pathname), A = b(this, p, xt).call(this, c.pathname);
|
|
588
595
|
if (t(this, W).forEach((r) => {
|
|
589
596
|
r.pathname !== c.pathname && r.abort();
|
|
590
|
-
}), yield A == null ? void 0 : A.fetch(
|
|
591
|
-
t(this,
|
|
597
|
+
}), yield A == null ? void 0 : A.fetch(y, t(this, g).path, f), t(this, X).pathname !== c.pathname) {
|
|
598
|
+
t(this, P).forEach((r) => {
|
|
592
599
|
r.checkCurrent(t(this, g).path);
|
|
593
600
|
});
|
|
594
601
|
return;
|
|
595
602
|
}
|
|
596
|
-
|
|
597
|
-
const
|
|
603
|
+
Ut.clearState(), Ut.saveScrollState(), Ut.saveDocumentState(), (!t(this, Y) || f) && (A.clearScrollState(), A.clearDocumentState()), et && A.clearState(), A.cloneDocument(), t(this, tt).textContent = A.title, document.body.appendChild(t(this, tt));
|
|
604
|
+
const Pt = Nt(Ct({}, Kt), {
|
|
598
605
|
document: A.document
|
|
599
606
|
});
|
|
600
|
-
v ||
|
|
607
|
+
v || Pt.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
601
608
|
r.classList.remove("out");
|
|
602
609
|
}), z(document, "morphStart", {
|
|
603
|
-
detail:
|
|
610
|
+
detail: Pt
|
|
604
611
|
});
|
|
605
|
-
const Yt = Array.from(document.head.children), $t = Array.from(A.document.head.children), jt =
|
|
606
|
-
|
|
607
|
-
r.tagName === "SCRIPT" && (
|
|
608
|
-
}),
|
|
612
|
+
const Yt = Array.from(document.head.children), $t = Array.from(A.document.head.children), jt = b(this, p, he).call(this, Yt, $t), le = b(this, p, Ft).call(this, Yt, jt), kt = b(this, p, Ft).call(this, $t, jt).filter((r) => !this.excludeHeadChild(r));
|
|
613
|
+
kt.forEach((r, k) => {
|
|
614
|
+
r.tagName === "SCRIPT" && (kt[k] = b(this, p, Wt).call(this, r));
|
|
615
|
+
}), kt.forEach((r) => {
|
|
609
616
|
document.head.appendChild(r);
|
|
610
617
|
});
|
|
611
|
-
const
|
|
618
|
+
const Tt = kt.filter((r) => {
|
|
612
619
|
if (r.hasAttribute("data-no-waiting"))
|
|
613
620
|
return !1;
|
|
614
|
-
if (
|
|
621
|
+
if (b(this, p, Ot).call(this, r))
|
|
615
622
|
return !0;
|
|
616
623
|
});
|
|
617
|
-
t(this,
|
|
618
|
-
let
|
|
624
|
+
t(this, D).waitForHeadToLoad && Tt.length && (yield new Promise((r) => G(this, null, function* () {
|
|
625
|
+
let k = 0;
|
|
619
626
|
try {
|
|
620
|
-
for (var
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
|
|
627
|
+
for (var T = ee(Tt), de, F, N; de = !(F = yield T.next()).done; de = !1) {
|
|
628
|
+
const wt = F.value;
|
|
629
|
+
wt.onload = () => {
|
|
630
|
+
k++, k === Tt.length && r();
|
|
624
631
|
};
|
|
625
632
|
}
|
|
626
633
|
} catch (F) {
|
|
627
|
-
|
|
634
|
+
N = [F];
|
|
628
635
|
} finally {
|
|
629
636
|
try {
|
|
630
|
-
|
|
637
|
+
de && (F = T.return) && (yield F.call(T));
|
|
631
638
|
} finally {
|
|
632
|
-
if (
|
|
633
|
-
throw
|
|
639
|
+
if (N)
|
|
640
|
+
throw N[0];
|
|
634
641
|
}
|
|
635
642
|
}
|
|
636
|
-
}))), yield
|
|
643
|
+
}))), yield ve(10);
|
|
637
644
|
const Gt = [];
|
|
638
|
-
v ||
|
|
639
|
-
r.hasAttribute("data-permanent") || (
|
|
645
|
+
v || le.forEach((r) => {
|
|
646
|
+
r.hasAttribute("data-permanent") || (b(this, p, Ot).call(this, r) ? Gt.push(r) : r.remove());
|
|
640
647
|
});
|
|
641
|
-
const
|
|
642
|
-
!t(this,
|
|
648
|
+
const ce = b(this, p, Vt).call(this, A.document.body);
|
|
649
|
+
!t(this, D).morphInsideScrollContainer && !d && b(this, p, Bt).call(this, A.document), document.documentElement.setAttribute(
|
|
643
650
|
"data-current-pathname",
|
|
644
651
|
c.pathname
|
|
645
652
|
), document.documentElement.setAttribute(
|
|
646
653
|
"data-current-leaf",
|
|
647
654
|
c.leaf
|
|
648
|
-
),
|
|
655
|
+
), zt({
|
|
649
656
|
action: s,
|
|
650
657
|
pathname: c.pathname,
|
|
651
|
-
searchParameters: c.parameters || (
|
|
658
|
+
searchParameters: c.parameters || (u ? location.search : ""),
|
|
652
659
|
hash: c.hash
|
|
653
|
-
}), t(this,
|
|
654
|
-
const
|
|
655
|
-
t(this,
|
|
656
|
-
const
|
|
657
|
-
let F = [],
|
|
658
|
-
d ? (d.forEach((
|
|
659
|
-
const L = r.querySelector(
|
|
660
|
-
L &&
|
|
661
|
-
}),
|
|
662
|
-
|
|
663
|
-
})) : (F.push(...
|
|
664
|
-
const
|
|
665
|
-
v ||
|
|
666
|
-
|
|
660
|
+
}), t(this, tt).remove(), o(this, _, t(this, g)), o(this, g, c);
|
|
661
|
+
const Mt = [];
|
|
662
|
+
t(this, ht).forEach((r, k) => {
|
|
663
|
+
const T = ce[k], de = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
664
|
+
let F = [], N = [];
|
|
665
|
+
d ? (d.forEach((m) => {
|
|
666
|
+
const L = r.querySelector(m), C = T.querySelector(m);
|
|
667
|
+
L && C && (N.push(L), F.push(C));
|
|
668
|
+
}), N.forEach((m) => {
|
|
669
|
+
m.parentElement && Mt.push(m.parentElement);
|
|
670
|
+
})) : (F.push(...T.childNodes), N.push(...r.childNodes), Mt.push(r));
|
|
671
|
+
const wt = [];
|
|
672
|
+
v || N.forEach((m) => {
|
|
673
|
+
m instanceof HTMLElement && (this.destroyOldLinks(m), m.classList.add("old"), m.querySelectorAll(
|
|
667
674
|
"[data-morph-transfer]"
|
|
668
|
-
).forEach((
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
element:
|
|
672
|
-
selector:
|
|
675
|
+
).forEach((C) => {
|
|
676
|
+
const me = C.getAttribute("data-morph-transfer");
|
|
677
|
+
wt.push({
|
|
678
|
+
element: C,
|
|
679
|
+
selector: me
|
|
673
680
|
});
|
|
674
681
|
}));
|
|
675
|
-
}), F.forEach((
|
|
676
|
-
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
})
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
682
|
+
}), F.forEach((m) => {
|
|
683
|
+
m instanceof HTMLElement && (wt.forEach((L) => {
|
|
684
|
+
const C = m.querySelector(L.selector);
|
|
685
|
+
C && C.replaceWith(
|
|
686
|
+
A.document.importNode(L.element, !0)
|
|
687
|
+
);
|
|
688
|
+
}), this.findNewLinks(m), m.classList.add("new"));
|
|
689
|
+
}), d ? v ? F.forEach((m, L) => {
|
|
690
|
+
N[L] instanceof HTMLElement && N[L].append(...m.childNodes);
|
|
691
|
+
}) : F.forEach((m, L) => {
|
|
692
|
+
var C;
|
|
693
|
+
(C = N[L].parentElement) == null || C.insertBefore(
|
|
694
|
+
m,
|
|
695
|
+
N[L]
|
|
687
696
|
);
|
|
688
697
|
}) : r.prepend(...F), setTimeout(() => {
|
|
689
|
-
v ||
|
|
690
|
-
|
|
691
|
-
}), F.forEach((
|
|
698
|
+
v || N.forEach((m) => {
|
|
699
|
+
m instanceof HTMLElement && m.classList.add("old-idle");
|
|
700
|
+
}), F.forEach((m) => {
|
|
692
701
|
var L;
|
|
693
|
-
|
|
702
|
+
m instanceof HTMLElement && ((L = m.parentElement) == null || L.style.setProperty(
|
|
694
703
|
"--new-content-height",
|
|
695
|
-
|
|
696
|
-
),
|
|
704
|
+
m.offsetHeight + "px"
|
|
705
|
+
), m.classList.add("new-idle"));
|
|
697
706
|
});
|
|
698
707
|
}, 0);
|
|
699
|
-
const Jt =
|
|
708
|
+
const Jt = Nt(Ct({}, Pt), {
|
|
700
709
|
morphElement: r
|
|
701
710
|
});
|
|
702
711
|
z(document, "morphNewChildrenAdded", {
|
|
703
712
|
detail: Jt
|
|
704
713
|
});
|
|
705
|
-
const
|
|
714
|
+
const ue = new Promise((m) => {
|
|
706
715
|
setTimeout(() => {
|
|
707
|
-
v ||
|
|
716
|
+
v || N.forEach((L) => {
|
|
708
717
|
L.remove();
|
|
709
718
|
}), F.forEach((L) => {
|
|
710
|
-
var
|
|
711
|
-
L instanceof HTMLElement && ((
|
|
719
|
+
var C;
|
|
720
|
+
L instanceof HTMLElement && ((C = L.parentElement) == null || C.style.removeProperty(
|
|
712
721
|
"--new-content-height"
|
|
713
722
|
), L.classList.remove("new-idle", "new"));
|
|
714
723
|
}), v || z(document, "morphOldChildrenRemoved", {
|
|
715
724
|
detail: Jt
|
|
716
|
-
}),
|
|
717
|
-
}, (parseFloat(
|
|
725
|
+
}), m();
|
|
726
|
+
}, (parseFloat(de) || 0) * 1e3 + 10);
|
|
718
727
|
});
|
|
719
|
-
t(this, K).push(
|
|
728
|
+
t(this, K).push(ue);
|
|
720
729
|
}), this.isPopstateNavigation ? document.documentElement.style.setProperty(
|
|
721
730
|
"--new-document-scroll-position",
|
|
722
731
|
(this.scrollValue.top - A.scrollState.y) * 1 + "px"
|
|
@@ -725,18 +734,18 @@ const dt = class dt {
|
|
|
725
734
|
this.scrollValue.top + "px"
|
|
726
735
|
), z(document, "morphBeforeNavigationScroll", {
|
|
727
736
|
detail: A.scrollState
|
|
728
|
-
}), c.hash ? (A.clearScrollState(),
|
|
737
|
+
}), c.hash ? (A.clearScrollState(), b(this, p, Xt).call(this, c.hash, {
|
|
729
738
|
centerScroll: a,
|
|
730
739
|
offsetScroll: n,
|
|
731
|
-
behavior:
|
|
732
|
-
})) : t(this, Y) ? A.restoreScrollPosition() :
|
|
733
|
-
r.querySelectorAll("script").forEach((
|
|
734
|
-
|
|
740
|
+
behavior: E
|
|
741
|
+
})) : t(this, Y) ? A.restoreScrollPosition() : w || A.renewScrollPosition(), yield Promise.all(t(this, K)), v || Gt.forEach((r) => r.remove()), o(this, K, []), Mt.forEach((r) => {
|
|
742
|
+
r.querySelectorAll("script").forEach((T) => {
|
|
743
|
+
T.replaceWith(b(this, p, Wt).call(this, T));
|
|
735
744
|
});
|
|
736
|
-
}), t(this,
|
|
745
|
+
}), t(this, P).forEach((r) => {
|
|
737
746
|
r.checkCurrent(t(this, g).path);
|
|
738
747
|
}), this.findParamsDependent(), z(document, "morphComplete", {
|
|
739
|
-
detail:
|
|
748
|
+
detail: Pt
|
|
740
749
|
}), document.documentElement.style.removeProperty(
|
|
741
750
|
"--new-document-scroll-position"
|
|
742
751
|
), window.dispatchEvent(new Event("resize"));
|
|
@@ -747,7 +756,7 @@ const dt = class dt {
|
|
|
747
756
|
});
|
|
748
757
|
}
|
|
749
758
|
addLink(e) {
|
|
750
|
-
t(this,
|
|
759
|
+
t(this, P).push(new qt(e, this));
|
|
751
760
|
}
|
|
752
761
|
addLinks(e) {
|
|
753
762
|
e.forEach((s) => {
|
|
@@ -755,24 +764,24 @@ const dt = class dt {
|
|
|
755
764
|
});
|
|
756
765
|
}
|
|
757
766
|
removeLink(e) {
|
|
758
|
-
o(this,
|
|
767
|
+
o(this, P, t(this, P).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
|
|
759
768
|
}
|
|
760
769
|
destroyOldLinks(e) {
|
|
761
|
-
o(this,
|
|
770
|
+
o(this, P, t(this, P).filter((s) => e.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
762
771
|
}
|
|
763
772
|
findNewLinks(e) {
|
|
764
773
|
const s = [...e.querySelectorAll("a")].filter(
|
|
765
|
-
t(this,
|
|
774
|
+
t(this, yt)
|
|
766
775
|
);
|
|
767
|
-
t(this,
|
|
768
|
-
...s.map((a) => new
|
|
776
|
+
t(this, P).push(
|
|
777
|
+
...s.map((a) => new qt(a, this))
|
|
769
778
|
);
|
|
770
779
|
}
|
|
771
780
|
findLinks() {
|
|
772
781
|
const e = [
|
|
773
782
|
...document.documentElement.querySelectorAll("a")
|
|
774
|
-
].filter(t(this,
|
|
775
|
-
t(this,
|
|
783
|
+
].filter(t(this, yt));
|
|
784
|
+
t(this, P).forEach((s) => s.destroy()), o(this, P, e.map((s) => new qt(s, this)));
|
|
776
785
|
}
|
|
777
786
|
findParamsDependent() {
|
|
778
787
|
const e = [
|
|
@@ -780,55 +789,55 @@ const dt = class dt {
|
|
|
780
789
|
"[data-morph-params-dependent]"
|
|
781
790
|
)
|
|
782
791
|
];
|
|
783
|
-
t(this,
|
|
792
|
+
t(this, vt).forEach((s) => s.destroy()), o(this, vt, e.map(
|
|
784
793
|
(s) => new we(s)
|
|
785
794
|
));
|
|
786
795
|
}
|
|
787
796
|
};
|
|
788
|
-
|
|
797
|
+
D = new WeakMap(), ht = new WeakMap(), P = new WeakMap(), X = new WeakMap(), g = new WeakMap(), _ = new WeakMap(), K = new WeakMap(), Y = new WeakMap(), M = new WeakMap(), Et = new WeakMap(), W = new WeakMap(), vt = new WeakMap(), tt = new WeakMap(), lt = new WeakMap(), ct = new WeakMap(), Lt = new WeakMap(), dt = new WeakMap(), St = new WeakMap(), p = new WeakSet(), Wt = function(e) {
|
|
789
798
|
const s = document.createElement("script");
|
|
790
799
|
for (let a = 0; a < e.attributes.length; a++) {
|
|
791
800
|
const n = e.attributes[a];
|
|
792
801
|
s.setAttribute(n.name, n.value);
|
|
793
802
|
}
|
|
794
803
|
return e.hasAttribute("src") || (s.innerHTML = e.innerHTML), s;
|
|
795
|
-
},
|
|
804
|
+
}, yt = new WeakMap(), xt = function(e) {
|
|
796
805
|
const s = this.normalizePath(e);
|
|
797
806
|
let a = t(this, W).get(s.pathname);
|
|
798
807
|
return a || (a = new se(this, s.pathname), t(this, W).set(s.pathname, a)), a;
|
|
799
|
-
},
|
|
808
|
+
}, Vt = function(e) {
|
|
800
809
|
const s = [...e.querySelectorAll("[data-morph]")];
|
|
801
810
|
return s.length ? s : [e];
|
|
802
|
-
},
|
|
811
|
+
}, he = function(e, s) {
|
|
803
812
|
return e.filter(
|
|
804
813
|
(a) => s.find(
|
|
805
814
|
(n) => n.outerHTML === a.outerHTML
|
|
806
815
|
)
|
|
807
816
|
);
|
|
808
|
-
},
|
|
817
|
+
}, Ft = function(e, s) {
|
|
809
818
|
return e.filter(
|
|
810
819
|
(a) => !s.find(
|
|
811
820
|
(n) => n.outerHTML === a.outerHTML
|
|
812
821
|
)
|
|
813
822
|
);
|
|
814
|
-
}, Ft = function(e) {
|
|
815
|
-
return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
|
|
816
823
|
}, Ot = function(e) {
|
|
824
|
+
return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
|
|
825
|
+
}, Bt = function(e) {
|
|
817
826
|
var s, a;
|
|
818
|
-
(s = t(this,
|
|
827
|
+
(s = t(this, M)) == null || s.removeEventListener(
|
|
819
828
|
"scroll",
|
|
820
|
-
t(this,
|
|
821
|
-
), o(this,
|
|
822
|
-
},
|
|
829
|
+
t(this, ut)
|
|
830
|
+
), o(this, ct, 0), o(this, lt, 0), o(this, M, t(this, D).scrollSelector && e.querySelector(t(this, D).scrollSelector) || window), o(this, Et, t(this, M) === window), (a = t(this, M)) == null || a.addEventListener("scroll", t(this, ut)), t(this, ut).call(this);
|
|
831
|
+
}, Xt = function(e, s) {
|
|
823
832
|
const a = typeof e == "string" ? document.getElementById(e) : e;
|
|
824
|
-
(typeof a == "number" || a) &&
|
|
825
|
-
scrollElement: t(this,
|
|
833
|
+
(typeof a == "number" || a) && Le(a, {
|
|
834
|
+
scrollElement: t(this, M),
|
|
826
835
|
behavior: (s == null ? void 0 : s.behavior) || "instant",
|
|
827
836
|
center: s == null ? void 0 : s.centerScroll,
|
|
828
837
|
offset: s == null ? void 0 : s.offsetScroll
|
|
829
838
|
});
|
|
830
|
-
},
|
|
831
|
-
let ie =
|
|
839
|
+
}, Ht = new WeakMap(), ut = new WeakMap(), mt.instance = null;
|
|
840
|
+
let ie = mt;
|
|
832
841
|
export {
|
|
833
842
|
ie as Morph
|
|
834
843
|
};
|