single-page-express
Version:
📄 A client-side implementation of the Express route API.
2 lines • 21.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("singlePageExpress",[],t):"object"==typeof exports?exports.singlePageExpress=t():e.singlePageExpress=t()}(this,()=>{return e={67(e,t){"use strict";t.YW=function(e,t={}){const{decode:n=decodeURIComponent,delimiter:s=r}=t,{regexp:a,keys:i}=p(e,t),l=i.map(e=>!1===n?o:"param"===e.type?n:e=>e.split(s).map(n));return function(e){const t=a.exec(e);if(!t)return!1;const r=t[0],o=Object.create(null);for(let e=1;e<t.length;e++){if(void 0===t[e])continue;const r=i[e-1],n=l[e-1];o[r.name]=n(t[e])}return{path:r,params:o}}};const r="/",o=e=>e,n=/^[$_\p{ID_Start}]$/u,s=/^[$\u200c\u200d\p{ID_Continue}]$/u,a={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function i(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class l{constructor(e,t){this.tokens=e,this.originalPath=t}}class c extends TypeError{constructor(e,t){let r=e;t&&(r+=`: ${t}`),r+="; visit https://git.new/pathToRegexpError for info",super(r),this.originalPath=t}}function d(e,t={}){const{encodePath:r=o}=t,i=[...e],d=[];let p=0,u=0;function f(){let t="";if(n.test(i[p]))do{t+=i[p++]}while(s.test(i[p]));else if('"'===i[p]){let r=p;for(;p++<i.length;){if('"'===i[p]){p++,r=0;break}"\\"===i[p]&&p++,t+=i[p]}if(r)throw new c(`Unterminated quote at index ${r}`,e)}if(!t)throw new c(`Missing parameter name at index ${p}`,e);return t}for(;p<i.length;){const e=i[p],t=a[e];t?d.push({type:t,index:p++,value:e}):"\\"===e?d.push({type:"escape",index:p++,value:i[p++]}):":"===e?d.push({type:"param",index:p++,value:f()}):"*"===e?d.push({type:"wildcard",index:p++,value:f()}):d.push({type:"char",index:p++,value:e})}return d.push({type:"end",index:p,value:""}),new l(function t(o){const n=[];for(;;){const s=d[u++];if(s.type===o)break;if("char"===s.type||"escape"===s.type){let e=s.value,t=d[u];for(;"char"===t.type||"escape"===t.type;)e+=t.value,t=d[++u];n.push({type:"text",value:r(e)});continue}if("param"!==s.type&&"wildcard"!==s.type){if("{"!==s.type)throw new c(`Unexpected ${s.type} at index ${s.index}, expected ${o}`,e);n.push({type:"group",tokens:t("}")})}else n.push({type:s.type,name:s.value})}return n}("end"),e)}function p(e,t={}){const{delimiter:o=r,end:n=!0,sensitive:s=!1,trailing:a=!0}=t,l=[],c=s?"":"i",p=[];for(const r of u(e,[])){const e="object"==typeof r?r:d(r,t);for(const t of f(e.tokens,0,[]))p.push(m(t,o,l,e.originalPath))}let h=`^(?:${p.join("|")})`;return a&&(h+=`(?:${i(o)}$)?`),h+=n?"$":`(?=${i(o)}|$)`,{regexp:new RegExp(h,c),keys:l}}function u(e,t){if(Array.isArray(e))for(const r of e)u(r,t);else t.push(e);return t}function*f(e,t,r){if(t===e.length)return yield r;const o=e[t];if("group"===o.type)for(const n of f(o.tokens,0,r.slice()))yield*f(e,t+1,n);else r.push(o);yield*f(e,t+1,r)}function m(e,t,r,o){let n="",s="",a=!0;for(const l of e)if("text"!==l.type)if("param"!==l.type&&"wildcard"!==l.type);else{if(!a&&!s)throw new c(`Missing text before "${l.name}" ${l.type}`,o);"param"===l.type?n+=`(${h(t,a?"":s)}+)`:n+="([\\s\\S]+)",r.push(l),s="",a=!1}else n+=i(l.value),s+=l.value,a||(a=l.value.includes(t));return n}function h(e,t){return t.length<2?e.length<2?`[^${i(e+t)}]`:`(?:(?!${i(e)})[^${i(t)}])`:e.length<2?`(?:(?!${i(t)})[^${i(e)}])`:`(?:(?!${i(t)}|${i(e)})[\\s\\S])`}},297(e){e.exports=function e(r,o,n){o=o||[];var s,a=(n=n||{}).strict,i=!1!==n.end,l=n.sensitive?"":"i",c=!1!==n.lookahead,d=0,p=o.length,u=0,f=0,m=0,h="";if(r instanceof RegExp){for(;s=t.exec(r.source);)"\\"!==s[0][0]&&o.push({name:s[1]||f++,optional:!1,offset:s.index});return r}if(Array.isArray(r))return r=r.map(function(t){return e(t,o,n).source}),new RegExp(r.join("|"),l);if("string"!=typeof r)throw new TypeError("path must be a string, array of strings, or regular expression");for(r=r.replace(/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,function(e,t,n,s,a,i,l,c){if("\\"===e[0])return h+=e,m+=2,e;if("."===e)return h+="\\.",d+=1,m+=1,"\\.";if(t||n?h="":h+=r.slice(m,c),m=c+e.length,"*"===e)return d+=3,"(.*)";if("/("===e)return h+="/",d+=2,"/(?:";t=t||"",n=n?"\\.":"",l=l||"",a=a?a.replace(/\\.|\*/,function(e){return"*"===e?"(.*)":e}):h?"((?:(?!/|"+h+").)+?)":"([^/"+n+"]+?)",o.push({name:s,optional:!!l,offset:c+d});var p="(?:"+n+t+a+(i?"((?:[/"+n+"].+?)?)":"")+")"+l;return d+=p.length-e.length,p});s=t.exec(r);)"\\"!==s[0][0]&&((p+u===o.length||o[p+u].offset>s.index)&&o.splice(p+u,0,{name:f++,optional:!1,offset:s.index}),u++);return r+=a?"":"/"===r[r.length-1]?"?":"/?",i?r+="$":"/"!==r[r.length-1]&&(r+=c?"(?=/|$)":"(?:/|$)"),new RegExp("^"+r,l)};var t=/\\.|\((?:\?<(.*?)>)?(?!\?)/g},524(e,t,r){const o=r(67).YW,n=r(297),s=new window.DOMParser;e.exports=function(e){const t={};let a;t.expressVersion=e.expressVersion,5!==t.expressVersion&&parseInt(t.expressVersion)<=4&&(t.expressVersion=4),t.expressVersion||(t.expressVersion=5),t.appVars={},t.templatingEngine=e.templatingEngine,t.templates=e.templates,t.templates||console.warn("single-page-express: no templates are loaded; as such the default render method will just print the template name and model to the console."),t.routes={},t.routeCallbacks={},t.defaultTarget=e.defaultTarget,t.defaultTargets=t.defaultTarget?[t.defaultTarget].concat(e.defaultTargets||[]):e.defaultTargets||[],t.defaultTargets.length||(t.defaultTargets=["body"]),t.beforeEveryRender=e.beforeEveryRender,t.updateDelay=e.updateDelay,t.afterEveryRender=e.afterEveryRender,t.postRenderCallbacks=e.postRenderCallbacks||{},t.topbarEnabled=!e.disableTopbar,t.topBarRoutes=e.topBarRoutes,(t.topbarEnabled||t.topBarRoutes)&&(t.topbar=r(663),t.topbar.config(e.topbarConfig||{barColors:{0:"rgba(0, 0, 0, .7)","1.0":"rgba(0, 0, 0, .7)"}})),t.alwaysSkipViewTransition=e.alwaysSkipViewTransition,t.alwaysScrollTop=e.alwaysScrollTop,t.urls={};const i=["checkout","copy","delete","get","head","lock","merge","mkactivity","mkcol","move","m-search","notify","options","patch","post","purge","put","report","search","subscribe","trace","unlock","unsubscribe"];function l(e,r,s,a){const c=r;let d,p;a?(d=s,p=(e,t)=>c(e,t,()=>a(e,t))):"string"!=typeof r&&"function"==typeof r?(d=s,p=r):(d=r,p=s),function(e,r,s){if("all"!==e){if(t.appVars["case sensitive routing"]&&(r=r.toLowerCase()),!t.appVars["strict routing"]&&r.endsWith("/")&&"/"!==r&&(r=r.slice(0,-1)),!(r in t.routes)){let a;if(5===t.expressVersion)try{a=o(r)}catch(e){console.error(`single-page-express: failed to register the route '${r}' because it could not be parsed.`),r.includes("*")&&console.error("single-page-express: routes with '*' in them should be written like '*all' instead in Express 5+ syntax."),console.error(e)}else a=n(r);t.routes[`${e}#${r}`]={method:e,route:r,matcher:a},t.routeCallbacks[`${e}#${r}`]=s}}else i.forEach((e,t)=>{l(t,e,r,s)})}(e,d,p)}t.appVars["case sensitive routing"]=!1,t.appVars.env="production",t.appVars["query parser"]=!0,t.appVars["strict routing"]=!1,t.appVars["subdomain offset"]=2,t.locals={},t.mountpath="",t.mount=()=>{},t.all=(e,t,r)=>{l("all",e,t,r)},t.delete=(e,t,r)=>{l("delete",e,t,r)},t.disable=e=>{t.appVars[e]=!1},t.disabled=e=>!t.appVars[e],t.enable=e=>{t.appVars[e]=!0},t.enabled=e=>!!t.appVars[e],t.engine=()=>{},t.get=(e,r,o)=>r||o?l("get",e,r,o):t.appVars[e],t.listen=()=>{},i.forEach(e=>{t[e]||(t[e]=(t,r,o)=>l(e,t,r,o))}),t.param=()=>{},t.path=()=>{},t.post=(e,t,r)=>{l("post",e,t,r)},t.put=(e,t,r)=>{l("put",e,t,r)},t.route=e=>{const t={route:e};return i.forEach(r=>{t[r]=(t,o)=>{l(r,t,e,o)}}),t},t.set=(e,r)=>{t.appVars[e]=r},t.use=()=>{},t.triggerRoute=p;const c={};c.app=t,c.baseUrl="",c.fresh=!0,c.hostname=window.location.hostname,c.ip="127.0.0.1",c.ips=[],c.signedCookies={},c.stale=!1,c.xhr=!0,c.accepts=()=>{},c.acceptsCharsets=()=>{},c.acceptsEncodings=()=>{},c.acceptsLanguages=()=>{},c.get=()=>{},c.is=()=>{},c.param=()=>{},c.range=()=>{},c.singlePageExpress=!0;const d={};async function p(e){let r=e.route;const o=e.method?(""+e.method).toLowerCase():"get";let n,s=r.split("?")[0];t.appVars["case sensitive routing"]&&(s=s.toLowerCase()),!t.appVars["strict routing"]&&s.length>1&&s.endsWith("/")&&(s=s.slice(0,-1));for(const e in t.routes){const r=t.routes[e];if(r.method===o&&(5===t.expressVersion?r.data=r.matcher(s):r.data=r.matcher.exec(s),r.data)){n=r;break}}if(n){e.event?.preventDefault(),(t.topbarEnabled&&!t.topBarRoutes||t.topBarRoutes?.includes?.(n.route))&&t.topbar.show(),t.urls[window.location.pathname]={scrollX:window.scrollX,scrollY:window.scrollY,scrollingChildContainers:{}};for(const e of document.querySelectorAll("[id]"))(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)&&(t.urls[window.location.pathname].scrollingChildContainers[e.id]={scrollX:e.scrollLeft,scrollY:e.scrollTop});if("get"===o&&!e.skipHistory){const e={index:u.length};u.push(e),f=u.length-1,window.history.pushState(e,"",r)}const s={...c};(e.parseBody||e.body)&&(e.event?.target?(s.body=Object.fromEntries(new FormData(e.event.target).entries()),e.event.submitter&&(s.body[e.event.submitter.name]=e.event.submitter.value)):e.body?s.body=e.body:s.body={},t.expressVersion>4&&s.body&&0===Object.keys(s.body).length&&(s.body=void 0));const i=document.cookie.split("; ");if(s.cookies={},i.forEach(e=>{const[t,r]=e.split("=");s.cookies[decodeURIComponent(t)]=decodeURIComponent(r)}),s.method=o,s.originalUrl=r,5===t.expressVersion)s.params=n.data.params;else{s.params={};const e=n.route.match(/:([^/]+)/g)?.map(e=>e.substring(1));if(e){const t=n.matcher.exec(n.data[0]);if(t)for(const[r,o]of e.entries())s.params[o]=t[r+1]}}const l=new URL(window.location.href);if(s.path=l.pathname,s.protocol=l.protocol,t.appVars["query parser"]){const e=r.split("?");r=e[0];const t=e.slice(1).join(", ");s.query=Object.fromEntries(new URLSearchParams(t).entries())}s.route=n.data,s.secure="https"===s.protocol||"https:"===s.protocol;const p=s.hostname.split(".").slice(0,-parseInt(t.appVars["subdomain offset"]));s.subdomains=p.reverse(),d.req=s,s.backButtonPressed=e.backButtonPressed,s.forwardButtonPressed=e.forwardButtonPressed;const m=document.querySelector("html");e.backButtonPressed?(m.classList.add("backButtonPressed"),m.classList.remove("forwardButtonPressed")):e.forwardButtonPressed?(m.classList.remove("backButtonPressed"),m.classList.add("forwardButtonPressed")):(m.classList.remove("backButtonPressed"),m.classList.remove("forwardButtonPressed")),await t.routeCallbacks[`${o}#${n.route}`](s,d);const h=()=>{if(!t.urls[r]||d.resetScroll||t.alwaysScrollTop)window.scrollTo(0,0),d.resetScroll&&(delete t.urls[r].scrollX,delete t.urls[r].scrollY,delete t.urls[r].scrollingChildContainers);else if(t.urls[r]){window.scrollTo(t.urls[r].scrollX||0,t.urls[r].scrollY||0);for(const e in t.urls[r].scrollingChildContainers)document.getElementById(e)&&document.getElementById(e).scrollTo(t.urls[r].scrollingChildContainers[e].scrollX||0,t.urls[r].scrollingChildContainers[e].scrollY||0)}d.resetScroll=null,(t.topbarEnabled&&!t.topBarRoutes||t.topBarRoutes?.includes?.(n.route))&&t.topbar.hide()};a?document.addEventListener("animationend",h):window.setTimeout(h,parseInt(d.updateDelay)||parseInt(t.updateDelay)||0)}}d.app=t,d.headersSent=!1,d.locals={},d.append=()=>d,d.attachment=()=>d,d.cookie=(e,r,o={})=>{const{domain:n,encode:s=encodeURIComponent,expires:a,httpOnly:i,maxAge:l,path:c="/",partitioned:d,priority:p,secure:u,signed:f,sameSite:m}=o;let h=`${s(e)}=${s(r)}`;a instanceof Date&&(h+=`; expires=${a.toUTCString()}`),l&&(h+=`; max-age=${l}`),n&&(h+=`; domain=${n}`),c&&(h+=`; path=${c}`),u&&(h+="; secure"),i&&(h+="; HttpOnly"),m&&(h+=`; SameSite=${m}`),d&&(h+="; Partitioned"),p&&(h+=`; Priority=${p}`),f&&"development"===t.appVars.env&&console.warn("Signed cookies are not supported in the browser context."),document.cookie=h},d.clearCookie=(e,t={})=>{const{domain:r,encode:o=encodeURIComponent,httpOnly:n,path:s="/",partitioned:a,priority:i,secure:l,signed:c,sameSite:d}=t,p=new Date(0).toUTCString();let u=`${o(e)}=; expires=${p}`;r&&(u+=`; domain=${r}`),s&&(u+=`; path=${s}`),l&&(u+="; secure"),n&&(u+="; HttpOnly"),d&&(u+=`; SameSite=${d}`),a&&(u+="; Partitioned"),i&&(u+=`; Priority=${i}`),c&&console.warn("Signed cookies are not supported in the frontend."),document.cookie=u},d.download=()=>d,d.end=()=>d,d.format=()=>d,d.get=()=>d,d.json=e=>(console.log(e),d),d.jsonp=()=>d,d.links=()=>d,d.location=()=>d,d.redirect=(e,t)=>(t||(t=e),p({route:t}),d),d.send=()=>d,d.sendFile=()=>d,d.sendStatus=()=>d,d.set=()=>d,d.status=()=>d,d.type=()=>d,d.vary=()=>d,c.res=d,t.render=function(r,o,n){o=o||{};const i=this.title,l=this.beforeRender,c=this.target,d=this.appendTargets,p=this.focus,u=this.removeMetaTags,f=this.removeStyleTags,m=this.removeLinkTags,h=this.removeScriptTags,g=this.removeBaseTags,y=this.removeTemplateTags,b=this.removeHeadTags,v=this.skipViewTransition,w=this.updateDelay,x=this.afterRender;this.title=null,this.beforeRender=null,this.target=null,this.focus=null,this.removeMetaTags=null,this.removeStyleTags=null,this.removeLinkTags=null,this.removeScriptTags=null,this.removeBaseTags=null,this.removeTemplateTags=null,this.removeHeadTags=null,this.skipViewTransition=null,this.updateDelay=null,this.afterRender=null;const T=()=>{t.postRenderCallbacks[r]&&("function"==typeof t.postRenderCallbacks[r]?t.postRenderCallbacks[r](o):console.error(`single-page-express: post-render callback for ${r} is not a function.`));for(const e in t.postRenderCallbacks)if(e.startsWith("*")){"function"==typeof t.postRenderCallbacks[e]?t.postRenderCallbacks[e](o):console.error(`single-page-express: post-render callback for ${e} is not a function.`);break}};if(e.renderMethod)e.renderMethod(r,o,n),T();else{let e;e||t.templates||(e="single-page-express: no templates are loaded.",console.log("template:",r),console.log("model:",o)),e||t?.templatingEngine.render&&"function"==typeof t?.templatingEngine?.render||(e="single-page-express: no template engine is loaded or the engine supplied does not have a `render` method; please use a templating engine that is compatible with Express",console.error(e)),e||t.templates[r]||(e=`single-page-express: attempted to render template which does not exist: ${r}`,console.error(e));let E="";if(!e){try{E=t.templatingEngine.render(r,o)}catch(t){const o=`single-page-express: error parsing post-rendered template: ${r}`;console.error(o),console.error(t.message),e=o+"\n"+t.message}if(!e){let k;try{k=s.parseFromString(E,"text/html")}catch(t){const o=`single-page-express: error parsing post-rendered template: ${r}`;console.error(o),console.error(t.message),e=o+"\n"+t.message}if(!e){let r;i?document.querySelector("title")&&(document.querySelector("title").innerHTML=i):k.querySelector("title")&&document.querySelector("title")&&(document.querySelector("title").innerHTML=k.querySelector("title").innerHTML),r=c?Array.isArray(c)?d?t.defaultTargets.concat(c):c:d?t.defaultTargets.concat([c]):[c]:t.defaultTargets;const s={model:o,markup:E,doc:k,targets:r};if(t.beforeEveryRender&&"function"==typeof t.beforeEveryRender&&t.beforeEveryRender(s),l&&"function"==typeof l&&l(s),u)for(const e of document.querySelectorAll("head meta"))e.remove();if(f)for(const e of document.querySelectorAll("head style"))e.remove();if(m)for(const e of document.querySelectorAll("head link"))e.remove();if(h)for(const e of document.querySelectorAll("head script"))e.remove();if(g)for(const e of document.querySelectorAll("head base"))e.remove();if(y)for(const e of document.querySelectorAll("head template"))e.remove();if(b)for(const e of document.querySelectorAll("head > :not(title)"))e.remove();for(const e of k.documentElement.attributes)document.documentElement.setAttribute(e.name,e.value);for(const e of k.head.attributes)document.head.setAttribute(e.name,e.value);const S=Array.from(document.head.children),$=Array.from(k.head.children),C=S.map(e=>e.outerHTML),R=$.filter(e=>!C.includes(e.outerHTML)),P=R.filter(e=>"link"===e.tagName.toLowerCase()),L=[];for(const e of P)L.push(new Promise(t=>{e.addEventListener("load",()=>t())}));for(const e of R)if("SCRIPT"!==e.nodeName||document.querySelector(`script[src="${e.src}"]`)||document.querySelector(`script[src="${e.src.replace(window.location.origin,"")}"]`))document.head.appendChild(e);else{const t=document.createElement("script");t.src=e.src,t.type="text/javascript",t.async=!0,L.push(new Promise(e=>{t.onload=()=>e()})),document.head.appendChild(t)}Promise.all(L).then(()=>{window.setTimeout(()=>{const o=()=>{for(const o of r){let n;if(document.querySelector(o)){n=document.querySelector(o);const e="BODY"===n.nodeName?"innerHTML":"outerHTML";k.querySelector(o)?n[e]=k.querySelector(o).outerHTML:k.body?n[e]=k.body.innerHTML:n[e]=k.innerHTML;const a=document.querySelector("[data-page-title]")||document.querySelector("h1[aria-label]")||document.querySelector("h1")||document.querySelector("title");if(!document.getElementById("singlePageExpressDefaultRenderMethodAriaLiveRegion")){const e=document.createElement("p");e.id="singlePageExpressDefaultRenderMethodAriaLiveRegion",e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.style.width="1px",e.style.height="1px",e.style.overflow="hidden",e.style.border="0",e.style.margin="-1px",e.style.padding="0",e.style.clipPath="inset(50%)",e.style.whiteSpace="nowrap",document.body.appendChild(e)}document.getElementById("singlePageExpressDefaultRenderMethodAriaLiveRegion").textContent="",document.getElementById("singlePageExpressDefaultRenderMethodAriaLiveRegion").textContent=a.textContent;const i=["A","INPUT","TEXTAREA","SELECT","BUTTON","FIELDSET"];let l=document.querySelector(p)||document.body.querySelector("[autofocus]");if(l&&!l.closest('[inert], [aria-disabled], [aria-hidden="true"]')&&(l=null),l&&l!==document.activeElement)l.focus(),i.includes(l.tagName)||(l.style.outline="none");else{const e=document.querySelector(r[0]),t=e.getAttribute("tabindex");e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),i.includes(e.tagName)||(e.style.outline="none"),null!==t&&e.setAttribute("tabindex",t)}t.afterEveryRender&&"function"==typeof t.afterEveryRender&&t.afterEveryRender(s),x&&"function"==typeof x&&x(s)}else{const t=`single-page-express: invalid target supplied: ${o}`;console.error(t),e=t}}n&&"function"==typeof n&&n(e,E),T()};!document.startViewTransition||v||t.alwaysSkipViewTransition?o():a=document.startViewTransition(o)},parseInt(w)||parseInt(t.updateDelay)||0)})}}}}},d.render=t.render,document.singlePageExpressEventListenerAdded||(document.addEventListener("click",e=>{"A"===e.target.tagName&&e.target.href&&p({route:e.target.getAttribute("href"),event:e})}),document.addEventListener("submit",e=>{e.target.getAttribute("action")&&p({route:e.target.getAttribute("action"),event:e,parseBody:!0,method:e.target.getAttribute("method")})})),document.singlePageExpressEventListenerAdded=!0;const u=[];let f=-1;return window.singlePageExpressGlobalsInitialized||(window.singlePageExpressGlobalsInitialized=!0,window.addEventListener("popstate",e=>{const t=e.state;if(!t)return;let r=!1,o=!1;const n=t.index;n<f?r=!0:n>f&&(o=!0),f=n,p({route:window.location.pathname,method:"get",skipHistory:!0,backButtonPressed:r,forwardButtonPressed:o})})),t}},663(e,t,r){var o;(function(n,s){"use strict";function a(){i.width=n.innerWidth,i.height=5*f.barThickness;var e=i.getContext("2d");e.shadowBlur=f.shadowBlur,e.shadowColor=f.shadowColor;var t,r=e.createLinearGradient(0,0,i.width,0);for(t in f.barColors)r.addColorStop(t,f.barColors[t]);e.lineWidth=f.barThickness,e.beginPath(),e.moveTo(0,f.barThickness/2),e.lineTo(Math.ceil(l*i.width),f.barThickness/2),e.strokeStyle=r,e.stroke()}var i,l,c,d=null,p=null,u=null,f={autoRun:!0,barThickness:3,barColors:{0:"rgba(26, 188, 156, .9)",".25":"rgba(52, 152, 219, .9)",".50":"rgba(241, 196, 15, .9)",".75":"rgba(230, 126, 34, .9)","1.0":"rgba(211, 84, 0, .9)"},shadowBlur:10,shadowColor:"rgba(0, 0, 0, .6)",className:null},m={config:function(e){for(var t in e)f.hasOwnProperty(t)&&(f[t]=e[t])},show:function(e){var t,r;c||(e?u=u||setTimeout(()=>m.show(),e):(c=!0,null!==p&&n.cancelAnimationFrame(p),i||((r=(i=s.createElement("canvas")).style).position="fixed",r.top=r.left=r.right=r.margin=r.padding=0,r.zIndex=100001,r.display="none",f.className&&i.classList.add(f.className),t="resize",e=a,(r=n).addEventListener?r.addEventListener(t,e,!1):r.attachEvent?r.attachEvent("on"+t,e):r["on"+t]=e),i.parentElement||s.body.appendChild(i),i.style.opacity=1,i.style.display="block",m.progress(0),f.autoRun&&function e(){d=n.requestAnimationFrame(e),m.progress("+"+.05*Math.pow(1-Math.sqrt(l),2))}()))},progress:function(e){return void 0===e||("string"==typeof e&&(e=(0<=e.indexOf("+")||0<=e.indexOf("-")?l:0)+parseFloat(e)),l=1<e?1:e,a()),l},hide:function(){clearTimeout(u),u=null,c&&(c=!1,null!=d&&(n.cancelAnimationFrame(d),d=null),function e(){return 1<=m.progress("+.1")&&(i.style.opacity-=.05,i.style.opacity<=.05)?(i.style.display="none",void(p=null)):void(p=n.requestAnimationFrame(e))}())}};"object"==typeof e.exports?e.exports=m:void 0===(o=function(){return m}.call(t,r,t,e))||(e.exports=o)}).call(this,window,document)}},t={},function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}(524);var e,t});
//# sourceMappingURL=single-page-express.min.js.map