Created
April 18, 2022 17:34
-
-
Save panoply/efaa8b3d079d59e1a487a653668c2986 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var f=(e,t,r)=>new Promise((o,i)=>{var s=R=>{try{H(r.next(R))}catch(ge){i(ge)}},y=R=>{try{H(r.throw(R))}catch(ge){i(ge)}},H=R=>R.done?o(R.value):Promise.resolve(R.value).then(s,y);H((r=r.apply(e,t)).next())});var T=window.history,z=window.location.origin,He=Object.getOwnPropertyNames,E=Object.assign,c=Object.create,te=Array.isArray,S=Array.from,G="";function qe(e){let t=c(e);return t.targets=["body"],t.timeout=3e4,t.poll=15,t.schema="pjax",t.async=!0,t.cache=!0,t.reverse=!0,t.limit=50,t.preload=null,t.persist=!1,t.hover=c(null),t.hover.trigger="attribute",t.hover.threshold=250,t.intersect=c(null),t.intersect.rootMargin="0px 0px 0px 0px",t.intersect.threshold=0,t.proximity=c(null),t.proximity.distance=75,t.proximity.threshold=250,t.proximity.throttle=500,t.progress=c(null),t.progress.background="#111",t.progress.height="3px",t.progress.minimum=.8,t.progress.easing="linear",t.progress.speed=300,t.progress.trickle=!0,t.progress.threshold=350,t.progress.trickleSpeed=300,t}var n=qe(null),a=c(null),p=c(null),l=c(null),b=c(null),he=new Set;function ye(e={}){e.hover!==void 0&&(typeof e.hover!="boolean"?E(n.hover,e.hover):e.hover===!1&&(n.hover=e.hover),delete e.hover),e.intersect!==void 0&&(typeof e.intersect!="boolean"?E(n.intersect,e.intersect):e.intersect===!1&&(n.intersect=e.intersect),delete e.intersect),e.proximity!==void 0&&(typeof e.proximity!="boolean"?E(n.proximity,e.proximity):e.proximity===!1&&(n.proximity=e.proximity),delete e.proximity),e.progress!==void 0&&(typeof e.progress!="boolean"?E(n.progress,e.progress):e.progress===!1&&(n.progress=e.progress),delete e.progress);let t=n.schema===null?"data":`data-${n.schema}`,r=`:not([${t}-disable]):not([href^="#"])`;return p.attrs=new RegExp("^href|"+t+"-("+"hydrate|append|prepend|replace|progress|threshold|position|proximity|hover|history"+")$","i"),p.hydrate=`[${t}-hydrate]`,p.track=`[${t}-track]:not([${t}-track=false])`,p.script=`script:not([${t}-eval=false])`,p.style=`style:not([${t}-eval=false])`,p.styleLink=`link[rel=stylesheet]:not([${t}-eval=false])`,p.href=`a${r}`,n.intersect!==!1&&(p.intersect=`[${t}-intersect]:not([${t}-intersect=false])`,p.interHref=`a${r}:not([${t}-intersect=false])`),n.proximity!==!1&&(p.proximity=`a[${t}-proximity]${r}:not([${t}-proximity=false])`),n.hover!==!1&&(p.hover=n.hover.trigger==="href"?`a${r}:not([${t}-hover=false]):not([${t}-intersect]):not([${t}-proximity])`:`a[${t}-hover]${r}:not([${t}-hover=false]):not([${t}-intersect]):not([${t}-proximity])`),E(n,e)}var $e=/(?:https?:)?\/\/(?:www\.)?/;var Ce=/\b(?:append|prepend)/,je=/^(?:application|text)\/(?:x-)?(?:ecma|java)script|text\/javascript$/,We=/^\b(?:true|false)$/i,U=/^[+-]?\d*\.?\d+$/,Fe=/\s+/g;var ve=/\[?[^,'"[\]()\s]+\]?/g,De=/\(?\[(['"]?.*['"]?,?)\]\)?/,Ve=/[xy]:[0-9.]+/,Be=/[xy]|\d*\.?\d+/g;function u(e,t){if(e===1)console.info("@brixtol/pjax: "+t);else if(e===2)console.warn("@brixtol/pjax: "+t);else{console.error("@brixtol/pjax: "+t);try{throw e===3?new TypeError(t):new Error(t)}catch(r){}}}function Ke(){return Math.random().toString(36).slice(2)}function Xe(e=2){return(t,r)=>{let o=t.length;return(o<1||t[o-1].length===e?t.push([r]):t[o-1].push(r))&&t}}function v(e,t){if(arguments.length===1)return i=>v(e,i);let r=t.length;if(r===0)return;let o=0;for(;o<r;)e(t[o],o,t),o++}function xe(e){let t=He(e);return t.length===0?!0:t.every(r=>delete e[r])}var A=z.replace($e,G);function St(e){let t=c(null);return v((r,o,i)=>{let s=i.length-1>=o?o-1:o;o%2&&(t[i[s]]=U.test(r)?Number(r):r)},e),t}function Mt(e){let t=c(null);for(let{nodeName:r,nodeValue:o}of e.attributes){if(!p.attrs.test(r))continue;if(r==="href"){t.location=Ge(o),t.key=t.location.pathname+t.location.search,t.rev=location.pathname+location.search;continue}let i=r.slice(1+r.lastIndexOf("-")),s=o.replace(Fe,G);De.test(s)?t[i]=Ce.test(i)?s.match(ve).reduce(Xe(2),[]):s.match(ve):Ve.test(s)?t[i]=St(s.match(Be)):We.test(s)?t[i]=s==="true":U.test(s)?t[i]=Number(s):t[i]=s}return t}function D(e){let t=c(null),r=e.indexOf("#");r>=0?(t.hash=e.slice(r),e=e.slice(0,r)):t.hash=G;let o=e.indexOf("?");return o>=0?(t.search=e.slice(o),e=e.slice(0,o)):t.search=G,t.pathname=e,t}function Ee(e){let t=e.startsWith("www.")?e.slice(4):e,r=t.indexOf("/");if(r>=0){let o=t.slice(r);if(t.slice(0,r)===A)return o.length?D(o):D("/")}else{let o=t.search(/[?#]/);if(o>=0){if(t.slice(0,o)===A)return D("/"+t.slice(o))}else if(t===A)return D("/")}return null}function Ye(e){if(e.charCodeAt(0)===47)return e.charCodeAt(1)!==47?!0:e.startsWith("www.",2)?e.startsWith(A,6):e.startsWith(A,2);if(e.charCodeAt(0)===63)return!0;if(e.startsWith("www."))return e.startsWith(A,4);if(e.startsWith("http")){let t=e.indexOf("/",4)+2;return e.startsWith("www.",t)?e.startsWith(A,t+4):e.startsWith(A,t)}}function ze(e){return e.charCodeAt(0)===47?e.charCodeAt(1)!==47?D(e):Ee(e.slice(2)):e.charCodeAt(0)===63?D(location.pathname+e):e.startsWith("https:")||e.startsWith("http:")?Ee(e.slice(e.indexOf("/",4)+2)):e.startsWith("www.")?Ee(e):null}function q(e){if(typeof e=="object")return e.pathname+e.search;let t=ze(e);return t.pathname+t.search}function Ge(e){let t=ze(e);return t.origin=z,t.hostname=A,t}function m(e,t){if(e instanceof Element){let o=Mt(e);return o.type=t||2,o}let r=c(null);return r.rev=location.pathname+location.search,r.location=Ge(typeof e=="string"?e:r.rev),r.key=q(r.location),r.type=t||2,r}var Ht=new DOMParser;function M(e){return Ht.parseFromString(e,"text/html")}function be(e){let t=e.indexOf(">",e.indexOf("<title"))+1,r=e.indexOf("</title",t);return e.slice(t,r)}var $=c(null);function g(e,...t){let r=e==="store";r&&t.splice(-1,1,M(t[t.length-1]));let o=!0;return v(i=>{let s=i.apply(null,t);r?s instanceof Document?o=s.documentElement.outerHTML:typeof o!="string"&&(o=s!==!1):o=s!==!1},$[e]||[]),o}function qt(e,t){e in $||($[e]=[]),$[e].push(t)}function $t(e,t){let r=$[e],o=[];if(r&&t){let i=0,s=r.length;for(;i<s;i++)r[i]!==t&&o.push(r[i])}return o.length?$[e]=o:delete $[e],this}function C(e){e===void 0?(xe(l),xe(b)):typeof e=="string"?(delete b[l[e].uuid],delete l[e]):te(e)&&Ie(e)}function h(e){return e.replace===void 0?e.replace=n.targets:v(t=>e.replace.push(t),n.targets),n.cache&&(e.cache===void 0&&(e.cache=n.cache),e.uuid===void 0&&(e.uuid=Ke())),e.position===void 0&&(e.position=c(null),e.position.y=0,e.position.x=0),n.hover!==!1&&e.type===4&&e.threshold===void 0&&(e.threshold=n.hover.threshold),n.proximity!==!1&&e.type===6&&(e.proximity===void 0&&(e.proximity=n.proximity.distance),e.threshold===void 0&&(e.threshold=n.hover.threshold)),n.progress!==!1&&e.progress===void 0&&(e.progress=n.progress.threshold),e}function oe(e,t){let r=g("store",e,t);if(r===!1)return;switch(e.type){case 4:case 6:case 5:e.type=11;break}let o=typeof r=="string"?r:t;return e.title=be(o),n.cache&&(l[e.key]=e,b[e.uuid]=o),e}function k(e,t){let r=e.key in l?l[e.key]:h(e);return typeof t=="string"?(e.title=be(t),b[r.uuid]=t,E(r,e)):E(r,e)}function Pe(e){let t=c(null);return e=e||T.state.key,t.page=l[e],t.dom=M(b[t.page.uuid]),t}function x(e){return e in l&&"uuid"in l[e]?l[e].uuid in b:!1}function Ie(e=[]){return Object.getOwnPropertyNames(l).forEach(t=>{e.includes(t)?delete b[l[t].uuid]:delete l[t]})}var P=typeof window<"u"?window:{screen:{},navigator:{}},V=(P.matchMedia||function(){return{matches:!1}}).bind(P),Ct=!1,jt={get passive(){return Ct=!0}},Ue=function(){};P.addEventListener&&P.addEventListener("p",Ue,jt);P.removeEventListener&&P.removeEventListener("p",Ue,!1);var w="PointerEvent"in P,Re="ontouchstart"in P,Wt="TouchEvent"in P,Ft=Re||Wt&&V("(any-pointer: coarse)").matches,Dr=(P.navigator.maxTouchPoints||0)>0||Ft,_e=P.navigator.userAgent||"",Dt=V("(pointer: coarse)").matches&&/iPad|Macintosh/.test(_e)&&Math.min(P.screen.width||0,P.screen.height||0)>=768,Vr=(V("(pointer: coarse)").matches||!V("(pointer: fine)").matches&&Re)&&!/Windows.*Firefox/.test(_e),Br=V("(any-pointer: fine)").matches||V("(any-hover: hover)").matches||Dt||!Re;function _(e,t){if(!(e instanceof Element))return!1;let r=e.closest(t);return r&&r.tagName==="A"?r:!1}function Te(e){if(e.nodeName!=="A")return!1;let t=e.href;return t.length===0||!Ye(t)?!1:!x(q(t))}function Je(e,t){return S(document.body.querySelectorAll(e)).flatMap(r=>r.nodeName!=="A"?S(r.querySelectorAll(t)).filter(Te):Te(r)?r:[])}var J=e=>S(document.body.querySelectorAll(e)).filter(Te);var j=null,Q=null,we=[];function Le(e){let{speed:t,easing:r,minimum:o}=n.progress,i=typeof j=="number";e=Ze(e,o,1),j=e===1?null:e;let s=Vt(!i);s.offsetWidth,Kt(y=>{if(s.style.transform=`translate3d(${et(e)}%,0,0)`,s.style.transition=`all ${t}ms ${r}`,e!==1)return setTimeout(y,t);s.style.transition="none",s.style.opacity="1",s.offsetWidth,setTimeout(()=>{s.style.transition=`all ${t}ms ${r}`,s.style.opacity="0",setTimeout(()=>[Bt(),y()],t)},t)})}function Qe(e){let t=j;if(!t)return Ae();if(t<1)return typeof e!="number"&&(t>=0&&t<.2?e=.1:t>=.2&&t<.5?e=.04:t>=.5&&t<.8?e=.02:t>=.8&&t<.99?e=.005:e=0),t=Ze(t+e,0,.994),Le(t)}function Vt(e){if(Q)return Q;document.documentElement.classList.add("pload");let t=e?"-100":et(j||0),r=document.createElement("div");return r.id="pprogress",r.style.pointerEvents="none",r.style.background=n.progress.background,r.style.height=n.progress.height,r.style.position="fixed",r.style.zIndex="9999",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.transition="all 0 linear",r.style.transform=`translate3d(${t}%,0,0)`,document.body.appendChild(r),Q=r,r}function Bt(){document.documentElement.classList.remove("pload"),document.getElementById("pprogress")&&document.body.removeChild(Q),Q=null}function Ze(e,t,r){return e<t?t:e>r?r:e}function et(e){return(-1+e)*100}function Kt(e){let t=()=>{let r=we.shift();r&&r(t)};we.push(e),we.length===1&&t()}function Ae(){if(!n.progress)return;j||Le(0);let e=function(){setTimeout(()=>{!j||(Qe(),e())},n.progress.trickleSpeed)};n.progress.trickle&&e()}function tt(e){if(!(!e&&!j))return Qe(.3+.5*Math.random()),Le(1)}var I=c(null);function Xt(e){return new Promise(t=>setTimeout(()=>t(e()),5))}var ot=0;function Yt(e){return f(this,null,function*(){ot=ot+e.length})}var W=c(null);function ne(e){let t=new XMLHttpRequest;return new Promise((r,o)=>{t.open("GET",e,n.async),t.setRequestHeader("X-Brixtol-Pjax","true"),t.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.onloadstart=i=>{I[e]=t},t.onload=i=>{r(t.status===200?t.responseText:!1)},t.onabort=i=>{delete I[e]},t.onloadend=i=>{delete I[e],Yt(t.responseText)},t.onerror=o,t.timeout=n.timeout,t.responseType="text",t.send(null)})}function ie(e,t,r){e in W||x(e)||(W[e]=setTimeout(t,r))}function nt(e){return e in W?(clearTimeout(W[e]),delete W[e]):!0}function it(e){e in I&&(I[e].abort(),u(2,`Request aborted: ${e}`))}function st(e){if(e in I)for(let t in I)e!==t&&(I[t].abort(),u(2,`Pending request aborted: ${t}`))}function Oe(e,t=0){return f(this,null,function*(){return e in I&&t<=n.timeout?(n.progress!==!1&&t*5===n.progress.threshold&&Ae(),t++,Xt(()=>Oe(e,t))):delete I[e]})}function d(e){return f(this,null,function*(){if(e.key in I){u(2,`Request already in transit: ${e.key}`);return}if(!g("fetch",e))return u(2,`Request cancelled in dispatched event: ${e.key}`),!1;try{let t=yield ne(e.key);if(t)return oe(e,t);u(4,` Failed to retrive response: ${e.key}`)}catch(t){delete I[e.key],u(4,`Fetch failed: ${e.key}`)}return!1})}function ce(e){let t=_(e.target,p.hover);t&&(nt(q(t.href)),ct(t))}function B(e){let t=_(e.target,p.hover);if(!t)return;let r=m(t,4);if(r.key in W)return;if(x(r.key))return se(t);zt(t);let o=h(r);console.log("hver",o);let i=o.threshold||n.hover.threshold;ie(r.key,()=>f(this,null,function*(){if(!g("prefetch",t,r))return se(t);(yield d(o))&&se(t)}),i)}function ct(e){w?e.addEventListener("pointerenter",B,!1):e.addEventListener("mouseenter",B,!1)}function zt(e){w?(e.addEventListener("pointerout",ce,!1),e.removeEventListener("pointerenter",B,!1)):(e.addEventListener("mouseleave",ce,!1),e.removeEventListener("mouseenter",B,!1))}function se(e){w?(e.removeEventListener("pointerenter",B,!1),e.removeEventListener("pointerout",ce,!1)):(e.removeEventListener("mouseleave",ce,!1),e.removeEventListener("mouseenter",B,!1))}function ae(){!n.hover||a.hover||(v(ct,J(p.hover)),a.hover=!0)}function fe(){!a.hover||(v(se,J(p.hover)),a.hover=!1)}var K;function Gt(e){return f(this,null,function*(){if(e.isIntersecting){let t=m(e.target,5);if(!g("prefetch",e.target,t))return K.unobserve(e.target);(yield d(h(t)))?K.unobserve(e.target):(console.warn(`@brixtol/pjax: Prefetch will retry at next intersect for: ${t.key}`),K.observe(e.target))}})}function pe(){!n.intersect||a.intersect||(K=new IntersectionObserver(v(Gt),n.intersect),v(K.observe,Je(p.intersect,p.interHref)),a.intersect=!0)}function le(){!a.intersect||(K.disconnect(),a.intersect=!1)}function Ut(e){return new Promise((t,r)=>{let o=document.createElement("script");o.addEventListener("error",r),o.async=!1,o.text=e.target.text;for(let{nodeName:i,nodeValue:s}of e.target.attributes)o.setAttribute(i,s);document.contains(e.target)?e.target.replaceWith(o):(document.head.append(o),e.external?o.addEventListener("load",()=>o.remove()):o.remove()),e.external?o.addEventListener("load",()=>t()):t()})}function _t(e){if(!e.hasAttribute("src")&&!e.text)return;let t=e.type?e.type.trim().toLowerCase():"text/javascript",r=je.test(t)?1:t==="module"?2:NaN,o=c(null);return o.blocking=!0,o.evaluate=!1,o.external=!1,isNaN(r)||e.noModule&&r===1||(e.src&&(o.external=!0),(r!==1||o.external&&(e.hasAttribute("async")||e.defer))&&(o.blocking=!1),o.evaluate=!0,o.target=e),o}function pt(e){return f(this,null,function*(){try{let t=Ut(e);e.blocking&&(yield t)}catch(t){console.error(t)}})}function lt(e){return f(this,null,function*(){let r=S(e,_t).filter(o=>o.evaluate).reduce((o,i)=>f(this,null,function*(){return i.external?Promise.all([o,pt(i)]):(yield o,yield pt(i))}),Promise.resolve());yield Promise.race([r])})}function Jt({clientX:e,clientY:t},r){return e<=r.right&&e>=r.left&&t<=r.bottom&&t>=r.top}function Qt(e){let t=c(null),r=e.getBoundingClientRect(),o=e.getAttribute(`${n.schema}-proximity`),i=U.test(o)?Number(o):n.proximity.distance;return t.target=e,t.top=r.top-i,t.bottom=r.bottom+i,t.left=r.left-i,t.right=r.right+i,t}function Zt(e){let t=!1;return r=>{if(t)return;t=!0;let o=e.findIndex(i=>Jt(r,i));if(o===-1)setTimeout(()=>{t=!1},n.proximity.throttle);else{let{target:i}=e[o],s=h(m(i,6));ie(s.key,()=>f(this,null,function*(){if(!g("prefetch",i,s))return stop();(yield d(s))&&(e.splice(o,1),t=!1,e.length===0&&(stop(),u(1,"Proximity observer disconnected")))}),s.threshold||n.proximity.threshold)}}}var Z;function ue(){if(!n.proximity||a.proximity)return;let e=J(p.proximity).map(Qt);e.length>0&&(Z=Zt(e),w?addEventListener("pointermove",Z,!1):addEventListener("mousemove",Z,!1),a.proximity=!0)}function me(){!a.proximity||(w?removeEventListener("pointermove",Z,!1):removeEventListener("mousemove",Z,!1),a.proximity=!1)}function er(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING||-1}function tr(e){return f(this,null,function*(){let t=S(e.querySelectorAll(p.script));t.sort(er),yield lt(t)})}function rr(e){e.querySelectorAll(p.track).forEach(t=>{!t.hasAttribute("id")||he.has(t.id)||(document.body.appendChild(t),he.add(t.id))})}function or(e,t){let r=n.targets;if(r.length===1&&r[0]==="body")return document.body.replaceWith(t.body);let o=r.join(","),i=document.body.querySelectorAll(o),s=t.body.querySelectorAll(o);i.forEach((y,H)=>{if(!!y.matches(r[H])&&!!g("render",y,s[H])&&(y.replaceWith(s[H]),e.append||e.prepend)){let R=document.createElement("div");return t.childNodes.forEach(R.appendChild),e.append?y.appendChild(R):y.insertBefore(R,y.firstChild)}}),rr(t.body)}function nr(e,t){let r=e.hydrate.join(","),o=document.body.querySelectorAll(r);if(o.length>0){let i=t.body.querySelectorAll(r);o.forEach((s,y)=>{!g("hydrate",s,i[y])||!i[y]||(s.firstChild.nodeType===Node.TEXT_NODE?s.innerHTML=i[y].innerHTML:s.replaceWith(i[y]))})}e.type=2,k(e),Ie([e.key])}function L(e){let t=M(b[e.uuid]);return fe(),le(),me(),e.type===3?nr(e,t):(or(e,t),scrollTo(e.position.x,e.position.y)),tr(t.head),tt(),ae(),pe(),ue(),g("load",e),e}function mt(e){let t=c(null);return console.log("GET STATE",t),t.key=e.key,t.rev=e.rev,t.title=e.title,t.uuid=e.uuid,t.position=e.position,t.cache=e.cache,t.replace=e.replace,t.type=e.type,t.progress=e.progress,t}function dt(){return T.state&&"rev"in T.state?T.state.rev:!1}function gt(e){return console.log("REPLACE STATE",e),T.replaceState(mt(e),null,e.key),e}function Ne(e){return console.log("PUSH STATE",e),T.pushState(mt(e),null,e.key),e}function ht(t){return f(this,arguments,function*({state:e}){if(console.log("POP STATE",e),x(e.key))return L(l[e.key]);e.type=9;let r=yield d(e);return r?L(r):location.assign(e.key)})}function yt({timeStamp:e}){console.log("PERSIST",e)}function vt(){a.history||(addEventListener("popstate",ht),n.persist&&addEventListener("beforeunload",yt,{capture:!0}),a.history=!0)}function xt(){!a.history||(removeEventListener("popstate",ht),n.persist&&removeEventListener("beforeunload",yt,{capture:!0}),a.history=!1)}function ir(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}function bt(e,t){return function r(o){return o.preventDefault(),e.removeEventListener("click",r,!1),typeof t=="object"?(Ne(t),L(t)):typeof t=="string"?de(t):location.assign(t)}}function X(e){if(!ir(e))return;let t=_(e.target,p.href);if(!t)return;let r=m(t,2);!g("visit",e,r)||(x(r.key)?t.addEventListener("click",bt(t,k(r)),!1):(st(r.key),d(h(r)),t.addEventListener("click",bt(t,r.key),!1)))}function de(e,t=!1){return f(this,null,function*(){if(t){typeof t.cache=="string"&&!("hydrate"in t)&&(t.cache==="clear"?C():C(t.key));let r=yield d(t);if(r)return L(r)}else if(yield Oe(e)){let o=l[e];return Ne(o),L(o)}else it(e);return location.assign(e)})}function Pt(){a.hrefs||(w?addEventListener("pointerdown",X,!1):(addEventListener("mousedown",X,!1),addEventListener("touchstart",X,!1)),a.hrefs=!0)}function It(){!a.hrefs||(w?removeEventListener("pointerdown",X,!1):(removeEventListener("mousedown",X,!1),removeEventListener("touchstart",X,!1)),a.hrefs=!1)}var Y=c(null),Se=!1;function ee(){return Y}function Me(){Y.y=scrollY,Y.x=scrollX,Se||(requestAnimationFrame(ee),Se=!0)}function sr(){return Se=!1,Y.x=0,Y.y=0,Y}function Tt(){a.scroll||(Me(),addEventListener("scroll",Me,{passive:!0}),a.scroll=!0)}function wt(){!a.scroll||(removeEventListener("scroll",Me,!1),sr(),a.scroll=!1)}function At(){let e=h(m(1)),t=dt(),r=oe(e,document.documentElement.outerHTML);n.reverse&&typeof t=="string"&&(e.rev=t),e.position=ee(),g("connected",r),n.preload!==null&&(te(n.preload)?v(o=>f(this,null,function*(){let i=m(o,7);i.key!==o&&(yield d(h(i)))}),n.preload):typeof n.preload=="object"&&e.key in n.preload&&v(o=>f(this,null,function*(){let i=m(o,7);i.key!==o&&(yield d(h(i)))}),n.preload[e.key])),gt(r),r.rev!==r.key&&d(h(m(r.rev,8))),removeEventListener("load",At)}function Ot(){vt(),Tt(),Pt(),ae(),pe(),ue(),addEventListener("load",At),u(1,"Connected \u26A1")}function kt(){xt(),wt(),It(),fe(),le(),me(),C(),u(1,"Disconnected \u{1F614}")}var ar=!!(window.history.pushState&&window.requestAnimationFrame&&window.addEventListener&&window.DOMParser);function nn(e={}){ye(e),ar?/https?/.test(window.location.protocol)?addEventListener("DOMContentLoaded",Ot):u(4,"Invalid protocol, pjax expects https or http protocol"):u(4,"Browser is not supported")}function sn(e,t){if(e)if(t)e==="config"&&ye(t),e==="observers"&&E(a,t);else{if(e==="config")return n;if(e==="observers")return a;if(e==="pages")return l;if(e==="snapshots")return b}let r=c(null);return r.config=n,r.snapshots=b,r.pages=l,r.observers=a,r}function cn(e,t){return f(this,null,function*(){if(e===void 0)return Pe();if(typeof e=="string"){let r=q(e);x(r)||u(4,`No store exists at: ${r}`);let o=Pe(r);return t!==void 0?k(E(o.page,t)):o}if(typeof e=="object")return k(e)})}function an(e){return f(this,null,function*(){let t=l[T.state.key];e&&E(t,e),t.type=10;let r=yield d(t);return r?(u(1,"Triggered reload, page was re-cached"),L(r)):(u(2,"Reload failed, triggering refresh (cache will be purged)"),location.assign(t.key))})}function fn(e){return f(this,null,function*(){let t=m(e,13);t.location.origin!==z&&u(4,"Cross origin fetches are not allowed");let r=yield ne(t.key);if(r)return M(r)})}function pn(e){return C(e)}function ln(e){return f(this,null,function*(){})}function un(e,t){return f(this,null,function*(){let r=m(3);r.position=ee(),r.hydrate=t;let o=yield ne(e);if(!o)return u(2,"Hydration fetch failed");let i=x(r.key)?k(r,o):h(r);if(n.reverse){let s=m(r.rev,8);d(s)}return L(i)})}function mn(e){return f(this,null,function*(){let t=m(e,11);if(x(t.key)){u(2,`Cache already exists for ${t.key}, prefetch skipped`);return}let r=yield d(h(t));if(r)return r;u(4,`Prefetch failed for ${t.key}`)})}function dn(e,t){return f(this,null,function*(){let r=m(e),o=typeof t=="object"?E(r,t):r;return x(r.key)?de(r.key,k(o)):de(r.key,h(o))})}function gn(){kt()}export{pn as clear,nn as connect,gn as disconnect,fn as fetch,un as hydrate,$t as off,qt as on,mn as prefetch,an as reload,sn as session,cn as state,ar as supported,ln as update,dn as visit}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment