@stacksjs/ts-cloud 0.12.0 → 0.12.2
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/dist/bin/{chunk-ta7sh0cc.js → chunk-33ct22z0.js} +1 -1
- package/dist/bin/{chunk-rv18092e.js → chunk-anx2a852.js} +32 -32
- package/dist/bin/{chunk-g6baf9c5.js → chunk-btdq3w81.js} +1 -1
- package/dist/bin/cli.js +223 -223
- package/dist/bin/dashboard-server.js +1 -1
- package/dist/{chunk-b087qsyf.js → chunk-hvwbgcs7.js} +1 -1
- package/dist/{chunk-nzqxdkch.js → chunk-kqnpprnh.js} +26 -26
- package/dist/deploy/index.js +1 -1
- package/dist/drivers/index.js +1 -1
- package/dist/drivers/shared/deploy-script.d.ts +46 -0
- package/dist/index.js +12 -12
- package/dist/pages/cloudflare-pages.d.ts +13 -0
- package/dist/ui/404.html +2 -2
- package/dist/ui/_stx/{router.fa5bc4dc.js → router.229f89ab.js} +1 -1
- package/dist/ui/_stx/runtime.dbee66d1.js +1 -0
- package/dist/ui/accept-invitation.html +2 -2
- package/dist/ui/access-denied.html +1 -1
- package/dist/ui/account/automation.html +6 -6
- package/dist/ui/account/security.html +2 -2
- package/dist/ui/applications/compose.html +6 -6
- package/dist/ui/applications/new.html +2 -2
- package/dist/ui/data/backups.html +6 -6
- package/dist/ui/data/services.html +6 -6
- package/dist/ui/data/volumes.html +6 -6
- package/dist/ui/index.html +6 -6
- package/dist/ui/infrastructure/topology.html +6 -6
- package/dist/ui/integrations.html +2 -2
- package/dist/ui/operations/alerts.html +6 -6
- package/dist/ui/operations/configuration.html +6 -6
- package/dist/ui/operations/jobs.html +6 -6
- package/dist/ui/operations/maintenance.html +6 -6
- package/dist/ui/operations/observability.html +6 -6
- package/dist/ui/operations/previews.html +6 -6
- package/dist/ui/operations/queue.html +6 -6
- package/dist/ui/operations/regions.html +6 -6
- package/dist/ui/operations/releases.html +6 -6
- package/dist/ui/operations/spend.html +6 -6
- package/dist/ui/operations/workloads.html +6 -6
- package/dist/ui/security.html +1 -1
- package/dist/ui/server/actions.html +6 -6
- package/dist/ui/server/activity.html +2 -2
- package/dist/ui/server/capacity.html +6 -6
- package/dist/ui/server/database.html +6 -6
- package/dist/ui/server/deployments.html +6 -6
- package/dist/ui/server/diagnostics.html +2 -2
- package/dist/ui/server/firewall.html +6 -6
- package/dist/ui/server/fleet.html +6 -6
- package/dist/ui/server/logs.html +6 -6
- package/dist/ui/server/metrics.html +6 -6
- package/dist/ui/server/security.html +2 -2
- package/dist/ui/server/services.html +2 -2
- package/dist/ui/server/sites.html +6 -6
- package/dist/ui/server/ssh-keys.html +6 -6
- package/dist/ui/server/team.html +6 -6
- package/dist/ui/server/terminal.html +3 -3
- package/dist/ui/serverless/alarms.html +6 -6
- package/dist/ui/serverless/assets.html +3 -3
- package/dist/ui/serverless/cost.html +2 -2
- package/dist/ui/serverless/data.html +6 -6
- package/dist/ui/serverless/deployments.html +3 -3
- package/dist/ui/serverless/firewall.html +2 -2
- package/dist/ui/serverless/functions.html +5 -5
- package/dist/ui/serverless/logs.html +6 -6
- package/dist/ui/serverless/metrics.html +2 -2
- package/dist/ui/serverless/queues.html +6 -6
- package/dist/ui/serverless/secrets.html +6 -6
- package/dist/ui/serverless/traces.html +6 -6
- package/dist/ui/serverless.html +6 -6
- package/dist/ui-src/src/charts.ts +4904 -21215
- package/package.json +6 -6
- package/dist/ui/_stx/runtime.c696d17a.js +0 -1
|
@@ -124,6 +124,19 @@ export declare class CloudflarePagesProvider {
|
|
|
124
124
|
* @returns The subset whose bytes still need sending
|
|
125
125
|
*/
|
|
126
126
|
private missingHashes;
|
|
127
|
+
/**
|
|
128
|
+
* Record hashes as present in the account's asset store.
|
|
129
|
+
*
|
|
130
|
+
* Uploading bytes is not by itself enough to make them findable: until the
|
|
131
|
+
* hashes are upserted, `check-missing` keeps reporting them absent, and every
|
|
132
|
+
* subsequent deploy re-uploads the entire site. Skipping this call is not
|
|
133
|
+
* visible in a single deploy — it only shows up as an upload that never gets
|
|
134
|
+
* cheaper.
|
|
135
|
+
*
|
|
136
|
+
* @param jwt - Upload token
|
|
137
|
+
* @param hashes - Every hash in the manifest, not only the newly uploaded ones
|
|
138
|
+
*/
|
|
139
|
+
private upsertHashes;
|
|
127
140
|
/**
|
|
128
141
|
* Upload one batch of assets.
|
|
129
142
|
*
|
package/dist/ui/404.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en" data-theme="dark">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
|
-
<meta name="stx-build" content="
|
|
5
|
+
<meta name="stx-build" content="mt97htifrbhwmi">
|
|
6
6
|
|
|
7
7
|
<!-- stx SEO Tags -->
|
|
8
8
|
<meta name="title" content="Page not found · ts-cloud">
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<meta name="twitter:description" content="A website built with stx templating engine">
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
<script data-stx-runtime src="/_stx/runtime.
|
|
18
|
+
<script data-stx-runtime src="/_stx/runtime.dbee66d1.js"></script>
|
|
19
19
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
20
20
|
<title>Page not found · ts-cloud</title>
|
|
21
21
|
<!-- Inline SVG favicon (single-accent tile) - declaring it stops the browser requesting /favicon.ico. -->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(function(){var ROUTER_REV=7;if(window.__stxRouter&&window.__stxRouter.__rev===ROUTER_REV)return;var defaults={container:"main",loadingClass:"stx-navigating",viewTransitions:true,cache:true,scrollToTop:true,prefetch:true,progress:true,progressColor:"#78dce8",progressHeight:"2px",interceptAllLinks:false,prefetchCacheMax:50,routeFocus:true,announceRoute:true,interceptForms:false};var o=Object.assign({},defaults,window.__stxRouterConfig||{},window.STX_ROUTER_OPTIONS||{});var containerSel=o.container;var debug=!!o.debug;function log(){if(debug&&typeof console!=="undefined"&&console.log)console.log.apply(console,arguments)};var buildMeta=document.querySelector('meta[name="stx-build"]');var loadedBuild=buildMeta?buildMeta.getAttribute("content")||"":"";window.__stxBuild=loadedBuild;function isBuildSkew(incoming){return!!(loadedBuild&&incoming&&incoming!==loadedBuild)};function reloadForSkew(url,incoming){log("[router] build skew: page is",loadedBuild,"server is",incoming,"— full navigation");location.href=url};function runViewTransition(callback){if(!o.viewTransitions||!document.startViewTransition)return false;try{var transition=document.startViewTransition(callback);var onAbort=function(err){log("[router] view transition aborted:",err&&err.message?err.message:err)};if(transition&&transition.ready&&transition.ready.catch)transition.ready.catch(onAbort);if(transition&&transition.finished&&transition.finished.catch)transition.finished.catch(onAbort);if(transition&&transition.updateCallbackDone&&transition.updateCallbackDone.catch)transition.updateCallbackDone.catch(onAbort);return true}catch(err){log("[router] view transition unavailable:",err&&err.message?err.message:err);return false}};var progEl=null;var progVal=0;var progTimer=null;function setProgress(v){progVal=v<0?0:v>100?100:v;if(!progEl)return;progEl.style.opacity=progVal>0?"1":"0";progEl.style.transform="scaleX("+progVal/100+")"};function startProgress(){if(!o.progress||!progEl)return;if(progTimer){clearInterval(progTimer);progTimer=null}setProgress(8);progTimer=setInterval(function(){if(progVal>=90)return;var inc=Math.max(0.4,(90-progVal)*0.08);setProgress(progVal+inc)},160)};function finishProgress(){if(!o.progress||!progEl)return;if(progTimer){clearInterval(progTimer);progTimer=null}setProgress(100);setTimeout(function(){if(!progEl)return;progEl.style.opacity="0";setTimeout(function(){progVal=0;if(progEl)progEl.style.transform="scaleX(0)"},260)},180)};var cache={};var prefetching={};var isNavigating=false;var cacheOrder=[];function setCache(key,html,layout,group,title,cattrs){if(!(key in cache))cacheOrder.push(key);cache[key]=html;layoutCache[key]=layout;layoutGroupCache[key]=group;titleCache[key]=title||"";attrsCache[key]=cattrs||"";while(cacheOrder.length>o.prefetchCacheMax){var oldest=cacheOrder.shift();delete cache[oldest];delete layoutCache[oldest];delete layoutGroupCache[oldest];delete titleCache[oldest];delete attrsCache[oldest]}};function applyTitle(t){if(t){try{document.title=decodeURIComponent(t)}catch(e){document.title=t}}};var pendingContainerAttrs="";function parseContainerAttrs(attrStr){var map={};if(!attrStr)return map;var probe=document.createElement("div");probe.innerHTML="<i "+attrStr+"></i>";var src=probe.firstChild;if(src&&src.attributes){Array.prototype.forEach.call(src.attributes,function(a){map[a.name]=a.value})}return map};function setContainerAttrs(el,map){if(!el)return;var prev=(el.getAttribute("data-stx-cattrs")||"").split(",");prev.forEach(function(n){if(n&&!(n in map))el.removeAttribute(n)});var names=[];for(var k in map){if(Object.prototype.hasOwnProperty.call(map,k)&&k!=="data-stx-cattrs"){el.setAttribute(k,map[k]);names.push(k)}}if(names.length)el.setAttribute("data-stx-cattrs",names.join(","));else el.removeAttribute("data-stx-cattrs")};function applyContainerAttrs(el,encoded){var attrStr="";if(encoded){try{attrStr=decodeURIComponent(encoded)}catch(e){attrStr=encoded}}setContainerAttrs(el,parseContainerAttrs(attrStr))};function touchCache(key){var i=cacheOrder.indexOf(key);if(i>=0){cacheOrder.splice(i,1);cacheOrder.push(key)}};function evictCache(key){var i=cacheOrder.indexOf(key);if(i>=0)cacheOrder.splice(i,1);delete cache[key];delete layoutCache[key];delete layoutGroupCache[key];delete titleCache[key];delete attrsCache[key]};function extractCssBlocks(css){var blocks=[];var i=0;var len=css.length;while(i<len){while(i<len&&(css[i]===" "||css[i]===`
|
|
2
2
|
`||css[i]==="\r"||css[i]==="\t"))i++;if(i>=len)break;var blockStart=i;var bracePos=css.indexOf("{",i);if(bracePos===-1)break;var depth=0;var j=bracePos;while(j<len){if(css[j]==="{")depth++;else if(css[j]==="}"){depth--;if(depth===0){j++;break}}j++}if(depth!==0)break;blocks.push(css.slice(blockStart,j).trim());i=j}return blocks};function mergeCrosswindCSS(existing,incoming){var blocks=extractCssBlocks(incoming);var newBlocks=[];for(var bi=0;bi<blocks.length;bi++){if(existing.indexOf(blocks[bi])===-1)newBlocks.push(blocks[bi])}if(newBlocks.length>0)return existing+`
|
|
3
3
|
`+newBlocks.join(`
|
|
4
|
-
`);return null};function getContainer(){return document.querySelector(containerSel)||document.querySelector("[data-stx-content]")||document.querySelector("main")};var layoutCache={};var layoutGroupCache={};var titleCache={};var attrsCache={};var executedScriptHashes={};var REGISTERS_SCOPE=/window\.stx\.mount|_scopes\s*\[|\.initScope\s*\(|__stxComponentFactories\s*\[/;function runsAlways(declared,code){if(declared==="always")return true;if(declared==="once")return false;if(REGISTERS_SCOPE.test(code))return true;var head=code.trimStart();return head.charAt(0)==="("||head.charAt(0)===";"};function hashScript(code){var h=0;for(var i=0;i<code.length;i++){h=(h<<5)-h+code.charCodeAt(i);h|=0}return h};function hasStaticImport(code){return/(?:^|\n)[ \t]*import(?:[ \t]+|[{*'"])/.test(code)};function generatedSetupName(code){var match=code.match(/function (__stx_setup_[A-Za-z0-9_]+)\s*\(/);return match?match[1]:""};function documentShipsRuntime(doc,html){if(doc&&doc.querySelector&&doc.querySelector("script[data-stx-runtime]"))return true;return html.indexOf("'use strict';var cloakStyle")!==-1||html.indexOf("_cleanupContainer")!==-1&&html.indexOf("signals runtime loading")!==-1};function isSignalsRuntimeScript(script,code){return!!(script&&script.hasAttribute&&script.hasAttribute("data-stx-runtime"))||code.indexOf("_cleanupContainer")!==-1&&code.indexOf("signals runtime loading")!==-1||code.indexOf("'use strict';var cloakStyle")!==-1};function fragmentNeedsRuntime(frag,declared){if(declared==="1")return true;if(declared==="0")return false;if(frag.indexOf("__stx_setup_")!==-1||frag.indexOf("data-stx-scope=")!==-1||frag.indexOf("data-stx-reactive")!==-1||/=\s*window\.stx\s*;/.test(frag))return true;var content=stripInertRegions(frag);return BARE_DIRECTIVE.test(content)||content.indexOf("{{")!==-1};function stripInertRegions(frag){return frag.replace(new RegExp("<scr"+"ipt\\b[\\s\\S]*?<\\/scr"+"ipt>","gi"),"").replace(/<style\b[\s\S]*?<\/style>/gi,"").replace(/<pre\b[\s\S]*?<\/pre>/gi,"").replace(/<code\b[\s\S]*?<\/code>/gi,"").replace(/<!--[\s\S]*?-->/g,"")};var BARE_DIRECTIVE=/\s(?::[a-z][\w-]*|@[a-z][\w.-]*|x-[a-z][\w-]*)\s*=\s*["']/i;function fragmentMarker(declared){return"<!--stx-fragment"+(declared==="true"?" rt=1":declared==="false"?" rt=0":"")+"-->"}document.querySelectorAll("script").forEach(function(s){var text=s.textContent||"";if(text.trim()&&!s.hasAttribute("src"))executedScriptHashes[hashScript(text)]=1});function cacheKey(url){var u=new URL(url,location.href);return u.pathname+u.search};function withCurrentLocale(href){var d=window.__stxI18n;if(d&&typeof d.localizeHref==="function")return d.localizeHref(href);return href};function defaultLayoutGroup(layout){if(!layout)return"app";var clean=String(layout).replace(/\\/g,"/");var parts=clean.split("/").filter(Boolean);var idx=parts.lastIndexOf("layouts");var part=idx>=0?parts[idx+1]:parts[parts.length-1];return part?part.replace(/\.stx$/i,""):"app"};function getCurrentLayoutGroup(){var meta=document.querySelector('meta[name="stx-layout-group"]');if(meta&&meta.getAttribute("content"))return meta.getAttribute("content");var layout=document.querySelector('meta[name="stx-layout"]');return defaultLayoutGroup(layout?layout.getAttribute("content"):"")};function getDocLayoutGroup(doc,layout){var meta=doc&&doc.querySelector?doc.querySelector('meta[name="stx-layout-group"]'):null;return meta&&meta.getAttribute("content")?meta.getAttribute("content"):defaultLayoutGroup(layout||"")};function checkLayoutChange(newLayout,targetUrl,newGroup){var currentLayout=document.querySelector('meta[name="stx-layout"]');var curLayoutName=currentLayout?currentLayout.getAttribute("content"):"";var curGroup=getCurrentLayoutGroup();var nextGroup=newGroup||defaultLayoutGroup(newLayout);log("[router] layout check: current="+curLayoutName+"("+curGroup+") new="+(newLayout||"")+"("+nextGroup+")");if(curGroup!==nextGroup){log("[router] layout group change:",curGroup,"→",nextGroup,"— full reload to:",targetUrl);return true}if(curLayoutName&&newLayout&&curLayoutName!==newLayout){log("[router] layout name change:",curLayoutName,"→",newLayout,"— full body swap");return true}return false};function shouldUseFragmentResponse(){return containerSel==="main"||containerSel==="[data-stx-content]"};function writeHistory(mode,href){if(mode==="replace")history.replaceState({},"",href);else history.pushState({},"",href)};function navigate(url,pushState,force){if(pushState&&typeof pushState==="object")pushState=pushState.replace?"replace":true;if(!force)url=withCurrentLocale(url);log("[router] navigate() called:",url,"isNavigating:",isNavigating);if(isNavigating)return Promise.resolve(false);var t=new URL(url,location.href);if(t.origin!==location.origin){location.href=url;return Promise.resolve(false)}if(t.pathname===location.pathname&&t.hash){if(pushState!==false)writeHistory(pushState,t.href);var el=document.querySelector(t.hash);if(el)el.scrollIntoView({behavior:"smooth"});return Promise.resolve(true)}if(pushState!==false&&t.href===location.href&&!t.hash&&!force)return Promise.resolve(false);isNavigating=true;document.body.classList.add(o.loadingClass);startProgress();var targetHref=t.href;var targetPath=cacheKey(url);var targetHash=t.hash;function done(){isNavigating=false;document.body.classList.remove(o.loadingClass);finishProgress()}if(o.cache&&cache[targetPath]&&!force){touchCache(targetPath);if(checkLayoutChange(layoutCache[targetPath],url,layoutGroupCache[targetPath])){log("[router] cache hit but layout changed — fetching full page");return fetch(url,{headers:{Accept:"text/html"}}).then(function(r){if(!r.ok)throw new Error(r.status);return r.text()}).then(function(html){log("[router] full page fetched from cache path, len:",html.length);pendingLayoutDecl={layout:layoutCache[targetPath]||"",group:layoutGroupCache[targetPath]||""};return swap(html,targetPath,pushState,targetHash)}).catch(function(err){console.error("[router] full page fetch error:",err);location.href=url}).finally(done)}pendingContainerAttrs=attrsCache[targetPath]||"";pendingLayoutDecl=null;return Promise.resolve(swap(cache[targetPath],targetPath,pushState,targetHash)).then(function(){applyTitle(titleCache[targetPath]);return true}).finally(done)}else{if(force&&cache[targetPath])evictCache(targetPath);var wantsFragment=shouldUseFragmentResponse();return fetch(url,{headers:wantsFragment?{"X-STX-Router":"true",Accept:"text/html"}:{Accept:"text/html"}}).then(function(r){if(!r.ok)throw new Error(r.status);if(r.redirected&&r.url){var rd=new URL(r.url,location.href);if(rd.origin!==location.origin){location.href=r.url;return null}log("[router] guard redirected:",url,"->",rd.pathname);url=rd.pathname+rd.search+rd.hash;targetPath=cacheKey(url);targetHash=rd.hash};var incomingBuild=r.headers.get("X-STX-Build")||"";if(isBuildSkew(incomingBuild)){reloadForSkew(url,incomingBuild);return null};var isFragment=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";var newLayout=r.headers.get("X-STX-Layout")||"";var newGroup=r.headers.get("X-STX-Layout-Group")||"";var newTitle=r.headers.get("X-STX-Title")||"";var newCAttrs=r.headers.get("X-STX-Container-Attrs")||"";var newRuntime=r.headers.get("X-STX-Runtime")||"";if(isFragment&&checkLayoutChange(newLayout,url,newGroup)){log("[router] layout change — fetching full page for document swap");return fetch(url,{headers:{Accept:"text/html"}}).then(function(fullRes){log("[router] full page fetched:",fullRes.status,"ok:",fullRes.ok);if(!fullRes.ok)throw new Error(fullRes.status);return fullRes.text().then(function(html){log("[router] full page html length:",html.length);return{html,isFragment:false,layout:newLayout,layoutGroup:newGroup,title:newTitle}})})}return r.text().then(function(html){return{html,isFragment,layout:newLayout,layoutGroup:newGroup,title:newTitle,containerAttrs:newCAttrs,runtime:newRuntime}})}).then(function(result){if(!result)return;if(result.isFragment)result.html=fragmentMarker(result.runtime)+result.html;if(o.cache)setCache(targetPath,result.html,result.layout,result.layoutGroup,result.title,result.containerAttrs);pendingContainerAttrs=result.isFragment?result.containerAttrs||"":"";pendingLayoutDecl=result.isFragment?null:{layout:result.layout||"",group:result.layoutGroup||""};return Promise.resolve(swap(result.html,targetPath,pushState,targetHash)).then(function(){if(result.isFragment)applyTitle(result.title);return true})}).catch(function(err){console.error("[router] fetch error:",err);location.href=url}).finally(done)}};function isStxDocument(html){return html.indexOf('name="stx-layout"')!==-1||html.indexOf("__stxRouterConfig")!==-1||html.indexOf("data-stx-content")!==-1};var pendingLayoutDecl=null;function routeAnnouncer(){var el=document.getElementById("stx-route-announcer");if(el)return el;el=document.createElement("div");el.id="stx-route-announcer";el.setAttribute("aria-live","polite");el.setAttribute("role","status");el.setAttribute("aria-atomic","true");el.style.cssText="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0";document.body.appendChild(el);return el};function announceRoute(){if(o.announceRoute===false)return;var c=getContainer();var h=c&&c.querySelector?c.querySelector("h1"):null;var label=h&&(h.textContent||"").trim()||document.title||"";if(!label)return;var el=routeAnnouncer();el.textContent="";el.textContent=label};function focusAfterNavigation(hash){if(o.routeFocus===false)return;var target=null;if(hash){try{target=document.querySelector(hash)}catch(e){target=null}}if(!target)target=getContainer();if(!target||!target.focus)return;if(!target.hasAttribute("tabindex"))target.setAttribute("tabindex","-1");try{target.focus({preventScroll:true})}catch(e){try{target.focus()}catch(e2){}}};function swap(html,url,pushState,hash){var fragMark=/^<!--stx-fragment(?: rt=([01]))?-->/.exec(html);var isFragment=!!fragMark;var declaredRuntime=fragMark&&fragMark[1]?fragMark[1]:"";if(isFragment)html=html.slice(fragMark[0].length);if(!isFragment&&!isStxDocument(html)){log("[router] non-stx document — full navigation to:",url);location.href=url;return Promise.resolve(false)};var currentContent=getContainer();log("[router] swap: isFragment="+isFragment+" container="+!!currentContent+" tag="+(currentContent&¤tContent.tagName)+" selector="+containerSel+" htmlLen="+html.length);if(!currentContent){log("[router] no container — falling back");location.href=url;return Promise.resolve(false)}if(isFragment){let doFragSwap=function(){var fragScripts=[];var fragScriptId=0;var fragStyles=[];var fragCrosswindHrefs=[];var fragCrosswindCSS=null;var cleanFrag=html.replace(new RegExp("<scr"+"ipt\\b([^>]*)>([\\s\\S]*?)<\\/scr"+"ipt>","gi"),function(m,attrs,code){var typeMatch=attrs.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i);var scriptType=(typeMatch&&(typeMatch[1]||typeMatch[2]||typeMatch[3])||"").trim().toLowerCase();if(scriptType&&scriptType!=="text/javascript"&&scriptType!=="application/javascript"&&scriptType!=="module")return m;if(code&&code.trim()&&!isSignalsRuntimeScript({hasAttribute:function(name){return name==="data-stx-runtime"&&attrs.indexOf("data-stx-runtime")!==-1}},code)){var slot="fragment-"+ ++fragScriptId;var scoped=/(?:^|\s)data-stx-scoped(?:\s|=|$)/i.test(attrs);var runDecl=(attrs.match(/data-stx-run\s*=\s*["']?(always|once)["']?/i)||[])[1];fragScripts.push({text:code,slot,setupName:generatedSetupName(code),scoped,run:runDecl?runDecl.toLowerCase():""});return"<scr"+'ipt type="application/stx-pending" data-stx-route-script="'+slot+'"'+(scoped?" data-stx-scoped":"")+(runDecl?' data-stx-run="'+runDecl.toLowerCase()+'"':"")+">"+code+"</scr"+"ipt>"}return""});cleanFrag=cleanFrag.replace(new RegExp("<sty"+"le\\b([^>]*)>([\\s\\S]*?)<\\/sty"+"le>","gi"),function(m,attrs,css){if(attrs.indexOf("data-crosswind")!==-1){fragCrosswindCSS=css}else{fragStyles.push({attrs,css})}return""});cleanFrag=cleanFrag.replace(new RegExp("<link\\b([^>]*)>","gi"),function(m,attrs){if(attrs.indexOf("data-crosswind")===-1)return m;var hrefMatch=attrs.match(/\bhref=(["'])(.*?)\1/i);if(hrefMatch&&hrefMatch[2])fragCrosswindHrefs.push(hrefMatch[2]);return""});document.querySelectorAll("style[data-stx-page]").forEach(function(s){s.remove()});if(fragCrosswindCSS){var curCrosswind=document.querySelector("head style[data-crosswind]");if(curCrosswind){var merged=mergeCrosswindCSS(curCrosswind.textContent||"",fragCrosswindCSS);if(merged)curCrosswind.textContent=merged}else{var cw=document.createElement("style");cw.setAttribute("data-crosswind","generated");cw.textContent=fragCrosswindCSS;document.head.appendChild(cw)}}fragCrosswindHrefs.forEach(function(href){var absolute=new URL(href,location.href).href;var exists=false;document.querySelectorAll("head link[data-crosswind][href]").forEach(function(link){if(new URL(link.getAttribute("href"),location.href).href===absolute)exists=true});if(exists)return;var link=document.createElement("link");link.setAttribute("data-crosswind","generated");link.setAttribute("rel","stylesheet");link.setAttribute("href",href);document.head.appendChild(link)});fragStyles.forEach(function(s){var el=document.createElement("style");el.textContent=s.css;el.setAttribute("data-stx-page","");document.head.appendChild(el)});applyContainerAttrs(currentContent,pendingContainerAttrs);currentContent.innerHTML=cleanFrag;document.querySelectorAll("script[data-stx-page]").forEach(function(s){s.remove()});if(pushState!==false)writeHistory(pushState,url+(hash||""));updateNav(url);updateActiveLinks();if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:"instant"});else if(hash){var el=document.querySelector(hash);if(el)el.scrollIntoView({behavior:"smooth"})}window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url}}));focusAfterNavigation(hash);setTimeout(announceRoute,0);log("[router] frag scripts:",fragScripts.length);document.querySelectorAll("script[data-stx-page]").forEach(function(s){s.remove()});fragScripts.sort(function(a,b){return(a.setupName?1:0)-(b.setupName?1:0)});fragScripts.forEach(function(entry){var code=entry.text;log("[router] exec script len:",code.length,"has __stx_setup:",code.indexOf("__stx_setup")>-1);var placeholder=document.querySelector('script[data-stx-route-script="'+entry.slot+'"]');var nestedScopedTemplate=false;var scopedLoopSetup=false;if(entry.scoped&&placeholder){document.querySelectorAll("template").forEach(function(template){if(template.contains(placeholder)||template.content&&template.content.contains(placeholder))nestedScopedTemplate=true});var loopRoot=placeholder.previousSibling;while(loopRoot&&(loopRoot.nodeType===Node.TEXT_NODE&&!(loopRoot.textContent||"").trim()||loopRoot.nodeType===Node.COMMENT_NODE))loopRoot=loopRoot.previousSibling;if(loopRoot&&loopRoot.nodeType===Node.ELEMENT_NODE&&loopRoot.hasAttribute("data-stx-scope")&&(loopRoot.hasAttribute(":for")||loopRoot.hasAttribute("@for")||loopRoot.hasAttribute("x-for"))){var loopScopeId=loopRoot.getAttribute("data-stx-scope");scopedLoopSetup=!!loopScopeId&&code.indexOf(loopScopeId)!==-1}}if(entry.scoped&&(!placeholder||!placeholder.parentNode||nestedScopedTemplate||scopedLoopSetup)){log("[router] leaving loop-scoped script for component hydration");return};var h=hashScript(code);var isSetup=code.indexOf("__stx_setup_")!==-1;var isAlreadyScoped=runsAlways(entry.run,code);if(!isSetup&&!isAlreadyScoped&&executedScriptHashes[h]){log("[router] skipping already-executed script (hash dedup)");return}executedScriptHashes[h]=1;var ns=document.createElement("script");var hasImport=hasStaticImport(code);if(hasImport){ns.type="module"}ns.textContent=hasImport||isAlreadyScoped?code:"{"+code+"}";ns.setAttribute("data-stx-page","");if(placeholder&&placeholder.parentNode){ns.setAttribute("data-stx-positioned","");placeholder.parentNode.replaceChild(ns,placeholder)}else{document.body.appendChild(ns)}});log("[router] scripts done. _latestSetup:",!!(window.stx&&window.stx._latestSetup));window.dispatchEvent(new Event("stx:load"))};if(!window.stx&&fragmentNeedsRuntime(html,declaredRuntime)){log("[router] fragment needs the signals runtime and this page has none — full navigation to:",url);location.href=url;return Promise.resolve(false)}if(window.stx&&window.stx._cleanupContainer)window.stx._cleanupContainer(currentContent);return new Promise(function(resolve,reject){function completeFragSwap(){try{doFragSwap();resolve(true)}catch(err){reject(err)}}if(runViewTransition(completeFragSwap)){}else{currentContent.style.transition="opacity 0.12s ease-out";currentContent.style.opacity="0";setTimeout(function(){completeFragSwap();currentContent.style.opacity="1";setTimeout(function(){currentContent.style.transition=""},150)},120)}})};var parser=new DOMParser;var doc=parser.parseFromString(html,"text/html");var docBuildMeta=doc.querySelector('meta[name="stx-build"]');var docBuild=docBuildMeta?docBuildMeta.getAttribute("content")||"":"";if(isBuildSkew(docBuild)){reloadForSkew(url,docBuild);return Promise.resolve(false)}if(!window.stx&&documentShipsRuntime(doc,html)){log("[router] document needs the signals runtime and this page has none — full navigation to:",url);location.href=url;return Promise.resolve(false)};var newContent=doc.querySelector(containerSel)||doc.querySelector("[data-stx-content]")||doc.querySelector("main");if(!newContent){location.href=url;return Promise.resolve(false)}if(window.stx&&window.stx._cleanupContainer){window.stx._cleanupContainer(currentContent)};function doSwap(){var keepIds={"stx-view-transitions":1,"stx-r-css":1};var curStyles=document.querySelectorAll("head style");var newStyles=doc.querySelectorAll("head style");var curCrosswind=document.querySelector("head style[data-crosswind]");var newCrosswind=null;newStyles.forEach(function(s){if(s.getAttribute("data-crosswind"))newCrosswind=s});if(curCrosswind&&newCrosswind){var merged=mergeCrosswindCSS(curCrosswind.textContent||"",newCrosswind.textContent||"");if(merged)curCrosswind.textContent=merged};var incoming=[];newStyles.forEach(function(s){if(!keepIds[s.id]&&!s.getAttribute("data-crosswind")){var ns=document.createElement("style");ns.textContent=s.textContent;ns.setAttribute("data-stx-incoming","");document.head.appendChild(ns);incoming.push(ns)}});if(!curCrosswind&&newCrosswind){var ns=document.createElement("style");ns.textContent=newCrosswind.textContent;ns.setAttribute("data-crosswind",newCrosswind.getAttribute("data-crosswind"));document.head.appendChild(ns)}curStyles.forEach(function(s){if(!keepIds[s.id]&&!s.hasAttribute("data-stx-incoming")&&!s.hasAttribute("data-crosswind"))s.remove()});incoming.forEach(function(s){s.removeAttribute("data-stx-incoming")});var docBase;try{docBase=new URL(url,location.href).href}catch(e){docBase=location.href};var linkSel='link[rel="stylesheet"],link[rel="preconnect"]';var curLinks={};document.querySelectorAll("head "+linkSel).forEach(function(l){var h=l.getAttribute("href");if(h)curLinks[new URL(h,location.href).href]=1});doc.querySelectorAll("head "+linkSel).forEach(function(l){var href=l.getAttribute("href");if(!href)return;var abs=new URL(href,docBase).href;if(curLinks[abs])return;curLinks[abs]=1;var nl=document.createElement("link");Array.from(l.attributes).forEach(function(a){nl.setAttribute(a.name,a.value)});document.head.appendChild(nl)});var newBody=doc.querySelector("body");var isLayoutChange=false;var declaredLayout=pendingLayoutDecl;pendingLayoutDecl=null;if(newBody){var newMeta=doc.querySelector('meta[name="stx-layout"]');var curMeta=document.querySelector('meta[name="stx-layout"]');var curLayout=curMeta?curMeta.getAttribute("content"):"";var newLayout=declaredLayout&&declaredLayout.layout?declaredLayout.layout:newMeta?newMeta.getAttribute("content"):"";var curGroup=getCurrentLayoutGroup();var newGroup=declaredLayout&&declaredLayout.group?declaredLayout.group:getDocLayoutGroup(doc,newLayout);isLayoutChange=curGroup!==newGroup||!!(curLayout&&newLayout&&curLayout!==newLayout)};var incomingSetupName=newBody?newBody.getAttribute("data-stx")||"":"";var routedBodyScripts=[];var routedBodyScriptId=0;function prepareRoutedBodyScripts(root){if(!root)return;root.querySelectorAll("script").forEach(function(s){var text=s.textContent||"";if(s.hasAttribute("src")){s.remove();return};var type=(s.getAttribute("type")||"").trim().toLowerCase();var executable=!type||type==="text/javascript"||type==="application/javascript"||type==="module";if(!executable||!text.trim())return;if(isSignalsRuntimeScript(s,text)||text.indexOf("__stxRouter")!==-1){s.remove();return};var slot="document-"+ ++routedBodyScriptId;var setupName=generatedSetupName(text);if(setupName)incomingSetupName=setupName;routedBodyScripts.push({text,runAlways:true,slot,setupName,run:s.getAttribute("data-stx-run")||""});s.textContent="";s.setAttribute("type","application/stx-pending");s.setAttribute("data-stx-route-script",slot)})}prepareRoutedBodyScripts(isLayoutChange?newBody:newContent);if(isLayoutChange&&newBody){log("[router] full body swap for layout change");var bodyHTML=newBody.innerHTML;document.body.innerHTML=bodyHTML;Array.from(newBody.attributes).forEach(function(attr){document.body.setAttribute(attr.name,attr.value)});var oldMeta=document.querySelector('meta[name="stx-layout"]');var freshMeta=doc.querySelector('meta[name="stx-layout"]');if(oldMeta&&freshMeta)oldMeta.setAttribute("content",freshMeta.getAttribute("content")||"");else if(freshMeta){var m=document.createElement("meta");m.name="stx-layout";m.content=freshMeta.getAttribute("content")||"";document.head.appendChild(m)};var oldGroupMeta=document.querySelector('meta[name="stx-layout-group"]');var freshGroupMeta=doc.querySelector('meta[name="stx-layout-group"]');if(oldGroupMeta&&freshGroupMeta)oldGroupMeta.setAttribute("content",freshGroupMeta.getAttribute("content")||"");else if(freshGroupMeta){var gm=document.createElement("meta");gm.name="stx-layout-group";gm.content=freshGroupMeta.getAttribute("content")||"";document.head.appendChild(gm)}currentContent=document.querySelector(containerSel)||document.querySelector("main")||document.body}else{var attrMap={};Array.prototype.forEach.call(newContent.attributes,function(a){attrMap[a.name]=a.value});setContainerAttrs(currentContent,attrMap);var cleanHTML=newContent.innerHTML;currentContent.innerHTML=cleanHTML;if(incomingSetupName)document.body.setAttribute("data-stx",incomingSetupName)};var loadedSrcs={};document.querySelectorAll("head script[src]").forEach(function(s){loadedSrcs[s.src]=1});var extPromises=[];doc.querySelectorAll("head script[src]").forEach(function(s){var src=new URL(s.getAttribute("src"),docBase).href;if(loadedSrcs[src])return;loadedSrcs[src]=1;extPromises.push(new Promise(function(resolve,reject){var ns=document.createElement("script");ns.src=src;ns.onload=resolve;ns.onerror=reject;document.head.appendChild(ns)}))});document.querySelectorAll("script[data-stx-page]").forEach(function(s){s.remove()});var scripts=routedBodyScripts.slice();function addScript(text,runAlways,slot){scripts.push({text,runAlways:!!runAlways,slot:slot||""})}if(isLayoutChange){doc.querySelectorAll("head script").forEach(function(s){var text=s.textContent||"";if(s.hasAttribute("src"))return;if(!text.trim())return;if(isSignalsRuntimeScript(s,text))return;if(text.indexOf("__stx_setup_")!==-1)addScript(text,true)})}else{var seenSetups={};scripts.forEach(function(entry){var t=entry.text;if(t.indexOf("__stx_setup_")!==-1)seenSetups[t.substring(0,80)]=1});doc.querySelectorAll("script").forEach(function(s){var text=s.textContent||"";if(s.hasAttribute("src"))return;if(!text.trim())return;if(isSignalsRuntimeScript(s,text))return;if(text.indexOf("__stxRouter")!==-1)return;if(newContent.contains(s))return;if(text.indexOf("__stx_setup_")===-1&&!s.hasAttribute("data-stx-scoped")&&!s.hasAttribute("data-stx-page")&&!s.hasAttribute("data-stx-route-params"))return;var key=text.substring(0,80);if(seenSetups[key])return;seenSetups[key]=1;addScript(text,true)})}if(incomingSetupName){scripts.sort(function(a,b){var aPage=(a.setupName||generatedSetupName(a.text))===incomingSetupName?1:0;var bPage=(b.setupName||generatedSetupName(b.text))===incomingSetupName?1:0;return aPage-bPage})}if(pushState!==false)writeHistory(pushState,url+(hash||""));updateNav(url);updateActiveLinks();if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:"instant"});else if(hash){var el=document.querySelector(hash);if(el)el.scrollIntoView({behavior:"smooth"})};var newTitle=doc.querySelector("title");if(newTitle)document.title=newTitle.textContent;if(doc.documentElement&&doc.documentElement.lang){document.documentElement.lang=doc.documentElement.lang}if(doc.documentElement){var curRoot=document.documentElement,incRoot=doc.documentElement;var tokens=function(el,attr){var v=el.getAttribute(attr);return v?v.split(/\s+/).filter(Boolean):[]};var prevCls=tokens(curRoot,"data-stx-html-class"),nextCls=tokens(incRoot,"data-stx-html-class");prevCls.forEach(function(c){if(nextCls.indexOf(c)===-1)curRoot.classList.remove(c)});nextCls.forEach(function(c){curRoot.classList.add(c)});if(nextCls.length)curRoot.setAttribute("data-stx-html-class",nextCls.join(" "));else curRoot.removeAttribute("data-stx-html-class");var prevNames=tokens(curRoot,"data-stx-html-attrs"),nextNames=tokens(incRoot,"data-stx-html-attrs");prevNames.forEach(function(n){if(nextNames.indexOf(n)===-1)curRoot.removeAttribute(n)});nextNames.forEach(function(n){var v=incRoot.getAttribute(n);if(v!==null)curRoot.setAttribute(n,v)});if(nextNames.length)curRoot.setAttribute("data-stx-html-attrs",nextNames.join(" "));else curRoot.removeAttribute("data-stx-html-attrs")}window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url}}));function execScripts(){scripts.forEach(function(entry){var text=typeof entry==="string"?entry:entry.text;var runAlways=typeof entry==="string"?false:entry.runAlways;var h=hashScript(text);var isSetup=text.indexOf("__stx_setup_")!==-1;var hasImport=hasStaticImport(text);if(!runAlways&&!isSetup&&executedScriptHashes[h])return;executedScriptHashes[h]=1;var ns=document.createElement("script");if(hasImport){ns.type="module"};var alreadyScoped=runsAlways(typeof entry==="string"?"":entry.run,text);ns.textContent=hasImport||alreadyScoped?text:"{"+text+"}";ns.setAttribute("data-stx-page","");var placeholder=entry.slot?document.querySelector('script[data-stx-route-script="'+entry.slot+'"]'):null;if(placeholder&&placeholder.parentNode){ns.setAttribute("data-stx-positioned","");placeholder.parentNode.replaceChild(ns,placeholder)}else{document.body.appendChild(ns)}});window.dispatchEvent(new Event("stx:load"))}if(extPromises.length>0){Promise.all(extPromises).then(execScripts).catch(execScripts)}else{execScripts()}}return new Promise(function(resolve,reject){function completeSwap(){try{doSwap();resolve(true)}catch(err){reject(err)}}if(runViewTransition(completeSwap)){}else{currentContent.style.transition="opacity 0.12s ease-out";currentContent.style.opacity="0";setTimeout(function(){completeSwap();currentContent.style.opacity="1";setTimeout(function(){currentContent.style.transition=""},150)},120)}})};function isRouterExcluded(link){if(!link)return true;var href=link.getAttribute("href");if(!href)return true;if(href.startsWith("http")||href.startsWith("#")||href.startsWith("mailto:")||href.startsWith("tel:")||href.startsWith("javascript:"))return true;if(link.target==="_blank")return true;if(link.hasAttribute("data-stx-no-router")||link.hasAttribute("data-no-router")||link.hasAttribute("download"))return true;return false};var ownedRoutes=null;(function(){var raw=o.ownedRoutes;if(!raw||!raw.length)return;var compiled=[];for(var i=0;i<raw.length;i++){try{compiled.push(new RegExp(raw[i]))}catch(e){}}if(compiled.length)ownedRoutes=compiled})();function routerOwns(pathname){if(!ownedRoutes)return true;for(var i=0;i<ownedRoutes.length;i++){if(ownedRoutes[i].test(pathname))return true}return false};function shouldIntercept(link){if(isRouterExcluded(link))return false;var href=link.getAttribute("href");if(href.startsWith("?"))return true;if(href===location.pathname)return false;if(!getContainer())return false;var path=href;var q=path.indexOf("?");if(q!==-1)path=path.slice(0,q);var h=path.indexOf("#");if(h!==-1)path=path.slice(0,h);if(path.charAt(0)==="/"&&!routerOwns(path)){log("[router] not a known route, leaving to the browser:",href);return false}return true}document.addEventListener("click",function(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;if(!e.target||!e.target.closest)return;var link=e.target.closest("[data-stx-link]");if(link&&isRouterExcluded(link)){log("[router] excluded:",link.getAttribute("href"));return}if(!link&&o.interceptAllLinks){var anchor=e.target.closest("a[href]");if(anchor&&shouldIntercept(anchor))link=anchor}if(!link){return};var href=link.getAttribute("href");log("[router] click intercepted:",href,"container:",!!getContainer(),"defaultPrevented:",e.defaultPrevented);e.preventDefault();e.stopPropagation();log("[router] navigating to:",href);navigate(withCurrentLocale(href))},true);function formAttrOf(form,submitter,submitterAttr,formAttr){var v=submitter&&submitter.getAttribute?submitter.getAttribute(submitterAttr):null;return v!==null&&v!==undefined?v:form.getAttribute(formAttr)};function formTargetUrl(form,submitter){return formAttrOf(form,submitter,"formaction","action")||location.pathname+location.search};function formMethodOf(form,submitter){return String(formAttrOf(form,submitter,"formmethod","method")||"get").toLowerCase()};function formExcluded(form,submitter){if(!form||form.tagName!=="FORM")return true;if(form.hasAttribute("data-stx-no-router")||form.hasAttribute("data-no-router"))return true;if(form.target&&form.target!=="_self")return true;try{if(new URL(formTargetUrl(form,submitter),location.href).origin!==location.origin)return true}catch(e){return true}return false};function setFormPending(form,on){if(on){form.classList.add("stx-submitting");form.setAttribute("aria-busy","true")}else{form.classList.remove("stx-submitting");form.removeAttribute("aria-busy")}};function submitForm(form,submitter){var method=formMethodOf(form,submitter);var action=formTargetUrl(form,submitter);var fd=new FormData(form);if(submitter&&submitter.name)fd.append(submitter.name,submitter.value||"");if(method==="get"){var qs=new URLSearchParams;fd.forEach(function(v,k){if(typeof v==="string")qs.append(k,v)});var gu=new URL(action,location.href);gu.search=qs.toString();return navigate(gu.pathname+gu.search+gu.hash)}setFormPending(form,true);form.dispatchEvent(new CustomEvent("stx:form-submit",{bubbles:true,detail:{action,method}}));var enctype=String(formAttrOf(form,submitter,"formenctype","enctype")||"").toLowerCase();var body=enctype.indexOf("multipart")===0?fd:new URLSearchParams(fd);var wantsFragment=shouldUseFragmentResponse();return fetch(action,{method:method.toUpperCase(),body,headers:wantsFragment?{"X-STX-Router":"true",Accept:"text/html"}:{Accept:"text/html"},credentials:"same-origin"}).then(function(r){if(r.redirected&&r.url){var rd=new URL(r.url,location.href);if(rd.origin!==location.origin){location.href=r.url;return}return navigate(rd.pathname+rd.search+rd.hash)}return r.text().then(function(html){var isFrag=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";pendingContainerAttrs=isFrag?r.headers.get("X-STX-Container-Attrs")||"":"";pendingLayoutDecl=isFrag?null:{layout:r.headers.get("X-STX-Layout")||"",group:r.headers.get("X-STX-Layout-Group")||""};var marked=isFrag?fragmentMarker(r.headers.get("X-STX-Runtime")||"")+html:html;return Promise.resolve(swap(marked,cacheKey(action),"replace","")).then(function(){applyTitle(r.headers.get("X-STX-Title")||"")})})}).catch(function(err){console.error("[router] form submit failed:",err);form.dispatchEvent(new CustomEvent("stx:form-error",{bubbles:true,detail:{error:err,action}}))}).finally(function(){setFormPending(form,false)})}document.addEventListener("submit",function(e){if(e.defaultPrevented)return;var form=e.target;if(!form||form.tagName!=="FORM")return;if(!form.hasAttribute("data-stx-form")&&!form.hasAttribute("data-stx-link")&&!o.interceptForms)return;var submitter=e.submitter||null;if(formExcluded(form,submitter))return;if(!getContainer())return;e.preventDefault();try{submitForm(form,submitter)}catch(err){console.error("[router] form submit failed:",err);setFormPending(form,false);form.dispatchEvent(new CustomEvent("stx:form-error",{bubbles:true,detail:{error:err}}))}});window.addEventListener("popstate",function(){navigate(location.pathname+location.search+location.hash,false)});if(o.prefetch){document.addEventListener("mouseover",function(e){if(!e.target||!e.target.closest)return;var link=e.target.closest("[data-stx-link]");if(isRouterExcluded(link))return;var href=withCurrentLocale(link.getAttribute("href"));var key=cacheKey(href);if(cache[key]||prefetching[key])return;prefetching[key]=true;var wantsFragment=shouldUseFragmentResponse();fetch(href,{headers:wantsFragment?{"X-STX-Router":"true",Accept:"text/html"}:{Accept:"text/html"}}).then(function(r){if(r.redirected)return null;var isFrag=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";var pLayout=r.headers.get("X-STX-Layout")||"";var pGroup=r.headers.get("X-STX-Layout-Group")||"";var pTitle=r.headers.get("X-STX-Title")||"";var pRuntime=r.headers.get("X-STX-Runtime")||"";return r.text().then(function(html){return{html:isFrag?fragmentMarker(pRuntime)+html:html,layout:pLayout,layoutGroup:pGroup,title:pTitle}})}).then(function(result){if(result&&o.cache)setCache(key,result.html,result.layout,result.layoutGroup,result.title)}).catch(function(){}).finally(function(){delete prefetching[key]})},true)};function updateNav(url){document.querySelectorAll("nav a[href], #mobileNav a[href], [data-stx-nav] a[href]").forEach(function(a){var href=a.getAttribute("href");if(!href||href.startsWith("#")||href.startsWith("http"))return;var isActive=href===url||href==="/"&&url==="/";if(a.hasAttribute("data-stx-link")){var ac=a.getAttribute("data-stx-active-class")||"active";if(isActive)ac.split(" ").forEach(function(cls){if(cls)a.classList.add(cls)});else ac.split(" ").forEach(function(cls){if(cls)a.classList.remove(cls)})}})};function updateActiveLinks(){var links=document.querySelectorAll("[data-stx-link]");var cur=location.pathname;links.forEach(function(link){var href=link.getAttribute("to")||link.getAttribute("href")||"";var ac=link.getAttribute("active-class")||link.getAttribute("data-stx-active-class")||"active";var eac=link.getAttribute("exact-active-class")||link.getAttribute("data-stx-exact-active-class")||"exact-active";ac.split(" ").forEach(function(cls){if(cls)link.classList.remove(cls)});eac.split(" ").forEach(function(cls){if(cls)link.classList.remove(cls)});var isExact=cur===href;var isActive=href!=="/"?cur.startsWith(href):cur==="/";if(isExact)eac.split(" ").forEach(function(cls){if(cls)link.classList.add(cls)});if(isActive)ac.split(" ").forEach(function(cls){if(cls)link.classList.add(cls)})})};function injectStyles(){if(!document.getElementById("stx-r-css")){var s=document.createElement("style");s.id="stx-r-css";var sanitize=function(v){return String(v).replace(/[;{}()"'\\<>\n\r\t]/g,"")};var pc=sanitize(o.progressColor);var ph=sanitize(o.progressHeight);var css=".stx-navigating{cursor:wait}.stx-navigating a,.stx-navigating button{pointer-events:none}#stx-router-progress{position:fixed;top:0;left:0;right:0;height:"+ph+";background:"+pc+";box-shadow:0 0 8px "+pc+",0 0 4px "+pc+";transform:scaleX(0);transform-origin:left;transition:transform .18s ease-out,opacity .26s ease;opacity:0;pointer-events:none;z-index:999999}";if(o.viewTransitions&&"startViewTransition"in document){var dur=(o.viewTransitionDuration||220)+"ms";var ease=o.viewTransitionEasing||"cubic-bezier(0.16, 1, 0.3, 1)";css+="::view-transition-old(root),::view-transition-new(root){animation-duration:"+dur+";animation-timing-function:"+ease+"}";css+="::view-transition-old(root){animation-name:stx-r-fade-out}::view-transition-new(root){animation-name:stx-r-fade-in}";css+="@keyframes stx-r-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}";css+="@keyframes stx-r-fade-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}";css+="@media (prefers-reduced-motion: reduce){::view-transition-old(root),::view-transition-new(root){animation-duration:0s;animation-name:none}}"}s.textContent=css;document.head.appendChild(s)}if(o.progress&&!document.getElementById("stx-router-progress")){var el=document.createElement("div");el.id="stx-router-progress";el.setAttribute("role","progressbar");el.setAttribute("aria-hidden","true");document.documentElement.appendChild(el);progEl=el}else if(o.progress){progEl=document.getElementById("stx-router-progress")}};function injectViewTransitionCSS(){if(document.getElementById("stx-view-transitions"))return;var s=document.createElement("style");s.id="stx-view-transitions";s.textContent="::view-transition-group(root){animation:none}::view-transition-old(root){animation:none}::view-transition-new(root){animation:none}main,#app-content,[data-stx-content]{view-transition-name:stx-content}::view-transition-old(stx-content){animation:stx-fade-out .15s ease-out both}::view-transition-new(stx-content){animation:stx-fade-in .15s ease-in .1s both}@keyframes stx-fade-out{from{opacity:1}to{opacity:0}}@keyframes stx-fade-in{from{opacity:0}to{opacity:1}}::view-transition{background:transparent}::view-transition-group(stx-content){background:inherit;overflow:hidden}";(document.head||document.documentElement).appendChild(s)};var router={navigate,navigateTo:navigate,prefetch:function(url){var key=cacheKey(url);if(!cache[key]){var wantsFragment=shouldUseFragmentResponse();fetch(url,{headers:wantsFragment?{"X-STX-Router":"true"}:{Accept:"text/html"}}).then(function(r){var isFrag=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";var pLayout=r.headers.get("X-STX-Layout")||"";var pGroup=r.headers.get("X-STX-Layout-Group")||"";var pTitle=r.headers.get("X-STX-Title")||"";var pRuntime=r.headers.get("X-STX-Runtime")||"";return r.text().then(function(html){return{html:isFrag?fragmentMarker(pRuntime)+html:html,layout:pLayout,layoutGroup:pGroup,title:pTitle}})}).then(function(result){setCache(key,result.html,result.layout,result.layoutGroup,result.title)}).catch(function(){})}},refresh:function(){return navigate(location.pathname+location.search+location.hash,"replace",true)},invalidate:function(url){evictCache(cacheKey(url||location.pathname+location.search))},clearCache:function(){for(var k in cache)delete cache[k];for(var lk in layoutCache)delete layoutCache[lk];for(var gk in layoutGroupCache)delete layoutGroupCache[gk];cacheOrder.length=0},cache,swap,updateNav};router.__rev=ROUTER_REV;window.__stxRouter=router;window.stxRouter=router;if(window.stx)window.stx.router=router;function init(){injectStyles();injectViewTransitionCSS();updateActiveLinks();updateNav(location.pathname)}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",init);else init()})();
|
|
4
|
+
`);return null};function getContainer(){return document.querySelector(containerSel)||document.querySelector("[data-stx-content]")||document.querySelector("main")};var layoutCache={};var layoutGroupCache={};var titleCache={};var attrsCache={};var executedScriptHashes={};var REGISTERS_SCOPE=/window\.stx\.mount|_scopes\s*\[|\.initScope\s*\(|__stxComponentFactories\s*\[/;function runsAlways(declared,code){if(declared==="always")return true;if(declared==="once")return false;if(REGISTERS_SCOPE.test(code))return true;var head=code.trimStart();return head.charAt(0)==="("||head.charAt(0)===";"};function hashScript(code){var h=0;for(var i=0;i<code.length;i++){h=(h<<5)-h+code.charCodeAt(i);h|=0}return h};function hasStaticImport(code){return/(?:^|\n)[ \t]*import(?:[ \t]+|[{*'"])/.test(code)};function generatedSetupName(code){var match=code.match(/function (__stx_setup_[A-Za-z0-9_]+)\s*\(/);return match?match[1]:""};function documentShipsRuntime(doc,html){if(doc&&doc.querySelector&&doc.querySelector("script[data-stx-runtime]"))return true;return html.indexOf("'use strict';var cloakStyle")!==-1||html.indexOf("_cleanupContainer")!==-1&&html.indexOf("signals runtime loading")!==-1};function isSignalsRuntimeScript(script,code){return!!(script&&script.hasAttribute&&script.hasAttribute("data-stx-runtime"))||code.indexOf("_cleanupContainer")!==-1&&code.indexOf("signals runtime loading")!==-1||code.indexOf("'use strict';var cloakStyle")!==-1};function fragmentNeedsRuntime(frag,declared){if(declared==="1")return true;if(declared==="0")return false;if(frag.indexOf("__stx_setup_")!==-1||frag.indexOf("data-stx-scope=")!==-1||frag.indexOf("data-stx-reactive")!==-1||/=\s*window\.stx\s*;/.test(frag))return true;var content=stripInertRegions(frag);return BARE_DIRECTIVE.test(content)||content.indexOf("{{")!==-1};function stripInertRegions(frag){return frag.replace(new RegExp("<scr"+"ipt\\b[\\s\\S]*?<\\/scr"+"ipt>","gi"),"").replace(/<style\b[\s\S]*?<\/style>/gi,"").replace(/<pre\b[\s\S]*?<\/pre>/gi,"").replace(/<code\b[\s\S]*?<\/code>/gi,"").replace(/<!--[\s\S]*?-->/g,"")};var BARE_DIRECTIVE=/\s(?::[a-z][\w-]*|@[a-z][\w.-]*|x-[a-z][\w-]*)\s*=\s*["']/i;function fragmentMarker(declared){return"<!--stx-fragment"+(declared==="true"?" rt=1":declared==="false"?" rt=0":"")+"-->"}document.querySelectorAll("script").forEach(function(s){var text=s.textContent||"";if(text.trim()&&!s.hasAttribute("src"))executedScriptHashes[hashScript(text)]=1});function cacheKey(url){var u=new URL(url,location.href);return u.pathname+u.search};function withCurrentLocale(href){var d=window.__stxI18n;if(d&&typeof d.localizeHref==="function")return d.localizeHref(href);return href};function defaultLayoutGroup(layout){if(!layout)return"app";var clean=String(layout).replace(/\\/g,"/");var parts=clean.split("/").filter(Boolean);var idx=parts.lastIndexOf("layouts");var part=idx>=0?parts[idx+1]:parts[parts.length-1];return part?part.replace(/\.stx$/i,""):"app"};function getCurrentLayoutGroup(){var meta=document.querySelector('meta[name="stx-layout-group"]');if(meta&&meta.getAttribute("content"))return meta.getAttribute("content");var layout=document.querySelector('meta[name="stx-layout"]');return defaultLayoutGroup(layout?layout.getAttribute("content"):"")};function getDocLayoutGroup(doc,layout){var meta=doc&&doc.querySelector?doc.querySelector('meta[name="stx-layout-group"]'):null;return meta&&meta.getAttribute("content")?meta.getAttribute("content"):defaultLayoutGroup(layout||"")};function checkLayoutChange(newLayout,targetUrl,newGroup){var currentLayout=document.querySelector('meta[name="stx-layout"]');var curLayoutName=currentLayout?currentLayout.getAttribute("content"):"";var curGroup=getCurrentLayoutGroup();var nextGroup=newGroup||defaultLayoutGroup(newLayout);log("[router] layout check: current="+curLayoutName+"("+curGroup+") new="+(newLayout||"")+"("+nextGroup+")");if(curGroup!==nextGroup){log("[router] layout group change:",curGroup,"→",nextGroup,"— full reload to:",targetUrl);return true}if(curLayoutName&&newLayout&&curLayoutName!==newLayout){log("[router] layout name change:",curLayoutName,"→",newLayout,"— full body swap");return true}return false};function shouldUseFragmentResponse(){return containerSel==="main"||containerSel==="[data-stx-content]"};function writeHistory(mode,href){if(mode==="replace")history.replaceState({},"",href);else history.pushState({},"",href)};function navigate(url,pushState,force){if(pushState&&typeof pushState==="object")pushState=pushState.replace?"replace":true;if(!force)url=withCurrentLocale(url);log("[router] navigate() called:",url,"isNavigating:",isNavigating);if(isNavigating)return Promise.resolve(false);var t=new URL(url,location.href);if(t.origin!==location.origin){location.href=url;return Promise.resolve(false)}if(t.pathname===location.pathname&&t.hash){if(pushState!==false)writeHistory(pushState,t.href);var el=document.querySelector(t.hash);if(el)el.scrollIntoView({behavior:"smooth"});return Promise.resolve(true)}if(pushState!==false&&t.href===location.href&&!t.hash&&!force)return Promise.resolve(false);isNavigating=true;document.body.classList.add(o.loadingClass);startProgress();var targetHref=t.href;var targetPath=cacheKey(url);var targetHash=t.hash;function done(){isNavigating=false;document.body.classList.remove(o.loadingClass);finishProgress()}if(o.cache&&cache[targetPath]&&!force){touchCache(targetPath);if(checkLayoutChange(layoutCache[targetPath],url,layoutGroupCache[targetPath])){log("[router] cache hit but layout changed — fetching full page");return fetch(url,{headers:{Accept:"text/html"}}).then(function(r){if(!r.ok)throw new Error(r.status);return r.text()}).then(function(html){log("[router] full page fetched from cache path, len:",html.length);pendingLayoutDecl={layout:layoutCache[targetPath]||"",group:layoutGroupCache[targetPath]||""};return swap(html,targetPath,pushState,targetHash)}).catch(function(err){console.error("[router] full page fetch error:",err);location.href=url}).finally(done)}pendingContainerAttrs=attrsCache[targetPath]||"";pendingLayoutDecl=null;return Promise.resolve(swap(cache[targetPath],targetPath,pushState,targetHash)).then(function(){applyTitle(titleCache[targetPath]);return true}).finally(done)}else{if(force&&cache[targetPath])evictCache(targetPath);var wantsFragment=shouldUseFragmentResponse();return fetch(url,{headers:wantsFragment?{"X-STX-Router":"true",Accept:"text/html"}:{Accept:"text/html"}}).then(function(r){if(!r.ok)throw new Error(r.status);if(r.redirected&&r.url){var rd=new URL(r.url,location.href);if(rd.origin!==location.origin){location.href=r.url;return null}log("[router] guard redirected:",url,"->",rd.pathname);url=rd.pathname+rd.search+rd.hash;targetPath=cacheKey(url);targetHash=rd.hash};var incomingBuild=r.headers.get("X-STX-Build")||"";if(isBuildSkew(incomingBuild)){reloadForSkew(url,incomingBuild);return null};var isFragment=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";var newLayout=r.headers.get("X-STX-Layout")||"";var newGroup=r.headers.get("X-STX-Layout-Group")||"";var newTitle=r.headers.get("X-STX-Title")||"";var newCAttrs=r.headers.get("X-STX-Container-Attrs")||"";var newRuntime=r.headers.get("X-STX-Runtime")||"";if(isFragment&&checkLayoutChange(newLayout,url,newGroup)){log("[router] layout change — fetching full page for document swap");return fetch(url,{headers:{Accept:"text/html"}}).then(function(fullRes){log("[router] full page fetched:",fullRes.status,"ok:",fullRes.ok);if(!fullRes.ok)throw new Error(fullRes.status);return fullRes.text().then(function(html){log("[router] full page html length:",html.length);return{html,isFragment:false,layout:newLayout,layoutGroup:newGroup,title:newTitle}})})}return r.text().then(function(html){return{html,isFragment,layout:newLayout,layoutGroup:newGroup,title:newTitle,containerAttrs:newCAttrs,runtime:newRuntime}})}).then(function(result){if(!result)return;if(result.isFragment)result.html=fragmentMarker(result.runtime)+result.html;if(o.cache)setCache(targetPath,result.html,result.layout,result.layoutGroup,result.title,result.containerAttrs);pendingContainerAttrs=result.isFragment?result.containerAttrs||"":"";pendingLayoutDecl=result.isFragment?null:{layout:result.layout||"",group:result.layoutGroup||""};return Promise.resolve(swap(result.html,targetPath,pushState,targetHash)).then(function(){if(result.isFragment)applyTitle(result.title);return true})}).catch(function(err){console.error("[router] fetch error:",err);location.href=url}).finally(done)}};function isStxDocument(html){return html.indexOf('name="stx-layout"')!==-1||html.indexOf("__stxRouterConfig")!==-1||html.indexOf("data-stx-content")!==-1};var pendingLayoutDecl=null;function routeAnnouncer(){var el=document.getElementById("stx-route-announcer");if(el)return el;el=document.createElement("div");el.id="stx-route-announcer";el.setAttribute("aria-live","polite");el.setAttribute("role","status");el.setAttribute("aria-atomic","true");el.style.cssText="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0";document.body.appendChild(el);return el};function announceRoute(){if(o.announceRoute===false)return;var c=getContainer();var h=c&&c.querySelector?c.querySelector("h1"):null;var label=h&&(h.textContent||"").trim()||document.title||"";if(!label)return;var el=routeAnnouncer();el.textContent="";el.textContent=label};function focusAfterNavigation(hash){if(o.routeFocus===false)return;var target=null;if(hash){try{target=document.querySelector(hash)}catch(e){target=null}}if(!target)target=getContainer();if(!target||!target.focus)return;if(!target.hasAttribute("tabindex"))target.setAttribute("tabindex","-1");try{target.focus({preventScroll:true})}catch(e){try{target.focus()}catch(e2){}}};function swap(html,url,pushState,hash){var fragMark=/^<!--stx-fragment(?: rt=([01]))?-->/.exec(html);var isFragment=!!fragMark;var declaredRuntime=fragMark&&fragMark[1]?fragMark[1]:"";if(isFragment)html=html.slice(fragMark[0].length);if(!isFragment&&!isStxDocument(html)){log("[router] non-stx document — full navigation to:",url);location.href=url;return Promise.resolve(false)};var currentContent=getContainer();log("[router] swap: isFragment="+isFragment+" container="+!!currentContent+" tag="+(currentContent&¤tContent.tagName)+" selector="+containerSel+" htmlLen="+html.length);if(!currentContent){log("[router] no container — falling back");location.href=url;return Promise.resolve(false)}if(isFragment){let doFragSwap=function(){var fragScripts=[];var fragScriptId=0;var fragStyles=[];var fragCrosswindHrefs=[];var fragCrosswindCSS=null;var cleanFrag=html.replace(new RegExp("<scr"+"ipt\\b([^>]*)>([\\s\\S]*?)<\\/scr"+"ipt>","gi"),function(m,attrs,code){var typeMatch=attrs.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i);var scriptType=(typeMatch&&(typeMatch[1]||typeMatch[2]||typeMatch[3])||"").trim().toLowerCase();if(scriptType&&scriptType!=="text/javascript"&&scriptType!=="application/javascript"&&scriptType!=="module")return m;if(code&&code.trim()&&!isSignalsRuntimeScript({hasAttribute:function(name){return name==="data-stx-runtime"&&attrs.indexOf("data-stx-runtime")!==-1}},code)){var slot="fragment-"+ ++fragScriptId;var scoped=/(?:^|\s)data-stx-scoped(?:\s|=|$)/i.test(attrs);var runDecl=(attrs.match(/data-stx-run\s*=\s*["']?(always|once)["']?/i)||[])[1];fragScripts.push({text:code,slot,setupName:generatedSetupName(code),scoped,run:runDecl?runDecl.toLowerCase():""});return"<scr"+'ipt type="application/stx-pending" data-stx-route-script="'+slot+'"'+(scoped?" data-stx-scoped":"")+(runDecl?' data-stx-run="'+runDecl.toLowerCase()+'"':"")+">"+code+"</scr"+"ipt>"}return""});cleanFrag=cleanFrag.replace(new RegExp("<sty"+"le\\b([^>]*)>([\\s\\S]*?)<\\/sty"+"le>","gi"),function(m,attrs,css){if(attrs.indexOf("data-crosswind")!==-1){fragCrosswindCSS=css}else{fragStyles.push({attrs,css})}return""});cleanFrag=cleanFrag.replace(new RegExp("<link\\b([^>]*)>","gi"),function(m,attrs){if(attrs.indexOf("data-crosswind")===-1)return m;var hrefMatch=attrs.match(/\bhref=(["'])(.*?)\1/i);if(hrefMatch&&hrefMatch[2])fragCrosswindHrefs.push(hrefMatch[2]);return""});document.querySelectorAll("style[data-stx-page]").forEach(function(s){s.remove()});if(fragCrosswindCSS){var curCrosswind=document.querySelector("head style[data-crosswind]");if(curCrosswind){var merged=mergeCrosswindCSS(curCrosswind.textContent||"",fragCrosswindCSS);if(merged)curCrosswind.textContent=merged}else{var cw=document.createElement("style");cw.setAttribute("data-crosswind","generated");cw.textContent=fragCrosswindCSS;document.head.appendChild(cw)}}fragCrosswindHrefs.forEach(function(href){var absolute=new URL(href,location.href).href;var exists=false;document.querySelectorAll("head link[data-crosswind][href]").forEach(function(link){if(new URL(link.getAttribute("href"),location.href).href===absolute)exists=true});if(exists)return;var link=document.createElement("link");link.setAttribute("data-crosswind","generated");link.setAttribute("rel","stylesheet");link.setAttribute("href",href);document.head.appendChild(link)});fragStyles.forEach(function(s){var el=document.createElement("style");el.textContent=s.css;el.setAttribute("data-stx-page","");document.head.appendChild(el)});applyContainerAttrs(currentContent,pendingContainerAttrs);currentContent.innerHTML=cleanFrag;document.querySelectorAll("script[data-stx-page]").forEach(function(s){s.remove()});if(pushState!==false)writeHistory(pushState,url+(hash||""));updateNav(url);updateActiveLinks();if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:"instant"});else if(hash){var el=document.querySelector(hash);if(el)el.scrollIntoView({behavior:"smooth"})}window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url}}));focusAfterNavigation(hash);setTimeout(announceRoute,0);log("[router] frag scripts:",fragScripts.length);document.querySelectorAll("script[data-stx-page]").forEach(function(s){s.remove()});fragScripts.sort(function(a,b){return(a.setupName?1:0)-(b.setupName?1:0)});fragScripts.forEach(function(entry){var code=entry.text;log("[router] exec script len:",code.length,"has __stx_setup:",code.indexOf("__stx_setup")>-1);var placeholder=document.querySelector('script[data-stx-route-script="'+entry.slot+'"]');var nestedScopedTemplate=false;var scopedLoopSetup=false;if(entry.scoped&&placeholder){document.querySelectorAll("template").forEach(function(template){if(template.contains(placeholder)||template.content&&template.content.contains(placeholder))nestedScopedTemplate=true});var loopRoot=placeholder.previousSibling;while(loopRoot&&(loopRoot.nodeType===Node.TEXT_NODE&&!(loopRoot.textContent||"").trim()||loopRoot.nodeType===Node.COMMENT_NODE))loopRoot=loopRoot.previousSibling;if(loopRoot&&loopRoot.nodeType===Node.ELEMENT_NODE&&loopRoot.hasAttribute("data-stx-scope")&&(loopRoot.hasAttribute(":for")||loopRoot.hasAttribute("@for")||loopRoot.hasAttribute("x-for"))){var loopScopeId=loopRoot.getAttribute("data-stx-scope");scopedLoopSetup=!!loopScopeId&&code.indexOf(loopScopeId)!==-1}}if(entry.scoped&&(!placeholder||!placeholder.parentNode||nestedScopedTemplate||scopedLoopSetup)){log("[router] leaving loop-scoped script for component hydration");return};var h=hashScript(code);var isSetup=code.indexOf("__stx_setup_")!==-1;var isAlreadyScoped=runsAlways(entry.run,code);if(!isSetup&&!isAlreadyScoped&&executedScriptHashes[h]){log("[router] skipping already-executed script (hash dedup)");return}executedScriptHashes[h]=1;var ns=document.createElement("script");var hasImport=hasStaticImport(code);if(hasImport){ns.type="module"}ns.textContent=hasImport||isAlreadyScoped?code:"{"+code+"}";ns.setAttribute("data-stx-page","");if(placeholder&&placeholder.parentNode){ns.setAttribute("data-stx-positioned","");placeholder.parentNode.replaceChild(ns,placeholder)}else{document.body.appendChild(ns)}});log("[router] scripts done. _latestSetup:",!!(window.stx&&window.stx._latestSetup));window.dispatchEvent(new Event("stx:load"))};if(!window.stx&&fragmentNeedsRuntime(html,declaredRuntime)){log("[router] fragment needs the signals runtime and this page has none — full navigation to:",url);location.href=url;return Promise.resolve(false)}if(window.stx&&window.stx._cleanupContainer)window.stx._cleanupContainer(currentContent);return new Promise(function(resolve,reject){function completeFragSwap(){try{doFragSwap();resolve(true)}catch(err){reject(err)}}if(runViewTransition(completeFragSwap)){}else{currentContent.style.transition="opacity 0.12s ease-out";currentContent.style.opacity="0";setTimeout(function(){completeFragSwap();currentContent.style.opacity="1";setTimeout(function(){currentContent.style.transition=""},150)},120)}})};var parser=new DOMParser;var doc=parser.parseFromString(html,"text/html");var docBuildMeta=doc.querySelector('meta[name="stx-build"]');var docBuild=docBuildMeta?docBuildMeta.getAttribute("content")||"":"";if(isBuildSkew(docBuild)){reloadForSkew(url,docBuild);return Promise.resolve(false)}if(!window.stx&&documentShipsRuntime(doc,html)){log("[router] document needs the signals runtime and this page has none — full navigation to:",url);location.href=url;return Promise.resolve(false)};var newContent=doc.querySelector(containerSel)||doc.querySelector("[data-stx-content]")||doc.querySelector("main");if(!newContent){location.href=url;return Promise.resolve(false)}if(window.stx&&window.stx._cleanupContainer){window.stx._cleanupContainer(currentContent)};function doSwap(){var keepIds={"stx-view-transitions":1,"stx-r-css":1};var curStyles=document.querySelectorAll("head style");var newStyles=doc.querySelectorAll("head style");var curCrosswind=document.querySelector("head style[data-crosswind]");var newCrosswind=null;newStyles.forEach(function(s){if(s.getAttribute("data-crosswind"))newCrosswind=s});if(curCrosswind&&newCrosswind){var merged=mergeCrosswindCSS(curCrosswind.textContent||"",newCrosswind.textContent||"");if(merged)curCrosswind.textContent=merged};var incoming=[];newStyles.forEach(function(s){if(!keepIds[s.id]&&!s.getAttribute("data-crosswind")){var ns=document.createElement("style");ns.textContent=s.textContent;ns.setAttribute("data-stx-incoming","");document.head.appendChild(ns);incoming.push(ns)}});if(!curCrosswind&&newCrosswind){var ns=document.createElement("style");ns.textContent=newCrosswind.textContent;ns.setAttribute("data-crosswind",newCrosswind.getAttribute("data-crosswind"));document.head.appendChild(ns)}curStyles.forEach(function(s){if(!keepIds[s.id]&&!s.hasAttribute("data-stx-incoming")&&!s.hasAttribute("data-crosswind"))s.remove()});incoming.forEach(function(s){s.removeAttribute("data-stx-incoming")});var docBase;try{docBase=new URL(url,location.href).href}catch(e){docBase=location.href};var linkSel='link[rel="stylesheet"],link[rel="preconnect"]';var curLinks={};document.querySelectorAll("head "+linkSel).forEach(function(l){var h=l.getAttribute("href");if(h)curLinks[new URL(h,location.href).href]=1});doc.querySelectorAll("head "+linkSel).forEach(function(l){var href=l.getAttribute("href");if(!href)return;var abs=new URL(href,docBase).href;if(curLinks[abs])return;curLinks[abs]=1;var nl=document.createElement("link");Array.from(l.attributes).forEach(function(a){nl.setAttribute(a.name,a.value)});document.head.appendChild(nl)});var newBody=doc.querySelector("body");var isLayoutChange=false;var declaredLayout=pendingLayoutDecl;pendingLayoutDecl=null;if(newBody){var newMeta=doc.querySelector('meta[name="stx-layout"]');var curMeta=document.querySelector('meta[name="stx-layout"]');var curLayout=curMeta?curMeta.getAttribute("content"):"";var newLayout=declaredLayout&&declaredLayout.layout?declaredLayout.layout:newMeta?newMeta.getAttribute("content"):"";var curGroup=getCurrentLayoutGroup();var newGroup=declaredLayout&&declaredLayout.group?declaredLayout.group:getDocLayoutGroup(doc,newLayout);isLayoutChange=curGroup!==newGroup||!!(curLayout&&newLayout&&curLayout!==newLayout)};var incomingSetupName=newBody?newBody.getAttribute("data-stx")||"":"";var routedBodyScripts=[];var routedBodyScriptId=0;function prepareRoutedBodyScripts(root){if(!root)return;root.querySelectorAll("script").forEach(function(s){var text=s.textContent||"";if(s.hasAttribute("src")){s.remove();return};var type=(s.getAttribute("type")||"").trim().toLowerCase();var executable=!type||type==="text/javascript"||type==="application/javascript"||type==="module";if(!executable||!text.trim())return;if(isSignalsRuntimeScript(s,text)||text.indexOf("__stxRouter")!==-1){s.remove();return};var slot="document-"+ ++routedBodyScriptId;var setupName=generatedSetupName(text);if(setupName)incomingSetupName=setupName;routedBodyScripts.push({text,runAlways:true,slot,setupName,run:s.getAttribute("data-stx-run")||""});s.textContent="";s.setAttribute("type","application/stx-pending");s.setAttribute("data-stx-route-script",slot)})}prepareRoutedBodyScripts(isLayoutChange?newBody:newContent);if(isLayoutChange&&newBody){log("[router] full body swap for layout change");var bodyHTML=newBody.innerHTML;document.body.innerHTML=bodyHTML;Array.from(newBody.attributes).forEach(function(attr){document.body.setAttribute(attr.name,attr.value)});var oldMeta=document.querySelector('meta[name="stx-layout"]');var freshMeta=doc.querySelector('meta[name="stx-layout"]');if(oldMeta&&freshMeta)oldMeta.setAttribute("content",freshMeta.getAttribute("content")||"");else if(freshMeta){var m=document.createElement("meta");m.name="stx-layout";m.content=freshMeta.getAttribute("content")||"";document.head.appendChild(m)};var oldGroupMeta=document.querySelector('meta[name="stx-layout-group"]');var freshGroupMeta=doc.querySelector('meta[name="stx-layout-group"]');if(oldGroupMeta&&freshGroupMeta)oldGroupMeta.setAttribute("content",freshGroupMeta.getAttribute("content")||"");else if(freshGroupMeta){var gm=document.createElement("meta");gm.name="stx-layout-group";gm.content=freshGroupMeta.getAttribute("content")||"";document.head.appendChild(gm)}currentContent=document.querySelector(containerSel)||document.querySelector("main")||document.body}else{var attrMap={};Array.prototype.forEach.call(newContent.attributes,function(a){attrMap[a.name]=a.value});setContainerAttrs(currentContent,attrMap);var cleanHTML=newContent.innerHTML;currentContent.innerHTML=cleanHTML;if(incomingSetupName)document.body.setAttribute("data-stx",incomingSetupName)};var loadedSrcs={};document.querySelectorAll("head script[src]").forEach(function(s){loadedSrcs[s.src]=1});var extPromises=[];doc.querySelectorAll("head script[src]").forEach(function(s){var src=new URL(s.getAttribute("src"),docBase).href;if(loadedSrcs[src])return;loadedSrcs[src]=1;extPromises.push(new Promise(function(resolve,reject){var ns=document.createElement("script");ns.src=src;ns.onload=resolve;ns.onerror=reject;document.head.appendChild(ns)}))});document.querySelectorAll("script[data-stx-page]").forEach(function(s){s.remove()});var scripts=routedBodyScripts.slice();function addScript(text,runAlways,slot){scripts.push({text,runAlways:!!runAlways,slot:slot||""})}if(isLayoutChange){doc.querySelectorAll("head script").forEach(function(s){var text=s.textContent||"";if(s.hasAttribute("src"))return;if(!text.trim())return;if(isSignalsRuntimeScript(s,text))return;if(text.indexOf("__stx_setup_")!==-1)addScript(text,true)})}else{var seenSetups={};scripts.forEach(function(entry){var t=entry.text;if(t.indexOf("__stx_setup_")!==-1)seenSetups[t.substring(0,80)]=1});doc.querySelectorAll("script").forEach(function(s){var text=s.textContent||"";if(s.hasAttribute("src"))return;if(!text.trim())return;if(isSignalsRuntimeScript(s,text))return;if(text.indexOf("__stxRouter")!==-1)return;if(newContent.contains(s))return;if(text.indexOf("__stx_setup_")===-1&&!s.hasAttribute("data-stx-scoped")&&!s.hasAttribute("data-stx-page")&&!s.hasAttribute("data-stx-route-params"))return;var key=text.substring(0,80);if(seenSetups[key])return;seenSetups[key]=1;addScript(text,true)})}if(incomingSetupName){scripts.sort(function(a,b){var aPage=(a.setupName||generatedSetupName(a.text))===incomingSetupName?1:0;var bPage=(b.setupName||generatedSetupName(b.text))===incomingSetupName?1:0;return aPage-bPage})}if(pushState!==false)writeHistory(pushState,url+(hash||""));updateNav(url);updateActiveLinks();if(o.scrollToTop&&!hash)window.scrollTo({top:0,behavior:"instant"});else if(hash){var el=document.querySelector(hash);if(el)el.scrollIntoView({behavior:"smooth"})};var newTitle=doc.querySelector("title");if(newTitle)document.title=newTitle.textContent;if(doc.documentElement&&doc.documentElement.lang){document.documentElement.lang=doc.documentElement.lang}if(doc.documentElement){var curRoot=document.documentElement,incRoot=doc.documentElement;var tokens=function(el,attr){var v=el.getAttribute(attr);return v?v.split(/\s+/).filter(Boolean):[]};var prevCls=tokens(curRoot,"data-stx-html-class"),nextCls=tokens(incRoot,"data-stx-html-class");prevCls.forEach(function(c){if(nextCls.indexOf(c)===-1)curRoot.classList.remove(c)});nextCls.forEach(function(c){curRoot.classList.add(c)});if(nextCls.length)curRoot.setAttribute("data-stx-html-class",nextCls.join(" "));else curRoot.removeAttribute("data-stx-html-class");var prevNames=tokens(curRoot,"data-stx-html-attrs"),nextNames=tokens(incRoot,"data-stx-html-attrs");prevNames.forEach(function(n){if(nextNames.indexOf(n)===-1)curRoot.removeAttribute(n)});nextNames.forEach(function(n){var v=incRoot.getAttribute(n);if(v!==null)curRoot.setAttribute(n,v)});if(nextNames.length)curRoot.setAttribute("data-stx-html-attrs",nextNames.join(" "));else curRoot.removeAttribute("data-stx-html-attrs")}window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url}}));function execScripts(){scripts.forEach(function(entry){var text=typeof entry==="string"?entry:entry.text;var runAlways=typeof entry==="string"?false:entry.runAlways;var h=hashScript(text);var isSetup=text.indexOf("__stx_setup_")!==-1;var hasImport=hasStaticImport(text);if(!runAlways&&!isSetup&&executedScriptHashes[h])return;executedScriptHashes[h]=1;var ns=document.createElement("script");if(hasImport){ns.type="module"};var alreadyScoped=runsAlways(typeof entry==="string"?"":entry.run,text);ns.textContent=hasImport||alreadyScoped?text:"{"+text+"}";ns.setAttribute("data-stx-page","");var placeholder=entry.slot?document.querySelector('script[data-stx-route-script="'+entry.slot+'"]'):null;if(placeholder&&placeholder.parentNode){ns.setAttribute("data-stx-positioned","");placeholder.parentNode.replaceChild(ns,placeholder)}else{document.body.appendChild(ns)}});window.dispatchEvent(new Event("stx:load"))}if(extPromises.length>0){Promise.all(extPromises).then(execScripts).catch(execScripts)}else{execScripts()}}return new Promise(function(resolve,reject){function completeSwap(){try{doSwap();resolve(true)}catch(err){reject(err)}}if(runViewTransition(completeSwap)){}else{currentContent.style.transition="opacity 0.12s ease-out";currentContent.style.opacity="0";setTimeout(function(){completeSwap();currentContent.style.opacity="1";setTimeout(function(){currentContent.style.transition=""},150)},120)}})};function isRouterExcluded(link){if(!link)return true;var href=link.getAttribute("href");if(!href)return true;if(href.startsWith("http")||href.startsWith("#")||href.startsWith("mailto:")||href.startsWith("tel:")||href.startsWith("javascript:"))return true;if(link.target==="_blank")return true;if(link.hasAttribute("data-stx-no-router")||link.hasAttribute("data-no-router")||link.hasAttribute("download"))return true;return false};var ownedRoutes=null;(function(){var raw=o.ownedRoutes;if(!raw||!raw.length)return;var compiled=[];for(var i=0;i<raw.length;i++){try{compiled.push(new RegExp(raw[i]))}catch(e){}}if(compiled.length)ownedRoutes=compiled})();function routerOwns(pathname){if(!ownedRoutes)return true;for(var i=0;i<ownedRoutes.length;i++){if(ownedRoutes[i].test(pathname))return true}return false};function shouldIntercept(link){if(isRouterExcluded(link))return false;var href=link.getAttribute("href");if(href.startsWith("?"))return true;if(href===location.pathname)return false;if(!getContainer())return false;var path=href;var q=path.indexOf("?");if(q!==-1)path=path.slice(0,q);var h=path.indexOf("#");if(h!==-1)path=path.slice(0,h);if(path.charAt(0)==="/"&&!routerOwns(path)){log("[router] not a known route, leaving to the browser:",href);return false}return true}document.addEventListener("click",function(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;if(!e.target||!e.target.closest)return;var link=e.target.closest("[data-stx-link]");if(link&&isRouterExcluded(link)){log("[router] excluded:",link.getAttribute("href"));return}if(!link&&o.interceptAllLinks){var anchor=e.target.closest("a[href]");if(anchor&&shouldIntercept(anchor))link=anchor}if(!link){return};var href=link.getAttribute("href");log("[router] click intercepted:",href,"container:",!!getContainer(),"defaultPrevented:",e.defaultPrevented);e.preventDefault();e.stopPropagation();log("[router] navigating to:",href);navigate(withCurrentLocale(href))},true);function formAttrOf(form,submitter,submitterAttr,formAttr){var v=submitter&&submitter.getAttribute?submitter.getAttribute(submitterAttr):null;return v!==null&&v!==undefined?v:form.getAttribute(formAttr)};function formTargetUrl(form,submitter){return formAttrOf(form,submitter,"formaction","action")||location.pathname+location.search};function formMethodOf(form,submitter){return String(formAttrOf(form,submitter,"formmethod","method")||"get").toLowerCase()};function formExcluded(form,submitter){if(!form||form.tagName!=="FORM")return true;if(form.hasAttribute("data-stx-no-router")||form.hasAttribute("data-no-router"))return true;if(form.target&&form.target!=="_self")return true;try{if(new URL(formTargetUrl(form,submitter),location.href).origin!==location.origin)return true}catch(e){return true}return false};function setFormPending(form,on){if(on){form.classList.add("stx-submitting");form.setAttribute("aria-busy","true")}else{form.classList.remove("stx-submitting");form.removeAttribute("aria-busy")}};function submitForm(form,submitter){var method=formMethodOf(form,submitter);var action=formTargetUrl(form,submitter);var fd=new FormData(form);if(submitter&&submitter.name)fd.append(submitter.name,submitter.value||"");if(method==="get"){var qs=new URLSearchParams;fd.forEach(function(v,k){if(typeof v==="string")qs.append(k,v)});var gu=new URL(action,location.href);gu.search=qs.toString();return navigate(gu.pathname+gu.search+gu.hash)}setFormPending(form,true);form.dispatchEvent(new CustomEvent("stx:form-submit",{bubbles:true,detail:{action,method}}));var enctype=String(formAttrOf(form,submitter,"formenctype","enctype")||"").toLowerCase();var body=enctype.indexOf("multipart")===0?fd:new URLSearchParams(fd);var wantsFragment=shouldUseFragmentResponse();return fetch(action,{method:method.toUpperCase(),body,headers:wantsFragment?{"X-STX-Router":"true",Accept:"text/html"}:{Accept:"text/html"},credentials:"same-origin"}).then(function(r){if(r.redirected&&r.url){var rd=new URL(r.url,location.href);if(rd.origin!==location.origin){location.href=r.url;return}return navigate(rd.pathname+rd.search+rd.hash)}return r.text().then(function(html){var isFrag=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";pendingContainerAttrs=isFrag?r.headers.get("X-STX-Container-Attrs")||"":"";pendingLayoutDecl=isFrag?null:{layout:r.headers.get("X-STX-Layout")||"",group:r.headers.get("X-STX-Layout-Group")||""};var marked=isFrag?fragmentMarker(r.headers.get("X-STX-Runtime")||"")+html:html;return Promise.resolve(swap(marked,cacheKey(action),"replace","")).then(function(){applyTitle(r.headers.get("X-STX-Title")||"")})})}).catch(function(err){console.error("[router] form submit failed:",err);form.dispatchEvent(new CustomEvent("stx:form-error",{bubbles:true,detail:{error:err,action}}))}).finally(function(){setFormPending(form,false)})}document.addEventListener("submit",function(e){if(e.defaultPrevented)return;var form=e.target;if(!form||form.tagName!=="FORM")return;if(!form.hasAttribute("data-stx-form")&&!form.hasAttribute("data-stx-link")&&!o.interceptForms)return;var submitter=e.submitter||null;if(formExcluded(form,submitter))return;if(!getContainer())return;e.preventDefault();try{submitForm(form,submitter)}catch(err){console.error("[router] form submit failed:",err);setFormPending(form,false);form.dispatchEvent(new CustomEvent("stx:form-error",{bubbles:true,detail:{error:err}}))}});window.addEventListener("popstate",function(){navigate(location.pathname+location.search+location.hash,false)});if(o.prefetch){document.addEventListener("mouseover",function(e){if(!e.target||!e.target.closest)return;var link=e.target.closest("[data-stx-link]");if(isRouterExcluded(link))return;var href=withCurrentLocale(link.getAttribute("href"));var key=cacheKey(href);if(cache[key]||prefetching[key])return;prefetching[key]=true;var wantsFragment=shouldUseFragmentResponse();fetch(href,{headers:wantsFragment?{"X-STX-Router":"true",Accept:"text/html"}:{Accept:"text/html"}}).then(function(r){if(r.redirected)return null;var isFrag=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";var pLayout=r.headers.get("X-STX-Layout")||"";var pGroup=r.headers.get("X-STX-Layout-Group")||"";var pTitle=r.headers.get("X-STX-Title")||"";var pRuntime=r.headers.get("X-STX-Runtime")||"";return r.text().then(function(html){return{html:isFrag?fragmentMarker(pRuntime)+html:html,layout:pLayout,layoutGroup:pGroup,title:pTitle}})}).then(function(result){if(result&&o.cache)setCache(key,result.html,result.layout,result.layoutGroup,result.title)}).catch(function(){}).finally(function(){delete prefetching[key]})},true)};function updateNav(url){document.querySelectorAll("nav a[href], #mobileNav a[href], [data-stx-nav] a[href]").forEach(function(a){var href=a.getAttribute("href");if(!href||href.startsWith("#")||href.startsWith("http"))return;var isActive=href===url||href==="/"&&url==="/";if(a.hasAttribute("data-stx-link")){var ac=a.getAttribute("data-stx-active-class")||"active";if(isActive)ac.split(" ").forEach(function(cls){if(cls)a.classList.add(cls)});else ac.split(" ").forEach(function(cls){if(cls)a.classList.remove(cls)})}})};function updateActiveLinks(){var links=document.querySelectorAll("[data-stx-link]");var cur=location.pathname;links.forEach(function(link){var href=link.getAttribute("to")||link.getAttribute("href")||"";var ac=link.getAttribute("active-class")||link.getAttribute("data-stx-active-class")||"active";var eac=link.getAttribute("exact-active-class")||link.getAttribute("data-stx-exact-active-class")||"exact-active";ac.split(" ").forEach(function(cls){if(cls)link.classList.remove(cls)});eac.split(" ").forEach(function(cls){if(cls)link.classList.remove(cls)});var isExact=cur===href;var isActive=href!=="/"?cur.startsWith(href):cur==="/";if(isExact)eac.split(" ").forEach(function(cls){if(cls)link.classList.add(cls)});if(isActive)ac.split(" ").forEach(function(cls){if(cls)link.classList.add(cls)});markCurrent(link,isExact)})};function markCurrent(link,isExact){if(isExact){if(link.getAttribute("aria-current")!=="page")link.setAttribute("aria-current","page");return}if(link.getAttribute("aria-current")==="page")link.removeAttribute("aria-current")};function injectStyles(){if(!document.getElementById("stx-r-css")){var s=document.createElement("style");s.id="stx-r-css";var sanitize=function(v){return String(v).replace(/[;{}()"'\\<>\n\r\t]/g,"")};var pc=sanitize(o.progressColor);var ph=sanitize(o.progressHeight);var css=".stx-navigating{cursor:wait}.stx-navigating a,.stx-navigating button{pointer-events:none}#stx-router-progress{position:fixed;top:0;left:0;right:0;height:"+ph+";background:"+pc+";box-shadow:0 0 8px "+pc+",0 0 4px "+pc+";transform:scaleX(0);transform-origin:left;transition:transform .18s ease-out,opacity .26s ease;opacity:0;pointer-events:none;z-index:999999}";if(o.viewTransitions&&"startViewTransition"in document){var dur=(o.viewTransitionDuration||220)+"ms";var ease=o.viewTransitionEasing||"cubic-bezier(0.16, 1, 0.3, 1)";css+="::view-transition-old(root),::view-transition-new(root){animation-duration:"+dur+";animation-timing-function:"+ease+"}";css+="::view-transition-old(root){animation-name:stx-r-fade-out}::view-transition-new(root){animation-name:stx-r-fade-in}";css+="@keyframes stx-r-fade-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}";css+="@keyframes stx-r-fade-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}";css+="@media (prefers-reduced-motion: reduce){::view-transition-old(root),::view-transition-new(root){animation-duration:0s;animation-name:none}}"}s.textContent=css;document.head.appendChild(s)}if(o.progress&&!document.getElementById("stx-router-progress")){var el=document.createElement("div");el.id="stx-router-progress";el.setAttribute("role","progressbar");el.setAttribute("aria-hidden","true");document.documentElement.appendChild(el);progEl=el}else if(o.progress){progEl=document.getElementById("stx-router-progress")}};function injectViewTransitionCSS(){if(document.getElementById("stx-view-transitions"))return;var s=document.createElement("style");s.id="stx-view-transitions";s.textContent="::view-transition-group(root){animation:none}::view-transition-old(root){animation:none}::view-transition-new(root){animation:none}main,#app-content,[data-stx-content]{view-transition-name:stx-content}::view-transition-old(stx-content){animation:stx-fade-out .15s ease-out both}::view-transition-new(stx-content){animation:stx-fade-in .15s ease-in .1s both}@keyframes stx-fade-out{from{opacity:1}to{opacity:0}}@keyframes stx-fade-in{from{opacity:0}to{opacity:1}}::view-transition{background:transparent}::view-transition-group(stx-content){background:inherit;overflow:hidden}";(document.head||document.documentElement).appendChild(s)};var router={navigate,navigateTo:navigate,prefetch:function(url){var key=cacheKey(url);if(!cache[key]){var wantsFragment=shouldUseFragmentResponse();fetch(url,{headers:wantsFragment?{"X-STX-Router":"true"}:{Accept:"text/html"}}).then(function(r){var isFrag=wantsFragment&&r.headers.get("X-STX-Fragment")==="true";var pLayout=r.headers.get("X-STX-Layout")||"";var pGroup=r.headers.get("X-STX-Layout-Group")||"";var pTitle=r.headers.get("X-STX-Title")||"";var pRuntime=r.headers.get("X-STX-Runtime")||"";return r.text().then(function(html){return{html:isFrag?fragmentMarker(pRuntime)+html:html,layout:pLayout,layoutGroup:pGroup,title:pTitle}})}).then(function(result){setCache(key,result.html,result.layout,result.layoutGroup,result.title)}).catch(function(){})}},refresh:function(){return navigate(location.pathname+location.search+location.hash,"replace",true)},invalidate:function(url){evictCache(cacheKey(url||location.pathname+location.search))},clearCache:function(){for(var k in cache)delete cache[k];for(var lk in layoutCache)delete layoutCache[lk];for(var gk in layoutGroupCache)delete layoutGroupCache[gk];cacheOrder.length=0},cache,swap,updateNav};router.__rev=ROUTER_REV;window.__stxRouter=router;window.stxRouter=router;if(window.stx)window.stx.router=router;function init(){injectStyles();injectViewTransitionCSS();updateActiveLinks();updateNav(location.pathname)}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",init);else init()})();
|