@tempo-ai/mcp 0.0.155 → 0.0.156

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.
@@ -1,29 +1,29 @@
1
1
  exports.tempoRuntimeContract=1;exports.createRuntime=function(__tempoRuntime){const require=__tempoRuntime.require;const module={exports:{}};const exports=module.exports;
2
- var da=Object.create;var mt=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var ga=Object.getPrototypeOf,ha=Object.prototype.hasOwnProperty;var l=(t,e)=>mt(t,"name",{value:e,configurable:!0});var P=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ye=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ut=(t,e)=>{for(var r in e)mt(t,r,{get:e[r],enumerable:!0})},vn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ma(e))!ha.call(t,o)&&o!==r&&mt(t,o,{get:()=>e[o],enumerable:!(n=fa(e,o))||n.enumerable});return t};var wr=(t,e,r)=>(r=t!=null?da(ga(t)):{},vn(e||!t||!t.__esModule?mt(r,"default",{value:t,enumerable:!0}):r,t)),xr=t=>vn(mt({},"__esModule",{value:!0}),t);function Ee(t){let e=5381,r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);e=(e<<5)+e^o,r=o+(r<<6)+(r<<16)-r|0}return bn(e)+bn(r)}function bn(t){return(t>>>0).toString(16).padStart(8,"0")}var Ge=P(()=>{"use strict";l(Ee,"sourceVersionHash");l(bn,"toHex8")});function Ne(t){let e=t;for(;["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression","TSInstantiationExpression"].includes(e.type);){let r=e.expression;if(!r)break;e=r}return e}function Me(t){let e=Ne(t);if(["Literal","StringLiteral","NumericLiteral","BooleanLiteral"].includes(e.type)&&(typeof e.value=="string"||typeof e.value=="boolean"||typeof e.value=="number"&&Number.isFinite(e.value)))return e.value;if(e.type==="TemplateLiteral"){let r=e.expressions,n=e.quasis;if(r.length===0&&n.length===1&&typeof n[0]?.value.cooked=="string")return n[0].value.cooked}if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let r=Me(e.argument);if(typeof r=="number")return e.operator==="-"?-r:r}if(e.type==="BinaryExpression"&&["+","-","*","/"].includes(e.operator)){let r=Me(e.left),n=Me(e.right);if(typeof r!="number"||typeof n!="number")return null;let o=e.operator==="+"?r+n:e.operator==="-"?r-n:e.operator==="*"?r*n:r/n;return Number.isFinite(o)?o:null}return null}function gt(t){if(t.type!=="JSXExpressionContainer")return null;let e=Ne(t.expression);return e.type==="JSXElement"?e:null}function ht(t,e=!1){if(!e&&t.type==="Identifier")return typeof t.name=="string"?t.name:null;let r=Me(t);return typeof r=="string"||typeof r=="number"?String(r):null}var Vt=P(()=>{"use strict";l(Ne,"unwrapLiteralExpression");l(Me,"readLiteralExpression");l(gt,"literalJsxChild");l(ht,"literalPropertyName")});function wn(t,e,r=!1){let o=t.openingElement.attributes,i=[];!r&&e!=="JSXElement"&&e!=="JSXFragment"&&i.push(ya);let s=new Map;o.forEach((a,u)=>{let p=Sa(a);p!==null&&s.set(p,u)});let c=-1;o.forEach((a,u)=>{a.type==="JSXSpreadAttribute"&&(c=u)});for(let[a,u]of s){if(va(a))continue;let p=u<c,f=o[u].value;if(f!==null){if(a==="style"&&!p){i.push(...ba(f));continue}if(p)i.push(a);else{if(a==="className"&&wa(f))continue;Cn(f)||i.push(a)}}}return i.length>0?i.join(" "):c>=0?"":void 0}function xn(t){let e=t.children??[];if(e.some(o=>o.type==="JSXSpreadChild"))return;let r=[],n=0;for(let o of e){if(o.type==="JSXText"){let i=String(o.value??"");if(/^[ \t\r\n]*$/.test(i)&&/[\r\n]/.test(i))continue}else if(o.type==="JSXExpressionContainer"){if(o.expression.type==="JSXEmptyExpression")continue;!gt(o)&&!Cn(o)&&r.push(n)}n++}return r.length>0?r.join(" "):void 0}function Sa(t){if(t.type!=="JSXAttribute")return null;let e=t.name;return e.type==="JSXIdentifier"?e.name:e.type==="JSXNamespacedName"?`${e.namespace.name}:${e.name.name}`:null}function va(t){return t==="key"||t.startsWith("data-tempo-")}function ba(t){let e=t.type==="JSXExpressionContainer"?xa(t.expression):t;if(e.type!=="ObjectExpression")return["style"];let r=e.properties,n=new Map;r.forEach((i,s)=>{let c=En(i);c!==null&&n.set(c,s)});let o=[];for(let[i,s]of n){let c=r[s],a=r.slice(s+1).some(p=>p.type==="SpreadElement"||p.computed&&En(p)===null),u=c.type!=="ObjectMethod"&&!c.shorthand&&An(c.value);(a||!u)&&o.push(`style.${i}`)}return o}function En(t){return t.type==="Property"||t.type==="ObjectProperty"||t.type==="ObjectMethod"?ht(t.key,!!t.computed):null}function Cn(t){return t.type==="Literal"||t.type==="StringLiteral"?!0:t.type!=="JSXExpressionContainer"?!1:An(t.expression)}function wa(t){if(t.type!=="JSXExpressionContainer")return!1;let e=t.expression;if(e.type!=="CallExpression")return!1;let r=e.callee;return r.type!=="Identifier"||!Ea.has(r.name)?!1:e.arguments.every(n=>(n.type==="Literal"||n.type==="StringLiteral")&&typeof n.value=="string"||n.type==="TemplateLiteral"&&n.expressions.length===0)}function An(t){return Me(t)!==null}function xa(t){return Ne(t)}var Cr,ya,Ar,Ea,Bt=P(()=>{"use strict";Vt();Vt();Cr="data-tempo-expr",ya="#slot";l(wn,"expressionFacts");Ar="data-tempo-expr-children";l(xn,"expressionChildren");l(Sa,"attributeName");l(va,"unstamped");l(ba,"styleFacts");l(En,"styleKey");l(Cn,"isLiteralValue");Ea=new Set(["cn","clsx","twMerge","cx","classNames"]);l(wa,"isClassHelperCall");l(An,"isLiteral");l(xa,"unwrap")});function yt(t,e,r){let n=e-r;n=n<0?-n<<1|1:n<<1;do{let o=n&31;n>>>=5,n>0&&(o|=32),t.write(kn[o])}while(n>0);return e}function In(t){let e=new Ra,r=0,n=0,o=0,i=0;for(let s=0;s<t.length;s++){let c=t[s];if(s>0&&e.write(Aa),c.length===0)continue;let a=0;for(let u=0;u<c.length;u++){let p=c[u];u>0&&e.write(Ca),a=yt(e,p[0],a),p.length!==1&&(r=yt(e,p[1],r),n=yt(e,p[2],n),o=yt(e,p[3],o),p.length!==4&&(i=yt(e,p[4],i)))}}return e.flush()}var Ca,Aa,_n,kn,_a,Rn,Tn,Ra,Pn=P(()=>{Ca=44,Aa=59,_n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kn=new Uint8Array(64),_a=new Uint8Array(128);for(let t=0;t<_n.length;t++){let e=_n.charCodeAt(t);kn[t]=e,_a[e]=t}l(yt,"encodeInteger");Rn=1024*16,Tn=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},Ra=class{static{l(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Rn)}write(t){let{buffer:e}=this;e[this.pos++]=t,this.pos===Rn&&(this.out+=Tn.decode(e),this.pos=0)}flush(){let{buffer:t,out:e,pos:r}=this;return r>0?e+Tn.decode(t.subarray(0,r)):e}};l(In,"encode")});function Ta(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?t=>globalThis.btoa(unescape(encodeURIComponent(t))):typeof Buffer=="function"?t=>Buffer.from(t,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}function Ia(t){let e=t.split(`
3
- `),r=e.filter(i=>/^\t+/.test(i)),n=e.filter(i=>/^ {2,}/.test(i));if(r.length===0&&n.length===0)return null;if(r.length>=n.length)return" ";let o=n.reduce((i,s)=>{let c=/^ +/.exec(s)[0].length;return Math.min(c,i)},1/0);return new Array(o+1).join(" ")}function Pa(t,e){let r=t.split(/[/\\]/),n=e.split(/[/\\]/);for(r.pop();r[0]===n[0];)r.shift(),n.shift();if(r.length){let o=r.length;for(;o--;)r[o]=".."}return r.concat(n).join("/")}function Na(t){return Ma.call(t)==="[object Object]"}function Mn(t){let e=t.split(`
4
- `),r=[];for(let n=0,o=0;n<e.length;n++)r.push(o),o+=e[n].length+1;return l(function(o){let i=0,s=r.length;for(;i<s;){let u=i+s>>1;o<r[u]?s=u:i=u+1}let c=i-1,a=o-r[c];return{line:c,column:a}},"locate")}var Wt,Jt,ka,_r,Ma,Oa,Rr,St,Qe,He,Tr=P(()=>{Pn();Wt=class t{static{l(this,"BitSet")}constructor(e){this.bits=e instanceof t?e.bits.slice():[]}add(e){this.bits[e>>5]|=1<<(e&31)}has(e){return!!(this.bits[e>>5]&1<<(e&31))}},Jt=class t{static{l(this,"Chunk")}constructor(e,r,n){this.start=e,this.end=r,this.original=n,this.intro="",this.outro="",this.content=n,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(e){this.outro+=e}appendRight(e){this.intro=this.intro+e}clone(){let e=new t(this.start,this.end,this.original);return e.intro=this.intro,e.outro=this.outro,e.content=this.content,e.storeName=this.storeName,e.edited=this.edited,e}contains(e){return this.start<e&&e<this.end}eachNext(e){let r=this;for(;r;)e(r),r=r.next}eachPrevious(e){let r=this;for(;r;)e(r),r=r.previous}edit(e,r,n){return this.content=e,n||(this.intro="",this.outro=""),this.storeName=r,this.edited=!0,this}prependLeft(e){this.outro=e+this.outro}prependRight(e){this.intro=e+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(e){let r=e-this.start,n=this.original.slice(0,r),o=this.original.slice(r);this.original=n;let i=new t(e,this.end,o);return i.outro=this.outro,this.outro="",this.end=e,this.edited?(i.edit("",!1),this.content=""):this.content=n,i.next=this.next,i.next&&(i.next.previous=i),i.previous=this,this.next=i,i}toString(){return this.intro+this.content+this.outro}trimEnd(e){if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;let r=this.content.replace(e,"");if(r.length)return r!==this.content&&(this.split(this.start+r.length).edit("",void 0,!0),this.edited&&this.edit(r,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(e,""),this.intro.length)return!0}trimStart(e){if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;let r=this.content.replace(e,"");if(r.length){if(r!==this.content){let n=this.split(this.end-r.length);this.edited&&n.edit(r,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(e,""),this.outro.length)return!0}};l(Ta,"getBtoa");ka=Ta(),_r=class{static{l(this,"SourceMap")}constructor(e){this.version=3,this.file=e.file,this.sources=e.sources,this.sourcesContent=e.sourcesContent,this.names=e.names,this.mappings=In(e.mappings),typeof e.x_google_ignoreList<"u"&&(this.x_google_ignoreList=e.x_google_ignoreList),typeof e.debugId<"u"&&(this.debugId=e.debugId)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+ka(this.toString())}};l(Ia,"guessIndent");l(Pa,"getRelativePath");Ma=Object.prototype.toString;l(Na,"isObject");l(Mn,"getLocator");Oa=/\w/,Rr=class{static{l(this,"Mappings")}constructor(e){this.hires=e,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(e,r,n,o){if(r.length){let i=r.length-1,s=r.indexOf(`
2
+ var ya=Object.create;var gt=Object.defineProperty;var Sa=Object.getOwnPropertyDescriptor;var va=Object.getOwnPropertyNames;var ba=Object.getPrototypeOf,Ea=Object.prototype.hasOwnProperty;var l=(t,e)=>gt(t,"name",{value:e,configurable:!0});var M=(t,e)=>()=>(t&&(e=t(t=0)),e);var Qe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Wt=(t,e)=>{for(var r in e)gt(t,r,{get:e[r],enumerable:!0})},En=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of va(e))!Ea.call(t,o)&&o!==r&&gt(t,o,{get:()=>e[o],enumerable:!(n=Sa(e,o))||n.enumerable});return t};var xr=(t,e,r)=>(r=t!=null?ya(ba(t)):{},En(e||!t||!t.__esModule?gt(r,"default",{value:t,enumerable:!0}):r,t)),Ar=t=>En(gt({},"__esModule",{value:!0}),t);function Ce(t){let e=5381,r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);e=(e<<5)+e^o,r=o+(r<<6)+(r<<16)-r|0}return wn(e)+wn(r)}function wn(t){return(t>>>0).toString(16).padStart(8,"0")}var Xe=M(()=>{"use strict";l(Ce,"sourceVersionHash");l(wn,"toHex8")});function Oe(t){let e=t;for(;["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression","TSInstantiationExpression"].includes(e.type);){let r=e.expression;if(!r)break;e=r}return e}function Ne(t){let e=Oe(t);if(["Literal","StringLiteral","NumericLiteral","BooleanLiteral"].includes(e.type)&&(typeof e.value=="string"||typeof e.value=="boolean"||typeof e.value=="number"&&Number.isFinite(e.value)))return e.value;if(e.type==="TemplateLiteral"){let r=e.expressions,n=e.quasis;if(r.length===0&&n.length===1&&typeof n[0]?.value.cooked=="string")return n[0].value.cooked}if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let r=Ne(e.argument);if(typeof r=="number")return e.operator==="-"?-r:r}if(e.type==="BinaryExpression"&&["+","-","*","/"].includes(e.operator)){let r=Ne(e.left),n=Ne(e.right);if(typeof r!="number"||typeof n!="number")return null;let o=e.operator==="+"?r+n:e.operator==="-"?r-n:e.operator==="*"?r*n:r/n;return Number.isFinite(o)?o:null}return null}function ht(t){if(t.type!=="JSXExpressionContainer")return null;let e=Oe(t.expression);return e.type==="JSXElement"?e:null}function yt(t,e=!1){if(!e&&t.type==="Identifier")return typeof t.name=="string"?t.name:null;let r=Ne(t);return typeof r=="string"||typeof r=="number"?String(r):null}var Jt=M(()=>{"use strict";l(Oe,"unwrapLiteralExpression");l(Ne,"readLiteralExpression");l(ht,"literalJsxChild");l(yt,"literalPropertyName")});function xn(t,e,r=!1){let o=t.openingElement.attributes,i=[];!r&&e!=="JSXElement"&&e!=="JSXFragment"&&i.push(wa);let s=new Map;o.forEach((a,u)=>{let p=Ca(a);p!==null&&s.set(p,u)});let c=-1;o.forEach((a,u)=>{a.type==="JSXSpreadAttribute"&&(c=u)});for(let[a,u]of s){if(xa(a))continue;let p=u<c,f=o[u].value;if(f!==null){if(a==="style"&&!p){i.push(...Aa(f));continue}if(p)i.push(a);else{if(a==="className"&&Ra(f))continue;_n(f)||i.push(a)}}}return i.length>0?i.join(" "):c>=0?"":void 0}function An(t){let e=t.children??[];if(e.some(o=>o.type==="JSXSpreadChild"))return;let r=[],n=0;for(let o of e){if(o.type==="JSXText"){let i=String(o.value??"");if(/^[ \t\r\n]*$/.test(i)&&/[\r\n]/.test(i))continue}else if(o.type==="JSXExpressionContainer"){if(o.expression.type==="JSXEmptyExpression")continue;!ht(o)&&!_n(o)&&r.push(n)}n++}return r.length>0?r.join(" "):void 0}function Ca(t){if(t.type!=="JSXAttribute")return null;let e=t.name;return e.type==="JSXIdentifier"?e.name:e.type==="JSXNamespacedName"?`${e.namespace.name}:${e.name.name}`:null}function xa(t){return t==="key"||t.startsWith("data-tempo-")}function Aa(t){let e=t.type==="JSXExpressionContainer"?Ta(t.expression):t;if(e.type!=="ObjectExpression")return["style"];let r=e.properties,n=new Map;r.forEach((i,s)=>{let c=Cn(i);c!==null&&n.set(c,s)});let o=[];for(let[i,s]of n){let c=r[s],a=r.slice(s+1).some(p=>p.type==="SpreadElement"||p.computed&&Cn(p)===null),u=c.type!=="ObjectMethod"&&!c.shorthand&&Rn(c.value);(a||!u)&&o.push(`style.${i}`)}return o}function Cn(t){return t.type==="Property"||t.type==="ObjectProperty"||t.type==="ObjectMethod"?yt(t.key,!!t.computed):null}function _n(t){return t.type==="Literal"||t.type==="StringLiteral"?!0:t.type!=="JSXExpressionContainer"?!1:Rn(t.expression)}function Ra(t){if(t.type!=="JSXExpressionContainer")return!1;let e=t.expression;if(e.type!=="CallExpression")return!1;let r=e.callee;return r.type!=="Identifier"||!_a.has(r.name)?!1:e.arguments.every(n=>(n.type==="Literal"||n.type==="StringLiteral")&&typeof n.value=="string"||n.type==="TemplateLiteral"&&n.expressions.length===0)}function Rn(t){return Ne(t)!==null}function Ta(t){return Oe(t)}var _r,wa,Rr,_a,Gt=M(()=>{"use strict";Jt();Jt();_r="data-tempo-expr",wa="#slot";l(xn,"expressionFacts");Rr="data-tempo-expr-children";l(An,"expressionChildren");l(Ca,"attributeName");l(xa,"unstamped");l(Aa,"styleFacts");l(Cn,"styleKey");l(_n,"isLiteralValue");_a=new Set(["cn","clsx","twMerge","cx","classNames"]);l(Ra,"isClassHelperCall");l(Rn,"isLiteral");l(Ta,"unwrap")});function St(t,e,r){let n=e-r;n=n<0?-n<<1|1:n<<1;do{let o=n&31;n>>>=5,n>0&&(o|=32),t.write(Pn[o])}while(n>0);return e}function Mn(t){let e=new Ma,r=0,n=0,o=0,i=0;for(let s=0;s<t.length;s++){let c=t[s];if(s>0&&e.write(Ia),c.length===0)continue;let a=0;for(let u=0;u<c.length;u++){let p=c[u];u>0&&e.write(ka),a=St(e,p[0],a),p.length!==1&&(r=St(e,p[1],r),n=St(e,p[2],n),o=St(e,p[3],o),p.length!==4&&(i=St(e,p[4],i)))}}return e.flush()}var ka,Ia,Tn,Pn,Pa,kn,In,Ma,Nn=M(()=>{ka=44,Ia=59,Tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pn=new Uint8Array(64),Pa=new Uint8Array(128);for(let t=0;t<Tn.length;t++){let e=Tn.charCodeAt(t);Pn[t]=e,Pa[e]=t}l(St,"encodeInteger");kn=1024*16,In=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},Ma=class{static{l(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(kn)}write(t){let{buffer:e}=this;e[this.pos++]=t,this.pos===kn&&(this.out+=In.decode(e),this.pos=0)}flush(){let{buffer:t,out:e,pos:r}=this;return r>0?e+In.decode(t.subarray(0,r)):e}};l(Mn,"encode")});function Na(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?t=>globalThis.btoa(unescape(encodeURIComponent(t))):typeof Buffer=="function"?t=>Buffer.from(t,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}function $a(t){let e=t.split(`
3
+ `),r=e.filter(i=>/^\t+/.test(i)),n=e.filter(i=>/^ {2,}/.test(i));if(r.length===0&&n.length===0)return null;if(r.length>=n.length)return" ";let o=n.reduce((i,s)=>{let c=/^ +/.exec(s)[0].length;return Math.min(c,i)},1/0);return new Array(o+1).join(" ")}function La(t,e){let r=t.split(/[/\\]/),n=e.split(/[/\\]/);for(r.pop();r[0]===n[0];)r.shift(),n.shift();if(r.length){let o=r.length;for(;o--;)r[o]=".."}return r.concat(n).join("/")}function Da(t){return Fa.call(t)==="[object Object]"}function On(t){let e=t.split(`
4
+ `),r=[];for(let n=0,o=0;n<e.length;n++)r.push(o),o+=e[n].length+1;return l(function(o){let i=0,s=r.length;for(;i<s;){let u=i+s>>1;o<r[u]?s=u:i=u+1}let c=i-1,a=o-r[c];return{line:c,column:a}},"locate")}var Xt,Kt,Oa,Tr,Fa,Ha,kr,vt,Ze,Ue,Ir=M(()=>{Nn();Xt=class t{static{l(this,"BitSet")}constructor(e){this.bits=e instanceof t?e.bits.slice():[]}add(e){this.bits[e>>5]|=1<<(e&31)}has(e){return!!(this.bits[e>>5]&1<<(e&31))}},Kt=class t{static{l(this,"Chunk")}constructor(e,r,n){this.start=e,this.end=r,this.original=n,this.intro="",this.outro="",this.content=n,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(e){this.outro+=e}appendRight(e){this.intro=this.intro+e}clone(){let e=new t(this.start,this.end,this.original);return e.intro=this.intro,e.outro=this.outro,e.content=this.content,e.storeName=this.storeName,e.edited=this.edited,e}contains(e){return this.start<e&&e<this.end}eachNext(e){let r=this;for(;r;)e(r),r=r.next}eachPrevious(e){let r=this;for(;r;)e(r),r=r.previous}edit(e,r,n){return this.content=e,n||(this.intro="",this.outro=""),this.storeName=r,this.edited=!0,this}prependLeft(e){this.outro=e+this.outro}prependRight(e){this.intro=e+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(e){let r=e-this.start,n=this.original.slice(0,r),o=this.original.slice(r);this.original=n;let i=new t(e,this.end,o);return i.outro=this.outro,this.outro="",this.end=e,this.edited?(i.edit("",!1),this.content=""):this.content=n,i.next=this.next,i.next&&(i.next.previous=i),i.previous=this,this.next=i,i}toString(){return this.intro+this.content+this.outro}trimEnd(e){if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;let r=this.content.replace(e,"");if(r.length)return r!==this.content&&(this.split(this.start+r.length).edit("",void 0,!0),this.edited&&this.edit(r,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(e,""),this.intro.length)return!0}trimStart(e){if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;let r=this.content.replace(e,"");if(r.length){if(r!==this.content){let n=this.split(this.end-r.length);this.edited&&n.edit(r,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(e,""),this.outro.length)return!0}};l(Na,"getBtoa");Oa=Na(),Tr=class{static{l(this,"SourceMap")}constructor(e){this.version=3,this.file=e.file,this.sources=e.sources,this.sourcesContent=e.sourcesContent,this.names=e.names,this.mappings=Mn(e.mappings),typeof e.x_google_ignoreList<"u"&&(this.x_google_ignoreList=e.x_google_ignoreList),typeof e.debugId<"u"&&(this.debugId=e.debugId)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+Oa(this.toString())}};l($a,"guessIndent");l(La,"getRelativePath");Fa=Object.prototype.toString;l(Da,"isObject");l(On,"getLocator");Ha=/\w/,kr=class{static{l(this,"Mappings")}constructor(e){this.hires=e,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(e,r,n,o){if(r.length){let i=r.length-1,s=r.indexOf(`
5
5
  `,0),c=-1;for(;s>=0&&i>s;){let u=[this.generatedCodeColumn,e,n.line,n.column];o>=0&&u.push(o),this.rawSegments.push(u),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,c=s,s=r.indexOf(`
6
6
  `,s+1)}let a=[this.generatedCodeColumn,e,n.line,n.column];o>=0&&a.push(o),this.rawSegments.push(a),this.advance(r.slice(c+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(r));this.pending=null}addUneditedChunk(e,r,n,o,i){let s=r.start,c=!0,a=!1;for(;s<r.end;){if(n[s]===`
7
- `)o.line+=1,o.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,c=!0,a=!1;else{if(this.hires||c||i.has(s)){let u=[this.generatedCodeColumn,e,o.line,o.column];this.hires==="boundary"?Oa.test(n[s])?a||(this.rawSegments.push(u),a=!0):(this.rawSegments.push(u),a=!1):this.rawSegments.push(u)}o.column+=1,this.generatedCodeColumn+=1,c=!1}s+=1}this.pending=null}advance(e){if(!e)return;let r=e.split(`
8
- `);if(r.length>1){for(let n=0;n<r.length-1;n++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=r[r.length-1].length}},St=`
9
- `,Qe={insertLeft:!1,insertRight:!1,storeName:!1},He=class t{static{l(this,"MagicString")}constructor(e,r={}){let n=new Jt(0,e.length,e);Object.defineProperties(this,{original:{writable:!0,value:e},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:n},lastChunk:{writable:!0,value:n},lastSearchedChunk:{writable:!0,value:n},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:r.filename},indentExclusionRanges:{writable:!0,value:r.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new Wt},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:r.ignoreList},offset:{writable:!0,value:r.offset||0}}),this.byStart[0]=n,this.byEnd[e.length]=n}addSourcemapLocation(e){this.sourcemapLocations.add(e)}append(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.outro+=e,this}appendLeft(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byEnd[e];return n?n.appendLeft(r):this.intro+=r,this}appendRight(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byStart[e];return n?n.appendRight(r):this.outro+=r,this}clone(){let e=new t(this.original,{filename:this.filename,offset:this.offset}),r=this.firstChunk,n=e.firstChunk=e.lastSearchedChunk=r.clone();for(;r;){e.byStart[n.start]=n,e.byEnd[n.end]=n;let o=r.next,i=o&&o.clone();i&&(n.next=i,i.previous=n,n=i),r=o}return e.lastChunk=n,this.indentExclusionRanges&&(e.indentExclusionRanges=this.indentExclusionRanges.slice()),e.sourcemapLocations=new Wt(this.sourcemapLocations),e.intro=this.intro,e.outro=this.outro,e}generateDecodedMap(e){e=e||{};let r=0,n=Object.keys(this.storedNames),o=new Rr(e.hires),i=Mn(this.original);return this.intro&&o.advance(this.intro),this.firstChunk.eachNext(s=>{let c=i(s.start);s.intro.length&&o.advance(s.intro),s.edited?o.addEdit(r,s.content,c,s.storeName?n.indexOf(s.original):-1):o.addUneditedChunk(r,s,this.original,c,this.sourcemapLocations),s.outro.length&&o.advance(s.outro)}),this.outro&&o.advance(this.outro),{file:e.file?e.file.split(/[/\\]/).pop():void 0,sources:[e.source?Pa(e.file||"",e.source):e.file||""],sourcesContent:e.includeContent?[this.original]:void 0,names:n,mappings:o.raw,x_google_ignoreList:this.ignoreList?[r]:void 0}}generateMap(e){return new _r(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=Ia(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(e,r){let n=/^[^\r\n]/gm;if(Na(e)&&(r=e,e=void 0),e===void 0&&(this._ensureindentStr(),e=this.indentStr||" "),e==="")return this;r=r||{};let o={};r.exclude&&(typeof r.exclude[0]=="number"?[r.exclude]:r.exclude).forEach(p=>{for(let f=p[0];f<p[1];f+=1)o[f]=!0});let i=r.indentStart!==!1,s=l(u=>i?`${e}${u}`:(i=!0,u),"replacer");this.intro=this.intro.replace(n,s);let c=0,a=this.firstChunk;for(;a;){let u=a.end;if(a.edited)o[c]||(a.content=a.content.replace(n,s),a.content.length&&(i=a.content[a.content.length-1]===`
7
+ `)o.line+=1,o.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,c=!0,a=!1;else{if(this.hires||c||i.has(s)){let u=[this.generatedCodeColumn,e,o.line,o.column];this.hires==="boundary"?Ha.test(n[s])?a||(this.rawSegments.push(u),a=!0):(this.rawSegments.push(u),a=!1):this.rawSegments.push(u)}o.column+=1,this.generatedCodeColumn+=1,c=!1}s+=1}this.pending=null}advance(e){if(!e)return;let r=e.split(`
8
+ `);if(r.length>1){for(let n=0;n<r.length-1;n++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=r[r.length-1].length}},vt=`
9
+ `,Ze={insertLeft:!1,insertRight:!1,storeName:!1},Ue=class t{static{l(this,"MagicString")}constructor(e,r={}){let n=new Kt(0,e.length,e);Object.defineProperties(this,{original:{writable:!0,value:e},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:n},lastChunk:{writable:!0,value:n},lastSearchedChunk:{writable:!0,value:n},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:r.filename},indentExclusionRanges:{writable:!0,value:r.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new Xt},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:r.ignoreList},offset:{writable:!0,value:r.offset||0}}),this.byStart[0]=n,this.byEnd[e.length]=n}addSourcemapLocation(e){this.sourcemapLocations.add(e)}append(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.outro+=e,this}appendLeft(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byEnd[e];return n?n.appendLeft(r):this.intro+=r,this}appendRight(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byStart[e];return n?n.appendRight(r):this.outro+=r,this}clone(){let e=new t(this.original,{filename:this.filename,offset:this.offset}),r=this.firstChunk,n=e.firstChunk=e.lastSearchedChunk=r.clone();for(;r;){e.byStart[n.start]=n,e.byEnd[n.end]=n;let o=r.next,i=o&&o.clone();i&&(n.next=i,i.previous=n,n=i),r=o}return e.lastChunk=n,this.indentExclusionRanges&&(e.indentExclusionRanges=this.indentExclusionRanges.slice()),e.sourcemapLocations=new Xt(this.sourcemapLocations),e.intro=this.intro,e.outro=this.outro,e}generateDecodedMap(e){e=e||{};let r=0,n=Object.keys(this.storedNames),o=new kr(e.hires),i=On(this.original);return this.intro&&o.advance(this.intro),this.firstChunk.eachNext(s=>{let c=i(s.start);s.intro.length&&o.advance(s.intro),s.edited?o.addEdit(r,s.content,c,s.storeName?n.indexOf(s.original):-1):o.addUneditedChunk(r,s,this.original,c,this.sourcemapLocations),s.outro.length&&o.advance(s.outro)}),this.outro&&o.advance(this.outro),{file:e.file?e.file.split(/[/\\]/).pop():void 0,sources:[e.source?La(e.file||"",e.source):e.file||""],sourcesContent:e.includeContent?[this.original]:void 0,names:n,mappings:o.raw,x_google_ignoreList:this.ignoreList?[r]:void 0}}generateMap(e){return new Tr(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=$a(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(e,r){let n=/^[^\r\n]/gm;if(Da(e)&&(r=e,e=void 0),e===void 0&&(this._ensureindentStr(),e=this.indentStr||" "),e==="")return this;r=r||{};let o={};r.exclude&&(typeof r.exclude[0]=="number"?[r.exclude]:r.exclude).forEach(p=>{for(let f=p[0];f<p[1];f+=1)o[f]=!0});let i=r.indentStart!==!1,s=l(u=>i?`${e}${u}`:(i=!0,u),"replacer");this.intro=this.intro.replace(n,s);let c=0,a=this.firstChunk;for(;a;){let u=a.end;if(a.edited)o[c]||(a.content=a.content.replace(n,s),a.content.length&&(i=a.content[a.content.length-1]===`
10
10
  `));else for(c=a.start;c<u;){if(!o[c]){let p=this.original[c];p===`
11
- `?i=!0:p!=="\r"&&i&&(i=!1,c===a.start||(this._splitChunk(a,c),a=a.next),a.prependRight(e))}c+=1}c=a.end,a=a.next}return this.outro=this.outro.replace(n,s),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(e,r){return Qe.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Qe.insertLeft=!0),this.appendLeft(e,r)}insertRight(e,r){return Qe.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Qe.insertRight=!0),this.prependRight(e,r)}move(e,r,n){if(e=e+this.offset,r=r+this.offset,n=n+this.offset,n>=e&&n<=r)throw new Error("Cannot move a selection inside itself");this._split(e),this._split(r),this._split(n);let o=this.byStart[e],i=this.byEnd[r],s=o.previous,c=i.next,a=this.byStart[n];if(!a&&i===this.lastChunk)return this;let u=a?a.previous:this.lastChunk;return s&&(s.next=c),c&&(c.previous=s),u&&(u.next=o),a&&(a.previous=i),o.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=o.previous,this.lastChunk.next=null),o.previous=u,i.next=a||null,u||(this.firstChunk=o),a||(this.lastChunk=i),this}overwrite(e,r,n,o){return o=o||{},this.update(e,r,n,{...o,overwrite:!o.contentOnly})}update(e,r,n,o){if(e=e+this.offset,r=r+this.offset,typeof n!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(r>this.original.length)throw new Error("end is out of bounds");if(e===r)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(e),this._split(r),o===!0&&(Qe.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Qe.storeName=!0),o={storeName:!0});let i=o!==void 0?o.storeName:!1,s=o!==void 0?o.overwrite:!1;if(i){let u=this.original.slice(e,r);Object.defineProperty(this.storedNames,u,{writable:!0,value:!0,enumerable:!0})}let c=this.byStart[e],a=this.byEnd[r];if(c){let u=c;for(;u!==a;){if(u.next!==this.byStart[u.end])throw new Error("Cannot overwrite across a split point");u=u.next,u.edit("",!1)}c.edit(n,i,!s)}else{let u=new Jt(e,r,"").edit(n,i);a.next=u,u.previous=a}return this}prepend(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.intro=e+this.intro,this}prependLeft(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byEnd[e];return n?n.prependLeft(r):this.intro=r+this.intro,this}prependRight(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byStart[e];return n?n.prependRight(r):this.outro=r+this.outro,this}remove(e,r){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(e===r)return this;if(e<0||r>this.original.length)throw new Error("Character is out of bounds");if(e>r)throw new Error("end must be greater than start");this._split(e),this._split(r);let n=this.byStart[e];for(;n;)n.intro="",n.outro="",n.edit(""),n=r>n.end?this.byStart[n.end]:null;return this}reset(e,r){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(e===r)return this;if(e<0||r>this.original.length)throw new Error("Character is out of bounds");if(e>r)throw new Error("end must be greater than start");this._split(e),this._split(r);let n=this.byStart[e];for(;n;)n.reset(),n=r>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let e=this.lastChunk;do{if(e.outro.length)return e.outro[e.outro.length-1];if(e.content.length)return e.content[e.content.length-1];if(e.intro.length)return e.intro[e.intro.length-1]}while(e=e.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let e=this.outro.lastIndexOf(St);if(e!==-1)return this.outro.substr(e+1);let r=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(e=n.outro.lastIndexOf(St),e!==-1)return n.outro.substr(e+1)+r;r=n.outro+r}if(n.content.length>0){if(e=n.content.lastIndexOf(St),e!==-1)return n.content.substr(e+1)+r;r=n.content+r}if(n.intro.length>0){if(e=n.intro.lastIndexOf(St),e!==-1)return n.intro.substr(e+1)+r;r=n.intro+r}}while(n=n.previous);return e=this.intro.lastIndexOf(St),e!==-1?this.intro.substr(e+1)+r:this.intro+r}slice(e=0,r=this.original.length-this.offset){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}let n="",o=this.firstChunk;for(;o&&(o.start>e||o.end<=e);){if(o.start<r&&o.end>=r)return n;o=o.next}if(o&&o.edited&&o.start!==e)throw new Error(`Cannot use replaced character ${e} as slice start anchor.`);let i=o;for(;o;){o.intro&&(i!==o||o.start===e)&&(n+=o.intro);let s=o.start<r&&o.end>=r;if(s&&o.edited&&o.end!==r)throw new Error(`Cannot use replaced character ${r} as slice end anchor.`);let c=i===o?e-o.start:0,a=s?o.content.length+r-o.end:o.content.length;if(n+=o.content.slice(c,a),o.outro&&(!s||o.end===r)&&(n+=o.outro),s)break;o=o.next}return n}snip(e,r){let n=this.clone();return n.remove(0,e),n.remove(r,n.original.length),n}_split(e){if(this.byStart[e]||this.byEnd[e])return;let r=this.lastSearchedChunk,n=r,o=e>r.end;for(;r;){if(r.contains(e))return this._splitChunk(r,e);if(r=o?this.byStart[r.end]:this.byEnd[r.start],r===n)return;n=r}}_splitChunk(e,r){if(e.edited&&e.content.length){let o=Mn(this.original)(r);throw new Error(`Cannot split a chunk that has already been edited (${o.line}:${o.column} \u2013 "${e.original}")`)}let n=e.split(r);return this.byEnd[r]=e,this.byStart[r]=n,this.byEnd[n.end]=n,e===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=e,!0}toString(){let e=this.intro,r=this.firstChunk;for(;r;)e+=r.toString(),r=r.next;return e+this.outro}isEmpty(){let e=this.firstChunk;do if(e.intro.length&&e.intro.trim()||e.content.length&&e.content.trim()||e.outro.length&&e.outro.trim())return!1;while(e=e.next);return!0}length(){let e=this.firstChunk,r=0;do r+=e.intro.length+e.content.length+e.outro.length;while(e=e.next);return r}trimLines(){return this.trim("[\\r\\n]")}trim(e){return this.trimStart(e).trimEnd(e)}trimEndAborted(e){let r=new RegExp((e||"\\s")+"+$");if(this.outro=this.outro.replace(r,""),this.outro.length)return!0;let n=this.lastChunk;do{let o=n.end,i=n.trimEnd(r);if(n.end!==o&&(this.lastChunk===n&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),i)return!0;n=n.previous}while(n);return!1}trimEnd(e){return this.trimEndAborted(e),this}trimStartAborted(e){let r=new RegExp("^"+(e||"\\s")+"+");if(this.intro=this.intro.replace(r,""),this.intro.length)return!0;let n=this.firstChunk;do{let o=n.end,i=n.trimStart(r);if(n.end!==o&&(n===this.lastChunk&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),i)return!0;n=n.next}while(n);return!1}trimStart(e){return this.trimStartAborted(e),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(e,r){function n(i,s){return typeof r=="string"?r.replace(/\$(\$|&|\d+)/g,(c,a)=>a==="$"?"$":a==="&"?i[0]:+a<i.length?i[+a]:`$${a}`):r(...i,i.index,s,i.groups)}l(n,"getReplacement");function o(i,s){let c,a=[];for(;c=i.exec(s);)a.push(c);return a}if(l(o,"matchAll"),e.global)o(e,this.original).forEach(s=>{if(s.index!=null){let c=n(s,this.original);c!==s[0]&&this.overwrite(s.index,s.index+s[0].length,c)}});else{let i=this.original.match(e);if(i&&i.index!=null){let s=n(i,this.original);s!==i[0]&&this.overwrite(i.index,i.index+i[0].length,s)}}return this}_replaceString(e,r){let{original:n}=this,o=n.indexOf(e);return o!==-1&&(typeof r=="function"&&(r=r(e,o,n)),e!==r&&this.overwrite(o,o+e.length,r)),this}replace(e,r){return typeof e=="string"?this._replaceString(e,r):this._replaceRegexp(e,r)}_replaceAllString(e,r){let{original:n}=this,o=e.length;for(let i=n.indexOf(e);i!==-1;i=n.indexOf(e,i+o)){let s=n.slice(i,i+o),c=r;typeof r=="function"&&(c=r(s,i,n)),s!==c&&this.overwrite(i,i+o,c)}return this}replaceAll(e,r){if(typeof e=="string")return this._replaceAllString(e,r);if(!e.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(e,r)}}});function V(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.type=="string"&&Number.isInteger(e.start)&&Number.isInteger(e.end)?e:null}function se(t){return Array.isArray(t)?t.flatMap(e=>V(e)??[]):[]}function Ze(t){let e=V(t);return e?typeof e.name=="string"?e.name:e.type==="JSXMemberExpression"?`${Ze(e.object)}.${Ze(e.property)}`:e.type==="JSXNamespacedName"?`${Ze(e.namespace)}:${Ze(e.name)}`:"":""}function _e(t){try{let e=(0,Nn.parse)(t),r=e.diagnostics.filter(a=>a.severity==="error");if(r.length)return{kind:"invalid",message:r.map(a=>a.text).join(`
12
- `)};let n=V(e.ast);if(!n||n.type!=="AstroRoot"||n.end!==t.length)return{kind:"invalid",message:"Unsupported Astro compiler AST or source offset contract"};let o=new Map,i=l((a,u,p)=>{if(a.type==="JSXElement"||a.type==="JSXFragment"){let d=V(a.openingElement??a.openingFragment),g=V(a.closingElement??a.closingFragment),h=V(d.name),y=a.type==="JSXFragment"?"Fragment":Ze(h);if(t[a.start]!=="<"||d.end<=a.start||!y)throw new Error("Astro source range does not address an authored opening tag");let v=y==="Fragment"?"fragment":y==="slot"?"slot":y==="script"?"script":y==="style"?"style":/^[A-Z]/.test(y)||y.includes(".")?"component":"native-element",w=se(d.attributes).map(A=>({name:A.type==="JSXSpreadAttribute"?null:Ze(A.name),start:A.start,end:A.end,spread:A.type==="JSXSpreadAttribute",value:V(A.value??A.argument)})),x=se(a.children);o.set(a.start,{kind:v,tagName:y,start:a.start,end:a.end,openingEnd:d.end,nameEnd:h?.end??d.end-1,childrenStart:g?d.end:null,childrenEnd:g?.start??null,selfClosing:d.selfClosing===!0,parentOffset:u,scopes:p,attributes:w,children:x,node:a});for(let A of se(d.attributes))i(A,a.start,[...p,A.start]);for(let A of x)i(A,a.start,p);return}if(a.type==="JSXText")return;let f=a.type==="JSXExpressionContainer"?[...p,a.start]:p;for(let d of Object.values(a))if(Array.isArray(d))for(let g of se(d))i(g,u,f);else{let g=V(d);g&&i(g,u,f)}},"visit");for(let a of se(n.body))i(a,null,[]);let s=V(n.frontmatter),c=V(s?.program);return{kind:"ok",root:n,elements:o,sourceVersion:Ee(t),frontmatter:s&&s.end>s.start&&c?{start:s.start,end:s.end,contentStart:c.start,contentEnd:c.end}:null,imports:se(c?.body).filter(a=>a.type==="ImportDeclaration")}}catch(e){return{kind:"invalid",message:e instanceof Error?e.message:String(e)}}}function Ae(t){if(!t)return{known:!0,value:!0};if(t.type==="JSXExpressionContainer"){let r=V(t.expression);return r?Ae(r):{known:!1}}let e=Ne(t);if(e.type==="TemplateLiteral"){let r=Me(e);return typeof r=="string"?{known:!0,value:r}:{known:!1}}if(e.type==="Literal"&&(e.value===null||typeof e.value=="string"||typeof e.value=="boolean"||typeof e.value=="number"&&Number.isFinite(e.value)))return{known:!0,value:e.value};if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let r=Ae(V(e.argument));if(r.known&&typeof r.value=="number")return{known:!0,value:e.operator==="-"?-r.value:r.value}}if(e.type==="ArrayExpression"&&Array.isArray(e.elements)){let r=e.elements.map(n=>n?Ae(V(n)):{known:!1});if(r.every(n=>n.known))return{known:!0,value:r.map(n=>n.value)}}if(e.type==="ObjectExpression"){let r=Object.create(null);for(let n of se(e.properties)){let o=V(n.key),i=o?.type==="Identifier"?o.name:o?.type==="Literal"?o.value:void 0;if(n.type!=="Property"||n.computed||n.method||n.kind!=="init"||typeof i!="string"&&typeof i!="number")return{known:!1};let s=V(n.value);if(!s)return{known:!1};let c=Ae(s);if(!c.known)return c;r[i]=c.value}return{known:!0,value:r}}return{known:!1}}var Nn,et=P(()=>{"use strict";Nn=require("@astrojs/compiler-rs");Bt();Ge();l(V,"astroNode");l(se,"astroNodes");l(Ze,"astroName");l(_e,"parseAstroSource");l(Ae,"readAstroLiteral")});function $a(t){let e=new Map;for(let r of t.attributes){if(r.spread){e.clear();continue}let n=r.name;if(!n||n.includes(":"))continue;let o=Ae(r.value);o.known?e.set(n,o.value):e.delete(n)}return Object.fromEntries(e)}function La(t){let e=V(t.key);return t.type==="Property"&&e?ht(e,t.computed===!0):null}function Fa(t){let e=t.scopes.some(o=>o>(t.parentOffset??-1))?["#slot"]:[];t.attributes.some(o=>["x-text","x-html","set:html","set:text"].includes(o.name??""))&&e.push("children"),t.attributes.some(o=>[":style","x-bind:style"].includes(o.name??""))&&e.push("style");let r=new Map,n=-1;t.attributes.forEach((o,i)=>{o.spread?n=i:o.name&&r.set(o.name,i)});for(let[o,i]of r){if(o.startsWith("data-tempo-"))continue;let s=t.attributes[i],c=s.value?.type==="JSXExpressionContainer"?V(s.value.expression):s.value,a=c&&Ne(c);if(o==="style"&&i>n&&a?.type==="ObjectExpression"){let p=se(a.properties),f=new Map;for(let d of p){let g=La(d);if(g===null){for(let y of f.keys())f.set(y,!1);continue}let h=d.method||d.kind!=="init"?{known:!1}:Ae(V(d.value));f.delete(g),f.set(g,h.known&&(h.value===null||["string","number"].includes(typeof h.value)))}for(let[d,g]of f)g||e.push(`style.${d}`);continue}let u=Ae(t.attributes[i].value);(i<n||!u.known)&&e.push(o==="class"?"className":o)}return e.length?e.join(" "):n>=0?"":void 0}function $n(t,e,r=e.filepath){let n=_e(t);if(n.kind!=="ok")return n;if(!e.filepath||n.sourceVersion!==e.sourceVersion||!Number.isSafeInteger(e.modifiedTs)||e.modifiedTs<0)return{kind:"invalid",message:"Astro annotation requires a receipt for these exact source bytes"};let o=new He(t),i="$$tempoAstroHostId";for(;t.includes(i);)i+="_";for(let s of n.elements.values()){if(s.attributes.some(({name:p})=>p===On||p?.startsWith("data-tempo-")&&p!=="data-tempo-locked"&&p!=="data-tempo-svg-paint"))return{kind:"invalid",message:"Astro source already contains reserved Tempo instrumentation"};if(s.kind!=="native-element"&&s.kind!=="component")continue;let c=Fa(s),a=s.kind==="component"?{[On]:{...e,position:s.start,name:s.tagName,expressions:c,literalProps:$a(s)}}:{"data-tempo-filepath":e.filepath,"data-tempo-position":s.start,"data-tempo-modifiedts":e.modifiedTs,"data-tempo-source-version":e.sourceVersion,...c!==void 0?{"data-tempo-expr":c}:{}},u=s.openingEnd-1;if(s.selfClosing){for(;/\s/.test(t[u-1]);)u--;t[u-1]==="/"&&u--}o.appendLeft(u,Object.entries(a).map(([p,f])=>` ${p}={${JSON.stringify(f)}}`).join("")+(s.kind==="native-element"?` data-tempo-astro-node={${i}()}`:""))}return{kind:"ok",code:o.toString(),occurrenceFactory:i,map:o.generateMap({source:r,includeContent:!0,hires:!0})}}var On,Ln=P(()=>{"use strict";Bt();Tr();et();On="__tempo_astro_callsite__";l($a,"literalComponentProps");l(La,"styleKey");l(Fa,"astroExpressionFacts");l($n,"annotateAstroSource")});function Fn(t,e,r,n){let o=(0,kr.parseSync)(`${e}.js`,t);if(o.errors.length)return;let i="$$tempoFrameworkComponent";for(;t.includes(i);)i+="_";let s=new He(t),c=new Map,a=!1;for(let u of o.program.body)if(u.type==="ExportDefaultDeclaration"){let p=u.declaration;p.type==="Identifier"?c.set(p.name,"default"):(p.type==="FunctionDeclaration"||p.type==="ClassDeclaration")&&p.id?c.set(p.id.name,"default"):(s.prependLeft(p.start,`${i}(`),s.appendLeft(p.end,`, ${JSON.stringify({...r,exportName:"default"})})`),a=!0)}else if(u.type==="ExportNamedDeclaration"&&!u.source){let p=u.declaration;if(p?.type==="VariableDeclaration")for(let f of p.declarations)f.id.type==="Identifier"&&c.set(f.id.name,f.id.name);else(p?.type==="FunctionDeclaration"||p?.type==="ClassDeclaration")&&p.id&&c.set(p.id.name,p.id.name);for(let f of u.specifiers)f.local.type==="Identifier"&&c.set(f.local.name,f.exported.type==="Identifier"?f.exported.name:f.exported.value)}if(!(!a&&!c.size)){s.prepend(`import { instrumentFrameworkComponent as ${i} } from ${JSON.stringify(n)};
11
+ `?i=!0:p!=="\r"&&i&&(i=!1,c===a.start||(this._splitChunk(a,c),a=a.next),a.prependRight(e))}c+=1}c=a.end,a=a.next}return this.outro=this.outro.replace(n,s),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(e,r){return Ze.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Ze.insertLeft=!0),this.appendLeft(e,r)}insertRight(e,r){return Ze.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Ze.insertRight=!0),this.prependRight(e,r)}move(e,r,n){if(e=e+this.offset,r=r+this.offset,n=n+this.offset,n>=e&&n<=r)throw new Error("Cannot move a selection inside itself");this._split(e),this._split(r),this._split(n);let o=this.byStart[e],i=this.byEnd[r],s=o.previous,c=i.next,a=this.byStart[n];if(!a&&i===this.lastChunk)return this;let u=a?a.previous:this.lastChunk;return s&&(s.next=c),c&&(c.previous=s),u&&(u.next=o),a&&(a.previous=i),o.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=o.previous,this.lastChunk.next=null),o.previous=u,i.next=a||null,u||(this.firstChunk=o),a||(this.lastChunk=i),this}overwrite(e,r,n,o){return o=o||{},this.update(e,r,n,{...o,overwrite:!o.contentOnly})}update(e,r,n,o){if(e=e+this.offset,r=r+this.offset,typeof n!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(r>this.original.length)throw new Error("end is out of bounds");if(e===r)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(e),this._split(r),o===!0&&(Ze.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Ze.storeName=!0),o={storeName:!0});let i=o!==void 0?o.storeName:!1,s=o!==void 0?o.overwrite:!1;if(i){let u=this.original.slice(e,r);Object.defineProperty(this.storedNames,u,{writable:!0,value:!0,enumerable:!0})}let c=this.byStart[e],a=this.byEnd[r];if(c){let u=c;for(;u!==a;){if(u.next!==this.byStart[u.end])throw new Error("Cannot overwrite across a split point");u=u.next,u.edit("",!1)}c.edit(n,i,!s)}else{let u=new Kt(e,r,"").edit(n,i);a.next=u,u.previous=a}return this}prepend(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.intro=e+this.intro,this}prependLeft(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byEnd[e];return n?n.prependLeft(r):this.intro=r+this.intro,this}prependRight(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byStart[e];return n?n.prependRight(r):this.outro=r+this.outro,this}remove(e,r){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(e===r)return this;if(e<0||r>this.original.length)throw new Error("Character is out of bounds");if(e>r)throw new Error("end must be greater than start");this._split(e),this._split(r);let n=this.byStart[e];for(;n;)n.intro="",n.outro="",n.edit(""),n=r>n.end?this.byStart[n.end]:null;return this}reset(e,r){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(e===r)return this;if(e<0||r>this.original.length)throw new Error("Character is out of bounds");if(e>r)throw new Error("end must be greater than start");this._split(e),this._split(r);let n=this.byStart[e];for(;n;)n.reset(),n=r>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let e=this.lastChunk;do{if(e.outro.length)return e.outro[e.outro.length-1];if(e.content.length)return e.content[e.content.length-1];if(e.intro.length)return e.intro[e.intro.length-1]}while(e=e.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let e=this.outro.lastIndexOf(vt);if(e!==-1)return this.outro.substr(e+1);let r=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(e=n.outro.lastIndexOf(vt),e!==-1)return n.outro.substr(e+1)+r;r=n.outro+r}if(n.content.length>0){if(e=n.content.lastIndexOf(vt),e!==-1)return n.content.substr(e+1)+r;r=n.content+r}if(n.intro.length>0){if(e=n.intro.lastIndexOf(vt),e!==-1)return n.intro.substr(e+1)+r;r=n.intro+r}}while(n=n.previous);return e=this.intro.lastIndexOf(vt),e!==-1?this.intro.substr(e+1)+r:this.intro+r}slice(e=0,r=this.original.length-this.offset){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}let n="",o=this.firstChunk;for(;o&&(o.start>e||o.end<=e);){if(o.start<r&&o.end>=r)return n;o=o.next}if(o&&o.edited&&o.start!==e)throw new Error(`Cannot use replaced character ${e} as slice start anchor.`);let i=o;for(;o;){o.intro&&(i!==o||o.start===e)&&(n+=o.intro);let s=o.start<r&&o.end>=r;if(s&&o.edited&&o.end!==r)throw new Error(`Cannot use replaced character ${r} as slice end anchor.`);let c=i===o?e-o.start:0,a=s?o.content.length+r-o.end:o.content.length;if(n+=o.content.slice(c,a),o.outro&&(!s||o.end===r)&&(n+=o.outro),s)break;o=o.next}return n}snip(e,r){let n=this.clone();return n.remove(0,e),n.remove(r,n.original.length),n}_split(e){if(this.byStart[e]||this.byEnd[e])return;let r=this.lastSearchedChunk,n=r,o=e>r.end;for(;r;){if(r.contains(e))return this._splitChunk(r,e);if(r=o?this.byStart[r.end]:this.byEnd[r.start],r===n)return;n=r}}_splitChunk(e,r){if(e.edited&&e.content.length){let o=On(this.original)(r);throw new Error(`Cannot split a chunk that has already been edited (${o.line}:${o.column} \u2013 "${e.original}")`)}let n=e.split(r);return this.byEnd[r]=e,this.byStart[r]=n,this.byEnd[n.end]=n,e===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=e,!0}toString(){let e=this.intro,r=this.firstChunk;for(;r;)e+=r.toString(),r=r.next;return e+this.outro}isEmpty(){let e=this.firstChunk;do if(e.intro.length&&e.intro.trim()||e.content.length&&e.content.trim()||e.outro.length&&e.outro.trim())return!1;while(e=e.next);return!0}length(){let e=this.firstChunk,r=0;do r+=e.intro.length+e.content.length+e.outro.length;while(e=e.next);return r}trimLines(){return this.trim("[\\r\\n]")}trim(e){return this.trimStart(e).trimEnd(e)}trimEndAborted(e){let r=new RegExp((e||"\\s")+"+$");if(this.outro=this.outro.replace(r,""),this.outro.length)return!0;let n=this.lastChunk;do{let o=n.end,i=n.trimEnd(r);if(n.end!==o&&(this.lastChunk===n&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),i)return!0;n=n.previous}while(n);return!1}trimEnd(e){return this.trimEndAborted(e),this}trimStartAborted(e){let r=new RegExp("^"+(e||"\\s")+"+");if(this.intro=this.intro.replace(r,""),this.intro.length)return!0;let n=this.firstChunk;do{let o=n.end,i=n.trimStart(r);if(n.end!==o&&(n===this.lastChunk&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),i)return!0;n=n.next}while(n);return!1}trimStart(e){return this.trimStartAborted(e),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(e,r){function n(i,s){return typeof r=="string"?r.replace(/\$(\$|&|\d+)/g,(c,a)=>a==="$"?"$":a==="&"?i[0]:+a<i.length?i[+a]:`$${a}`):r(...i,i.index,s,i.groups)}l(n,"getReplacement");function o(i,s){let c,a=[];for(;c=i.exec(s);)a.push(c);return a}if(l(o,"matchAll"),e.global)o(e,this.original).forEach(s=>{if(s.index!=null){let c=n(s,this.original);c!==s[0]&&this.overwrite(s.index,s.index+s[0].length,c)}});else{let i=this.original.match(e);if(i&&i.index!=null){let s=n(i,this.original);s!==i[0]&&this.overwrite(i.index,i.index+i[0].length,s)}}return this}_replaceString(e,r){let{original:n}=this,o=n.indexOf(e);return o!==-1&&(typeof r=="function"&&(r=r(e,o,n)),e!==r&&this.overwrite(o,o+e.length,r)),this}replace(e,r){return typeof e=="string"?this._replaceString(e,r):this._replaceRegexp(e,r)}_replaceAllString(e,r){let{original:n}=this,o=e.length;for(let i=n.indexOf(e);i!==-1;i=n.indexOf(e,i+o)){let s=n.slice(i,i+o),c=r;typeof r=="function"&&(c=r(s,i,n)),s!==c&&this.overwrite(i,i+o,c)}return this}replaceAll(e,r){if(typeof e=="string")return this._replaceAllString(e,r);if(!e.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(e,r)}}});function U(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.type=="string"&&Number.isInteger(e.start)&&Number.isInteger(e.end)?e:null}function ie(t){return Array.isArray(t)?t.flatMap(e=>U(e)??[]):[]}function et(t){let e=U(t);return e?typeof e.name=="string"?e.name:e.type==="JSXMemberExpression"?`${et(e.object)}.${et(e.property)}`:e.type==="JSXNamespacedName"?`${et(e.namespace)}:${et(e.name)}`:"":""}function _e(t){try{let e=(0,$n.parse)(t),r=e.diagnostics.filter(a=>a.severity==="error");if(r.length)return{kind:"invalid",message:r.map(a=>a.text).join(`
12
+ `)};let n=U(e.ast);if(!n||n.type!=="AstroRoot"||n.end!==t.length)return{kind:"invalid",message:"Unsupported Astro compiler AST or source offset contract"};let o=new Map,i=l((a,u,p)=>{if(a.type==="JSXElement"||a.type==="JSXFragment"){let d=U(a.openingElement??a.openingFragment),g=U(a.closingElement??a.closingFragment),h=U(d.name),y=a.type==="JSXFragment"?"Fragment":et(h);if(t[a.start]!=="<"||d.end<=a.start||!y)throw new Error("Astro source range does not address an authored opening tag");let v=y==="Fragment"?"fragment":y==="slot"?"slot":y==="script"?"script":y==="style"?"style":/^[A-Z]/.test(y)||y.includes(".")?"component":"native-element",w=ie(d.attributes).map(x=>({name:x.type==="JSXSpreadAttribute"?null:et(x.name),start:x.start,end:x.end,spread:x.type==="JSXSpreadAttribute",value:U(x.value??x.argument)})),C=ie(a.children);o.set(a.start,{kind:v,tagName:y,start:a.start,end:a.end,openingEnd:d.end,nameEnd:h?.end??d.end-1,childrenStart:g?d.end:null,childrenEnd:g?.start??null,selfClosing:d.selfClosing===!0,parentOffset:u,scopes:p,attributes:w,children:C,node:a});for(let x of ie(d.attributes))i(x,a.start,[...p,x.start]);for(let x of C)i(x,a.start,p);return}if(a.type==="JSXText")return;let f=a.type==="JSXExpressionContainer"?[...p,a.start]:p;for(let d of Object.values(a))if(Array.isArray(d))for(let g of ie(d))i(g,u,f);else{let g=U(d);g&&i(g,u,f)}},"visit");for(let a of ie(n.body))i(a,null,[]);let s=U(n.frontmatter),c=U(s?.program);return{kind:"ok",root:n,elements:o,sourceVersion:Ce(t),frontmatter:s&&s.end>s.start&&c?{start:s.start,end:s.end,contentStart:c.start,contentEnd:c.end}:null,imports:ie(c?.body).filter(a=>a.type==="ImportDeclaration")}}catch(e){return{kind:"invalid",message:e instanceof Error?e.message:String(e)}}}function Ae(t){if(!t)return{known:!0,value:!0};if(t.type==="JSXExpressionContainer"){let r=U(t.expression);return r?Ae(r):{known:!1}}let e=Oe(t);if(e.type==="TemplateLiteral"){let r=Ne(e);return typeof r=="string"?{known:!0,value:r}:{known:!1}}if(e.type==="Literal"&&(e.value===null||typeof e.value=="string"||typeof e.value=="boolean"||typeof e.value=="number"&&Number.isFinite(e.value)))return{known:!0,value:e.value};if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let r=Ae(U(e.argument));if(r.known&&typeof r.value=="number")return{known:!0,value:e.operator==="-"?-r.value:r.value}}if(e.type==="ArrayExpression"&&Array.isArray(e.elements)){let r=e.elements.map(n=>n?Ae(U(n)):{known:!1});if(r.every(n=>n.known))return{known:!0,value:r.map(n=>n.value)}}if(e.type==="ObjectExpression"){let r=Object.create(null);for(let n of ie(e.properties)){let o=U(n.key),i=o?.type==="Identifier"?o.name:o?.type==="Literal"?o.value:void 0;if(n.type!=="Property"||n.computed||n.method||n.kind!=="init"||typeof i!="string"&&typeof i!="number")return{known:!1};let s=U(n.value);if(!s)return{known:!1};let c=Ae(s);if(!c.known)return c;r[i]=c.value}return{known:!0,value:r}}return{known:!1}}var $n,tt=M(()=>{"use strict";$n=require("@astrojs/compiler-rs");Gt();Xe();l(U,"astroNode");l(ie,"astroNodes");l(et,"astroName");l(_e,"parseAstroSource");l(Ae,"readAstroLiteral")});function ja(t){let e=new Map;for(let r of t.attributes){if(r.spread){e.clear();continue}let n=r.name;if(!n||n.includes(":"))continue;let o=Ae(r.value);o.known?e.set(n,o.value):e.delete(n)}return Object.fromEntries(e)}function Ua(t){let e=U(t.key);return t.type==="Property"&&e?yt(e,t.computed===!0):null}function Va(t){let e=t.scopes.some(o=>o>(t.parentOffset??-1))?["#slot"]:[];t.attributes.some(o=>["x-text","x-html","set:html","set:text"].includes(o.name??""))&&e.push("children"),t.attributes.some(o=>[":style","x-bind:style"].includes(o.name??""))&&e.push("style");let r=new Map,n=-1;t.attributes.forEach((o,i)=>{o.spread?n=i:o.name&&r.set(o.name,i)});for(let[o,i]of r){if(o.startsWith("data-tempo-"))continue;let s=t.attributes[i],c=s.value?.type==="JSXExpressionContainer"?U(s.value.expression):s.value,a=c&&Oe(c);if(o==="style"&&i>n&&a?.type==="ObjectExpression"){let p=ie(a.properties),f=new Map;for(let d of p){let g=Ua(d);if(g===null){for(let y of f.keys())f.set(y,!1);continue}let h=d.method||d.kind!=="init"?{known:!1}:Ae(U(d.value));f.delete(g),f.set(g,h.known&&(h.value===null||["string","number"].includes(typeof h.value)))}for(let[d,g]of f)g||e.push(`style.${d}`);continue}let u=Ae(t.attributes[i].value);(i<n||!u.known)&&e.push(o==="class"?"className":o)}return e.length?e.join(" "):n>=0?"":void 0}function Fn(t,e,r=e.filepath){let n=_e(t);if(n.kind!=="ok")return n;if(!e.filepath||n.sourceVersion!==e.sourceVersion||!Number.isSafeInteger(e.modifiedTs)||e.modifiedTs<0)return{kind:"invalid",message:"Astro annotation requires a receipt for these exact source bytes"};let o=new Ue(t),i="$$tempoAstroHostId";for(;t.includes(i);)i+="_";for(let s of n.elements.values()){if(s.attributes.some(({name:p})=>p===Ln||p?.startsWith("data-tempo-")&&p!=="data-tempo-locked"&&p!=="data-tempo-svg-paint"))return{kind:"invalid",message:"Astro source already contains reserved Tempo instrumentation"};if(s.kind!=="native-element"&&s.kind!=="component")continue;let c=Va(s),a=s.kind==="component"?{[Ln]:{...e,position:s.start,name:s.tagName,expressions:c,literalProps:ja(s)}}:{"data-tempo-filepath":e.filepath,"data-tempo-position":s.start,"data-tempo-modifiedts":e.modifiedTs,"data-tempo-source-version":e.sourceVersion,...c!==void 0?{"data-tempo-expr":c}:{}},u=s.openingEnd-1;if(s.selfClosing){for(;/\s/.test(t[u-1]);)u--;t[u-1]==="/"&&u--}o.appendLeft(u,Object.entries(a).map(([p,f])=>` ${p}={${JSON.stringify(f)}}`).join("")+(s.kind==="native-element"?` data-tempo-astro-node={${i}()}`:""))}return{kind:"ok",code:o.toString(),occurrenceFactory:i,map:o.generateMap({source:r,includeContent:!0,hires:!0})}}var Ln,Dn=M(()=>{"use strict";Gt();Ir();tt();Ln="__tempo_astro_callsite__";l(ja,"literalComponentProps");l(Ua,"styleKey");l(Va,"astroExpressionFacts");l(Fn,"annotateAstroSource")});function Hn(t,e,r,n){let o=(0,Pr.parseSync)(`${e}.js`,t);if(o.errors.length)return;let i="$$tempoFrameworkComponent";for(;t.includes(i);)i+="_";let s=new Ue(t),c=new Map,a=!1;for(let u of o.program.body)if(u.type==="ExportDefaultDeclaration"){let p=u.declaration;p.type==="Identifier"?c.set(p.name,"default"):(p.type==="FunctionDeclaration"||p.type==="ClassDeclaration")&&p.id?c.set(p.id.name,"default"):(s.prependLeft(p.start,`${i}(`),s.appendLeft(p.end,`, ${JSON.stringify({...r,exportName:"default"})})`),a=!0)}else if(u.type==="ExportNamedDeclaration"&&!u.source){let p=u.declaration;if(p?.type==="VariableDeclaration")for(let f of p.declarations)f.id.type==="Identifier"&&c.set(f.id.name,f.id.name);else(p?.type==="FunctionDeclaration"||p?.type==="ClassDeclaration")&&p.id&&c.set(p.id.name,p.id.name);for(let f of u.specifiers)f.local.type==="Identifier"&&c.set(f.local.name,f.exported.type==="Identifier"?f.exported.name:f.exported.value)}if(!(!a&&!c.size)){s.prepend(`import { instrumentFrameworkComponent as ${i} } from ${JSON.stringify(n)};
13
13
  `);for(let[u,p]of c)s.append(`
14
- ${i}(${u}, ${JSON.stringify({...r,exportName:p})});`);return{code:s.toString(),map:s.generateMap({source:e,includeContent:!0,hires:!0})}}}function Ir(t,e,r,n,o,i=console.warn){let s=(0,kr.parseSync)(`${e}.js`,t),c=s.module.staticImports.map(g=>g.moduleRequest.value),a=l(g=>{if(i(`Tempo could not instrument ${e}: ${g}. Imports: ${c.join(", ")||"none"}`),s.errors.length||!t.includes(o))return{code:t,map:null};let h=new He(t);return h.prepend(`import { astroHostId as ${o} } from ${JSON.stringify(n)};
15
- `),{code:h.toString(),map:h.generateMap({source:e,includeContent:!0,hires:!0})}},"unchanged");if(s.errors.length)return a("compiled code could not be parsed");let u=new He(t),p="$$tempo";for(;t.includes(p);)p+="_";let f=[],d=!1;for(let g of s.program.body){if(g.type!=="ImportDeclaration")continue;let h=g.source.value.split(/[?#]/)[0];if(!(h!=="astro/runtime/server/index.js"&&h!=="astro/compiler-runtime"&&h!=="astro/runtime/compiler/index.js"&&!h.endsWith("/astro/dist/runtime/compiler/index.js")))for(let y of g.specifiers){if(y.type!=="ImportSpecifier"||y.imported.type!=="Identifier")continue;let v=y.imported.name;if(v!=="createComponent"&&v!=="renderComponent")continue;if(v==="createComponent"&&!r){d=!0;continue}let w=y.local,x=`${p}_${v}`;u.overwrite(y.start,y.end,`${v} as ${x}`);let A=v==="createComponent"?"instrumentCreateComponent":"instrumentRenderComponent";f.push(`const ${w.name} = ${p}_${A}(${x}${v==="createComponent"?`, ${JSON.stringify(r)}`:""});`),v==="createComponent"&&(d=!0)}}return d?(u.prepend(`import { astroHostId as ${o}, instrumentCreateComponent as ${p}_instrumentCreateComponent, instrumentRenderComponent as ${p}_instrumentRenderComponent } from ${JSON.stringify(n)};
14
+ ${i}(${u}, ${JSON.stringify({...r,exportName:p})});`);return{code:s.toString(),map:s.generateMap({source:e,includeContent:!0,hires:!0})}}}function Mr(t,e,r,n,o,i=console.warn){let s=(0,Pr.parseSync)(`${e}.js`,t),c=s.module.staticImports.map(g=>g.moduleRequest.value),a=l(g=>{if(i(`Tempo could not instrument ${e}: ${g}. Imports: ${c.join(", ")||"none"}`),s.errors.length||!t.includes(o))return{code:t,map:null};let h=new Ue(t);return h.prepend(`import { astroHostId as ${o} } from ${JSON.stringify(n)};
15
+ `),{code:h.toString(),map:h.generateMap({source:e,includeContent:!0,hires:!0})}},"unchanged");if(s.errors.length)return a("compiled code could not be parsed");let u=new Ue(t),p="$$tempo";for(;t.includes(p);)p+="_";let f=[],d=!1;for(let g of s.program.body){if(g.type!=="ImportDeclaration")continue;let h=g.source.value.split(/[?#]/)[0];if(!(h!=="astro/runtime/server/index.js"&&h!=="astro/compiler-runtime"&&h!=="astro/runtime/compiler/index.js"&&!h.endsWith("/astro/dist/runtime/compiler/index.js")))for(let y of g.specifiers){if(y.type!=="ImportSpecifier"||y.imported.type!=="Identifier")continue;let v=y.imported.name;if(v!=="createComponent"&&v!=="renderComponent")continue;if(v==="createComponent"&&!r){d=!0;continue}let w=y.local,C=`${p}_${v}`;u.overwrite(y.start,y.end,`${v} as ${C}`);let x=v==="createComponent"?"instrumentCreateComponent":"instrumentRenderComponent";f.push(`const ${w.name} = ${p}_${x}(${C}${v==="createComponent"?`, ${JSON.stringify(r)}`:""});`),v==="createComponent"&&(d=!0)}}return d?(u.prepend(`import { astroHostId as ${o}, instrumentCreateComponent as ${p}_instrumentCreateComponent, instrumentRenderComponent as ${p}_instrumentRenderComponent } from ${JSON.stringify(n)};
16
16
  ${f.join(`
17
17
  `)}
18
- `),{code:u.toString(),map:u.generateMap({source:e,includeContent:!0,hires:!0})}):a("Astro createComponent import was not found")}var kr,Dn=P(()=>{Tr();kr=require("oxc-parser");l(Fn,"instrumentFrameworkModule");l(Ir,"instrumentAstroModule")});function Hn(t,e,r){let n=(0,re.resolve)(e??t);if(!e)for(let c=n;;c=(0,re.dirname)(c)){let a=(0,re.join)(c,"tempo/tempo.config.json");if((0,fe.existsSync)(a)){let u=JSON.parse((0,fe.readFileSync)(a,"utf8"));if(c===t||(0,re.resolve)(c,u.apps?.[0]?.appDir??u.appDir??".")===t){n=c;break}}if((0,re.dirname)(c)===c)break}let o=(0,re.join)(n,"tempo"),i=(0,re.join)(o,"tempo.config.json"),s=(0,fe.existsSync)(i)?JSON.parse((0,fe.readFileSync)(i,"utf8")):{};return{root:n,tempoRoot:o,canvasesRoot:r?(0,re.resolve)(n,r):(0,re.resolve)(o,s.paths?.canvases??"designs")}}function jn(t){let e=new Set,r=l((n,o)=>{if(!(!(0,fe.existsSync)(n)||o>5))for(let i of(0,fe.readdirSync)(n,{withFileTypes:!0})){if(i.isSymbolicLink())continue;let s=(0,re.join)(n,i.name);if(i.isDirectory())r(s,o+1);else if(i.name.endsWith(".astro")){let c=(0,fe.readFileSync)(s,"utf8"),a=_e(c);if(a.kind!=="ok")continue;for(let u of a.imports){let p=u.source?.value;if(typeof p!="string"||!p.endsWith(".css")||p.endsWith(".module.css"))continue;let f=p.startsWith(".")?(0,re.resolve)((0,re.dirname)(s),p):p;(!p.startsWith(".")||(0,fe.existsSync)(f))&&e.add(f)}}}},"scan");if(r((0,re.join)(t,"src/layouts"),0),e.size||r((0,re.join)(t,"src/pages"),0),!e.size)for(let n of["src/styles/global.css","src/styles/tailwind.css","src/styles.css","src/index.css"]){let o=(0,re.resolve)(t,n);if((0,fe.existsSync)(o)){e.add(o);break}}return[...e]}var fe,re,Un=P(()=>{fe=require("node:fs"),re=require("node:path");et();l(Hn,"astroProjectContext");l(jn,"discoverAstroStyles")});var Re,Gt=P(()=>{Re=__tempoRuntime.sdkModuleUrl});function vt(t){let e=`preview ${JSON.stringify(t)}`;if(t.includes("\\"))return{error:`${e} uses a backslash; use "/" (paths in canvases are POSIX).`};let r=t.lastIndexOf("#");if(r<0)return{error:`${e} needs "#<function>" after the file, e.g. "../../lib/cards.dart#productCard".`};let n=t.slice(0,r),o=t.slice(r+1);return!n.startsWith("./")&&!n.startsWith("../")?{error:n.startsWith("lib/")?`${e} is no longer relative to a Flutter app folder; write the path from this canvas file, starting with "./" or "../".`:`${e} must be a path relative to this canvas file and start with "./" or "../", like a relative import.`}:n.endsWith(".dart")?/[?#]/.test(n)||n.includes("//")?{error:`${e} must not contain "?", "#", or empty path segments.`}:/^[A-Za-z$][A-Za-z0-9_$]*$/.test(o)?{file:n,functionName:o}:{error:`${e}: ${JSON.stringify(o)} is not a public Dart function name.`}:{error:`${e} must name a .dart file.`}}var Vn,Xt=P(()=>{"use strict";l(vt,"parseFlutterPreview");Vn="data-tempo-flutter-preview-key"});var Da,bt,Kt,Pr=P(()=>{"use strict";Da={Storyboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!0,componentFileExtension:".tsx"},SvelteStoryboard:{importSource:"tempo-sdk/canvas/svelte",kind:"component",uiFramework:"svelte",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!0,componentFileExtension:".svelte"},VueStoryboard:{importSource:"tempo-sdk/canvas/vue",kind:"component",uiFramework:"vue",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!0,componentFileExtension:".vue"},AstroStoryboard:{importSource:"tempo-sdk/canvas/astro",kind:"component",uiFramework:"astro",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!1,componentFileExtension:".astro",componentImportQuery:"?tempo-component"},FlutterStoryboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!0,allowsResponsive:!1},RouteStoryboard:{importSource:"tempo-sdk/canvas",kind:"route",requiresComponentProp:!1,allowsVrt:!1,allowsResponsive:!1},HtmlStoryboard:{importSource:"tempo-sdk/canvas",kind:"html",requiresComponentProp:!1,allowsVrt:!0,allowsResponsive:!1},LegacyStoryboardV1:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!1,allowsResponsive:!1}},bt=Da,Kt=Object.keys(bt)});function Gn(t){return t.componentFramework??t.runtimeFramework??t.uiFramework}function nt(t,e){let r=[],n;try{let w=(0,Jn.parseSync)(t,e);n=w.program;for(let x of w.errors??[])r.push({message:x.message??"Unable to parse canvas source",span:k(x)??k(x?.labels?.[0]),kind:"structural"})}catch(w){return{filePath:t,pageName:Wn(t),imports:[],misimportedSdkCanvasImports:[],storyboards:[],errors:[{message:w instanceof Error?w.message:"Unable to parse canvas source",kind:"structural"}]}}let o=Ja(n),i=Wa(n),{legacyObjects:s,stringBindings:c}=Ga(n,o,e),a=null,u=[];Or(n,w=>{if(w.type!=="JSXElement")return;let x=$r(w.openingElement?.name,o),A=fl(w.openingElement?.name,o,i);if(A&&i.add(A),x==="Canvas"){a?r.push({message:"Canvas file must declare exactly one <Canvas> element",span:k(w),kind:"structural"}):a=w;return}Lr(x)&&u.push({element:w,component:x})});let p=a?Ya(a,o):[],f=new Set(p.map(w=>w.element)),d=p.map(w=>qa(w.element,w.component,o,s,e,r));for(let w of u)f.has(w.element)||r.push({message:`<${w.component}> declarations must be direct children of the <Canvas> element`,span:k(w.element),kind:"structural"});if(Qa(d,r),a)r.push(...Za(a,o));else if(i.all.length>0)for(let w of i.all)r.push({message:Ba(w),span:w.sourceSpan,kind:"structural"});else r.push({message:Va,kind:"structural"});let g=a?.openingElement,h=Mr(g,"name",c),y=Oe(g,"path"),v=Mr(g,"backgroundColor",c)??Mr(g,"background",c);return g&&!h&&r.push({message:'<Canvas> must include a literal "name" prop',span:k(g),kind:"degraded"}),{filePath:t,canvasPath:y?.value,pageName:h?.value??Wn(t),backgroundColor:v?.value,canvasElementSpan:k(a),canvasOpeningElementSpan:k(g),canvasChildrenInsertionOffset:typeof a?.closingElement?.start=="number"?a.closingElement.start:void 0,nameSpan:h?.valueSpan,nameAttributeSpan:h?.attributeSpan,pathSpan:y?.valueSpan,pathAttributeSpan:y?.attributeSpan,backgroundColorSpan:v?.valueSpan,backgroundColorAttributeSpan:v?.attributeSpan,imports:o.all,misimportedSdkCanvasImports:i.all,storyboards:d,errors:r}}function Ba(t){return`Tempo canvas components must be imported from "tempo-sdk/canvas" \u2014 found import of ${t.importedNames.join(", ")} from "${t.source}"`}function Wa(t){let e=[],r=new Map,n=new Map,o=l(i=>{let s=hl(i.sourceSpan);r.has(s)||(r.set(s,i),e.push(i))},"add");for(let i of t?.body??[]){if(i?.type!=="ImportDeclaration"||typeof i.source?.value!="string"||!Zn(i.source.value)||i.importKind==="type")continue;let s=i.source.value,c=k(i.source);if(!c)continue;let a=(i.specifiers??[]).filter(d=>d?.importKind!=="type"),u=a.map(zt),p={source:s,sourceSpan:c,importedNames:u,rewritable:a.length>0&&a.every(d=>d?.type==="ImportSpecifier"&&Ua.has(zt(d)))};a.some(d=>d?.type==="ImportSpecifier"&&qt.has(zt(d)))&&o(p);for(let d of a){if(d?.type!=="ImportNamespaceSpecifier")continue;let g=d.local?.name;typeof g=="string"&&n.set(g,p)}}return{all:e,byDeclarationKey:r,namespaceCandidatesByLocalName:n,add:o}}function Ja(t){let e=[],r=new Map,n=new Map,o=new Set;for(let i of t?.body??[]){if(i?.type!=="ImportDeclaration"||typeof i.source?.value!="string")continue;let s=i.source.value,c=Qn(s);for(let a of i.specifiers??[]){let u=a.local?.name;if(typeof u!="string")continue;let p=zt(a),f={localName:u,source:s,importedName:p,kind:gl(a),importKind:a.importKind==="type"?"type":"value",span:k(a)??k(i)??{start:0,end:0},declarationSpan:k(i)??{start:0,end:0},specifierCount:i.specifiers?.length??0,namedSpecifierCount:(i.specifiers??[]).filter(d=>d?.type==="ImportSpecifier").length,hasDefaultSpecifier:(i.specifiers??[]).some(d=>d?.type==="ImportDefaultSpecifier"),hasNamespaceSpecifier:(i.specifiers??[]).some(d=>d?.type==="ImportNamespaceSpecifier")};if(e.push(f),r.set(u,f),!!c){if(a.type==="ImportNamespaceSpecifier"){o.add(u);continue}qt.has(p)&&n.set(u,p)}}}return{all:e,byLocalName:r,sdkLocalNames:n,sdkNamespaces:o}}function Ga(t,e,r){let n=new Map,o=new Map;for(let i of Xa(t)){if(i.id?.type!=="Identifier")continue;let s=Et(i.init);if(s?.type!=="ObjectExpression")continue;let c=i.id.name;n.set(c,Ka(c,s,e,r));let a=za(s);a.size>0&&o.set(c,a)}return{legacyObjects:n,stringBindings:o}}function Xa(t){let e=[];for(let r of t?.body??[]){let n=r?.type==="VariableDeclaration"?r:r?.type==="ExportNamedDeclaration"&&r.declaration?.type==="VariableDeclaration"?r.declaration:null;n&&e.push(...n.declarations??[])}return e}function Ka(t,e,r,n){let o=[],i=$e(e,"name"),s=i?qn(i.value):null,c=$e(e,"layout"),a=c?zn(c.value,"LegacyStoryboardV1"):{value:rt,errors:[{message:'<LegacyStoryboardV1> storyboard object must include a literal "layout" object',span:k(e),kind:"degraded"}]},u=$e(e,"render"),p=cl(u?.value,r,n);return i&&!s&&o.push({message:"<LegacyStoryboardV1> storyboard.name must be a string literal when set",span:k(i),kind:"degraded"}),o.push(...a.errors),{bindingName:t,displayName:s?.value,component:p??void 0,objectSpan:k(e),objectClose:Nr(e),nameSpan:s?.span,namePropertySpan:k(i),layoutPropertySpan:k(c),layout:a.value,layoutSpans:a.spans,errors:o}}function za(t){let e=new Map;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;let n=Yt(r.key),o=qn(r.value);!n||!o||e.set(n,o)}return e}function qa(t,e,r,n,o,i){let s=t.openingElement,c=[],a=Oe(s,"id"),u=Oe(s,"name"),p=e==="LegacyStoryboardV1"?Bn(s,"storyboard",o):void 0,f=p?.expression&&ul(p.expression)?n.get(p.expression):void 0,d=e==="LegacyStoryboardV1"?{value:f?.layout??rt,spans:f?.layoutSpans,attributeSpan:void 0,errors:f?.errors??(p?[{message:"<LegacyStoryboardV1> storyboard prop must reference a same-file object literal",span:p.span,kind:"degraded"}]:[{message:'<LegacyStoryboardV1> must include a "storyboard" expression prop',span:k(s),kind:"degraded"}])}:pl(s,e),g=bt[e];a||c.push({message:`<${e}> must include a literal "id" prop`,span:k(s),kind:"structural"}),d.errors.length>0&&c.push(...d.errors);let h={storyboardKey:a?.value??"",displayName:u?.value??f?.displayName,kind:g.kind,...g.uiFramework?{componentFramework:g.uiFramework}:{},...g.uiFramework==="svelte"?{uiFramework:g.uiFramework}:g.uiFramework==="astro"?{runtimeFramework:g.uiFramework}:{},layout:d.value,editable:!!a&&d.errors.length===0,jsxElementSpan:k(t)??{start:0,end:0},openingElementSpan:k(s),idSpan:a?.valueSpan,idAttributeSpan:a?.attributeSpan,nameSpan:u?.valueSpan??f?.nameSpan,nameAttributeSpan:u?.attributeSpan??f?.namePropertySpan,layoutAttributeSpan:d.attributeSpan,layoutSpans:d.spans,props:Bn(s,"props",o),component:f?.component,legacyV1:p?{storyboard:p,objectName:f?.bindingName,objectSpan:f?.objectSpan,objectClose:f?.objectClose,namePropertySpan:f?.namePropertySpan,layoutPropertySpan:f?.layoutPropertySpan}:void 0,errors:c};if(g.requiresComponentProp){let y=ll(s,r,o);y?h.component=y:c.push({message:`<${e}> must include a "component" expression prop`,span:k(s),kind:"degraded"})}if(g.allowsVrt){let y=Kn(s,c);y&&(y.value&&(h.vrt=y.value),h.vrtAttributeSpan=y.attributeSpan)}if(g.allowsResponsive){let y=nl(s,c);y&&(h.responsiveAttributeSpan=y.attributeSpan,y.value&&il(h.layout,y.attributeSpan,c)&&(h.responsive=!0))}else{let y=Le(s,"responsive");y&&c.push({message:`<${e}> does not support responsive`,span:k(y),kind:"degraded"})}if(e==="RouteStoryboard"){let y=Oe(s,"route");y?(h.route=y.value,h.routeSpan=y.valueSpan,h.routeAttributeSpan=y.attributeSpan):c.push({message:'<RouteStoryboard> must include a literal "route" prop',span:k(s),kind:"degraded"})}if(e==="HtmlStoryboard"){let y=Oe(s,"filepath"),v=Oe(s,"src");h.filepath=y?.value.trim()?y.value:void 0,h.filepathSpan=y?.valueSpan,h.filepathAttributeSpan=y?.attributeSpan,h.src=v?.value,h.srcSpan=v?.valueSpan,h.srcAttributeSpan=v?.attributeSpan,!y?.value.trim()&&!v?.value.trim()&&c.push({message:'<HtmlStoryboard> must include a literal "filepath" or "src" prop',span:k(s),kind:"degraded"})}if(e==="FlutterStoryboard"){let y=Oe(s,"preview");if(y?.value.trim()){h.preview=y.value,h.previewSpan=y.valueSpan,h.previewAttributeSpan=y.attributeSpan;let v=vt(y.value);"error"in v&&c.push({message:`flutter_preview_invalid: ${v.error}`,span:y.valueSpan,kind:"structural"})}else c.push({message:'<FlutterStoryboard> must include a literal "preview" prop naming a Flutter @Preview function, e.g. preview="../../lib/cards.dart#productCard"',span:k(Le(s,"preview")??s),kind:"structural"})}return i.push(...c),h}function Ya(t,e){let r=[];for(let n of t.children??[]){if(n?.type!=="JSXElement")continue;let o=$r(n.openingElement?.name,e);Lr(o)&&r.push({element:n,component:o})}return r}function Qa(t,e){let r=new Map;for(let n of t){if(!n.storyboardKey)continue;let o=r.get(n.storyboardKey);o?o.push(n):r.set(n.storyboardKey,[n])}for(let[n,o]of r)o.length<2||e.push({message:`Duplicate storyboard id "${n}" (${o.length} declarations) \u2014 storyboard ids must be unique`,span:o[1]?.jsxElementSpan,kind:"structural"})}function Za(t,e){let r=[];for(let n of t.children??[])if(n&&!(n.type==="JSXText"&&typeof n.value=="string"&&n.value.trim()==="")){if(n.type==="JSXExpressionContainer"){if(n.expression?.type==="JSXEmptyExpression")continue;r.push({message:"<Canvas> children must be static storyboard declarations, not expressions",span:k(n),kind:"structural"});continue}if(n.type==="JSXElement"){let o=$r(n.openingElement?.name,e);if(Lr(o))continue;let i=tl(n.openingElement?.name,e);if(i){r.push(rl(n,i));continue}}r.push({message:ja,span:k(n),kind:"structural"})}return r}function tl(t,e){let r,n;if(t?.type==="JSXIdentifier"){let s=e.byLocalName.get(t.name);if(s?.kind!=="named")return null;r=s.importedName,n=s.source}else if(t?.type==="JSXMemberExpression"&&t.object?.type==="JSXIdentifier"&&t.property?.type==="JSXIdentifier"){let s=e.byLocalName.get(t.object.name);if(s?.kind!=="namespace")return null;r=t.property.name,n=s.source}else return null;let o=el.test(n),i=r.endsWith("Storyboard");return o&&i?r:null}function rl(t,e){let r=t.openingElement,n=Oe(r,"id")?.value,o=Kn(r,[])?.value!=null,i=n?` id="${n}"`:"";return{message:`<${e}${i}> is a storyboard from a newer tempo-sdk than this reader supports`,span:k(t),kind:"structural",newerSdkStoryboard:{component:e,...n?{storyboardKey:n}:{},vrt:o}}}function nl(t,e){let r=Le(t,"responsive");if(!r)return null;let n=k(r);if(r.value==null)return{value:!0,attributeSpan:n};let o=Et(Xe(r.value));return o?.type==="Literal"&&typeof o.value=="boolean"?{value:o.value,attributeSpan:n}:(e.push({message:"responsive must be the literal true",span:k(o)??n,kind:"degraded"}),{value:!1,attributeSpan:n})}function il(t,e,r){let{width:n,height:o}=t;return n===void 0||o===void 0?!0:n>ol||o>sl?(r.push({message:"responsive supports at most 3840x12000",span:e,kind:"degraded"}),!1):!0}function Kn(t,e){let r=Le(t,"vrt");if(!r)return null;let n=k(r);if(r.value==null)return{value:{},attributeSpan:n};let o=Et(Xe(r.value));if(o?.type==="Literal"&&o.value===!0)return{value:{},attributeSpan:n};if(o?.type==="Literal"&&o.value===!1)return{value:null,attributeSpan:n};if(o?.type!=="ObjectExpression")return e.push({message:"<Storyboard> vrt must be a boolean literal or an object literal ({ threshold?, skip?, ignore? })",span:k(o)??n,kind:"degraded"}),{value:null,attributeSpan:n};let i={};for(let s of o.properties??[]){if(s?.type!=="Property"||s.computed){e.push({message:"<Storyboard> vrt must contain only literal properties",span:k(s??o),kind:"degraded"});continue}let c=Yt(s.key);if(c==="threshold"){let a=tt(s.value);a&&a.value>=0&&a.value<=.5?i.threshold=a.value:e.push({message:"<Storyboard> vrt.threshold must be a number literal between 0 and 0.5",span:k(s),kind:"degraded"});continue}if(c==="skip"){s.value?.type==="Literal"&&typeof s.value.value=="boolean"?s.value.value&&(i.skip=!0):e.push({message:"<Storyboard> vrt.skip must be a boolean literal",span:k(s),kind:"degraded"});continue}if(c==="ignore"){let a=al(s.value,e);a&&(i.ignore=a);continue}e.push({message:`<Storyboard> vrt has unknown property "${c??"?"}" \u2014 expected threshold, skip, or ignore`,span:k(s),kind:"degraded"})}return{value:i,attributeSpan:n}}function al(t,e){if(t?.type!=="ArrayExpression")return e.push({message:"<Storyboard> vrt.ignore must be an array of { x, y, w, h } literals",span:k(t),kind:"degraded"}),null;let r=[];for(let n of t.elements??[]){let o={};for(let i of["x","y","w","h"]){let s=$e(n,i),c=s?tt(s.value):null;c&&(o[i]=c.value)}if(o.x===void 0||o.y===void 0||o.w===void 0||o.h===void 0)return e.push({message:"<Storyboard> vrt.ignore regions must be { x, y, w, h } number literals",span:k(n)??k(t),kind:"degraded"}),null;r.push(o)}return r}function ll(t,e,r){let n=Le(t,"component"),o=Xe(n?.value),i=k(o);if(!o||!i)return null;let s=o.type==="Identifier"?o.name:o.type==="MemberExpression"&&o.object?.type==="Identifier"?o.object.name:void 0;return{expression:r.slice(i.start,i.end),span:i,attributeSpan:k(n),localName:s,import:s?e.byLocalName.get(s):void 0}}function cl(t,e,r){if(t?.type!=="ArrowFunctionExpression")return null;let n=Et(t.body);if(n?.type!=="JSXElement")return null;let o=n.openingElement?.name;if(o?.type!=="JSXIdentifier")return null;let i=k(o);return!i||typeof o.name!="string"?null:{expression:r.slice(i.start,i.end),span:i,localName:o.name,import:e.byLocalName.get(o.name)}}function Bn(t,e,r){let n=Le(t,e),o=Xe(n?.value),i=k(o);if(!(!o||!i))return{expression:r.slice(i.start,i.end),span:i,attributeSpan:k(n)}}function ul(t){return/^[A-Za-z_$][\w$]*$/.test(t)}function pl(t,e){let r=Yn(e),n=Le(t,"layout"),o=Xe(n?.value);return o?{...zn(o,e),attributeSpan:k(n)}:{value:r?Xn:rt,attributeSpan:k(n),errors:[{message:`<${e}> must include a literal "layout" object prop`,span:k(t),kind:"degraded"}]}}function zn(t,e){let r=[],n=Yn(e);if(t.type!=="ObjectExpression")return{value:n?Xn:rt,spans:{layoutClose:Nr(t)},errors:[{message:`<${e}> layout must be an object literal`,span:k(t),kind:"degraded"}]};let o={layoutClose:Nr(t)},i={...rt},s=$e(t,"width"),c=$e(t,"height"),a=$e(t,"intrinsicSizing"),u=a?.value?.value==="root-element",f=n||!!(s&&c)&&!u;!n&&!!s!=!!c&&r.push({message:"layout.width and layout.height must be set together",span:k(t),kind:"degraded"});let g=f?{width:s?tt(s.value):null,height:c?tt(c.value):null}:null,h=f?["x","y","width","height"]:["x","y"];for(let w of h){let x=w==="width"?s:w==="height"?c:$e(t,w),A=w==="width"||w==="height"?g?.[w]:x?tt(x.value):null,T=w==="x"||w==="y"||n||!!(g?.width&&g.height);if(!A){r.push({message:`<${e}> layout.${w} must be a number literal`,span:k(x??t),kind:"degraded"});continue}T&&(i[w]=A.value,o[w]=A.span)}let y=$e(t,"zIndex");if(y){let w=tt(y.value);w?(i.zIndex=w.value,o.zIndex=w.span):r.push({message:`<${e}> layout.zIndex must be a number literal`,span:k(y),kind:"degraded"})}return a&&(a.value?.type!=="Literal"||!u)&&r.push({message:`<${e}> layout.intrinsicSizing must be "root-element" when set`,span:k(a),kind:"degraded"}),{value:i,spans:o,errors:r}}function qn(t){return t?.type==="Literal"&&typeof t.value=="string"?{value:t.value,span:k(t)??{start:0,end:0}}:null}function Et(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function Mr(t,e,r){let n=Oe(t,e);if(n)return n;let o=Le(t,e),i=Xe(o?.value),s=k(i),c=k(o);if(!i||!s||!c)return null;let a=dl(i,r);return a?{value:a.value,valueSpan:s,attributeSpan:c}:null}function dl(t,e){if(t?.type!=="MemberExpression"||t.object?.type!=="Identifier")return null;let r=Yt(t.property);return r?e.get(t.object.name)?.get(r)??null:null}function Oe(t,e){let r=Le(t,e);if(!r)return null;let n=r.value;if(n?.type==="Literal"&&typeof n.value=="string")return{value:n.value,valueSpan:k(n)??k(r)??{start:0,end:0},attributeSpan:k(r)??{start:0,end:0}};let o=Et(Xe(n)),i=o?.type==="Literal"&&typeof o.value=="string"?o.value:o?.type==="TemplateLiteral"&&(o.expressions?.length??0)===0&&o.quasis?.length===1&&typeof o.quasis[0]?.value?.cooked=="string"?o.quasis[0].value.cooked:null;return i!==null?{value:i,valueSpan:k(o)??k(r)??{start:0,end:0},attributeSpan:k(r)??{start:0,end:0}}:null}function Le(t,e){for(let r of t?.attributes??[])if(r?.type==="JSXAttribute"&&r.name?.type==="JSXIdentifier"&&r.name.name===e)return r;return null}function Xe(t){return t?t.type==="JSXExpressionContainer"?t.expression:t:null}function Yt(t){return t?.type==="Identifier"?t.name:t?.type==="Literal"&&typeof t.value=="string"?t.value:null}function $e(t,e){if(t?.type!=="ObjectExpression")return null;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;if(Yt(r.key)===e)return r}return null}function tt(t){return t?.type==="Literal"&&typeof t.value=="number"&&Number.isFinite(t.value)?{value:t.value,span:k(t)??{start:0,end:0}}:t?.type==="UnaryExpression"&&t.operator==="-"&&t.argument?.type==="Literal"&&typeof t.argument.value=="number"&&Number.isFinite(t.argument.value)?{value:-t.argument.value,span:k(t)??{start:0,end:0}}:null}function $r(t,e){return t?.type==="JSXIdentifier"?e.sdkLocalNames.get(t.name)??null:t?.type==="JSXMemberExpression"&&t.object?.type==="JSXIdentifier"&&t.property?.type==="JSXIdentifier"&&e.sdkNamespaces.has(t.object.name)&&qt.has(t.property.name)?t.property.name:null}function fl(t,e,r){if(t?.type!=="JSXMemberExpression"||t.object?.type!=="JSXIdentifier"||t.property?.type!=="JSXIdentifier"||!qt.has(t.property.name))return null;let n=e.byLocalName.get(t.object.name);return n?.kind!=="namespace"||!Zn(n.source)?null:r.namespaceCandidatesByLocalName.get(t.object.name)??null}function Lr(t){return t!==null&&t!=="Canvas"}function ml(t){return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`}function Yn(t){return t==="RouteStoryboard"||t==="HtmlStoryboard"||t==="FlutterStoryboard"}function zt(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"*":t.imported?.name??t.local?.name??"unknown"}function gl(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"namespace":"named"}function Qn(t){for(let e of Ha)if(t===e||t.endsWith(`/${e}`))return!0;return!1}function Zn(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Qn(t)}function hl(t){return`${t.start}:${t.end}`}function Nr(t){return typeof t?.end=="number"&&Number.isFinite(t.end)?t.end-1:void 0}function Wn(t){let r=t.replace(/\\/g,"/").split("/").filter(Boolean),n=r.length>0?r[r.length-1]:t,o=r.length>1?r[r.length-2]:n;return(/^index\.canvas\.[tj]sx?$/.test(n)?o:n.replace(/\.canvas\.[tj]sx?$/,"")).split(/[-_\s]+/).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function k(t){return typeof t?.start=="number"&&Number.isFinite(t.start)&&typeof t?.end=="number"&&Number.isFinite(t.end)?{start:t.start,end:t.end}:void 0}function Or(t,e,r=new Set){if(!(!t||typeof t!="object"||r.has(t))){r.add(t),e(t);for(let n of Object.values(t))if(n)if(Array.isArray(n))for(let o of n)Or(o,e,r);else typeof n=="object"&&Or(n,e,r)}}var Jn,Ha,qt,ja,Ua,rt,Xn,Va,el,ol,sl,Qt=P(()=>{Xt();Jn=require("oxc-parser");Pr();Pr();l(Gn,"componentFrameworkForStoryboard");Ha=new Set(["tempo-sdk/canvas",...Kt.map(t=>bt[t].importSource)]),qt=new Set(["Canvas",...Kt]),ja=`<Canvas> children must be ${ml(Kt.map(t=>`<${t}>`))} declarations`,Ua=new Set(["Canvas","CanvasContext","getCanvasStoryboardRenderId","CanvasHost","buildRenderContentFiberSelector","buildRenderContentSelector","buildRenderSelector","captureStoryboardCombined","captureStoryboardHtml","captureStoryboardImage","stripRenderContentWrapperAttributes","stripRenderContentWrapperFromCombinedCapture","watchStoryboardCombined","getCanvasHostRuntime","getOptionalCanvasHostRuntime","useActiveState","FlutterStoryboard","HtmlStoryboard","LegacyStoryboardV1","RouteStoryboard","Storyboard","StoryboardSlot"]),rt={x:0,y:0},Xn={...rt,width:600,height:400},Va="No <Canvas> declaration found in canvas file";l(nt,"parseCanvasFile");l(Ba,"misimportedSdkCanvasImportMessage");l(Wa,"readMisimportedSdkCanvasImports");l(Ja,"readImports");l(Ga,"readObjectExpressionBindings");l(Xa,"readTopLevelVariableDeclarators");l(Ka,"readLegacyStoryboardObject");l(za,"readObjectStringProperties");l(qa,"readStoryboard");l(Ya,"readDirectCanvasStoryboardElements");l(Qa,"reportDuplicateStoryboardIds");l(Za,"validateCanvasChildren");el=/(^|\/)tempo-sdk\/canvas(\/[^/]+)?$/;l(tl,"resolveNewerSdkStoryboardComponent");l(rl,"newerSdkStoryboardError");l(nl,"readResponsive");ol=3840,sl=12e3;l(il,"responsiveBoxFits");l(Kn,"readVrt");l(al,"readVrtIgnoreRegions");l(ll,"readComponentReference");l(cl,"readRenderComponentReference");l(Bn,"readExpressionReference");l(ul,"isIdentifierExpression");l(pl,"readLayout");l(zn,"readLayoutExpression");l(qn,"readStringLiteralValue");l(Et,"unwrapTsExpression");l(Mr,"readResolvableStringAttribute");l(dl,"resolveStringMemberExpression");l(Oe,"readStringAttribute");l(Le,"getAttribute");l(Xe,"unwrapAttributeExpression");l(Yt,"readPropertyKeyName");l($e,"getObjectProperty");l(tt,"readNumberLiteral");l($r,"resolveSdkComponent");l(fl,"resolveMisimportedNamespaceSdkComponent");l(Lr,"isStoryboardSdkComponent");l(ml,"formatAlternatives");l(Yn,"requiresFixedLayoutSize");l(zt,"readImportedName");l(gl,"readImportKind");l(Qn,"isSdkImportSource");l(Zn,"isWrongTempoSdkCanvasImportSource");l(hl,"spanKey");l(Nr,"readLayoutClose");l(Wn,"fallbackPageName");l(k,"toSpan");l(Or,"walk")});function eo(t,e){return`/__tempo/astro/${encodeURIComponent(t)}/${encodeURIComponent(e)}`}var to=P(()=>{"use strict";l(eo,"astroStoryboardPath")});function Fr(t){if(!t)return{};let e=(0,ro.parseSync)("props.ts",`(${t})`);if(e.errors.length)throw new Error("Astro storyboard props must be a JSON object literal");let r=l(i=>{if(i?.type==="ParenthesizedExpression")return r(i.expression);if(i?.type==="Literal"&&(i.value===null||["string","boolean"].includes(typeof i.value)||typeof i.value=="number"&&Number.isFinite(i.value)))return i.value;if(i?.type==="UnaryExpression"&&["-","+"].includes(i.operator)&&i.argument?.type==="Literal"&&typeof i.argument.value=="number"&&Number.isFinite(i.argument.value))return i.operator==="-"?-i.argument.value:i.argument.value;if(i?.type==="ArrayExpression")return i.elements.map(r);if(i?.type==="ObjectExpression"){let s=Object.create(null);for(let c of i.properties){if(c.type!=="Property"||c.computed||c.method||c.shorthand||c.kind!=="init")throw new Error("Astro storyboard props cannot contain expressions, spreads or getters");let a=c.key.type==="Identifier"?c.key.name:c.key.value;if(typeof a!="string"&&typeof a!="number")throw new Error("Astro storyboard props require literal keys");s[a]=r(c.value)}return s}throw new Error("Astro storyboard props must be static JSON; use an authored .astro fixture for server data or slots")},"read"),n=e.program.body[0],o=r(n?.type==="ExpressionStatement"?n.expression:void 0);if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Astro storyboard props must be a JSON object literal");return o}var ro,no=P(()=>{ro=require("oxc-parser");l(Fr,"readAstroStoryboardProps")});function ao(t){return(0,ee.existsSync)(t)?(0,ee.readdirSync)(t,{withFileTypes:!0}).flatMap(e=>{if(e.isSymbolicLink())return[];let r=(0,oe.join)(t,e.name);return e.isDirectory()?ao(r):e.name.endsWith(".canvas.tsx")?[r]:[]}):[]}function oo(t,e,r,n=[]){let o=[];for(let s of new Set((Array.isArray(e)?e:[e]).flatMap(ao))){let c=(0,ee.openSync)(s,"r"),a,u;try{let d=(0,ee.fstatSync)(c);a=(0,ee.readFileSync)(c,"utf8");let g=(0,ee.fstatSync)(c);if(!["mtimeMs","ctimeMs","size","ino","dev"].every(h=>d[h]===g[h]))throw new Error(`Canvas changed while reading: ${s}`);u=Math.trunc(d.mtimeMs)}finally{(0,ee.closeSync)(c)}let p=nt(s,a),f=p.canvasPath??(0,oe.relative)(t,(0,oe.dirname)(s)).replaceAll("\\","/");for(let d of p.storyboards){if(Gn(d)!=="astro")continue;let g=eo(f,d.storyboardKey),h=(0,oe.join)(r,`${(0,Dr.createHash)("sha256").update(g).digest("hex")}.astro`),y=(0,Dr.createHash)("sha256").update(a).digest("hex"),v;try{if(p.errors.some(S=>S.kind==="structural")||d.errors.length)throw new Error("Fix the Astro storyboard's canvas declaration before rendering it");let w=d.component?.import;if(!w||w.kind!=="default"||!w.source.endsWith(".astro?tempo-component"))throw new Error("AstroStoryboard requires a default .astro?tempo-component import; use an authored .astro fixture for slots and server data");let x=w.source.slice(0,-16),A=x.startsWith(".")?(0,oe.resolve)((0,oe.dirname)(s),x).replaceAll("\\","/"):x,T=JSON.stringify(Fr(d.props?.expression)).replaceAll("<","\\u003c"),O=JSON.stringify({filepath:(0,oe.relative)(t,s).replaceAll("\\","/"),sourceVersion:Ee(a),modifiedTs:u,position:d.jsxElementSpan.start,name:d.component?.localName??"Component"}),M=JSON.stringify({canvasPath:f,storyboardId:d.storyboardKey,revision:y}),B=/\/\.tempo\/(library-canvases|asset-edit-previews)\//.exec(s.replaceAll("\\","/"))?.[1],L;if(B==="asset-edit-previews"){for(let S of(0,io.parseSync)(s,a).program.body)if(!(S.type!=="ExportNamedDeclaration"||S.declaration?.type!=="VariableDeclaration"))for(let J of S.declaration.declarations)J.id.type==="Identifier"&&J.id.name==="__tempoAstroAssetPreview"&&J.init&&(L=Fr(a.slice(J.init.start,J.init.end)))}let $=B?{imports:`import ComponentMetadata from ${JSON.stringify(A+"?tempo-component")};
18
+ `),{code:u.toString(),map:u.generateMap({source:e,includeContent:!0,hires:!0})}):a("Astro createComponent import was not found")}var Pr,jn=M(()=>{Ir();Pr=require("oxc-parser");l(Hn,"instrumentFrameworkModule");l(Mr,"instrumentAstroModule")});function Un(t,e,r){let n=(0,re.resolve)(e??t);if(!e)for(let c=n;;c=(0,re.dirname)(c)){let a=(0,re.join)(c,"tempo/tempo.config.json");if((0,ge.existsSync)(a)){let u=JSON.parse((0,ge.readFileSync)(a,"utf8"));if(c===t||(0,re.resolve)(c,u.apps?.[0]?.appDir??u.appDir??".")===t){n=c;break}}if((0,re.dirname)(c)===c)break}let o=(0,re.join)(n,"tempo"),i=(0,re.join)(o,"tempo.config.json"),s=(0,ge.existsSync)(i)?JSON.parse((0,ge.readFileSync)(i,"utf8")):{};return{root:n,tempoRoot:o,canvasesRoot:r?(0,re.resolve)(n,r):(0,re.resolve)(o,s.paths?.canvases??"designs")}}function Vn(t){let e=new Set,r=l((n,o)=>{if(!(!(0,ge.existsSync)(n)||o>5))for(let i of(0,ge.readdirSync)(n,{withFileTypes:!0})){if(i.isSymbolicLink())continue;let s=(0,re.join)(n,i.name);if(i.isDirectory())r(s,o+1);else if(i.name.endsWith(".astro")){let c=(0,ge.readFileSync)(s,"utf8"),a=_e(c);if(a.kind!=="ok")continue;for(let u of a.imports){let p=u.source?.value;if(typeof p!="string"||!p.endsWith(".css")||p.endsWith(".module.css"))continue;let f=p.startsWith(".")?(0,re.resolve)((0,re.dirname)(s),p):p;(!p.startsWith(".")||(0,ge.existsSync)(f))&&e.add(f)}}}},"scan");if(r((0,re.join)(t,"src/layouts"),0),e.size||r((0,re.join)(t,"src/pages"),0),!e.size)for(let n of["src/styles/global.css","src/styles/tailwind.css","src/styles.css","src/index.css"]){let o=(0,re.resolve)(t,n);if((0,ge.existsSync)(o)){e.add(o);break}}return[...e]}var ge,re,Bn=M(()=>{ge=require("node:fs"),re=require("node:path");tt();l(Un,"astroProjectContext");l(Vn,"discoverAstroStyles")});var Re,zt=M(()=>{Re=__tempoRuntime.sdkModuleUrl});function bt(t){let e=`preview ${JSON.stringify(t)}`;if(t.includes("\\"))return{error:`${e} uses a backslash; use "/" (paths in canvases are POSIX).`};let r=t.lastIndexOf("#");if(r<0)return{error:`${e} needs "#<function>" after the file, e.g. "../../lib/cards.dart#productCard".`};let n=t.slice(0,r),o=t.slice(r+1);return!n.startsWith("./")&&!n.startsWith("../")?{error:n.startsWith("lib/")?`${e} is no longer relative to a Flutter app folder; write the path from this canvas file, starting with "./" or "../".`:`${e} must be a path relative to this canvas file and start with "./" or "../", like a relative import.`}:n.endsWith(".dart")?/[?#]/.test(n)||n.includes("//")?{error:`${e} must not contain "?", "#", or empty path segments.`}:/^[A-Za-z$][A-Za-z0-9_$]*$/.test(o)?{file:n,functionName:o}:{error:`${e}: ${JSON.stringify(o)} is not a public Dart function name.`}:{error:`${e} must name a .dart file.`}}var Wn,qt=M(()=>{"use strict";l(bt,"parseFlutterPreview");Wn="data-tempo-flutter-preview-key"});var Ba,Et,Yt,Nr=M(()=>{"use strict";Ba={Storyboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!0,componentFileExtension:".tsx"},SvelteStoryboard:{importSource:"tempo-sdk/canvas/svelte",kind:"component",uiFramework:"svelte",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!0,componentFileExtension:".svelte"},VueStoryboard:{importSource:"tempo-sdk/canvas/vue",kind:"component",uiFramework:"vue",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!0,componentFileExtension:".vue"},AstroStoryboard:{importSource:"tempo-sdk/canvas/astro",kind:"component",uiFramework:"astro",requiresComponentProp:!0,allowsVrt:!0,allowsResponsive:!1,componentFileExtension:".astro",componentImportQuery:"?tempo-component"},FlutterStoryboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!0,allowsResponsive:!1},RouteStoryboard:{importSource:"tempo-sdk/canvas",kind:"route",requiresComponentProp:!1,allowsVrt:!1,allowsResponsive:!1},HtmlStoryboard:{importSource:"tempo-sdk/canvas",kind:"html",requiresComponentProp:!1,allowsVrt:!0,allowsResponsive:!1},LegacyStoryboardV1:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!1,allowsResponsive:!1}},Et=Ba,Yt=Object.keys(Et)});function Kn(t){return t.componentFramework??t.runtimeFramework??t.uiFramework}function ot(t,e){let r=[],n;try{let w=(0,Xn.parseSync)(t,e);n=w.program;for(let C of w.errors??[])r.push({message:C.message??"Unable to parse canvas source",span:I(C)??I(C?.labels?.[0]),kind:"structural"})}catch(w){return{filePath:t,pageName:Gn(t),imports:[],misimportedSdkCanvasImports:[],storyboards:[],errors:[{message:w instanceof Error?w.message:"Unable to parse canvas source",kind:"structural"}]}}let o=qa(n),i=za(n),{legacyObjects:s,stringBindings:c}=Ya(n,o,e),a=null,u=[];Lr(n,w=>{if(w.type!=="JSXElement")return;let C=Fr(w.openingElement?.name,o),x=Sl(w.openingElement?.name,o,i);if(x&&i.add(x),C==="Canvas"){a?r.push({message:"Canvas file must declare exactly one <Canvas> element",span:I(w),kind:"structural"}):a=w;return}Dr(C)&&u.push({element:w,component:C})});let p=a?rl(a,o):[],f=new Set(p.map(w=>w.element)),d=p.map(w=>tl(w.element,w.component,o,s,e,r));for(let w of u)f.has(w.element)||r.push({message:`<${w.component}> declarations must be direct children of the <Canvas> element`,span:I(w.element),kind:"structural"});if(nl(d,r),a)r.push(...ol(a,o));else if(i.all.length>0)for(let w of i.all)r.push({message:Ka(w),span:w.sourceSpan,kind:"structural"});else r.push({message:Xa,kind:"structural"});let g=a?.openingElement,h=Or(g,"name",c),y=$e(g,"path"),v=Or(g,"backgroundColor",c)??Or(g,"background",c);return g&&!h&&r.push({message:'<Canvas> must include a literal "name" prop',span:I(g),kind:"degraded"}),{filePath:t,canvasPath:y?.value,pageName:h?.value??Gn(t),backgroundColor:v?.value,canvasElementSpan:I(a),canvasOpeningElementSpan:I(g),canvasChildrenInsertionOffset:typeof a?.closingElement?.start=="number"?a.closingElement.start:void 0,nameSpan:h?.valueSpan,nameAttributeSpan:h?.attributeSpan,pathSpan:y?.valueSpan,pathAttributeSpan:y?.attributeSpan,backgroundColorSpan:v?.valueSpan,backgroundColorAttributeSpan:v?.attributeSpan,imports:o.all,misimportedSdkCanvasImports:i.all,storyboards:d,errors:r}}function Ka(t){return`Tempo canvas components must be imported from "tempo-sdk/canvas" \u2014 found import of ${t.importedNames.join(", ")} from "${t.source}"`}function za(t){let e=[],r=new Map,n=new Map,o=l(i=>{let s=El(i.sourceSpan);r.has(s)||(r.set(s,i),e.push(i))},"add");for(let i of t?.body??[]){if(i?.type!=="ImportDeclaration"||typeof i.source?.value!="string"||!to(i.source.value)||i.importKind==="type")continue;let s=i.source.value,c=I(i.source);if(!c)continue;let a=(i.specifiers??[]).filter(d=>d?.importKind!=="type"),u=a.map(Qt),p={source:s,sourceSpan:c,importedNames:u,rewritable:a.length>0&&a.every(d=>d?.type==="ImportSpecifier"&&Ga.has(Qt(d)))};a.some(d=>d?.type==="ImportSpecifier"&&Zt.has(Qt(d)))&&o(p);for(let d of a){if(d?.type!=="ImportNamespaceSpecifier")continue;let g=d.local?.name;typeof g=="string"&&n.set(g,p)}}return{all:e,byDeclarationKey:r,namespaceCandidatesByLocalName:n,add:o}}function qa(t){let e=[],r=new Map,n=new Map,o=new Set;for(let i of t?.body??[]){if(i?.type!=="ImportDeclaration"||typeof i.source?.value!="string")continue;let s=i.source.value,c=eo(s);for(let a of i.specifiers??[]){let u=a.local?.name;if(typeof u!="string")continue;let p=Qt(a),f={localName:u,source:s,importedName:p,kind:bl(a),importKind:a.importKind==="type"?"type":"value",span:I(a)??I(i)??{start:0,end:0},declarationSpan:I(i)??{start:0,end:0},specifierCount:i.specifiers?.length??0,namedSpecifierCount:(i.specifiers??[]).filter(d=>d?.type==="ImportSpecifier").length,hasDefaultSpecifier:(i.specifiers??[]).some(d=>d?.type==="ImportDefaultSpecifier"),hasNamespaceSpecifier:(i.specifiers??[]).some(d=>d?.type==="ImportNamespaceSpecifier")};if(e.push(f),r.set(u,f),!!c){if(a.type==="ImportNamespaceSpecifier"){o.add(u);continue}Zt.has(p)&&n.set(u,p)}}}return{all:e,byLocalName:r,sdkLocalNames:n,sdkNamespaces:o}}function Ya(t,e,r){let n=new Map,o=new Map;for(let i of Qa(t)){if(i.id?.type!=="Identifier")continue;let s=wt(i.init);if(s?.type!=="ObjectExpression")continue;let c=i.id.name;n.set(c,Za(c,s,e,r));let a=el(s);a.size>0&&o.set(c,a)}return{legacyObjects:n,stringBindings:o}}function Qa(t){let e=[];for(let r of t?.body??[]){let n=r?.type==="VariableDeclaration"?r:r?.type==="ExportNamedDeclaration"&&r.declaration?.type==="VariableDeclaration"?r.declaration:null;n&&e.push(...n.declarations??[])}return e}function Za(t,e,r,n){let o=[],i=Le(e,"name"),s=i?Qn(i.value):null,c=Le(e,"layout"),a=c?Yn(c.value,"LegacyStoryboardV1"):{value:nt,errors:[{message:'<LegacyStoryboardV1> storyboard object must include a literal "layout" object',span:I(e),kind:"degraded"}]},u=Le(e,"render"),p=ml(u?.value,r,n);return i&&!s&&o.push({message:"<LegacyStoryboardV1> storyboard.name must be a string literal when set",span:I(i),kind:"degraded"}),o.push(...a.errors),{bindingName:t,displayName:s?.value,component:p??void 0,objectSpan:I(e),objectClose:$r(e),nameSpan:s?.span,namePropertySpan:I(i),layoutPropertySpan:I(c),layout:a.value,layoutSpans:a.spans,errors:o}}function el(t){let e=new Map;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;let n=er(r.key),o=Qn(r.value);!n||!o||e.set(n,o)}return e}function tl(t,e,r,n,o,i){let s=t.openingElement,c=[],a=$e(s,"id"),u=$e(s,"name"),p=e==="LegacyStoryboardV1"?Jn(s,"storyboard",o):void 0,f=p?.expression&&gl(p.expression)?n.get(p.expression):void 0,d=e==="LegacyStoryboardV1"?{value:f?.layout??nt,spans:f?.layoutSpans,attributeSpan:void 0,errors:f?.errors??(p?[{message:"<LegacyStoryboardV1> storyboard prop must reference a same-file object literal",span:p.span,kind:"degraded"}]:[{message:'<LegacyStoryboardV1> must include a "storyboard" expression prop',span:I(s),kind:"degraded"}])}:hl(s,e),g=Et[e];a||c.push({message:`<${e}> must include a literal "id" prop`,span:I(s),kind:"structural"}),d.errors.length>0&&c.push(...d.errors);let h={storyboardKey:a?.value??"",displayName:u?.value??f?.displayName,kind:g.kind,...g.uiFramework?{componentFramework:g.uiFramework}:{},...g.uiFramework==="svelte"?{uiFramework:g.uiFramework}:g.uiFramework==="astro"?{runtimeFramework:g.uiFramework}:{},layout:d.value,editable:!!a&&d.errors.length===0,jsxElementSpan:I(t)??{start:0,end:0},openingElementSpan:I(s),idSpan:a?.valueSpan,idAttributeSpan:a?.attributeSpan,nameSpan:u?.valueSpan??f?.nameSpan,nameAttributeSpan:u?.attributeSpan??f?.namePropertySpan,layoutAttributeSpan:d.attributeSpan,layoutSpans:d.spans,props:Jn(s,"props",o),component:f?.component,legacyV1:p?{storyboard:p,objectName:f?.bindingName,objectSpan:f?.objectSpan,objectClose:f?.objectClose,namePropertySpan:f?.namePropertySpan,layoutPropertySpan:f?.layoutPropertySpan}:void 0,errors:c};if(g.requiresComponentProp){let y=fl(s,r,o);y?h.component=y:c.push({message:`<${e}> must include a "component" expression prop`,span:I(s),kind:"degraded"})}if(g.allowsVrt){let y=qn(s,c);y&&(y.value&&(h.vrt=y.value),h.vrtAttributeSpan=y.attributeSpan)}if(g.allowsResponsive){let y=ll(s,c);y&&(h.responsiveAttributeSpan=y.attributeSpan,y.value&&pl(h.layout,y.attributeSpan,c)&&(h.responsive=!0))}else{let y=Fe(s,"responsive");y&&c.push({message:`<${e}> does not support responsive`,span:I(y),kind:"degraded"})}if(e==="RouteStoryboard"){let y=$e(s,"route");y?(h.route=y.value,h.routeSpan=y.valueSpan,h.routeAttributeSpan=y.attributeSpan):c.push({message:'<RouteStoryboard> must include a literal "route" prop',span:I(s),kind:"degraded"})}if(e==="HtmlStoryboard"){let y=$e(s,"filepath"),v=$e(s,"src");h.filepath=y?.value.trim()?y.value:void 0,h.filepathSpan=y?.valueSpan,h.filepathAttributeSpan=y?.attributeSpan,h.src=v?.value,h.srcSpan=v?.valueSpan,h.srcAttributeSpan=v?.attributeSpan,!y?.value.trim()&&!v?.value.trim()&&c.push({message:'<HtmlStoryboard> must include a literal "filepath" or "src" prop',span:I(s),kind:"degraded"})}if(e==="FlutterStoryboard"){let y=$e(s,"preview");if(y?.value.trim()){h.preview=y.value,h.previewSpan=y.valueSpan,h.previewAttributeSpan=y.attributeSpan;let v=bt(y.value);"error"in v&&c.push({message:`flutter_preview_invalid: ${v.error}`,span:y.valueSpan,kind:"structural"})}else c.push({message:'<FlutterStoryboard> must include a literal "preview" prop naming a Flutter @Preview function, e.g. preview="../../lib/cards.dart#productCard"',span:I(Fe(s,"preview")??s),kind:"structural"})}return i.push(...c),h}function rl(t,e){let r=[];for(let n of t.children??[]){if(n?.type!=="JSXElement")continue;let o=Fr(n.openingElement?.name,e);Dr(o)&&r.push({element:n,component:o})}return r}function nl(t,e){let r=new Map;for(let n of t){if(!n.storyboardKey)continue;let o=r.get(n.storyboardKey);o?o.push(n):r.set(n.storyboardKey,[n])}for(let[n,o]of r)o.length<2||e.push({message:`Duplicate storyboard id "${n}" (${o.length} declarations) \u2014 storyboard ids must be unique`,span:o[1]?.jsxElementSpan,kind:"structural"})}function ol(t,e){let r=[];for(let n of t.children??[])if(n&&!(n.type==="JSXText"&&typeof n.value=="string"&&n.value.trim()==="")){if(n.type==="JSXExpressionContainer"){if(n.expression?.type==="JSXEmptyExpression")continue;r.push({message:"<Canvas> children must be static storyboard declarations, not expressions",span:I(n),kind:"structural"});continue}if(n.type==="JSXElement"){let o=Fr(n.openingElement?.name,e);if(Dr(o))continue;let i=il(n.openingElement?.name,e);if(i){r.push(al(n,i));continue}}r.push({message:Ja,span:I(n),kind:"structural"})}return r}function il(t,e){let r,n;if(t?.type==="JSXIdentifier"){let s=e.byLocalName.get(t.name);if(s?.kind!=="named")return null;r=s.importedName,n=s.source}else if(t?.type==="JSXMemberExpression"&&t.object?.type==="JSXIdentifier"&&t.property?.type==="JSXIdentifier"){let s=e.byLocalName.get(t.object.name);if(s?.kind!=="namespace")return null;r=t.property.name,n=s.source}else return null;let o=sl.test(n),i=r.endsWith("Storyboard");return o&&i?r:null}function al(t,e){let r=t.openingElement,n=$e(r,"id")?.value,o=qn(r,[])?.value!=null,i=n?` id="${n}"`:"";return{message:`<${e}${i}> is a storyboard from a newer tempo-sdk than this reader supports`,span:I(t),kind:"structural",newerSdkStoryboard:{component:e,...n?{storyboardKey:n}:{},vrt:o}}}function ll(t,e){let r=Fe(t,"responsive");if(!r)return null;let n=I(r);if(r.value==null)return{value:!0,attributeSpan:n};let o=wt(Ke(r.value));return o?.type==="Literal"&&typeof o.value=="boolean"?{value:o.value,attributeSpan:n}:(e.push({message:"responsive must be the literal true",span:I(o)??n,kind:"degraded"}),{value:!1,attributeSpan:n})}function pl(t,e,r){let{width:n,height:o}=t;return n===void 0||o===void 0?!0:n>cl||o>ul?(r.push({message:"responsive supports at most 3840x12000",span:e,kind:"degraded"}),!1):!0}function qn(t,e){let r=Fe(t,"vrt");if(!r)return null;let n=I(r);if(r.value==null)return{value:{},attributeSpan:n};let o=wt(Ke(r.value));if(o?.type==="Literal"&&o.value===!0)return{value:{},attributeSpan:n};if(o?.type==="Literal"&&o.value===!1)return{value:null,attributeSpan:n};if(o?.type!=="ObjectExpression")return e.push({message:"<Storyboard> vrt must be a boolean literal or an object literal ({ threshold?, skip?, ignore? })",span:I(o)??n,kind:"degraded"}),{value:null,attributeSpan:n};let i={};for(let s of o.properties??[]){if(s?.type!=="Property"||s.computed){e.push({message:"<Storyboard> vrt must contain only literal properties",span:I(s??o),kind:"degraded"});continue}let c=er(s.key);if(c==="threshold"){let a=rt(s.value);a&&a.value>=0&&a.value<=.5?i.threshold=a.value:e.push({message:"<Storyboard> vrt.threshold must be a number literal between 0 and 0.5",span:I(s),kind:"degraded"});continue}if(c==="skip"){s.value?.type==="Literal"&&typeof s.value.value=="boolean"?s.value.value&&(i.skip=!0):e.push({message:"<Storyboard> vrt.skip must be a boolean literal",span:I(s),kind:"degraded"});continue}if(c==="ignore"){let a=dl(s.value,e);a&&(i.ignore=a);continue}e.push({message:`<Storyboard> vrt has unknown property "${c??"?"}" \u2014 expected threshold, skip, or ignore`,span:I(s),kind:"degraded"})}return{value:i,attributeSpan:n}}function dl(t,e){if(t?.type!=="ArrayExpression")return e.push({message:"<Storyboard> vrt.ignore must be an array of { x, y, w, h } literals",span:I(t),kind:"degraded"}),null;let r=[];for(let n of t.elements??[]){let o={};for(let i of["x","y","w","h"]){let s=Le(n,i),c=s?rt(s.value):null;c&&(o[i]=c.value)}if(o.x===void 0||o.y===void 0||o.w===void 0||o.h===void 0)return e.push({message:"<Storyboard> vrt.ignore regions must be { x, y, w, h } number literals",span:I(n)??I(t),kind:"degraded"}),null;r.push(o)}return r}function fl(t,e,r){let n=Fe(t,"component"),o=Ke(n?.value),i=I(o);if(!o||!i)return null;let s=o.type==="Identifier"?o.name:o.type==="MemberExpression"&&o.object?.type==="Identifier"?o.object.name:void 0;return{expression:r.slice(i.start,i.end),span:i,attributeSpan:I(n),localName:s,import:s?e.byLocalName.get(s):void 0}}function ml(t,e,r){if(t?.type!=="ArrowFunctionExpression")return null;let n=wt(t.body);if(n?.type!=="JSXElement")return null;let o=n.openingElement?.name;if(o?.type!=="JSXIdentifier")return null;let i=I(o);return!i||typeof o.name!="string"?null:{expression:r.slice(i.start,i.end),span:i,localName:o.name,import:e.byLocalName.get(o.name)}}function Jn(t,e,r){let n=Fe(t,e),o=Ke(n?.value),i=I(o);if(!(!o||!i))return{expression:r.slice(i.start,i.end),span:i,attributeSpan:I(n)}}function gl(t){return/^[A-Za-z_$][\w$]*$/.test(t)}function hl(t,e){let r=Zn(e),n=Fe(t,"layout"),o=Ke(n?.value);return o?{...Yn(o,e),attributeSpan:I(n)}:{value:r?zn:nt,attributeSpan:I(n),errors:[{message:`<${e}> must include a literal "layout" object prop`,span:I(t),kind:"degraded"}]}}function Yn(t,e){let r=[],n=Zn(e);if(t.type!=="ObjectExpression")return{value:n?zn:nt,spans:{layoutClose:$r(t)},errors:[{message:`<${e}> layout must be an object literal`,span:I(t),kind:"degraded"}]};let o={layoutClose:$r(t)},i={...nt},s=Le(t,"width"),c=Le(t,"height"),a=Le(t,"intrinsicSizing"),u=a?.value?.value==="root-element",f=n||!!(s&&c)&&!u;!n&&!!s!=!!c&&r.push({message:"layout.width and layout.height must be set together",span:I(t),kind:"degraded"});let g=f?{width:s?rt(s.value):null,height:c?rt(c.value):null}:null,h=f?["x","y","width","height"]:["x","y"];for(let w of h){let C=w==="width"?s:w==="height"?c:Le(t,w),x=w==="width"||w==="height"?g?.[w]:C?rt(C.value):null,T=w==="x"||w==="y"||n||!!(g?.width&&g.height);if(!x){r.push({message:`<${e}> layout.${w} must be a number literal`,span:I(C??t),kind:"degraded"});continue}T&&(i[w]=x.value,o[w]=x.span)}let y=Le(t,"zIndex");if(y){let w=rt(y.value);w?(i.zIndex=w.value,o.zIndex=w.span):r.push({message:`<${e}> layout.zIndex must be a number literal`,span:I(y),kind:"degraded"})}return a&&(a.value?.type!=="Literal"||!u)&&r.push({message:`<${e}> layout.intrinsicSizing must be "root-element" when set`,span:I(a),kind:"degraded"}),{value:i,spans:o,errors:r}}function Qn(t){return t?.type==="Literal"&&typeof t.value=="string"?{value:t.value,span:I(t)??{start:0,end:0}}:null}function wt(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function Or(t,e,r){let n=$e(t,e);if(n)return n;let o=Fe(t,e),i=Ke(o?.value),s=I(i),c=I(o);if(!i||!s||!c)return null;let a=yl(i,r);return a?{value:a.value,valueSpan:s,attributeSpan:c}:null}function yl(t,e){if(t?.type!=="MemberExpression"||t.object?.type!=="Identifier")return null;let r=er(t.property);return r?e.get(t.object.name)?.get(r)??null:null}function $e(t,e){let r=Fe(t,e);if(!r)return null;let n=r.value;if(n?.type==="Literal"&&typeof n.value=="string")return{value:n.value,valueSpan:I(n)??I(r)??{start:0,end:0},attributeSpan:I(r)??{start:0,end:0}};let o=wt(Ke(n)),i=o?.type==="Literal"&&typeof o.value=="string"?o.value:o?.type==="TemplateLiteral"&&(o.expressions?.length??0)===0&&o.quasis?.length===1&&typeof o.quasis[0]?.value?.cooked=="string"?o.quasis[0].value.cooked:null;return i!==null?{value:i,valueSpan:I(o)??I(r)??{start:0,end:0},attributeSpan:I(r)??{start:0,end:0}}:null}function Fe(t,e){for(let r of t?.attributes??[])if(r?.type==="JSXAttribute"&&r.name?.type==="JSXIdentifier"&&r.name.name===e)return r;return null}function Ke(t){return t?t.type==="JSXExpressionContainer"?t.expression:t:null}function er(t){return t?.type==="Identifier"?t.name:t?.type==="Literal"&&typeof t.value=="string"?t.value:null}function Le(t,e){if(t?.type!=="ObjectExpression")return null;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;if(er(r.key)===e)return r}return null}function rt(t){return t?.type==="Literal"&&typeof t.value=="number"&&Number.isFinite(t.value)?{value:t.value,span:I(t)??{start:0,end:0}}:t?.type==="UnaryExpression"&&t.operator==="-"&&t.argument?.type==="Literal"&&typeof t.argument.value=="number"&&Number.isFinite(t.argument.value)?{value:-t.argument.value,span:I(t)??{start:0,end:0}}:null}function Fr(t,e){return t?.type==="JSXIdentifier"?e.sdkLocalNames.get(t.name)??null:t?.type==="JSXMemberExpression"&&t.object?.type==="JSXIdentifier"&&t.property?.type==="JSXIdentifier"&&e.sdkNamespaces.has(t.object.name)&&Zt.has(t.property.name)?t.property.name:null}function Sl(t,e,r){if(t?.type!=="JSXMemberExpression"||t.object?.type!=="JSXIdentifier"||t.property?.type!=="JSXIdentifier"||!Zt.has(t.property.name))return null;let n=e.byLocalName.get(t.object.name);return n?.kind!=="namespace"||!to(n.source)?null:r.namespaceCandidatesByLocalName.get(t.object.name)??null}function Dr(t){return t!==null&&t!=="Canvas"}function vl(t){return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`}function Zn(t){return t==="RouteStoryboard"||t==="HtmlStoryboard"||t==="FlutterStoryboard"}function Qt(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"*":t.imported?.name??t.local?.name??"unknown"}function bl(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"namespace":"named"}function eo(t){for(let e of Wa)if(t===e||t.endsWith(`/${e}`))return!0;return!1}function to(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!eo(t)}function El(t){return`${t.start}:${t.end}`}function $r(t){return typeof t?.end=="number"&&Number.isFinite(t.end)?t.end-1:void 0}function Gn(t){let r=t.replace(/\\/g,"/").split("/").filter(Boolean),n=r.length>0?r[r.length-1]:t,o=r.length>1?r[r.length-2]:n;return(/^index\.canvas\.[tj]sx?$/.test(n)?o:n.replace(/\.canvas\.[tj]sx?$/,"")).split(/[-_\s]+/).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function I(t){return typeof t?.start=="number"&&Number.isFinite(t.start)&&typeof t?.end=="number"&&Number.isFinite(t.end)?{start:t.start,end:t.end}:void 0}function Lr(t,e,r=new Set){if(!(!t||typeof t!="object"||r.has(t))){r.add(t),e(t);for(let n of Object.values(t))if(n)if(Array.isArray(n))for(let o of n)Lr(o,e,r);else typeof n=="object"&&Lr(n,e,r)}}var Xn,Wa,Zt,Ja,Ga,nt,zn,Xa,sl,cl,ul,tr=M(()=>{qt();Xn=require("oxc-parser");Nr();Nr();l(Kn,"componentFrameworkForStoryboard");Wa=new Set(["tempo-sdk/canvas",...Yt.map(t=>Et[t].importSource)]),Zt=new Set(["Canvas",...Yt]),Ja=`<Canvas> children must be ${vl(Yt.map(t=>`<${t}>`))} declarations`,Ga=new Set(["Canvas","CanvasContext","getCanvasStoryboardRenderId","CanvasHost","buildRenderContentFiberSelector","buildRenderContentSelector","buildRenderSelector","captureStoryboardCombined","captureStoryboardHtml","captureStoryboardImage","stripRenderContentWrapperAttributes","stripRenderContentWrapperFromCombinedCapture","watchStoryboardCombined","getCanvasHostRuntime","getOptionalCanvasHostRuntime","useActiveState","FlutterStoryboard","HtmlStoryboard","LegacyStoryboardV1","RouteStoryboard","Storyboard","StoryboardSlot"]),nt={x:0,y:0},zn={...nt,width:600,height:400},Xa="No <Canvas> declaration found in canvas file";l(ot,"parseCanvasFile");l(Ka,"misimportedSdkCanvasImportMessage");l(za,"readMisimportedSdkCanvasImports");l(qa,"readImports");l(Ya,"readObjectExpressionBindings");l(Qa,"readTopLevelVariableDeclarators");l(Za,"readLegacyStoryboardObject");l(el,"readObjectStringProperties");l(tl,"readStoryboard");l(rl,"readDirectCanvasStoryboardElements");l(nl,"reportDuplicateStoryboardIds");l(ol,"validateCanvasChildren");sl=/(^|\/)tempo-sdk\/canvas(\/[^/]+)?$/;l(il,"resolveNewerSdkStoryboardComponent");l(al,"newerSdkStoryboardError");l(ll,"readResponsive");cl=3840,ul=12e3;l(pl,"responsiveBoxFits");l(qn,"readVrt");l(dl,"readVrtIgnoreRegions");l(fl,"readComponentReference");l(ml,"readRenderComponentReference");l(Jn,"readExpressionReference");l(gl,"isIdentifierExpression");l(hl,"readLayout");l(Yn,"readLayoutExpression");l(Qn,"readStringLiteralValue");l(wt,"unwrapTsExpression");l(Or,"readResolvableStringAttribute");l(yl,"resolveStringMemberExpression");l($e,"readStringAttribute");l(Fe,"getAttribute");l(Ke,"unwrapAttributeExpression");l(er,"readPropertyKeyName");l(Le,"getObjectProperty");l(rt,"readNumberLiteral");l(Fr,"resolveSdkComponent");l(Sl,"resolveMisimportedNamespaceSdkComponent");l(Dr,"isStoryboardSdkComponent");l(vl,"formatAlternatives");l(Zn,"requiresFixedLayoutSize");l(Qt,"readImportedName");l(bl,"readImportKind");l(eo,"isSdkImportSource");l(to,"isWrongTempoSdkCanvasImportSource");l(El,"spanKey");l($r,"readLayoutClose");l(Gn,"fallbackPageName");l(I,"toSpan");l(Lr,"walk")});function ro(t,e){return`/__tempo/astro/${encodeURIComponent(t)}/${encodeURIComponent(e)}`}var no=M(()=>{"use strict";l(ro,"astroStoryboardPath")});function Hr(t){if(!t)return{};let e=(0,oo.parseSync)("props.ts",`(${t})`);if(e.errors.length)throw new Error("Astro storyboard props must be a JSON object literal");let r=l(i=>{if(i?.type==="ParenthesizedExpression")return r(i.expression);if(i?.type==="Literal"&&(i.value===null||["string","boolean"].includes(typeof i.value)||typeof i.value=="number"&&Number.isFinite(i.value)))return i.value;if(i?.type==="UnaryExpression"&&["-","+"].includes(i.operator)&&i.argument?.type==="Literal"&&typeof i.argument.value=="number"&&Number.isFinite(i.argument.value))return i.operator==="-"?-i.argument.value:i.argument.value;if(i?.type==="ArrayExpression")return i.elements.map(r);if(i?.type==="ObjectExpression"){let s=Object.create(null);for(let c of i.properties){if(c.type!=="Property"||c.computed||c.method||c.shorthand||c.kind!=="init")throw new Error("Astro storyboard props cannot contain expressions, spreads or getters");let a=c.key.type==="Identifier"?c.key.name:c.key.value;if(typeof a!="string"&&typeof a!="number")throw new Error("Astro storyboard props require literal keys");s[a]=r(c.value)}return s}throw new Error("Astro storyboard props must be static JSON; use an authored .astro fixture for server data or slots")},"read"),n=e.program.body[0],o=r(n?.type==="ExpressionStatement"?n.expression:void 0);if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Astro storyboard props must be a JSON object literal");return o}var oo,so=M(()=>{oo=require("oxc-parser");l(Hr,"readAstroStoryboardProps")});function co(t){return(0,te.existsSync)(t)?(0,te.readdirSync)(t,{withFileTypes:!0}).flatMap(e=>{if(e.isSymbolicLink())return[];let r=(0,se.join)(t,e.name);return e.isDirectory()?co(r):e.name.endsWith(".canvas.tsx")?[r]:[]}):[]}function io(t,e,r,n=[]){let o=[];for(let s of new Set((Array.isArray(e)?e:[e]).flatMap(co))){let c=(0,te.openSync)(s,"r"),a,u;try{let d=(0,te.fstatSync)(c);a=(0,te.readFileSync)(c,"utf8");let g=(0,te.fstatSync)(c);if(!["mtimeMs","ctimeMs","size","ino","dev"].every(h=>d[h]===g[h]))throw new Error(`Canvas changed while reading: ${s}`);u=Math.trunc(d.mtimeMs)}finally{(0,te.closeSync)(c)}let p=ot(s,a),f=p.canvasPath??(0,se.relative)(t,(0,se.dirname)(s)).replaceAll("\\","/");for(let d of p.storyboards){if(Kn(d)!=="astro")continue;let g=ro(f,d.storyboardKey),h=(0,se.join)(r,`${(0,jr.createHash)("sha256").update(g).digest("hex")}.astro`),y=(0,jr.createHash)("sha256").update(a).digest("hex"),v;try{if(p.errors.some(S=>S.kind==="structural")||d.errors.length)throw new Error("Fix the Astro storyboard's canvas declaration before rendering it");let w=d.component?.import;if(!w||w.kind!=="default"||!w.source.endsWith(".astro?tempo-component"))throw new Error("AstroStoryboard requires a default .astro?tempo-component import; use an authored .astro fixture for slots and server data");let C=w.source.slice(0,-16),x=C.startsWith(".")?(0,se.resolve)((0,se.dirname)(s),C).replaceAll("\\","/"):C,T=JSON.stringify(Hr(d.props?.expression)).replaceAll("<","\\u003c"),$=JSON.stringify({filepath:(0,se.relative)(t,s).replaceAll("\\","/"),sourceVersion:Ce(a),modifiedTs:u,position:d.jsxElementSpan.start,name:d.component?.localName??"Component"}),k=JSON.stringify({canvasPath:f,storyboardId:d.storyboardKey,revision:y}),B=/\/\.tempo\/(library-canvases|asset-edit-previews)\//.exec(s.replaceAll("\\","/"))?.[1],O;if(B==="asset-edit-previews"){for(let S of(0,lo.parseSync)(s,a).program.body)if(!(S.type!=="ExportNamedDeclaration"||S.declaration?.type!=="VariableDeclaration"))for(let X of S.declaration.declarations)X.id.type==="Identifier"&&X.id.name==="__tempoAstroAssetPreview"&&X.init&&(O=Hr(a.slice(X.init.start,X.init.end)))}let L=B?{imports:`import ComponentMetadata from ${JSON.stringify(x+"?tempo-component")};
19
19
  `,frontmatter:`const controls = JSON.stringify(ComponentMetadata.__tempoAstroControls ?? {});
20
20
  `,element:"<pre hidden data-asset-definition={controls}>Component controls</pre>"}:{imports:"",frontmatter:"",element:""};if(v=`---
21
- import Component from ${JSON.stringify(A)};
22
- ${$.imports}${n.map(S=>`import ${JSON.stringify(S.replaceAll("\\","/"))};`).join(`
21
+ import Component from ${JSON.stringify(x)};
22
+ ${L.imports}${n.map(S=>`import ${JSON.stringify(S.replaceAll("\\","/"))};`).join(`
23
23
  `)}
24
24
  const props = ${T};
25
- ${$.frontmatter}---
26
- <!doctype html><html><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="tempo-project-root" content={${JSON.stringify(t)}} /><meta name="tempo-astro-storyboard" content={${JSON.stringify(M)}} /></head><body style="margin:0"><Component {...props} __tempo_astro_callsite__={${O}} />${$.element}</body></html>`,L){let S=(0,so.fileURLToPath)(new URL(Re("astro/storyboards.ts").endsWith(".ts")?"./asset-preview-client.ts":"./asset-preview-client.js",Re("astro/storyboards.ts")));v=v.replace(`const props = ${T};`,`const preview = ${JSON.stringify(L).replaceAll("<","\\u003c")};
25
+ ${L.frontmatter}---
26
+ <!doctype html><html><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="tempo-project-root" content={${JSON.stringify(t)}} /><meta name="tempo-astro-storyboard" content={${JSON.stringify(k)}} /></head><body style="margin:0"><Component {...props} __tempo_astro_callsite__={${$}} />${L.element}</body></html>`,O){let S=(0,ao.fileURLToPath)(new URL(Re("astro/storyboards.ts").endsWith(".ts")?"./asset-preview-client.ts":"./asset-preview-client.js",Re("astro/storyboards.ts")));v=v.replace(`const props = ${T};`,`const preview = ${JSON.stringify(O).replaceAll("<","\\u003c")};
27
27
  const raw = Astro.url.searchParams.get("__tempo_asset_update");
28
28
  if (raw && raw.length > 64000) throw new Error("Astro preview props are too large");
29
29
  const update = raw ? JSON.parse(raw) : {variant:null,edits:{}};
@@ -32,9 +32,9 @@ const variant = update.variant !== null && Object.hasOwn(preview.asset.variants,
32
32
  if (update.variant !== null && (!variant || variant.error)) throw new Error(variant?.error ?? "The Astro asset variant no longer exists");
33
33
  const props = {...variant?.props};
34
34
  for (const [key,value] of Object.entries(update.edits)) { if(value && typeof value === "object" && Object.keys(value).length===1 && value.__tempo_omit_prop__===true) delete props[key]; else Object.defineProperty(props,key,{value,enumerable:true,configurable:true}); }
35
- const assetMetadata = JSON.stringify({sessionId:preview.sessionId,metadata:{asset:preview.asset,...ComponentMetadata.__tempoAstroControls}});`).replace("</head>",'<meta name="tempo-astro-asset-preview" content={assetMetadata} /></head>').replace(`<Component {...props} __tempo_astro_callsite__={${O}} />`,`{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${O}} />}`).replace("</body>",`<script>import {startAstroAssetPreview} from ${JSON.stringify(S)}; startAstroAssetPreview();</script></body>`)}}catch(w){v=`---
35
+ const assetMetadata = JSON.stringify({sessionId:preview.sessionId,metadata:{asset:preview.asset,...ComponentMetadata.__tempoAstroControls}});`).replace("</head>",'<meta name="tempo-astro-asset-preview" content={assetMetadata} /></head>').replace(`<Component {...props} __tempo_astro_callsite__={${$}} />`,`{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${$}} />}`).replace("</body>",`<script>import {startAstroAssetPreview} from ${JSON.stringify(S)}; startAstroAssetPreview();</script></body>`)}}catch(w){v=`---
36
36
  throw new Error(${JSON.stringify(w instanceof Error?w.message:String(w))});
37
- ---`}v=v.replace("</body>",`${yl}</body>`),o.push({path:g,file:h,source:v,revision:y})}}let i=new Set;for(let s of o){if(i.has(s.path))throw new Error(`Duplicate Astro storyboard address: ${s.path}`);i.add(s.path)}return o}function Zt(t,e){let r=(0,ee.existsSync)(t);if(!(r&&(0,ee.readFileSync)(t,"utf8")===e))return(0,ee.mkdirSync)((0,oe.dirname)(t),{recursive:!0}),(0,ee.writeFileSync)(t,e),r?"updated":"created"}function Sl(t){return String.raw`---
37
+ ---`}v=v.replace("</body>",`${wl}</body>`),o.push({path:g,file:h,source:v,revision:y})}}let i=new Set;for(let s of o){if(i.has(s.path))throw new Error(`Duplicate Astro storyboard address: ${s.path}`);i.add(s.path)}return o}function rr(t,e){let r=(0,te.existsSync)(t);if(!(r&&(0,te.readFileSync)(t,"utf8")===e))return(0,te.mkdirSync)((0,se.dirname)(t),{recursive:!0}),(0,te.writeFileSync)(t,e),r?"updated":"created"}function Cl(t){return String.raw`---
38
38
  import { readFileSync } from "node:fs";
39
39
  import { createComponent } from "astro/runtime/server/index.js";
40
40
  const base = import.meta.env.BASE_URL.replace(/\/$/, "");
@@ -62,7 +62,7 @@ const Preview = createComponent((result, props, slots) => {
62
62
  return Page(result, props, slots);
63
63
  });
64
64
  ---
65
- <Preview />`}function lo(t,e,r,n=[]){let o=Array.isArray(e)?e:[e],i=oo(t,o,r,n),s=i,c=(0,oe.join)(r,"routes.json"),a=(0,oe.join)(r,"storyboards.astro"),u=l(h=>JSON.stringify(h.map(({path:y,file:v})=>({path:y,file:v.replaceAll("\\","/")}))),"shape"),p=new Set,f=l(h=>{let y=Zt(h.file,h.source),v=h.file.replaceAll("\\","/");return y==="created"?p.add(v):y==="updated"&&p.delete(v),y},"writeDocument");for(let h of i)f(h);Zt(c,u(i)),Zt(a,Sl(c));let d;return{routes:i,registryFile:c,entrypoint:a,plugin:{name:"tempo:astro-storyboards",hotUpdate:{order:"pre",async handler({type:h,file:y,modules:v,read:w}){if(this.environment.name==="client"&&y.endsWith(".canvas.tsx")&&(h!=="delete"&&await w(),d?.(y)),h==="create"&&p.has(y))return v.filter(x=>x.file!==y)}},configureServer(h){d=l(x=>{if(!(!x.endsWith(".canvas.tsx")||!o.some(A=>{let T=(0,oe.relative)(A,x);return!(0,oe.isAbsolute)(T)&&!T.startsWith("../")})))try{let A=oo(t,o,r,n),T=A.filter(M=>f(M)==="updated").map(M=>M.file),O=new Set(A.map(M=>M.file.replaceAll("\\","/")));for(let M of p)O.has(M)||p.delete(M);s=A,Zt(c,u(A));for(let M of T)h.watcher.emit("change",M)}catch(A){h.config.logger.error(String(A))}},"changed"),h.watcher.add(o);let v=l((x,A)=>{if(typeof x?.path!="string"||typeof x.revision!="string")return;let T=h.config.base.replace(/\/$/,""),O=T&&x.path.startsWith(`${T}/`)?x.path.slice(T.length):x.path,M=s.find(B=>B.path===O);M&&A.send({type:"custom",event:"tempo:astro:revision",data:{path:x.path,revision:M.revision}})},"verifyRevision");h.ws.on("tempo:astro:revision-request",v);let w=l(()=>{h.ws.off("tempo:astro:revision-request",v)},"dispose");h.httpServer?.once("close",w)}}}}var Dr,ee,oe,so,io,yl,co=P(()=>{Gt();Dr=require("node:crypto"),ee=require("node:fs");Ge();oe=require("node:path"),so=require("node:url");Qt();to();no();io=require("oxc-parser"),yl=`<script>
65
+ <Preview />`}function uo(t,e,r,n=[]){let o=Array.isArray(e)?e:[e],i=io(t,o,r,n),s=i,c=(0,se.join)(r,"routes.json"),a=(0,se.join)(r,"storyboards.astro"),u=l(h=>JSON.stringify(h.map(({path:y,file:v})=>({path:y,file:v.replaceAll("\\","/")}))),"shape"),p=new Set,f=l(h=>{let y=rr(h.file,h.source),v=h.file.replaceAll("\\","/");return y==="created"?p.add(v):y==="updated"&&p.delete(v),y},"writeDocument");for(let h of i)f(h);rr(c,u(i)),rr(a,Cl(c));let d;return{routes:i,registryFile:c,entrypoint:a,plugin:{name:"tempo:astro-storyboards",hotUpdate:{order:"pre",async handler({type:h,file:y,modules:v,read:w}){if(this.environment.name==="client"&&y.endsWith(".canvas.tsx")&&(h!=="delete"&&await w(),d?.(y)),h==="create"&&p.has(y))return v.filter(C=>C.file!==y)}},configureServer(h){d=l(C=>{if(!(!C.endsWith(".canvas.tsx")||!o.some(x=>{let T=(0,se.relative)(x,C);return!(0,se.isAbsolute)(T)&&!T.startsWith("../")})))try{let x=io(t,o,r,n),T=x.filter(k=>f(k)==="updated").map(k=>k.file),$=new Set(x.map(k=>k.file.replaceAll("\\","/")));for(let k of p)$.has(k)||p.delete(k);s=x,rr(c,u(x));for(let k of T)h.watcher.emit("change",k)}catch(x){h.config.logger.error(String(x))}},"changed"),h.watcher.add(o);let v=l((C,x)=>{if(typeof C?.path!="string"||typeof C.revision!="string")return;let T=h.config.base.replace(/\/$/,""),$=T&&C.path.startsWith(`${T}/`)?C.path.slice(T.length):C.path,k=s.find(B=>B.path===$);k&&x.send({type:"custom",event:"tempo:astro:revision",data:{path:C.path,revision:k.revision}})},"verifyRevision");h.ws.on("tempo:astro:revision-request",v);let w=l(()=>{h.ws.off("tempo:astro:revision-request",v)},"dispose");h.httpServer?.once("close",w)}}}}var jr,te,se,ao,lo,wl,po=M(()=>{zt();jr=require("node:crypto"),te=require("node:fs");Xe();se=require("node:path"),ao=require("node:url");tr();no();so();lo=require("oxc-parser"),wl=`<script>
66
66
  const hot = import.meta.hot;
67
67
  if (hot) {
68
68
  const receipt = () => JSON.parse(document.querySelector('meta[name="tempo-astro-storyboard"]')?.getAttribute('content') ?? 'null');
@@ -78,15 +78,15 @@ if (hot) {
78
78
  hot.off('vite:ws:connect', check);
79
79
  });
80
80
  }
81
- </script>`;l(ao,"filesUnder");l(oo,"collectAstroStoryboards");l(Zt,"writeChanged");l(Sl,"storyboardEntrypoint");l(lo,"createAstroStoryboardRegistry")});function uo(t,e){return{name:"tempo:astro-tailwind-sources",enforce:"pre",transform:{order:"pre",handler(r,n){let o=n.split("?")[0];if(!o.endsWith(".css")||o.replaceAll("\\","/").includes("/node_modules/"))return;let i=(0,er.relative)(t,o);if(!(i.startsWith("..")||(0,er.isAbsolute)(i))&&/@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[\w.-]+)?["']/.test(r))return{code:`${r}
81
+ </script>`;l(co,"filesUnder");l(io,"collectAstroStoryboards");l(rr,"writeChanged");l(Cl,"storyboardEntrypoint");l(uo,"createAstroStoryboardRegistry")});function fo(t,e){return{name:"tempo:astro-tailwind-sources",enforce:"pre",transform:{order:"pre",handler(r,n){let o=n.split("?")[0];if(!o.endsWith(".css")||o.replaceAll("\\","/").includes("/node_modules/"))return;let i=(0,nr.relative)(t,o);if(!(i.startsWith("..")||(0,nr.isAbsolute)(i))&&/@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[\w.-]+)?["']/.test(r))return{code:`${r}
82
82
  ${e.map(s=>`@source ${JSON.stringify(s.replaceAll("\\","/"))};`).join(`
83
83
  `)}
84
- `,map:null}}}}}var er,po=P(()=>{er=require("node:path");l(uo,"astroTailwindSources")});async function mo(t=process.env.TEMPO_SDK_RUNTIME_PATH){if(!t||!(0,je.isAbsolute)(t))throw new Error("Tempo browser runtime is not provisioned. Set TEMPO_SDK_RUNTIME_PATH to the host's private runtime directory.");let e=JSON.parse(await(0,ot.readFile)((0,je.resolve)(t,"runtime.json"),"utf8")),r=e.browser;if(e.tempoRuntimeContract!==1||typeof r?.file!="string"||typeof r?.sha256!="string")throw new Error("Incompatible Tempo browser runtime. Update the host application.");let n=await(0,ot.realpath)(t),o=await(0,ot.realpath)((0,je.resolve)(n,r.file)),i=(0,je.relative)(n,o);if((0,je.isAbsolute)(i)||i===".."||i.startsWith("../")||i.startsWith("..\\"))throw new Error("Tempo browser runtime path escapes its directory.");let s=await(0,ot.readFile)(o,"utf8");if((0,fo.createHash)("sha256").update(s).digest("hex")!==r.sha256)throw new Error("Tempo browser runtime artifact failed its integrity check.");return s}var fo,ot,je,go=P(()=>{fo=require("node:crypto"),ot=require("node:fs/promises"),je=require("node:path");l(mo,"readBrowserRuntimeScript")});function tr(t){return`${t.replace(/\/$/,"")}${vl}`}function ho(t){let e=tr(t),r;return async(n,o,i)=>{if(n.url?.split(/[?#]/)[0]!==e)return i();if(o.setHeader("Cache-Control","no-store"),o.setHeader("X-Content-Type-Options","nosniff"),n.method!=="GET"&&n.method!=="HEAD"){o.statusCode=405,o.setHeader("Allow","GET, HEAD"),o.end();return}try{r||(r=await Hr()),o.setHeader("Content-Type","application/javascript; charset=utf-8"),o.end(n.method==="HEAD"?void 0:r)}catch(c){o.statusCode=503,o.setHeader("Content-Type","text/plain; charset=utf-8"),o.end(n.method==="HEAD"?void 0:`Tempo browser runtime unavailable: ${c instanceof Error?c.message:String(c)}`)}}}async function Hr(){return bl(await mo())}function bl(t){return`(() => { const provider = globalThis.__tempoSdkRuntime; if (provider) { if (provider.contract !== 1 || typeof provider.createBrowserRuntime !== "function" || typeof provider.createDocumentRuntime !== "function") throw new Error("Incompatible Tempo browser runtime. Update the host application."); return; }
84
+ `,map:null}}}}}var nr,mo=M(()=>{nr=require("node:path");l(fo,"astroTailwindSources")});async function ho(t=process.env.TEMPO_SDK_RUNTIME_PATH){if(!t||!(0,Ve.isAbsolute)(t))throw new Error("Tempo browser runtime is not provisioned. Set TEMPO_SDK_RUNTIME_PATH to the host's private runtime directory.");let e=JSON.parse(await(0,st.readFile)((0,Ve.resolve)(t,"runtime.json"),"utf8")),r=e.browser;if(e.tempoRuntimeContract!==1||typeof r?.file!="string"||typeof r?.sha256!="string")throw new Error("Incompatible Tempo browser runtime. Update the host application.");let n=await(0,st.realpath)(t),o=await(0,st.realpath)((0,Ve.resolve)(n,r.file)),i=(0,Ve.relative)(n,o);if((0,Ve.isAbsolute)(i)||i===".."||i.startsWith("../")||i.startsWith("..\\"))throw new Error("Tempo browser runtime path escapes its directory.");let s=await(0,st.readFile)(o,"utf8");if((0,go.createHash)("sha256").update(s).digest("hex")!==r.sha256)throw new Error("Tempo browser runtime artifact failed its integrity check.");return s}var go,st,Ve,yo=M(()=>{go=require("node:crypto"),st=require("node:fs/promises"),Ve=require("node:path");l(ho,"readBrowserRuntimeScript")});function or(t){return`${t.replace(/\/$/,"")}${xl}`}function So(t){let e=or(t),r;return async(n,o,i)=>{if(n.url?.split(/[?#]/)[0]!==e)return i();if(o.setHeader("Cache-Control","no-store"),o.setHeader("X-Content-Type-Options","nosniff"),n.method!=="GET"&&n.method!=="HEAD"){o.statusCode=405,o.setHeader("Allow","GET, HEAD"),o.end();return}try{r||(r=await Ur()),o.setHeader("Content-Type","application/javascript; charset=utf-8"),o.end(n.method==="HEAD"?void 0:r)}catch(c){o.statusCode=503,o.setHeader("Content-Type","text/plain; charset=utf-8"),o.end(n.method==="HEAD"?void 0:`Tempo browser runtime unavailable: ${c instanceof Error?c.message:String(c)}`)}}}async function Ur(){return Al(await ho())}function Al(t){return`(() => { const provider = globalThis.__tempoSdkRuntime; if (provider) { if (provider.contract !== 1 || typeof provider.createBrowserRuntime !== "function" || typeof provider.createDocumentRuntime !== "function") throw new Error("Incompatible Tempo browser runtime. Update the host application."); return; }
85
85
  ${t}
86
- })();`}function yo(t){return t.replace(/<\/script/gi,e=>e.replace("/","\\/"))}var vl,jr=P(()=>{go();vl="/@tempo/browser-runtime.js";l(tr,"browserRuntimeUrl");l(ho,"createBrowserRuntimeMiddleware");l(Hr,"readBrowserRuntimeInstallScript");l(bl,"browserRuntimeInstallScript");l(yo,"escapeBrowserRuntimeInlineScript")});var rr,nr,st,or,So,sr=P(()=>{"use strict";rr="/@tempo/server-errors",nr="\0tempo:server-errors",st="tempo:server-error-state",or="tempo:subscribe-server-errors",So="__tempoViteServerErrors"});var Ur,Vr=P(()=>{sr();Ur=`
86
+ })();`}function vo(t){return t.replace(/<\/script/gi,e=>e.replace("/","\\/"))}var xl,Vr=M(()=>{yo();xl="/@tempo/browser-runtime.js";l(or,"browserRuntimeUrl");l(So,"createBrowserRuntimeMiddleware");l(Ur,"readBrowserRuntimeInstallScript");l(Al,"browserRuntimeInstallScript");l(vo,"escapeBrowserRuntimeInlineScript")});var sr,ir,it,ar,bo,lr=M(()=>{"use strict";sr="/@tempo/server-errors",ir="\0tempo:server-errors",it="tempo:server-error-state",ar="tempo:subscribe-server-errors",bo="__tempoViteServerErrors"});var Br,Wr=M(()=>{lr();Br=`
87
87
  if (import.meta.hot) {
88
88
  const hot = import.meta.hot;
89
- const feed = globalThis.${So} ??= (() => {
89
+ const feed = globalThis.${bo} ??= (() => {
90
90
  const listeners = new Set();
91
91
  let hasState = false;
92
92
  let state;
@@ -104,23 +104,23 @@ if (import.meta.hot) {
104
104
  };
105
105
  })();
106
106
  const publish = (state) => feed.publish(state);
107
- const subscribe = () => hot.send(${JSON.stringify(or)});
108
- hot.on(${JSON.stringify(st)}, publish);
107
+ const subscribe = () => hot.send(${JSON.stringify(ar)});
108
+ hot.on(${JSON.stringify(it)}, publish);
109
109
  hot.on("vite:ws:connect", subscribe);
110
110
  subscribe();
111
111
  hot.dispose(() => {
112
- hot.off(${JSON.stringify(st)}, publish);
112
+ hot.off(${JSON.stringify(it)}, publish);
113
113
  hot.off("vite:ws:connect", subscribe);
114
114
  });
115
115
  }
116
- `});function vo(t){if(process.env.TEMPO_MONOREPO_SDK_SOURCE!=="local-prebuilt")return[];let e=(0,wt.resolve)(t??process.cwd(),"node_modules/tempo-sdk");return(0,Br.existsSync)((0,wt.join)(e,".tempo-prebuilt-source.json"))?["canvas","assets"].flatMap(r=>{let n=(0,wt.join)(e,"dist",r,"index.js");return(0,Br.existsSync)(n)?[{find:new RegExp(`^tempo-sdk/${r}$`),replacement:n}]:[]}):[]}var Br,wt,bo=P(()=>{Br=require("node:fs"),wt=require("node:path");l(vo,"localPrebuiltAliases")});function xo(t,e=process.env){let r=e.TEMPO_CANVAS_HOST_ROOT,n=e.TEMPO_CANVAS_SOURCE_ROOT;if(!r||!n||(0,Ue.resolve)(t.root??process.cwd())!==(0,Ue.resolve)(r))return;let o=[(0,Ue.relative)(r,n).replace(/\\/g,"/"),"**/index.canvas.tsx"].filter(Boolean).join("/"),i=t.optimizeDeps?.entries,s=(i===void 0?[]:typeof i=="string"?[i]:i).filter(c=>c.replace(/\\/g,"/").replace(/^\.\//,"")!==o);t.optimizeDeps??={},t.optimizeDeps.entries=[...new Set(["index.html",...s])];for(let c of["tempo-sdk/canvas","tempo-sdk/assets","tempo-sdk/canvas/interact-projection"])t.optimizeDeps.exclude?.some(a=>c===a||c.startsWith(`${a}/`))||(t.optimizeDeps.include=[...new Set([...t.optimizeDeps.include??[],c])])}function Co(t){if(t.optimizeDeps?.entries!==void 0||t.build?.rollupOptions?.input!==void 0)return;let e=(0,Ue.resolve)(t.root??process.cwd()),r=(0,Ue.join)(e,Eo,"tempo.config.json");(0,wo.existsSync)(r)&&(t.optimizeDeps??={},t.optimizeDeps.entries=["**/*.html","!**/__tests__/**","!**/coverage/**",`!${Eo}/**`])}var wo,Ue,Eo,Ao=P(()=>{wo=require("node:fs"),Ue=require("node:path");l(xo,"applyManagedCanvasDependencyScan");Eo="tempo";l(Co,"excludeTempoHostFromAppDependencyScan")});function Ve(t){return t.replace(/[?#].*$/,"")}function wl(t){return t.length>0&&t[0]===t[0].toLowerCase()}function ir(t,e){for(let r of t.element.openingElement.attributes)if(r.name?.name===e)return!0;return!1}function xl(t,e,r,n){return{"data-tempo-filepath":e,"data-tempo-position":t.element.openingElement.start,"data-tempo-source-tag":t.tagName,"data-tempo-modifiedts":r,"data-tempo-source-version":n}}function ar(t,e,r,n){let o=JSON.stringify({file:e,modifiedTs:r,sourceVersion:n});return`${t}
116
+ `});function Eo(t){if(process.env.TEMPO_MONOREPO_SDK_SOURCE!=="local-prebuilt")return[];let e=(0,Ct.resolve)(t??process.cwd(),"node_modules/tempo-sdk");return(0,Jr.existsSync)((0,Ct.join)(e,".tempo-prebuilt-source.json"))?["canvas","assets"].flatMap(r=>{let n=(0,Ct.join)(e,"dist",r,"index.js");return(0,Jr.existsSync)(n)?[{find:new RegExp(`^tempo-sdk/${r}$`),replacement:n}]:[]}):[]}var Jr,Ct,wo=M(()=>{Jr=require("node:fs"),Ct=require("node:path");l(Eo,"localPrebuiltAliases")});function Ao(t,e=process.env){let r=e.TEMPO_CANVAS_HOST_ROOT,n=e.TEMPO_CANVAS_SOURCE_ROOT;if(!r||!n||(0,Be.resolve)(t.root??process.cwd())!==(0,Be.resolve)(r))return;let o=[(0,Be.relative)(r,n).replace(/\\/g,"/"),"**/index.canvas.tsx"].filter(Boolean).join("/"),i=t.optimizeDeps?.entries,s=(i===void 0?[]:typeof i=="string"?[i]:i).filter(c=>c.replace(/\\/g,"/").replace(/^\.\//,"")!==o);t.optimizeDeps??={},t.optimizeDeps.entries=[...new Set(["index.html",...s])];for(let c of["tempo-sdk/canvas","tempo-sdk/assets","tempo-sdk/canvas/interact-projection"])t.optimizeDeps.exclude?.some(a=>c===a||c.startsWith(`${a}/`))||(t.optimizeDeps.include=[...new Set([...t.optimizeDeps.include??[],c])])}function _o(t){if(t.optimizeDeps?.entries!==void 0||t.build?.rollupOptions?.input!==void 0)return;let e=(0,Be.resolve)(t.root??process.cwd()),r=(0,Be.join)(e,Co,"tempo.config.json");(0,xo.existsSync)(r)&&(t.optimizeDeps??={},t.optimizeDeps.entries=["**/*.html","!**/__tests__/**","!**/coverage/**",`!${Co}/**`])}var xo,Be,Co,Ro=M(()=>{xo=require("node:fs"),Be=require("node:path");l(Ao,"applyManagedCanvasDependencyScan");Co="tempo";l(_o,"excludeTempoHostFromAppDependencyScan")});function We(t){return t.replace(/[?#].*$/,"")}function Rl(t){return t.length>0&&t[0]===t[0].toLowerCase()}function cr(t,e){for(let r of t.element.openingElement.attributes)if(r.name?.name===e)return!0;return!1}function Tl(t,e,r,n){return{"data-tempo-filepath":e,"data-tempo-position":t.element.openingElement.start,"data-tempo-source-tag":t.tagName,"data-tempo-modifiedts":r,"data-tempo-source-version":n}}function ur(t,e,r,n){let o=JSON.stringify({file:e,modifiedTs:r,sourceVersion:n});return`${t}
117
117
  ;typeof window !== "undefined" && (globalThis.__TEMPO_MODULE_VERSIONS__ || (globalThis.__TEMPO_MODULE_VERSIONS__ = [])).push(${o});
118
- `}function _o(t){let{info:e,filepath:r,modifiedtsMs:n,sourceVersion:o,computeAnnotatedProps:i,elementSupportOverrides:s}=t,c={...i?i(e,r,n,o):xl(e,r,n,o),...e.parentType!==void 0&&!ir(e,Cr)?{[Cr]:wn(e.element,e.parentType,e.isStaticJsxChild)}:{},...ir(e,Ar)?{}:{[Ar]:xn(e.element)}};if(wl(e.tagName))return{...c,"data-tempo-supports-children":ir(e,"data-tempo-supports-children")?void 0:!El.has(e.tagName)};let a=s?.get(e.tagName);return a?{...c,"data-tempo-supports-children":ir(e,"data-tempo-supports-children")?void 0:a.supportsChildren}:c}var El,it=P(()=>{Bt();Ge();El=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);l(Ve,"cleanModuleId");l(wl,"isIntrinsicElement");l(ir,"hasJsxAttribute");l(xl,"defaultComputeAnnotatedProps");l(ar,"appendModuleVersionRecord");l(_o,"computeTempoAnnotatedProps")});function Ro(t){let e=t.now??Date.now,r=t.watcherGraceMs??1e3,n=t.maxEmitsPerRevision??3,o=new Map,i=new Map;return{async sweep(){let s=[],c=0;for(let[a,u]of t.listServedFiles()){c>0&&c%100===0&&await Cl(),c+=1;let p=await t.statMtimeMs(a);if(p===null){i.delete(a);continue}let f=o.get(a);if(f===void 0){let v=t.lastHotUpdateMtimeMs?.(a);if(v===void 0||v>=p){o.set(a,p);continue}f=v,o.set(a,v)}if(p>f){if(e()-p<r)continue;o.set(a,p)}else p<f&&o.set(a,p);let d=i.get(a);if(p<=f&&d===void 0)continue;let g=t.lastHotUpdateMtimeMs?.(a),h;if(g!==void 0)h=g>=p;else{h=!1;for(let v of u)if((v.lastInvalidationTimestamp??0)>=p){h=!0;break}}if(h){i.delete(a);continue}let y=d!==void 0&&d.mtimeMs===p?d:{mtimeMs:p,emits:0};i.set(a,y),!(y.emits>=n)&&(y.emits+=1,t.emitChange(a),s.push(a))}return s}}}var Cl,To=P(()=>{Cl=l(()=>new Promise(t=>setImmediate(t)),"nextTurn");l(Ro,"createMissedChangeSweep")});function ko(t){let e=t?.quietMs??100,r=t?.schedule??setTimeout,n=t?.cancel??clearTimeout,o=new Map,i=l((s,c)=>{s.eventCount<2||(c?.gate&&c.release?(s.gate=c.gate,s.release=c.release,c.release=void 0,c.expiry&&n(c.expiry)):s.gate=new Promise(a=>{s.release=a}),s.expiry=r(()=>s.release?.(),e*2))},"armGate");return{observe(s,c){let a=o.get(s);a?.timer&&n(a.timer);let u={eventCount:(a?.eventCount??0)+1,replay:c};i(u,a),u.timer=r(()=>{if(o.get(s)!==u||(o.delete(s),u.expiry&&n(u.expiry),u.release?.(),u.eventCount<2))return;let p={eventCount:-1,replay:u.replay};p.timer=r(()=>{o.get(s)===p&&o.delete(s)},e),o.set(s,p),u.replay()},e),o.set(s,u)},settled(s){return o.get(s)?.gate??Promise.resolve()},clear(){for(let s of o.values())s.timer&&n(s.timer),s.expiry&&n(s.expiry),s.release?.();o.clear()}}}var Io=P(()=>{l(ko,"createRapidHotUpdateReplay")});function me(t){return Ve(t).replace(/^\/@fs\//,"/")}function xt(t){return me(t).replace(/\\/g,"/")}function Po(){let t=ko(),e=new Map,r=l(n=>{let o=me(n),i=xt(n);try{e.set(i,(0,Wr.statSync)(o).mtimeMs)}catch{e.delete(i)}},"recordCoverage");return{recordCoverage:r,lastHotUpdateMtimeMs(n){return e.get(xt(n))},observeUpdate(n,o){t.observe(xt(o),()=>{n.config.logger.info(`[tempo] replaying settled rapid watcher change: ${o}`,{timestamp:!0}),n.watcher.emit("change",o)})},settled(n){return t.settled(xt(n))},installCoverage(n){for(let o of["change","add","unlink"])n.watcher?.prependListener?.(o,r)},installSweep(n,o={}){let i=n.config.cacheDir?.replace(/\\/g,"/").replace(/\/+$/,""),s=Ro({listServedFiles:l(function*(){let u=new Map(n.moduleGraph?.fileToModulesMap??new Map);for(let f of o.listExtraFiles?.()??[]){let d=me(f),g=(0,Be.isAbsolute)(d)?d:(0,Be.resolve)(n.config.root,d);u.has(g)||u.set(g,[])}let p=Al(n);for(let f of u){let d=f[0];i&&d.replace(/\\/g,"/").startsWith(`${i}/`)||p&&_l(p,d)||(yield f)}},"listServedFiles"),statMtimeMs:l(async u=>{try{return(0,Wr.statSync)(u).mtimeMs}catch{return null}},"statMtimeMs"),emitChange:l(u=>{n.config?.logger?.info?.(`[tempo] re-emitting lost watcher change: ${u}`,{timestamp:!0}),n.watcher?.emit?.("change",u)},"emitChange"),lastHotUpdateMtimeMs:l(u=>e.get(xt(u)),"lastHotUpdateMtimeMs")}),c=!1,a=setInterval(()=>{c||(c=!0,s.sweep().then(()=>o.afterSweep?.()).catch(()=>{}).finally(()=>{c=!1}))},o.sweepIntervalMs??Ct);a.unref?.(),n.httpServer?.once("close",()=>clearInterval(a))},clear(){t.clear(),e.clear()}}}function Al(t){return t.watcher?.getWatched?.()}function _l(t,e){let r=t[(0,Be.dirname)(e)];return r!==void 0&&!r.includes((0,Be.basename)(e))}var Wr,Be,Ct,At=P(()=>{Wr=require("node:fs"),Be=require("node:path");it();To();Io();Ct=3e3;l(me,"fsPathFromModuleId");l(xt,"fileKey");l(Po,"createHotUpdateNet");l(Al,"watchedEntries");l(_l,"isUnwatched")});function Tl(t,e){return t.type===e.type&&t.message===e.message&&t.loc?.line===e.loc?.line&&t.loc?.column===e.loc?.column}function kl(t,e){let r=new Map;function n(){if(r.size===0)return null;let s=null;for(let c of r.values())s=c;return s}l(n,"getMostRecentError");function o(){e?.(i.currentError);let s=JSON.stringify(i.currentError);for(let c of i.clients)c.write(`data: ${s}
118
+ `}function To(t){let{info:e,filepath:r,modifiedtsMs:n,sourceVersion:o,computeAnnotatedProps:i,elementSupportOverrides:s}=t,c={...i?i(e,r,n,o):Tl(e,r,n,o),...e.parentType!==void 0&&!cr(e,_r)?{[_r]:xn(e.element,e.parentType,e.isStaticJsxChild)}:{},...cr(e,Rr)?{}:{[Rr]:An(e.element)}};if(Rl(e.tagName))return{...c,"data-tempo-supports-children":cr(e,"data-tempo-supports-children")?void 0:!_l.has(e.tagName)};let a=s?.get(e.tagName);return a?{...c,"data-tempo-supports-children":cr(e,"data-tempo-supports-children")?void 0:a.supportsChildren}:c}var _l,at=M(()=>{Gt();Xe();_l=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);l(We,"cleanModuleId");l(Rl,"isIntrinsicElement");l(cr,"hasJsxAttribute");l(Tl,"defaultComputeAnnotatedProps");l(ur,"appendModuleVersionRecord");l(To,"computeTempoAnnotatedProps")});function ko(t){let e=t.now??Date.now,r=t.watcherGraceMs??1e3,n=t.maxEmitsPerRevision??3,o=new Map,i=new Map;return{async sweep(){let s=[],c=0;for(let[a,u]of t.listServedFiles()){c>0&&c%100===0&&await kl(),c+=1;let p=await t.statMtimeMs(a);if(p===null){i.delete(a);continue}let f=o.get(a);if(f===void 0){let v=t.lastHotUpdateMtimeMs?.(a);if(v===void 0||v>=p){o.set(a,p);continue}f=v,o.set(a,v)}if(p>f){if(e()-p<r)continue;o.set(a,p)}else p<f&&o.set(a,p);let d=i.get(a);if(p<=f&&d===void 0)continue;let g=t.lastHotUpdateMtimeMs?.(a),h;if(g!==void 0)h=g>=p;else{h=!1;for(let v of u)if((v.lastInvalidationTimestamp??0)>=p){h=!0;break}}if(h){i.delete(a);continue}let y=d!==void 0&&d.mtimeMs===p?d:{mtimeMs:p,emits:0};i.set(a,y),!(y.emits>=n)&&(y.emits+=1,t.emitChange(a),s.push(a))}return s}}}var kl,Io=M(()=>{kl=l(()=>new Promise(t=>setImmediate(t)),"nextTurn");l(ko,"createMissedChangeSweep")});function Po(t){let e=t?.quietMs??100,r=t?.schedule??setTimeout,n=t?.cancel??clearTimeout,o=new Map,i=l((s,c)=>{s.eventCount<2||(c?.gate&&c.release?(s.gate=c.gate,s.release=c.release,c.release=void 0,c.expiry&&n(c.expiry)):s.gate=new Promise(a=>{s.release=a}),s.expiry=r(()=>s.release?.(),e*2))},"armGate");return{observe(s,c){let a=o.get(s);a?.timer&&n(a.timer);let u={eventCount:(a?.eventCount??0)+1,replay:c};i(u,a),u.timer=r(()=>{if(o.get(s)!==u||(o.delete(s),u.expiry&&n(u.expiry),u.release?.(),u.eventCount<2))return;let p={eventCount:-1,replay:u.replay};p.timer=r(()=>{o.get(s)===p&&o.delete(s)},e),o.set(s,p),u.replay()},e),o.set(s,u)},settled(s){return o.get(s)?.gate??Promise.resolve()},clear(){for(let s of o.values())s.timer&&n(s.timer),s.expiry&&n(s.expiry),s.release?.();o.clear()}}}var Mo=M(()=>{l(Po,"createRapidHotUpdateReplay")});function he(t){return We(t).replace(/^\/@fs\//,"/")}function xt(t){return he(t).replace(/\\/g,"/")}function No(){let t=Po(),e=new Map,r=l(n=>{let o=he(n),i=xt(n);try{e.set(i,(0,Gr.statSync)(o).mtimeMs)}catch{e.delete(i)}},"recordCoverage");return{recordCoverage:r,lastHotUpdateMtimeMs(n){return e.get(xt(n))},observeUpdate(n,o){t.observe(xt(o),()=>{n.config.logger.info(`[tempo] replaying settled rapid watcher change: ${o}`,{timestamp:!0}),n.watcher.emit("change",o)})},settled(n){return t.settled(xt(n))},installCoverage(n){for(let o of["change","add","unlink"])n.watcher?.prependListener?.(o,r)},installSweep(n,o={}){let i=n.config.cacheDir?.replace(/\\/g,"/").replace(/\/+$/,""),s=ko({listServedFiles:l(function*(){let u=new Map(n.moduleGraph?.fileToModulesMap??new Map);for(let f of o.listExtraFiles?.()??[]){let d=he(f),g=(0,Je.isAbsolute)(d)?d:(0,Je.resolve)(n.config.root,d);u.has(g)||u.set(g,[])}let p=Il(n);for(let f of u){let d=f[0];i&&d.replace(/\\/g,"/").startsWith(`${i}/`)||p&&Pl(p,d)||(yield f)}},"listServedFiles"),statMtimeMs:l(async u=>{try{return(0,Gr.statSync)(u).mtimeMs}catch{return null}},"statMtimeMs"),emitChange:l(u=>{n.config?.logger?.info?.(`[tempo] re-emitting lost watcher change: ${u}`,{timestamp:!0}),n.watcher?.emit?.("change",u)},"emitChange"),lastHotUpdateMtimeMs:l(u=>e.get(xt(u)),"lastHotUpdateMtimeMs")}),c=!1,a=setInterval(()=>{c||(c=!0,s.sweep().then(()=>o.afterSweep?.()).catch(()=>{}).finally(()=>{c=!1}))},o.sweepIntervalMs??At);a.unref?.(),n.httpServer?.once("close",()=>clearInterval(a))},clear(){t.clear(),e.clear()}}}function Il(t){return t.watcher?.getWatched?.()}function Pl(t,e){let r=t[(0,Je.dirname)(e)];return r!==void 0&&!r.includes((0,Je.basename)(e))}var Gr,Je,At,_t=M(()=>{Gr=require("node:fs"),Je=require("node:path");at();Io();Mo();At=3e3;l(he,"fsPathFromModuleId");l(xt,"fileKey");l(No,"createHotUpdateNet");l(Il,"watchedEntries");l(Pl,"isUnwatched")});function Nl(t,e){return t.type===e.type&&t.message===e.message&&t.loc?.line===e.loc?.line&&t.loc?.column===e.loc?.column}function Ol(t,e){let r=new Map;function n(){if(r.size===0)return null;let s=null;for(let c of r.values())s=c;return s}l(n,"getMostRecentError");function o(){e?.(i.currentError);let s=JSON.stringify(i.currentError);for(let c of i.clients)c.write(`data: ${s}
119
119
 
120
- `)}l(o,"broadcastCurrentState");let i={get currentError(){return n()},get errorFiles(){return[...r.keys()].filter(s=>s!=="unknown")},clients:new Set,setError(s){let c=s.file??s.loc?.file??"unknown",a=r.get(c);a&&Tl(a,s)||(c!=="unknown"&&!a&&t?.(c),r.delete(c),r.set(c,s),o())},clearErrorForModules(s){if(r.size===0)return;let c=!1;for(let a of[...r.keys()])a!=="unknown"&&s.some(u=>No(a,u))&&(r.delete(a),c=!0);c&&o()},clearAll(){r.clear(),o()}};return i}function No(t,e){let r=l(n=>Ve(n).replace(/^file:\/\//,"").replace(/^\/@fs\//,"/").replace(/\\/g,"/").replace(/^\/+/,""),"normalize");return r(t)===r(e)}function Oo(t={}){let e,r=kl(t.onErrorFile,a=>e?.ws.send(st,a)),n=l(a=>a.replace(/\\/g,"/"),"normalizedFileKey"),o=l(a=>r.errorFiles.some(u=>No(u,a)),"hasActiveCompileError"),i=l(async(a,u)=>{if(!o(u))return!1;let p=me(u),f=`/@fs/${p.replace(/^\/+/,"")}`,d=a.environments?.client,g=d??a;try{let h=(0,_t.readFileSync)(p,"utf8"),y=/\.canvas\.[cm]?[jt]sx?$/.test(p),v=l(T=>{let O=(0,Mo.parseSync)(p,T);return!O.errors.length&&O.program.body.some(M=>M.type==="ExportDefaultDeclaration"||M.type==="ExportNamedDeclaration"&&M.exportKind!=="type"&&M.specifiers.some(B=>B.exportKind!=="type"&&(B.exported.type==="Identifier"?B.exported.name:B.exported.value)==="default"))},"hasDefault");if(y&&!v(h))return!1;let w=p;try{w=(0,_t.realpathSync)(p)}catch{}let x=new Set([...g.moduleGraph.getModulesByFile(w)??[],...g.moduleGraph.getModulesByFile(p)??[]]);for(let T of x)g.moduleGraph.invalidateModule(T);let A=await g.transformRequest(f);if(!A||(0,_t.readFileSync)(p,"utf8")!==h||y&&(typeof A!="object"||!("code"in A)||typeof A.code!="string"||!v(A.code)))return!1}catch{return!1}return r.clearErrorForModules([u,p,f]),a.config.logger.info(`[tempo] recovered compile-error module after validated transform: ${p}`,{timestamp:!0}),(d?.hot??a.ws).send({type:"full-reload",path:"*"}),!0},"recoverActiveCompileError"),s=new Map;return{errorServer:r,attach(a){e=a,a.ws.on?.(or,(u,p)=>{p.send(st,r.currentError)})},handleRequest(a,u){let p=a.url;return p==="/__tempo/report-error"&&a.method==="POST"?(Pl(a).then(f=>{try{r.setError(JSON.parse(f))}catch{}u.statusCode=200,u.end("ok")}),!0):p==="/__tempo/report-clear"&&a.method==="POST"?(r.clearAll(),u.statusCode=200,u.end("ok"),!0):p==="/__tempo/errors"&&a.method==="OPTIONS"?(u.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*"}),u.end(),!0):p==="/__tempo/errors"&&a.method==="GET"?(u.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}),u.write(`data: ${JSON.stringify(r.currentError)}
120
+ `)}l(o,"broadcastCurrentState");let i={get currentError(){return n()},get errorFiles(){return[...r.keys()].filter(s=>s!=="unknown")},clients:new Set,setError(s){let c=s.file??s.loc?.file??"unknown",a=r.get(c);a&&Nl(a,s)||(c!=="unknown"&&!a&&t?.(c),r.delete(c),r.set(c,s),o())},clearErrorForModules(s){if(r.size===0)return;let c=!1;for(let a of[...r.keys()])a!=="unknown"&&s.some(u=>$o(a,u))&&(r.delete(a),c=!0);c&&o()},clearAll(){r.clear(),o()}};return i}function $o(t,e){let r=l(n=>We(n).replace(/^file:\/\//,"").replace(/^\/@fs\//,"/").replace(/\\/g,"/").replace(/^\/+/,""),"normalize");return r(t)===r(e)}function Lo(t={}){let e,r=Ol(t.onErrorFile,a=>e?.ws.send(it,a)),n=l(a=>a.replace(/\\/g,"/"),"normalizedFileKey"),o=l(a=>r.errorFiles.some(u=>$o(u,a)),"hasActiveCompileError"),i=l(async(a,u)=>{if(!o(u))return!1;let p=he(u),f=`/@fs/${p.replace(/^\/+/,"")}`,d=a.environments?.client,g=d??a;try{let h=(0,Rt.readFileSync)(p,"utf8"),y=/\.canvas\.[cm]?[jt]sx?$/.test(p),v=l(T=>{let $=(0,Oo.parseSync)(p,T);return!$.errors.length&&$.program.body.some(k=>k.type==="ExportDefaultDeclaration"||k.type==="ExportNamedDeclaration"&&k.exportKind!=="type"&&k.specifiers.some(B=>B.exportKind!=="type"&&(B.exported.type==="Identifier"?B.exported.name:B.exported.value)==="default"))},"hasDefault");if(y&&!v(h))return!1;let w=p;try{w=(0,Rt.realpathSync)(p)}catch{}let C=new Set([...g.moduleGraph.getModulesByFile(w)??[],...g.moduleGraph.getModulesByFile(p)??[]]);for(let T of C)g.moduleGraph.invalidateModule(T);let x=await g.transformRequest(f);if(!x||(0,Rt.readFileSync)(p,"utf8")!==h||y&&(typeof x!="object"||!("code"in x)||typeof x.code!="string"||!v(x.code)))return!1}catch{return!1}return r.clearErrorForModules([u,p,f]),a.config.logger.info(`[tempo] recovered compile-error module after validated transform: ${p}`,{timestamp:!0}),(d?.hot??a.ws).send({type:"full-reload",path:"*"}),!0},"recoverActiveCompileError"),s=new Map;return{errorServer:r,attach(a){e=a,a.ws.on?.(ar,(u,p)=>{p.send(it,r.currentError)})},handleRequest(a,u){let p=a.url;return p==="/__tempo/report-error"&&a.method==="POST"?(Ll(a).then(f=>{try{r.setError(JSON.parse(f))}catch{}u.statusCode=200,u.end("ok")}),!0):p==="/__tempo/report-clear"&&a.method==="POST"?(r.clearAll(),u.statusCode=200,u.end("ok"),!0):p==="/__tempo/errors"&&a.method==="OPTIONS"?(u.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*"}),u.end(),!0):p==="/__tempo/errors"&&a.method==="GET"?(u.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}),u.write(`data: ${JSON.stringify(r.currentError)}
121
121
 
122
- `),r.clients.add(u),a.on("close",()=>{r.clients.delete(u)}),!0):!1},recordHmrError(a){r.setError({type:"compile",message:a?.message??"Unknown error",stack:a?.stack,file:a?.id??a?.loc?.file,frame:a?.frame,plugin:a?.plugin,loc:a?.loc})},hasActiveCompileError:o,recover:i,pollRecovery:l(async a=>{let u=new Map(r.errorFiles.map(f=>[n(me(f)),f]));for(let f of[...s.keys()])u.has(f)||s.delete(f);let p=Date.now();for(let[f,d]of u){let g=s.get(f);if(g&&p<g.nextAttemptAtMs)continue;if(await i(a,d)){s.delete(f);continue}let h=g?.intervalMs??Rl;s.set(f,{nextAttemptAtMs:p+h,intervalMs:Math.min(h*2,Il)})}},"pollCompileErrorRecovery"),reset(){s.clear()}}}function Pl(t){return new Promise((e,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>e(Buffer.concat(n).toString())),t.on("error",r)})}var _t,Mo,Rl,Il,$o=P(()=>{Vr();_t=require("node:fs"),Mo=require("oxc-parser");it();At();sr();Rl=Ct;l(Tl,"isSameError");l(kl,"createErrorServer");l(No,"moduleIdsMatch");Il=3e4;l(Oo,"createCompileErrorStream");l(Pl,"readBody")});function lr(t){return t.trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"")}var Jr,Gr,Lo=P(()=>{"use strict";Jr="/__tempo/canvas-host-registration",Gr="x-tempo-canvas-host-registration";l(lr,"normalizeCanvasRegistrationPath")});async function Do(t,e){let r=performance.now(),n=!1,o=setTimeout(()=>{n=!0,e("pending",Math.round(performance.now()-r))},5e3),i=l(s=>{let c=Math.round(performance.now()-r);(n||c>=5e3)&&e(s,c)},"settled");try{let s=await t();return i("ready"),s}catch(s){throw i("error"),s}finally{clearTimeout(o)}}function Ho(){let t=new Map;return l(async function(r,n){let o=(0,Fo.readFileSync)(r,"utf8"),i=t.get(r);if(i?.source===o&&(i.pending||i.current()))return i.result;let s={source:o,pending:!0,current:l(()=>!1,"current"),result:Promise.resolve()};return t.set(r,s),s.result=Promise.resolve().then(async()=>{s.current=await n(),s.pending=!1}).catch(c=>{throw t.get(r)===s&&t.delete(r),c}),s.result},"confirm")}async function jo(t,e,r,n=1e3){if(!r)return await t,null;let o;try{return await Promise.race([t.then(()=>null),new Promise(i=>{o=setTimeout(()=>i(e()),n)})])}finally{clearTimeout(o)}}var Fo,Uo=P(()=>{Fo=require("node:fs");l(Do,"traceSlowRegistration");l(Ho,"createRegistrationTransforms");l(jo,"registrationReply")});function Wo(t){let e=new Set,r=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")/g;for(let n of t.matchAll(r))try{let o=JSON.parse(n[1]??"");if(typeof o!="string")continue;let i=lr(o);i&&e.add(i)}catch{}return[...e]}async function Nl(t,e){let r=(0,Rt.resolve)(t.config.root,".tempo","tempo-host.tsx"),n;try{n=(0,Ke.readFileSync)(r,"utf8")}catch(u){throw new Error(`Canvas host wrapper is unavailable at ${r}: ${u instanceof Error?u.message:String(u)}`)}if(!Wo(n).includes(e))throw Object.assign(new Error(`Generated canvas host wrapper does not contain ${JSON.stringify(e)}`),{statusCode:409});let i=(0,Ke.realpathSync)(r),s=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")\s*,\s*load:\s*\(\)\s*=>\s*import\(\s*("(?:\\.|[^"\\])*")\s*\)/g,c,a=t.environments?.client??t;for(let u of n.matchAll(s)){if(lr(JSON.parse(u[1]))!==e)continue;let p=await a.pluginContainer.resolveId(JSON.parse(u[2]),r);if(!p)throw new Error(`Cannot resolve canvas ${e}`);let f=me(p.id),d=`/@fs/${f.replace(/^\/+/,"")}`;c=`${Ol(t)}${d.slice(1)}`,await Vo(t,a,(0,Ke.realpathSync)(f),f,d);break}return await Vo(t,a,i,r),n.includes("tempo-incremental-canvas-registration")?c:void 0}function Ol(t){let e=t.config.base||"/",r=e.startsWith("/")?e:new URL(e,"http://tempo.invalid").pathname;return r.endsWith("/")?r:`${r}/`}function Jo(t){let e=t.environments?.client?.depsOptimizer;return{status:"compiling",phase:e?.scanProcessing?"scanning":Object.values(e?.metadata.discovered??{}).some(n=>n.processing)?"bundling":"transforming",progress:cr.get(t)??0}}async function Vo(t,e,r,n,o=Ml){let i=Xr.get(e);i||(i=Ho(),Xr.set(e,i)),await i(r,()=>Do(async()=>{let s=l(()=>e.moduleGraph.getModulesByFile(r)??e.moduleGraph.getModulesByFile(n),"modules");for(let p of s()??[])e.moduleGraph.invalidateModule(p);if(!await e.transformRequest(o))throw new Error(`Vite did not transform ${o} after registration`);await e.waitForRequestsIdle?.();let a=t.environments?.client?.depsOptimizer;await a?.scanProcessing,await Promise.all(Object.values(a?.metadata.discovered??{}).map(p=>p.processing)),a&&await e.transformRequest(o);let u=[...s()??[]].map(p=>[p,p.transformResult]);return()=>u.length>0&&u.every(([p,f])=>f!=null&&s()?.has(p)&&p.transformResult===f)},(s,c)=>{t.config.logger.info(`[tempo] canvas registration ${JSON.stringify({...Jo(t),status:s,module:(0,Rt.relative)(t.config.root,r),elapsedMs:c})}`)}))}function Bo(t){t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Expose-Headers",Gr),t.setHeader(Gr,"1")}function Go(t,e){if(t.replace(/\\/g,"/")!==e.replace(/\\/g,"/"))return!1;try{return(0,Ke.readFileSync)(t,"utf8").includes("tempo-incremental-canvas-registration")}catch{return!1}}function Xo(t,e,r,n){let o=(0,Rt.relative)(e.sourceRoot,t).replace(/\\/g,"/"),i;try{i=(0,Ke.readFileSync)(e.wrapperPath,"utf8")}catch{return}if(!Wo(i).includes(o))return;let s=r.getModulesByFile(e.wrapperPath);if(s?.size){for(let c of s)r.invalidateModule(c);return[...new Set([...n,...s])]}}function Ko(t){cr.set(t,0),Xr.delete(t.environments?.client??t)}function zo(t){cr.set(t,(cr.get(t)??0)+1)}function qo(t,e,r){let n=e.url;return n===Jr&&e.method==="OPTIONS"?(Bo(r),r.writeHead(204,{"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"content-type"}),r.end(),!0):n===Jr&&e.method==="POST"?(Bo(r),$l(e).then(async o=>{let i=JSON.parse(o),s=typeof i.canvasPath=="string"?lr(i.canvasPath):"";if(!s)throw Object.assign(new Error("canvasPath must be a non-empty string"),{statusCode:400});let c,a=await jo(Nl(t,s).then(u=>{c=u}),()=>Jo(t),i.poll===!0);r.statusCode=a?202:200,r.setHeader("Content-Type","application/json"),r.setHeader("Cache-Control","no-store"),r.end(JSON.stringify(a??{canvasPath:s,...c?{moduleUrl:c}:{}}))}).catch(o=>{r.statusCode=typeof o=="object"&&o!==null&&"statusCode"in o&&typeof o.statusCode=="number"?o.statusCode:500,r.setHeader("Content-Type","text/plain; charset=utf-8"),r.end(o instanceof Error?o.message:String(o))}),!0):!1}function $l(t){return new Promise((e,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>e(Buffer.concat(n).toString())),t.on("error",r)})}var Ke,Rt,Ml,Xr,cr,Yo=P(()=>{Ke=require("node:fs"),Rt=require("node:path");Lo();Uo();At();Ml="/.tempo/tempo-host";l(Wo,"readGeneratedCanvasPaths");l(Nl,"synchronizeCanvasHostRegistrationTransform");l(Ol,"viteBasePath");Xr=new WeakMap,cr=new WeakMap;l(Jo,"registrationProgress");l(Vo,"retransformCanvasHostWrapper");l(Bo,"writeCanvasRegistrationResponseHeaders");l(Go,"isIncrementalWrapperFile");l(Xo,"withRegisteredCanvasLoader");l(Ko,"resetCanvasHostRegistration");l(zo,"noteCanvasHostRegistrationActivity");l(qo,"handleCanvasHostRegistrationRequest");l($l,"readBody")});var Qo=P(()=>{});var Tt=Ye((Fd,ns)=>{"use strict";var Zo="[^\\\\/]",Ll="(?=.)",es="[^/]",Kr="(?:\\/|$)",ts="(?:^|\\/)",zr=`\\.{1,2}${Kr}`,Fl="(?!\\.)",Dl=`(?!${ts}${zr})`,Hl=`(?!\\.{0,1}${Kr})`,jl=`(?!${zr})`,Ul="[^.\\/]",Vl=`${es}*?`,Bl="/",rs={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:Ll,QMARK:es,END_ANCHOR:Kr,DOTS_SLASH:zr,NO_DOT:Fl,NO_DOTS:Dl,NO_DOT_SLASH:Hl,NO_DOTS_SLASH:jl,QMARK_NO_DOT:Ul,STAR:Vl,START_ANCHOR:ts,SEP:Bl},Wl={...rs,SLASH_LITERAL:"[\\\\/]",QMARK:Zo,STAR:`${Zo}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Jl={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};ns.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Jl,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Wl:rs}}});var kt=Ye(ie=>{"use strict";var{REGEX_BACKSLASH:Gl,REGEX_REMOVE_BACKSLASH:Xl,REGEX_SPECIAL_CHARS:Kl,REGEX_SPECIAL_CHARS_GLOBAL:zl}=Tt();ie.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ie.hasRegexChars=t=>Kl.test(t);ie.isRegexChar=t=>t.length===1&&ie.hasRegexChars(t);ie.escapeRegex=t=>t.replace(zl,"\\$1");ie.toPosixSlashes=t=>t.replace(Gl,"/");ie.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};ie.removeBackslashes=t=>t.replace(Xl,e=>e==="\\"?"":e);ie.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?ie.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};ie.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};ie.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};ie.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var ps=Ye((Hd,us)=>{"use strict";var os=kt(),{CHAR_ASTERISK:qr,CHAR_AT:ql,CHAR_BACKWARD_SLASH:at,CHAR_COMMA:Yl,CHAR_DOT:Yr,CHAR_EXCLAMATION_MARK:Qr,CHAR_FORWARD_SLASH:cs,CHAR_LEFT_CURLY_BRACE:Zr,CHAR_LEFT_PARENTHESES:ur,CHAR_LEFT_SQUARE_BRACKET:Ql,CHAR_PLUS:Zl,CHAR_QUESTION_MARK:ss,CHAR_RIGHT_CURLY_BRACE:ec,CHAR_RIGHT_PARENTHESES:is,CHAR_RIGHT_SQUARE_BRACKET:tc}=Tt(),as=l(t=>t===cs||t===at,"isPathSeparator"),ls=l(t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},"depth"),rc=l((t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.tokens===!0||r.scanToEnd===!0,i=[],s=[],c=[],a=t,u=-1,p=0,f=0,d=!1,g=!1,h=!1,y=!1,v=!1,w=!1,x=!1,A=!1,T=!1,O=!1,M=0,B,L,$={value:"",depth:0,isGlob:!1},S=l(()=>u>=n,"eos"),J=l(()=>a.charCodeAt(u+1),"peek"),U=l(()=>(B=L,a.charCodeAt(++u)),"advance");for(;u<n;){L=U();let W;if(L===at){x=$.backslashes=!0,L=U(),L===Zr&&(w=!0);continue}if(w===!0||L===Zr){for(M++;S()!==!0&&(L=U());){if(L===at){x=$.backslashes=!0,U();continue}if(L===Zr){M++;continue}if(w!==!0&&L===Yr&&(L=U())===Yr){if(d=$.isBrace=!0,h=$.isGlob=!0,O=!0,o===!0)continue;break}if(w!==!0&&L===Yl){if(d=$.isBrace=!0,h=$.isGlob=!0,O=!0,o===!0)continue;break}if(L===ec&&(M--,M===0)){w=!1,d=$.isBrace=!0,O=!0;break}}if(o===!0)continue;break}if(L===cs){if(i.push(u),s.push($),$={value:"",depth:0,isGlob:!1},O===!0)continue;if(B===Yr&&u===p+1){p+=2;continue}f=u+1;continue}if(r.noext!==!0&&(L===Zl||L===ql||L===qr||L===ss||L===Qr)===!0&&J()===ur){if(h=$.isGlob=!0,y=$.isExtglob=!0,O=!0,L===Qr&&u===p&&(T=!0),o===!0){let Z=0;for(;S()!==!0&&(L=U());){if(L===at){x=$.backslashes=!0,U();continue}if(L===ur){Z++;continue}if(L===is&&--Z===0){O=!0;break}}continue}break}if(L===qr){if(B===qr&&(v=$.isGlobstar=!0),h=$.isGlob=!0,O=!0,o===!0)continue;break}if(L===ss){if(h=$.isGlob=!0,O=!0,o===!0)continue;break}if(L===Ql){for(;S()!==!0&&(W=U());){if(W===at){x=$.backslashes=!0,U();continue}if(W===tc){g=$.isBracket=!0,h=$.isGlob=!0,O=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&L===Qr&&u===p){A=$.negated=!0,p++;continue}if(r.noparen!==!0&&L===ur){if(h=$.isGlob=!0,o===!0){let Q=1;for(;S()!==!0&&(L=U());){if(L===at){x=$.backslashes=!0,U();continue}if(L===ur){Q++;continue}if(L===is&&--Q===0){O=!0;break}}continue}break}if(h===!0){if(O=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,h=!1);let F=a,b="",E="";p>0&&(b=a.slice(0,p),a=a.slice(p),f-=p),F&&h===!0&&f>0?(F=a.slice(0,f),E=a.slice(f)):h===!0?(F="",E=a):F=a,F&&F!==""&&F!=="/"&&F!==a&&as(F.charCodeAt(F.length-1))&&(F=F.slice(0,-1)),r.unescape===!0&&(E&&(E=os.removeBackslashes(E)),F&&x===!0&&(F=os.removeBackslashes(F)));let te={prefix:b,input:t,start:p,base:F,glob:E,isBrace:d,isBracket:g,isGlob:h,isExtglob:y,isGlobstar:v,negated:A,negatedExtglob:T};if(r.tokens===!0&&(te.maxDepth=0,as(L)||s.push($),te.tokens=s),r.parts===!0||r.tokens===!0){let W;for(let q=0;q<i.length;q++){let ke=W!==void 0?W+1:p,we=i[q],xe=t.slice(ke,we);r.tokens&&(q===0&&p!==0?(s[q].isPrefix=!0,s[q].value=b):s[q].value=xe,ls(s[q]),te.maxDepth+=s[q].depth),we>=p&&(c.push(xe),W=we)}let Q=W!==void 0?W+1:p,Z=t.slice(Q);c.push(Z),r.tokens&&W&&W+1<t.length&&(s[s.length-1].value=Z,ls(s[s.length-1]),te.maxDepth+=s[s.length-1].depth),te.slashes=i,te.parts=c}return te},"scan");us.exports=rc});var gs=Ye((Ud,ms)=>{"use strict";var It=Tt(),ue=kt(),{MAX_LENGTH:pr,POSIX_REGEX_SOURCE:nc,REGEX_NON_SPECIAL_CHARS:oc,REGEX_SPECIAL_CHARS_BACKREF:sc,REPLACEMENTS:ds}=It,ic=l((t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>ue.escapeRegex(o)).join("..")}return r},"expandRange"),lt=l((t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,"syntaxError"),fs=l(t=>{let e=[],r=0,n=0,o=0,i="",s=!1;for(let c of t){if(s===!0){i+=c,s=!1;continue}if(c==="\\"){i+=c,s=!0;continue}if(c==='"'){o=o===1?0:1,i+=c;continue}if(o===0){if(c==="[")r++;else if(c==="]"&&r>0)r--;else if(r===0){if(c==="(")n++;else if(c===")"&&n>0)n--;else if(c==="|"&&n===0){e.push(i),i="";continue}}}i+=c}return e.push(i),e},"splitTopLevel"),ac=l(t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},"isPlainBranch"),tn=l(t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(ac(e))return e.replace(/\\(.)/g,"$1")},"normalizeSimpleBranch"),lc=l(t=>{let e=t.map(tn).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let o=e[r],i=e[n],s=o[0];if(!(!s||o!==s.repeat(o.length)||i!==s.repeat(i.length))&&(o===i||o.startsWith(i)||i.startsWith(o)))return!0}return!1},"hasRepeatedCharPrefixOverlap"),en=l((t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,o=0,i=!1;for(let s=1;s<t.length;s++){let c=t[s];if(i===!0){i=!1;continue}if(c==="\\"){i=!0;continue}if(c==='"'){o=o===1?0:1;continue}if(o!==1){if(c==="["){r++;continue}if(c==="]"&&r>0){r--;continue}if(!(r>0)){if(c==="("){n++;continue}if(c===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},"parseRepeatedExtglob"),cc=l(t=>`${t.length===1?ue.escapeRegex(t[0]):`[${t.map(r=>ue.escapeRegex(r)).join("")}]`}*`,"buildCharClassStar"),uc=l(t=>{let e=0,r=[];for(;e<t.length;){let n=en(t.slice(e),!1);if(!n||n.type!=="*")return;let o=fs(n.body).map(s=>s.trim());if(o.length!==1)return;let i=tn(o[0]);if(!i||i.length!==1)return;r.push(i),e+=n.end+1}if(!(r.length<1))return r},"getStarExtglobSequenceChars"),pc=l(t=>{let e=0,r=t.trim(),n=en(r);for(;n;)e++,r=n.body.trim(),n=en(r);return e},"repeatedExtglobRecursion"),dc=l((t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:It.DEFAULT_MAX_EXTGLOB_RECURSION,n=fs(t).map(c=>c.trim());if(n.length>1&&(n.some(c=>c==="")||n.some(c=>/^[*?]+$/.test(c))||lc(n)))return{risky:!0};let o=[],i=!1,s=!0;for(let c of n){let a=uc(c);if(a){i=!0,o.push(...a);continue}let u=tn(c);if(u&&u.length===1){o.push(u);continue}if(s=!1,pc(c)>r)return{risky:!0}}return i?s?{risky:!0,safeOutput:cc([...new Set(o)])}:{risky:!0}:{risky:!1}},"analyzeRepeatedExtglob"),rn=l((t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ds[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(pr,r.maxLength):pr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},s=[i],c=r.capture?"":"?:",a=It.globChars(r.windows),u=It.extglobChars(a),{DOT_LITERAL:p,PLUS_LITERAL:f,SLASH_LITERAL:d,ONE_CHAR:g,DOTS_SLASH:h,NO_DOT:y,NO_DOT_SLASH:v,NO_DOTS_SLASH:w,QMARK:x,QMARK_NO_DOT:A,STAR:T,START_ANCHOR:O}=a,M=l(R=>`(${c}(?:(?!${O}${R.dot?h:p}).)*?)`,"globstar"),B=r.dot?"":y,L=r.dot?x:A,$=r.bash===!0?M(r):T;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let S={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ue.removePrefix(t,S),o=t.length;let J=[],U=[],F=[],b=i,E,te=l(()=>S.index===o-1,"eos"),W=S.peek=(R=1)=>t[S.index+R],Q=S.advance=()=>t[++S.index]||"",Z=l(()=>t.slice(S.index+1),"remaining"),q=l((R="",z=0)=>{S.consumed+=R,S.index+=z},"consume"),ke=l(R=>{S.output+=R.output!=null?R.output:R.value,q(R.value)},"append"),we=l(()=>{let R=1;for(;W()==="!"&&(W(2)!=="("||W(3)==="?");)Q(),S.start++,R++;return R%2===0?!1:(S.negated=!0,S.start++,!0)},"negate"),xe=l(R=>{S[R]++,F.push(R)},"increment"),Se=l(R=>{S[R]--,F.pop()},"decrement"),D=l(R=>{if(b.type==="globstar"){let z=S.braces>0&&(R.type==="comma"||R.type==="brace"),_=R.extglob===!0||J.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!z&&!_&&(S.output=S.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=$,S.output+=b.output)}if(J.length&&R.type!=="paren"&&(J[J.length-1].inner+=R.value),(R.value||R.output)&&ke(R),b&&b.type==="text"&&R.type==="text"){b.output=(b.output||b.value)+R.value,b.value+=R.value;return}R.prev=b,s.push(R),b=R},"push"),Je=l((R,z)=>{let _={...u[z],conditions:1,inner:""};_.prev=b,_.parens=S.parens,_.output=S.output,_.startIndex=S.index,_.tokensIndex=s.length;let H=(r.capture?"(":"")+_.open;xe("parens"),D({type:R,value:z,output:S.output?"":g}),D({type:"paren",extglob:!0,value:Q(),output:H}),J.push(_)},"extglobOpen"),br=l(R=>{let z=t.slice(R.startIndex,S.index+1),_=t.slice(R.startIndex+2,S.index),H=dc(_,r);if((R.type==="plus"||R.type==="star")&&H.risky){let C=H.safeOutput?(R.output?"":g)+(r.capture?`(${H.safeOutput})`:H.safeOutput):void 0,N=s[R.tokensIndex];N.type="text",N.value=z,N.output=C||ue.escapeRegex(z);for(let I=R.tokensIndex+1;I<s.length;I++)s[I].value="",s[I].output="",delete s[I].suffix;S.output=R.output+N.output,S.backtrack=!0,D({type:"paren",extglob:!0,value:E,output:""}),Se("parens");return}let X=R.close+(r.capture?")":""),m;if(R.type==="negate"){let C=$;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(C=M(r)),(C!==$||te()||/^\)+$/.test(Z()))&&(X=R.close=`)$))${C}`),R.inner.includes("*")&&(m=Z())&&/^\.[^\\/.]+$/.test(m)){let N=rn(m,{...e,fastpaths:!1}).output;X=R.close=`)${N})${C})`}R.prev.type==="bos"&&(S.negatedExtglob=!0)}D({type:"paren",extglob:!0,value:E,output:X}),Se("parens")},"extglobClose");if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let R=!1,z=t.replace(sc,(_,H,X,m,C,N)=>m==="\\"?(R=!0,_):m==="?"?H?H+m+(C?x.repeat(C.length):""):N===0?L+(C?x.repeat(C.length):""):x.repeat(X.length):m==="."?p.repeat(X.length):m==="*"?H?H+m+(C?$:""):$:H?_:`\\${_}`);return R===!0&&(r.unescape===!0?z=z.replace(/\\/g,""):z=z.replace(/\\+/g,_=>_.length%2===0?"\\\\":_?"\\":"")),z===t&&r.contains===!0?(S.output=t,S):(S.output=ue.wrapOutput(z,S,e),S)}for(;!te();){if(E=Q(),E==="\0")continue;if(E==="\\"){let _=W();if(_==="/"&&r.bash!==!0||_==="."||_===";")continue;if(!_){E+="\\",D({type:"text",value:E});continue}let H=/^\\+/.exec(Z()),X=0;if(H&&H[0].length>2&&(X=H[0].length,S.index+=X,X%2!==0&&(E+="\\")),r.unescape===!0?E=Q():E+=Q(),S.brackets===0){D({type:"text",value:E});continue}}if(S.brackets>0&&(E!=="]"||b.value==="["||b.value==="[^")){if(r.posix!==!1&&E===":"){let _=b.value.slice(1);if(_.includes("[")&&(b.posix=!0,_.includes(":"))){let H=b.value.lastIndexOf("["),X=b.value.slice(0,H),m=b.value.slice(H+2),C=nc[m];if(C){b.value=X+C,S.backtrack=!0,Q(),!i.output&&s.indexOf(b)===1&&(i.output=g);continue}}}(E==="["&&W()!==":"||E==="-"&&W()==="]")&&(E=`\\${E}`),E==="]"&&(b.value==="["||b.value==="[^")&&(E=`\\${E}`),r.posix===!0&&E==="!"&&b.value==="["&&(E="^"),b.value+=E,ke({value:E});continue}if(S.quotes===1&&E!=='"'){E=ue.escapeRegex(E),b.value+=E,ke({value:E});continue}if(E==='"'){S.quotes=S.quotes===1?0:1,r.keepQuotes===!0&&D({type:"text",value:E});continue}if(E==="("){xe("parens"),D({type:"paren",value:E});continue}if(E===")"){if(S.parens===0&&r.strictBrackets===!0)throw new SyntaxError(lt("opening","("));let _=J[J.length-1];if(_&&S.parens===_.parens+1){br(J.pop());continue}D({type:"paren",value:E,output:S.parens?")":"\\)"}),Se("parens");continue}if(E==="["){if(r.nobracket===!0||!Z().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(lt("closing","]"));E=`\\${E}`}else xe("brackets");D({type:"bracket",value:E});continue}if(E==="]"){if(r.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){D({type:"text",value:E,output:`\\${E}`});continue}if(S.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(lt("opening","["));D({type:"text",value:E,output:`\\${E}`});continue}Se("brackets");let _=b.value.slice(1);if(b.posix!==!0&&_[0]==="^"&&!_.includes("/")&&(E=`/${E}`),b.value+=E,ke({value:E}),r.literalBrackets===!1||ue.hasRegexChars(_))continue;let H=ue.escapeRegex(b.value);if(S.output=S.output.slice(0,-b.value.length),r.literalBrackets===!0){S.output+=H,b.value=H;continue}b.value=`(${c}${H}|${b.value})`,S.output+=b.value;continue}if(E==="{"&&r.nobrace!==!0){xe("braces");let _={type:"brace",value:E,output:"(",outputIndex:S.output.length,tokensIndex:S.tokens.length};U.push(_),D(_);continue}if(E==="}"){let _=U[U.length-1];if(r.nobrace===!0||!_){D({type:"text",value:E,output:E});continue}let H=")";if(_.dots===!0){let X=s.slice(),m=[];for(let C=X.length-1;C>=0&&(s.pop(),X[C].type!=="brace");C--)X[C].type!=="dots"&&m.unshift(X[C].value);H=ic(m,r),S.backtrack=!0}if(_.comma!==!0&&_.dots!==!0){let X=S.output.slice(0,_.outputIndex),m=S.tokens.slice(_.tokensIndex);_.value=_.output="\\{",E=H="\\}",S.output=X;for(let C of m)S.output+=C.output||C.value}D({type:"brace",value:E,output:H}),Se("braces"),U.pop();continue}if(E==="|"){J.length>0&&J[J.length-1].conditions++,D({type:"text",value:E});continue}if(E===","){let _=E,H=U[U.length-1];H&&F[F.length-1]==="braces"&&(H.comma=!0,_="|"),D({type:"comma",value:E,output:_});continue}if(E==="/"){if(b.type==="dot"&&S.index===S.start+1){S.start=S.index+1,S.consumed="",S.output="",s.pop(),b=i;continue}D({type:"slash",value:E,output:d});continue}if(E==="."){if(S.braces>0&&b.type==="dot"){b.value==="."&&(b.output=p);let _=U[U.length-1];b.type="dots",b.output+=E,b.value+=E,_.dots=!0;continue}if(S.braces+S.parens===0&&b.type!=="bos"&&b.type!=="slash"){D({type:"text",value:E,output:p});continue}D({type:"dot",value:E,output:p});continue}if(E==="?"){if(!(b&&b.value==="(")&&r.noextglob!==!0&&W()==="("&&W(2)!=="?"){Je("qmark",E);continue}if(b&&b.type==="paren"){let H=W(),X=E;(b.value==="("&&!/[!=<:]/.test(H)||H==="<"&&!/<([!=]|\w+>)/.test(Z()))&&(X=`\\${E}`),D({type:"text",value:E,output:X});continue}if(r.dot!==!0&&(b.type==="slash"||b.type==="bos")){D({type:"qmark",value:E,output:A});continue}D({type:"qmark",value:E,output:x});continue}if(E==="!"){if(r.noextglob!==!0&&W()==="("&&(W(2)!=="?"||!/[!=<:]/.test(W(3)))){Je("negate",E);continue}if(r.nonegate!==!0&&S.index===0){we();continue}}if(E==="+"){if(r.noextglob!==!0&&W()==="("&&W(2)!=="?"){Je("plus",E);continue}if(b&&b.value==="("||r.regex===!1){D({type:"plus",value:E,output:f});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||S.parens>0){D({type:"plus",value:E});continue}D({type:"plus",value:f});continue}if(E==="@"){if(r.noextglob!==!0&&W()==="("&&W(2)!=="?"){D({type:"at",extglob:!0,value:E,output:""});continue}D({type:"text",value:E});continue}if(E!=="*"){(E==="$"||E==="^")&&(E=`\\${E}`);let _=oc.exec(Z());_&&(E+=_[0],S.index+=_[0].length),D({type:"text",value:E});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=E,b.output=$,S.backtrack=!0,S.globstar=!0,q(E);continue}let R=Z();if(r.noextglob!==!0&&/^\([^?]/.test(R)){Je("star",E);continue}if(b.type==="star"){if(r.noglobstar===!0){q(E);continue}let _=b.prev,H=_.prev,X=_.type==="slash"||_.type==="bos",m=H&&(H.type==="star"||H.type==="globstar");if(r.bash===!0&&(!X||R[0]&&R[0]!=="/")){D({type:"star",value:E,output:""});continue}let C=S.braces>0&&(_.type==="comma"||_.type==="brace"),N=J.length&&(_.type==="pipe"||_.type==="paren");if(!X&&_.type!=="paren"&&!C&&!N){D({type:"star",value:E,output:""});continue}for(;R.slice(0,3)==="/**";){let j=t[S.index+4];if(j&&j!=="/")break;R=R.slice(3),q("/**",3)}let I=te()||S.parens>0&&R===")".repeat(S.parens)&&!J.some(j=>j.type==="negate");if(_.type==="bos"&&te()){b.type="globstar",b.value+=E,b.output=M(r),S.output=b.output,S.globstar=!0,q(E);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&!m&&I){S.output=S.output.slice(0,-(_.output+b.output).length),_.output=`(?:${_.output}`,b.type="globstar",b.output=M(r)+(r.strictSlashes?")":"|$)"),b.value+=E,S.globstar=!0,S.output+=_.output+b.output,q(E);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&R[0]==="/"){let j=R[1]!==void 0?"|$":"";S.output=S.output.slice(0,-(_.output+b.output).length),_.output=`(?:${_.output}`,b.type="globstar",b.output=`${M(r)}${d}|${d}${j})`,b.value+=E,S.output+=_.output+b.output,S.globstar=!0,q(E+Q()),D({type:"slash",value:"/",output:""});continue}if(_.type==="bos"&&R[0]==="/"){b.type="globstar",b.value+=E,b.output=`(?:^|${d}|${M(r)}${d})`,S.output=b.output,S.globstar=!0,q(E+Q()),D({type:"slash",value:"/",output:""});continue}S.output=S.output.slice(0,-b.output.length),b.type="globstar",b.output=M(r),b.value+=E,S.output+=b.output,S.globstar=!0,q(E);continue}let z={type:"star",value:E,output:$};if(r.bash===!0){z.output=".*?",(b.type==="bos"||b.type==="slash")&&(z.output=B+z.output),D(z);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&r.regex===!0){z.output=E,D(z);continue}(S.index===S.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(S.output+=v,b.output+=v):r.dot===!0?(S.output+=w,b.output+=w):(S.output+=B,b.output+=B),W()!=="*"&&(S.output+=g,b.output+=g)),D(z)}for(;S.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(lt("closing","]"));S.output=ue.escapeLast(S.output,"["),Se("brackets")}for(;S.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(lt("closing",")"));S.output=ue.escapeLast(S.output,"("),Se("parens")}for(;S.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(lt("closing","}"));S.output=ue.escapeLast(S.output,"{"),Se("braces")}if(r.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&D({type:"maybe_slash",value:"",output:`${d}?`}),S.backtrack===!0){S.output="";for(let R of S.tokens)S.output+=R.output!=null?R.output:R.value,R.suffix&&(S.output+=R.suffix)}return S},"parse");rn.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(pr,r.maxLength):pr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=ds[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:c,DOTS_SLASH:a,NO_DOT:u,NO_DOTS:p,NO_DOTS_SLASH:f,STAR:d,START_ANCHOR:g}=It.globChars(r.windows),h=r.dot?p:u,y=r.dot?f:u,v=r.capture?"":"?:",w={negated:!1,prefix:""},x=r.bash===!0?".*?":d;r.capture&&(x=`(${x})`);let A=l(B=>B.noglobstar===!0?x:`(${v}(?:(?!${g}${B.dot?a:i}).)*?)`,"globstar"),T=l(B=>{switch(B){case"*":return`${h}${c}${x}`;case".*":return`${i}${c}${x}`;case"*.*":return`${h}${x}${i}${c}${x}`;case"*/*":return`${h}${x}${s}${c}${y}${x}`;case"**":return h+A(r);case"**/*":return`(?:${h}${A(r)}${s})?${y}${c}${x}`;case"**/*.*":return`(?:${h}${A(r)}${s})?${y}${x}${i}${c}${x}`;case"**/.*":return`(?:${h}${A(r)}${s})?${i}${c}${x}`;default:{let L=/^(.*?)\.(\w+)$/.exec(B);if(!L)return;let $=T(L[1]);return $?$+i+L[2]:void 0}}},"create"),O=ue.removePrefix(t,w),M=T(O);return M&&r.strictSlashes!==!0&&(M+=`${s}?`),M};ms.exports=rn});var Ss=Ye((Bd,ys)=>{"use strict";var fc=ps(),nn=gs(),hs=kt(),mc=Tt(),gc=l(t=>t&&typeof t=="object"&&!Array.isArray(t),"isObject"),Y=l((t,e,r=!1)=>{if(Array.isArray(t)){let p=t.map(d=>Y(d,e,r));return l(d=>{for(let g of p){let h=g(d);if(h)return h}return!1},"arrayMatcher")}let n=gc(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=o.windows,s=n?Y.compileRe(t,e):Y.makeRe(t,e,!1,!0),c=s.state;delete s.state;let a=l(()=>!1,"isIgnored");if(o.ignore){let p={...e,ignore:null,onMatch:null,onResult:null};a=Y(o.ignore,p,r)}let u=l((p,f=!1)=>{let{isMatch:d,match:g,output:h}=Y.test(p,s,e,{glob:t,posix:i}),y={glob:t,state:c,regex:s,posix:i,input:p,output:h,match:g,isMatch:d};return typeof o.onResult=="function"&&o.onResult(y),d===!1?(y.isMatch=!1,f?y:!1):a(p)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,f?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),f?y:!0)},"matcher");return r&&(u.state=c),u},"picomatch");Y.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},s=i.format||(o?hs.toPosixSlashes:null),c=t===n,a=c&&s?s(t):t;return c===!1&&(a=s?s(t):t,c=a===n),(c===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?c=Y.matchBase(t,e,r,o):c=e.exec(a)),{isMatch:!!c,match:c,output:a}};Y.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Y.makeRe(e,r)).test(hs.basename(t,{windows:n}));Y.isMatch=(t,e,r)=>Y(e,r)(t);Y.parse=(t,e)=>Array.isArray(t)?t.map(r=>Y.parse(r,e)):nn(t,{...e,fastpaths:!1});Y.scan=(t,e)=>fc(t,e);Y.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",s=o.contains?"":"$",c=`${i}(?:${t.output})${s}`;t&&t.negated===!0&&(c=`^(?!${c}).*$`);let a=Y.toRegex(c,e);return n===!0&&(a.state=t),a};Y.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=nn.fastpaths(t,e)),o.output||(o=nn(t,e)),Y.compileRe(o,e,r,n)};Y.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Y.constants=mc;ys.exports=Y});var ws=Ye((Jd,Es)=>{"use strict";var vs=Ss(),hc=kt();function bs(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:hc.isWindows()}),vs(t,e,r)}l(bs,"picomatch");Object.assign(bs,vs);Es.exports=bs});function yc(t){return Array.isArray(t)}function xs(t){return yc(t)?t:t==null?[]:[t]}function vc(t,e){if(e===!1||(0,Te.isAbsolute)(t)||t.startsWith("**"))return dr(t);let r=dr((0,Te.resolve)(e||"")).replace(/[-^$*+?.()|[\]{}]/g,"\\$&");return Te.posix.join(r,dr(t))}var Te,Cs,Sc,dr,on,bc,Ec,wc,zd,As=P(()=>{Te=require("path");Qo();Cs=wr(ws(),1);l(yc,"isArray");l(xs,"ensureArray");Sc=new RegExp(`\\${Te.win32.sep}`,"g"),dr=l(function(e){return e.replace(Sc,Te.posix.sep)},"normalizePath");l(vc,"getMatcherString");on=l(function(e,r,n){let o=n&&n.resolve,i=l(a=>a instanceof RegExp?a:{test:l(u=>{let p=vc(a,o);return(0,Cs.default)(p,{dot:!0})(u)},"test")},"getMatcher"),s=xs(e).map(i),c=xs(r).map(i);return!s.length&&!c.length?a=>typeof a=="string"&&!a.includes("\0"):l(function(u){if(typeof u!="string"||u.includes("\0"))return!1;let p=dr(u);for(let f=0;f<c.length;++f){let d=c[f];if(d instanceof RegExp&&(d.lastIndex=0),d.test(p))return!1}for(let f=0;f<s.length;++f){let d=s[f];if(d instanceof RegExp&&(d.lastIndex=0),d.test(p))return!0}return!s.length},"result")},"createFilter"),bc="break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public",Ec="arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl",wc=new Set(`${bc} ${Ec}`.split(" "));wc.add("");zd="isWellFormed"in String.prototype});var Pt,_s=P(()=>{"use strict";Pt="tempo-interact-preview"});function sn(t){switch(t.type){case"JSXIdentifier":return t.name;case"JSXNamespacedName":return`${t.namespace.name}:${t.name.name}`;case"JSXMemberExpression":return Rs(t)}}function Rs(t){return`${t.object.type==="JSXIdentifier"?t.object.name:Rs(t.object)}.${t.property.name}`}var Ts=P(()=>{"use strict";l(sn,"getTagName");l(Rs,"getJSXMemberExpressionName")});function fr(t,e,r=null){if(t==null||typeof t!="object")return;if(Array.isArray(t)){for(let s of t)fr(s,e,r);return}let n=t,o=n.type;typeof o=="string"&&o in e&&e[o](t,r);let i=typeof o=="string"?t:r;for(let s of Object.values(n))s!==null&&typeof s=="object"&&fr(s,e,i)}var Is,ks,rf,Ps=P(()=>{"use strict";Is=wr(require("oxc-parser/src-js/generated/visit/keys.js"),1),ks=Is.default,rf=ks.default??ks;l(fr,"walk")});function Cc(t){let e=xc.exec(t);if(e)return e[1].toLowerCase()==="c"?{lang:"jsx",sourceType:"commonjs"}:{lang:"jsx"}}function Ns(t,e){return(0,Ms.parseSync)(t,e,Cc(t))}var Ms,xc,Os=P(()=>{"use strict";Ms=require("oxc-parser"),xc=/\.([cm]?)js$/i;l(Cc,"sourceParseOptions");l(Ns,"parseSourceFile")});function Ac(t){return t===void 0?null:typeof t=="function"?t.toString():JSON.stringify(t)}function _c(t){return Object.entries(t).map(([e,r])=>{let n=Ac(r);return n===null?null:` ${e}={${n}}`}).filter(e=>e!==null).join("")}function Rc(t){let e=new Set;for(let r of t.openingElement.attributes??[])r.type==="JSXAttribute"&&e.add(sn(r.name));return e}function Tc(t,e){return Object.fromEntries(Object.entries(t).filter(([r])=>!e.has(r)))}function $s(t,e,r){let n=Ns(e,t),o=[],i=new WeakSet,s=l(u=>{for(let p of u.children){let f=gt(p);f&&i.add(f)}},"noteChildren");fr(n.program,{JSXFragment(u){s(u)},JSXElement(u,p){let f=u;s(f);let d=sn(f.openingElement.name);if(kc.has(d))return;let g=p?.type??null,h=Tc(r({element:f,tagName:d,parentType:g,...i.has(f)?{isStaticJsxChild:!0}:{}}),Rc(f));if(Object.keys(h).length===0)return;let y=f.openingElement,v=y.end-1;if(y.selfClosing)for(v--;v>y.start&&/\s/.test(t[v-1]);)v--;o.push({position:v,text:_c(h)})}}),o.sort((u,p)=>u.position-p.position);let c=[],a=0;for(let{position:u,text:p}of o)c.push(t.slice(a,u)),c.push(p),a=u;return c.push(t.slice(a)),{annotatedSource:c.join(""),elementsAnnotated:o.length,parseResult:n}}var kc,Ls=P(()=>{"use strict";Ts();Ps();Vt();Os();l(Ac,"formatPropValue");l(_c,"formatProps");l(Rc,"getExistingAttributeNames");l(Tc,"removeExistingProps");kc=new Set(["Fragment","React.Fragment"]);l($s,"annotateFile")});var Ic,an=P(()=>{"use strict";Ic=Object.freeze({$unresolved:!0})});function Pc(t){let e=(0,Hs.createRequire)(__tempoRuntime.sdkModuleUrl("assets/parser.ts"))("@astrojs/compiler-rs").parse(t),r=e.diagnostics.filter(n=>n.severity==="error");if(r.length)throw new Error(r.map(n=>n.text).join(`
123
- `));return e.ast}function Mc(t,e){try{if(t.endsWith(".astro"))return{program:Pc(e).frontmatter?.program??{type:"Program",body:[]},errors:[]};let r=(0,Ds.parseSync)(t,e),n=(r.errors??[]).map(o=>({code:"unparseable_source",severity:"structural",message:o?.message??"Unable to parse asset source",span:Nt(o)??Nt(o?.labels?.[0])}));return n.length>0?{program:null,errors:n}:{program:r.program,errors:[]}}catch(r){return{program:null,errors:[{code:"unparseable_source",severity:"structural",message:r instanceof Error?r.message:"Unable to parse asset source"}]}}}function Nc(t){let e={trustedDefineControlsNames:new Set,trustedDefineAssetNames:new Set,importedBindings:new Map,referenceableImports:new Map,importDeclarationSpans:[],misimports:[]};for(let r of t?.body??[]){if(r?.type!=="ImportDeclaration"||typeof r.source?.value!="string")continue;let n=Nt(r);if(n&&e.importDeclarationSpans.push(n),r.importKind==="type")continue;let o=r.source.value,i=Us(o);for(let s of r.specifiers??[]){if(s?.importKind==="type")continue;let c=s?.local?.name;if(typeof c!="string")continue;if(e.importedBindings.set(c,o),s.type==="ImportDefaultSpecifier"){e.referenceableImports.set(c,{importSpecifier:o,importedName:"default"});continue}if(s.type!=="ImportSpecifier")continue;let a=s.imported?.name??s.imported?.value??c;e.referenceableImports.set(c,{importSpecifier:o,importedName:a}),i&&a==="defineControls"&&e.trustedDefineControlsNames.add(c),a==="defineAsset"&&(i?e.trustedDefineAssetNames.add(c):Oc(o)&&e.misimports.push({source:o,span:Nt(r.source)??n??{start:0,end:0}}))}}return e}function js(t,e,r=Mc(t,e)){let{program:n}=r,o=Nc(n),i=n?$c(n):null,s=new Set;if(t.endsWith(".astro")){for(let c of n?.body??[])if(!(c.type!=="ImportDeclaration"||c.source.value!=="tempo-sdk/astro/controls"||c.importKind==="type"))for(let a of c.specifiers)a.type==="ImportSpecifier"&&a.importKind!=="type"&&(a.imported.name??a.imported.value)==="defineAstroControls"&&s.add(a.local.name)}return(n?.body??[]).flatMap(c=>{let a=c.type==="ExpressionStatement"?c.expression:null;if(a?.type==="CallExpression"&&a.callee.type==="Identifier"&&s.has(a.callee.name)&&a.arguments.length===1)return[{bindingName:"default",exportKind:"default",start:a.start,end:a.end}];if(a?.type!=="CallExpression"||a.callee.type!=="Identifier"||!o.trustedDefineControlsNames?.has(a.callee.name)||a.arguments.length!==2||a.arguments[0]?.type!=="Identifier")return[];let u=a.arguments[0].name,p=o.referenceableImports.get(u),f=i?.bindings.get(u);return!p&&!f?[]:[{bindingName:u,reference:p,exportKind:p?.importedName==="default"?"default":f?.exportKind??"named",start:a.start,end:a.end}]})}function Us(t){return t===Fs||t.endsWith(`/${Fs}`)}function Oc(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Us(t)}function $c(t){let e=new Map,r=new Set,n=new Set,o=new Set,i=l((s,c,a)=>{let u=l(p=>{a==="named"&&n.add(p),a==="default"&&o.add(p)},"markExported");if(s?.type==="FunctionDeclaration"||s?.type==="ClassDeclaration"){let p=s.id?.name;typeof p=="string"&&(e.set(p,{name:p,statementSpan:c,exportKind:"none"}),u(p));return}if(s?.type==="VariableDeclaration")for(let p of s.declarations??[])if(p?.id?.type==="Identifier"){let f=p.id.name;p.init?(e.set(f,{name:f,statementSpan:c,exportKind:"none"}),u(f)):r.add(f)}else Mt(p?.id,r)},"register");for(let s of t?.body??[]){let c=Nt(s)??{start:0,end:0};if(s?.type==="ExportNamedDeclaration"){if(s.declaration&&i(s.declaration,c,"named"),!s.source)for(let a of s.specifiers??[]){if(a?.type!=="ExportSpecifier")continue;let u=a.local?.name;if(typeof u!="string")continue;((a.exported?.name??a.exported?.value)==="default"?o:n).add(u)}continue}if(s?.type==="ExportDefaultDeclaration"){let a=s.declaration;if(a?.type==="FunctionDeclaration"||a?.type==="ClassDeclaration")i(a,c,"default");else{let u=Lc(a);u?.type==="Identifier"&&o.add(u.name)}continue}i(s,c,null)}for(let s of e.values())s.exportKind=o.has(s.name)?"default":n.has(s.name)?"named":"none";return{bindings:e,nonSimpleNames:r}}function Mt(t,e){if(!(!t||typeof t!="object")){if(t.type==="Identifier"&&typeof t.name=="string"){e.add(t.name);return}if(t.type==="ObjectPattern"){for(let r of t.properties??[])Mt(r?.value??r?.argument,e);return}if(t.type==="ArrayPattern"){for(let r of t.elements??[])Mt(r,e);return}if(t.type==="AssignmentPattern"){Mt(t.left,e);return}t.type==="RestElement"&&Mt(t.argument,e)}}function Lc(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function Nt(t){return typeof t?.start=="number"&&Number.isFinite(t.start)&&typeof t?.end=="number"&&Number.isFinite(t.end)?{start:t.start,end:t.end}:void 0}var Ds,Hs,Fs,Vs=P(()=>{Ds=require("oxc-parser"),Hs=require("node:module");an();an();l(Pc,"parseAstroAssetSource");Fs="tempo-sdk/assets";l(Mc,"parseAssetProgram");l(Nc,"readAssetImports");l(js,"parseControlsFile");l(Us,"isTrustedAssetImportSource");l(Oc,"isMisimportedAssetSdkSource");l($c,"collectTopLevelScope");l(Mt,"collectPatternNames");l(Lc,"unwrapTsExpression");l(Nt,"toSourceSpan")});function Bs(t,e,r=!1){let n=t.includes("defineControls")?js(e,t):[];if(!n.length&&!r)return t;for(let{start:o,end:i}of n.reverse())t=t.slice(0,o)+`((dispose) => { if (import.meta.hot && typeof dispose === "function") import.meta.hot.data.__tempoControlsDisposers.push(dispose); })(${t.slice(o,i)})`+t.slice(i);return`if (import.meta.hot) {
122
+ `),r.clients.add(u),a.on("close",()=>{r.clients.delete(u)}),!0):!1},recordHmrError(a){r.setError({type:"compile",message:a?.message??"Unknown error",stack:a?.stack,file:a?.id??a?.loc?.file,frame:a?.frame,plugin:a?.plugin,loc:a?.loc})},hasActiveCompileError:o,recover:i,pollRecovery:l(async a=>{let u=new Map(r.errorFiles.map(f=>[n(he(f)),f]));for(let f of[...s.keys()])u.has(f)||s.delete(f);let p=Date.now();for(let[f,d]of u){let g=s.get(f);if(g&&p<g.nextAttemptAtMs)continue;if(await i(a,d)){s.delete(f);continue}let h=g?.intervalMs??Ml;s.set(f,{nextAttemptAtMs:p+h,intervalMs:Math.min(h*2,$l)})}},"pollCompileErrorRecovery"),reset(){s.clear()}}}function Ll(t){return new Promise((e,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>e(Buffer.concat(n).toString())),t.on("error",r)})}var Rt,Oo,Ml,$l,Fo=M(()=>{Wr();Rt=require("node:fs"),Oo=require("oxc-parser");at();_t();lr();Ml=At;l(Nl,"isSameError");l(Ol,"createErrorServer");l($o,"moduleIdsMatch");$l=3e4;l(Lo,"createCompileErrorStream");l(Ll,"readBody")});function pr(t){return t.trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"")}var Xr,Kr,Do=M(()=>{"use strict";Xr="/__tempo/canvas-host-registration",Kr="x-tempo-canvas-host-registration";l(pr,"normalizeCanvasRegistrationPath")});async function jo(t,e){let r=performance.now(),n=!1,o=setTimeout(()=>{n=!0,e("pending",Math.round(performance.now()-r))},5e3),i=l(s=>{let c=Math.round(performance.now()-r);(n||c>=5e3)&&e(s,c)},"settled");try{let s=await t();return i("ready"),s}catch(s){throw i("error"),s}finally{clearTimeout(o)}}function Uo(){let t=new Map;return l(async function(r,n){let o=(0,Ho.readFileSync)(r,"utf8"),i=t.get(r);if(i?.source===o&&(i.pending||i.current()))return i.result;let s={source:o,pending:!0,current:l(()=>!1,"current"),result:Promise.resolve()};return t.set(r,s),s.result=Promise.resolve().then(async()=>{s.current=await n(),s.pending=!1}).catch(c=>{throw t.get(r)===s&&t.delete(r),c}),s.result},"confirm")}async function Vo(t,e,r,n=1e3){if(!r)return await t,null;let o;try{return await Promise.race([t.then(()=>null),new Promise(i=>{o=setTimeout(()=>i(e()),n)})])}finally{clearTimeout(o)}}var Ho,Bo=M(()=>{Ho=require("node:fs");l(jo,"traceSlowRegistration");l(Uo,"createRegistrationTransforms");l(Vo,"registrationReply")});function Go(t){let e=new Set,r=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")/g;for(let n of t.matchAll(r))try{let o=JSON.parse(n[1]??"");if(typeof o!="string")continue;let i=pr(o);i&&e.add(i)}catch{}return[...e]}async function Dl(t,e){let r=(0,Tt.resolve)(t.config.root,".tempo","tempo-host.tsx"),n;try{n=(0,ze.readFileSync)(r,"utf8")}catch(u){throw new Error(`Canvas host wrapper is unavailable at ${r}: ${u instanceof Error?u.message:String(u)}`)}if(!Go(n).includes(e))throw Object.assign(new Error(`Generated canvas host wrapper does not contain ${JSON.stringify(e)}`),{statusCode:409});let i=(0,ze.realpathSync)(r),s=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")\s*,\s*load:\s*\(\)\s*=>\s*import\(\s*("(?:\\.|[^"\\])*")\s*\)/g,c,a=t.environments?.client??t;for(let u of n.matchAll(s)){if(pr(JSON.parse(u[1]))!==e)continue;let p=await a.pluginContainer.resolveId(JSON.parse(u[2]),r);if(!p)throw new Error(`Cannot resolve canvas ${e}`);let f=he(p.id),d=`/@fs/${f.replace(/^\/+/,"")}`;c=`${Hl(t)}${d.slice(1)}`,await Wo(t,a,(0,ze.realpathSync)(f),f,d);break}return await Wo(t,a,i,r),n.includes("tempo-incremental-canvas-registration")?c:void 0}function Hl(t){let e=t.config.base||"/",r=e.startsWith("/")?e:new URL(e,"http://tempo.invalid").pathname;return r.endsWith("/")?r:`${r}/`}function Xo(t){let e=t.environments?.client?.depsOptimizer;return{status:"compiling",phase:e?.scanProcessing?"scanning":Object.values(e?.metadata.discovered??{}).some(n=>n.processing)?"bundling":"transforming",progress:dr.get(t)??0}}async function Wo(t,e,r,n,o=Fl){let i=zr.get(e);i||(i=Uo(),zr.set(e,i)),await i(r,()=>jo(async()=>{let s=l(()=>e.moduleGraph.getModulesByFile(r)??e.moduleGraph.getModulesByFile(n),"modules");for(let p of s()??[])e.moduleGraph.invalidateModule(p);if(!await e.transformRequest(o))throw new Error(`Vite did not transform ${o} after registration`);await e.waitForRequestsIdle?.();let a=t.environments?.client?.depsOptimizer;await a?.scanProcessing,await Promise.all(Object.values(a?.metadata.discovered??{}).map(p=>p.processing)),a&&await e.transformRequest(o);let u=[...s()??[]].map(p=>[p,p.transformResult]);return()=>u.length>0&&u.every(([p,f])=>f!=null&&s()?.has(p)&&p.transformResult===f)},(s,c)=>{t.config.logger.info(`[tempo] canvas registration ${JSON.stringify({...Xo(t),status:s,module:(0,Tt.relative)(t.config.root,r),elapsedMs:c})}`)}))}function Jo(t){t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Expose-Headers",Kr),t.setHeader(Kr,"1")}function Ko(t,e){if(t.replace(/\\/g,"/")!==e.replace(/\\/g,"/"))return!1;try{return(0,ze.readFileSync)(t,"utf8").includes("tempo-incremental-canvas-registration")}catch{return!1}}function zo(t,e,r,n){let o=(0,Tt.relative)(e.sourceRoot,t).replace(/\\/g,"/"),i;try{i=(0,ze.readFileSync)(e.wrapperPath,"utf8")}catch{return}if(!Go(i).includes(o))return;let s=r.getModulesByFile(e.wrapperPath);if(s?.size){for(let c of s)r.invalidateModule(c);return[...new Set([...n,...s])]}}function qo(t){dr.set(t,0),zr.delete(t.environments?.client??t)}function Yo(t){dr.set(t,(dr.get(t)??0)+1)}function Qo(t,e,r){let n=e.url;return n===Xr&&e.method==="OPTIONS"?(Jo(r),r.writeHead(204,{"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"content-type"}),r.end(),!0):n===Xr&&e.method==="POST"?(Jo(r),jl(e).then(async o=>{let i=JSON.parse(o),s=typeof i.canvasPath=="string"?pr(i.canvasPath):"";if(!s)throw Object.assign(new Error("canvasPath must be a non-empty string"),{statusCode:400});let c,a=await Vo(Dl(t,s).then(u=>{c=u}),()=>Xo(t),i.poll===!0);r.statusCode=a?202:200,r.setHeader("Content-Type","application/json"),r.setHeader("Cache-Control","no-store"),r.end(JSON.stringify(a??{canvasPath:s,...c?{moduleUrl:c}:{}}))}).catch(o=>{r.statusCode=typeof o=="object"&&o!==null&&"statusCode"in o&&typeof o.statusCode=="number"?o.statusCode:500,r.setHeader("Content-Type","text/plain; charset=utf-8"),r.end(o instanceof Error?o.message:String(o))}),!0):!1}function jl(t){return new Promise((e,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>e(Buffer.concat(n).toString())),t.on("error",r)})}var ze,Tt,Fl,zr,dr,Zo=M(()=>{ze=require("node:fs"),Tt=require("node:path");Do();Bo();_t();Fl="/.tempo/tempo-host";l(Go,"readGeneratedCanvasPaths");l(Dl,"synchronizeCanvasHostRegistrationTransform");l(Hl,"viteBasePath");zr=new WeakMap,dr=new WeakMap;l(Xo,"registrationProgress");l(Wo,"retransformCanvasHostWrapper");l(Jo,"writeCanvasRegistrationResponseHeaders");l(Ko,"isIncrementalWrapperFile");l(zo,"withRegisteredCanvasLoader");l(qo,"resetCanvasHostRegistration");l(Yo,"noteCanvasHostRegistrationActivity");l(Qo,"handleCanvasHostRegistrationRequest");l(jl,"readBody")});var es=M(()=>{});var kt=Qe((Vd,ss)=>{"use strict";var ts="[^\\\\/]",Ul="(?=.)",rs="[^/]",qr="(?:\\/|$)",ns="(?:^|\\/)",Yr=`\\.{1,2}${qr}`,Vl="(?!\\.)",Bl=`(?!${ns}${Yr})`,Wl=`(?!\\.{0,1}${qr})`,Jl=`(?!${Yr})`,Gl="[^.\\/]",Xl=`${rs}*?`,Kl="/",os={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:Ul,QMARK:rs,END_ANCHOR:qr,DOTS_SLASH:Yr,NO_DOT:Vl,NO_DOTS:Bl,NO_DOT_SLASH:Wl,NO_DOTS_SLASH:Jl,QMARK_NO_DOT:Gl,STAR:Xl,START_ANCHOR:ns,SEP:Kl},zl={...os,SLASH_LITERAL:"[\\\\/]",QMARK:ts,STAR:`${ts}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},ql={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};ss.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:ql,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?zl:os}}});var It=Qe(ae=>{"use strict";var{REGEX_BACKSLASH:Yl,REGEX_REMOVE_BACKSLASH:Ql,REGEX_SPECIAL_CHARS:Zl,REGEX_SPECIAL_CHARS_GLOBAL:ec}=kt();ae.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ae.hasRegexChars=t=>Zl.test(t);ae.isRegexChar=t=>t.length===1&&ae.hasRegexChars(t);ae.escapeRegex=t=>t.replace(ec,"\\$1");ae.toPosixSlashes=t=>t.replace(Yl,"/");ae.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};ae.removeBackslashes=t=>t.replace(Ql,e=>e==="\\"?"":e);ae.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?ae.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};ae.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};ae.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};ae.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var fs=Qe((Wd,ds)=>{"use strict";var is=It(),{CHAR_ASTERISK:Qr,CHAR_AT:tc,CHAR_BACKWARD_SLASH:lt,CHAR_COMMA:rc,CHAR_DOT:Zr,CHAR_EXCLAMATION_MARK:en,CHAR_FORWARD_SLASH:ps,CHAR_LEFT_CURLY_BRACE:tn,CHAR_LEFT_PARENTHESES:fr,CHAR_LEFT_SQUARE_BRACKET:nc,CHAR_PLUS:oc,CHAR_QUESTION_MARK:as,CHAR_RIGHT_CURLY_BRACE:sc,CHAR_RIGHT_PARENTHESES:ls,CHAR_RIGHT_SQUARE_BRACKET:ic}=kt(),cs=l(t=>t===ps||t===lt,"isPathSeparator"),us=l(t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},"depth"),ac=l((t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.tokens===!0||r.scanToEnd===!0,i=[],s=[],c=[],a=t,u=-1,p=0,f=0,d=!1,g=!1,h=!1,y=!1,v=!1,w=!1,C=!1,x=!1,T=!1,$=!1,k=0,B,O,L={value:"",depth:0,isGlob:!1},S=l(()=>u>=n,"eos"),X=l(()=>a.charCodeAt(u+1),"peek"),H=l(()=>(B=O,a.charCodeAt(++u)),"advance");for(;u<n;){O=H();let V;if(O===lt){C=L.backslashes=!0,O=H(),O===tn&&(w=!0);continue}if(w===!0||O===tn){for(k++;S()!==!0&&(O=H());){if(O===lt){C=L.backslashes=!0,H();continue}if(O===tn){k++;continue}if(w!==!0&&O===Zr&&(O=H())===Zr){if(d=L.isBrace=!0,h=L.isGlob=!0,$=!0,o===!0)continue;break}if(w!==!0&&O===rc){if(d=L.isBrace=!0,h=L.isGlob=!0,$=!0,o===!0)continue;break}if(O===sc&&(k--,k===0)){w=!1,d=L.isBrace=!0,$=!0;break}}if(o===!0)continue;break}if(O===ps){if(i.push(u),s.push(L),L={value:"",depth:0,isGlob:!1},$===!0)continue;if(B===Zr&&u===p+1){p+=2;continue}f=u+1;continue}if(r.noext!==!0&&(O===oc||O===tc||O===Qr||O===as||O===en)===!0&&X()===fr){if(h=L.isGlob=!0,y=L.isExtglob=!0,$=!0,O===en&&u===p&&(T=!0),o===!0){let ee=0;for(;S()!==!0&&(O=H());){if(O===lt){C=L.backslashes=!0,H();continue}if(O===fr){ee++;continue}if(O===ls&&--ee===0){$=!0;break}}continue}break}if(O===Qr){if(B===Qr&&(v=L.isGlobstar=!0),h=L.isGlob=!0,$=!0,o===!0)continue;break}if(O===as){if(h=L.isGlob=!0,$=!0,o===!0)continue;break}if(O===nc){for(;S()!==!0&&(V=H());){if(V===lt){C=L.backslashes=!0,H();continue}if(V===ic){g=L.isBracket=!0,h=L.isGlob=!0,$=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&O===en&&u===p){x=L.negated=!0,p++;continue}if(r.noparen!==!0&&O===fr){if(h=L.isGlob=!0,o===!0){let Z=1;for(;S()!==!0&&(O=H());){if(O===lt){C=L.backslashes=!0,H();continue}if(O===fr){Z++;continue}if(O===ls&&--Z===0){$=!0;break}}continue}break}if(h===!0){if($=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,h=!1);let D=a,b="",E="";p>0&&(b=a.slice(0,p),a=a.slice(p),f-=p),D&&h===!0&&f>0?(D=a.slice(0,f),E=a.slice(f)):h===!0?(D="",E=a):D=a,D&&D!==""&&D!=="/"&&D!==a&&cs(D.charCodeAt(D.length-1))&&(D=D.slice(0,-1)),r.unescape===!0&&(E&&(E=is.removeBackslashes(E)),D&&C===!0&&(D=is.removeBackslashes(D)));let ne={prefix:b,input:t,start:p,base:D,glob:E,isBrace:d,isBracket:g,isGlob:h,isExtglob:y,isGlobstar:v,negated:x,negatedExtglob:T};if(r.tokens===!0&&(ne.maxDepth=0,cs(O)||s.push(L),ne.tokens=s),r.parts===!0||r.tokens===!0){let V;for(let q=0;q<i.length;q++){let ke=V!==void 0?V+1:p,je=i[q],fe=t.slice(ke,je);r.tokens&&(q===0&&p!==0?(s[q].isPrefix=!0,s[q].value=b):s[q].value=fe,us(s[q]),ne.maxDepth+=s[q].depth),je>=p&&(c.push(fe),V=je)}let Z=V!==void 0?V+1:p,ee=t.slice(Z);c.push(ee),r.tokens&&V&&V+1<t.length&&(s[s.length-1].value=ee,us(s[s.length-1]),ne.maxDepth+=s[s.length-1].depth),ne.slashes=i,ne.parts=c}return ne},"scan");ds.exports=ac});var ys=Qe((Gd,hs)=>{"use strict";var Pt=kt(),pe=It(),{MAX_LENGTH:mr,POSIX_REGEX_SOURCE:lc,REGEX_NON_SPECIAL_CHARS:cc,REGEX_SPECIAL_CHARS_BACKREF:uc,REPLACEMENTS:ms}=Pt,pc=l((t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>pe.escapeRegex(o)).join("..")}return r},"expandRange"),ct=l((t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,"syntaxError"),gs=l(t=>{let e=[],r=0,n=0,o=0,i="",s=!1;for(let c of t){if(s===!0){i+=c,s=!1;continue}if(c==="\\"){i+=c,s=!0;continue}if(c==='"'){o=o===1?0:1,i+=c;continue}if(o===0){if(c==="[")r++;else if(c==="]"&&r>0)r--;else if(r===0){if(c==="(")n++;else if(c===")"&&n>0)n--;else if(c==="|"&&n===0){e.push(i),i="";continue}}}i+=c}return e.push(i),e},"splitTopLevel"),dc=l(t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},"isPlainBranch"),nn=l(t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(dc(e))return e.replace(/\\(.)/g,"$1")},"normalizeSimpleBranch"),fc=l(t=>{let e=t.map(nn).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let o=e[r],i=e[n],s=o[0];if(!(!s||o!==s.repeat(o.length)||i!==s.repeat(i.length))&&(o===i||o.startsWith(i)||i.startsWith(o)))return!0}return!1},"hasRepeatedCharPrefixOverlap"),rn=l((t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,o=0,i=!1;for(let s=1;s<t.length;s++){let c=t[s];if(i===!0){i=!1;continue}if(c==="\\"){i=!0;continue}if(c==='"'){o=o===1?0:1;continue}if(o!==1){if(c==="["){r++;continue}if(c==="]"&&r>0){r--;continue}if(!(r>0)){if(c==="("){n++;continue}if(c===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},"parseRepeatedExtglob"),mc=l(t=>`${t.length===1?pe.escapeRegex(t[0]):`[${t.map(r=>pe.escapeRegex(r)).join("")}]`}*`,"buildCharClassStar"),gc=l(t=>{let e=0,r=[];for(;e<t.length;){let n=rn(t.slice(e),!1);if(!n||n.type!=="*")return;let o=gs(n.body).map(s=>s.trim());if(o.length!==1)return;let i=nn(o[0]);if(!i||i.length!==1)return;r.push(i),e+=n.end+1}if(!(r.length<1))return r},"getStarExtglobSequenceChars"),hc=l(t=>{let e=0,r=t.trim(),n=rn(r);for(;n;)e++,r=n.body.trim(),n=rn(r);return e},"repeatedExtglobRecursion"),yc=l((t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Pt.DEFAULT_MAX_EXTGLOB_RECURSION,n=gs(t).map(c=>c.trim());if(n.length>1&&(n.some(c=>c==="")||n.some(c=>/^[*?]+$/.test(c))||fc(n)))return{risky:!0};let o=[],i=!1,s=!0;for(let c of n){let a=gc(c);if(a){i=!0,o.push(...a);continue}let u=nn(c);if(u&&u.length===1){o.push(u);continue}if(s=!1,hc(c)>r)return{risky:!0}}return i?s?{risky:!0,safeOutput:mc([...new Set(o)])}:{risky:!0}:{risky:!1}},"analyzeRepeatedExtglob"),on=l((t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ms[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(mr,r.maxLength):mr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},s=[i],c=r.capture?"":"?:",a=Pt.globChars(r.windows),u=Pt.extglobChars(a),{DOT_LITERAL:p,PLUS_LITERAL:f,SLASH_LITERAL:d,ONE_CHAR:g,DOTS_SLASH:h,NO_DOT:y,NO_DOT_SLASH:v,NO_DOTS_SLASH:w,QMARK:C,QMARK_NO_DOT:x,STAR:T,START_ANCHOR:$}=a,k=l(R=>`(${c}(?:(?!${$}${R.dot?h:p}).)*?)`,"globstar"),B=r.dot?"":y,O=r.dot?C:x,L=r.bash===!0?k(r):T;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let S={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=pe.removePrefix(t,S),o=t.length;let X=[],H=[],D=[],b=i,E,ne=l(()=>S.index===o-1,"eos"),V=S.peek=(R=1)=>t[S.index+R],Z=S.advance=()=>t[++S.index]||"",ee=l(()=>t.slice(S.index+1),"remaining"),q=l((R="",z=0)=>{S.consumed+=R,S.index+=z},"consume"),ke=l(R=>{S.output+=R.output!=null?R.output:R.value,q(R.value)},"append"),je=l(()=>{let R=1;for(;V()==="!"&&(V(2)!=="("||V(3)==="?");)Z(),S.start++,R++;return R%2===0?!1:(S.negated=!0,S.start++,!0)},"negate"),fe=l(R=>{S[R]++,D.push(R)},"increment"),be=l(R=>{S[R]--,D.pop()},"decrement"),j=l(R=>{if(b.type==="globstar"){let z=S.braces>0&&(R.type==="comma"||R.type==="brace"),_=R.extglob===!0||X.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!z&&!_&&(S.output=S.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=L,S.output+=b.output)}if(X.length&&R.type!=="paren"&&(X[X.length-1].inner+=R.value),(R.value||R.output)&&ke(R),b&&b.type==="text"&&R.type==="text"){b.output=(b.output||b.value)+R.value,b.value+=R.value;return}R.prev=b,s.push(R),b=R},"push"),Ie=l((R,z)=>{let _={...u[z],conditions:1,inner:""};_.prev=b,_.parens=S.parens,_.output=S.output,_.startIndex=S.index,_.tokensIndex=s.length;let F=(r.capture?"(":"")+_.open;fe("parens"),j({type:R,value:z,output:S.output?"":g}),j({type:"paren",extglob:!0,value:Z(),output:F}),X.push(_)},"extglobOpen"),Bt=l(R=>{let z=t.slice(R.startIndex,S.index+1),_=t.slice(R.startIndex+2,S.index),F=yc(_,r);if((R.type==="plus"||R.type==="star")&&F.risky){let m=F.safeOutput?(R.output?"":g)+(r.capture?`(${F.safeOutput})`:F.safeOutput):void 0,A=s[R.tokensIndex];A.type="text",A.value=z,A.output=m||pe.escapeRegex(z);for(let N=R.tokensIndex+1;N<s.length;N++)s[N].value="",s[N].output="",delete s[N].suffix;S.output=R.output+A.output,S.backtrack=!0,j({type:"paren",extglob:!0,value:E,output:""}),be("parens");return}let J=R.close+(r.capture?")":""),Y;if(R.type==="negate"){let m=L;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(m=k(r)),(m!==L||ne()||/^\)+$/.test(ee()))&&(J=R.close=`)$))${m}`),R.inner.includes("*")&&(Y=ee())&&/^\.[^\\/.]+$/.test(Y)){let A=on(Y,{...e,fastpaths:!1}).output;J=R.close=`)${A})${m})`}R.prev.type==="bos"&&(S.negatedExtglob=!0)}j({type:"paren",extglob:!0,value:E,output:J}),be("parens")},"extglobClose");if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let R=!1,z=t.replace(uc,(_,F,J,Y,m,A)=>Y==="\\"?(R=!0,_):Y==="?"?F?F+Y+(m?C.repeat(m.length):""):A===0?O+(m?C.repeat(m.length):""):C.repeat(J.length):Y==="."?p.repeat(J.length):Y==="*"?F?F+Y+(m?L:""):L:F?_:`\\${_}`);return R===!0&&(r.unescape===!0?z=z.replace(/\\/g,""):z=z.replace(/\\+/g,_=>_.length%2===0?"\\\\":_?"\\":"")),z===t&&r.contains===!0?(S.output=t,S):(S.output=pe.wrapOutput(z,S,e),S)}for(;!ne();){if(E=Z(),E==="\0")continue;if(E==="\\"){let _=V();if(_==="/"&&r.bash!==!0||_==="."||_===";")continue;if(!_){E+="\\",j({type:"text",value:E});continue}let F=/^\\+/.exec(ee()),J=0;if(F&&F[0].length>2&&(J=F[0].length,S.index+=J,J%2!==0&&(E+="\\")),r.unescape===!0?E=Z():E+=Z(),S.brackets===0){j({type:"text",value:E});continue}}if(S.brackets>0&&(E!=="]"||b.value==="["||b.value==="[^")){if(r.posix!==!1&&E===":"){let _=b.value.slice(1);if(_.includes("[")&&(b.posix=!0,_.includes(":"))){let F=b.value.lastIndexOf("["),J=b.value.slice(0,F),Y=b.value.slice(F+2),m=lc[Y];if(m){b.value=J+m,S.backtrack=!0,Z(),!i.output&&s.indexOf(b)===1&&(i.output=g);continue}}}(E==="["&&V()!==":"||E==="-"&&V()==="]")&&(E=`\\${E}`),E==="]"&&(b.value==="["||b.value==="[^")&&(E=`\\${E}`),r.posix===!0&&E==="!"&&b.value==="["&&(E="^"),b.value+=E,ke({value:E});continue}if(S.quotes===1&&E!=='"'){E=pe.escapeRegex(E),b.value+=E,ke({value:E});continue}if(E==='"'){S.quotes=S.quotes===1?0:1,r.keepQuotes===!0&&j({type:"text",value:E});continue}if(E==="("){fe("parens"),j({type:"paren",value:E});continue}if(E===")"){if(S.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ct("opening","("));let _=X[X.length-1];if(_&&S.parens===_.parens+1){Bt(X.pop());continue}j({type:"paren",value:E,output:S.parens?")":"\\)"}),be("parens");continue}if(E==="["){if(r.nobracket===!0||!ee().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ct("closing","]"));E=`\\${E}`}else fe("brackets");j({type:"bracket",value:E});continue}if(E==="]"){if(r.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){j({type:"text",value:E,output:`\\${E}`});continue}if(S.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ct("opening","["));j({type:"text",value:E,output:`\\${E}`});continue}be("brackets");let _=b.value.slice(1);if(b.posix!==!0&&_[0]==="^"&&!_.includes("/")&&(E=`/${E}`),b.value+=E,ke({value:E}),r.literalBrackets===!1||pe.hasRegexChars(_))continue;let F=pe.escapeRegex(b.value);if(S.output=S.output.slice(0,-b.value.length),r.literalBrackets===!0){S.output+=F,b.value=F;continue}b.value=`(${c}${F}|${b.value})`,S.output+=b.value;continue}if(E==="{"&&r.nobrace!==!0){fe("braces");let _={type:"brace",value:E,output:"(",outputIndex:S.output.length,tokensIndex:S.tokens.length};H.push(_),j(_);continue}if(E==="}"){let _=H[H.length-1];if(r.nobrace===!0||!_){j({type:"text",value:E,output:E});continue}let F=")";if(_.dots===!0){let J=s.slice(),Y=[];for(let m=J.length-1;m>=0&&(s.pop(),J[m].type!=="brace");m--)J[m].type!=="dots"&&Y.unshift(J[m].value);F=pc(Y,r),S.backtrack=!0}if(_.comma!==!0&&_.dots!==!0){let J=S.output.slice(0,_.outputIndex),Y=S.tokens.slice(_.tokensIndex);_.value=_.output="\\{",E=F="\\}",S.output=J;for(let m of Y)S.output+=m.output||m.value}j({type:"brace",value:E,output:F}),be("braces"),H.pop();continue}if(E==="|"){X.length>0&&X[X.length-1].conditions++,j({type:"text",value:E});continue}if(E===","){let _=E,F=H[H.length-1];F&&D[D.length-1]==="braces"&&(F.comma=!0,_="|"),j({type:"comma",value:E,output:_});continue}if(E==="/"){if(b.type==="dot"&&S.index===S.start+1){S.start=S.index+1,S.consumed="",S.output="",s.pop(),b=i;continue}j({type:"slash",value:E,output:d});continue}if(E==="."){if(S.braces>0&&b.type==="dot"){b.value==="."&&(b.output=p);let _=H[H.length-1];b.type="dots",b.output+=E,b.value+=E,_.dots=!0;continue}if(S.braces+S.parens===0&&b.type!=="bos"&&b.type!=="slash"){j({type:"text",value:E,output:p});continue}j({type:"dot",value:E,output:p});continue}if(E==="?"){if(!(b&&b.value==="(")&&r.noextglob!==!0&&V()==="("&&V(2)!=="?"){Ie("qmark",E);continue}if(b&&b.type==="paren"){let F=V(),J=E;(b.value==="("&&!/[!=<:]/.test(F)||F==="<"&&!/<([!=]|\w+>)/.test(ee()))&&(J=`\\${E}`),j({type:"text",value:E,output:J});continue}if(r.dot!==!0&&(b.type==="slash"||b.type==="bos")){j({type:"qmark",value:E,output:x});continue}j({type:"qmark",value:E,output:C});continue}if(E==="!"){if(r.noextglob!==!0&&V()==="("&&(V(2)!=="?"||!/[!=<:]/.test(V(3)))){Ie("negate",E);continue}if(r.nonegate!==!0&&S.index===0){je();continue}}if(E==="+"){if(r.noextglob!==!0&&V()==="("&&V(2)!=="?"){Ie("plus",E);continue}if(b&&b.value==="("||r.regex===!1){j({type:"plus",value:E,output:f});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||S.parens>0){j({type:"plus",value:E});continue}j({type:"plus",value:f});continue}if(E==="@"){if(r.noextglob!==!0&&V()==="("&&V(2)!=="?"){j({type:"at",extglob:!0,value:E,output:""});continue}j({type:"text",value:E});continue}if(E!=="*"){(E==="$"||E==="^")&&(E=`\\${E}`);let _=cc.exec(ee());_&&(E+=_[0],S.index+=_[0].length),j({type:"text",value:E});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=E,b.output=L,S.backtrack=!0,S.globstar=!0,q(E);continue}let R=ee();if(r.noextglob!==!0&&/^\([^?]/.test(R)){Ie("star",E);continue}if(b.type==="star"){if(r.noglobstar===!0){q(E);continue}let _=b.prev,F=_.prev,J=_.type==="slash"||_.type==="bos",Y=F&&(F.type==="star"||F.type==="globstar");if(r.bash===!0&&(!J||R[0]&&R[0]!=="/")){j({type:"star",value:E,output:""});continue}let m=S.braces>0&&(_.type==="comma"||_.type==="brace"),A=X.length&&(_.type==="pipe"||_.type==="paren");if(!J&&_.type!=="paren"&&!m&&!A){j({type:"star",value:E,output:""});continue}for(;R.slice(0,3)==="/**";){let P=t[S.index+4];if(P&&P!=="/")break;R=R.slice(3),q("/**",3)}let N=ne()||S.parens>0&&R===")".repeat(S.parens)&&!X.some(P=>P.type==="negate");if(_.type==="bos"&&ne()){b.type="globstar",b.value+=E,b.output=k(r),S.output=b.output,S.globstar=!0,q(E);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&!Y&&N){S.output=S.output.slice(0,-(_.output+b.output).length),_.output=`(?:${_.output}`,b.type="globstar",b.output=k(r)+(r.strictSlashes?")":"|$)"),b.value+=E,S.globstar=!0,S.output+=_.output+b.output,q(E);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&R[0]==="/"){let P=R[1]!==void 0?"|$":"";S.output=S.output.slice(0,-(_.output+b.output).length),_.output=`(?:${_.output}`,b.type="globstar",b.output=`${k(r)}${d}|${d}${P})`,b.value+=E,S.output+=_.output+b.output,S.globstar=!0,q(E+Z()),j({type:"slash",value:"/",output:""});continue}if(_.type==="bos"&&R[0]==="/"){b.type="globstar",b.value+=E,b.output=`(?:^|${d}|${k(r)}${d})`,S.output=b.output,S.globstar=!0,q(E+Z()),j({type:"slash",value:"/",output:""});continue}S.output=S.output.slice(0,-b.output.length),b.type="globstar",b.output=k(r),b.value+=E,S.output+=b.output,S.globstar=!0,q(E);continue}let z={type:"star",value:E,output:L};if(r.bash===!0){z.output=".*?",(b.type==="bos"||b.type==="slash")&&(z.output=B+z.output),j(z);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&r.regex===!0){z.output=E,j(z);continue}(S.index===S.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(S.output+=v,b.output+=v):r.dot===!0?(S.output+=w,b.output+=w):(S.output+=B,b.output+=B),V()!=="*"&&(S.output+=g,b.output+=g)),j(z)}for(;S.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ct("closing","]"));S.output=pe.escapeLast(S.output,"["),be("brackets")}for(;S.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ct("closing",")"));S.output=pe.escapeLast(S.output,"("),be("parens")}for(;S.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ct("closing","}"));S.output=pe.escapeLast(S.output,"{"),be("braces")}if(r.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&j({type:"maybe_slash",value:"",output:`${d}?`}),S.backtrack===!0){S.output="";for(let R of S.tokens)S.output+=R.output!=null?R.output:R.value,R.suffix&&(S.output+=R.suffix)}return S},"parse");on.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(mr,r.maxLength):mr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=ms[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:c,DOTS_SLASH:a,NO_DOT:u,NO_DOTS:p,NO_DOTS_SLASH:f,STAR:d,START_ANCHOR:g}=Pt.globChars(r.windows),h=r.dot?p:u,y=r.dot?f:u,v=r.capture?"":"?:",w={negated:!1,prefix:""},C=r.bash===!0?".*?":d;r.capture&&(C=`(${C})`);let x=l(B=>B.noglobstar===!0?C:`(${v}(?:(?!${g}${B.dot?a:i}).)*?)`,"globstar"),T=l(B=>{switch(B){case"*":return`${h}${c}${C}`;case".*":return`${i}${c}${C}`;case"*.*":return`${h}${C}${i}${c}${C}`;case"*/*":return`${h}${C}${s}${c}${y}${C}`;case"**":return h+x(r);case"**/*":return`(?:${h}${x(r)}${s})?${y}${c}${C}`;case"**/*.*":return`(?:${h}${x(r)}${s})?${y}${C}${i}${c}${C}`;case"**/.*":return`(?:${h}${x(r)}${s})?${i}${c}${C}`;default:{let O=/^(.*?)\.(\w+)$/.exec(B);if(!O)return;let L=T(O[1]);return L?L+i+O[2]:void 0}}},"create"),$=pe.removePrefix(t,w),k=T($);return k&&r.strictSlashes!==!0&&(k+=`${s}?`),k};hs.exports=on});var bs=Qe((Kd,vs)=>{"use strict";var Sc=fs(),sn=ys(),Ss=It(),vc=kt(),bc=l(t=>t&&typeof t=="object"&&!Array.isArray(t),"isObject"),Q=l((t,e,r=!1)=>{if(Array.isArray(t)){let p=t.map(d=>Q(d,e,r));return l(d=>{for(let g of p){let h=g(d);if(h)return h}return!1},"arrayMatcher")}let n=bc(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=o.windows,s=n?Q.compileRe(t,e):Q.makeRe(t,e,!1,!0),c=s.state;delete s.state;let a=l(()=>!1,"isIgnored");if(o.ignore){let p={...e,ignore:null,onMatch:null,onResult:null};a=Q(o.ignore,p,r)}let u=l((p,f=!1)=>{let{isMatch:d,match:g,output:h}=Q.test(p,s,e,{glob:t,posix:i}),y={glob:t,state:c,regex:s,posix:i,input:p,output:h,match:g,isMatch:d};return typeof o.onResult=="function"&&o.onResult(y),d===!1?(y.isMatch=!1,f?y:!1):a(p)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,f?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),f?y:!0)},"matcher");return r&&(u.state=c),u},"picomatch");Q.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},s=i.format||(o?Ss.toPosixSlashes:null),c=t===n,a=c&&s?s(t):t;return c===!1&&(a=s?s(t):t,c=a===n),(c===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?c=Q.matchBase(t,e,r,o):c=e.exec(a)),{isMatch:!!c,match:c,output:a}};Q.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Q.makeRe(e,r)).test(Ss.basename(t,{windows:n}));Q.isMatch=(t,e,r)=>Q(e,r)(t);Q.parse=(t,e)=>Array.isArray(t)?t.map(r=>Q.parse(r,e)):sn(t,{...e,fastpaths:!1});Q.scan=(t,e)=>Sc(t,e);Q.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",s=o.contains?"":"$",c=`${i}(?:${t.output})${s}`;t&&t.negated===!0&&(c=`^(?!${c}).*$`);let a=Q.toRegex(c,e);return n===!0&&(a.state=t),a};Q.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=sn.fastpaths(t,e)),o.output||(o=sn(t,e)),Q.compileRe(o,e,r,n)};Q.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Q.constants=vc;vs.exports=Q});var xs=Qe((qd,Cs)=>{"use strict";var Es=bs(),Ec=It();function ws(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Ec.isWindows()}),Es(t,e,r)}l(ws,"picomatch");Object.assign(ws,Es);Cs.exports=ws});function wc(t){return Array.isArray(t)}function As(t){return wc(t)?t:t==null?[]:[t]}function xc(t,e){if(e===!1||(0,Te.isAbsolute)(t)||t.startsWith("**"))return gr(t);let r=gr((0,Te.resolve)(e||"")).replace(/[-^$*+?.()|[\]{}]/g,"\\$&");return Te.posix.join(r,gr(t))}var Te,_s,Cc,gr,an,Ac,_c,Rc,ef,Rs=M(()=>{Te=require("path");es();_s=xr(xs(),1);l(wc,"isArray");l(As,"ensureArray");Cc=new RegExp(`\\${Te.win32.sep}`,"g"),gr=l(function(e){return e.replace(Cc,Te.posix.sep)},"normalizePath");l(xc,"getMatcherString");an=l(function(e,r,n){let o=n&&n.resolve,i=l(a=>a instanceof RegExp?a:{test:l(u=>{let p=xc(a,o);return(0,_s.default)(p,{dot:!0})(u)},"test")},"getMatcher"),s=As(e).map(i),c=As(r).map(i);return!s.length&&!c.length?a=>typeof a=="string"&&!a.includes("\0"):l(function(u){if(typeof u!="string"||u.includes("\0"))return!1;let p=gr(u);for(let f=0;f<c.length;++f){let d=c[f];if(d instanceof RegExp&&(d.lastIndex=0),d.test(p))return!1}for(let f=0;f<s.length;++f){let d=s[f];if(d instanceof RegExp&&(d.lastIndex=0),d.test(p))return!0}return!s.length},"result")},"createFilter"),Ac="break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public",_c="arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl",Rc=new Set(`${Ac} ${_c}`.split(" "));Rc.add("");ef="isWellFormed"in String.prototype});var Mt,Ts=M(()=>{"use strict";Mt="tempo-interact-preview"});function ln(t){switch(t.type){case"JSXIdentifier":return t.name;case"JSXNamespacedName":return`${t.namespace.name}:${t.name.name}`;case"JSXMemberExpression":return ks(t)}}function ks(t){return`${t.object.type==="JSXIdentifier"?t.object.name:ks(t.object)}.${t.property.name}`}var Is=M(()=>{"use strict";l(ln,"getTagName");l(ks,"getJSXMemberExpressionName")});function hr(t,e,r=null){if(t==null||typeof t!="object")return;if(Array.isArray(t)){for(let s of t)hr(s,e,r);return}let n=t,o=n.type;typeof o=="string"&&o in e&&e[o](t,r);let i=typeof o=="string"?t:r;for(let s of Object.values(n))s!==null&&typeof s=="object"&&hr(s,e,i)}var Ms,Ps,lf,Ns=M(()=>{"use strict";Ms=xr(require("oxc-parser/src-js/generated/visit/keys.js"),1),Ps=Ms.default,lf=Ps.default??Ps;l(hr,"walk")});function kc(t){let e=Tc.exec(t);if(e)return e[1].toLowerCase()==="c"?{lang:"jsx",sourceType:"commonjs"}:{lang:"jsx"}}function $s(t,e){return(0,Os.parseSync)(t,e,kc(t))}var Os,Tc,Ls=M(()=>{"use strict";Os=require("oxc-parser"),Tc=/\.([cm]?)js$/i;l(kc,"sourceParseOptions");l($s,"parseSourceFile")});function Ic(t){return t===void 0?null:typeof t=="function"?t.toString():JSON.stringify(t)}function Pc(t){return Object.entries(t).map(([e,r])=>{let n=Ic(r);return n===null?null:` ${e}={${n}}`}).filter(e=>e!==null).join("")}function Mc(t){let e=new Set;for(let r of t.openingElement.attributes??[])r.type==="JSXAttribute"&&e.add(ln(r.name));return e}function Nc(t,e){return Object.fromEntries(Object.entries(t).filter(([r])=>!e.has(r)))}function Fs(t,e,r){let n=$s(e,t),o=[],i=new WeakSet,s=l(u=>{for(let p of u.children){let f=ht(p);f&&i.add(f)}},"noteChildren");hr(n.program,{JSXFragment(u){s(u)},JSXElement(u,p){let f=u;s(f);let d=ln(f.openingElement.name);if(Oc.has(d))return;let g=p?.type??null,h=Nc(r({element:f,tagName:d,parentType:g,...i.has(f)?{isStaticJsxChild:!0}:{}}),Mc(f));if(Object.keys(h).length===0)return;let y=f.openingElement,v=y.end-1;if(y.selfClosing)for(v--;v>y.start&&/\s/.test(t[v-1]);)v--;o.push({position:v,text:Pc(h)})}}),o.sort((u,p)=>u.position-p.position);let c=[],a=0;for(let{position:u,text:p}of o)c.push(t.slice(a,u)),c.push(p),a=u;return c.push(t.slice(a)),{annotatedSource:c.join(""),elementsAnnotated:o.length,parseResult:n}}var Oc,Ds=M(()=>{"use strict";Is();Ns();Jt();Ls();l(Ic,"formatPropValue");l(Pc,"formatProps");l(Mc,"getExistingAttributeNames");l(Nc,"removeExistingProps");Oc=new Set(["Fragment","React.Fragment"]);l(Fs,"annotateFile")});var $c,cn=M(()=>{"use strict";$c=Object.freeze({$unresolved:!0})});function Lc(t){let e=(0,Us.createRequire)(__tempoRuntime.sdkModuleUrl("assets/parser.ts"))("@astrojs/compiler-rs").parse(t),r=e.diagnostics.filter(n=>n.severity==="error");if(r.length)throw new Error(r.map(n=>n.text).join(`
123
+ `));return e.ast}function Fc(t,e){try{if(t.endsWith(".astro"))return{program:Lc(e).frontmatter?.program??{type:"Program",body:[]},errors:[]};let r=(0,js.parseSync)(t,e),n=(r.errors??[]).map(o=>({code:"unparseable_source",severity:"structural",message:o?.message??"Unable to parse asset source",span:Ot(o)??Ot(o?.labels?.[0])}));return n.length>0?{program:null,errors:n}:{program:r.program,errors:[]}}catch(r){return{program:null,errors:[{code:"unparseable_source",severity:"structural",message:r instanceof Error?r.message:"Unable to parse asset source"}]}}}function Dc(t){let e={trustedDefineControlsNames:new Set,trustedDefineAssetNames:new Set,importedBindings:new Map,referenceableImports:new Map,importDeclarationSpans:[],misimports:[]};for(let r of t?.body??[]){if(r?.type!=="ImportDeclaration"||typeof r.source?.value!="string")continue;let n=Ot(r);if(n&&e.importDeclarationSpans.push(n),r.importKind==="type")continue;let o=r.source.value,i=Bs(o);for(let s of r.specifiers??[]){if(s?.importKind==="type")continue;let c=s?.local?.name;if(typeof c!="string")continue;if(e.importedBindings.set(c,o),s.type==="ImportDefaultSpecifier"){e.referenceableImports.set(c,{importSpecifier:o,importedName:"default"});continue}if(s.type!=="ImportSpecifier")continue;let a=s.imported?.name??s.imported?.value??c;e.referenceableImports.set(c,{importSpecifier:o,importedName:a}),i&&a==="defineControls"&&e.trustedDefineControlsNames.add(c),a==="defineAsset"&&(i?e.trustedDefineAssetNames.add(c):Hc(o)&&e.misimports.push({source:o,span:Ot(r.source)??n??{start:0,end:0}}))}}return e}function Vs(t,e,r=Fc(t,e)){let{program:n}=r,o=Dc(n),i=n?jc(n):null,s=new Set;if(t.endsWith(".astro")){for(let c of n?.body??[])if(!(c.type!=="ImportDeclaration"||c.source.value!=="tempo-sdk/astro/controls"||c.importKind==="type"))for(let a of c.specifiers)a.type==="ImportSpecifier"&&a.importKind!=="type"&&(a.imported.name??a.imported.value)==="defineAstroControls"&&s.add(a.local.name)}return(n?.body??[]).flatMap(c=>{let a=c.type==="ExpressionStatement"?c.expression:null;if(a?.type==="CallExpression"&&a.callee.type==="Identifier"&&s.has(a.callee.name)&&a.arguments.length===1)return[{bindingName:"default",exportKind:"default",start:a.start,end:a.end}];if(a?.type!=="CallExpression"||a.callee.type!=="Identifier"||!o.trustedDefineControlsNames?.has(a.callee.name)||a.arguments.length!==2||a.arguments[0]?.type!=="Identifier")return[];let u=a.arguments[0].name,p=o.referenceableImports.get(u),f=i?.bindings.get(u);return!p&&!f?[]:[{bindingName:u,reference:p,exportKind:p?.importedName==="default"?"default":f?.exportKind??"named",start:a.start,end:a.end}]})}function Bs(t){return t===Hs||t.endsWith(`/${Hs}`)}function Hc(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Bs(t)}function jc(t){let e=new Map,r=new Set,n=new Set,o=new Set,i=l((s,c,a)=>{let u=l(p=>{a==="named"&&n.add(p),a==="default"&&o.add(p)},"markExported");if(s?.type==="FunctionDeclaration"||s?.type==="ClassDeclaration"){let p=s.id?.name;typeof p=="string"&&(e.set(p,{name:p,statementSpan:c,exportKind:"none"}),u(p));return}if(s?.type==="VariableDeclaration")for(let p of s.declarations??[])if(p?.id?.type==="Identifier"){let f=p.id.name;p.init?(e.set(f,{name:f,statementSpan:c,exportKind:"none"}),u(f)):r.add(f)}else Nt(p?.id,r)},"register");for(let s of t?.body??[]){let c=Ot(s)??{start:0,end:0};if(s?.type==="ExportNamedDeclaration"){if(s.declaration&&i(s.declaration,c,"named"),!s.source)for(let a of s.specifiers??[]){if(a?.type!=="ExportSpecifier")continue;let u=a.local?.name;if(typeof u!="string")continue;((a.exported?.name??a.exported?.value)==="default"?o:n).add(u)}continue}if(s?.type==="ExportDefaultDeclaration"){let a=s.declaration;if(a?.type==="FunctionDeclaration"||a?.type==="ClassDeclaration")i(a,c,"default");else{let u=Uc(a);u?.type==="Identifier"&&o.add(u.name)}continue}i(s,c,null)}for(let s of e.values())s.exportKind=o.has(s.name)?"default":n.has(s.name)?"named":"none";return{bindings:e,nonSimpleNames:r}}function Nt(t,e){if(!(!t||typeof t!="object")){if(t.type==="Identifier"&&typeof t.name=="string"){e.add(t.name);return}if(t.type==="ObjectPattern"){for(let r of t.properties??[])Nt(r?.value??r?.argument,e);return}if(t.type==="ArrayPattern"){for(let r of t.elements??[])Nt(r,e);return}if(t.type==="AssignmentPattern"){Nt(t.left,e);return}t.type==="RestElement"&&Nt(t.argument,e)}}function Uc(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function Ot(t){return typeof t?.start=="number"&&Number.isFinite(t.start)&&typeof t?.end=="number"&&Number.isFinite(t.end)?{start:t.start,end:t.end}:void 0}var js,Us,Hs,Ws=M(()=>{js=require("oxc-parser"),Us=require("node:module");cn();cn();l(Lc,"parseAstroAssetSource");Hs="tempo-sdk/assets";l(Fc,"parseAssetProgram");l(Dc,"readAssetImports");l(Vs,"parseControlsFile");l(Bs,"isTrustedAssetImportSource");l(Hc,"isMisimportedAssetSdkSource");l(jc,"collectTopLevelScope");l(Nt,"collectPatternNames");l(Uc,"unwrapTsExpression");l(Ot,"toSourceSpan")});function Js(t,e,r=!1){let n=t.includes("defineControls")?Vs(e,t):[];if(!n.length&&!r)return t;for(let{start:o,end:i}of n.reverse())t=t.slice(0,o)+`((dispose) => { if (import.meta.hot && typeof dispose === "function") import.meta.hot.data.__tempoControlsDisposers.push(dispose); })(${t.slice(o,i)})`+t.slice(i);return`if (import.meta.hot) {
124
124
  for (const dispose of import.meta.hot.data.__tempoControlsDisposers ?? []) dispose();
125
125
  import.meta.hot.data.__tempoControlsDisposers = [];
126
126
  import.meta.hot.dispose(() => {
@@ -128,17 +128,17 @@ if (import.meta.hot) {
128
128
  import.meta.hot.data.__tempoControlsDisposers = [];
129
129
  });
130
130
  }
131
- ${t}`}var Ws=P(()=>{Vs();l(Bs,"transformControlsForHmr")});function Ot(t){let e=ze.default.resolve(t);try{return mr.realpathSync.native(e)}catch(r){let n=r.code;if(n!=="ENOENT"&&n!=="ENOTDIR")throw r;let o=!1;try{o=(0,mr.lstatSync)(e).isSymbolicLink()}catch(s){if(s.code!=="ENOENT"&&s.code!=="ENOTDIR")throw s}if(o)throw r;let i=ze.default.dirname(e);if(i===e)throw r;return ze.default.join(Ot(i),ze.default.basename(e))}}function Js(t,e,r){return`${ze.default.relative(Ot(t),Ot(e)).split(ze.default.sep).join("/")}#${r}`}var mr,ze,Gs=P(()=>{Xt();mr=require("node:fs"),ze=wr(require("node:path"),1);l(Ot,"canonicalPathAllowMissing");l(Js,"flutterPreviewKey")});function Fc(t,e,r){let n=r?.get(e),o=n?.startsWith("\0tempo:astro-component:")?decodeURIComponent(n.slice(23,-3)):n,i=o===void 0?e:o.replace(/\bt=\d{13}&?\b/,"").replace(/[?&]$/,"");if(i.startsWith("\0"))return i;let s=i.search(/[?#]/),c=(s<0?i:i.slice(0,s)).replace(/\\/g,"/"),a=s<0||i.endsWith(".astro?tempo-component")?"":i.slice(s);if(o===void 0&&c.startsWith(".")&&(c=(0,pe.resolve)((0,pe.dirname)(t),c)),!(0,pe.isAbsolute)(c)&&!/^[A-Za-z]:\//.test(c))return i;if(o!==void 0)try{c=Ks.realpathSync.native(c)}catch{}return(0,pe.normalize)(c).replace(/\\/g,"/")+a}function zs(t,e,r,n){let o=new Map;if(!e.includes("tempo-sdk/canvas"))return o;let i=nt(t,e);for(let s of i.storyboards){if(s.kind!=="component"||s.openingElementSpan===void 0)continue;let c=s.preview?vt(s.preview):null;if(c&&!("error"in c)&&n){let h;try{let y=(0,pe.resolve)((0,pe.dirname)(Ot(t)),c.file);h=Js(n,y,c.functionName)}catch{continue}o.set(s.openingElementSpan.start,{[Vn]:h,[Xs]:JSON.stringify(["flutter",h.slice(0,h.lastIndexOf("#")),c.functionName]),"data-tempo-external-component":"true"});continue}let a=s.component;if(!a?.localName)continue;let u=a.expression.match(/^\s*([$\w]+)(?:\s*\.\s*([$\w]+))?\s*$/);if(!u)continue;let p;if(a.import)if(a.import.kind==="namespace"){if(!u[2])continue;p=u[2]}else{if(u[2])continue;p=a.import.importedName}else{if(u[2])continue;p=a.localName}let f=a.import?.source.replace(/\\/g,"/").replace(/[?#].*/,""),d=pe.posix.dirname(t.replace(/\\/g,"/")),g=f!==void 0&&(!f.startsWith(".")||!pe.posix.join(d,f).startsWith(`${d}/`));o.set(s.openingElementSpan.start,{[Xs]:JSON.stringify([a.import?"import":"local",Fc(t,a.import?.source??t,r),p]),...g?{"data-tempo-external-component":"true"}:{}})}return o}var Ks,pe,Xs,qs=P(()=>{Ks=require("node:fs"),pe=require("node:path");Xt();Gs();Qt();Xs="data-tempo-component-reference";l(Fc,"moduleIdentity");l(zs,"canvasComponentAnnotations")});function ln(t){let e=/\bexport\s+default\s+/.exec(t);if(!e)return null;let r=t.slice(e.index+e[0].length),n=Dc.exec(r);if(n)return{kind:"function",name:n[1]??null};let o=Hc.exec(r);if(o)return{kind:"class",name:o[1]??null};if(jc.test(r))return{kind:"function",name:null};let i=Uc.exec(r);return i?{kind:"identifier",name:i[1]}:null}function Qs(t,e){return t?t.name===null?!0:!e||t.name===e.name?!1:Ys(t)&&Ys(e):!1}function Ys(t){return t.name===null||/^[A-Z]/.test(t.name)}var Dc,Hc,jc,Uc,Zs=P(()=>{Dc=/^(?:async\s+)?function(?:\s*\*)?(?:\s+([A-Za-z_$][\w$]*))?\s*\(/,Hc=/^(?:abstract\s+)?class(?:\s+([A-Za-z_$][\w$]*))?(?=[\s{])/,jc=/^(?:async\s+)?(?:\([^()]*\)|[A-Za-z_$][\w$]*)\s*=>/,Uc=/^([A-Za-z_$][\w$]*)[ \t]*(?:;|\r?\n|$)/;l(ln,"readDefaultExportIdentity");l(Qs,"isDefaultExportIdentityRewrite");l(Ys,"isComponentShaped")});function ti(t){let e=new Set;function r(c,a){let u=Bs(c,a,e.has(a));return u!==c&&e.add(a),u}l(r,"transformControls");let n=new Map,o=l(c=>{let a=me(c);try{return ae.realpathSync.native(a)}catch{return a.replace(/\\/g,"/")}},"canonicalIdentityKey");async function i(c,a,u){let p=t.transformsControls(u)?r(a,u):a,f=t.stampedFilepath(u);if(f===null)return p!==a?{code:p,map:null}:null;try{let d=(0,ae.openSync)(u,"r"),g;try{let U=(0,ae.fstatSync)(d),F=(0,ae.readFileSync)(d,"utf8");g={before:U,rawSource:F,after:(0,ae.fstatSync)(d)}}finally{(0,ae.closeSync)(d)}let{before:h,after:y,rawSource:v}=g,w=["mtimeMs","ctimeMs","size","ino","dev"],x=a===v?a:void 0;if(x===void 0&&typeof c.getCombinedSourcemap=="function")try{let U=c.getCombinedSourcemap(),F=U.sourceRoot,b=U.sources.flatMap((E,te)=>{let W=E.startsWith("file:")?(0,ei.fileURLToPath)(E):E,Q=(0,ct.isAbsolute)(W)?W:(0,ct.resolve)((0,ct.dirname)(u),typeof F=="string"?F:"",W),Z=Ve(Q).replace(/\\/g,"/")===u.replace(/\\/g,"/");if(!Z)try{Z=ae.realpathSync.native(Q)===ae.realpathSync.native(u)}catch{}return Z&&typeof U.sourcesContent?.[te]=="string"?[U.sourcesContent[te]]:[]});b.length===1&&(x=b[0])}catch{}let A=x===v&&w.every(U=>h[U]===y[U]),T=A?Math.trunc(h.mtimeMs):0,O=A?Ee(v):"",M=o(u);n.has(M)||n.set(M,ln(v));let B=new Map;if(a.includes("tempo-sdk/canvas")&&typeof c.resolve=="function"){let U=nt(u,a).storyboards.flatMap(F=>F.component?.import?.source??[]);await Promise.all([...new Set(U)].map(async F=>{let b=await c.resolve(F,u,{skipSelf:!0});b&&B.set(F,b.id)}))}let L=zs(u,a,B,t.flutterHostRoot?.()),$=$s(a,u,U=>{let F={...L.get(U.element.openingElement.start),..._o({info:U,filepath:f,modifiedtsMs:T,sourceVersion:O,computeAnnotatedProps:t.computeAnnotatedProps})};return A||(delete F["data-tempo-filepath"],delete F["data-tempo-position"],delete F["data-tempo-source-tag"],delete F["data-tempo-expr"],delete F["data-tempo-expr-children"],delete F["data-tempo-modifiedts"],delete F["data-tempo-source-version"]),F});if($.parseResult.errors.length>0)return null;let S=$.elementsAnnotated===0?a:$.annotatedSource,J=t.transformsControls(u)?r(S,u):S;return{code:A?ar(J,f,T,O):J,map:null}}catch{return null}}l(i,"annotateJsxModule");async function s(c){let{file:a}=c,u=o(a);if(!n.has(u))return!1;let p;try{p=(0,ae.readFileSync)(a,"utf8"),p.length===0&&(p=await c.read())}catch{return!1}let f=n.get(u);if(f===void 0)return!1;let d=ln(p);return n.set(u,d),Qs(f,d)}return l(s,"defaultExportIdentityRewritten"),{annotateJsxModule:i,defaultExportIdentityRewritten:s,forgetDefaultExportIdentity(c){n.delete(o(c))}}}var ae,ct,ei,ri=P(()=>{ae=require("node:fs"),ct=require("node:path"),ei=require("node:url");Ls();Ge();it();Ws();qs();Qt();Zs();At();l(ti,"createJsxModuleAnnotation")});function ii(t){return si.has((0,ut.extname)(t))&&!qe(t)}function $t(t){return Vc.test(t)}function qe(t){return t.replace(/\\/g,"/").includes("/node_modules/")}function ai(t){let e=new WeakMap,r=new Map;function n(i,s,c,a){let u=/[?#]/.test(s);a&&!u&&(0,ut.isAbsolute)(s)&&si.has((0,ut.extname)(s))&&!qe(s)&&!t.skips(s)&&e.set(i,{id:s,code:c})}return l(n,"noteChainInput"),{noteChainInput:n,plugin:{name:"tempo-module-version-records",apply:"serve",load:{order:"pre",handler(i,s){return oi(this,s)&&ni(i)&&r.set(i,Date.now()),null}},transform:{order:"post",handler(i,s,c){let a=e.get(this);if(a&&e.delete(this),!(oi(this,c)&&ni(s)))return null;let p=r.get(s)??null;if(r.delete(s),$t(s)&&!i.includes(Bc))return null;let f=t.stampedFilepath(s),d=i,g=a?.id===s?Jc(s):null;return a&&g&&g.text===a.code&&(d=ar(d,f,Math.trunc(g.mtimeMs),Ee(a.code))),{code:Wc(d,f,p),map:null}}}}}}function ni(t){return(0,ut.isAbsolute)(t)&&!/[?#]/.test(t)&&!qe(t)}function oi(t,e){let r=t.environment?.config?.consumer;return r?r==="client":e?.ssr!==!0}function Wc(t,e,r){let n=`[${JSON.stringify(e)}, Date.now(), ${r??"null"}]`;return`${t}
131
+ ${t}`}var Gs=M(()=>{Ws();l(Js,"transformControlsForHmr")});function $t(t){let e=qe.default.resolve(t);try{return yr.realpathSync.native(e)}catch(r){let n=r.code;if(n!=="ENOENT"&&n!=="ENOTDIR")throw r;let o=!1;try{o=(0,yr.lstatSync)(e).isSymbolicLink()}catch(s){if(s.code!=="ENOENT"&&s.code!=="ENOTDIR")throw s}if(o)throw r;let i=qe.default.dirname(e);if(i===e)throw r;return qe.default.join($t(i),qe.default.basename(e))}}function Xs(t,e,r){return`${qe.default.relative($t(t),$t(e)).split(qe.default.sep).join("/")}#${r}`}var yr,qe,Ks=M(()=>{qt();yr=require("node:fs"),qe=xr(require("node:path"),1);l($t,"canonicalPathAllowMissing");l(Xs,"flutterPreviewKey")});function Vc(t,e,r){let n=r?.get(e),o=n?.startsWith("\0tempo:astro-component:")?decodeURIComponent(n.slice(23,-3)):n,i=o===void 0?e:o.replace(/\bt=\d{13}&?\b/,"").replace(/[?&]$/,"");if(i.startsWith("\0"))return i;let s=i.search(/[?#]/),c=(s<0?i:i.slice(0,s)).replace(/\\/g,"/"),a=s<0||i.endsWith(".astro?tempo-component")?"":i.slice(s);if(o===void 0&&c.startsWith(".")&&(c=(0,de.resolve)((0,de.dirname)(t),c)),!(0,de.isAbsolute)(c)&&!/^[A-Za-z]:\//.test(c))return i;if(o!==void 0)try{c=qs.realpathSync.native(c)}catch{}return(0,de.normalize)(c).replace(/\\/g,"/")+a}function Ys(t,e,r,n){let o=new Map;if(!e.includes("tempo-sdk/canvas"))return o;let i=ot(t,e);for(let s of i.storyboards){if(s.kind!=="component"||s.openingElementSpan===void 0)continue;let c=s.preview?bt(s.preview):null;if(c&&!("error"in c)&&n){let h;try{let y=(0,de.resolve)((0,de.dirname)($t(t)),c.file);h=Xs(n,y,c.functionName)}catch{continue}o.set(s.openingElementSpan.start,{[Wn]:h,[zs]:JSON.stringify(["flutter",h.slice(0,h.lastIndexOf("#")),c.functionName]),"data-tempo-external-component":"true"});continue}let a=s.component;if(!a?.localName)continue;let u=a.expression.match(/^\s*([$\w]+)(?:\s*\.\s*([$\w]+))?\s*$/);if(!u)continue;let p;if(a.import)if(a.import.kind==="namespace"){if(!u[2])continue;p=u[2]}else{if(u[2])continue;p=a.import.importedName}else{if(u[2])continue;p=a.localName}let f=a.import?.source.replace(/\\/g,"/").replace(/[?#].*/,""),d=de.posix.dirname(t.replace(/\\/g,"/")),g=f!==void 0&&(!f.startsWith(".")||!de.posix.join(d,f).startsWith(`${d}/`));o.set(s.openingElementSpan.start,{[zs]:JSON.stringify([a.import?"import":"local",Vc(t,a.import?.source??t,r),p]),...g?{"data-tempo-external-component":"true"}:{}})}return o}var qs,de,zs,Qs=M(()=>{qs=require("node:fs"),de=require("node:path");qt();Ks();tr();zs="data-tempo-component-reference";l(Vc,"moduleIdentity");l(Ys,"canvasComponentAnnotations")});function un(t){let e=/\bexport\s+default\s+/.exec(t);if(!e)return null;let r=t.slice(e.index+e[0].length),n=Bc.exec(r);if(n)return{kind:"function",name:n[1]??null};let o=Wc.exec(r);if(o)return{kind:"class",name:o[1]??null};if(Jc.test(r))return{kind:"function",name:null};let i=Gc.exec(r);return i?{kind:"identifier",name:i[1]}:null}function ei(t,e){return t?t.name===null?!0:!e||t.name===e.name?!1:Zs(t)&&Zs(e):!1}function Zs(t){return t.name===null||/^[A-Z]/.test(t.name)}var Bc,Wc,Jc,Gc,ti=M(()=>{Bc=/^(?:async\s+)?function(?:\s*\*)?(?:\s+([A-Za-z_$][\w$]*))?\s*\(/,Wc=/^(?:abstract\s+)?class(?:\s+([A-Za-z_$][\w$]*))?(?=[\s{])/,Jc=/^(?:async\s+)?(?:\([^()]*\)|[A-Za-z_$][\w$]*)\s*=>/,Gc=/^([A-Za-z_$][\w$]*)[ \t]*(?:;|\r?\n|$)/;l(un,"readDefaultExportIdentity");l(ei,"isDefaultExportIdentityRewrite");l(Zs,"isComponentShaped")});function ni(t){let e=new Set;function r(c,a){let u=Js(c,a,e.has(a));return u!==c&&e.add(a),u}l(r,"transformControls");let n=new Map,o=l(c=>{let a=he(c);try{return le.realpathSync.native(a)}catch{return a.replace(/\\/g,"/")}},"canonicalIdentityKey");async function i(c,a,u){let p=t.transformsControls(u)?r(a,u):a,f=t.stampedFilepath(u);if(f===null)return p!==a?{code:p,map:null}:null;try{let d=(0,le.openSync)(u,"r"),g;try{let H=(0,le.fstatSync)(d),D=(0,le.readFileSync)(d,"utf8");g={before:H,rawSource:D,after:(0,le.fstatSync)(d)}}finally{(0,le.closeSync)(d)}let{before:h,after:y,rawSource:v}=g,w=["mtimeMs","ctimeMs","size","ino","dev"],C=a===v?a:void 0;if(C===void 0&&typeof c.getCombinedSourcemap=="function")try{let H=c.getCombinedSourcemap(),D=H.sourceRoot,b=H.sources.flatMap((E,ne)=>{let V=E.startsWith("file:")?(0,ri.fileURLToPath)(E):E,Z=(0,ut.isAbsolute)(V)?V:(0,ut.resolve)((0,ut.dirname)(u),typeof D=="string"?D:"",V),ee=We(Z).replace(/\\/g,"/")===u.replace(/\\/g,"/");if(!ee)try{ee=le.realpathSync.native(Z)===le.realpathSync.native(u)}catch{}return ee&&typeof H.sourcesContent?.[ne]=="string"?[H.sourcesContent[ne]]:[]});b.length===1&&(C=b[0])}catch{}let x=C===v&&w.every(H=>h[H]===y[H]),T=x?Math.trunc(h.mtimeMs):0,$=x?Ce(v):"",k=o(u);n.has(k)||n.set(k,un(v));let B=new Map;if(a.includes("tempo-sdk/canvas")&&typeof c.resolve=="function"){let H=ot(u,a).storyboards.flatMap(D=>D.component?.import?.source??[]);await Promise.all([...new Set(H)].map(async D=>{let b=await c.resolve(D,u,{skipSelf:!0});b&&B.set(D,b.id)}))}let O=Ys(u,a,B,t.flutterHostRoot?.()),L=Fs(a,u,H=>{let D={...O.get(H.element.openingElement.start),...To({info:H,filepath:f,modifiedtsMs:T,sourceVersion:$,computeAnnotatedProps:t.computeAnnotatedProps})};return x||(delete D["data-tempo-filepath"],delete D["data-tempo-position"],delete D["data-tempo-source-tag"],delete D["data-tempo-expr"],delete D["data-tempo-expr-children"],delete D["data-tempo-modifiedts"],delete D["data-tempo-source-version"]),D});if(L.parseResult.errors.length>0)return null;let S=L.elementsAnnotated===0?a:L.annotatedSource,X=t.transformsControls(u)?r(S,u):S;return{code:x?ur(X,f,T,$):X,map:null}}catch{return null}}l(i,"annotateJsxModule");async function s(c){let{file:a}=c,u=o(a);if(!n.has(u))return!1;let p;try{p=(0,le.readFileSync)(a,"utf8"),p.length===0&&(p=await c.read())}catch{return!1}let f=n.get(u);if(f===void 0)return!1;let d=un(p);return n.set(u,d),ei(f,d)}return l(s,"defaultExportIdentityRewritten"),{annotateJsxModule:i,defaultExportIdentityRewritten:s,forgetDefaultExportIdentity(c){n.delete(o(c))}}}var le,ut,ri,oi=M(()=>{le=require("node:fs"),ut=require("node:path"),ri=require("node:url");Ds();Xe();at();Gs();Qs();tr();ti();_t();l(ni,"createJsxModuleAnnotation")});function li(t){return ai.has((0,pt.extname)(t))&&!Ye(t)}function Lt(t){return Xc.test(t)}function Ye(t){return t.replace(/\\/g,"/").includes("/node_modules/")}function ci(t){let e=new WeakMap,r=new Map;function n(i,s,c,a){let u=/[?#]/.test(s);a&&!u&&(0,pt.isAbsolute)(s)&&ai.has((0,pt.extname)(s))&&!Ye(s)&&!t.skips(s)&&e.set(i,{id:s,code:c})}return l(n,"noteChainInput"),{noteChainInput:n,plugin:{name:"tempo-module-version-records",apply:"serve",load:{order:"pre",handler(i,s){return ii(this,s)&&si(i)&&r.set(i,Date.now()),null}},transform:{order:"post",handler(i,s,c){let a=e.get(this);if(a&&e.delete(this),!(ii(this,c)&&si(s)))return null;let p=r.get(s)??null;if(r.delete(s),Lt(s)&&!i.includes(Kc))return null;let f=t.stampedFilepath(s),d=i,g=a?.id===s?qc(s):null;return a&&g&&g.text===a.code&&(d=ur(d,f,Math.trunc(g.mtimeMs),Ce(a.code))),{code:zc(d,f,p),map:null}}}}}}function si(t){return(0,pt.isAbsolute)(t)&&!/[?#]/.test(t)&&!Ye(t)}function ii(t,e){let r=t.environment?.config?.consumer;return r?r==="client":e?.ssr!==!0}function zc(t,e,r){let n=`[${JSON.stringify(e)}, Date.now(), ${r??"null"}]`;return`${t}
132
132
  ;typeof window !== "undefined" && (globalThis.__TEMPO_MODULE_EVALUATIONS__ || (globalThis.__TEMPO_MODULE_EVALUATIONS__ = [])).push(${n});
133
- `}function Jc(t){let e;try{e=(0,Fe.openSync)(t,"r")}catch{return null}try{let r=(0,Fe.fstatSync)(e),n=(0,Fe.readFileSync)(e,"utf8"),o=(0,Fe.fstatSync)(e);return r.mtimeMs===o.mtimeMs&&r.size===o.size?{text:n,mtimeMs:r.mtimeMs}:null}catch{return null}finally{(0,Fe.closeSync)(e)}}var Fe,ut,si,Vc,Bc,cn=P(()=>{Fe=require("node:fs"),ut=require("node:path");Ge();it();si=new Set([".js",".mjs",".cjs",".ts",".mts",".cts",".jsx",".tsx",".json",".css",".scss",".sass",".less",".pcss",".postcss"]),Vc=/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/,Bc="__vite__updateStyle";l(ii,"isRecordedModuleFile");l($t,"isCssFile");l(qe,"isInNodeModules");l(ai,"createModuleVersionRecords");l(ni,"isSourceModuleId");l(oi,"isClient");l(Wc,"appendModuleEvaluation");l(Jc,"readStableFile")});function ci(t){if(t.transformResult)return!0;let e=t.invalidationState;return typeof e=="object"&&e!==null}function pi(t,e,r,n){if(e.method!=="GET"||!e.url)return!1;let o=new URL(e.url,"http://tempo.invalid");if(o.pathname!==Gc)return!1;r.setHeader("Content-Type","application/json"),r.setHeader("Cache-Control","no-store"),r.setHeader("Access-Control-Allow-Origin","*"),r.setHeader("Access-Control-Expose-Headers",li),r.setHeader(li,"2");let i=l((a,u)=>{r.statusCode=a,r.end(JSON.stringify(u))},"reply"),s=o.searchParams.get("canvas")??"";if(!(0,Lt.isAbsolute)(s))return i(400,{error:"canvas must be an absolute path"}),!0;let c=Kc(o.searchParams.get("imports"));return c?(zc(t,s,n,c).then(a=>"error"in a?i(404,a):i(200,a)).catch(a=>i(500,{error:a instanceof Error?a.message:String(a)})),!0):(i(400,{error:"imports must be a JSON array of import specifiers"}),!0)}function Kc(t){if(t===null)return null;try{let e=JSON.parse(t);return Array.isArray(e)&&e.length<=512&&e.every(n=>typeof n=="string"&&n.length>0&&n.length<=4096)?e:null}catch{return null}}async function zc(t,e,r,n){let o=t.environments?.client,i=o?.moduleGraph??t.moduleGraph,s=o?.pluginContainer??t.pluginContainer,c=[...i.getModulesByFile(ui(pn(e)))??i.getModulesByFile(ui(e))??[]][0];if(!c)return{error:`canvas is not loaded in the client: ${e}`};let a=c.id??e,u=t.config,p=new Map,f=eu(i,p),d={version:2,stampRoot:r,root:u.root,publicDir:u.publicDir||null,envDir:typeof u.envDir=="string"?u.envDir:u.root,configFile:u.configFile??null,css:f};try{let g=await Qc(i,s,a,n,p);return{...d,files:g,importers:Yc(i,p)}}catch(g){if(!(g instanceof De))throw g;return{...d,importers:{},files:null,reason:g.message}}}function qc(t){let e=new Set,r=new Set(t),n=t.flatMap(o=>[...o.importers]);for(let o=n.pop();o;o=n.pop())r.has(o)||(r.add(o),o.id==null?n.push(...o.importers):o.file&&(0,Lt.isAbsolute)(o.file)&&e.add(pn(o.file)));return[...e].sort()}function Yc(t,e){let r={};for(let[n,o]of e){let i=[...t.getModulesByFile(o)??[]];ii(n)&&i.some(c=>c.id!=null)||(r[n]=qc(i))}return r}async function Qc(t,e,r,n,o){let i=[];for(let u of new Set(n)){let p=await e.resolveId(u,r);if(!p)throw new De(`unresolved:${u}`);if(p.external)throw new De(`external:${p.id}`);if(qe(Ve(p.id)))continue;let f=t.getModuleById(p.id);if(!f||!ci(f))throw new De(`not-loaded:${u}`);i.push(f)}let s=new Set,c=new Set,a=i.map(u=>({module:u,fromCss:!1}));for(let u=a.pop();u;u=a.pop()){let{module:p,fromCss:f}=u;if(c.has(p))continue;c.add(p);let d=p.file;if(f&&!(d&&$t(d)&&!d.includes("*"))||Zc(p))continue;if(!d||d.startsWith("\0")||p.id?.startsWith("\0")||!(0,Lt.isAbsolute)(d))throw new De(`virtual:${p.id??p.url}`);if(qe(d))continue;if(!(p.id==null)&&!ci(p))throw new De(`unsettled:${d}`);let y;try{y=un.realpathSync.native(d)}catch{throw new De(`missing:${d}`)}s.add(y),o.set(y,d);let v=$t(d);for(let w of p.importedModules)a.push({module:w,fromCss:v})}return[...s].sort()}function Zc(t){return Xc.some(e=>t.id?.startsWith(e)===!0||t.url.startsWith(e))}function eu(t,e){let r=new Set;for(let n of t.fileToModulesMap.keys()){if(!($t(n)&&!n.includes("*"))||qe(n)||!(0,Lt.isAbsolute)(n))continue;let i=pn(n);r.add(i),e.set(i,n)}return[...r].sort()}function pn(t){try{return un.realpathSync.native(t)}catch{return t}}function ui(t){return t.replace(/\\/g,"/")}var un,Lt,Gc,li,Xc,De,di=P(()=>{un=require("node:fs"),Lt=require("node:path");it();cn();Gc="/__tempo/storyboard-dependencies",li="x-tempo-storyboard-dependencies";l(ci,"isLoaded");Xc=["/@vite/","\0vite/","/@react-refresh","/@id/__x00__vite","\0commonjsHelpers"],De=class extends Error{static{l(this,"UnprovableClosure")}};l(pi,"handleStoryboardDependenciesRequest");l(Kc,"readSpecifiers");l(zc,"storyboardDependencies");l(qc,"transformedImporters");l(Yc,"unrecordedImporters");l(Qc,"closureFiles");l(Zc,"isRuntimeModule");l(eu,"loadedCssFiles");l(pn,"realPathOr");l(ui,"posixPath")});function fi(){let t=0,e=0,r=new WeakMap;return{observePrune(n,o){let i=++t;for(let s of o){let c=n.urlToModuleMap.get(s);c&&(r.has(c)||e++,r.set(c,i))}},observeRequest(n,o,i,s,c){if(!e||["document","iframe","frame"].includes(String(s)))return;let a=t;return async(u,p,f)=>{if(!e||u<200||u>=400||u!==304&&!/^text\/(?:javascript|css)(?:;|$)/i.test(String(p)))return;let d=u===304?c:f;if(typeof d!="string"||!n.getModuleByEtag(d))return;let g=o;i!=="/"&&g.startsWith(i)&&(g=`/${g.slice(i.length)}`);try{g=decodeURI(g).replace(/__x00__/g,"\0"),g.startsWith("/@id/")&&(g=g.slice(5));let[,h]=await n.resolveUrl(g),y=n.getModuleById(h);y&&y.transformResult?.etag===d&&(r.get(y)??1/0)<=a&&(r.delete(y),e--)}catch{}}},suppressDeletion(n,o){if(!o.length||!o.every(s=>r.has(s)&&s.importers.size===0))return!1;let i=new Set;for(let s of o)n.invalidateModule(s,i);return!0},clear(){r=new WeakMap,e=0}}}var mi=P(()=>{l(fi,"createPrunedModuleDeletionGuard")});function xi(t,e=console){let r=t.TEMPO_FLUTTER_URL?.trim();if(!r)return null;try{let n=new URL(r);if(n.protocol==="http:")return n}catch{}return e.warn(`[tempo] ignoring TEMPO_FLUTTER_URL=${JSON.stringify(r)}: expected an http:// origin such as http://127.0.0.1:<port>`),null}function Ci(t){let e=t.intervalMs??3e3,r=new URL(tu,t.target.origin),n=null,o=!1,i=null;async function s(){try{let c=await fetch(r,{signal:AbortSignal.timeout(e)}),a=c.ok?await c.json():null;if(!o&&a?.status==="ready"&&typeof a.spawn=="number"){let u=n!==null&&a.spawn!==n;n=a.spawn,u&&t.onRelaunch()}}catch{}o||(i=setTimeout(s,e),i.unref?.())}return l(s,"poll"),s(),()=>{o=!0,i&&clearTimeout(i)}}function hi(t){let e=t.slice(dn.length);return e.startsWith("/")?e:`/${e}`}function yi(t){if(!t.startsWith(dn))return!1;let e=t.charAt(dn.length);return e===""||e==="/"||e==="?"}function Ai(t){let{target:e,config:r}=t,n=ru(r),o=!0;function i(){o||(o=!0,r.logger.info(`[tempo] Flutter dev server reachable at ${e.origin}`))}l(i,"noteReachable");function s(u){o&&(o=!1,r.logger.warn(`[tempo] Flutter dev server unreachable at ${e.origin} (${u.code??u.message}); answering 502 until it is up`))}l(s,"noteUnreachable");function c(u,p,f){let d=(0,vi.request)({hostname:e.hostname,port:e.port,method:u.method,path:f,headers:{...Si(u.headers),host:e.host}},g=>{i(),p.writeHead(g.statusCode??502,g.statusMessage,Si(g.headers)),(0,Ei.pipeline)(g,p,()=>{})});d.on("error",g=>{if(p.headersSent||p.destroyed){p.destroy();return}s(g),p.writeHead(502,{"content-type":"application/json"}),p.end(JSON.stringify(gi))}),p.on("close",()=>{p.writableFinished||d.destroy()}),u.pipe(d)}l(c,"forward");function a(u,p,f,d){let g=!1,h=(0,bi.connect)({host:e.hostname,port:Number(e.port)||80},()=>{g=!0,i(),h.write(nu(u,d,e.host)),f.length>0&&h.write(f),h.pipe(p),p.pipe(h)});h.on("error",y=>{if(g){p.destroy();return}s(y);let v=JSON.stringify(gi);p.end(`HTTP/1.1 502 Bad Gateway\r
133
+ `}function qc(t){let e;try{e=(0,De.openSync)(t,"r")}catch{return null}try{let r=(0,De.fstatSync)(e),n=(0,De.readFileSync)(e,"utf8"),o=(0,De.fstatSync)(e);return r.mtimeMs===o.mtimeMs&&r.size===o.size?{text:n,mtimeMs:r.mtimeMs}:null}catch{return null}finally{(0,De.closeSync)(e)}}var De,pt,ai,Xc,Kc,pn=M(()=>{De=require("node:fs"),pt=require("node:path");Xe();at();ai=new Set([".js",".mjs",".cjs",".ts",".mts",".cts",".jsx",".tsx",".json",".css",".scss",".sass",".less",".pcss",".postcss"]),Xc=/\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/,Kc="__vite__updateStyle";l(li,"isRecordedModuleFile");l(Lt,"isCssFile");l(Ye,"isInNodeModules");l(ci,"createModuleVersionRecords");l(si,"isSourceModuleId");l(ii,"isClient");l(zc,"appendModuleEvaluation");l(qc,"readStableFile")});function pi(t){if(t.transformResult)return!0;let e=t.invalidationState;return typeof e=="object"&&e!==null}function fi(t,e,r,n){if(e.method!=="GET"||!e.url)return!1;let o=new URL(e.url,"http://tempo.invalid");if(o.pathname!==Yc)return!1;r.setHeader("Content-Type","application/json"),r.setHeader("Cache-Control","no-store"),r.setHeader("Access-Control-Allow-Origin","*"),r.setHeader("Access-Control-Expose-Headers",ui),r.setHeader(ui,"2");let i=l((a,u)=>{r.statusCode=a,r.end(JSON.stringify(u))},"reply"),s=o.searchParams.get("canvas")??"";if(!(0,Ft.isAbsolute)(s))return i(400,{error:"canvas must be an absolute path"}),!0;let c=Zc(o.searchParams.get("imports"));return c?(eu(t,s,n,c).then(a=>"error"in a?i(404,a):i(200,a)).catch(a=>i(500,{error:a instanceof Error?a.message:String(a)})),!0):(i(400,{error:"imports must be a JSON array of import specifiers"}),!0)}function Zc(t){if(t===null)return null;try{let e=JSON.parse(t);return Array.isArray(e)&&e.length<=512&&e.every(n=>typeof n=="string"&&n.length>0&&n.length<=4096)?e:null}catch{return null}}async function eu(t,e,r,n){let o=t.environments?.client,i=o?.moduleGraph??t.moduleGraph,s=o?.pluginContainer??t.pluginContainer,c=[...i.getModulesByFile(di(fn(e)))??i.getModulesByFile(di(e))??[]][0];if(!c)return{error:`canvas is not loaded in the client: ${e}`};let a=c.id??e,u=t.config,p=new Map,f=su(i,p),d={version:2,stampRoot:r,root:u.root,publicDir:u.publicDir||null,envDir:typeof u.envDir=="string"?u.envDir:u.root,configFile:u.configFile??null,css:f};try{let g=await nu(i,s,a,n,p);return{...d,files:g,importers:ru(i,p)}}catch(g){if(!(g instanceof He))throw g;return{...d,importers:{},files:null,reason:g.message}}}function tu(t){let e=new Set,r=new Set(t),n=t.flatMap(o=>[...o.importers]);for(let o=n.pop();o;o=n.pop())r.has(o)||(r.add(o),o.id==null?n.push(...o.importers):o.file&&(0,Ft.isAbsolute)(o.file)&&e.add(fn(o.file)));return[...e].sort()}function ru(t,e){let r={};for(let[n,o]of e){let i=[...t.getModulesByFile(o)??[]];li(n)&&i.some(c=>c.id!=null)||(r[n]=tu(i))}return r}async function nu(t,e,r,n,o){let i=[];for(let u of new Set(n)){let p=await e.resolveId(u,r);if(!p)throw new He(`unresolved:${u}`);if(p.external)throw new He(`external:${p.id}`);if(Ye(We(p.id)))continue;let f=t.getModuleById(p.id);if(!f||!pi(f))throw new He(`not-loaded:${u}`);i.push(f)}let s=new Set,c=new Set,a=i.map(u=>({module:u,fromCss:!1}));for(let u=a.pop();u;u=a.pop()){let{module:p,fromCss:f}=u;if(c.has(p))continue;c.add(p);let d=p.file;if(f&&!(d&&Lt(d)&&!d.includes("*"))||ou(p))continue;if(!d||d.startsWith("\0")||p.id?.startsWith("\0")||!(0,Ft.isAbsolute)(d))throw new He(`virtual:${p.id??p.url}`);if(Ye(d))continue;if(!(p.id==null)&&!pi(p))throw new He(`unsettled:${d}`);let y;try{y=dn.realpathSync.native(d)}catch{throw new He(`missing:${d}`)}s.add(y),o.set(y,d);let v=Lt(d);for(let w of p.importedModules)a.push({module:w,fromCss:v})}return[...s].sort()}function ou(t){return Qc.some(e=>t.id?.startsWith(e)===!0||t.url.startsWith(e))}function su(t,e){let r=new Set;for(let n of t.fileToModulesMap.keys()){if(!(Lt(n)&&!n.includes("*"))||Ye(n)||!(0,Ft.isAbsolute)(n))continue;let i=fn(n);r.add(i),e.set(i,n)}return[...r].sort()}function fn(t){try{return dn.realpathSync.native(t)}catch{return t}}function di(t){return t.replace(/\\/g,"/")}var dn,Ft,Yc,ui,Qc,He,mi=M(()=>{dn=require("node:fs"),Ft=require("node:path");at();pn();Yc="/__tempo/storyboard-dependencies",ui="x-tempo-storyboard-dependencies";l(pi,"isLoaded");Qc=["/@vite/","\0vite/","/@react-refresh","/@id/__x00__vite","\0commonjsHelpers"],He=class extends Error{static{l(this,"UnprovableClosure")}};l(fi,"handleStoryboardDependenciesRequest");l(Zc,"readSpecifiers");l(eu,"storyboardDependencies");l(tu,"transformedImporters");l(ru,"unrecordedImporters");l(nu,"closureFiles");l(ou,"isRuntimeModule");l(su,"loadedCssFiles");l(fn,"realPathOr");l(di,"posixPath")});function gi(){let t=0,e=0,r=new WeakMap;return{observePrune(n,o){let i=++t;for(let s of o){let c=n.urlToModuleMap.get(s);c&&(r.has(c)||e++,r.set(c,i))}},observeRequest(n,o,i,s,c){if(!e||["document","iframe","frame"].includes(String(s)))return;let a=t;return async(u,p,f)=>{if(!e||u<200||u>=400||u!==304&&!/^text\/(?:javascript|css)(?:;|$)/i.test(String(p)))return;let d=u===304?c:f;if(typeof d!="string"||!n.getModuleByEtag(d))return;let g=o;i!=="/"&&g.startsWith(i)&&(g=`/${g.slice(i.length)}`);try{g=decodeURI(g).replace(/__x00__/g,"\0"),g.startsWith("/@id/")&&(g=g.slice(5));let[,h]=await n.resolveUrl(g),y=n.getModuleById(h);y&&y.transformResult?.etag===d&&(r.get(y)??1/0)<=a&&(r.delete(y),e--)}catch{}}},suppressDeletion(n,o){if(!o.length||!o.every(s=>r.has(s)&&s.importers.size===0))return!1;let i=new Set;for(let s of o)n.invalidateModule(s,i);return!0},clear(){r=new WeakMap,e=0}}}var hi=M(()=>{l(gi,"createPrunedModuleDeletionGuard")});function Ai(t,e=console){let r=t.TEMPO_FLUTTER_URL?.trim();if(!r)return null;try{let n=new URL(r);if(n.protocol==="http:")return n}catch{}return e.warn(`[tempo] ignoring TEMPO_FLUTTER_URL=${JSON.stringify(r)}: expected an http:// origin such as http://127.0.0.1:<port>`),null}function _i(t){let e=t.intervalMs??3e3,r=new URL(iu,t.target.origin),n=null,o=!1,i=null;async function s(){try{let c=await fetch(r,{signal:AbortSignal.timeout(e)}),a=c.ok?await c.json():null;if(!o&&a?.status==="ready"&&typeof a.spawn=="number"){let u=n!==null&&a.spawn!==n;n=a.spawn,u&&t.onRelaunch()}}catch{}o||(i=setTimeout(s,e),i.unref?.())}return l(s,"poll"),s(),()=>{o=!0,i&&clearTimeout(i)}}function Si(t){let e=t.slice(mn.length);return e.startsWith("/")?e:`/${e}`}function vi(t){if(!t.startsWith(mn))return!1;let e=t.charAt(mn.length);return e===""||e==="/"||e==="?"}function Ri(t){let{target:e,config:r}=t,n=au(r),o=!0;function i(){o||(o=!0,r.logger.info(`[tempo] Flutter dev server reachable at ${e.origin}`))}l(i,"noteReachable");function s(u){o&&(o=!1,r.logger.warn(`[tempo] Flutter dev server unreachable at ${e.origin} (${u.code??u.message}); answering 502 until it is up`))}l(s,"noteUnreachable");function c(u,p,f){let d=(0,Ei.request)({hostname:e.hostname,port:e.port,method:u.method,path:f,headers:{...bi(u.headers),host:e.host}},g=>{i(),p.writeHead(g.statusCode??502,g.statusMessage,bi(g.headers)),(0,Ci.pipeline)(g,p,()=>{})});d.on("error",g=>{if(p.headersSent||p.destroyed){p.destroy();return}s(g),p.writeHead(502,{"content-type":"application/json"}),p.end(JSON.stringify(yi))}),p.on("close",()=>{p.writableFinished||d.destroy()}),u.pipe(d)}l(c,"forward");function a(u,p,f,d){let g=!1,h=(0,wi.connect)({host:e.hostname,port:Number(e.port)||80},()=>{g=!0,i(),h.write(lu(u,d,e.host)),f.length>0&&h.write(f),h.pipe(p),p.pipe(h)});h.on("error",y=>{if(g){p.destroy();return}s(y);let v=JSON.stringify(yi);p.end(`HTTP/1.1 502 Bad Gateway\r
134
134
  Content-Type: application/json\r
135
135
  Content-Length: ${Buffer.byteLength(v)}\r
136
136
  Connection: close\r
137
137
  \r
138
- ${v}`)}),h.on("close",()=>{g&&p.destroy()}),p.on("error",()=>h.destroy()),p.on("close",()=>h.destroy())}return l(a,"forwardUpgrade"),{prefix(u,p,f){let d=u.url??"/";if(!yi(d))return f();c(u,p,hi(d))},fallthrough(u,p,f){let d=u.originalUrl??u.url??"/",g=_i(d);if(g===null||g.startsWith("/@")||g.startsWith("/__tempo/")||ou(g)||su(u.headers.accept,g)||iu(r.root,g))return f();c(u,p,d)},upgrade(u,p,f){let d=u.url??"/";if(n(u,d))return;let g=yi(d)?hi(d):d;a(u,p,f,g)}}}function ru(t){let e=t.server.hmr,r=typeof e=="object"&&e.path?We.posix.join(t.base||"/",e.path):null,n=Object.keys(t.server.proxy??{});return(o,i)=>{let s=o.headers["sec-websocket-protocol"]??"";return s.includes("vite-hmr")||s.includes("vite-ping")||r!==null&&_i(i)===r?!0:n.some(c=>c.startsWith("^")?new RegExp(c).test(i):i.startsWith(c))}}function nu(t,e,r){let n=[`${t.method??"GET"} ${e} HTTP/${t.httpVersion}`];for(let o=0;o<t.rawHeaders.length;o+=2){let i=t.rawHeaders[o]??"",s=i.toLowerCase()==="host"?r:t.rawHeaders[o+1];n.push(`${i}: ${s}`)}return`${n.join(`\r
138
+ ${v}`)}),h.on("close",()=>{g&&p.destroy()}),p.on("error",()=>h.destroy()),p.on("close",()=>h.destroy())}return l(a,"forwardUpgrade"),{prefix(u,p,f){let d=u.url??"/";if(!vi(d))return f();c(u,p,Si(d))},fallthrough(u,p,f){let d=u.originalUrl??u.url??"/",g=Ti(d);if(g===null||g.startsWith("/@")||g.startsWith("/__tempo/")||cu(g)||uu(u.headers.accept,g)||pu(r.root,g))return f();c(u,p,d)},upgrade(u,p,f){let d=u.url??"/";if(n(u,d))return;let g=vi(d)?Si(d):d;a(u,p,f,g)}}}function au(t){let e=t.server.hmr,r=typeof e=="object"&&e.path?Ge.posix.join(t.base||"/",e.path):null,n=Object.keys(t.server.proxy??{});return(o,i)=>{let s=o.headers["sec-websocket-protocol"]??"";return s.includes("vite-hmr")||s.includes("vite-ping")||r!==null&&Ti(i)===r?!0:n.some(c=>c.startsWith("^")?new RegExp(c).test(i):i.startsWith(c))}}function lu(t,e,r){let n=[`${t.method??"GET"} ${e} HTTP/${t.httpVersion}`];for(let o=0;o<t.rawHeaders.length;o+=2){let i=t.rawHeaders[o]??"",s=i.toLowerCase()==="host"?r:t.rawHeaders[o+1];n.push(`${i}: ${s}`)}return`${n.join(`\r
139
139
  `)}\r
140
140
  \r
141
- `}function ou(t){return t.replace(/\/+$/,"")==="/tempo-host"}function su(t,e){return!!t?.includes("text/html")&&(0,We.extname)(e)===""}function iu(t,e){return e.split("/").includes("..")?!1:e.endsWith(".html")?(0,gr.existsSync)((0,We.join)(t,e)):e.endsWith("/")?(0,gr.existsSync)((0,We.join)(t,e,"index.html")):(0,gr.existsSync)((0,We.join)(t,`${e}.html`))}function _i(t){try{return decodeURIComponent(new URL(t,"http://host").pathname)}catch{return null}}function Si(t){let e={};for(let[r,n]of Object.entries(t))n===void 0||au.has(r)||(e[r]=n);return e}var gr,vi,bi,We,Ei,dn,gi,wi,tu,au,Ri=P(()=>{gr=require("node:fs"),vi=require("node:http"),bi=require("node:net"),We=require("node:path"),Ei=require("node:stream"),dn="/__tempo/flutter",gi={error:"flutter_unreachable"},wi="**/.flutter-host/**";l(xi,"readFlutterDevServerUrl");tu="/__tempo_flutter_status";l(Ci,"watchFlutterRelaunches");l(hi,"stripFlutterPrefix");l(yi,"isUnderFlutterPrefix");l(Ai,"createFlutterForwarding");l(ru,"createViteUpgradeMatcher");l(nu,"upgradeRequestHead");l(ou,"isCanvasHostPage");l(su,"isHtmlNavigation");l(iu,"rootHasHtmlPage");l(_i,"decodePathname");au=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","proxy-connection","te","trailer","transfer-encoding","upgrade"]);l(Si,"endToEndHeaders")});function lu(t){let e=typeof t.type=="string"?t.type:null,r=typeof t.acceptedPath=="string"?t.acceptedPath:typeof t.path=="string"?t.path:null;return!e||!r?null:`${e}\0${r}`}function Ti(){let t=new Map;return{filter(e){let r=[];for(let n of e){let o=lu(n),i=n.timestamp;if(o===null||typeof i!="number"||!Number.isFinite(i)){r.push(n);continue}let s=t.get(o);s!==void 0&&i<s||((s===void 0||i>s)&&t.set(o,i),r.push(n))}return r},clear(){t.clear()}}}var ki=P(()=>{l(lu,"generationIdentity");l(Ti,"createHmrGenerationFence")});function Ii(t){for(let e of t){if(e.name==="vite:react-refresh"&&e.load&&!hr.has(e)){hr.add(e);let i=e.load,s=typeof i=="function"?i:i.handler,c=l(async function(...a){let u=await s.apply(this,a);if(!u||a[0]!=="/@react-refresh")return u;let p=typeof u=="string"?u:u.code;if(!p||!/\b(?:let|const) allFamiliesByType = new WeakMap\(\)/.test(p)||!p.includes("function performReactRefresh()"))return u;let f=`${p}
141
+ `}function cu(t){return t.replace(/\/+$/,"")==="/tempo-host"}function uu(t,e){return!!t?.includes("text/html")&&(0,Ge.extname)(e)===""}function pu(t,e){return e.split("/").includes("..")?!1:e.endsWith(".html")?(0,Sr.existsSync)((0,Ge.join)(t,e)):e.endsWith("/")?(0,Sr.existsSync)((0,Ge.join)(t,e,"index.html")):(0,Sr.existsSync)((0,Ge.join)(t,`${e}.html`))}function Ti(t){try{return decodeURIComponent(new URL(t,"http://host").pathname)}catch{return null}}function bi(t){let e={};for(let[r,n]of Object.entries(t))n===void 0||du.has(r)||(e[r]=n);return e}var Sr,Ei,wi,Ge,Ci,mn,yi,xi,iu,du,ki=M(()=>{Sr=require("node:fs"),Ei=require("node:http"),wi=require("node:net"),Ge=require("node:path"),Ci=require("node:stream"),mn="/__tempo/flutter",yi={error:"flutter_unreachable"},xi="**/.flutter-host/**";l(Ai,"readFlutterDevServerUrl");iu="/__tempo_flutter_status";l(_i,"watchFlutterRelaunches");l(Si,"stripFlutterPrefix");l(vi,"isUnderFlutterPrefix");l(Ri,"createFlutterForwarding");l(au,"createViteUpgradeMatcher");l(lu,"upgradeRequestHead");l(cu,"isCanvasHostPage");l(uu,"isHtmlNavigation");l(pu,"rootHasHtmlPage");l(Ti,"decodePathname");du=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","proxy-connection","te","trailer","transfer-encoding","upgrade"]);l(bi,"endToEndHeaders")});function fu(t){let e=typeof t.type=="string"?t.type:null,r=typeof t.acceptedPath=="string"?t.acceptedPath:typeof t.path=="string"?t.path:null;return!e||!r?null:`${e}\0${r}`}function Ii(){let t=new Map;return{filter(e){let r=[];for(let n of e){let o=fu(n),i=n.timestamp;if(o===null||typeof i!="number"||!Number.isFinite(i)){r.push(n);continue}let s=t.get(o);s!==void 0&&i<s||((s===void 0||i>s)&&t.set(o,i),r.push(n))}return r},clear(){t.clear()}}}var Pi=M(()=>{l(fu,"generationIdentity");l(Ii,"createHmrGenerationFence")});function Mi(t){for(let e of t){if(e.name==="vite:react-refresh"&&e.load&&!vr.has(e)){vr.add(e);let i=e.load,s=typeof i=="function"?i:i.handler,c=l(async function(...a){let u=await s.apply(this,a);if(!u||a[0]!=="/@react-refresh")return u;let p=typeof u=="string"?u:u.code;if(!p||!/\b(?:let|const) allFamiliesByType = new WeakMap\(\)/.test(p)||!p.includes("function performReactRefresh()"))return u;let f=`${p}
142
142
  const tempoPerformReactRefresh = performReactRefresh;
143
143
  performReactRefresh = () => {
144
144
  const update = tempoPerformReactRefresh();
@@ -147,13 +147,13 @@ performReactRefresh = () => {
147
147
  };
148
148
  globalThis[Symbol.for("tempo.react-refresh.family")] = (type) => allFamiliesByType.get(type);
149
149
  globalThis[Symbol.for("tempo.react-refresh.flush")] = performReactRefresh;
150
- `;return typeof u=="string"?f:{...u,code:f}},"wrapped");e.load=typeof i=="function"?c:{...i,handler:c}}if(e.name!=="vite:react-babel"||!e.transform||hr.has(e))continue;hr.add(e);let r=e.transform,n=typeof r=="function"?r:r.handler,o=l(async function(...i){let s=await n.apply(this,i);if(!s)return s;let c=typeof s=="string"?s:s.code;if(!c)return s;let a=c.replace(/RefreshRuntime\.__hmr_import\(import\.meta\.url\)\.then\(\(currentExports\) => \{\n(\s*RefreshRuntime\.registerExportsForReactRefresh\([^\n]+\);)\n\s*import\.meta\.hot\.accept\(\(nextExports\) => \{([\s\S]*?)\n\s*\}\);\n\s*\}\);/,(u,p,f)=>`const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
150
+ `;return typeof u=="string"?f:{...u,code:f}},"wrapped");e.load=typeof i=="function"?c:{...i,handler:c}}if(e.name!=="vite:react-babel"||!e.transform||vr.has(e))continue;vr.add(e);let r=e.transform,n=typeof r=="function"?r:r.handler,o=l(async function(...i){let s=await n.apply(this,i);if(!s)return s;let c=typeof s=="string"?s:s.code;if(!c)return s;let a=c.replace(/RefreshRuntime\.__hmr_import\(import\.meta\.url\)\.then\(\(currentExports\) => \{\n(\s*RefreshRuntime\.registerExportsForReactRefresh\([^\n]+\);)\n\s*import\.meta\.hot\.accept\(\(nextExports\) => \{([\s\S]*?)\n\s*\}\);\n\s*\}\);/,(u,p,f)=>`const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
151
151
  ${p}
152
152
  return currentExports;
153
153
  });
154
154
  import.meta.hot.accept(async (nextExports) => {
155
155
  const currentExports = await __tempoReactRefreshExports;${f}
156
- });`);return a===c?s:typeof s=="string"?a:{...s,code:a}},"wrapped");e.transform=typeof r=="function"?o:{...r,handler:o}}}var hr,Pi=P(()=>{hr=new WeakSet;l(Ii,"installSynchronousReactRefreshBoundary")});function Ni(){let t=new Map,e=l(r=>{let n=[],o=r,i=!1;for(;;){let s=t.get(o);if(s!==void 0){i=s;break}n.push(o);let c=uu(o);if(c!==void 0){i=c?.name===Mi;break}let a=(0,Ft.dirname)(o);if(a===o)break;o=a}for(let s of n)t.set(s,i);return i},"nearestPackageIsSdk");return r=>{if(r.replace(/\\/g,"/").includes(cu))return!0;let n=r;try{n=yr.realpathSync.native(r)}catch{}return e((0,Ft.dirname)(n))}}function uu(t){let e;try{e=(0,yr.readFileSync)((0,Ft.join)(t,"package.json"),"utf8")}catch{return}try{let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}var yr,Ft,Mi,cu,Oi=P(()=>{yr=require("node:fs"),Ft=require("node:path"),Mi="tempo-sdk",cu=`/node_modules/${Mi}/`;l(Ni,"createSdkFileMatcher");l(uu,"readPackageManifest")});function $i(t){let e=/(const mod = this\.hotModulesMap\.get\(path\);\s*)if \(!mod\)\s*(?:return;|\{\s*return;\s*\})/,r="this.hmrClient.hotModulesMap.set(this.ownerPath, mod);";return!e.test(t)||!t.includes(r)?t:t.replace(e,`$1if (!mod || mod.pendingUpdates) {
156
+ });`);return a===c?s:typeof s=="string"?a:{...s,code:a}},"wrapped");e.transform=typeof r=="function"?o:{...r,handler:o}}}var vr,Ni=M(()=>{vr=new WeakSet;l(Mi,"installSynchronousReactRefreshBoundary")});function $i(){let t=new Map,e=l(r=>{let n=[],o=r,i=!1;for(;;){let s=t.get(o);if(s!==void 0){i=s;break}n.push(o);let c=gu(o);if(c!==void 0){i=c?.name===Oi;break}let a=(0,Dt.dirname)(o);if(a===o)break;o=a}for(let s of n)t.set(s,i);return i},"nearestPackageIsSdk");return r=>{if(r.replace(/\\/g,"/").includes(mu))return!0;let n=r;try{n=br.realpathSync.native(r)}catch{}return e((0,Dt.dirname)(n))}}function gu(t){let e;try{e=(0,br.readFileSync)((0,Dt.join)(t,"package.json"),"utf8")}catch{return}try{let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}var br,Dt,Oi,mu,Li=M(()=>{br=require("node:fs"),Dt=require("node:path"),Oi="tempo-sdk",mu=`/node_modules/${Oi}/`;l($i,"createSdkFileMatcher");l(gu,"readPackageManifest")});function Fi(t){let e=/(const mod = this\.hotModulesMap\.get\(path\);\s*)if \(!mod\)\s*(?:return;|\{\s*return;\s*\})/,r="this.hmrClient.hotModulesMap.set(this.ownerPath, mod);";return!e.test(t)||!t.includes(r)?t:t.replace(e,`$1if (!mod || mod.pendingUpdates) {
157
157
  const pending = mod || {
158
158
  id: path,
159
159
  callbacks: [],
@@ -173,20 +173,20 @@ ${p}
173
173
  });
174
174
  }
175
175
  });
176
- }`)}var Li=P(()=>{l($i,"preservePendingViteModuleUpdates")});function Dt(t){return t.replace(/\\/g,"/")}function Di(t){let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?"":e.slice(r+1).toLowerCase()}function gu(t){let e=Dt(t);return Fi.has(Di(e))?!pu.some(r=>e.includes(r)):!1}function hu(t){if(t.includes("*"))return!0;let e=Di(Dt(t));return e!==""&&e!=="css"&&Fi.has(e)}function yu(t,e){if(t.deps===null)return!1;let r=Dt(e),n=!1;for(let o of t.deps){let i=Dt(o);if(i===r)return!1;!n&&hu(i)&&(n=!0)}return n}function Hi(t){let e=t.debounceMs??du,r=t.maxPokesPerPair??fu,n=new Set,o=new Map,i=new Set,s=null,c=Number.NEGATIVE_INFINITY,a=!1,u=l(()=>{s=null,c=Date.now(),i.clear();let p=[...n];n.clear();for(let f of p)t.emitChange(f)},"flush");return{handleWatcherFile(p){if(a||!gu(p))return!1;let f=!1;for(let d of t.listCssEntries()){if(!yu(d,p))continue;let g=`${d.cssFile}\0${Dt(p)}`;if(!i.has(g)){let h=o.get(g)??0;if(h>=r)continue;o.size>=mu&&o.clear(),o.set(g,h+1),i.add(g)}n.add(d.cssFile),f=!0}if(f&&s===null){let g=Date.now()-c>=e?0:e;s=setTimeout(u,g),s.unref?.()}return f},dispose(){a=!0,n.clear(),o.clear(),i.clear(),s!==null&&(clearTimeout(s),s=null)}}}var Fi,pu,du,fu,mu,ji=P(()=>{Fi=new Set(["ts","tsx","js","jsx","mjs","cjs","html","mdx","md","svelte","vue","astro"]),pu=["/node_modules/","/.git/","/.vite/","/.tempo/"],du=100,fu=2,mu=2e4;l(Dt,"normalizeSlashes");l(Di,"fileExtension");l(gu,"isScannableSourceFile");l(hu,"isScanDep");l(yu,"cssEntryNeedsRescanFor");l(Hi,"createTailwindScanNet")});function Ui(t,e){try{let r=_e(t);if(r.kind!=="ok")throw new Error(r.message);let n=se(V(V(r.root.frontmatter)?.program)?.body),o=new Set,i=new Map,s=new Map,c=new Set;for(let d of n){if(d.type==="ImportDeclaration")for(let h of se(d.specifiers)){let y=String(V(h.local)?.name),v=String(V(d.source)?.value),w=h.type==="ImportDefaultSpecifier"?"default":String(V(h.imported)?.name??V(h.imported)?.value);v==="tempo-sdk/astro/controls"&&w==="defineAstroControls"?o.add(y):i.set(y,{source:v,name:w})}let g=d.type==="ExportNamedDeclaration"?V(d.declaration):d;if(g?.type==="VariableDeclaration"&&g.kind==="const")for(let h of se(g.declarations)){let y=V(h.id),v=V(h.init);y?.type==="Identifier"&&v&&s.set(String(y.name),v)}}let a=n.flatMap(d=>{let g=d.type==="ExpressionStatement"?V(d.expression):null;return g?.type==="CallExpression"&&o.has(String(V(g.callee)?.name))?[g]:[]});if(a.length>1)throw new Error("Keep one defineAstroControls declaration in this component");let u=l((d,g=new Set)=>{let h=Ae(d);if(h.known)return h.value;if(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","ParenthesizedExpression"].includes(d.type))return u(V(d.expression),g);if(d.type==="Identifier"){let y=String(d.name);if(g.has(y))throw new Error(`Controls contain a constant cycle through ${y}`);let v=s.get(y);if(v)return u(v,new Set([...g,y]));let w=i.get(y);if(w){c.add(w.source);let x=e?.(w.source,w.name);if(x!==void 0)return x}throw new Error(`Control value ${y} must resolve to a static constant`)}if(d.type==="ArrayExpression"){if(!Array.isArray(d.elements)||d.elements.some(y=>!V(y)||V(y)?.type==="SpreadElement"))throw new Error("Controls arrays cannot contain holes or spreads");return se(d.elements).map(y=>u(y,g))}if(d.type==="ObjectExpression"){let y=Object.create(null);for(let v of se(d.properties)){let w=V(v.key),x=V(v.value);if(v.type!=="Property"||v.computed||v.method||v.kind!=="init"||!w||!x)throw new Error("Controls require ordinary static object properties");let A=w.type==="Identifier"?w.name:w.value;if(typeof A!="string"&&typeof A!="number")throw new Error("Invalid control property");y[A]=u(x,g)}return y}if(d.type==="MemberExpression"){let y=u(V(d.object),g),v=V(d.property),w=d.computed?u(v,g):String(v.name);if(y&&typeof y=="object"&&(typeof w=="string"||typeof w=="number")&&Object.prototype.hasOwnProperty.call(y,w))return y[w]}throw new Error("Controls must use static values; calls, getters and request data are not evaluated")},"evaluate");if(!a.length)return{kind:"ok",declared:!1,controls:{},dependencies:[]};let p=se(a[0].arguments);if(p.length!==1)throw new Error("defineAstroControls takes one controls object");let f=u(p[0]);if(!f||Array.isArray(f)||typeof f!="object")throw new Error("defineAstroControls requires a controls object");return{kind:"ok",declared:!0,controls:f,dependencies:[...c]}}catch(r){return{kind:"error",message:r instanceof Error?r.message:String(r)}}}var Vi=P(()=>{"use strict";et();l(Ui,"readAstroControls")});var Bi={};Ut(Bi,{readAstroControlsMetadata:()=>Su});async function Su(t,e,r,n=[]){let o=new Set([t]),i=new Set,s=new Map,c=new Map,a=l(async(f,d)=>{let g=`${f}#${d??"controls"}`;if(i.has(g)||i.size>16)return{kind:"error",message:"Controls have cyclic or excessively deep imports"};i.add(g);try{o.add(f),r(f);let h=c.get(f)??(0,Ht.readFileSync)(f,"utf8");if(d!==void 0){if(f.endsWith(".astro")){let x=_e(h);if(x.kind!=="ok"||!x.frontmatter)return{kind:"error",message:"This Astro file has no static exported constant"};h=h.slice(x.frontmatter.contentStart,x.frontmatter.contentEnd)}let y=(0,fn.parseSync)(f.endsWith(".astro")?`${f}.ts`:f,h);if(y.errors.length)return{kind:"error",message:"Controls dependency cannot be parsed"};let v;for(let x of y.program.body){if(x.type==="ExportDefaultDeclaration"&&d==="default"&&(v=h.slice(x.declaration.start,x.declaration.end)),x.type!=="ExportNamedDeclaration")continue;let A=x.declaration;if(A?.type==="VariableDeclaration"&&A.kind==="const")for(let T of A.declarations)T.id.type==="Identifier"&&T.id.name===d&&(v=d);for(let T of x.specifiers){if((T.exported.type==="Identifier"?T.exported.name:T.exported.value)!==d)continue;let M=T.local.type==="Identifier"?T.local.name:T.local.value;if(x.source){let B=await e(x.source.value,f);return B?await a(B,M):{kind:"error",message:`Cannot resolve ${x.source.value}`}}v=M}}if(!v)return{kind:"error",message:`${d} is not a static exported constant`};let w="__tempoReadControls";for(;h.includes(w);)w+="_";h=`---
176
+ }`)}var Di=M(()=>{l(Fi,"preservePendingViteModuleUpdates")});function Ht(t){return/\.html?$/i.test(t)}function ji(t){let e=new Set,r=t.environments?.client?.hot??t.ws,n=r.send.bind(r);return r.send=((...o)=>{let[i]=o;if(!(i?.type==="full-reload"&&(i.path===void 0||i.path==="*")&&e.size>0&&!("triggeredBy"in i)))return n(...o);let[a]=e,u=`/${(0,Hi.relative)(t.config.root,a).replace(/\\/g,"/")}`;return n({...i,path:u})}),{begin(o){Ht(o)&&e.add(o)},finish(o,i,s){setTimeout(()=>e.delete(i),0);let c=new Set;for(let a of o.moduleGraph.getModulesByFile(i)??[])if(!a.id)for(let u of a.importers)(!u.file||!Ht(u.file))&&c.add(u);for(let a of c)o.reloadModule(a).catch(()=>{});return s.filter(a=>a.id)}}}var Hi,Ui=M(()=>{Hi=require("node:path");l(Ht,"isHtmlFile");l(ji,"installHtmlChangeReloads")});function jt(t){return t.replace(/\\/g,"/")}function Bi(t){let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?"":e.slice(r+1).toLowerCase()}function bu(t){let e=jt(t);return Vi.has(Bi(e))?!hu.some(r=>e.includes(r)):!1}function Eu(t){if(t.includes("*"))return!0;let e=Bi(jt(t));return e!==""&&e!=="css"&&Vi.has(e)}function wu(t,e){if(t.deps===null)return!1;let r=jt(e),n=!1;for(let o of t.deps){let i=jt(o);if(i===r)return!1;!n&&Eu(i)&&(n=!0)}return n}function Wi(t){let e=t.debounceMs??yu,r=t.maxPokesPerPair??Su,n=new Set,o=new Map,i=new Set,s=null,c=Number.NEGATIVE_INFINITY,a=!1,u=l(()=>{s=null,c=Date.now(),i.clear();let p=[...n];n.clear();for(let f of p)t.emitChange(f)},"flush");return{handleWatcherFile(p){if(a||!bu(p))return!1;let f=!1;for(let d of t.listCssEntries()){if(!wu(d,p))continue;let g=`${d.cssFile}\0${jt(p)}`;if(!i.has(g)){let h=o.get(g)??0;if(h>=r)continue;o.size>=vu&&o.clear(),o.set(g,h+1),i.add(g)}n.add(d.cssFile),f=!0}if(f&&s===null){let g=Date.now()-c>=e?0:e;s=setTimeout(u,g),s.unref?.()}return f},dispose(){a=!0,n.clear(),o.clear(),i.clear(),s!==null&&(clearTimeout(s),s=null)}}}var Vi,hu,yu,Su,vu,Ji=M(()=>{Vi=new Set(["ts","tsx","js","jsx","mjs","cjs","html","mdx","md","svelte","vue","astro"]),hu=["/node_modules/","/.git/","/.vite/","/.tempo/"],yu=100,Su=2,vu=2e4;l(jt,"normalizeSlashes");l(Bi,"fileExtension");l(bu,"isScannableSourceFile");l(Eu,"isScanDep");l(wu,"cssEntryNeedsRescanFor");l(Wi,"createTailwindScanNet")});function Gi(t,e){try{let r=_e(t);if(r.kind!=="ok")throw new Error(r.message);let n=ie(U(U(r.root.frontmatter)?.program)?.body),o=new Set,i=new Map,s=new Map,c=new Set;for(let d of n){if(d.type==="ImportDeclaration")for(let h of ie(d.specifiers)){let y=String(U(h.local)?.name),v=String(U(d.source)?.value),w=h.type==="ImportDefaultSpecifier"?"default":String(U(h.imported)?.name??U(h.imported)?.value);v==="tempo-sdk/astro/controls"&&w==="defineAstroControls"?o.add(y):i.set(y,{source:v,name:w})}let g=d.type==="ExportNamedDeclaration"?U(d.declaration):d;if(g?.type==="VariableDeclaration"&&g.kind==="const")for(let h of ie(g.declarations)){let y=U(h.id),v=U(h.init);y?.type==="Identifier"&&v&&s.set(String(y.name),v)}}let a=n.flatMap(d=>{let g=d.type==="ExpressionStatement"?U(d.expression):null;return g?.type==="CallExpression"&&o.has(String(U(g.callee)?.name))?[g]:[]});if(a.length>1)throw new Error("Keep one defineAstroControls declaration in this component");let u=l((d,g=new Set)=>{let h=Ae(d);if(h.known)return h.value;if(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","ParenthesizedExpression"].includes(d.type))return u(U(d.expression),g);if(d.type==="Identifier"){let y=String(d.name);if(g.has(y))throw new Error(`Controls contain a constant cycle through ${y}`);let v=s.get(y);if(v)return u(v,new Set([...g,y]));let w=i.get(y);if(w){c.add(w.source);let C=e?.(w.source,w.name);if(C!==void 0)return C}throw new Error(`Control value ${y} must resolve to a static constant`)}if(d.type==="ArrayExpression"){if(!Array.isArray(d.elements)||d.elements.some(y=>!U(y)||U(y)?.type==="SpreadElement"))throw new Error("Controls arrays cannot contain holes or spreads");return ie(d.elements).map(y=>u(y,g))}if(d.type==="ObjectExpression"){let y=Object.create(null);for(let v of ie(d.properties)){let w=U(v.key),C=U(v.value);if(v.type!=="Property"||v.computed||v.method||v.kind!=="init"||!w||!C)throw new Error("Controls require ordinary static object properties");let x=w.type==="Identifier"?w.name:w.value;if(typeof x!="string"&&typeof x!="number")throw new Error("Invalid control property");y[x]=u(C,g)}return y}if(d.type==="MemberExpression"){let y=u(U(d.object),g),v=U(d.property),w=d.computed?u(v,g):String(v.name);if(y&&typeof y=="object"&&(typeof w=="string"||typeof w=="number")&&Object.prototype.hasOwnProperty.call(y,w))return y[w]}throw new Error("Controls must use static values; calls, getters and request data are not evaluated")},"evaluate");if(!a.length)return{kind:"ok",declared:!1,controls:{},dependencies:[]};let p=ie(a[0].arguments);if(p.length!==1)throw new Error("defineAstroControls takes one controls object");let f=u(p[0]);if(!f||Array.isArray(f)||typeof f!="object")throw new Error("defineAstroControls requires a controls object");return{kind:"ok",declared:!0,controls:f,dependencies:[...c]}}catch(r){return{kind:"error",message:r instanceof Error?r.message:String(r)}}}var Xi=M(()=>{"use strict";tt();l(Gi,"readAstroControls")});var Ki={};Wt(Ki,{readAstroControlsMetadata:()=>Cu});async function Cu(t,e,r,n=[]){let o=new Set([t]),i=new Set,s=new Map,c=new Map,a=l(async(f,d)=>{let g=`${f}#${d??"controls"}`;if(i.has(g)||i.size>16)return{kind:"error",message:"Controls have cyclic or excessively deep imports"};i.add(g);try{o.add(f),r(f);let h=c.get(f)??(0,Ut.readFileSync)(f,"utf8");if(d!==void 0){if(f.endsWith(".astro")){let C=_e(h);if(C.kind!=="ok"||!C.frontmatter)return{kind:"error",message:"This Astro file has no static exported constant"};h=h.slice(C.frontmatter.contentStart,C.frontmatter.contentEnd)}let y=(0,gn.parseSync)(f.endsWith(".astro")?`${f}.ts`:f,h);if(y.errors.length)return{kind:"error",message:"Controls dependency cannot be parsed"};let v;for(let C of y.program.body){if(C.type==="ExportDefaultDeclaration"&&d==="default"&&(v=h.slice(C.declaration.start,C.declaration.end)),C.type!=="ExportNamedDeclaration")continue;let x=C.declaration;if(x?.type==="VariableDeclaration"&&x.kind==="const")for(let T of x.declarations)T.id.type==="Identifier"&&T.id.name===d&&(v=d);for(let T of C.specifiers){if((T.exported.type==="Identifier"?T.exported.name:T.exported.value)!==d)continue;let k=T.local.type==="Identifier"?T.local.name:T.local.value;if(C.source){let B=await e(C.source.value,f);return B?await a(B,k):{kind:"error",message:`Cannot resolve ${C.source.value}`}}v=k}}if(!v)return{kind:"error",message:`${d} is not a static exported constant`};let w="__tempoReadControls";for(;h.includes(w);)w+="_";h=`---
177
177
  import { defineAstroControls as ${w} } from "tempo-sdk/astro/controls";
178
178
  ${h}
179
179
  ${w}({value: ${v}});
180
- ---`}for(let y=0;y<64;y++){let v,w=Ui(h,(T,O)=>{let M=`${f}:${T}#${O}`;if(s.has(M))return s.get(M);v??={specifier:T,name:O}});if(!v)return w;let x=await e(v.specifier,f);if(!x||x.startsWith("\0"))return{kind:"error",message:`Cannot statically read controls import ${v.specifier}`};let A=await a(x,v.name);if(A.kind==="error")return A;s.set(`${f}:${v.specifier}#${v.name}`,A.controls.value)}return{kind:"error",message:"Controls exceed the static dependency budget"}}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}finally{i.delete(g)}},"read"),u=await a(t),p=!1;try{for(let f of new Set(n)){if(r(f),o.add(f),!(0,Ht.existsSync)(f))continue;let d=(0,Ht.readFileSync)(f,"utf8"),g=(0,fn.parseSync)(f,d);if(g.errors.length)throw new Error("Shared component controls cannot be parsed");let h=new Set,y=new Set;for(let A of g.program.body)if(A.type==="ImportDeclaration")for(let T of A.specifiers)A.source.value==="tempo-sdk/assets"&&T.type==="ImportSpecifier"&&(T.imported.type==="Identifier"?T.imported.name:T.imported.value)==="defineControls"&&h.add(T.local.name),T.type==="ImportDefaultSpecifier"&&A.source.value.endsWith(".astro?tempo-component")&&await e(A.source.value.replace(/\?tempo-component$/,""),f)===t&&y.add(T.local.name);let v=g.program.body.flatMap(A=>{let T=A.type==="ExpressionStatement"?A.expression:null;return T?.type==="CallExpression"&&T.callee.type==="Identifier"&&h.has(T.callee.name)&&T.arguments[0]?.type==="Identifier"&&y.has(T.arguments[0].name)?[T]:[]});if(!v.length)continue;if(v.length>1||u.kind==="ok"&&u.declared)throw new Error("Keep one controls declaration for this Astro component; remove the duplicate shared declaration");if(u.kind==="error")break;let w=v[0].arguments[1];if(!w)throw new Error("defineControls requires a controls object");let x="__tempoReadSharedControls";for(;d.includes(x);)x+="_";c.set(f,`---
181
- import {defineAstroControls as ${x}} from "tempo-sdk/astro/controls";
180
+ ---`}for(let y=0;y<64;y++){let v,w=Gi(h,(T,$)=>{let k=`${f}:${T}#${$}`;if(s.has(k))return s.get(k);v??={specifier:T,name:$}});if(!v)return w;let C=await e(v.specifier,f);if(!C||C.startsWith("\0"))return{kind:"error",message:`Cannot statically read controls import ${v.specifier}`};let x=await a(C,v.name);if(x.kind==="error")return x;s.set(`${f}:${v.specifier}#${v.name}`,x.controls.value)}return{kind:"error",message:"Controls exceed the static dependency budget"}}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}finally{i.delete(g)}},"read"),u=await a(t),p=!1;try{for(let f of new Set(n)){if(r(f),o.add(f),!(0,Ut.existsSync)(f))continue;let d=(0,Ut.readFileSync)(f,"utf8"),g=(0,gn.parseSync)(f,d);if(g.errors.length)throw new Error("Shared component controls cannot be parsed");let h=new Set,y=new Set;for(let x of g.program.body)if(x.type==="ImportDeclaration")for(let T of x.specifiers)x.source.value==="tempo-sdk/assets"&&T.type==="ImportSpecifier"&&(T.imported.type==="Identifier"?T.imported.name:T.imported.value)==="defineControls"&&h.add(T.local.name),T.type==="ImportDefaultSpecifier"&&x.source.value.endsWith(".astro?tempo-component")&&await e(x.source.value.replace(/\?tempo-component$/,""),f)===t&&y.add(T.local.name);let v=g.program.body.flatMap(x=>{let T=x.type==="ExpressionStatement"?x.expression:null;return T?.type==="CallExpression"&&T.callee.type==="Identifier"&&h.has(T.callee.name)&&T.arguments[0]?.type==="Identifier"&&y.has(T.arguments[0].name)?[T]:[]});if(!v.length)continue;if(v.length>1||u.kind==="ok"&&u.declared)throw new Error("Keep one controls declaration for this Astro component; remove the duplicate shared declaration");if(u.kind==="error")break;let w=v[0].arguments[1];if(!w)throw new Error("defineControls requires a controls object");let C="__tempoReadSharedControls";for(;d.includes(C);)C+="_";c.set(f,`---
181
+ import {defineAstroControls as ${C}} from "tempo-sdk/astro/controls";
182
182
  ${d}
183
- ${x}(${d.slice(w.start,w.end)});
184
- ---`),u=await a(f),p=!0}}catch(f){u={kind:"error",message:f instanceof Error?f.message:String(f)}}return u.kind==="ok"?{...u.declared?{controls:u.controls,...p?{shared:!0}:{}}:{},dependencies:[...o]}:{error:u.message,dependencies:[...o]}}var Ht,fn,Wi=P(()=>{Ht=require("node:fs");Vi();et();fn=require("oxc-parser");l(Su,"readAstroControlsMetadata")});function Xi(){let t=(0,K.dirname)((0,Qi.fileURLToPath)(Re("index.ts")));for(let e of[(0,K.join)(t,"canvas","interact-projection.ts"),(0,K.join)(t,"canvas","interact-projection.js")])if((0,le.existsSync)(e))return e.replace(/\\/g,"/");return null}function pt(t){return t.replace(/[?#].*$/,"")}function Cu(t){return new URL(t,"http://tempo.local").pathname.replace(/\/+$/,"")==="/tempo-host"}function Au(t){if(!Cu(t))return!1;let e=new URL(t,"http://tempo.local").searchParams,r=e.get("canvasPath")?.trim()??e.get("pageFile")?.trim()??e.get("importPath")?.trim(),n=e.get("storyboardId")?.trim()??e.get("exportName")?.trim()??e.get("importName")?.trim();return!r||!n}function zi(t){return t.startsWith("./")||t.startsWith("../")}function Tu(t){if(!t||t.startsWith(".")||t.startsWith("/")||t.startsWith("\0")||t.startsWith("#")||t.includes(":"))return;let e=t.split("/"),r=t.startsWith("@")?e.length>=2&&e[0]!=="@"&&e[1]?`${e[0]}/${e[1]}`:void 0:e[0];return r&&/^@?[A-Za-z0-9_][A-Za-z0-9._/-]*$/.test(r)?r:void 0}function ku(t,e){let r=me(t);try{return le.realpathSync.native(r)===le.realpathSync.native(e)}catch{return r.replace(/\\/g,"/")===e.replace(/\\/g,"/")}}function qi(t){try{return le.realpathSync.native(t)}catch{return t}}function Iu(t){return/<meta[^>]+name=["']tempo-project-root["'][^>]*>/i.test(t)}function Pu(t){return/<meta[^>]+name=["']tempo-source-identity-root["'][^>]*>/i.test(t)}function Mu(t){return new RegExp(`<meta[^>]+name=["']${ge.TEMPO_WORKSPACE_NONCE_META_NAME}["'][^>]*>`,"i").test(t)}function Nu(t){return(t??[]).some(e=>e.name===ge.TEMPO_VUE_ANNOTATION_PLUGIN_NAME&&e.api?.enabled===!0)}function Ou(t,e,r,n,o,i){let s=n.url;if(!s?.startsWith("/__tempo/"))return i();if(s===ge.TEMPO_HOST_IDENTITY_ENDPOINT&&n.method==="GET"){let c=(0,ge.createTempoHostIdentity)("vite",{root:r.config?.root,pluginActive:!0,...Nu(r.config?.plugins)?{capabilities:{vueSourceAnnotation:1}}:{}});o.statusCode=200,o.setHeader("Cache-Control","no-store"),o.setHeader("Content-Type","application/json; charset=utf-8"),o.setHeader(ge.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),o.end(JSON.stringify(c));return}qo(r,n,o)||pi(r,n,o,e)||t.handleRequest(n,o)||i()}function Lu(t){let e=Hi({listCssEntries:l(function*(){let n=t.moduleGraph?.fileToModulesMap??new Map;for(let[o,i]of n)if(o.endsWith(".css"))for(let s of i){let c=[];for(let a of s.importedModules??[]){let u=a.file??a.url??a.id;u&&c.push(u)}yield{cssFile:o,deps:c}}},"listCssEntries"),emitChange:l(n=>{t.config?.logger?.info?.(`[tempo] new source file outside the Tailwind scan \u2014 re-emitting change: ${n}`,{timestamp:!0}),t.watcher?.emit?.("change",n)},"emitChange")}),r=l(n=>{e.handleWatcherFile(n)},"onWatcherFile");t.watcher?.on?.("add",r),t.watcher?.on?.("change",r),t.httpServer?.once("close",()=>{t.watcher?.off?.("add",r),t.watcher?.off?.("change",r),e.dispose()})}function Zi(t={}){let e=t.enabled??!!process.env.TEMPO,r=e?xi(process.env):null,n=t.include===void 0?vu:t.include,o=t.exclude===void 0?bu:t.exclude,i=Ni(),s=on(n,o),c=l(m=>s(m)&&!i(m),"filter"),a=on(["**/*.tsx","**/*.jsx","**/*.ts","**/*.js"],o),u=l(m=>a(m)&&!i(m),"controlsFilter"),p=new Map,f=l((m,C,N)=>{let I=new Set(N);for(let[j,ne]of p)if(ne.has(m)){let ve=C.getModuleById(j);ve&&(C.invalidateModule(ve),I.add(ve))}return[...I]},"invalidateAstroDescriptors"),d=process.cwd(),g=ti({stampedFilepath:l(m=>c(m)?(0,K.relative)(d,m):null,"stampedFilepath"),transformsControls:u,computeAnnotatedProps:t.computeAnnotatedProps,flutterHostRoot:l(()=>d,"flutterHostRoot")}),h=ai({stampedFilepath:l(m=>(0,K.relative)(d,m),"stampedFilepath"),skips:l(m=>c(m)||i(m),"skips")}),y=d,v="serve",w=!0,x=Oo({onErrorFile:l(m=>E(m),"onErrorFile")}),A=new Map,T,O=new Map,M=!1,B=!1,L=!1,$=null,S=new WeakSet,J=fi(),U=Ti(),F=Po(),b=F.recordCoverage,E=l(m=>{b(m)},"pinErroneousRevisionCoverage"),te=l(async m=>await g.defaultExportIdentityRewritten(m)?(T?.ws.send({type:"full-reload",path:"*"}),!0):!1,"repairDefaultExportIdentityRewrite"),W=l(()=>(0,K.resolve)(d,".tempo","tempo-host.tsx"),"wrapperPath"),Q=l(m=>Go(m,W()),"isIncrementalRegistration"),Z=l((m,C,N)=>Xo(m,{wrapperPath:W(),sourceRoot:y},C,N),"invalidateCanvasLoader"),q=l((m,C,N)=>{let I=`${C}\0${m}`;for(A.delete(I),A.set(I,{specifier:m,importer:C,packageName:N});A.size>_u;){let j=A.keys().next().value;if(j===void 0)break;A.delete(j)}_()},"rememberUnresolvedImport"),ke=l(m=>{for(let[C,N]of A)ku(N.importer,m)&&A.delete(C);_()},"forgetUnresolvedImportsFrom"),we=l(m=>{O.get(m)?.watcher.close(),O.delete(m)},"closeUnresolvedImportWatcher"),xe=l(()=>{$!==null&&(clearTimeout($),$=null)},"cancelUnresolvedImportWatchRearm"),Se=l(()=>{$!==null||!T||A.size===0||($=setTimeout(()=>{$=null,T&&A.size>0&&(_(),H())},Ru),$.unref?.())},"scheduleUnresolvedImportWatchRearm"),D=l(()=>{xe();for(let m of[...O.keys()])we(m)},"closeUnresolvedImportWatchers"),Je=l(()=>[...A.values()].some(m=>m.packageName!==void 0),"hasUnresolvedBarePackages"),br=l(m=>{let C=(0,K.dirname)(pt(m.importer)),N;for(;;){try{if((0,le.statSync)((0,K.join)(C,"node_modules")).isDirectory())return(0,K.join)(C,"node_modules",m.packageName)}catch{}if(N===void 0)try{(0,le.statSync)((0,K.join)(C,"package.json")).isFile()&&(N=C)}catch{}let I=(0,K.dirname)(C);if(I===C)break;C=I}return(0,K.join)(N??d,"node_modules",m.packageName)},"packageWatchTarget"),R=l(m=>m.packageName?br(m):(0,K.resolve)((0,K.dirname)(pt(m.importer)),pt(m.specifier)),"unresolvedImportWatchTarget"),z=l(m=>{let C=m;for(;;){try{if((0,le.statSync)(C).isDirectory())return C}catch{}let N=(0,K.dirname)(C);if(N===C)return;C=N}},"nearestExistingDirectory");function _(){if(!T||A.size===0){D();return}let m=new Map;for(let C of A.values()){let N=R(C),I=z(N);if(!I)continue;let j=m.get(I);m.set(I,{recursive:j?.recursive===!0||I===N})}for(let[C,N]of[...O]){let I=m.get(C);(!I||I.recursive!==N.recursive)&&we(C)}for(let[C,N]of m)if(!O.has(C))try{let I=(0,le.watch)(C,{recursive:N.recursive},H);O.set(C,{watcher:I,recursive:N.recursive}),I.on("error",()=>{we(C),Se()}),N.recursive&&H()}catch{we(C),Se()}[...m.keys()].every(C=>O.has(C))&&xe()}l(_,"syncUnresolvedImportWatcher");function H(){if(M||B){L=!0;return}M=!0,queueMicrotask(()=>{M=!1,X()})}l(H,"scheduleUnresolvedImportResolution");async function X(){let m=T;if(!(!m||B)){B=!0;try{do{L=!1,_();let C=!1;for(let[N,I]of[...A]){let j;if(zi(I.specifier)){let ne=I.specifier.search(/[?#]/),ve=ne<0?I.specifier:I.specifier.slice(0,ne),G=(0,K.resolve)((0,K.dirname)(pt(I.importer)),ve),ce=[G,...Ki.map(de=>`${G}${de}`),...Ki.map(de=>(0,K.join)(G,`index${de}`))];for(let de of ce)try{if((0,le.statSync)(de).isFile()){j=de;break}}catch{}}if(!j&&I.packageName)try{j=(0,Yi.createRequire)(pt(I.importer)).resolve(I.specifier)}catch{}j&&(m.watcher.add(j),A.delete(N),x.errorServer.clearErrorForModules([I.importer]),C=!0)}C&&m.ws.send({type:"full-reload",path:"*"}),_()}while(L)}finally{B=!1}}}return l(X,"runUnresolvedImportResolution"),{name:"tempo-annotate",apply:"serve",enforce:"pre",config(m,C){if(!e||C.command!=="serve")return;xo(m),Co(m);let N=["react","react-dom"].filter(j=>!m.resolve?.dedupe?.includes(j)),I=vo(m.root);return{resolve:{dedupe:N,...I.length?{alias:I}:{}},...m.css?.devSourcemap===void 0?{css:{devSourcemap:!0}}:{},...r&&m.server?.watch!==null?{server:{watch:{ignored:[wi]}}}:{}}},resolveId:{order:"pre",async handler(m,C,N){if(m.endsWith(".astro?tempo-component")){let I=await this.resolve(m.slice(0,-16),C,{...N,skipSelf:!0});return I?`\0tempo:astro-component:${encodeURIComponent(I.id)}.js`:null}if(e&&m===rr)return nr;if(m===Ji)return mn;if(m===Gi&&C===mn){let I=await this.resolve(m,C,{...N,skipSelf:!0});return I||Xi()}if(e&&C&&!C.startsWith("\0")){let I=Tu(m);if(!zi(m)&&!I)return null;try{let j=await this.resolve(m,C,{...N,skipSelf:!0});return j||q(m,C,I),j}catch(j){throw q(m,C,I),j}}return null}},load:{order:"pre",async handler(m){if(m.startsWith("\0tempo:astro-component:")){let C=decodeURIComponent(m.slice(23,-3)),{readAstroControlsMetadata:N}=await Promise.resolve().then(()=>(Wi(),Bi)),I=await N(C,async(j,ne)=>(await this.resolve(j,ne,{skipSelf:!0}))?.id??null,j=>T?.watcher.add(j),[(0,K.resolve)(y,"tempo/controls.ts"),(0,K.resolve)(d,"controls.ts")]);return p.set(m,new Set(I.dependencies)),`export default {kind:"astro-component",module:${JSON.stringify(C.replaceAll("\\","/"))},__tempoAstroControls:${JSON.stringify(I).replaceAll("<","\\u003c")}};`}return e&&m===nr?Ur:m===mn?`import { installTempoInteractProjectionSource } from ${JSON.stringify(Gi)};
183
+ ${C}(${d.slice(w.start,w.end)});
184
+ ---`),u=await a(f),p=!0}}catch(f){u={kind:"error",message:f instanceof Error?f.message:String(f)}}return u.kind==="ok"?{...u.declared?{controls:u.controls,...p?{shared:!0}:{}}:{},dependencies:[...o]}:{error:u.message,dependencies:[...o]}}var Ut,gn,zi=M(()=>{Ut=require("node:fs");Xi();tt();gn=require("oxc-parser");l(Cu,"readAstroControlsMetadata")});function Qi(){let t=(0,K.dirname)((0,na.fileURLToPath)(Re("index.ts")));for(let e of[(0,K.join)(t,"canvas","interact-projection.ts"),(0,K.join)(t,"canvas","interact-projection.js")])if((0,ce.existsSync)(e))return e.replace(/\\/g,"/");return null}function dt(t){return t.replace(/[?#].*$/,"")}function ku(t){return new URL(t,"http://tempo.local").pathname.replace(/\/+$/,"")==="/tempo-host"}function Iu(t){if(!ku(t))return!1;let e=new URL(t,"http://tempo.local").searchParams,r=e.get("canvasPath")?.trim()??e.get("pageFile")?.trim()??e.get("importPath")?.trim(),n=e.get("storyboardId")?.trim()??e.get("exportName")?.trim()??e.get("importName")?.trim();return!r||!n}function ea(t){return t.startsWith("./")||t.startsWith("../")}function Nu(t){if(!t||t.startsWith(".")||t.startsWith("/")||t.startsWith("\0")||t.startsWith("#")||t.includes(":"))return;let e=t.split("/"),r=t.startsWith("@")?e.length>=2&&e[0]!=="@"&&e[1]?`${e[0]}/${e[1]}`:void 0:e[0];return r&&/^@?[A-Za-z0-9_][A-Za-z0-9._/-]*$/.test(r)?r:void 0}function Ou(t,e){let r=he(t);try{return ce.realpathSync.native(r)===ce.realpathSync.native(e)}catch{return r.replace(/\\/g,"/")===e.replace(/\\/g,"/")}}function ta(t){try{return ce.realpathSync.native(t)}catch{return t}}function $u(t){return/<meta[^>]+name=["']tempo-project-root["'][^>]*>/i.test(t)}function Lu(t){return/<meta[^>]+name=["']tempo-source-identity-root["'][^>]*>/i.test(t)}function Fu(t){return new RegExp(`<meta[^>]+name=["']${ye.TEMPO_WORKSPACE_NONCE_META_NAME}["'][^>]*>`,"i").test(t)}function Du(t){return(t??[]).some(e=>e.name===ye.TEMPO_VUE_ANNOTATION_PLUGIN_NAME&&e.api?.enabled===!0)}function Hu(t,e,r,n,o,i){let s=n.url;if(!s?.startsWith("/__tempo/"))return i();if(s===ye.TEMPO_HOST_IDENTITY_ENDPOINT&&n.method==="GET"){let c=(0,ye.createTempoHostIdentity)("vite",{root:r.config?.root,pluginActive:!0,...Du(r.config?.plugins)?{capabilities:{vueSourceAnnotation:1}}:{}});o.statusCode=200,o.setHeader("Cache-Control","no-store"),o.setHeader("Content-Type","application/json; charset=utf-8"),o.setHeader(ye.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),o.end(JSON.stringify(c));return}Qo(r,n,o)||fi(r,n,o,e)||t.handleRequest(n,o)||i()}function Uu(t){let e=Wi({listCssEntries:l(function*(){let n=t.moduleGraph?.fileToModulesMap??new Map;for(let[o,i]of n)if(o.endsWith(".css"))for(let s of i){let c=[];for(let a of s.importedModules??[]){let u=a.file??a.url??a.id;u&&c.push(u)}yield{cssFile:o,deps:c}}},"listCssEntries"),emitChange:l(n=>{t.config?.logger?.info?.(`[tempo] new source file outside the Tailwind scan \u2014 re-emitting change: ${n}`,{timestamp:!0}),t.watcher?.emit?.("change",n)},"emitChange")}),r=l(n=>{e.handleWatcherFile(n)},"onWatcherFile");t.watcher?.on?.("add",r),t.watcher?.on?.("change",r),t.httpServer?.once("close",()=>{t.watcher?.off?.("add",r),t.watcher?.off?.("change",r),e.dispose()})}function oa(t={}){let e=t.enabled??!!process.env.TEMPO,r=e?Ai(process.env):null,n=t.include===void 0?xu:t.include,o=t.exclude===void 0?Au:t.exclude,i=$i(),s=an(n,o),c=l(m=>s(m)&&!i(m),"filter"),a=an(["**/*.tsx","**/*.jsx","**/*.ts","**/*.js"],o),u=l(m=>a(m)&&!i(m),"controlsFilter"),p=new Map,f=l((m,A,N)=>{let P=new Set(N);for(let[W,oe]of p)if(oe.has(m)){let Ee=A.getModuleById(W);Ee&&(A.invalidateModule(Ee),P.add(Ee))}return[...P]},"invalidateAstroDescriptors"),d=process.cwd(),g=ni({stampedFilepath:l(m=>c(m)?(0,K.relative)(d,m):null,"stampedFilepath"),transformsControls:u,computeAnnotatedProps:t.computeAnnotatedProps,flutterHostRoot:l(()=>d,"flutterHostRoot")}),h=ci({stampedFilepath:l(m=>(0,K.relative)(d,m),"stampedFilepath"),skips:l(m=>c(m)||i(m),"skips")}),y=d,v="serve",w=!0,C=Lo({onErrorFile:l(m=>ne(m),"onErrorFile")}),x=new Map,T,$,k=new Map,B=!1,O=!1,L=!1,S=null,X=new WeakSet,H=gi(),D=Ii(),b=No(),E=b.recordCoverage,ne=l(m=>{E(m)},"pinErroneousRevisionCoverage"),V=l(async m=>await g.defaultExportIdentityRewritten(m)?(T?.ws.send({type:"full-reload",path:"*"}),!0):!1,"repairDefaultExportIdentityRewrite"),Z=l(()=>(0,K.resolve)(d,".tempo","tempo-host.tsx"),"wrapperPath"),ee=l(m=>Ko(m,Z()),"isIncrementalRegistration"),q=l((m,A,N)=>zo(m,{wrapperPath:Z(),sourceRoot:y},A,N),"invalidateCanvasLoader"),ke=l((m,A,N)=>{let P=`${A}\0${m}`;for(x.delete(P),x.set(P,{specifier:m,importer:A,packageName:N});x.size>Pu;){let W=x.keys().next().value;if(W===void 0)break;x.delete(W)}F()},"rememberUnresolvedImport"),je=l(m=>{for(let[A,N]of x)Ou(N.importer,m)&&x.delete(A);F()},"forgetUnresolvedImportsFrom"),fe=l(m=>{k.get(m)?.watcher.close(),k.delete(m)},"closeUnresolvedImportWatcher"),be=l(()=>{S!==null&&(clearTimeout(S),S=null)},"cancelUnresolvedImportWatchRearm"),j=l(()=>{S!==null||!T||x.size===0||(S=setTimeout(()=>{S=null,T&&x.size>0&&(F(),J())},Mu),S.unref?.())},"scheduleUnresolvedImportWatchRearm"),Ie=l(()=>{be();for(let m of[...k.keys()])fe(m)},"closeUnresolvedImportWatchers"),Bt=l(()=>[...x.values()].some(m=>m.packageName!==void 0),"hasUnresolvedBarePackages"),R=l(m=>{let A=(0,K.dirname)(dt(m.importer)),N;for(;;){try{if((0,ce.statSync)((0,K.join)(A,"node_modules")).isDirectory())return(0,K.join)(A,"node_modules",m.packageName)}catch{}if(N===void 0)try{(0,ce.statSync)((0,K.join)(A,"package.json")).isFile()&&(N=A)}catch{}let P=(0,K.dirname)(A);if(P===A)break;A=P}return(0,K.join)(N??d,"node_modules",m.packageName)},"packageWatchTarget"),z=l(m=>m.packageName?R(m):(0,K.resolve)((0,K.dirname)(dt(m.importer)),dt(m.specifier)),"unresolvedImportWatchTarget"),_=l(m=>{let A=m;for(;;){try{if((0,ce.statSync)(A).isDirectory())return A}catch{}let N=(0,K.dirname)(A);if(N===A)return;A=N}},"nearestExistingDirectory");function F(){if(!T||x.size===0){Ie();return}let m=new Map;for(let A of x.values()){let N=z(A),P=_(N);if(!P)continue;let W=m.get(P);m.set(P,{recursive:W?.recursive===!0||P===N})}for(let[A,N]of[...k]){let P=m.get(A);(!P||P.recursive!==N.recursive)&&fe(A)}for(let[A,N]of m)if(!k.has(A))try{let P=(0,ce.watch)(A,{recursive:N.recursive},J);k.set(A,{watcher:P,recursive:N.recursive}),P.on("error",()=>{fe(A),j()}),N.recursive&&J()}catch{fe(A),j()}[...m.keys()].every(A=>k.has(A))&&be()}l(F,"syncUnresolvedImportWatcher");function J(){if(B||O){L=!0;return}B=!0,queueMicrotask(()=>{B=!1,Y()})}l(J,"scheduleUnresolvedImportResolution");async function Y(){let m=T;if(!(!m||O)){O=!0;try{do{L=!1,F();let A=!1;for(let[N,P]of[...x]){let W;if(ea(P.specifier)){let oe=P.specifier.search(/[?#]/),Ee=oe<0?P.specifier:P.specifier.slice(0,oe),G=(0,K.resolve)((0,K.dirname)(dt(P.importer)),Ee),ue=[G,...Zi.map(me=>`${G}${me}`),...Zi.map(me=>(0,K.join)(G,`index${me}`))];for(let me of ue)try{if((0,ce.statSync)(me).isFile()){W=me;break}}catch{}}if(!W&&P.packageName)try{W=(0,ra.createRequire)(dt(P.importer)).resolve(P.specifier)}catch{}W&&(m.watcher.add(W),x.delete(N),C.errorServer.clearErrorForModules([P.importer]),A=!0)}A&&m.ws.send({type:"full-reload",path:"*"}),F()}while(L)}finally{O=!1}}}return l(Y,"runUnresolvedImportResolution"),{name:"tempo-annotate",apply:"serve",enforce:"pre",config(m,A){if(!e||A.command!=="serve")return;Ao(m),_o(m);let N=["react","react-dom"].filter(W=>!m.resolve?.dedupe?.includes(W)),P=Eo(m.root);return{resolve:{dedupe:N,...P.length?{alias:P}:{}},...m.css?.devSourcemap===void 0?{css:{devSourcemap:!0}}:{},...r&&m.server?.watch!==null?{server:{watch:{ignored:[xi]}}}:{}}},resolveId:{order:"pre",async handler(m,A,N){if(m.endsWith(".astro?tempo-component")){let P=await this.resolve(m.slice(0,-16),A,{...N,skipSelf:!0});return P?`\0tempo:astro-component:${encodeURIComponent(P.id)}.js`:null}if(e&&m===sr)return ir;if(m===qi)return hn;if(m===Yi&&A===hn){let P=await this.resolve(m,A,{...N,skipSelf:!0});return P||Qi()}if(e&&A&&!A.startsWith("\0")){let P=Nu(m);if(!ea(m)&&!P)return null;try{let W=await this.resolve(m,A,{...N,skipSelf:!0});return W||ke(m,A,P),W}catch(W){throw ke(m,A,P),W}}return null}},load:{order:"pre",async handler(m){if(m.startsWith("\0tempo:astro-component:")){let A=decodeURIComponent(m.slice(23,-3)),{readAstroControlsMetadata:N}=await Promise.resolve().then(()=>(zi(),Ki)),P=await N(A,async(W,oe)=>(await this.resolve(W,oe,{skipSelf:!0}))?.id??null,W=>T?.watcher.add(W),[(0,K.resolve)(y,"tempo/controls.ts"),(0,K.resolve)(d,"controls.ts")]);return p.set(m,new Set(P.dependencies)),`export default {kind:"astro-component",module:${JSON.stringify(A.replaceAll("\\","/"))},__tempoAstroControls:${JSON.stringify(P).replaceAll("<","\\u003c")}};`}return e&&m===ir?Br:m===hn?`import { installTempoInteractProjectionSource } from ${JSON.stringify(Yi)};
185
185
  let stop;
186
186
  const releaseOwner = () => {
187
187
  if (window.__tempoInteractProjectionOwner === "vite") delete window.__tempoInteractProjectionOwner;
188
188
  };
189
- if (window.parent !== window && !window.__tempoInteractProjectionOwner && (window.name === ${JSON.stringify(Pt)} || window.name.startsWith(${JSON.stringify(`${Pt}:`)}))) {
189
+ if (window.parent !== window && !window.__tempoInteractProjectionOwner && (window.name === ${JSON.stringify(Mt)} || window.name.startsWith(${JSON.stringify(`${Mt}:`)}))) {
190
190
  window.__tempoInteractProjectionOwner = "vite";
191
191
  const stopSource = installTempoInteractProjectionSource();
192
192
  stop = () => {
@@ -197,9 +197,9 @@ if (window.parent !== window && !window.__tempoInteractProjectionOwner && (windo
197
197
  if (import.meta.hot) import.meta.hot.dispose(() => {
198
198
  stop?.();
199
199
  releaseOwner();
200
- });`:(!e||v==="build"||m.startsWith("\0")||await F.settled(m),null)}},_tempoErrorServer:x.errorServer,_tempoHotUpdateState:{lastHotUpdateMtimeMs(m){return F.lastHotUpdateMtimeMs(m)}},_tempoUnresolvedImportState:{get size(){return A.size},get barePackageCount(){return[...A.values()].filter(m=>m.packageName!==void 0).length},get hasBarePackageWatcher(){return O.size>0&&Je()},get barePackageWatchPath(){return Je()?O.keys().next().value:void 0},get hasUnresolvedImportWatcher(){return O.size>0},get unresolvedImportWatchPath(){return O.keys().next().value},get unresolvedImportWatchPaths(){return[...O.keys()]},get hasUnresolvedImportWatchRearm(){return $!==null},emitUnresolvedImportWatcherErrorForTesting(){for(let{watcher:m}of O.values())m.emit("error",new Error("Simulated unresolved-import watcher failure"))}},configResolved(m){if(!e)return;v=m.command,w=m.server?.hmr!==!1,v==="serve"&&w&&Ii(m.plugins??[]),d=qi(t.root??m.root);let C=m.plugins;v==="serve"&&Array.isArray(C)&&Object.isExtensible(C)&&!C.includes(h.plugin)&&C.push(h.plugin),y=t.sourceIdentityRoot?qi((0,K.resolve)(m.root,t.sourceIdentityRoot)):d},configureServer(m){if(!e||v!=="serve")return;let C=m.config?.base??"/",N=ho(C);Ko(m),F.installCoverage(m);let I=Xi(),j=m.config?.server?.fs?.allow;if(Array.isArray(j)){let G=[y,...I?[(0,K.dirname)(I)]:[]];for(let ce of G)j.includes(ce)||j.push(ce)}T=m,x.attach(m),_(),m.watcher?.once?.("close",D),m.httpServer?.once("close",D),m.middlewares.use((G,ce,de)=>{if(G.url?.split(/[?#]/)[0]===tr(C)){N(G,ce,de);return}let Ie=m.environments?.client?.moduleGraph;if(Ie&&G.url&&(G.method==="GET"||G.method==="HEAD")){let be=J.observeRequest(Ie,G.url,m.config.base,G.headers["sec-fetch-dest"],G.headers["if-none-match"]);be&&ce.once("finish",()=>{be(ce.statusCode,ce.getHeader("content-type"),ce.getHeader("etag"))})}let Pe=G.url?.match(/^\/tempo-assets\/([a-zA-Z0-9._-]+)(?:\?.*)?$/)?.[1];if(Pe){let be=["public","static"].map(Ce=>(0,K.join)(y,Ce,"tempo-assets",Pe)).find(Ce=>(0,le.existsSync)(Ce));be&&(G.url=`/@fs/${be.replace(/\\/g,"/")}`)}Ou(x,d,m,G,ce,de)});let ne=r?Ai({target:r,config:m.config}):null;if(ne&&(m.middlewares.use(ne.prefix),m.httpServer?.on("upgrade",ne.upgrade)),r){let G=Ci({target:r,onRelaunch(){m.config.logger.info("[tempo] Flutter dev server relaunched; reloading the canvas host page"),m.ws.send({type:"full-reload"})}});m.httpServer?.once("close",G),m.watcher?.once?.("close",G)}F.installSweep(m,{sweepIntervalMs:$u,listExtraFiles:l(()=>x.errorServer.errorFiles,"listExtraFiles"),afterSweep:l(()=>x.pollRecovery(m),"afterSweep")}),Lu(m);let ve=l(G=>{let ce=G.send.bind(G);G.send=((...de)=>{let Ie=de[0];if(typeof Ie=="object"&&Ie!==null&&"type"in Ie){let Pe=Ie;if(Pe.type==="prune"){let be=m.environments?.client?.moduleGraph;be&&J.observePrune(be,Pe.paths??[])}if(Pe.type==="error")x.recordHmrError(Pe.err);else if(Pe.type==="update"&&!S.has(Ie)){S.add(Ie);let be=Pe,Ce=be.updates,ft=Ce?U.filter(Ce):void 0;Ce&&ft&&ft.length!==Ce.length&&(be.updates=ft);let pa=ft?.map(Er=>Er.path).filter(Er=>typeof Er=="string")??[];if(x.errorServer.clearErrorForModules(pa),Ce&&Ce.length>0&&ft?.length===0)return}}return ce(...de)})},"interceptHmrSend");return ve(m.ws),()=>{let G=m.environments?.client?.hot;G&&G!==m.ws&&ve(G),ne&&m.middlewares.use(ne.fallthrough)}},closeBundle(){p.clear(),T=void 0,F.clear(),U.clear(),J.clear(),x.reset(),D()},hotUpdate:{order:"post",async handler(m){let C=f(m.file,this.environment.moduleGraph,m.modules);if(!e||this.environment.config.consumer!=="client")return C;if(m.modules.splice(0,m.modules.length,...C),Q(m.file))return[];if(m.type==="create"&&/\/\.tempo\/asset-edit-previews\/\d+\/index\.canvas\.tsx$/.test(m.file.replace(/\\/g,"/")))return[];if(m.type==="update"&&m.modules.length>0&&F.observeUpdate(m.server,m.file),m.type!=="create"&&ke(m.file),m.type==="update"&&x.hasActiveCompileError(m.file)&&await x.recover(m.server,m.file))return[];if(m.type==="delete")return g.forgetDefaultExportIdentity(m.file),J.suppressDeletion(this.environment.moduleGraph,m.modules)?[]:void 0;if(m.type==="update"&&await te(m))return[];if(m.type==="update")return Z(m.file,this.environment.moduleGraph,m.modules)}},handleHotUpdate:{order:"post",async handler(m){let C=f(m.file,m.server.moduleGraph,m.modules);if(m.modules.splice(0,m.modules.length,...C),!!e)return Q(m.file)?[]:(m.modules.length>0&&F.observeUpdate(m.server,m.file),ke(m.file),x.hasActiveCompileError(m.file)&&await x.recover(m.server,m.file)?[]:await te(m)?[]:Z(m.file,m.server.moduleGraph,m.modules))}},transformIndexHtml(m,C){if(!e||v!=="serve")return;let N=[{tag:"script",attrs:{src:tr(T?.config.base??"/")},injectTo:"head-prepend"}];w&&N.push({tag:"script",attrs:{type:"module",src:rr},injectTo:"head-prepend"}),Iu(m)||N.push({tag:"meta",attrs:{name:Eu,content:d},injectTo:"head"}),Pu(m)||N.push({tag:"meta",attrs:{name:wu,content:y},injectTo:"head"});let I=(0,ge.createTempoHostIdentity)("vite",{root:d,pluginActive:!0}).workspaceNonce;I&&!Mu(m)&&N.push({tag:"meta",attrs:{name:ge.TEMPO_WORKSPACE_NONCE_META_NAME,content:I},injectTo:"head"});let j=C?.originalUrl??C?.path,ne=j?Au(j):!1;return j&&!ne&&(N.push({tag:"script",children:xu,injectTo:"head-prepend"}),N.push({tag:"script",attrs:{type:"module",src:Ji},injectTo:"head-prepend"})),N.length>0?N:void 0},async transform(m,C,N){if(!e||v==="build"||(T&&zo(T),C.startsWith("\0")))return null;let I=this.environment,j=I?.config?.consumer?I.config.consumer==="client":N?.ssr!==!0;h.noteChainInput(this,C,m,j);let ne=pt(C);if(ne.replace(/\\/g,"/").endsWith("/vite/dist/client/client.mjs")){let ve=$i(m);return ve===m?null:{code:ve,map:null}}return g.annotateJsxModule(this,m,ne)}}}var le,Yi,K,Qi,ge,vu,bu,Eu,wu,Ji,mn,Gi,xu,_u,Ki,Ru,$u,ea=P(()=>{jr();Gt();Vr();bo();Ao();$o();Yo();le=require("node:fs"),Yi=require("node:module"),K=require("node:path"),Qi=require("node:url");As();_s();ri();cn();di();mi();Ri();ki();ge=require("@tempo-sdk-public/host-identity");At();Pi();Oi();Li();ji();sr();vu=["**/*.tsx","**/*.jsx"],bu=["**/node_modules/**"],Eu="tempo-project-root",wu="tempo-source-identity-root",Ji="/@tempo/interact-projection",mn="\0tempo:interact-projection",Gi="tempo-sdk/canvas/interact-projection";l(Xi,"resolveOwnInteractProjectionModule");xu=`
200
+ });`:(!e||v==="build"||m.startsWith("\0")||await b.settled(m),null)}},_tempoErrorServer:C.errorServer,_tempoHotUpdateState:{lastHotUpdateMtimeMs(m){return b.lastHotUpdateMtimeMs(m)}},_tempoUnresolvedImportState:{get size(){return x.size},get barePackageCount(){return[...x.values()].filter(m=>m.packageName!==void 0).length},get hasBarePackageWatcher(){return k.size>0&&Bt()},get barePackageWatchPath(){return Bt()?k.keys().next().value:void 0},get hasUnresolvedImportWatcher(){return k.size>0},get unresolvedImportWatchPath(){return k.keys().next().value},get unresolvedImportWatchPaths(){return[...k.keys()]},get hasUnresolvedImportWatchRearm(){return S!==null},emitUnresolvedImportWatcherErrorForTesting(){for(let{watcher:m}of k.values())m.emit("error",new Error("Simulated unresolved-import watcher failure"))}},configResolved(m){if(!e)return;v=m.command,w=m.server?.hmr!==!1,v==="serve"&&w&&Mi(m.plugins??[]),d=ta(t.root??m.root);let A=m.plugins;v==="serve"&&Array.isArray(A)&&Object.isExtensible(A)&&!A.includes(h.plugin)&&A.push(h.plugin),y=t.sourceIdentityRoot?ta((0,K.resolve)(m.root,t.sourceIdentityRoot)):d},configureServer(m){if(!e||v!=="serve")return;let A=m.config?.base??"/",N=So(A);qo(m),b.installCoverage(m),$=ji(m);let P=Qi(),W=m.config?.server?.fs?.allow;if(Array.isArray(W)){let G=[y,...P?[(0,K.dirname)(P)]:[]];for(let ue of G)W.includes(ue)||W.push(ue)}T=m,C.attach(m),F(),m.watcher?.once?.("close",Ie),m.httpServer?.once("close",Ie),m.middlewares.use((G,ue,me)=>{if(G.url?.split(/[?#]/)[0]===or(A)){N(G,ue,me);return}let Pe=m.environments?.client?.moduleGraph;if(Pe&&G.url&&(G.method==="GET"||G.method==="HEAD")){let we=H.observeRequest(Pe,G.url,m.config.base,G.headers["sec-fetch-dest"],G.headers["if-none-match"]);we&&ue.once("finish",()=>{we(ue.statusCode,ue.getHeader("content-type"),ue.getHeader("etag"))})}let Me=G.url?.match(/^\/tempo-assets\/([a-zA-Z0-9._-]+)(?:\?.*)?$/)?.[1];if(Me){let we=["public","static"].map(xe=>(0,K.join)(y,xe,"tempo-assets",Me)).find(xe=>(0,ce.existsSync)(xe));we&&(G.url=`/@fs/${we.replace(/\\/g,"/")}`)}Hu(C,d,m,G,ue,me)});let oe=r?Ri({target:r,config:m.config}):null;if(oe&&(m.middlewares.use(oe.prefix),m.httpServer?.on("upgrade",oe.upgrade)),r){let G=_i({target:r,onRelaunch(){m.config.logger.info("[tempo] Flutter dev server relaunched; reloading the canvas host page"),m.ws.send({type:"full-reload"})}});m.httpServer?.once("close",G),m.watcher?.once?.("close",G)}b.installSweep(m,{sweepIntervalMs:ju,listExtraFiles:l(()=>C.errorServer.errorFiles,"listExtraFiles"),afterSweep:l(()=>C.pollRecovery(m),"afterSweep")}),Uu(m);let Ee=l(G=>{let ue=G.send.bind(G);G.send=((...me)=>{let Pe=me[0];if(typeof Pe=="object"&&Pe!==null&&"type"in Pe){let Me=Pe;if(Me.type==="prune"){let we=m.environments?.client?.moduleGraph;we&&H.observePrune(we,Me.paths??[])}if(Me.type==="error")C.recordHmrError(Me.err);else if(Me.type==="update"&&!X.has(Pe)){X.add(Pe);let we=Me,xe=we.updates,mt=xe?D.filter(xe):void 0;xe&&mt&&mt.length!==xe.length&&(we.updates=mt);let ha=mt?.map(Cr=>Cr.path).filter(Cr=>typeof Cr=="string")??[];if(C.errorServer.clearErrorForModules(ha),xe&&xe.length>0&&mt?.length===0)return}}return ue(...me)})},"interceptHmrSend");return Ee(m.ws),()=>{let G=m.environments?.client?.hot;G&&G!==m.ws&&Ee(G),oe&&m.middlewares.use(oe.fallthrough)}},closeBundle(){p.clear(),T=void 0,$=void 0,b.clear(),D.clear(),H.clear(),C.reset(),Ie()},watchChange(m){$?.begin(m)},hotUpdate:{order:"post",async handler(m){let A=f(m.file,this.environment.moduleGraph,m.modules);if(!e||this.environment.config.consumer!=="client")return A;if(m.modules.splice(0,m.modules.length,...A),$&&Ht(m.file))return $.finish(this.environment,m.file,A);if(ee(m.file))return[];if(m.type==="create"&&/\/\.tempo\/asset-edit-previews\/\d+\/index\.canvas\.tsx$/.test(m.file.replace(/\\/g,"/")))return[];if(m.type==="update"&&m.modules.length>0&&b.observeUpdate(m.server,m.file),m.type!=="create"&&je(m.file),m.type==="update"&&C.hasActiveCompileError(m.file)&&await C.recover(m.server,m.file))return[];if(m.type==="delete")return g.forgetDefaultExportIdentity(m.file),H.suppressDeletion(this.environment.moduleGraph,m.modules)?[]:void 0;if(m.type==="update"&&await V(m))return[];if(m.type==="update")return q(m.file,this.environment.moduleGraph,m.modules)}},handleHotUpdate:{order:"post",async handler(m){let A=f(m.file,m.server.moduleGraph,m.modules);if(m.modules.splice(0,m.modules.length,...A),!!e)return $&&Ht(m.file)?$.finish(m.server,m.file,A):ee(m.file)?[]:(m.modules.length>0&&b.observeUpdate(m.server,m.file),je(m.file),C.hasActiveCompileError(m.file)&&await C.recover(m.server,m.file)?[]:await V(m)?[]:q(m.file,m.server.moduleGraph,m.modules))}},transformIndexHtml(m,A){if(!e||v!=="serve")return;let N=[{tag:"script",attrs:{src:or(T?.config.base??"/")},injectTo:"head-prepend"}];w&&N.push({tag:"script",attrs:{type:"module",src:sr},injectTo:"head-prepend"}),$u(m)||N.push({tag:"meta",attrs:{name:_u,content:d},injectTo:"head"}),Lu(m)||N.push({tag:"meta",attrs:{name:Ru,content:y},injectTo:"head"});let P=(0,ye.createTempoHostIdentity)("vite",{root:d,pluginActive:!0}).workspaceNonce;P&&!Fu(m)&&N.push({tag:"meta",attrs:{name:ye.TEMPO_WORKSPACE_NONCE_META_NAME,content:P},injectTo:"head"});let W=A?.originalUrl??A?.path,oe=W?Iu(W):!1;return W&&!oe&&(N.push({tag:"script",children:Tu,injectTo:"head-prepend"}),N.push({tag:"script",attrs:{type:"module",src:qi},injectTo:"head-prepend"})),N.length>0?N:void 0},async transform(m,A,N){if(!e||v==="build"||(T&&Yo(T),A.startsWith("\0")))return null;let P=this.environment,W=P?.config?.consumer?P.config.consumer==="client":N?.ssr!==!0;h.noteChainInput(this,A,m,W);let oe=dt(A);if(oe.replace(/\\/g,"/").endsWith("/vite/dist/client/client.mjs")){let Ee=Fi(m);return Ee===m?null:{code:Ee,map:null}}return g.annotateJsxModule(this,m,oe)}}}var ce,ra,K,na,ye,xu,Au,_u,Ru,qi,hn,Yi,Tu,Pu,Zi,Mu,ju,sa=M(()=>{Vr();zt();Wr();wo();Ro();Fo();Zo();ce=require("node:fs"),ra=require("node:module"),K=require("node:path"),na=require("node:url");Rs();Ts();oi();pn();mi();hi();ki();Pi();ye=require("@tempo-sdk-public/host-identity");_t();Ni();Li();Di();Ui();Ji();lr();xu=["**/*.tsx","**/*.jsx"],Au=["**/node_modules/**"],_u="tempo-project-root",Ru="tempo-source-identity-root",qi="/@tempo/interact-projection",hn="\0tempo:interact-projection",Yi="tempo-sdk/canvas/interact-projection";l(Qi,"resolveOwnInteractProjectionModule");Tu=`
201
201
  (function() {
202
- if (window.parent === window || (window.name !== ${JSON.stringify(Pt)} && !window.name.startsWith(${JSON.stringify(`${Pt}:`)}))) return;
202
+ if (window.parent === window || (window.name !== ${JSON.stringify(Mt)} && !window.name.startsWith(${JSON.stringify(`${Mt}:`)}))) return;
203
203
  var roots = new Map();
204
204
  var existing = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
205
205
  if (existing) {
@@ -228,6 +228,6 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
228
228
  checkDCE: function() {},
229
229
  onScheduleFiberRoot: function() {}
230
230
  };
231
- })();`;l(pt,"cleanModuleId");l(Cu,"isCanvasHostRequest");l(Au,"isDeclarativeCanvasHostRequest");_u=256,Ki=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"],Ru=1e3;l(zi,"isRelativeImportSpecifier");l(Tu,"barePackageName");l(ku,"resolvedIdMatchesFile");l(qi,"resolveCanonicalRoot");l(Iu,"hasRootMetaTag");l(Pu,"hasSourceIdentityRootMetaTag");l(Mu,"hasWorkspaceNonceMetaTag");l(Nu,"runsVueSourceAnnotation");l(Ou,"handleTempoMiddleware");$u=Ct;l(Lu,"installTailwindScanNet");l(Zi,"tempoVitePlugin")});var oa={};Ut(oa,{astroAnnotationPlugins:()=>ra,default:()=>Fu,tempoAstro:()=>gn,withTempoAstro:()=>na});function gn(t={}){return{name:"tempo-astro",hooks:{async"astro:config:setup"({config:e,command:r,updateConfig:n,injectRoute:o,createCodegenDir:i,injectScript:s}){if(r!=="dev"||!(t.enabled??!!process.env.TEMPO))return;let[c,a]=process.versions.node.split(".").map(Number);if(c<22||c===22&&a<12)throw new Error("Tempo Astro support requires Node 22.12 or newer");let p=(0,ta.createRequire)(new URL("package.json",e.root))("astro/package.json").version;if(!p.startsWith("7."))throw new Error(`Tempo native Astro support requires Astro 7; this app uses ${p}`);let f=ye.realpathSync.native((0,jt.fileURLToPath)(e.root)),{root:d,tempoRoot:g,canvasesRoot:h}=Hn(f,t.root,t.canvasesRoot),y=(0,jt.fileURLToPath)(i()),v=[h,(0,he.resolve)(g,".tempo/library-canvases"),(0,he.resolve)(g,".tempo/asset-edit-previews")],w=lo(d,v,y,t.styles?.map(T=>(0,he.resolve)(f,T))??jn(f));o({pattern:"/__tempo/astro/[...storyboard]",entrypoint:w.entrypoint,prerender:!1}),s("head-inline",yo(await Hr())),s("head-inline",`if(!document.querySelector('meta[name="tempo-project-root"]')){const m=document.createElement('meta');m.name='tempo-project-root';m.content=${JSON.stringify(d).replaceAll("<","\\u003c")};document.head.append(m)}`);let x=(0,jt.fileURLToPath)(new URL(Re("astro.ts").endsWith(".ts")?"./astro/document-client.ts":"./astro/document-client.js",Re("astro.ts")));s("page",`import { startAstroDocumentClient } from ${JSON.stringify(x)}; startAstroDocumentClient(import.meta.hot);`),n({vite:{plugins:[{name:"tempo:astro-identity",enforce:"pre",configureServer(T){T.middlewares.use((O,M,B)=>{if(O.method!=="GET"||O.url?.split("?")[0]!==dt.TEMPO_HOST_IDENTITY_ENDPOINT)return B();M.setHeader(dt.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),M.setHeader("Cache-Control","no-store"),M.setHeader("Content-Type","application/json"),M.end(JSON.stringify({...(0,dt.createTempoHostIdentity)("astro",{root:g,pluginActive:!0}),capabilities:{astroComponents:1}}))})}},uo(d,[...v,(0,he.resolve)(y,"*.astro")]),...ra(d,y),Zi({root:d,enabled:!0}),w.plugin]}})}}}}function ra(t,e){let r=new Set,n=new WeakMap,o=l(c=>{let a=n.get(c);return a||(a=new Map,n.set(c,a)),a},"receiptMap"),i=(0,jt.fileURLToPath)(new URL("./astro/runtime.js",Re("astro.ts"))),s=Re("astro.ts").endsWith(".ts")?i.replace(/\.js$/,".ts"):i;return[{name:"tempo:astro-source",enforce:"pre",transform:{order:"pre",handler(c,a,u){let p=a.endsWith(".astro"),f=u?.ssr&&/\.[jt]sx?$/.test(a);if(!p&&!f||a.includes("?")||!(0,he.isAbsolute)(a))return;let d=o(this.environment);d.delete(a);let g;try{g=ye.realpathSync.native(a)}catch{return}if(e&&!(0,he.relative)(e,g).startsWith(".."))return;let h=(0,he.relative)(t,g).replaceAll("\\","/");if(!h||h.startsWith("../")||(0,he.isAbsolute)(h)||h.split("/").includes("node_modules"))return;let y=(0,ye.openSync)(g,"r"),v;try{let x=(0,ye.fstatSync)(y),A=(0,ye.readFileSync)(y,"utf8"),T=(0,ye.fstatSync)(y);if(c!==A||!["mtimeMs","ctimeMs","size","ino","dev"].every(M=>x[M]===T[M]))return;let O=p?_e(c):null;if(O&&O.kind!=="ok")return;v={filepath:h,sourceVersion:O?.sourceVersion??Ee(c),modifiedTs:Math.trunc(x.mtimeMs)}}finally{(0,ye.closeSync)(y)}if(f){d.set(a,{metadata:v});return}let w=$n(c,v,a);return w.kind!=="ok"&&this.error(w.message),d.set(a,{metadata:v,occurrenceFactory:w.occurrenceFactory}),{code:w.code,map:w.map}}}},{name:"tempo:astro-compiled",enforce:"post",transform:{order:"post",handler(c,a){let u=l(d=>{r.has(a)||(r.add(a),this.warn(d))},"warn");if(e&&a.endsWith(".astro")&&!(0,he.relative)(e,a).startsWith(".."))return Ir(c,a,null,s,"$$tempoStoryboardHostId",u);let p=o(this.environment),f=p.get(a);if(f)return p.delete(a),f.occurrenceFactory?Ir(c,a,f.metadata,s,f.occurrenceFactory,u):Fn(c,a,f.metadata,s)}}}]}function na(t){return t instanceof Promise?t.then(e=>na(e)):{...t,integrations:[...t.integrations??[],gn()]}}var ye,ta,he,jt,dt,Fu,sa=P(()=>{ye=require("node:fs"),ta=require("node:module"),he=require("node:path"),jt=require("node:url");Ge();Ln();et();dt=require("@tempo-sdk-public/host-identity");Dn();Un();co();po();jr();ea();Gt();l(gn,"tempoAstro");l(ra,"astroAnnotationPlugins");Fu=gn;l(na,"withTempoAstro")});var ca={};Ut(ca,{astroHostId:()=>aa,instrumentCreateComponent:()=>Uu,instrumentFrameworkComponent:()=>ju,instrumentRenderComponent:()=>Vu});function ju(t,e){return(typeof t=="function"||t&&typeof t=="object"&&"$$typeof"in t)&&Object.isExtensible(t)&&!Object.prototype.hasOwnProperty.call(t,Sr)&&Object.defineProperty(t,Sr,{value:e}),t}function aa(){return globalThis.crypto.randomUUID()}function yn(t,e){return`<!--tempo:astro:${t}${e===void 0?"":`:${encodeURIComponent(JSON.stringify(e)).replaceAll("-","%2D")}`}-->`}function Sn(t,e){return t&&typeof t.then=="function"?Promise.resolve(t).then(e):e(t)}function la(t,e){if(!t||typeof t!="object")return t;if(t[Hu]&&t.content)return{...t,content:la(t.content,e)};if(!t[Du])return t;let r=[...t.htmlParts];return r[r.length-1]+=yn("m",e),Object.assign(Object.create(Object.getPrototypeOf(t)),t,{htmlParts:r})}function Uu(t,e){return(...r)=>{let n=l(s=>function(...c){return Sn(s.apply(this,c),a=>la(a,e))},"wrap"),o=r[0],i=typeof o=="function"?t(n(o),...r.slice(1)):t({...o,factory:n(o.factory)},...r.slice(1));return Object.defineProperty(i,Sr,{value:e}),i}}function Vu(t){return(e,r,n,o={},...i)=>{let s=o[ia];if(!s)return t(e,r,n,o,...i);let c={...o};return delete c[ia],Sn(t(e,r,n,c,...i),a=>({render(u){let p=aa();return u.write((0,hn.markHTMLString)(yn("b",{occurrence:p,source:s,definition:n?.[Sr]??null}))),Sn(a.render(u),()=>u.write((0,hn.markHTMLString)(yn("e",{occurrence:p}))))}}))}}var hn,ia,Sr,Du,Hu,ua=P(()=>{hn=require("astro/runtime/server/index.js"),ia="__tempo_astro_callsite__",Sr=Symbol.for("tempo.astro.definition"),Du=Symbol.for("astro.renderTemplateResult"),Hu=Symbol.for("astro.headAndContent");l(ju,"instrumentFrameworkComponent");l(aa,"astroHostId");l(yn,"comment");l(Sn,"thenOrValue");l(la,"withReceipt");l(Uu,"instrumentCreateComponent");l(Vu,"instrumentRenderComponent")});var Wu={};Ut(Wu,{getEntry:()=>Bu});module.exports=xr(Wu);var vr={};function Bu(t){if(vr[t])return vr[t];switch(t){case"astro":return vr[t]=(sa(),xr(oa));case"astro/runtime":return vr[t]=(ua(),xr(ca));default:throw new Error("Unknown Tempo runtime entry: "+t)}}l(Bu,"getEntry");0&&(module.exports={getEntry});
231
+ })();`;l(dt,"cleanModuleId");l(ku,"isCanvasHostRequest");l(Iu,"isDeclarativeCanvasHostRequest");Pu=256,Zi=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"],Mu=1e3;l(ea,"isRelativeImportSpecifier");l(Nu,"barePackageName");l(Ou,"resolvedIdMatchesFile");l(ta,"resolveCanonicalRoot");l($u,"hasRootMetaTag");l(Lu,"hasSourceIdentityRootMetaTag");l(Fu,"hasWorkspaceNonceMetaTag");l(Du,"runsVueSourceAnnotation");l(Hu,"handleTempoMiddleware");ju=At;l(Uu,"installTailwindScanNet");l(oa,"tempoVitePlugin")});var ca={};Wt(ca,{astroAnnotationPlugins:()=>aa,default:()=>Vu,tempoAstro:()=>yn,withTempoAstro:()=>la});function yn(t={}){return{name:"tempo-astro",hooks:{async"astro:config:setup"({config:e,command:r,updateConfig:n,injectRoute:o,createCodegenDir:i,injectScript:s}){if(r!=="dev"||!(t.enabled??!!process.env.TEMPO))return;let[c,a]=process.versions.node.split(".").map(Number);if(c<22||c===22&&a<12)throw new Error("Tempo Astro support requires Node 22.12 or newer");let p=(0,ia.createRequire)(new URL("package.json",e.root))("astro/package.json").version;if(!p.startsWith("7."))throw new Error(`Tempo native Astro support requires Astro 7; this app uses ${p}`);let f=ve.realpathSync.native((0,Vt.fileURLToPath)(e.root)),{root:d,tempoRoot:g,canvasesRoot:h}=Un(f,t.root,t.canvasesRoot),y=(0,Vt.fileURLToPath)(i()),v=[h,(0,Se.resolve)(g,".tempo/library-canvases"),(0,Se.resolve)(g,".tempo/asset-edit-previews")],w=uo(d,v,y,t.styles?.map(T=>(0,Se.resolve)(f,T))??Vn(f));o({pattern:"/__tempo/astro/[...storyboard]",entrypoint:w.entrypoint,prerender:!1}),s("head-inline",vo(await Ur())),s("head-inline",`if(!document.querySelector('meta[name="tempo-project-root"]')){const m=document.createElement('meta');m.name='tempo-project-root';m.content=${JSON.stringify(d).replaceAll("<","\\u003c")};document.head.append(m)}`);let C=(0,Vt.fileURLToPath)(new URL(Re("astro.ts").endsWith(".ts")?"./astro/document-client.ts":"./astro/document-client.js",Re("astro.ts")));s("page",`import { startAstroDocumentClient } from ${JSON.stringify(C)}; startAstroDocumentClient(import.meta.hot);`),n({vite:{plugins:[{name:"tempo:astro-identity",enforce:"pre",configureServer(T){T.middlewares.use(($,k,B)=>{if($.method!=="GET"||$.url?.split("?")[0]!==ft.TEMPO_HOST_IDENTITY_ENDPOINT)return B();k.setHeader(ft.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),k.setHeader("Cache-Control","no-store"),k.setHeader("Content-Type","application/json"),k.end(JSON.stringify({...(0,ft.createTempoHostIdentity)("astro",{root:g,pluginActive:!0}),capabilities:{astroComponents:1}}))})}},fo(d,[...v,(0,Se.resolve)(y,"*.astro")]),...aa(d,y),oa({root:d,enabled:!0}),w.plugin]}})}}}}function aa(t,e){let r=new Set,n=new WeakMap,o=l(c=>{let a=n.get(c);return a||(a=new Map,n.set(c,a)),a},"receiptMap"),i=(0,Vt.fileURLToPath)(new URL("./astro/runtime.js",Re("astro.ts"))),s=Re("astro.ts").endsWith(".ts")?i.replace(/\.js$/,".ts"):i;return[{name:"tempo:astro-source",enforce:"pre",transform:{order:"pre",handler(c,a,u){let p=a.endsWith(".astro"),f=u?.ssr&&/\.[jt]sx?$/.test(a);if(!p&&!f||a.includes("?")||!(0,Se.isAbsolute)(a))return;let d=o(this.environment);d.delete(a);let g;try{g=ve.realpathSync.native(a)}catch{return}if(e&&!(0,Se.relative)(e,g).startsWith(".."))return;let h=(0,Se.relative)(t,g).replaceAll("\\","/");if(!h||h.startsWith("../")||(0,Se.isAbsolute)(h)||h.split("/").includes("node_modules"))return;let y=(0,ve.openSync)(g,"r"),v;try{let C=(0,ve.fstatSync)(y),x=(0,ve.readFileSync)(y,"utf8"),T=(0,ve.fstatSync)(y);if(c!==x||!["mtimeMs","ctimeMs","size","ino","dev"].every(k=>C[k]===T[k]))return;let $=p?_e(c):null;if($&&$.kind!=="ok")return;v={filepath:h,sourceVersion:$?.sourceVersion??Ce(c),modifiedTs:Math.trunc(C.mtimeMs)}}finally{(0,ve.closeSync)(y)}if(f){d.set(a,{metadata:v});return}let w=Fn(c,v,a);return w.kind!=="ok"&&this.error(w.message),d.set(a,{metadata:v,occurrenceFactory:w.occurrenceFactory}),{code:w.code,map:w.map}}}},{name:"tempo:astro-compiled",enforce:"post",transform:{order:"post",handler(c,a){let u=l(d=>{r.has(a)||(r.add(a),this.warn(d))},"warn");if(e&&a.endsWith(".astro")&&!(0,Se.relative)(e,a).startsWith(".."))return Mr(c,a,null,s,"$$tempoStoryboardHostId",u);let p=o(this.environment),f=p.get(a);if(f)return p.delete(a),f.occurrenceFactory?Mr(c,a,f.metadata,s,f.occurrenceFactory,u):Hn(c,a,f.metadata,s)}}}]}function la(t){return t instanceof Promise?t.then(e=>la(e)):{...t,integrations:[...t.integrations??[],yn()]}}var ve,ia,Se,Vt,ft,Vu,ua=M(()=>{ve=require("node:fs"),ia=require("node:module"),Se=require("node:path"),Vt=require("node:url");Xe();Dn();tt();ft=require("@tempo-sdk-public/host-identity");jn();Bn();po();mo();Vr();sa();zt();l(yn,"tempoAstro");l(aa,"astroAnnotationPlugins");Vu=yn;l(la,"withTempoAstro")});var ma={};Wt(ma,{astroHostId:()=>da,instrumentCreateComponent:()=>Gu,instrumentFrameworkComponent:()=>Ju,instrumentRenderComponent:()=>Xu});function Ju(t,e){return(typeof t=="function"||t&&typeof t=="object"&&"$$typeof"in t)&&Object.isExtensible(t)&&!Object.prototype.hasOwnProperty.call(t,Er)&&Object.defineProperty(t,Er,{value:e}),t}function da(){return globalThis.crypto.randomUUID()}function vn(t,e){return`<!--tempo:astro:${t}${e===void 0?"":`:${encodeURIComponent(JSON.stringify(e)).replaceAll("-","%2D")}`}-->`}function bn(t,e){return t&&typeof t.then=="function"?Promise.resolve(t).then(e):e(t)}function fa(t,e){if(!t||typeof t!="object")return t;if(t[Wu]&&t.content)return{...t,content:fa(t.content,e)};if(!t[Bu])return t;let r=[...t.htmlParts];return r[r.length-1]+=vn("m",e),Object.assign(Object.create(Object.getPrototypeOf(t)),t,{htmlParts:r})}function Gu(t,e){return(...r)=>{let n=l(s=>function(...c){return bn(s.apply(this,c),a=>fa(a,e))},"wrap"),o=r[0],i=typeof o=="function"?t(n(o),...r.slice(1)):t({...o,factory:n(o.factory)},...r.slice(1));return Object.defineProperty(i,Er,{value:e}),i}}function Xu(t){return(e,r,n,o={},...i)=>{let s=o[pa];if(!s)return t(e,r,n,o,...i);let c={...o};return delete c[pa],bn(t(e,r,n,c,...i),a=>({render(u){let p=da();return u.write((0,Sn.markHTMLString)(vn("b",{occurrence:p,source:s,definition:n?.[Er]??null}))),bn(a.render(u),()=>u.write((0,Sn.markHTMLString)(vn("e",{occurrence:p}))))}}))}}var Sn,pa,Er,Bu,Wu,ga=M(()=>{Sn=require("astro/runtime/server/index.js"),pa="__tempo_astro_callsite__",Er=Symbol.for("tempo.astro.definition"),Bu=Symbol.for("astro.renderTemplateResult"),Wu=Symbol.for("astro.headAndContent");l(Ju,"instrumentFrameworkComponent");l(da,"astroHostId");l(vn,"comment");l(bn,"thenOrValue");l(fa,"withReceipt");l(Gu,"instrumentCreateComponent");l(Xu,"instrumentRenderComponent")});var zu={};Wt(zu,{getEntry:()=>Ku});module.exports=Ar(zu);var wr={};function Ku(t){if(wr[t])return wr[t];switch(t){case"astro":return wr[t]=(ua(),Ar(ca));case"astro/runtime":return wr[t]=(ga(),Ar(ma));default:throw new Error("Unknown Tempo runtime entry: "+t)}}l(Ku,"getEntry");0&&(module.exports={getEntry});
232
232
 
233
233
  return module.exports;};