@tempo-ai/mcp 0.0.150 → 0.0.151-staging.1

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 Wi=Object.create;var lt=Object.defineProperty;var Bi=Object.getOwnPropertyDescriptor;var Ji=Object.getOwnPropertyNames;var Ki=Object.getPrototypeOf,Gi=Object.prototype.hasOwnProperty;var c=(t,e)=>lt(t,"name",{value:e,configurable:!0});var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var Be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pt=(t,e)=>{for(var r in e)lt(t,r,{get:e[r],enumerable:!0})},an=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ji(e))!Gi.call(t,o)&&o!==r&&lt(t,o,{get:()=>e[o],enumerable:!(n=Bi(e,o))||n.enumerable});return t};var dr=(t,e,r)=>(r=t!=null?Wi(Ki(t)):{},an(e||!t||!t.__esModule?lt(r,"default",{value:t,enumerable:!0}):r,t)),fr=t=>an(lt({},"__esModule",{value:!0}),t);function ke(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 ln(e)+ln(r)}function ln(t){return(t>>>0).toString(16).padStart(8,"0")}var Je=O(()=>{"use strict";c(ke,"sourceVersionHash");c(ln,"toHex8")});function Ie(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 Te(t){let e=Ie(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=Te(e.argument);if(typeof r=="number")return e.operator==="-"?-r:r}if(e.type==="BinaryExpression"&&["+","-","*","/"].includes(e.operator)){let r=Te(e.left),n=Te(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 mr(t){if(t.type!=="JSXExpressionContainer")return null;let e=Ie(t.expression);return e.type==="JSXElement"?e:null}function ct(t,e=!1){if(!e&&t.type==="Identifier")return typeof t.name=="string"?t.name:null;let r=Te(t);return typeof r=="string"||typeof r=="number"?String(r):null}var Nt=O(()=>{"use strict";c(Ie,"unwrapLiteralExpression");c(Te,"readLiteralExpression");c(mr,"literalJsxChild");c(ct,"literalPropertyName")});function un(t,e,r=!1){let o=t.openingElement.attributes,i=[];!r&&e!=="JSXElement"&&e!=="JSXFragment"&&i.push(Xi);let s=new Map;o.forEach((a,u)=>{let p=zi(a);p!==null&&s.set(p,u)});let l=-1;o.forEach((a,u)=>{a.type==="JSXSpreadAttribute"&&(l=u)});for(let[a,u]of s){if(qi(a))continue;let p=u<l,d=o[u].value;if(d!==null){if(a==="style"&&!p){i.push(...Yi(d));continue}if(p)i.push(a);else{if(a==="className"&&ea(d))continue;Qi(d)||i.push(a)}}}return i.length>0?i.join(" "):l>=0?"":void 0}function zi(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 qi(t){return t==="key"||t.startsWith("data-tempo-")}function Yi(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 l=cn(i);l!==null&&n.set(l,s)});let o=[];for(let[i,s]of n){let l=r[s],a=r.slice(s+1).some(p=>p.type==="SpreadElement"||p.computed&&cn(p)===null),u=l.type!=="ObjectMethod"&&!l.shorthand&&pn(l.value);(a||!u)&&o.push(`style.${i}`)}return o}function cn(t){return t.type==="Property"||t.type==="ObjectProperty"||t.type==="ObjectMethod"?ct(t.key,!!t.computed):null}function Qi(t){return t.type==="Literal"||t.type==="StringLiteral"?!0:t.type!=="JSXExpressionContainer"?!1:pn(t.expression)}function ea(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"||!Zi.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 pn(t){return Te(t)!==null}function ta(t){return Ie(t)}var gr,Xi,Zi,Mt=O(()=>{"use strict";Nt();Nt();gr="data-tempo-expr",Xi="#slot";c(un,"expressionFacts");c(zi,"attributeName");c(qi,"unstamped");c(Yi,"styleFacts");c(cn,"styleKey");c(Qi,"isLiteralValue");Zi=new Set(["cn","clsx","twMerge","cx","classNames"]);c(ea,"isClassHelperCall");c(pn,"isLiteral");c(ta,"unwrap")});function ut(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(gn[o])}while(n>0);return e}function hn(t){let e=new sa,r=0,n=0,o=0,i=0;for(let s=0;s<t.length;s++){let l=t[s];if(s>0&&e.write(na),l.length===0)continue;let a=0;for(let u=0;u<l.length;u++){let p=l[u];u>0&&e.write(ra),a=ut(e,p[0],a),p.length!==1&&(r=ut(e,p[1],r),n=ut(e,p[2],n),o=ut(e,p[3],o),p.length!==4&&(i=ut(e,p[4],i)))}}return e.flush()}var ra,na,dn,gn,oa,fn,mn,sa,yn=O(()=>{ra=44,na=59,dn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=new Uint8Array(64),oa=new Uint8Array(128);for(let t=0;t<dn.length;t++){let e=dn.charCodeAt(t);gn[t]=e,oa[e]=t}c(ut,"encodeInteger");fn=1024*16,mn=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}},sa=class{static{c(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(fn)}write(t){let{buffer:e}=this;e[this.pos++]=t,this.pos===fn&&(this.out+=mn.decode(e),this.pos=0)}flush(){let{buffer:t,out:e,pos:r}=this;return r>0?e+mn.decode(t.subarray(0,r)):e}};c(hn,"encode")});function ia(){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 la(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 l=/^ +/.exec(s)[0].length;return Math.min(l,i)},1/0);return new Array(o+1).join(" ")}function ca(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 pa(t){return ua.call(t)==="[object Object]"}function Sn(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 c(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 l=i-1,a=o-r[l];return{line:l,column:a}},"locate")}var Ot,$t,aa,hr,ua,da,yr,pt,Ke,$e,Sr=O(()=>{yn();Ot=class t{static{c(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))}},$t=class t{static{c(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}};c(ia,"getBtoa");aa=ia(),hr=class{static{c(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=hn(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,"+aa(this.toString())}};c(la,"guessIndent");c(ca,"getRelativePath");ua=Object.prototype.toString;c(pa,"isObject");c(Sn,"getLocator");da=/\w/,yr=class{static{c(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
- `,0),l=-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,l=s,s=r.indexOf(`
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(l+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,l=!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,l=!0,a=!1;else{if(this.hires||l||i.has(s)){let u=[this.generatedCodeColumn,e,o.line,o.column];this.hires==="boundary"?da.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,l=!1}s+=1}this.pending=null}advance(e){if(!e)return;let r=e.split(`
2
+ var Wi=Object.create;var lt=Object.defineProperty;var Bi=Object.getOwnPropertyDescriptor;var Ji=Object.getOwnPropertyNames;var Ki=Object.getPrototypeOf,Gi=Object.prototype.hasOwnProperty;var l=(t,e)=>lt(t,"name",{value:e,configurable:!0});var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var Je=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Nt=(t,e)=>{for(var r in e)lt(t,r,{get:e[r],enumerable:!0})},an=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ji(e))!Gi.call(t,o)&&o!==r&&lt(t,o,{get:()=>e[o],enumerable:!(n=Bi(e,o))||n.enumerable});return t};var dr=(t,e,r)=>(r=t!=null?Wi(Ki(t)):{},an(e||!t||!t.__esModule?lt(r,"default",{value:t,enumerable:!0}):r,t)),fr=t=>an(lt({},"__esModule",{value:!0}),t);function Te(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 ln(e)+ln(r)}function ln(t){return(t>>>0).toString(16).padStart(8,"0")}var Ke=O(()=>{"use strict";l(Te,"sourceVersionHash");l(ln,"toHex8")});function Ie(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 ke(t){let e=Ie(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=ke(e.argument);if(typeof r=="number")return e.operator==="-"?-r:r}if(e.type==="BinaryExpression"&&["+","-","*","/"].includes(e.operator)){let r=ke(e.left),n=ke(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 mr(t){if(t.type!=="JSXExpressionContainer")return null;let e=Ie(t.expression);return e.type==="JSXElement"?e:null}function ct(t,e=!1){if(!e&&t.type==="Identifier")return typeof t.name=="string"?t.name:null;let r=ke(t);return typeof r=="string"||typeof r=="number"?String(r):null}var Mt=O(()=>{"use strict";l(Ie,"unwrapLiteralExpression");l(ke,"readLiteralExpression");l(mr,"literalJsxChild");l(ct,"literalPropertyName")});function un(t,e,r=!1){let o=t.openingElement.attributes,i=[];!r&&e!=="JSXElement"&&e!=="JSXFragment"&&i.push(Xi);let s=new Map;o.forEach((a,u)=>{let p=zi(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(qi(a))continue;let p=u<c,d=o[u].value;if(d!==null){if(a==="style"&&!p){i.push(...Yi(d));continue}if(p)i.push(a);else{if(a==="className"&&ea(d))continue;Qi(d)||i.push(a)}}}return i.length>0?i.join(" "):c>=0?"":void 0}function zi(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 qi(t){return t==="key"||t.startsWith("data-tempo-")}function Yi(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&&pn(c.value);(a||!u)&&o.push(`style.${i}`)}return o}function cn(t){return t.type==="Property"||t.type==="ObjectProperty"||t.type==="ObjectMethod"?ct(t.key,!!t.computed):null}function Qi(t){return t.type==="Literal"||t.type==="StringLiteral"?!0:t.type!=="JSXExpressionContainer"?!1:pn(t.expression)}function ea(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"||!Zi.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 pn(t){return ke(t)!==null}function ta(t){return Ie(t)}var gr,Xi,Zi,Ot=O(()=>{"use strict";Mt();Mt();gr="data-tempo-expr",Xi="#slot";l(un,"expressionFacts");l(zi,"attributeName");l(qi,"unstamped");l(Yi,"styleFacts");l(cn,"styleKey");l(Qi,"isLiteralValue");Zi=new Set(["cn","clsx","twMerge","cx","classNames"]);l(ea,"isClassHelperCall");l(pn,"isLiteral");l(ta,"unwrap")});function ut(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(gn[o])}while(n>0);return e}function hn(t){let e=new sa,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(na),c.length===0)continue;let a=0;for(let u=0;u<c.length;u++){let p=c[u];u>0&&e.write(ra),a=ut(e,p[0],a),p.length!==1&&(r=ut(e,p[1],r),n=ut(e,p[2],n),o=ut(e,p[3],o),p.length!==4&&(i=ut(e,p[4],i)))}}return e.flush()}var ra,na,dn,gn,oa,fn,mn,sa,yn=O(()=>{ra=44,na=59,dn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=new Uint8Array(64),oa=new Uint8Array(128);for(let t=0;t<dn.length;t++){let e=dn.charCodeAt(t);gn[t]=e,oa[e]=t}l(ut,"encodeInteger");fn=1024*16,mn=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}},sa=class{static{l(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(fn)}write(t){let{buffer:e}=this;e[this.pos++]=t,this.pos===fn&&(this.out+=mn.decode(e),this.pos=0)}flush(){let{buffer:t,out:e,pos:r}=this;return r>0?e+mn.decode(t.subarray(0,r)):e}};l(hn,"encode")});function ia(){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 la(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 ca(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 pa(t){return ua.call(t)==="[object Object]"}function Sn(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 $t,Lt,aa,hr,ua,da,yr,pt,Ge,Le,Sr=O(()=>{yn();$t=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))}},Lt=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(ia,"getBtoa");aa=ia(),hr=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=hn(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,"+aa(this.toString())}};l(la,"guessIndent");l(ca,"getRelativePath");ua=Object.prototype.toString;l(pa,"isObject");l(Sn,"getLocator");da=/\w/,yr=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
+ `,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
+ `,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"?da.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
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}},pt=`
9
- `,Ke={insertLeft:!1,insertRight:!1,storeName:!1},$e=class t{static{c(this,"MagicString")}constructor(e,r={}){let n=new $t(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 Ot},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 Ot(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 yr(e.hires),i=Sn(this.original);return this.intro&&o.advance(this.intro),this.firstChunk.eachNext(s=>{let l=i(s.start);s.intro.length&&o.advance(s.intro),s.edited?o.addEdit(r,s.content,l,s.storeName?n.indexOf(s.original):-1):o.addUneditedChunk(r,s,this.original,l,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?ca(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 hr(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=la(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(pa(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 d=p[0];d<p[1];d+=1)o[d]=!0});let i=r.indentStart!==!1,s=c(u=>i?`${e}${u}`:(i=!0,u),"replacer");this.intro=this.intro.replace(n,s);let l=0,a=this.firstChunk;for(;a;){let u=a.end;if(a.edited)o[l]||(a.content=a.content.replace(n,s),a.content.length&&(i=a.content[a.content.length-1]===`
10
- `));else for(l=a.start;l<u;){if(!o[l]){let p=this.original[l];p===`
11
- `?i=!0:p!=="\r"&&i&&(i=!1,l===a.start||(this._splitChunk(a,l),a=a.next),a.prependRight(e))}l+=1}l=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 Ke.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Ke.insertLeft=!0),this.appendLeft(e,r)}insertRight(e,r){return Ke.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Ke.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,l=i.next,a=this.byStart[n];if(!a&&i===this.lastChunk)return this;let u=a?a.previous:this.lastChunk;return s&&(s.next=l),l&&(l.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&&(Ke.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Ke.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 l=this.byStart[e],a=this.byEnd[r];if(l){let u=l;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)}l.edit(n,i,!s)}else{let u=new $t(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(pt);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(pt),e!==-1)return n.outro.substr(e+1)+r;r=n.outro+r}if(n.content.length>0){if(e=n.content.lastIndexOf(pt),e!==-1)return n.content.substr(e+1)+r;r=n.content+r}if(n.intro.length>0){if(e=n.intro.lastIndexOf(pt),e!==-1)return n.intro.substr(e+1)+r;r=n.intro+r}}while(n=n.previous);return e=this.intro.lastIndexOf(pt),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 l=i===o?e-o.start:0,a=s?o.content.length+r-o.end:o.content.length;if(n+=o.content.slice(l,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=Sn(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,(l,a)=>a==="$"?"$":a==="&"?i[0]:+a<i.length?i[+a]:`$${a}`):r(...i,i.index,s,i.groups)}c(n,"getReplacement");function o(i,s){let l,a=[];for(;l=i.exec(s);)a.push(l);return a}if(c(o,"matchAll"),e.global)o(e,this.original).forEach(s=>{if(s.index!=null){let l=n(s,this.original);l!==s[0]&&this.overwrite(s.index,s.index+s[0].length,l)}});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),l=r;typeof r=="function"&&(l=r(s,i,n)),s!==l&&this.overwrite(i,i+o,l)}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 oe(t){return Array.isArray(t)?t.flatMap(e=>V(e)??[]):[]}function Ge(t){let e=V(t);return e?typeof e.name=="string"?e.name:e.type==="JSXMemberExpression"?`${Ge(e.object)}.${Ge(e.property)}`:e.type==="JSXNamespacedName"?`${Ge(e.namespace)}:${Ge(e.name)}`:"":""}function xe(t){try{let e=(0,vn.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=c((a,u,p)=>{if(a.type==="JSXElement"||a.type==="JSXFragment"){let f=V(a.openingElement??a.openingFragment),h=V(a.closingElement??a.closingFragment),g=V(f.name),y=a.type==="JSXFragment"?"Fragment":Ge(g);if(t[a.start]!=="<"||f.end<=a.start||!y)throw new Error("Astro source range does not address an authored opening tag");let x=y==="Fragment"?"fragment":y==="slot"?"slot":y==="script"?"script":y==="style"?"style":/^[A-Z]/.test(y)||y.includes(".")?"component":"native-element",S=oe(f.attributes).map(C=>({name:C.type==="JSXSpreadAttribute"?null:Ge(C.name),start:C.start,end:C.end,spread:C.type==="JSXSpreadAttribute",value:V(C.value??C.argument)})),w=oe(a.children);o.set(a.start,{kind:x,tagName:y,start:a.start,end:a.end,openingEnd:f.end,nameEnd:g?.end??f.end-1,childrenStart:h?f.end:null,childrenEnd:h?.start??null,selfClosing:f.selfClosing===!0,parentOffset:u,scopes:p,attributes:S,children:w,node:a});for(let C of oe(f.attributes))i(C,a.start,[...p,C.start]);for(let C of w)i(C,a.start,p);return}if(a.type==="JSXText")return;let d=a.type==="JSXExpressionContainer"?[...p,a.start]:p;for(let f of Object.values(a))if(Array.isArray(f))for(let h of oe(f))i(h,u,d);else{let h=V(f);h&&i(h,u,d)}},"visit");for(let a of oe(n.body))i(a,null,[]);let s=V(n.frontmatter),l=V(s?.program);return{kind:"ok",root:n,elements:o,sourceVersion:ke(t),frontmatter:s&&s.end>s.start&&l?{start:s.start,end:s.end,contentStart:l.start,contentEnd:l.end}:null,imports:oe(l?.body).filter(a=>a.type==="ImportDeclaration")}}catch(e){return{kind:"invalid",message:e instanceof Error?e.message:String(e)}}}function we(t){if(!t)return{known:!0,value:!0};if(t.type==="JSXExpressionContainer"){let r=V(t.expression);return r?we(r):{known:!1}}let e=Ie(t);if(e.type==="TemplateLiteral"){let r=Te(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=we(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?we(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 oe(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 l=we(s);if(!l.known)return l;r[i]=l.value}return{known:!0,value:r}}return{known:!1}}var vn,Xe=O(()=>{"use strict";vn=require("@astrojs/compiler-rs");Mt();Je();c(V,"astroNode");c(oe,"astroNodes");c(Ge,"astroName");c(xe,"parseAstroSource");c(we,"readAstroLiteral")});function fa(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=we(r.value);o.known?e.set(n,o.value):e.delete(n)}return Object.fromEntries(e)}function ma(t){let e=V(t.key);return t.type==="Property"&&e?ct(e,t.computed===!0):null}function ga(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],l=s.value?.type==="JSXExpressionContainer"?V(s.value.expression):s.value,a=l&&Ie(l);if(o==="style"&&i>n&&a?.type==="ObjectExpression"){let p=oe(a.properties),d=new Map;for(let f of p){let h=ma(f);if(h===null){for(let y of d.keys())d.set(y,!1);continue}let g=f.method||f.kind!=="init"?{known:!1}:we(V(f.value));d.delete(h),d.set(h,g.known&&(g.value===null||["string","number"].includes(typeof g.value)))}for(let[f,h]of d)h||e.push(`style.${f}`);continue}let u=we(t.attributes[i].value);(i<n||!u.known)&&e.push(o==="class"?"className":o)}return e.length?e.join(" "):n>=0?"":void 0}function En(t,e,r=e.filepath){let n=xe(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 $e(t),i="$$tempoAstroHostId";for(;t.includes(i);)i+="_";for(let s of n.elements.values()){if(s.attributes.some(({name:p})=>p===bn||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 l=ga(s),a=s.kind==="component"?{[bn]:{...e,position:s.start,name:s.tagName,expressions:l,literalProps:fa(s)}}:{"data-tempo-filepath":e.filepath,"data-tempo-position":s.start,"data-tempo-modifiedts":e.modifiedTs,"data-tempo-source-version":e.sourceVersion,...l!==void 0?{"data-tempo-expr":l}:{}},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,d])=>` ${p}={${JSON.stringify(d)}}`).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 bn,wn=O(()=>{"use strict";Mt();Sr();Xe();bn="__tempo_astro_callsite__";c(fa,"literalComponentProps");c(ma,"styleKey");c(ga,"astroExpressionFacts");c(En,"annotateAstroSource")});function xn(t,e,r,n){let o=(0,vr.parseSync)(`${e}.js`,t);if(o.errors.length)return;let i="$$tempoFrameworkComponent";for(;t.includes(i);)i+="_";let s=new $e(t),l=new Map,a=!1;for(let u of o.program.body)if(u.type==="ExportDefaultDeclaration"){let p=u.declaration;p.type==="Identifier"?l.set(p.name,"default"):(p.type==="FunctionDeclaration"||p.type==="ClassDeclaration")&&p.id?l.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 d of p.declarations)d.id.type==="Identifier"&&l.set(d.id.name,d.id.name);else(p?.type==="FunctionDeclaration"||p?.type==="ClassDeclaration")&&p.id&&l.set(p.id.name,p.id.name);for(let d of u.specifiers)d.local.type==="Identifier"&&l.set(d.local.name,d.exported.type==="Identifier"?d.exported.name:d.exported.value)}if(!(!a&&!l.size)){s.prepend(`import { instrumentFrameworkComponent as ${i} } from ${JSON.stringify(n)};
13
- `);for(let[u,p]of l)s.append(`
14
- ${i}(${u}, ${JSON.stringify({...r,exportName:p})});`);return{code:s.toString(),map:s.generateMap({source:e,includeContent:!0,hires:!0})}}}function br(t,e,r,n,o,i=console.warn){let s=(0,vr.parseSync)(`${e}.js`,t),l=s.module.staticImports.map(h=>h.moduleRequest.value),a=c(h=>{if(i(`Tempo could not instrument ${e}: ${h}. Imports: ${l.join(", ")||"none"}`),s.errors.length||!t.includes(o))return{code:t,map:null};let g=new $e(t);return g.prepend(`import { astroHostId as ${o} } from ${JSON.stringify(n)};
15
- `),{code:g.toString(),map:g.generateMap({source:e,includeContent:!0,hires:!0})}},"unchanged");if(s.errors.length)return a("compiled code could not be parsed");let u=new $e(t),p="$$tempo";for(;t.includes(p);)p+="_";let d=[],f=!1;for(let h of s.program.body){if(h.type!=="ImportDeclaration")continue;let g=h.source.value.split(/[?#]/)[0];if(!(g!=="astro/runtime/server/index.js"&&g!=="astro/compiler-runtime"&&g!=="astro/runtime/compiler/index.js"&&!g.endsWith("/astro/dist/runtime/compiler/index.js")))for(let y of h.specifiers){if(y.type!=="ImportSpecifier"||y.imported.type!=="Identifier")continue;let x=y.imported.name;if(x!=="createComponent"&&x!=="renderComponent")continue;if(x==="createComponent"&&!r){f=!0;continue}let S=y.local,w=`${p}_${x}`;u.overwrite(y.start,y.end,`${x} as ${w}`);let C=x==="createComponent"?"instrumentCreateComponent":"instrumentRenderComponent";d.push(`const ${S.name} = ${p}_${C}(${w}${x==="createComponent"?`, ${JSON.stringify(r)}`:""});`),x==="createComponent"&&(f=!0)}}return f?(u.prepend(`import { astroHostId as ${o}, instrumentCreateComponent as ${p}_instrumentCreateComponent, instrumentRenderComponent as ${p}_instrumentRenderComponent } from ${JSON.stringify(n)};
9
+ `,Ge={insertLeft:!1,insertRight:!1,storeName:!1},Le=class t{static{l(this,"MagicString")}constructor(e,r={}){let n=new Lt(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 $t},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 $t(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 yr(e.hires),i=Sn(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?ca(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 hr(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=la(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(pa(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 d=p[0];d<p[1];d+=1)o[d]=!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
+ `));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 Ge.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Ge.insertLeft=!0),this.appendLeft(e,r)}insertRight(e,r){return Ge.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Ge.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&&(Ge.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Ge.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 Lt(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(pt);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(pt),e!==-1)return n.outro.substr(e+1)+r;r=n.outro+r}if(n.content.length>0){if(e=n.content.lastIndexOf(pt),e!==-1)return n.content.substr(e+1)+r;r=n.content+r}if(n.intro.length>0){if(e=n.intro.lastIndexOf(pt),e!==-1)return n.intro.substr(e+1)+r;r=n.intro+r}}while(n=n.previous);return e=this.intro.lastIndexOf(pt),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=Sn(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 oe(t){return Array.isArray(t)?t.flatMap(e=>V(e)??[]):[]}function Xe(t){let e=V(t);return e?typeof e.name=="string"?e.name:e.type==="JSXMemberExpression"?`${Xe(e.object)}.${Xe(e.property)}`:e.type==="JSXNamespacedName"?`${Xe(e.namespace)}:${Xe(e.name)}`:"":""}function xe(t){try{let e=(0,vn.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 f=V(a.openingElement??a.openingFragment),y=V(a.closingElement??a.closingFragment),g=V(f.name),h=a.type==="JSXFragment"?"Fragment":Xe(g);if(t[a.start]!=="<"||f.end<=a.start||!h)throw new Error("Astro source range does not address an authored opening tag");let v=h==="Fragment"?"fragment":h==="slot"?"slot":h==="script"?"script":h==="style"?"style":/^[A-Z]/.test(h)||h.includes(".")?"component":"native-element",S=oe(f.attributes).map(C=>({name:C.type==="JSXSpreadAttribute"?null:Xe(C.name),start:C.start,end:C.end,spread:C.type==="JSXSpreadAttribute",value:V(C.value??C.argument)})),x=oe(a.children);o.set(a.start,{kind:v,tagName:h,start:a.start,end:a.end,openingEnd:f.end,nameEnd:g?.end??f.end-1,childrenStart:y?f.end:null,childrenEnd:y?.start??null,selfClosing:f.selfClosing===!0,parentOffset:u,scopes:p,attributes:S,children:x,node:a});for(let C of oe(f.attributes))i(C,a.start,[...p,C.start]);for(let C of x)i(C,a.start,p);return}if(a.type==="JSXText")return;let d=a.type==="JSXExpressionContainer"?[...p,a.start]:p;for(let f of Object.values(a))if(Array.isArray(f))for(let y of oe(f))i(y,u,d);else{let y=V(f);y&&i(y,u,d)}},"visit");for(let a of oe(n.body))i(a,null,[]);let s=V(n.frontmatter),c=V(s?.program);return{kind:"ok",root:n,elements:o,sourceVersion:Te(t),frontmatter:s&&s.end>s.start&&c?{start:s.start,end:s.end,contentStart:c.start,contentEnd:c.end}:null,imports:oe(c?.body).filter(a=>a.type==="ImportDeclaration")}}catch(e){return{kind:"invalid",message:e instanceof Error?e.message:String(e)}}}function we(t){if(!t)return{known:!0,value:!0};if(t.type==="JSXExpressionContainer"){let r=V(t.expression);return r?we(r):{known:!1}}let e=Ie(t);if(e.type==="TemplateLiteral"){let r=ke(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=we(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?we(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 oe(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=we(s);if(!c.known)return c;r[i]=c.value}return{known:!0,value:r}}return{known:!1}}var vn,ze=O(()=>{"use strict";vn=require("@astrojs/compiler-rs");Ot();Ke();l(V,"astroNode");l(oe,"astroNodes");l(Xe,"astroName");l(xe,"parseAstroSource");l(we,"readAstroLiteral")});function fa(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=we(r.value);o.known?e.set(n,o.value):e.delete(n)}return Object.fromEntries(e)}function ma(t){let e=V(t.key);return t.type==="Property"&&e?ct(e,t.computed===!0):null}function ga(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&&Ie(c);if(o==="style"&&i>n&&a?.type==="ObjectExpression"){let p=oe(a.properties),d=new Map;for(let f of p){let y=ma(f);if(y===null){for(let h of d.keys())d.set(h,!1);continue}let g=f.method||f.kind!=="init"?{known:!1}:we(V(f.value));d.delete(y),d.set(y,g.known&&(g.value===null||["string","number"].includes(typeof g.value)))}for(let[f,y]of d)y||e.push(`style.${f}`);continue}let u=we(t.attributes[i].value);(i<n||!u.known)&&e.push(o==="class"?"className":o)}return e.length?e.join(" "):n>=0?"":void 0}function En(t,e,r=e.filepath){let n=xe(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 Le(t),i="$$tempoAstroHostId";for(;t.includes(i);)i+="_";for(let s of n.elements.values()){if(s.attributes.some(({name:p})=>p===bn||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=ga(s),a=s.kind==="component"?{[bn]:{...e,position:s.start,name:s.tagName,expressions:c,literalProps:fa(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,d])=>` ${p}={${JSON.stringify(d)}}`).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 bn,wn=O(()=>{"use strict";Ot();Sr();ze();bn="__tempo_astro_callsite__";l(fa,"literalComponentProps");l(ma,"styleKey");l(ga,"astroExpressionFacts");l(En,"annotateAstroSource")});function xn(t,e,r,n){let o=(0,vr.parseSync)(`${e}.js`,t);if(o.errors.length)return;let i="$$tempoFrameworkComponent";for(;t.includes(i);)i+="_";let s=new Le(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 d of p.declarations)d.id.type==="Identifier"&&c.set(d.id.name,d.id.name);else(p?.type==="FunctionDeclaration"||p?.type==="ClassDeclaration")&&p.id&&c.set(p.id.name,p.id.name);for(let d of u.specifiers)d.local.type==="Identifier"&&c.set(d.local.name,d.exported.type==="Identifier"?d.exported.name:d.exported.value)}if(!(!a&&!c.size)){s.prepend(`import { instrumentFrameworkComponent as ${i} } from ${JSON.stringify(n)};
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 br(t,e,r,n,o,i=console.warn){let s=(0,vr.parseSync)(`${e}.js`,t),c=s.module.staticImports.map(y=>y.moduleRequest.value),a=l(y=>{if(i(`Tempo could not instrument ${e}: ${y}. Imports: ${c.join(", ")||"none"}`),s.errors.length||!t.includes(o))return{code:t,map:null};let g=new Le(t);return g.prepend(`import { astroHostId as ${o} } from ${JSON.stringify(n)};
15
+ `),{code:g.toString(),map:g.generateMap({source:e,includeContent:!0,hires:!0})}},"unchanged");if(s.errors.length)return a("compiled code could not be parsed");let u=new Le(t),p="$$tempo";for(;t.includes(p);)p+="_";let d=[],f=!1;for(let y of s.program.body){if(y.type!=="ImportDeclaration")continue;let g=y.source.value.split(/[?#]/)[0];if(!(g!=="astro/runtime/server/index.js"&&g!=="astro/compiler-runtime"&&g!=="astro/runtime/compiler/index.js"&&!g.endsWith("/astro/dist/runtime/compiler/index.js")))for(let h of y.specifiers){if(h.type!=="ImportSpecifier"||h.imported.type!=="Identifier")continue;let v=h.imported.name;if(v!=="createComponent"&&v!=="renderComponent")continue;if(v==="createComponent"&&!r){f=!0;continue}let S=h.local,x=`${p}_${v}`;u.overwrite(h.start,h.end,`${v} as ${x}`);let C=v==="createComponent"?"instrumentCreateComponent":"instrumentRenderComponent";d.push(`const ${S.name} = ${p}_${C}(${x}${v==="createComponent"?`, ${JSON.stringify(r)}`:""});`),v==="createComponent"&&(f=!0)}}return f?(u.prepend(`import { astroHostId as ${o}, instrumentCreateComponent as ${p}_instrumentCreateComponent, instrumentRenderComponent as ${p}_instrumentRenderComponent } from ${JSON.stringify(n)};
16
16
  ${d.join(`
17
17
  `)}
18
- `),{code:u.toString(),map:u.generateMap({source:e,includeContent:!0,hires:!0})}):a("Astro createComponent import was not found")}var vr,Cn=O(()=>{Sr();vr=require("oxc-parser");c(xn,"instrumentFrameworkModule");c(br,"instrumentAstroModule")});function An(t,e,r){let n=(0,re.resolve)(e??t);if(!e)for(let l=n;;l=(0,re.dirname)(l)){let a=(0,re.join)(l,"tempo/tempo.config.json");if((0,fe.existsSync)(a)){let u=JSON.parse((0,fe.readFileSync)(a,"utf8"));if(l===t||(0,re.resolve)(l,u.apps?.[0]?.appDir??u.appDir??".")===t){n=l;break}}if((0,re.dirname)(l)===l)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 _n(t){let e=new Set,r=c((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 l=(0,fe.readFileSync)(s,"utf8"),a=xe(l);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 d=p.startsWith(".")?(0,re.resolve)((0,re.dirname)(s),p):p;(!p.startsWith(".")||(0,fe.existsSync)(d))&&e.add(d)}}}},"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,Rn=O(()=>{fe=require("node:fs"),re=require("node:path");Xe();c(An,"astroProjectContext");c(_n,"discoverAstroStyles")});var Ce,Lt=O(()=>{Ce=__tempoRuntime.sdkModuleUrl});function dt(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 kn,Ft=O(()=>{"use strict";c(dt,"parseFlutterPreview");kn="data-tempo-flutter-preview-key"});var ha,ft,Dt,Er=O(()=>{"use strict";ha={Storyboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".tsx"},SvelteStoryboard:{importSource:"tempo-sdk/canvas/svelte",kind:"component",uiFramework:"svelte",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".svelte"},VueStoryboard:{importSource:"tempo-sdk/canvas/vue",kind:"component",uiFramework:"vue",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".vue"},AstroStoryboard:{importSource:"tempo-sdk/canvas/astro",kind:"component",uiFramework:"astro",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".astro",componentImportQuery:"?tempo-component"},FlutterStoryboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!0},RouteStoryboard:{importSource:"tempo-sdk/canvas",kind:"route",requiresComponentProp:!1,allowsVrt:!1},HtmlStoryboard:{importSource:"tempo-sdk/canvas",kind:"html",requiresComponentProp:!1,allowsVrt:!0},LegacyStoryboardV1:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!1}},ft=ha,Dt=Object.keys(ft)});function Nn(t){return t.componentFramework??t.runtimeFramework??t.uiFramework}function Ye(t,e){let r=[],n;try{let S=(0,Pn.parseSync)(t,e);n=S.program;for(let w of S.errors??[])r.push({message:w.message??"Unable to parse canvas source",span:N(w)??N(w?.labels?.[0]),kind:"structural"})}catch(S){return{filePath:t,pageName:In(t),imports:[],misimportedSdkCanvasImports:[],storyboards:[],errors:[{message:S instanceof Error?S.message:"Unable to parse canvas source",kind:"structural"}]}}let o=xa(n),i=wa(n),{legacyObjects:s,stringBindings:l}=Ca(n,o,e),a=null,u=[];Cr(n,S=>{if(S.type!=="JSXElement")return;let w=Ar(S.openingElement?.name,o),C=Ua(S.openingElement?.name,o,i);if(C&&i.add(C),w==="Canvas"){a?r.push({message:"Canvas file must declare exactly one <Canvas> element",span:N(S),kind:"structural"}):a=S;return}_r(w)&&u.push({element:S,component:w})});let p=a?Ta(a,o):[],d=new Set(p.map(S=>S.element)),f=p.map(S=>ka(S.element,S.component,o,s,e,r));for(let S of u)d.has(S.element)||r.push({message:`<${S.component}> declarations must be direct children of the <Canvas> element`,span:N(S.element),kind:"structural"});if(Ia(f,r),a)r.push(...Pa(a,o));else if(i.all.length>0)for(let S of i.all)r.push({message:Ea(S),span:S.sourceSpan,kind:"structural"});else r.push({message:ba,kind:"structural"});let h=a?.openingElement,g=wr(h,"name",l),y=Pe(h,"path"),x=wr(h,"backgroundColor",l)??wr(h,"background",l);return h&&!g&&r.push({message:'<Canvas> must include a literal "name" prop',span:N(h),kind:"degraded"}),{filePath:t,canvasPath:y?.value,pageName:g?.value??In(t),backgroundColor:x?.value,canvasElementSpan:N(a),canvasOpeningElementSpan:N(h),canvasChildrenInsertionOffset:typeof a?.closingElement?.start=="number"?a.closingElement.start:void 0,nameSpan:g?.valueSpan,nameAttributeSpan:g?.attributeSpan,pathSpan:y?.valueSpan,pathAttributeSpan:y?.attributeSpan,backgroundColorSpan:x?.valueSpan,backgroundColorAttributeSpan:x?.attributeSpan,imports:o.all,misimportedSdkCanvasImports:i.all,storyboards:f,errors:r}}function Ea(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=c(i=>{let s=Ba(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"||!Hn(i.source.value)||i.importKind==="type")continue;let s=i.source.value,l=N(i.source);if(!l)continue;let a=(i.specifiers??[]).filter(f=>f?.importKind!=="type"),u=a.map(Ht),p={source:s,sourceSpan:l,importedNames:u,rewritable:a.length>0&&a.every(f=>f?.type==="ImportSpecifier"&&va.has(Ht(f)))};a.some(f=>f?.type==="ImportSpecifier"&&jt.has(Ht(f)))&&o(p);for(let f of a){if(f?.type!=="ImportNamespaceSpecifier")continue;let h=f.local?.name;typeof h=="string"&&n.set(h,p)}}return{all:e,byDeclarationKey:r,namespaceCandidatesByLocalName:n,add:o}}function xa(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,l=Dn(s);for(let a of i.specifiers??[]){let u=a.local?.name;if(typeof u!="string")continue;let p=Ht(a),d={localName:u,source:s,importedName:p,kind:Wa(a),importKind:a.importKind==="type"?"type":"value",span:N(a)??N(i)??{start:0,end:0},declarationSpan:N(i)??{start:0,end:0},specifierCount:i.specifiers?.length??0,namedSpecifierCount:(i.specifiers??[]).filter(f=>f?.type==="ImportSpecifier").length,hasDefaultSpecifier:(i.specifiers??[]).some(f=>f?.type==="ImportDefaultSpecifier"),hasNamespaceSpecifier:(i.specifiers??[]).some(f=>f?.type==="ImportNamespaceSpecifier")};if(e.push(d),r.set(u,d),!!l){if(a.type==="ImportNamespaceSpecifier"){o.add(u);continue}jt.has(p)&&n.set(u,p)}}}return{all:e,byLocalName:r,sdkLocalNames:n,sdkNamespaces:o}}function Ca(t,e,r){let n=new Map,o=new Map;for(let i of Aa(t)){if(i.id?.type!=="Identifier")continue;let s=Ut(i.init);if(s?.type!=="ObjectExpression")continue;let l=i.id.name;n.set(l,_a(l,s,e,r));let a=Ra(s);a.size>0&&o.set(l,a)}return{legacyObjects:n,stringBindings:o}}function Aa(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 _a(t,e,r,n){let o=[],i=Ne(e,"name"),s=i?Ln(i.value):null,l=Ne(e,"layout"),a=l?$n(l.value,"LegacyStoryboardV1"):{value:qe,errors:[{message:'<LegacyStoryboardV1> storyboard object must include a literal "layout" object',span:N(e),kind:"degraded"}]},u=Ne(e,"render"),p=Fa(u?.value,r,n);return i&&!s&&o.push({message:"<LegacyStoryboardV1> storyboard.name must be a string literal when set",span:N(i),kind:"degraded"}),o.push(...a.errors),{bindingName:t,displayName:s?.value,component:p??void 0,objectSpan:N(e),objectClose:xr(e),nameSpan:s?.span,namePropertySpan:N(i),layoutPropertySpan:N(l),layout:a.value,layoutSpans:a.spans,errors:o}}function Ra(t){let e=new Map;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;let n=Vt(r.key),o=Ln(r.value);!n||!o||e.set(n,o)}return e}function ka(t,e,r,n,o,i){let s=t.openingElement,l=[],a=Pe(s,"id"),u=Pe(s,"name"),p=e==="LegacyStoryboardV1"?Tn(s,"storyboard",o):void 0,d=p?.expression&&Da(p.expression)?n.get(p.expression):void 0,f=e==="LegacyStoryboardV1"?{value:d?.layout??qe,spans:d?.layoutSpans,attributeSpan:void 0,errors:d?.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:N(s),kind:"degraded"}])}:Ha(s,e),h=ft[e];a||l.push({message:`<${e}> must include a literal "id" prop`,span:N(s),kind:"structural"}),f.errors.length>0&&l.push(...f.errors);let g={storyboardKey:a?.value??"",displayName:u?.value??d?.displayName,kind:h.kind,...h.uiFramework?{componentFramework:h.uiFramework}:{},...h.uiFramework==="svelte"?{uiFramework:h.uiFramework}:h.uiFramework==="astro"?{runtimeFramework:h.uiFramework}:{},layout:f.value,editable:!!a&&f.errors.length===0,jsxElementSpan:N(t)??{start:0,end:0},openingElementSpan:N(s),idSpan:a?.valueSpan,idAttributeSpan:a?.attributeSpan,nameSpan:u?.valueSpan??d?.nameSpan,nameAttributeSpan:u?.attributeSpan??d?.namePropertySpan,layoutAttributeSpan:f.attributeSpan,layoutSpans:f.spans,props:Tn(s,"props",o),component:d?.component,legacyV1:p?{storyboard:p,objectName:d?.bindingName,objectSpan:d?.objectSpan,objectClose:d?.objectClose,namePropertySpan:d?.namePropertySpan,layoutPropertySpan:d?.layoutPropertySpan}:void 0,errors:l};if(h.requiresComponentProp){let y=La(s,r,o);y?g.component=y:l.push({message:`<${e}> must include a "component" expression prop`,span:N(s),kind:"degraded"})}if(h.allowsVrt){let y=On(s,l);y&&(y.value&&(g.vrt=y.value),g.vrtAttributeSpan=y.attributeSpan)}if(e==="RouteStoryboard"){let y=Pe(s,"route");y?(g.route=y.value,g.routeSpan=y.valueSpan,g.routeAttributeSpan=y.attributeSpan):l.push({message:'<RouteStoryboard> must include a literal "route" prop',span:N(s),kind:"degraded"})}if(e==="HtmlStoryboard"){let y=Pe(s,"filepath"),x=Pe(s,"src");g.filepath=y?.value.trim()?y.value:void 0,g.filepathSpan=y?.valueSpan,g.filepathAttributeSpan=y?.attributeSpan,g.src=x?.value,g.srcSpan=x?.valueSpan,g.srcAttributeSpan=x?.attributeSpan,!y?.value.trim()&&!x?.value.trim()&&l.push({message:'<HtmlStoryboard> must include a literal "filepath" or "src" prop',span:N(s),kind:"degraded"})}if(e==="FlutterStoryboard"){let y=Pe(s,"preview");if(y?.value.trim()){g.preview=y.value,g.previewSpan=y.valueSpan,g.previewAttributeSpan=y.attributeSpan;let x=dt(y.value);"error"in x&&l.push({message:`flutter_preview_invalid: ${x.error}`,span:y.valueSpan,kind:"structural"})}else l.push({message:'<FlutterStoryboard> must include a literal "preview" prop naming a Flutter @Preview function, e.g. preview="../../lib/cards.dart#productCard"',span:N(je(s,"preview")??s),kind:"structural"})}return i.push(...l),g}function Ta(t,e){let r=[];for(let n of t.children??[]){if(n?.type!=="JSXElement")continue;let o=Ar(n.openingElement?.name,e);_r(o)&&r.push({element:n,component:o})}return r}function Ia(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 Pa(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:N(n),kind:"structural"});continue}if(n.type==="JSXElement"){let o=Ar(n.openingElement?.name,e);if(_r(o))continue;let i=Ma(n.openingElement?.name,e);if(i){r.push(Oa(n,i));continue}}r.push({message:Sa,span:N(n),kind:"structural"})}return r}function Ma(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=Na.test(n),i=r.endsWith("Storyboard");return o&&i?r:null}function Oa(t,e){let r=t.openingElement,n=Pe(r,"id")?.value,o=On(r,[])?.value!=null,i=n?` id="${n}"`:"";return{message:`<${e}${i}> is a storyboard from a newer tempo-sdk than this reader supports`,span:N(t),kind:"structural",newerSdkStoryboard:{component:e,...n?{storyboardKey:n}:{},vrt:o}}}function On(t,e){let r=je(t,"vrt");if(!r)return null;let n=N(r);if(r.value==null)return{value:{},attributeSpan:n};let o=Ut(Qe(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:N(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:N(s??o),kind:"degraded"});continue}let l=Vt(s.key);if(l==="threshold"){let a=ze(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:N(s),kind:"degraded"});continue}if(l==="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:N(s),kind:"degraded"});continue}if(l==="ignore"){let a=$a(s.value,e);a&&(i.ignore=a);continue}e.push({message:`<Storyboard> vrt has unknown property "${l??"?"}" \u2014 expected threshold, skip, or ignore`,span:N(s),kind:"degraded"})}return{value:i,attributeSpan:n}}function $a(t,e){if(t?.type!=="ArrayExpression")return e.push({message:"<Storyboard> vrt.ignore must be an array of { x, y, w, h } literals",span:N(t),kind:"degraded"}),null;let r=[];for(let n of t.elements??[]){let o={};for(let i of["x","y","w","h"]){let s=Ne(n,i),l=s?ze(s.value):null;l&&(o[i]=l.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:N(n)??N(t),kind:"degraded"}),null;r.push(o)}return r}function La(t,e,r){let n=je(t,"component"),o=Qe(n?.value),i=N(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:N(n),localName:s,import:s?e.byLocalName.get(s):void 0}}function Fa(t,e,r){if(t?.type!=="ArrowFunctionExpression")return null;let n=Ut(t.body);if(n?.type!=="JSXElement")return null;let o=n.openingElement?.name;if(o?.type!=="JSXIdentifier")return null;let i=N(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 Tn(t,e,r){let n=je(t,e),o=Qe(n?.value),i=N(o);if(!(!o||!i))return{expression:r.slice(i.start,i.end),span:i,attributeSpan:N(n)}}function Da(t){return/^[A-Za-z_$][\w$]*$/.test(t)}function Ha(t,e){let r=Fn(e),n=je(t,"layout"),o=Qe(n?.value);return o?{...$n(o,e),attributeSpan:N(n)}:{value:r?Mn:qe,attributeSpan:N(n),errors:[{message:`<${e}> must include a literal "layout" object prop`,span:N(t),kind:"degraded"}]}}function $n(t,e){let r=[],n=Fn(e);if(t.type!=="ObjectExpression")return{value:n?Mn:qe,spans:{layoutClose:xr(t)},errors:[{message:`<${e}> layout must be an object literal`,span:N(t),kind:"degraded"}]};let o={layoutClose:xr(t)},i={...qe},s=Ne(t,"width"),l=Ne(t,"height"),a=Ne(t,"intrinsicSizing"),u=a?.value?.value==="root-element",d=n||!!(s&&l)&&!u;!n&&!!s!=!!l&&r.push({message:"layout.width and layout.height must be set together",span:N(t),kind:"degraded"});let h=d?{width:s?ze(s.value):null,height:l?ze(l.value):null}:null,g=d?["x","y","width","height"]:["x","y"];for(let S of g){let w=S==="width"?s:S==="height"?l:Ne(t,S),C=S==="width"||S==="height"?h?.[S]:w?ze(w.value):null,k=S==="x"||S==="y"||n||!!(h?.width&&h.height);if(!C){r.push({message:`<${e}> layout.${S} must be a number literal`,span:N(w??t),kind:"degraded"});continue}k&&(i[S]=C.value,o[S]=C.span)}let y=Ne(t,"zIndex");if(y){let S=ze(y.value);S?(i.zIndex=S.value,o.zIndex=S.span):r.push({message:`<${e}> layout.zIndex must be a number literal`,span:N(y),kind:"degraded"})}return a&&(a.value?.type!=="Literal"||!u)&&r.push({message:`<${e}> layout.intrinsicSizing must be "root-element" when set`,span:N(a),kind:"degraded"}),{value:i,spans:o,errors:r}}function Ln(t){return t?.type==="Literal"&&typeof t.value=="string"?{value:t.value,span:N(t)??{start:0,end:0}}:null}function Ut(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function wr(t,e,r){let n=Pe(t,e);if(n)return n;let o=je(t,e),i=Qe(o?.value),s=N(i),l=N(o);if(!i||!s||!l)return null;let a=ja(i,r);return a?{value:a.value,valueSpan:s,attributeSpan:l}:null}function ja(t,e){if(t?.type!=="MemberExpression"||t.object?.type!=="Identifier")return null;let r=Vt(t.property);return r?e.get(t.object.name)?.get(r)??null:null}function Pe(t,e){let r=je(t,e);if(!r)return null;let n=r.value;if(n?.type==="Literal"&&typeof n.value=="string")return{value:n.value,valueSpan:N(n)??N(r)??{start:0,end:0},attributeSpan:N(r)??{start:0,end:0}};let o=Ut(Qe(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:N(o)??N(r)??{start:0,end:0},attributeSpan:N(r)??{start:0,end:0}}:null}function je(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 Qe(t){return t?t.type==="JSXExpressionContainer"?t.expression:t:null}function Vt(t){return t?.type==="Identifier"?t.name:t?.type==="Literal"&&typeof t.value=="string"?t.value:null}function Ne(t,e){if(t?.type!=="ObjectExpression")return null;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;if(Vt(r.key)===e)return r}return null}function ze(t){return t?.type==="Literal"&&typeof t.value=="number"&&Number.isFinite(t.value)?{value:t.value,span:N(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:N(t)??{start:0,end:0}}:null}function Ar(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)&&jt.has(t.property.name)?t.property.name:null}function Ua(t,e,r){if(t?.type!=="JSXMemberExpression"||t.object?.type!=="JSXIdentifier"||t.property?.type!=="JSXIdentifier"||!jt.has(t.property.name))return null;let n=e.byLocalName.get(t.object.name);return n?.kind!=="namespace"||!Hn(n.source)?null:r.namespaceCandidatesByLocalName.get(t.object.name)??null}function _r(t){return t!==null&&t!=="Canvas"}function Va(t){return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`}function Fn(t){return t==="RouteStoryboard"||t==="HtmlStoryboard"||t==="FlutterStoryboard"}function Ht(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"*":t.imported?.name??t.local?.name??"unknown"}function Wa(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"namespace":"named"}function Dn(t){for(let e of ya)if(t===e||t.endsWith(`/${e}`))return!0;return!1}function Hn(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Dn(t)}function Ba(t){return`${t.start}:${t.end}`}function xr(t){return typeof t?.end=="number"&&Number.isFinite(t.end)?t.end-1:void 0}function In(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 N(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 Cr(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)Cr(o,e,r);else typeof n=="object"&&Cr(n,e,r)}}var Pn,ya,jt,Sa,va,qe,Mn,ba,Na,Wt=O(()=>{Ft();Pn=require("oxc-parser");Er();Er();c(Nn,"componentFrameworkForStoryboard");ya=new Set(["tempo-sdk/canvas",...Dt.map(t=>ft[t].importSource)]),jt=new Set(["Canvas",...Dt]),Sa=`<Canvas> children must be ${Va(Dt.map(t=>`<${t}>`))} declarations`,va=new Set(["Canvas","CanvasContext","getCanvasStoryboardRenderId","CanvasHost","buildRenderContentFiberSelector","buildRenderContentSelector","buildRenderSelector","captureStoryboardCombined","captureStoryboardHtml","captureStoryboardImage","stripRenderContentWrapperAttributes","stripRenderContentWrapperFromCombinedCapture","watchStoryboardCombined","getCanvasHostRuntime","getOptionalCanvasHostRuntime","useActiveState","FlutterStoryboard","HtmlStoryboard","LegacyStoryboardV1","RouteStoryboard","Storyboard","StoryboardSlot"]),qe={x:0,y:0},Mn={...qe,width:600,height:400},ba="No <Canvas> declaration found in canvas file";c(Ye,"parseCanvasFile");c(Ea,"misimportedSdkCanvasImportMessage");c(wa,"readMisimportedSdkCanvasImports");c(xa,"readImports");c(Ca,"readObjectExpressionBindings");c(Aa,"readTopLevelVariableDeclarators");c(_a,"readLegacyStoryboardObject");c(Ra,"readObjectStringProperties");c(ka,"readStoryboard");c(Ta,"readDirectCanvasStoryboardElements");c(Ia,"reportDuplicateStoryboardIds");c(Pa,"validateCanvasChildren");Na=/(^|\/)tempo-sdk\/canvas(\/[^/]+)?$/;c(Ma,"resolveNewerSdkStoryboardComponent");c(Oa,"newerSdkStoryboardError");c(On,"readVrt");c($a,"readVrtIgnoreRegions");c(La,"readComponentReference");c(Fa,"readRenderComponentReference");c(Tn,"readExpressionReference");c(Da,"isIdentifierExpression");c(Ha,"readLayout");c($n,"readLayoutExpression");c(Ln,"readStringLiteralValue");c(Ut,"unwrapTsExpression");c(wr,"readResolvableStringAttribute");c(ja,"resolveStringMemberExpression");c(Pe,"readStringAttribute");c(je,"getAttribute");c(Qe,"unwrapAttributeExpression");c(Vt,"readPropertyKeyName");c(Ne,"getObjectProperty");c(ze,"readNumberLiteral");c(Ar,"resolveSdkComponent");c(Ua,"resolveMisimportedNamespaceSdkComponent");c(_r,"isStoryboardSdkComponent");c(Va,"formatAlternatives");c(Fn,"requiresFixedLayoutSize");c(Ht,"readImportedName");c(Wa,"readImportKind");c(Dn,"isSdkImportSource");c(Hn,"isWrongTempoSdkCanvasImportSource");c(Ba,"spanKey");c(xr,"readLayoutClose");c(In,"fallbackPageName");c(N,"toSpan");c(Cr,"walk")});function jn(t,e){return`/__tempo/astro/${encodeURIComponent(t)}/${encodeURIComponent(e)}`}var Un=O(()=>{"use strict";c(jn,"astroStoryboardPath")});function Rr(t){if(!t)return{};let e=(0,Vn.parseSync)("props.ts",`(${t})`);if(e.errors.length)throw new Error("Astro storyboard props must be a JSON object literal");let r=c(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 l of i.properties){if(l.type!=="Property"||l.computed||l.method||l.shorthand||l.kind!=="init")throw new Error("Astro storyboard props cannot contain expressions, spreads or getters");let a=l.key.type==="Identifier"?l.key.name:l.key.value;if(typeof a!="string"&&typeof a!="number")throw new Error("Astro storyboard props require literal keys");s[a]=r(l.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 Vn,Wn=O(()=>{Vn=require("oxc-parser");c(Rr,"readAstroStoryboardProps")});function Gn(t){return(0,ee.existsSync)(t)?(0,ee.readdirSync)(t,{withFileTypes:!0}).flatMap(e=>{if(e.isSymbolicLink())return[];let r=(0,ne.join)(t,e.name);return e.isDirectory()?Gn(r):e.name.endsWith(".canvas.tsx")?[r]:[]}):[]}function Bn(t,e,r,n=[]){let o=[];for(let s of new Set((Array.isArray(e)?e:[e]).flatMap(Gn))){let l=(0,ee.openSync)(s,"r"),a,u;try{let f=(0,ee.fstatSync)(l);a=(0,ee.readFileSync)(l,"utf8");let h=(0,ee.fstatSync)(l);if(!["mtimeMs","ctimeMs","size","ino","dev"].every(g=>f[g]===h[g]))throw new Error(`Canvas changed while reading: ${s}`);u=Math.trunc(f.mtimeMs)}finally{(0,ee.closeSync)(l)}let p=Ye(s,a),d=p.canvasPath??(0,ne.relative)(t,(0,ne.dirname)(s)).replaceAll("\\","/");for(let f of p.storyboards){if(Nn(f)!=="astro")continue;let h=jn(d,f.storyboardKey),g=(0,ne.join)(r,`${(0,kr.createHash)("sha256").update(h).digest("hex")}.astro`),y=(0,kr.createHash)("sha256").update(a).digest("hex"),x;try{if(p.errors.some(P=>P.kind==="structural")||f.errors.length)throw new Error("Fix the Astro storyboard's canvas declaration before rendering it");let S=f.component?.import;if(!S||S.kind!=="default"||!S.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 w=S.source.slice(0,-16),C=w.startsWith(".")?(0,ne.resolve)((0,ne.dirname)(s),w).replaceAll("\\","/"):w,k=JSON.stringify(Rr(f.props?.expression)).replaceAll("<","\\u003c"),L=JSON.stringify({filepath:(0,ne.relative)(t,s).replaceAll("\\","/"),sourceVersion:ke(a),modifiedTs:u,position:f.jsxElementSpan.start,name:f.component?.localName??"Component"}),M=JSON.stringify({canvasPath:d,storyboardId:f.storyboardKey,revision:y}),W;if(s.replaceAll("\\","/").includes("/.tempo/asset-edit-previews/")){for(let P of(0,Kn.parseSync)(s,a).program.body)if(!(P.type!=="ExportNamedDeclaration"||P.declaration?.type!=="VariableDeclaration"))for(let $ of P.declaration.declarations)$.id.type==="Identifier"&&$.id.name==="__tempoAstroAssetPreview"&&$.init&&(W=Rr(a.slice($.init.start,$.init.end)))}if(x=`---
18
+ `),{code:u.toString(),map:u.generateMap({source:e,includeContent:!0,hires:!0})}):a("Astro createComponent import was not found")}var vr,Cn=O(()=>{Sr();vr=require("oxc-parser");l(xn,"instrumentFrameworkModule");l(br,"instrumentAstroModule")});function An(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 _n(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=xe(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 d=p.startsWith(".")?(0,re.resolve)((0,re.dirname)(s),p):p;(!p.startsWith(".")||(0,fe.existsSync)(d))&&e.add(d)}}}},"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,Rn=O(()=>{fe=require("node:fs"),re=require("node:path");ze();l(An,"astroProjectContext");l(_n,"discoverAstroStyles")});var Ce,Ft=O(()=>{Ce=__tempoRuntime.sdkModuleUrl});function dt(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 Tn,Dt=O(()=>{"use strict";l(dt,"parseFlutterPreview");Tn="data-tempo-flutter-preview-key"});var ha,ft,Ht,Er=O(()=>{"use strict";ha={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}},ft=ha,Ht=Object.keys(ft)});function Nn(t){return t.componentFramework??t.runtimeFramework??t.uiFramework}function Qe(t,e){let r=[],n;try{let S=(0,Pn.parseSync)(t,e);n=S.program;for(let x of S.errors??[])r.push({message:x.message??"Unable to parse canvas source",span:P(x)??P(x?.labels?.[0]),kind:"structural"})}catch(S){return{filePath:t,pageName:In(t),imports:[],misimportedSdkCanvasImports:[],storyboards:[],errors:[{message:S instanceof Error?S.message:"Unable to parse canvas source",kind:"structural"}]}}let o=xa(n),i=wa(n),{legacyObjects:s,stringBindings:c}=Ca(n,o,e),a=null,u=[];Cr(n,S=>{if(S.type!=="JSXElement")return;let x=Ar(S.openingElement?.name,o),C=Ja(S.openingElement?.name,o,i);if(C&&i.add(C),x==="Canvas"){a?r.push({message:"Canvas file must declare exactly one <Canvas> element",span:P(S),kind:"structural"}):a=S;return}_r(x)&&u.push({element:S,component:x})});let p=a?ka(a,o):[],d=new Set(p.map(S=>S.element)),f=p.map(S=>Ta(S.element,S.component,o,s,e,r));for(let S of u)d.has(S.element)||r.push({message:`<${S.component}> declarations must be direct children of the <Canvas> element`,span:P(S.element),kind:"structural"});if(Ia(f,r),a)r.push(...Pa(a,o));else if(i.all.length>0)for(let S of i.all)r.push({message:Ea(S),span:S.sourceSpan,kind:"structural"});else r.push({message:ba,kind:"structural"});let y=a?.openingElement,g=wr(y,"name",c),h=Pe(y,"path"),v=wr(y,"backgroundColor",c)??wr(y,"background",c);return y&&!g&&r.push({message:'<Canvas> must include a literal "name" prop',span:P(y),kind:"degraded"}),{filePath:t,canvasPath:h?.value,pageName:g?.value??In(t),backgroundColor:v?.value,canvasElementSpan:P(a),canvasOpeningElementSpan:P(y),canvasChildrenInsertionOffset:typeof a?.closingElement?.start=="number"?a.closingElement.start:void 0,nameSpan:g?.valueSpan,nameAttributeSpan:g?.attributeSpan,pathSpan:h?.valueSpan,pathAttributeSpan:h?.attributeSpan,backgroundColorSpan:v?.valueSpan,backgroundColorAttributeSpan:v?.attributeSpan,imports:o.all,misimportedSdkCanvasImports:i.all,storyboards:f,errors:r}}function Ea(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=Xa(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"||!Hn(i.source.value)||i.importKind==="type")continue;let s=i.source.value,c=P(i.source);if(!c)continue;let a=(i.specifiers??[]).filter(f=>f?.importKind!=="type"),u=a.map(jt),p={source:s,sourceSpan:c,importedNames:u,rewritable:a.length>0&&a.every(f=>f?.type==="ImportSpecifier"&&va.has(jt(f)))};a.some(f=>f?.type==="ImportSpecifier"&&Ut.has(jt(f)))&&o(p);for(let f of a){if(f?.type!=="ImportNamespaceSpecifier")continue;let y=f.local?.name;typeof y=="string"&&n.set(y,p)}}return{all:e,byDeclarationKey:r,namespaceCandidatesByLocalName:n,add:o}}function xa(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=Dn(s);for(let a of i.specifiers??[]){let u=a.local?.name;if(typeof u!="string")continue;let p=jt(a),d={localName:u,source:s,importedName:p,kind:Ga(a),importKind:a.importKind==="type"?"type":"value",span:P(a)??P(i)??{start:0,end:0},declarationSpan:P(i)??{start:0,end:0},specifierCount:i.specifiers?.length??0,namedSpecifierCount:(i.specifiers??[]).filter(f=>f?.type==="ImportSpecifier").length,hasDefaultSpecifier:(i.specifiers??[]).some(f=>f?.type==="ImportDefaultSpecifier"),hasNamespaceSpecifier:(i.specifiers??[]).some(f=>f?.type==="ImportNamespaceSpecifier")};if(e.push(d),r.set(u,d),!!c){if(a.type==="ImportNamespaceSpecifier"){o.add(u);continue}Ut.has(p)&&n.set(u,p)}}}return{all:e,byLocalName:r,sdkLocalNames:n,sdkNamespaces:o}}function Ca(t,e,r){let n=new Map,o=new Map;for(let i of Aa(t)){if(i.id?.type!=="Identifier")continue;let s=mt(i.init);if(s?.type!=="ObjectExpression")continue;let c=i.id.name;n.set(c,_a(c,s,e,r));let a=Ra(s);a.size>0&&o.set(c,a)}return{legacyObjects:n,stringBindings:o}}function Aa(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 _a(t,e,r,n){let o=[],i=Ne(e,"name"),s=i?Ln(i.value):null,c=Ne(e,"layout"),a=c?$n(c.value,"LegacyStoryboardV1"):{value:Ye,errors:[{message:'<LegacyStoryboardV1> storyboard object must include a literal "layout" object',span:P(e),kind:"degraded"}]},u=Ne(e,"render"),p=Ua(u?.value,r,n);return i&&!s&&o.push({message:"<LegacyStoryboardV1> storyboard.name must be a string literal when set",span:P(i),kind:"degraded"}),o.push(...a.errors),{bindingName:t,displayName:s?.value,component:p??void 0,objectSpan:P(e),objectClose:xr(e),nameSpan:s?.span,namePropertySpan:P(i),layoutPropertySpan:P(c),layout:a.value,layoutSpans:a.spans,errors:o}}function Ra(t){let e=new Map;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;let n=Vt(r.key),o=Ln(r.value);!n||!o||e.set(n,o)}return e}function Ta(t,e,r,n,o,i){let s=t.openingElement,c=[],a=Pe(s,"id"),u=Pe(s,"name"),p=e==="LegacyStoryboardV1"?kn(s,"storyboard",o):void 0,d=p?.expression&&Va(p.expression)?n.get(p.expression):void 0,f=e==="LegacyStoryboardV1"?{value:d?.layout??Ye,spans:d?.layoutSpans,attributeSpan:void 0,errors:d?.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:P(s),kind:"degraded"}])}:Wa(s,e),y=ft[e];a||c.push({message:`<${e}> must include a literal "id" prop`,span:P(s),kind:"structural"}),f.errors.length>0&&c.push(...f.errors);let g={storyboardKey:a?.value??"",displayName:u?.value??d?.displayName,kind:y.kind,...y.uiFramework?{componentFramework:y.uiFramework}:{},...y.uiFramework==="svelte"?{uiFramework:y.uiFramework}:y.uiFramework==="astro"?{runtimeFramework:y.uiFramework}:{},layout:f.value,editable:!!a&&f.errors.length===0,jsxElementSpan:P(t)??{start:0,end:0},openingElementSpan:P(s),idSpan:a?.valueSpan,idAttributeSpan:a?.attributeSpan,nameSpan:u?.valueSpan??d?.nameSpan,nameAttributeSpan:u?.attributeSpan??d?.namePropertySpan,layoutAttributeSpan:f.attributeSpan,layoutSpans:f.spans,props:kn(s,"props",o),component:d?.component,legacyV1:p?{storyboard:p,objectName:d?.bindingName,objectSpan:d?.objectSpan,objectClose:d?.objectClose,namePropertySpan:d?.namePropertySpan,layoutPropertySpan:d?.layoutPropertySpan}:void 0,errors:c};if(y.requiresComponentProp){let h=ja(s,r,o);h?g.component=h:c.push({message:`<${e}> must include a "component" expression prop`,span:P(s),kind:"degraded"})}if(y.allowsVrt){let h=On(s,c);h&&(h.value&&(g.vrt=h.value),g.vrtAttributeSpan=h.attributeSpan)}if(y.allowsResponsive){let h=$a(s,c);h&&(g.responsiveAttributeSpan=h.attributeSpan,h.value&&Da(g.layout,h.attributeSpan,c)&&(g.responsive=!0))}else{let h=Me(s,"responsive");h&&c.push({message:`<${e}> does not support responsive`,span:P(h),kind:"degraded"})}if(e==="RouteStoryboard"){let h=Pe(s,"route");h?(g.route=h.value,g.routeSpan=h.valueSpan,g.routeAttributeSpan=h.attributeSpan):c.push({message:'<RouteStoryboard> must include a literal "route" prop',span:P(s),kind:"degraded"})}if(e==="HtmlStoryboard"){let h=Pe(s,"filepath"),v=Pe(s,"src");g.filepath=h?.value.trim()?h.value:void 0,g.filepathSpan=h?.valueSpan,g.filepathAttributeSpan=h?.attributeSpan,g.src=v?.value,g.srcSpan=v?.valueSpan,g.srcAttributeSpan=v?.attributeSpan,!h?.value.trim()&&!v?.value.trim()&&c.push({message:'<HtmlStoryboard> must include a literal "filepath" or "src" prop',span:P(s),kind:"degraded"})}if(e==="FlutterStoryboard"){let h=Pe(s,"preview");if(h?.value.trim()){g.preview=h.value,g.previewSpan=h.valueSpan,g.previewAttributeSpan=h.attributeSpan;let v=dt(h.value);"error"in v&&c.push({message:`flutter_preview_invalid: ${v.error}`,span:h.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:P(Me(s,"preview")??s),kind:"structural"})}return i.push(...c),g}function ka(t,e){let r=[];for(let n of t.children??[]){if(n?.type!=="JSXElement")continue;let o=Ar(n.openingElement?.name,e);_r(o)&&r.push({element:n,component:o})}return r}function Ia(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 Pa(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:P(n),kind:"structural"});continue}if(n.type==="JSXElement"){let o=Ar(n.openingElement?.name,e);if(_r(o))continue;let i=Ma(n.openingElement?.name,e);if(i){r.push(Oa(n,i));continue}}r.push({message:Sa,span:P(n),kind:"structural"})}return r}function Ma(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=Na.test(n),i=r.endsWith("Storyboard");return o&&i?r:null}function Oa(t,e){let r=t.openingElement,n=Pe(r,"id")?.value,o=On(r,[])?.value!=null,i=n?` id="${n}"`:"";return{message:`<${e}${i}> is a storyboard from a newer tempo-sdk than this reader supports`,span:P(t),kind:"structural",newerSdkStoryboard:{component:e,...n?{storyboardKey:n}:{},vrt:o}}}function $a(t,e){let r=Me(t,"responsive");if(!r)return null;let n=P(r);if(r.value==null)return{value:!0,attributeSpan:n};let o=mt(Ue(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:P(o)??n,kind:"degraded"}),{value:!1,attributeSpan:n})}function Da(t,e,r){let{width:n,height:o}=t;return n===void 0||o===void 0?!0:n>La||o>Fa?(r.push({message:"responsive supports at most 3840x12000",span:e,kind:"degraded"}),!1):!0}function On(t,e){let r=Me(t,"vrt");if(!r)return null;let n=P(r);if(r.value==null)return{value:{},attributeSpan:n};let o=mt(Ue(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:P(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:P(s??o),kind:"degraded"});continue}let c=Vt(s.key);if(c==="threshold"){let a=qe(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:P(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:P(s),kind:"degraded"});continue}if(c==="ignore"){let a=Ha(s.value,e);a&&(i.ignore=a);continue}e.push({message:`<Storyboard> vrt has unknown property "${c??"?"}" \u2014 expected threshold, skip, or ignore`,span:P(s),kind:"degraded"})}return{value:i,attributeSpan:n}}function Ha(t,e){if(t?.type!=="ArrayExpression")return e.push({message:"<Storyboard> vrt.ignore must be an array of { x, y, w, h } literals",span:P(t),kind:"degraded"}),null;let r=[];for(let n of t.elements??[]){let o={};for(let i of["x","y","w","h"]){let s=Ne(n,i),c=s?qe(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:P(n)??P(t),kind:"degraded"}),null;r.push(o)}return r}function ja(t,e,r){let n=Me(t,"component"),o=Ue(n?.value),i=P(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:P(n),localName:s,import:s?e.byLocalName.get(s):void 0}}function Ua(t,e,r){if(t?.type!=="ArrowFunctionExpression")return null;let n=mt(t.body);if(n?.type!=="JSXElement")return null;let o=n.openingElement?.name;if(o?.type!=="JSXIdentifier")return null;let i=P(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 kn(t,e,r){let n=Me(t,e),o=Ue(n?.value),i=P(o);if(!(!o||!i))return{expression:r.slice(i.start,i.end),span:i,attributeSpan:P(n)}}function Va(t){return/^[A-Za-z_$][\w$]*$/.test(t)}function Wa(t,e){let r=Fn(e),n=Me(t,"layout"),o=Ue(n?.value);return o?{...$n(o,e),attributeSpan:P(n)}:{value:r?Mn:Ye,attributeSpan:P(n),errors:[{message:`<${e}> must include a literal "layout" object prop`,span:P(t),kind:"degraded"}]}}function $n(t,e){let r=[],n=Fn(e);if(t.type!=="ObjectExpression")return{value:n?Mn:Ye,spans:{layoutClose:xr(t)},errors:[{message:`<${e}> layout must be an object literal`,span:P(t),kind:"degraded"}]};let o={layoutClose:xr(t)},i={...Ye},s=Ne(t,"width"),c=Ne(t,"height"),a=Ne(t,"intrinsicSizing"),u=a?.value?.value==="root-element",d=n||!!(s&&c)&&!u;!n&&!!s!=!!c&&r.push({message:"layout.width and layout.height must be set together",span:P(t),kind:"degraded"});let y=d?{width:s?qe(s.value):null,height:c?qe(c.value):null}:null,g=d?["x","y","width","height"]:["x","y"];for(let S of g){let x=S==="width"?s:S==="height"?c:Ne(t,S),C=S==="width"||S==="height"?y?.[S]:x?qe(x.value):null,T=S==="x"||S==="y"||n||!!(y?.width&&y.height);if(!C){r.push({message:`<${e}> layout.${S} must be a number literal`,span:P(x??t),kind:"degraded"});continue}T&&(i[S]=C.value,o[S]=C.span)}let h=Ne(t,"zIndex");if(h){let S=qe(h.value);S?(i.zIndex=S.value,o.zIndex=S.span):r.push({message:`<${e}> layout.zIndex must be a number literal`,span:P(h),kind:"degraded"})}return a&&(a.value?.type!=="Literal"||!u)&&r.push({message:`<${e}> layout.intrinsicSizing must be "root-element" when set`,span:P(a),kind:"degraded"}),{value:i,spans:o,errors:r}}function Ln(t){return t?.type==="Literal"&&typeof t.value=="string"?{value:t.value,span:P(t)??{start:0,end:0}}:null}function mt(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function wr(t,e,r){let n=Pe(t,e);if(n)return n;let o=Me(t,e),i=Ue(o?.value),s=P(i),c=P(o);if(!i||!s||!c)return null;let a=Ba(i,r);return a?{value:a.value,valueSpan:s,attributeSpan:c}:null}function Ba(t,e){if(t?.type!=="MemberExpression"||t.object?.type!=="Identifier")return null;let r=Vt(t.property);return r?e.get(t.object.name)?.get(r)??null:null}function Pe(t,e){let r=Me(t,e);if(!r)return null;let n=r.value;if(n?.type==="Literal"&&typeof n.value=="string")return{value:n.value,valueSpan:P(n)??P(r)??{start:0,end:0},attributeSpan:P(r)??{start:0,end:0}};let o=mt(Ue(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:P(o)??P(r)??{start:0,end:0},attributeSpan:P(r)??{start:0,end:0}}:null}function Me(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 Ue(t){return t?t.type==="JSXExpressionContainer"?t.expression:t:null}function Vt(t){return t?.type==="Identifier"?t.name:t?.type==="Literal"&&typeof t.value=="string"?t.value:null}function Ne(t,e){if(t?.type!=="ObjectExpression")return null;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;if(Vt(r.key)===e)return r}return null}function qe(t){return t?.type==="Literal"&&typeof t.value=="number"&&Number.isFinite(t.value)?{value:t.value,span:P(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:P(t)??{start:0,end:0}}:null}function Ar(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)&&Ut.has(t.property.name)?t.property.name:null}function Ja(t,e,r){if(t?.type!=="JSXMemberExpression"||t.object?.type!=="JSXIdentifier"||t.property?.type!=="JSXIdentifier"||!Ut.has(t.property.name))return null;let n=e.byLocalName.get(t.object.name);return n?.kind!=="namespace"||!Hn(n.source)?null:r.namespaceCandidatesByLocalName.get(t.object.name)??null}function _r(t){return t!==null&&t!=="Canvas"}function Ka(t){return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`}function Fn(t){return t==="RouteStoryboard"||t==="HtmlStoryboard"||t==="FlutterStoryboard"}function jt(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"*":t.imported?.name??t.local?.name??"unknown"}function Ga(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"namespace":"named"}function Dn(t){for(let e of ya)if(t===e||t.endsWith(`/${e}`))return!0;return!1}function Hn(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Dn(t)}function Xa(t){return`${t.start}:${t.end}`}function xr(t){return typeof t?.end=="number"&&Number.isFinite(t.end)?t.end-1:void 0}function In(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 P(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 Cr(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)Cr(o,e,r);else typeof n=="object"&&Cr(n,e,r)}}var Pn,ya,Ut,Sa,va,Ye,Mn,ba,Na,La,Fa,Wt=O(()=>{Dt();Pn=require("oxc-parser");Er();Er();l(Nn,"componentFrameworkForStoryboard");ya=new Set(["tempo-sdk/canvas",...Ht.map(t=>ft[t].importSource)]),Ut=new Set(["Canvas",...Ht]),Sa=`<Canvas> children must be ${Ka(Ht.map(t=>`<${t}>`))} declarations`,va=new Set(["Canvas","CanvasContext","getCanvasStoryboardRenderId","CanvasHost","buildRenderContentFiberSelector","buildRenderContentSelector","buildRenderSelector","captureStoryboardCombined","captureStoryboardHtml","captureStoryboardImage","stripRenderContentWrapperAttributes","stripRenderContentWrapperFromCombinedCapture","watchStoryboardCombined","getCanvasHostRuntime","getOptionalCanvasHostRuntime","useActiveState","FlutterStoryboard","HtmlStoryboard","LegacyStoryboardV1","RouteStoryboard","Storyboard","StoryboardSlot"]),Ye={x:0,y:0},Mn={...Ye,width:600,height:400},ba="No <Canvas> declaration found in canvas file";l(Qe,"parseCanvasFile");l(Ea,"misimportedSdkCanvasImportMessage");l(wa,"readMisimportedSdkCanvasImports");l(xa,"readImports");l(Ca,"readObjectExpressionBindings");l(Aa,"readTopLevelVariableDeclarators");l(_a,"readLegacyStoryboardObject");l(Ra,"readObjectStringProperties");l(Ta,"readStoryboard");l(ka,"readDirectCanvasStoryboardElements");l(Ia,"reportDuplicateStoryboardIds");l(Pa,"validateCanvasChildren");Na=/(^|\/)tempo-sdk\/canvas(\/[^/]+)?$/;l(Ma,"resolveNewerSdkStoryboardComponent");l(Oa,"newerSdkStoryboardError");l($a,"readResponsive");La=3840,Fa=12e3;l(Da,"responsiveBoxFits");l(On,"readVrt");l(Ha,"readVrtIgnoreRegions");l(ja,"readComponentReference");l(Ua,"readRenderComponentReference");l(kn,"readExpressionReference");l(Va,"isIdentifierExpression");l(Wa,"readLayout");l($n,"readLayoutExpression");l(Ln,"readStringLiteralValue");l(mt,"unwrapTsExpression");l(wr,"readResolvableStringAttribute");l(Ba,"resolveStringMemberExpression");l(Pe,"readStringAttribute");l(Me,"getAttribute");l(Ue,"unwrapAttributeExpression");l(Vt,"readPropertyKeyName");l(Ne,"getObjectProperty");l(qe,"readNumberLiteral");l(Ar,"resolveSdkComponent");l(Ja,"resolveMisimportedNamespaceSdkComponent");l(_r,"isStoryboardSdkComponent");l(Ka,"formatAlternatives");l(Fn,"requiresFixedLayoutSize");l(jt,"readImportedName");l(Ga,"readImportKind");l(Dn,"isSdkImportSource");l(Hn,"isWrongTempoSdkCanvasImportSource");l(Xa,"spanKey");l(xr,"readLayoutClose");l(In,"fallbackPageName");l(P,"toSpan");l(Cr,"walk")});function jn(t,e){return`/__tempo/astro/${encodeURIComponent(t)}/${encodeURIComponent(e)}`}var Un=O(()=>{"use strict";l(jn,"astroStoryboardPath")});function Rr(t){if(!t)return{};let e=(0,Vn.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 Vn,Wn=O(()=>{Vn=require("oxc-parser");l(Rr,"readAstroStoryboardProps")});function Gn(t){return(0,ee.existsSync)(t)?(0,ee.readdirSync)(t,{withFileTypes:!0}).flatMap(e=>{if(e.isSymbolicLink())return[];let r=(0,ne.join)(t,e.name);return e.isDirectory()?Gn(r):e.name.endsWith(".canvas.tsx")?[r]:[]}):[]}function Bn(t,e,r,n=[]){let o=[];for(let s of new Set((Array.isArray(e)?e:[e]).flatMap(Gn))){let c=(0,ee.openSync)(s,"r"),a,u;try{let f=(0,ee.fstatSync)(c);a=(0,ee.readFileSync)(c,"utf8");let y=(0,ee.fstatSync)(c);if(!["mtimeMs","ctimeMs","size","ino","dev"].every(g=>f[g]===y[g]))throw new Error(`Canvas changed while reading: ${s}`);u=Math.trunc(f.mtimeMs)}finally{(0,ee.closeSync)(c)}let p=Qe(s,a),d=p.canvasPath??(0,ne.relative)(t,(0,ne.dirname)(s)).replaceAll("\\","/");for(let f of p.storyboards){if(Nn(f)!=="astro")continue;let y=jn(d,f.storyboardKey),g=(0,ne.join)(r,`${(0,Tr.createHash)("sha256").update(y).digest("hex")}.astro`),h=(0,Tr.createHash)("sha256").update(a).digest("hex"),v;try{if(p.errors.some(N=>N.kind==="structural")||f.errors.length)throw new Error("Fix the Astro storyboard's canvas declaration before rendering it");let S=f.component?.import;if(!S||S.kind!=="default"||!S.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=S.source.slice(0,-16),C=x.startsWith(".")?(0,ne.resolve)((0,ne.dirname)(s),x).replaceAll("\\","/"):x,T=JSON.stringify(Rr(f.props?.expression)).replaceAll("<","\\u003c"),L=JSON.stringify({filepath:(0,ne.relative)(t,s).replaceAll("\\","/"),sourceVersion:Te(a),modifiedTs:u,position:f.jsxElementSpan.start,name:f.component?.localName??"Component"}),M=JSON.stringify({canvasPath:d,storyboardId:f.storyboardKey,revision:h}),W;if(s.replaceAll("\\","/").includes("/.tempo/asset-edit-previews/")){for(let N of(0,Kn.parseSync)(s,a).program.body)if(!(N.type!=="ExportNamedDeclaration"||N.declaration?.type!=="VariableDeclaration"))for(let $ of N.declaration.declarations)$.id.type==="Identifier"&&$.id.name==="__tempoAstroAssetPreview"&&$.init&&(W=Rr(a.slice($.init.start,$.init.end)))}if(v=`---
19
19
  import Component from ${JSON.stringify(C)};
20
20
  import ComponentMetadata from ${JSON.stringify(C+"?tempo-component")};
21
- ${n.map(P=>`import ${JSON.stringify(P.replaceAll("\\","/"))};`).join(`
21
+ ${n.map(N=>`import ${JSON.stringify(N.replaceAll("\\","/"))};`).join(`
22
22
  `)}
23
- const props = ${k};
23
+ const props = ${T};
24
24
  const controls = JSON.stringify(ComponentMetadata.__tempoAstroControls ?? {});
25
25
  ---
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__={${L}} /><pre hidden data-asset-definition={controls}>Component controls</pre></body></html>`,W){let P=(0,Jn.fileURLToPath)(new URL(Ce("astro/storyboards.ts").endsWith(".ts")?"./asset-preview-client.ts":"./asset-preview-client.js",Ce("astro/storyboards.ts")));x=x.replace(`const props = ${k};`,`const preview = ${JSON.stringify(W).replaceAll("<","\\u003c")};
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__={${L}} /><pre hidden data-asset-definition={controls}>Component controls</pre></body></html>`,W){let N=(0,Jn.fileURLToPath)(new URL(Ce("astro/storyboards.ts").endsWith(".ts")?"./asset-preview-client.ts":"./asset-preview-client.js",Ce("astro/storyboards.ts")));v=v.replace(`const props = ${T};`,`const preview = ${JSON.stringify(W).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__={${L}} />`,`{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${L}} />}`).replace("</body>",`<script>import {startAstroAssetPreview} from ${JSON.stringify(P)}; startAstroAssetPreview();</script></body>`)}}catch(S){x=`---
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__={${L}} />`,`{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${L}} />}`).replace("</body>",`<script>import {startAstroAssetPreview} from ${JSON.stringify(N)}; startAstroAssetPreview();</script></body>`)}}catch(S){v=`---
36
36
  throw new Error(${JSON.stringify(S instanceof Error?S.message:String(S))});
37
- ---`}x=x.replace("</body>",`${Ja}</body>`),o.push({path:h,file:g,source:x,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 Bt(t,e){let r=(0,ee.existsSync)(t);if(!(r&&(0,ee.readFileSync)(t,"utf8")===e))return(0,ee.mkdirSync)((0,ne.dirname)(t),{recursive:!0}),(0,ee.writeFileSync)(t,e),r?"updated":"created"}function Ka(t){return String.raw`---
37
+ ---`}v=v.replace("</body>",`${za}</body>`),o.push({path:y,file:g,source:v,revision:h})}}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 Bt(t,e){let r=(0,ee.existsSync)(t);if(!(r&&(0,ee.readFileSync)(t,"utf8")===e))return(0,ee.mkdirSync)((0,ne.dirname)(t),{recursive:!0}),(0,ee.writeFileSync)(t,e),r?"updated":"created"}function qa(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 Xn(t,e,r,n=[]){let o=Array.isArray(e)?e:[e],i=Bn(t,o,r,n),s=i,l=(0,ne.join)(r,"routes.json"),a=(0,ne.join)(r,"storyboards.astro"),u=c(g=>JSON.stringify(g.map(({path:y,file:x})=>({path:y,file:x.replaceAll("\\","/")}))),"shape"),p=new Set,d=c(g=>{let y=Bt(g.file,g.source),x=g.file.replaceAll("\\","/");return y==="created"?p.add(x):y==="updated"&&p.delete(x),y},"writeDocument");for(let g of i)d(g);Bt(l,u(i)),Bt(a,Ka(l));let f;return{routes:i,registryFile:l,entrypoint:a,plugin:{name:"tempo:astro-storyboards",hotUpdate:{order:"pre",async handler({type:g,file:y,modules:x,read:S}){if(this.environment.name==="client"&&y.endsWith(".canvas.tsx")&&(g!=="delete"&&await S(),f?.(y)),g==="create"&&p.has(y))return x.filter(w=>w.file!==y)}},configureServer(g){f=c(w=>{if(!(!w.endsWith(".canvas.tsx")||!o.some(C=>{let k=(0,ne.relative)(C,w);return!(0,ne.isAbsolute)(k)&&!k.startsWith("../")})))try{let C=Bn(t,o,r,n),k=C.filter(M=>d(M)==="updated").map(M=>M.file),L=new Set(C.map(M=>M.file.replaceAll("\\","/")));for(let M of p)L.has(M)||p.delete(M);s=C,Bt(l,u(C));for(let M of k)g.watcher.emit("change",M)}catch(C){g.config.logger.error(String(C))}},"changed"),g.watcher.add(o);let x=c((w,C)=>{if(typeof w?.path!="string"||typeof w.revision!="string")return;let k=g.config.base.replace(/\/$/,""),L=k&&w.path.startsWith(`${k}/`)?w.path.slice(k.length):w.path,M=s.find(W=>W.path===L);M&&C.send({type:"custom",event:"tempo:astro:revision",data:{path:w.path,revision:M.revision}})},"verifyRevision");g.ws.on("tempo:astro:revision-request",x);let S=c(()=>{g.ws.off("tempo:astro:revision-request",x)},"dispose");g.httpServer?.once("close",S)}}}}var kr,ee,ne,Jn,Kn,Ja,zn=O(()=>{Lt();kr=require("node:crypto"),ee=require("node:fs");Je();ne=require("node:path"),Jn=require("node:url");Wt();Un();Wn();Kn=require("oxc-parser"),Ja=`<script>
65
+ <Preview />`}function Xn(t,e,r,n=[]){let o=Array.isArray(e)?e:[e],i=Bn(t,o,r,n),s=i,c=(0,ne.join)(r,"routes.json"),a=(0,ne.join)(r,"storyboards.astro"),u=l(g=>JSON.stringify(g.map(({path:h,file:v})=>({path:h,file:v.replaceAll("\\","/")}))),"shape"),p=new Set,d=l(g=>{let h=Bt(g.file,g.source),v=g.file.replaceAll("\\","/");return h==="created"?p.add(v):h==="updated"&&p.delete(v),h},"writeDocument");for(let g of i)d(g);Bt(c,u(i)),Bt(a,qa(c));let f;return{routes:i,registryFile:c,entrypoint:a,plugin:{name:"tempo:astro-storyboards",hotUpdate:{order:"pre",async handler({type:g,file:h,modules:v,read:S}){if(this.environment.name==="client"&&h.endsWith(".canvas.tsx")&&(g!=="delete"&&await S(),f?.(h)),g==="create"&&p.has(h))return v.filter(x=>x.file!==h)}},configureServer(g){f=l(x=>{if(!(!x.endsWith(".canvas.tsx")||!o.some(C=>{let T=(0,ne.relative)(C,x);return!(0,ne.isAbsolute)(T)&&!T.startsWith("../")})))try{let C=Bn(t,o,r,n),T=C.filter(M=>d(M)==="updated").map(M=>M.file),L=new Set(C.map(M=>M.file.replaceAll("\\","/")));for(let M of p)L.has(M)||p.delete(M);s=C,Bt(c,u(C));for(let M of T)g.watcher.emit("change",M)}catch(C){g.config.logger.error(String(C))}},"changed"),g.watcher.add(o);let v=l((x,C)=>{if(typeof x?.path!="string"||typeof x.revision!="string")return;let T=g.config.base.replace(/\/$/,""),L=T&&x.path.startsWith(`${T}/`)?x.path.slice(T.length):x.path,M=s.find(W=>W.path===L);M&&C.send({type:"custom",event:"tempo:astro:revision",data:{path:x.path,revision:M.revision}})},"verifyRevision");g.ws.on("tempo:astro:revision-request",v);let S=l(()=>{g.ws.off("tempo:astro:revision-request",v)},"dispose");g.httpServer?.once("close",S)}}}}var Tr,ee,ne,Jn,Kn,za,zn=O(()=>{Ft();Tr=require("node:crypto"),ee=require("node:fs");Ke();ne=require("node:path"),Jn=require("node:url");Wt();Un();Wn();Kn=require("oxc-parser"),za=`<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,12 +78,12 @@ if (hot) {
78
78
  hot.off('vite:ws:connect', check);
79
79
  });
80
80
  }
81
- </script>`;c(Gn,"filesUnder");c(Bn,"collectAstroStoryboards");c(Bt,"writeChanged");c(Ka,"storyboardEntrypoint");c(Xn,"createAstroStoryboardRegistry")});function qn(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,Jt.relative)(t,o);if(!(i.startsWith("..")||(0,Jt.isAbsolute)(i))&&/@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[\w.-]+)?["']/.test(r))return{code:`${r}
81
+ </script>`;l(Gn,"filesUnder");l(Bn,"collectAstroStoryboards");l(Bt,"writeChanged");l(qa,"storyboardEntrypoint");l(Xn,"createAstroStoryboardRegistry")});function qn(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,Jt.relative)(t,o);if(!(i.startsWith("..")||(0,Jt.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 Jt,Yn=O(()=>{Jt=require("node:path");c(qn,"astroTailwindSources")});async function Zn(t=process.env.TEMPO_SDK_RUNTIME_PATH){if(!t||!(0,Le.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,Ze.readFile)((0,Le.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,Ze.realpath)(t),o=await(0,Ze.realpath)((0,Le.resolve)(n,r.file)),i=(0,Le.relative)(n,o);if((0,Le.isAbsolute)(i)||i===".."||i.startsWith("../")||i.startsWith("..\\"))throw new Error("Tempo browser runtime path escapes its directory.");let s=await(0,Ze.readFile)(o,"utf8");if((0,Qn.createHash)("sha256").update(s).digest("hex")!==r.sha256)throw new Error("Tempo browser runtime artifact failed its integrity check.");return s}var Qn,Ze,Le,eo=O(()=>{Qn=require("node:crypto"),Ze=require("node:fs/promises"),Le=require("node:path");c(Zn,"readBrowserRuntimeScript")});function Kt(t){return`${t.replace(/\/$/,"")}${Ga}`}function to(t){let e=Kt(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 Tr()),o.setHeader("Content-Type","application/javascript; charset=utf-8"),o.end(n.method==="HEAD"?void 0:r)}catch(l){o.statusCode=503,o.setHeader("Content-Type","text/plain; charset=utf-8"),o.end(n.method==="HEAD"?void 0:`Tempo browser runtime unavailable: ${l instanceof Error?l.message:String(l)}`)}}}async function Tr(){return Xa(await Zn())}function Xa(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 Jt,Yn=O(()=>{Jt=require("node:path");l(qn,"astroTailwindSources")});async function Zn(t=process.env.TEMPO_SDK_RUNTIME_PATH){if(!t||!(0,Fe.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,Ze.readFile)((0,Fe.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,Ze.realpath)(t),o=await(0,Ze.realpath)((0,Fe.resolve)(n,r.file)),i=(0,Fe.relative)(n,o);if((0,Fe.isAbsolute)(i)||i===".."||i.startsWith("../")||i.startsWith("..\\"))throw new Error("Tempo browser runtime path escapes its directory.");let s=await(0,Ze.readFile)(o,"utf8");if((0,Qn.createHash)("sha256").update(s).digest("hex")!==r.sha256)throw new Error("Tempo browser runtime artifact failed its integrity check.");return s}var Qn,Ze,Fe,eo=O(()=>{Qn=require("node:crypto"),Ze=require("node:fs/promises"),Fe=require("node:path");l(Zn,"readBrowserRuntimeScript")});function Kt(t){return`${t.replace(/\/$/,"")}${Ya}`}function to(t){let e=Kt(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 kr()),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 kr(){return Qa(await Zn())}function Qa(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 ro(t){return t.replace(/<\/script/gi,e=>e.replace("/","\\/"))}var Ga,Ir=O(()=>{eo();Ga="/@tempo/browser-runtime.js";c(Kt,"browserRuntimeUrl");c(to,"createBrowserRuntimeMiddleware");c(Tr,"readBrowserRuntimeInstallScript");c(Xa,"browserRuntimeInstallScript");c(ro,"escapeBrowserRuntimeInlineScript")});var Gt,Xt,et,zt,no,qt=O(()=>{"use strict";Gt="/@tempo/server-errors",Xt="\0tempo:server-errors",et="tempo:server-error-state",zt="tempo:subscribe-server-errors",no="__tempoViteServerErrors"});var Pr,Nr=O(()=>{qt();Pr=`
86
+ })();`}function ro(t){return t.replace(/<\/script/gi,e=>e.replace("/","\\/"))}var Ya,Ir=O(()=>{eo();Ya="/@tempo/browser-runtime.js";l(Kt,"browserRuntimeUrl");l(to,"createBrowserRuntimeMiddleware");l(kr,"readBrowserRuntimeInstallScript");l(Qa,"browserRuntimeInstallScript");l(ro,"escapeBrowserRuntimeInlineScript")});var Gt,Xt,et,zt,no,qt=O(()=>{"use strict";Gt="/@tempo/server-errors",Xt="\0tempo:server-errors",et="tempo:server-error-state",zt="tempo:subscribe-server-errors",no="__tempoViteServerErrors"});var Pr,Nr=O(()=>{qt();Pr=`
87
87
  if (import.meta.hot) {
88
88
  const hot = import.meta.hot;
89
89
  const feed = globalThis.${no} ??= (() => {
@@ -113,14 +113,14 @@ if (import.meta.hot) {
113
113
  hot.off("vite:ws:connect", subscribe);
114
114
  });
115
115
  }
116
- `});function oo(t){if(process.env.TEMPO_MONOREPO_SDK_SOURCE!=="local-prebuilt")return[];let e=(0,mt.resolve)(t??process.cwd(),"node_modules/tempo-sdk");return(0,Mr.existsSync)((0,mt.join)(e,".tempo-prebuilt-source.json"))?["canvas","assets"].flatMap(r=>{let n=(0,mt.join)(e,"dist",r,"index.js");return(0,Mr.existsSync)(n)?[{find:new RegExp(`^tempo-sdk/${r}$`),replacement:n}]:[]}):[]}var Mr,mt,so=O(()=>{Mr=require("node:fs"),mt=require("node:path");c(oo,"localPrebuiltAliases")});function lo(t,e=process.env){let r=e.TEMPO_CANVAS_HOST_ROOT,n=e.TEMPO_CANVAS_SOURCE_ROOT;if(!r||!n||(0,Fe.resolve)(t.root??process.cwd())!==(0,Fe.resolve)(r))return;let o=[(0,Fe.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(l=>l.replace(/\\/g,"/").replace(/^\.\//,"")!==o);t.optimizeDeps??={},t.optimizeDeps.entries=[...new Set(["index.html",...s])];for(let l of["tempo-sdk/canvas","tempo-sdk/assets","tempo-sdk/canvas/interact-projection"])t.optimizeDeps.exclude?.some(a=>l===a||l.startsWith(`${a}/`))||(t.optimizeDeps.include=[...new Set([...t.optimizeDeps.include??[],l])])}function co(t){if(t.optimizeDeps?.entries!==void 0||t.build?.rollupOptions?.input!==void 0)return;let e=(0,Fe.resolve)(t.root??process.cwd()),r=(0,Fe.join)(e,io,"tempo.config.json");(0,ao.existsSync)(r)&&(t.optimizeDeps??={},t.optimizeDeps.entries=["**/*.html","!**/__tests__/**","!**/coverage/**",`!${io}/**`])}var ao,Fe,io,uo=O(()=>{ao=require("node:fs"),Fe=require("node:path");c(lo,"applyManagedCanvasDependencyScan");io="tempo";c(co,"excludeTempoHostFromAppDependencyScan")});function tt(t){return t.replace(/[?#].*$/,"")}function qa(t){return t.length>0&&t[0]===t[0].toLowerCase()}function Or(t,e){for(let r of t.element.openingElement.attributes)if(r.name?.name===e)return!0;return!1}function Ya(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 po(t,e,r,n){let o=JSON.stringify({file:e,modifiedTs:r,sourceVersion:n});return`${t}
116
+ `});function oo(t){if(process.env.TEMPO_MONOREPO_SDK_SOURCE!=="local-prebuilt")return[];let e=(0,gt.resolve)(t??process.cwd(),"node_modules/tempo-sdk");return(0,Mr.existsSync)((0,gt.join)(e,".tempo-prebuilt-source.json"))?["canvas","assets"].flatMap(r=>{let n=(0,gt.join)(e,"dist",r,"index.js");return(0,Mr.existsSync)(n)?[{find:new RegExp(`^tempo-sdk/${r}$`),replacement:n}]:[]}):[]}var Mr,gt,so=O(()=>{Mr=require("node:fs"),gt=require("node:path");l(oo,"localPrebuiltAliases")});function lo(t,e=process.env){let r=e.TEMPO_CANVAS_HOST_ROOT,n=e.TEMPO_CANVAS_SOURCE_ROOT;if(!r||!n||(0,De.resolve)(t.root??process.cwd())!==(0,De.resolve)(r))return;let o=[(0,De.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,De.resolve)(t.root??process.cwd()),r=(0,De.join)(e,io,"tempo.config.json");(0,ao.existsSync)(r)&&(t.optimizeDeps??={},t.optimizeDeps.entries=["**/*.html","!**/__tests__/**","!**/coverage/**",`!${io}/**`])}var ao,De,io,uo=O(()=>{ao=require("node:fs"),De=require("node:path");l(lo,"applyManagedCanvasDependencyScan");io="tempo";l(co,"excludeTempoHostFromAppDependencyScan")});function tt(t){return t.replace(/[?#].*$/,"")}function el(t){return t.length>0&&t[0]===t[0].toLowerCase()}function Or(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 po(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 fo(t){let{info:e,filepath:r,modifiedtsMs:n,sourceVersion:o,computeAnnotatedProps:i,elementSupportOverrides:s}=t,l={...i?i(e,r,n,o):Ya(e,r,n,o),...e.parentType!==void 0&&!Or(e,gr)?{[gr]:un(e.element,e.parentType,e.isStaticJsxChild)}:{}};if(qa(e.tagName))return{...l,"data-tempo-supports-children":Or(e,"data-tempo-supports-children")?void 0:!za.has(e.tagName)};let a=s?.get(e.tagName);return a?{...l,"data-tempo-supports-children":Or(e,"data-tempo-supports-children")?void 0:a.supportsChildren}:l}var za,Yt=O(()=>{Mt();Je();za=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);c(tt,"cleanModuleId");c(qa,"isIntrinsicElement");c(Or,"hasJsxAttribute");c(Ya,"defaultComputeAnnotatedProps");c(po,"appendModuleVersionRecord");c(fo,"computeTempoAnnotatedProps")});function mo(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=[];for(let[l,a]of t.listServedFiles()){let u=await t.statMtimeMs(l);if(u===null){i.delete(l);continue}let p=o.get(l);if(p===void 0){let y=t.lastHotUpdateMtimeMs?.(l);if(y===void 0||y>=u){o.set(l,u);continue}p=y,o.set(l,y)}if(u>p){if(e()-u<r)continue;o.set(l,u)}else u<p&&o.set(l,u);let d=i.get(l);if(u<=p&&d===void 0)continue;let f=t.lastHotUpdateMtimeMs?.(l),h;if(f!==void 0)h=f>=u;else{h=!1;for(let y of a)if((y.lastInvalidationTimestamp??0)>=u){h=!0;break}}if(h){i.delete(l);continue}let g=d!==void 0&&d.mtimeMs===u?d:{mtimeMs:u,emits:0};i.set(l,g),!(g.emits>=n)&&(g.emits+=1,t.emitChange(l),s.push(l))}return s}}}var go=O(()=>{c(mo,"createMissedChangeSweep")});function ho(t){let e=t?.quietMs??100,r=t?.schedule??setTimeout,n=t?.cancel??clearTimeout,o=new Map,i=c((s,l)=>{s.eventCount<2||(l?.gate&&l.release?(s.gate=l.gate,s.release=l.release,l.release=void 0,l.expiry&&n(l.expiry)):s.gate=new Promise(a=>{s.release=a}),s.expiry=r(()=>s.release?.(),e*2))},"armGate");return{observe(s,l){let a=o.get(s);a?.timer&&n(a.timer);let u={eventCount:(a?.eventCount??0)+1,replay:l};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 yo=O(()=>{c(ho,"createRapidHotUpdateReplay")});function me(t){return tt(t).replace(/^\/@fs\//,"/")}function gt(t){return me(t).replace(/\\/g,"/")}function So(){let t=ho(),e=new Map,r=c(n=>{let o=me(n),i=gt(n);try{e.set(i,(0,$r.statSync)(o).mtimeMs)}catch{e.delete(i)}},"recordCoverage");return{recordCoverage:r,lastHotUpdateMtimeMs(n){return e.get(gt(n))},observeUpdate(n,o){t.observe(gt(o),()=>{n.config.logger.info(`[tempo] replaying settled rapid watcher change: ${o}`,{timestamp:!0}),n.watcher.emit("change",o)})},settled(n){return t.settled(gt(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=mo({listServedFiles:c(()=>{let u=new Map(n.moduleGraph?.fileToModulesMap??new Map);for(let p of o.listExtraFiles?.()??[]){let d=me(p),f=(0,De.isAbsolute)(d)?d:(0,De.resolve)(n.config.root,d);u.has(f)||u.set(f,[])}if(i)for(let p of u.keys())p.replace(/\\/g,"/").startsWith(`${i}/`)&&u.delete(p);return Qa(n,u),u.entries()},"listServedFiles"),statMtimeMs:c(async u=>{try{return(0,$r.statSync)(u).mtimeMs}catch{return null}},"statMtimeMs"),emitChange:c(u=>{n.config?.logger?.info?.(`[tempo] re-emitting lost watcher change: ${u}`,{timestamp:!0}),n.watcher?.emit?.("change",u)},"emitChange"),lastHotUpdateMtimeMs:c(u=>e.get(gt(u)),"lastHotUpdateMtimeMs")}),l=!1,a=setInterval(()=>{l||(l=!0,s.sweep().then(()=>o.afterSweep?.()).catch(()=>{}).finally(()=>{l=!1}))},o.sweepIntervalMs??ht);a.unref?.(),n.httpServer?.once("close",()=>clearInterval(a))},clear(){t.clear(),e.clear()}}}function Qa(t,e){let n=t.watcher?.getWatched?.();if(n)for(let o of[...e.keys()]){let i=n[(0,De.dirname)(o)];i&&!i.includes((0,De.basename)(o))&&e.delete(o)}}var $r,De,ht,yt=O(()=>{$r=require("node:fs"),De=require("node:path");Yt();go();yo();ht=3e3;c(me,"fsPathFromModuleId");c(gt,"fileKey");c(So,"createHotUpdateNet");c(Qa,"dropUnwatched")});function el(t,e){return t.type===e.type&&t.message===e.message&&t.loc?.line===e.loc?.line&&t.loc?.column===e.loc?.column}function tl(t,e){let r=new Map;function n(){if(r.size===0)return null;let s=null;for(let l of r.values())s=l;return s}c(n,"getMostRecentError");function o(){e?.(i.currentError);let s=JSON.stringify(i.currentError);for(let l of i.clients)l.write(`data: ${s}
118
+ `}function fo(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&&!Or(e,gr)?{[gr]:un(e.element,e.parentType,e.isStaticJsxChild)}:{}};if(el(e.tagName))return{...c,"data-tempo-supports-children":Or(e,"data-tempo-supports-children")?void 0:!Za.has(e.tagName)};let a=s?.get(e.tagName);return a?{...c,"data-tempo-supports-children":Or(e,"data-tempo-supports-children")?void 0:a.supportsChildren}:c}var Za,Yt=O(()=>{Ot();Ke();Za=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);l(tt,"cleanModuleId");l(el,"isIntrinsicElement");l(Or,"hasJsxAttribute");l(tl,"defaultComputeAnnotatedProps");l(po,"appendModuleVersionRecord");l(fo,"computeTempoAnnotatedProps")});function mo(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 rl(),c+=1;let p=await t.statMtimeMs(a);if(p===null){i.delete(a);continue}let d=o.get(a);if(d===void 0){let v=t.lastHotUpdateMtimeMs?.(a);if(v===void 0||v>=p){o.set(a,p);continue}d=v,o.set(a,v)}if(p>d){if(e()-p<r)continue;o.set(a,p)}else p<d&&o.set(a,p);let f=i.get(a);if(p<=d&&f===void 0)continue;let y=t.lastHotUpdateMtimeMs?.(a),g;if(y!==void 0)g=y>=p;else{g=!1;for(let v of u)if((v.lastInvalidationTimestamp??0)>=p){g=!0;break}}if(g){i.delete(a);continue}let h=f!==void 0&&f.mtimeMs===p?f:{mtimeMs:p,emits:0};i.set(a,h),!(h.emits>=n)&&(h.emits+=1,t.emitChange(a),s.push(a))}return s}}}var rl,go=O(()=>{rl=l(()=>new Promise(t=>setImmediate(t)),"nextTurn");l(mo,"createMissedChangeSweep")});function ho(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 yo=O(()=>{l(ho,"createRapidHotUpdateReplay")});function me(t){return tt(t).replace(/^\/@fs\//,"/")}function ht(t){return me(t).replace(/\\/g,"/")}function So(){let t=ho(),e=new Map,r=l(n=>{let o=me(n),i=ht(n);try{e.set(i,(0,$r.statSync)(o).mtimeMs)}catch{e.delete(i)}},"recordCoverage");return{recordCoverage:r,lastHotUpdateMtimeMs(n){return e.get(ht(n))},observeUpdate(n,o){t.observe(ht(o),()=>{n.config.logger.info(`[tempo] replaying settled rapid watcher change: ${o}`,{timestamp:!0}),n.watcher.emit("change",o)})},settled(n){return t.settled(ht(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=mo({listServedFiles:l(function*(){let u=new Map(n.moduleGraph?.fileToModulesMap??new Map);for(let d of o.listExtraFiles?.()??[]){let f=me(d),y=(0,He.isAbsolute)(f)?f:(0,He.resolve)(n.config.root,f);u.has(y)||u.set(y,[])}let p=nl(n);for(let d of u){let f=d[0];i&&f.replace(/\\/g,"/").startsWith(`${i}/`)||p&&ol(p,f)||(yield d)}},"listServedFiles"),statMtimeMs:l(async u=>{try{return(0,$r.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(ht(u)),"lastHotUpdateMtimeMs")}),c=!1,a=setInterval(()=>{c||(c=!0,s.sweep().then(()=>o.afterSweep?.()).catch(()=>{}).finally(()=>{c=!1}))},o.sweepIntervalMs??yt);a.unref?.(),n.httpServer?.once("close",()=>clearInterval(a))},clear(){t.clear(),e.clear()}}}function nl(t){return t.watcher?.getWatched?.()}function ol(t,e){let r=t[(0,He.dirname)(e)];return r!==void 0&&!r.includes((0,He.basename)(e))}var $r,He,yt,St=O(()=>{$r=require("node:fs"),He=require("node:path");Yt();go();yo();yt=3e3;l(me,"fsPathFromModuleId");l(ht,"fileKey");l(So,"createHotUpdateNet");l(nl,"watchedEntries");l(ol,"isUnwatched")});function il(t,e){return t.type===e.type&&t.message===e.message&&t.loc?.line===e.loc?.line&&t.loc?.column===e.loc?.column}function al(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
- `)}c(o,"broadcastCurrentState");let i={get currentError(){return n()},get errorFiles(){return[...r.keys()].filter(s=>s!=="unknown")},clients:new Set,setError(s){let l=s.file??s.loc?.file??"unknown",a=r.get(l);a&&el(a,s)||(l!=="unknown"&&!a&&t?.(l),r.delete(l),r.set(l,s),o())},clearErrorForModules(s){if(r.size===0)return;let l=!1;for(let a of[...r.keys()])a!=="unknown"&&s.some(u=>bo(a,u))&&(r.delete(a),l=!0);l&&o()},clearAll(){r.clear(),o()}};return i}function bo(t,e){let r=c(n=>tt(n).replace(/^file:\/\//,"").replace(/^\/@fs\//,"/").replace(/\\/g,"/").replace(/^\/+/,""),"normalize");return r(t)===r(e)}function Eo(t={}){let e,r=tl(t.onErrorFile,a=>e?.ws.send(et,a)),n=c(a=>a.replace(/\\/g,"/"),"normalizedFileKey"),o=c(a=>r.errorFiles.some(u=>bo(u,a)),"hasActiveCompileError"),i=c(async(a,u)=>{if(!o(u))return!1;let p=me(u),d=`/@fs/${p.replace(/^\/+/,"")}`,f=a.environments?.client,h=f??a;try{let g=(0,St.readFileSync)(p,"utf8"),y=/\.canvas\.[cm]?[jt]sx?$/.test(p),x=c(k=>{let L=(0,vo.parseSync)(p,k);return!L.errors.length&&L.program.body.some(M=>M.type==="ExportDefaultDeclaration"||M.type==="ExportNamedDeclaration"&&M.exportKind!=="type"&&M.specifiers.some(W=>W.exportKind!=="type"&&(W.exported.type==="Identifier"?W.exported.name:W.exported.value)==="default"))},"hasDefault");if(y&&!x(g))return!1;let S=p;try{S=(0,St.realpathSync)(p)}catch{}let w=new Set([...h.moduleGraph.getModulesByFile(S)??[],...h.moduleGraph.getModulesByFile(p)??[]]);for(let k of w)h.moduleGraph.invalidateModule(k);let C=await h.transformRequest(d);if(!C||(0,St.readFileSync)(p,"utf8")!==g||y&&(typeof C!="object"||!("code"in C)||typeof C.code!="string"||!x(C.code)))return!1}catch{return!1}return r.clearErrorForModules([u,p,d]),a.config.logger.info(`[tempo] recovered compile-error module after validated transform: ${p}`,{timestamp:!0}),(f?.hot??a.ws).send({type:"full-reload",path:"*"}),!0},"recoverActiveCompileError"),s=new Map;return{errorServer:r,attach(a){e=a,a.ws.on?.(zt,(u,p)=>{p.send(et,r.currentError)})},handleRequest(a,u){let p=a.url;return p==="/__tempo/report-error"&&a.method==="POST"?(nl(a).then(d=>{try{r.setError(JSON.parse(d))}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&&il(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=>bo(a,u))&&(r.delete(a),c=!0);c&&o()},clearAll(){r.clear(),o()}};return i}function bo(t,e){let r=l(n=>tt(n).replace(/^file:\/\//,"").replace(/^\/@fs\//,"/").replace(/\\/g,"/").replace(/^\/+/,""),"normalize");return r(t)===r(e)}function Eo(t={}){let e,r=al(t.onErrorFile,a=>e?.ws.send(et,a)),n=l(a=>a.replace(/\\/g,"/"),"normalizedFileKey"),o=l(a=>r.errorFiles.some(u=>bo(u,a)),"hasActiveCompileError"),i=l(async(a,u)=>{if(!o(u))return!1;let p=me(u),d=`/@fs/${p.replace(/^\/+/,"")}`,f=a.environments?.client,y=f??a;try{let g=(0,vt.readFileSync)(p,"utf8"),h=/\.canvas\.[cm]?[jt]sx?$/.test(p),v=l(T=>{let L=(0,vo.parseSync)(p,T);return!L.errors.length&&L.program.body.some(M=>M.type==="ExportDefaultDeclaration"||M.type==="ExportNamedDeclaration"&&M.exportKind!=="type"&&M.specifiers.some(W=>W.exportKind!=="type"&&(W.exported.type==="Identifier"?W.exported.name:W.exported.value)==="default"))},"hasDefault");if(h&&!v(g))return!1;let S=p;try{S=(0,vt.realpathSync)(p)}catch{}let x=new Set([...y.moduleGraph.getModulesByFile(S)??[],...y.moduleGraph.getModulesByFile(p)??[]]);for(let T of x)y.moduleGraph.invalidateModule(T);let C=await y.transformRequest(d);if(!C||(0,vt.readFileSync)(p,"utf8")!==g||h&&(typeof C!="object"||!("code"in C)||typeof C.code!="string"||!v(C.code)))return!1}catch{return!1}return r.clearErrorForModules([u,p,d]),a.config.logger.info(`[tempo] recovered compile-error module after validated transform: ${p}`,{timestamp:!0}),(f?.hot??a.ws).send({type:"full-reload",path:"*"}),!0},"recoverActiveCompileError"),s=new Map;return{errorServer:r,attach(a){e=a,a.ws.on?.(zt,(u,p)=>{p.send(et,r.currentError)})},handleRequest(a,u){let p=a.url;return p==="/__tempo/report-error"&&a.method==="POST"?(cl(a).then(d=>{try{r.setError(JSON.parse(d))}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:c(async a=>{let u=new Map(r.errorFiles.map(d=>[n(me(d)),d]));for(let d of[...s.keys()])u.has(d)||s.delete(d);let p=Date.now();for(let[d,f]of u){let h=s.get(d);if(h&&p<h.nextAttemptAtMs)continue;if(await i(a,f)){s.delete(d);continue}let g=h?.intervalMs??Za;s.set(d,{nextAttemptAtMs:p+g,intervalMs:Math.min(g*2,rl)})}},"pollCompileErrorRecovery"),reset(){s.clear()}}}function nl(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 St,vo,Za,rl,wo=O(()=>{Nr();St=require("node:fs"),vo=require("oxc-parser");Yt();yt();qt();Za=ht;c(el,"isSameError");c(tl,"createErrorServer");c(bo,"moduleIdsMatch");rl=3e4;c(Eo,"createCompileErrorStream");c(nl,"readBody")});function Qt(t){return t.trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"")}var Lr,Fr,xo=O(()=>{"use strict";Lr="/__tempo/canvas-host-registration",Fr="x-tempo-canvas-host-registration";c(Qt,"normalizeCanvasRegistrationPath")});async function Ao(t,e){let r=performance.now(),n=!1,o=setTimeout(()=>{n=!0,e("pending",Math.round(performance.now()-r))},5e3),i=c(s=>{let l=Math.round(performance.now()-r);(n||l>=5e3)&&e(s,l)},"settled");try{let s=await t();return i("ready"),s}catch(s){throw i("error"),s}finally{clearTimeout(o)}}function _o(){let t=new Map;return c(async function(r,n){let o=(0,Co.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:c(()=>!1,"current"),result:Promise.resolve()};return t.set(r,s),s.result=Promise.resolve().then(async()=>{s.current=await n(),s.pending=!1}).catch(l=>{throw t.get(r)===s&&t.delete(r),l}),s.result},"confirm")}async function Ro(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 Co,ko=O(()=>{Co=require("node:fs");c(Ao,"traceSlowRegistration");c(_o,"createRegistrationTransforms");c(Ro,"registrationReply")});function Po(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=Qt(o);i&&e.add(i)}catch{}return[...e]}async function sl(t,e){let r=(0,vt.resolve)(t.config.root,".tempo","tempo-host.tsx"),n;try{n=(0,Ue.readFileSync)(r,"utf8")}catch(u){throw new Error(`Canvas host wrapper is unavailable at ${r}: ${u instanceof Error?u.message:String(u)}`)}if(!Po(n).includes(e))throw Object.assign(new Error(`Generated canvas host wrapper does not contain ${JSON.stringify(e)}`),{statusCode:409});let i=(0,Ue.realpathSync)(r),s=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")\s*,\s*load:\s*\(\)\s*=>\s*import\(\s*("(?:\\.|[^"\\])*")\s*\)/g,l,a=t.environments?.client??t;for(let u of n.matchAll(s)){if(Qt(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 d=me(p.id),f=`/@fs/${d.replace(/^\/+/,"")}`;l=`${il(t)}${f.slice(1)}`,await To(t,a,(0,Ue.realpathSync)(d),d,f);break}return await To(t,a,i,r),n.includes("tempo-incremental-canvas-registration")?l:void 0}function il(t){let e=t.config.base||"/",r=e.startsWith("/")?e:new URL(e,"http://tempo.invalid").pathname;return r.endsWith("/")?r:`${r}/`}function No(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:Zt.get(t)??0}}async function To(t,e,r,n,o=ol){let i=Dr.get(e);i||(i=_o(),Dr.set(e,i)),await i(r,()=>Ao(async()=>{let s=c(()=>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,d])=>d!=null&&s()?.has(p)&&p.transformResult===d)},(s,l)=>{t.config.logger.info(`[tempo] canvas registration ${JSON.stringify({...No(t),status:s,module:(0,vt.relative)(t.config.root,r),elapsedMs:l})}`)}))}function Io(t){t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Expose-Headers",Fr),t.setHeader(Fr,"1")}function Mo(t,e){if(t.replace(/\\/g,"/")!==e.replace(/\\/g,"/"))return!1;try{return(0,Ue.readFileSync)(t,"utf8").includes("tempo-incremental-canvas-registration")}catch{return!1}}function Oo(t,e,r,n){let o=(0,vt.relative)(e.sourceRoot,t).replace(/\\/g,"/"),i;try{i=(0,Ue.readFileSync)(e.wrapperPath,"utf8")}catch{return}if(!Po(i).includes(o))return;let s=r.getModulesByFile(e.wrapperPath);if(s?.size){for(let l of s)r.invalidateModule(l);return[...new Set([...n,...s])]}}function $o(t){Zt.set(t,0),Dr.delete(t.environments?.client??t)}function Lo(t){Zt.set(t,(Zt.get(t)??0)+1)}function Fo(t,e,r){let n=e.url;return n===Lr&&e.method==="OPTIONS"?(Io(r),r.writeHead(204,{"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"content-type"}),r.end(),!0):n===Lr&&e.method==="POST"?(Io(r),al(e).then(async o=>{let i=JSON.parse(o),s=typeof i.canvasPath=="string"?Qt(i.canvasPath):"";if(!s)throw Object.assign(new Error("canvasPath must be a non-empty string"),{statusCode:400});let l,a=await Ro(sl(t,s).then(u=>{l=u}),()=>No(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,...l?{moduleUrl:l}:{}}))}).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 al(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 Ue,vt,ol,Dr,Zt,Do=O(()=>{Ue=require("node:fs"),vt=require("node:path");xo();ko();yt();ol="/.tempo/tempo-host";c(Po,"readGeneratedCanvasPaths");c(sl,"synchronizeCanvasHostRegistrationTransform");c(il,"viteBasePath");Dr=new WeakMap,Zt=new WeakMap;c(No,"registrationProgress");c(To,"retransformCanvasHostWrapper");c(Io,"writeCanvasRegistrationResponseHeaders");c(Mo,"isIncrementalWrapperFile");c(Oo,"withRegisteredCanvasLoader");c($o,"resetCanvasHostRegistration");c(Lo,"noteCanvasHostRegistrationActivity");c(Fo,"handleCanvasHostRegistrationRequest");c(al,"readBody")});var Ho=O(()=>{});var bt=Be((qp,Bo)=>{"use strict";var jo="[^\\\\/]",ll="(?=.)",Uo="[^/]",Hr="(?:\\/|$)",Vo="(?:^|\\/)",jr=`\\.{1,2}${Hr}`,cl="(?!\\.)",ul=`(?!${Vo}${jr})`,pl=`(?!\\.{0,1}${Hr})`,dl=`(?!${jr})`,fl="[^.\\/]",ml=`${Uo}*?`,gl="/",Wo={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ll,QMARK:Uo,END_ANCHOR:Hr,DOTS_SLASH:jr,NO_DOT:cl,NO_DOTS:ul,NO_DOT_SLASH:pl,NO_DOTS_SLASH:dl,QMARK_NO_DOT:fl,STAR:ml,START_ANCHOR:Vo,SEP:gl},hl={...Wo,SLASH_LITERAL:"[\\\\/]",QMARK:jo,STAR:`${jo}*?`,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:"\\"},yl={__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"};Bo.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:yl,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?hl:Wo}}});var Et=Be(se=>{"use strict";var{REGEX_BACKSLASH:Sl,REGEX_REMOVE_BACKSLASH:vl,REGEX_SPECIAL_CHARS:bl,REGEX_SPECIAL_CHARS_GLOBAL:El}=bt();se.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);se.hasRegexChars=t=>bl.test(t);se.isRegexChar=t=>t.length===1&&se.hasRegexChars(t);se.escapeRegex=t=>t.replace(El,"\\$1");se.toPosixSlashes=t=>t.replace(Sl,"/");se.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};se.removeBackslashes=t=>t.replace(vl,e=>e==="\\"?"":e);se.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?se.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};se.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};se.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};se.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var Qo=Be((Qp,Yo)=>{"use strict";var Jo=Et(),{CHAR_ASTERISK:Ur,CHAR_AT:wl,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:xl,CHAR_DOT:Vr,CHAR_EXCLAMATION_MARK:Wr,CHAR_FORWARD_SLASH:qo,CHAR_LEFT_CURLY_BRACE:Br,CHAR_LEFT_PARENTHESES:er,CHAR_LEFT_SQUARE_BRACKET:Cl,CHAR_PLUS:Al,CHAR_QUESTION_MARK:Ko,CHAR_RIGHT_CURLY_BRACE:_l,CHAR_RIGHT_PARENTHESES:Go,CHAR_RIGHT_SQUARE_BRACKET:Rl}=bt(),Xo=c(t=>t===qo||t===rt,"isPathSeparator"),zo=c(t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},"depth"),kl=c((t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.tokens===!0||r.scanToEnd===!0,i=[],s=[],l=[],a=t,u=-1,p=0,d=0,f=!1,h=!1,g=!1,y=!1,x=!1,S=!1,w=!1,C=!1,k=!1,L=!1,M=0,W,P,$={value:"",depth:0,isGlob:!1},v=c(()=>u>=n,"eos"),z=c(()=>a.charCodeAt(u+1),"peek"),F=c(()=>(W=P,a.charCodeAt(++u)),"advance");for(;u<n;){P=F();let B;if(P===rt){w=$.backslashes=!0,P=F(),P===Br&&(S=!0);continue}if(S===!0||P===Br){for(M++;v()!==!0&&(P=F());){if(P===rt){w=$.backslashes=!0,F();continue}if(P===Br){M++;continue}if(S!==!0&&P===Vr&&(P=F())===Vr){if(f=$.isBrace=!0,g=$.isGlob=!0,L=!0,o===!0)continue;break}if(S!==!0&&P===xl){if(f=$.isBrace=!0,g=$.isGlob=!0,L=!0,o===!0)continue;break}if(P===_l&&(M--,M===0)){S=!1,f=$.isBrace=!0,L=!0;break}}if(o===!0)continue;break}if(P===qo){if(i.push(u),s.push($),$={value:"",depth:0,isGlob:!1},L===!0)continue;if(W===Vr&&u===p+1){p+=2;continue}d=u+1;continue}if(r.noext!==!0&&(P===Al||P===wl||P===Ur||P===Ko||P===Wr)===!0&&z()===er){if(g=$.isGlob=!0,y=$.isExtglob=!0,L=!0,P===Wr&&u===p&&(k=!0),o===!0){let Z=0;for(;v()!==!0&&(P=F());){if(P===rt){w=$.backslashes=!0,F();continue}if(P===er){Z++;continue}if(P===Go&&--Z===0){L=!0;break}}continue}break}if(P===Ur){if(W===Ur&&(x=$.isGlobstar=!0),g=$.isGlob=!0,L=!0,o===!0)continue;break}if(P===Ko){if(g=$.isGlob=!0,L=!0,o===!0)continue;break}if(P===Cl){for(;v()!==!0&&(B=F());){if(B===rt){w=$.backslashes=!0,F();continue}if(B===Rl){h=$.isBracket=!0,g=$.isGlob=!0,L=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&P===Wr&&u===p){C=$.negated=!0,p++;continue}if(r.noparen!==!0&&P===er){if(g=$.isGlob=!0,o===!0){let Q=1;for(;v()!==!0&&(P=F());){if(P===rt){w=$.backslashes=!0,F();continue}if(P===er){Q++;continue}if(P===Go&&--Q===0){L=!0;break}}continue}break}if(g===!0){if(L=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,g=!1);let D=a,b="",E="";p>0&&(b=a.slice(0,p),a=a.slice(p),d-=p),D&&g===!0&&d>0?(D=a.slice(0,d),E=a.slice(d)):g===!0?(D="",E=a):D=a,D&&D!==""&&D!=="/"&&D!==a&&Xo(D.charCodeAt(D.length-1))&&(D=D.slice(0,-1)),r.unescape===!0&&(E&&(E=Jo.removeBackslashes(E)),D&&w===!0&&(D=Jo.removeBackslashes(D)));let te={prefix:b,input:t,start:p,base:D,glob:E,isBrace:f,isBracket:h,isGlob:g,isExtglob:y,isGlobstar:x,negated:C,negatedExtglob:k};if(r.tokens===!0&&(te.maxDepth=0,Xo(P)||s.push($),te.tokens=s),r.parts===!0||r.tokens===!0){let B;for(let X=0;X<i.length;X++){let Se=B!==void 0?B+1:p,Me=i[X],be=t.slice(Se,Me);r.tokens&&(X===0&&p!==0?(s[X].isPrefix=!0,s[X].value=b):s[X].value=be,zo(s[X]),te.maxDepth+=s[X].depth),Me>=p&&(l.push(be),B=Me)}let Q=B!==void 0?B+1:p,Z=t.slice(Q);l.push(Z),r.tokens&&B&&B+1<t.length&&(s[s.length-1].value=Z,zo(s[s.length-1]),te.maxDepth+=s[s.length-1].depth),te.slashes=i,te.parts=l}return te},"scan");Yo.exports=kl});var rs=Be((ed,ts)=>{"use strict";var wt=bt(),ue=Et(),{MAX_LENGTH:tr,POSIX_REGEX_SOURCE:Tl,REGEX_NON_SPECIAL_CHARS:Il,REGEX_SPECIAL_CHARS_BACKREF:Pl,REPLACEMENTS:Zo}=wt,Nl=c((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"),nt=c((t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,"syntaxError"),es=c(t=>{let e=[],r=0,n=0,o=0,i="",s=!1;for(let l of t){if(s===!0){i+=l,s=!1;continue}if(l==="\\"){i+=l,s=!0;continue}if(l==='"'){o=o===1?0:1,i+=l;continue}if(o===0){if(l==="[")r++;else if(l==="]"&&r>0)r--;else if(r===0){if(l==="(")n++;else if(l===")"&&n>0)n--;else if(l==="|"&&n===0){e.push(i),i="";continue}}}i+=l}return e.push(i),e},"splitTopLevel"),Ml=c(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"),Kr=c(t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Ml(e))return e.replace(/\\(.)/g,"$1")},"normalizeSimpleBranch"),Ol=c(t=>{let e=t.map(Kr).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"),Jr=c((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 l=t[s];if(i===!0){i=!1;continue}if(l==="\\"){i=!0;continue}if(l==='"'){o=o===1?0:1;continue}if(o!==1){if(l==="["){r++;continue}if(l==="]"&&r>0){r--;continue}if(!(r>0)){if(l==="("){n++;continue}if(l===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},"parseRepeatedExtglob"),$l=c(t=>`${t.length===1?ue.escapeRegex(t[0]):`[${t.map(r=>ue.escapeRegex(r)).join("")}]`}*`,"buildCharClassStar"),Ll=c(t=>{let e=0,r=[];for(;e<t.length;){let n=Jr(t.slice(e),!1);if(!n||n.type!=="*")return;let o=es(n.body).map(s=>s.trim());if(o.length!==1)return;let i=Kr(o[0]);if(!i||i.length!==1)return;r.push(i),e+=n.end+1}if(!(r.length<1))return r},"getStarExtglobSequenceChars"),Fl=c(t=>{let e=0,r=t.trim(),n=Jr(r);for(;n;)e++,r=n.body.trim(),n=Jr(r);return e},"repeatedExtglobRecursion"),Dl=c((t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:wt.DEFAULT_MAX_EXTGLOB_RECURSION,n=es(t).map(l=>l.trim());if(n.length>1&&(n.some(l=>l==="")||n.some(l=>/^[*?]+$/.test(l))||Ol(n)))return{risky:!0};let o=[],i=!1,s=!0;for(let l of n){let a=Ll(l);if(a){i=!0,o.push(...a);continue}let u=Kr(l);if(u&&u.length===1){o.push(u);continue}if(s=!1,Fl(l)>r)return{risky:!0}}return i?s?{risky:!0,safeOutput:$l([...new Set(o)])}:{risky:!0}:{risky:!1}},"analyzeRepeatedExtglob"),Gr=c((t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Zo[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(tr,r.maxLength):tr,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],l=r.capture?"":"?:",a=wt.globChars(r.windows),u=wt.extglobChars(a),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:h,DOTS_SLASH:g,NO_DOT:y,NO_DOT_SLASH:x,NO_DOTS_SLASH:S,QMARK:w,QMARK_NO_DOT:C,STAR:k,START_ANCHOR:L}=a,M=c(R=>`(${l}(?:(?!${L}${R.dot?g:p}).)*?)`,"globstar"),W=r.dot?"":y,P=r.dot?w:C,$=r.bash===!0?M(r):k;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let v={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,v),o=t.length;let z=[],F=[],D=[],b=i,E,te=c(()=>v.index===o-1,"eos"),B=v.peek=(R=1)=>t[v.index+R],Q=v.advance=()=>t[++v.index]||"",Z=c(()=>t.slice(v.index+1),"remaining"),X=c((R="",J=0)=>{v.consumed+=R,v.index+=J},"consume"),Se=c(R=>{v.output+=R.output!=null?R.output:R.value,X(R.value)},"append"),Me=c(()=>{let R=1;for(;B()==="!"&&(B(2)!=="("||B(3)==="?");)Q(),v.start++,R++;return R%2===0?!1:(v.negated=!0,v.start++,!0)},"negate"),be=c(R=>{v[R]++,D.push(R)},"increment"),le=c(R=>{v[R]--,D.pop()},"decrement"),H=c(R=>{if(b.type==="globstar"){let J=v.braces>0&&(R.type==="comma"||R.type==="brace"),_=R.extglob===!0||z.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!J&&!_&&(v.output=v.output.slice(0,-b.output.length),b.type="star",b.value="*",b.output=$,v.output+=b.output)}if(z.length&&R.type!=="paren"&&(z[z.length-1].inner+=R.value),(R.value||R.output)&&Se(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"),We=c((R,J)=>{let _={...u[J],conditions:1,inner:""};_.prev=b,_.parens=v.parens,_.output=v.output,_.startIndex=v.index,_.tokensIndex=s.length;let j=(r.capture?"(":"")+_.open;be("parens"),H({type:R,value:J,output:v.output?"":h}),H({type:"paren",extglob:!0,value:Q(),output:j}),z.push(_)},"extglobOpen"),ur=c(R=>{let J=t.slice(R.startIndex,v.index+1),_=t.slice(R.startIndex+2,v.index),j=Dl(_,r);if((R.type==="plus"||R.type==="star")&&j.risky){let T=j.safeOutput?(R.output?"":h)+(r.capture?`(${j.safeOutput})`:j.safeOutput):void 0,I=s[R.tokensIndex];I.type="text",I.value=J,I.output=T||ue.escapeRegex(J);for(let U=R.tokensIndex+1;U<s.length;U++)s[U].value="",s[U].output="",delete s[U].suffix;v.output=R.output+I.output,v.backtrack=!0,H({type:"paren",extglob:!0,value:E,output:""}),le("parens");return}let m=R.close+(r.capture?")":""),A;if(R.type==="negate"){let T=$;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(T=M(r)),(T!==$||te()||/^\)+$/.test(Z()))&&(m=R.close=`)$))${T}`),R.inner.includes("*")&&(A=Z())&&/^\.[^\\/.]+$/.test(A)){let I=Gr(A,{...e,fastpaths:!1}).output;m=R.close=`)${I})${T})`}R.prev.type==="bos"&&(v.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:E,output:m}),le("parens")},"extglobClose");if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let R=!1,J=t.replace(Pl,(_,j,m,A,T,I)=>A==="\\"?(R=!0,_):A==="?"?j?j+A+(T?w.repeat(T.length):""):I===0?P+(T?w.repeat(T.length):""):w.repeat(m.length):A==="."?p.repeat(m.length):A==="*"?j?j+A+(T?$:""):$:j?_:`\\${_}`);return R===!0&&(r.unescape===!0?J=J.replace(/\\/g,""):J=J.replace(/\\+/g,_=>_.length%2===0?"\\\\":_?"\\":"")),J===t&&r.contains===!0?(v.output=t,v):(v.output=ue.wrapOutput(J,v,e),v)}for(;!te();){if(E=Q(),E==="\0")continue;if(E==="\\"){let _=B();if(_==="/"&&r.bash!==!0||_==="."||_===";")continue;if(!_){E+="\\",H({type:"text",value:E});continue}let j=/^\\+/.exec(Z()),m=0;if(j&&j[0].length>2&&(m=j[0].length,v.index+=m,m%2!==0&&(E+="\\")),r.unescape===!0?E=Q():E+=Q(),v.brackets===0){H({type:"text",value:E});continue}}if(v.brackets>0&&(E!=="]"||b.value==="["||b.value==="[^")){if(r.posix!==!1&&E===":"){let _=b.value.slice(1);if(_.includes("[")&&(b.posix=!0,_.includes(":"))){let j=b.value.lastIndexOf("["),m=b.value.slice(0,j),A=b.value.slice(j+2),T=Tl[A];if(T){b.value=m+T,v.backtrack=!0,Q(),!i.output&&s.indexOf(b)===1&&(i.output=h);continue}}}(E==="["&&B()!==":"||E==="-"&&B()==="]")&&(E=`\\${E}`),E==="]"&&(b.value==="["||b.value==="[^")&&(E=`\\${E}`),r.posix===!0&&E==="!"&&b.value==="["&&(E="^"),b.value+=E,Se({value:E});continue}if(v.quotes===1&&E!=='"'){E=ue.escapeRegex(E),b.value+=E,Se({value:E});continue}if(E==='"'){v.quotes=v.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:E});continue}if(E==="("){be("parens"),H({type:"paren",value:E});continue}if(E===")"){if(v.parens===0&&r.strictBrackets===!0)throw new SyntaxError(nt("opening","("));let _=z[z.length-1];if(_&&v.parens===_.parens+1){ur(z.pop());continue}H({type:"paren",value:E,output:v.parens?")":"\\)"}),le("parens");continue}if(E==="["){if(r.nobracket===!0||!Z().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(nt("closing","]"));E=`\\${E}`}else be("brackets");H({type:"bracket",value:E});continue}if(E==="]"){if(r.nobracket===!0||b&&b.type==="bracket"&&b.value.length===1){H({type:"text",value:E,output:`\\${E}`});continue}if(v.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(nt("opening","["));H({type:"text",value:E,output:`\\${E}`});continue}le("brackets");let _=b.value.slice(1);if(b.posix!==!0&&_[0]==="^"&&!_.includes("/")&&(E=`/${E}`),b.value+=E,Se({value:E}),r.literalBrackets===!1||ue.hasRegexChars(_))continue;let j=ue.escapeRegex(b.value);if(v.output=v.output.slice(0,-b.value.length),r.literalBrackets===!0){v.output+=j,b.value=j;continue}b.value=`(${l}${j}|${b.value})`,v.output+=b.value;continue}if(E==="{"&&r.nobrace!==!0){be("braces");let _={type:"brace",value:E,output:"(",outputIndex:v.output.length,tokensIndex:v.tokens.length};F.push(_),H(_);continue}if(E==="}"){let _=F[F.length-1];if(r.nobrace===!0||!_){H({type:"text",value:E,output:E});continue}let j=")";if(_.dots===!0){let m=s.slice(),A=[];for(let T=m.length-1;T>=0&&(s.pop(),m[T].type!=="brace");T--)m[T].type!=="dots"&&A.unshift(m[T].value);j=Nl(A,r),v.backtrack=!0}if(_.comma!==!0&&_.dots!==!0){let m=v.output.slice(0,_.outputIndex),A=v.tokens.slice(_.tokensIndex);_.value=_.output="\\{",E=j="\\}",v.output=m;for(let T of A)v.output+=T.output||T.value}H({type:"brace",value:E,output:j}),le("braces"),F.pop();continue}if(E==="|"){z.length>0&&z[z.length-1].conditions++,H({type:"text",value:E});continue}if(E===","){let _=E,j=F[F.length-1];j&&D[D.length-1]==="braces"&&(j.comma=!0,_="|"),H({type:"comma",value:E,output:_});continue}if(E==="/"){if(b.type==="dot"&&v.index===v.start+1){v.start=v.index+1,v.consumed="",v.output="",s.pop(),b=i;continue}H({type:"slash",value:E,output:f});continue}if(E==="."){if(v.braces>0&&b.type==="dot"){b.value==="."&&(b.output=p);let _=F[F.length-1];b.type="dots",b.output+=E,b.value+=E,_.dots=!0;continue}if(v.braces+v.parens===0&&b.type!=="bos"&&b.type!=="slash"){H({type:"text",value:E,output:p});continue}H({type:"dot",value:E,output:p});continue}if(E==="?"){if(!(b&&b.value==="(")&&r.noextglob!==!0&&B()==="("&&B(2)!=="?"){We("qmark",E);continue}if(b&&b.type==="paren"){let j=B(),m=E;(b.value==="("&&!/[!=<:]/.test(j)||j==="<"&&!/<([!=]|\w+>)/.test(Z()))&&(m=`\\${E}`),H({type:"text",value:E,output:m});continue}if(r.dot!==!0&&(b.type==="slash"||b.type==="bos")){H({type:"qmark",value:E,output:C});continue}H({type:"qmark",value:E,output:w});continue}if(E==="!"){if(r.noextglob!==!0&&B()==="("&&(B(2)!=="?"||!/[!=<:]/.test(B(3)))){We("negate",E);continue}if(r.nonegate!==!0&&v.index===0){Me();continue}}if(E==="+"){if(r.noextglob!==!0&&B()==="("&&B(2)!=="?"){We("plus",E);continue}if(b&&b.value==="("||r.regex===!1){H({type:"plus",value:E,output:d});continue}if(b&&(b.type==="bracket"||b.type==="paren"||b.type==="brace")||v.parens>0){H({type:"plus",value:E});continue}H({type:"plus",value:d});continue}if(E==="@"){if(r.noextglob!==!0&&B()==="("&&B(2)!=="?"){H({type:"at",extglob:!0,value:E,output:""});continue}H({type:"text",value:E});continue}if(E!=="*"){(E==="$"||E==="^")&&(E=`\\${E}`);let _=Il.exec(Z());_&&(E+=_[0],v.index+=_[0].length),H({type:"text",value:E});continue}if(b&&(b.type==="globstar"||b.star===!0)){b.type="star",b.star=!0,b.value+=E,b.output=$,v.backtrack=!0,v.globstar=!0,X(E);continue}let R=Z();if(r.noextglob!==!0&&/^\([^?]/.test(R)){We("star",E);continue}if(b.type==="star"){if(r.noglobstar===!0){X(E);continue}let _=b.prev,j=_.prev,m=_.type==="slash"||_.type==="bos",A=j&&(j.type==="star"||j.type==="globstar");if(r.bash===!0&&(!m||R[0]&&R[0]!=="/")){H({type:"star",value:E,output:""});continue}let T=v.braces>0&&(_.type==="comma"||_.type==="brace"),I=z.length&&(_.type==="pipe"||_.type==="paren");if(!m&&_.type!=="paren"&&!T&&!I){H({type:"star",value:E,output:""});continue}for(;R.slice(0,3)==="/**";){let q=t[v.index+4];if(q&&q!=="/")break;R=R.slice(3),X("/**",3)}let U=te()||v.parens>0&&R===")".repeat(v.parens)&&!z.some(q=>q.type==="negate");if(_.type==="bos"&&te()){b.type="globstar",b.value+=E,b.output=M(r),v.output=b.output,v.globstar=!0,X(E);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&!A&&U){v.output=v.output.slice(0,-(_.output+b.output).length),_.output=`(?:${_.output}`,b.type="globstar",b.output=M(r)+(r.strictSlashes?")":"|$)"),b.value+=E,v.globstar=!0,v.output+=_.output+b.output,X(E);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&R[0]==="/"){let q=R[1]!==void 0?"|$":"";v.output=v.output.slice(0,-(_.output+b.output).length),_.output=`(?:${_.output}`,b.type="globstar",b.output=`${M(r)}${f}|${f}${q})`,b.value+=E,v.output+=_.output+b.output,v.globstar=!0,X(E+Q()),H({type:"slash",value:"/",output:""});continue}if(_.type==="bos"&&R[0]==="/"){b.type="globstar",b.value+=E,b.output=`(?:^|${f}|${M(r)}${f})`,v.output=b.output,v.globstar=!0,X(E+Q()),H({type:"slash",value:"/",output:""});continue}v.output=v.output.slice(0,-b.output.length),b.type="globstar",b.output=M(r),b.value+=E,v.output+=b.output,v.globstar=!0,X(E);continue}let J={type:"star",value:E,output:$};if(r.bash===!0){J.output=".*?",(b.type==="bos"||b.type==="slash")&&(J.output=W+J.output),H(J);continue}if(b&&(b.type==="bracket"||b.type==="paren")&&r.regex===!0){J.output=E,H(J);continue}(v.index===v.start||b.type==="slash"||b.type==="dot")&&(b.type==="dot"?(v.output+=x,b.output+=x):r.dot===!0?(v.output+=S,b.output+=S):(v.output+=W,b.output+=W),B()!=="*"&&(v.output+=h,b.output+=h)),H(J)}for(;v.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing","]"));v.output=ue.escapeLast(v.output,"["),le("brackets")}for(;v.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing",")"));v.output=ue.escapeLast(v.output,"("),le("parens")}for(;v.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing","}"));v.output=ue.escapeLast(v.output,"{"),le("braces")}if(r.strictSlashes!==!0&&(b.type==="star"||b.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${f}?`}),v.backtrack===!0){v.output="";for(let R of v.tokens)v.output+=R.output!=null?R.output:R.value,R.suffix&&(v.output+=R.suffix)}return v},"parse");Gr.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(tr,r.maxLength):tr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=Zo[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:l,DOTS_SLASH:a,NO_DOT:u,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:h}=wt.globChars(r.windows),g=r.dot?p:u,y=r.dot?d:u,x=r.capture?"":"?:",S={negated:!1,prefix:""},w=r.bash===!0?".*?":f;r.capture&&(w=`(${w})`);let C=c(W=>W.noglobstar===!0?w:`(${x}(?:(?!${h}${W.dot?a:i}).)*?)`,"globstar"),k=c(W=>{switch(W){case"*":return`${g}${l}${w}`;case".*":return`${i}${l}${w}`;case"*.*":return`${g}${w}${i}${l}${w}`;case"*/*":return`${g}${w}${s}${l}${y}${w}`;case"**":return g+C(r);case"**/*":return`(?:${g}${C(r)}${s})?${y}${l}${w}`;case"**/*.*":return`(?:${g}${C(r)}${s})?${y}${w}${i}${l}${w}`;case"**/.*":return`(?:${g}${C(r)}${s})?${i}${l}${w}`;default:{let P=/^(.*?)\.(\w+)$/.exec(W);if(!P)return;let $=k(P[1]);return $?$+i+P[2]:void 0}}},"create"),L=ue.removePrefix(t,S),M=k(L);return M&&r.strictSlashes!==!0&&(M+=`${s}?`),M};ts.exports=Gr});var ss=Be((rd,os)=>{"use strict";var Hl=Qo(),Xr=rs(),ns=Et(),jl=bt(),Ul=c(t=>t&&typeof t=="object"&&!Array.isArray(t),"isObject"),Y=c((t,e,r=!1)=>{if(Array.isArray(t)){let p=t.map(f=>Y(f,e,r));return c(f=>{for(let h of p){let g=h(f);if(g)return g}return!1},"arrayMatcher")}let n=Ul(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),l=s.state;delete s.state;let a=c(()=>!1,"isIgnored");if(o.ignore){let p={...e,ignore:null,onMatch:null,onResult:null};a=Y(o.ignore,p,r)}let u=c((p,d=!1)=>{let{isMatch:f,match:h,output:g}=Y.test(p,s,e,{glob:t,posix:i}),y={glob:t,state:l,regex:s,posix:i,input:p,output:g,match:h,isMatch:f};return typeof o.onResult=="function"&&o.onResult(y),f===!1?(y.isMatch=!1,d?y:!1):a(p)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,d?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),d?y:!0)},"matcher");return r&&(u.state=l),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?ns.toPosixSlashes:null),l=t===n,a=l&&s?s(t):t;return l===!1&&(a=s?s(t):t,l=a===n),(l===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?l=Y.matchBase(t,e,r,o):l=e.exec(a)),{isMatch:!!l,match:l,output:a}};Y.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Y.makeRe(e,r)).test(ns.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)):Xr(t,{...e,fastpaths:!1});Y.scan=(t,e)=>Hl(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?"":"$",l=`${i}(?:${t.output})${s}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let a=Y.toRegex(l,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=Xr.fastpaths(t,e)),o.output||(o=Xr(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=jl;os.exports=Y});var cs=Be((od,ls)=>{"use strict";var is=ss(),Vl=Et();function as(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Vl.isWindows()}),is(t,e,r)}c(as,"picomatch");Object.assign(as,is);ls.exports=as});function Wl(t){return Array.isArray(t)}function us(t){return Wl(t)?t:t==null?[]:[t]}function Jl(t,e){if(e===!1||(0,Ae.isAbsolute)(t)||t.startsWith("**"))return rr(t);let r=rr((0,Ae.resolve)(e||"")).replace(/[-^$*+?.()|[\]{}]/g,"\\$&");return Ae.posix.join(r,rr(t))}var Ae,ps,Bl,rr,zr,Kl,Gl,Xl,ld,ds=O(()=>{Ae=require("path");Ho();ps=dr(cs(),1);c(Wl,"isArray");c(us,"ensureArray");Bl=new RegExp(`\\${Ae.win32.sep}`,"g"),rr=c(function(e){return e.replace(Bl,Ae.posix.sep)},"normalizePath");c(Jl,"getMatcherString");zr=c(function(e,r,n){let o=n&&n.resolve,i=c(a=>a instanceof RegExp?a:{test:c(u=>{let p=Jl(a,o);return(0,ps.default)(p,{dot:!0})(u)},"test")},"getMatcher"),s=us(e).map(i),l=us(r).map(i);return!s.length&&!l.length?a=>typeof a=="string"&&!a.includes("\0"):c(function(u){if(typeof u!="string"||u.includes("\0"))return!1;let p=rr(u);for(let d=0;d<l.length;++d){let f=l[d];if(f instanceof RegExp&&(f.lastIndex=0),f.test(p))return!1}for(let d=0;d<s.length;++d){let f=s[d];if(f instanceof RegExp&&(f.lastIndex=0),f.test(p))return!0}return!s.length},"result")},"createFilter"),Kl="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",Gl="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",Xl=new Set(`${Kl} ${Gl}`.split(" "));Xl.add("");ld="isWellFormed"in String.prototype});var xt,fs=O(()=>{"use strict";xt="tempo-interact-preview"});function qr(t){switch(t.type){case"JSXIdentifier":return t.name;case"JSXNamespacedName":return`${t.namespace.name}:${t.name.name}`;case"JSXMemberExpression":return ms(t)}}function ms(t){return`${t.object.type==="JSXIdentifier"?t.object.name:ms(t.object)}.${t.property.name}`}var gs=O(()=>{"use strict";c(qr,"getTagName");c(ms,"getJSXMemberExpressionName")});function nr(t,e,r=null){if(t==null||typeof t!="object")return;if(Array.isArray(t)){for(let s of t)nr(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"&&nr(s,e,i)}var ys,hs,gd,Ss=O(()=>{"use strict";ys=dr(require("oxc-parser/src-js/generated/visit/keys.js"),1),hs=ys.default,gd=hs.default??hs;c(nr,"walk")});function ql(t){let e=zl.exec(t);if(e)return e[1].toLowerCase()==="c"?{lang:"jsx",sourceType:"commonjs"}:{lang:"jsx"}}function bs(t,e){return(0,vs.parseSync)(t,e,ql(t))}var vs,zl,Es=O(()=>{"use strict";vs=require("oxc-parser"),zl=/\.([cm]?)js$/i;c(ql,"sourceParseOptions");c(bs,"parseSourceFile")});function Yl(t){return t===void 0?null:typeof t=="function"?t.toString():JSON.stringify(t)}function Ql(t){return Object.entries(t).map(([e,r])=>{let n=Yl(r);return n===null?null:` ${e}={${n}}`}).filter(e=>e!==null).join("")}function Zl(t){let e=new Set;for(let r of t.openingElement.attributes??[])r.type==="JSXAttribute"&&e.add(qr(r.name));return e}function ec(t,e){return Object.fromEntries(Object.entries(t).filter(([r])=>!e.has(r)))}function ws(t,e,r){let n=bs(e,t),o=[],i=new WeakSet,s=c(u=>{for(let p of u.children){let d=mr(p);d&&i.add(d)}},"noteChildren");nr(n.program,{JSXFragment(u){s(u)},JSXElement(u,p){let d=u;s(d);let f=qr(d.openingElement.name);if(tc.has(f))return;let h=p?.type??null,g=ec(r({element:d,tagName:f,parentType:h,...i.has(d)?{isStaticJsxChild:!0}:{}}),Zl(d));if(Object.keys(g).length===0)return;let y=d.openingElement,x=y.end-1;if(y.selfClosing)for(x--;x>y.start&&/\s/.test(t[x-1]);)x--;o.push({position:x,text:Ql(g)})}}),o.sort((u,p)=>u.position-p.position);let l=[],a=0;for(let{position:u,text:p}of o)l.push(t.slice(a,u)),l.push(p),a=u;return l.push(t.slice(a)),{annotatedSource:l.join(""),elementsAnnotated:o.length,parseResult:n}}var tc,xs=O(()=>{"use strict";gs();Ss();Nt();Es();c(Yl,"formatPropValue");c(Ql,"formatProps");c(Zl,"getExistingAttributeNames");c(ec,"removeExistingProps");tc=new Set(["Fragment","React.Fragment"]);c(ws,"annotateFile")});var rc,Yr=O(()=>{"use strict";rc=Object.freeze({$unresolved:!0})});function nc(t){let e=(0,_s.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 oc(t,e){try{if(t.endsWith(".astro"))return{program:nc(e).frontmatter?.program??{type:"Program",body:[]},errors:[]};let r=(0,As.parseSync)(t,e),n=(r.errors??[]).map(o=>({code:"unparseable_source",severity:"structural",message:o?.message??"Unable to parse asset source",span:At(o)??At(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 sc(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=At(r);if(n&&e.importDeclarationSpans.push(n),r.importKind==="type")continue;let o=r.source.value,i=ks(o);for(let s of r.specifiers??[]){if(s?.importKind==="type")continue;let l=s?.local?.name;if(typeof l!="string")continue;if(e.importedBindings.set(l,o),s.type==="ImportDefaultSpecifier"){e.referenceableImports.set(l,{importSpecifier:o,importedName:"default"});continue}if(s.type!=="ImportSpecifier")continue;let a=s.imported?.name??s.imported?.value??l;e.referenceableImports.set(l,{importSpecifier:o,importedName:a}),i&&a==="defineControls"&&e.trustedDefineControlsNames.add(l),a==="defineAsset"&&(i?e.trustedDefineAssetNames.add(l):ic(o)&&e.misimports.push({source:o,span:At(r.source)??n??{start:0,end:0}}))}}return e}function Rs(t,e,r=oc(t,e)){let{program:n}=r,o=sc(n),i=n?ac(n):null,s=new Set;if(t.endsWith(".astro")){for(let l of n?.body??[])if(!(l.type!=="ImportDeclaration"||l.source.value!=="tempo-sdk/astro/controls"||l.importKind==="type"))for(let a of l.specifiers)a.type==="ImportSpecifier"&&a.importKind!=="type"&&(a.imported.name??a.imported.value)==="defineAstroControls"&&s.add(a.local.name)}return(n?.body??[]).flatMap(l=>{let a=l.type==="ExpressionStatement"?l.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),d=i?.bindings.get(u);return!p&&!d?[]:[{bindingName:u,reference:p,exportKind:p?.importedName==="default"?"default":d?.exportKind??"named",start:a.start,end:a.end}]})}function ks(t){return t===Cs||t.endsWith(`/${Cs}`)}function ic(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!ks(t)}function ac(t){let e=new Map,r=new Set,n=new Set,o=new Set,i=c((s,l,a)=>{let u=c(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:l,exportKind:"none"}),u(p));return}if(s?.type==="VariableDeclaration")for(let p of s.declarations??[])if(p?.id?.type==="Identifier"){let d=p.id.name;p.init?(e.set(d,{name:d,statementSpan:l,exportKind:"none"}),u(d)):r.add(d)}else Ct(p?.id,r)},"register");for(let s of t?.body??[]){let l=At(s)??{start:0,end:0};if(s?.type==="ExportNamedDeclaration"){if(s.declaration&&i(s.declaration,l,"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,l,"default");else{let u=lc(a);u?.type==="Identifier"&&o.add(u.name)}continue}i(s,l,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 Ct(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??[])Ct(r?.value??r?.argument,e);return}if(t.type==="ArrayPattern"){for(let r of t.elements??[])Ct(r,e);return}if(t.type==="AssignmentPattern"){Ct(t.left,e);return}t.type==="RestElement"&&Ct(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 At(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 As,_s,Cs,Ts=O(()=>{As=require("oxc-parser"),_s=require("node:module");Yr();Yr();c(nc,"parseAstroAssetSource");Cs="tempo-sdk/assets";c(oc,"parseAssetProgram");c(sc,"readAssetImports");c(Rs,"parseControlsFile");c(ks,"isTrustedAssetImportSource");c(ic,"isMisimportedAssetSdkSource");c(ac,"collectTopLevelScope");c(Ct,"collectPatternNames");c(lc,"unwrapTsExpression");c(At,"toSourceSpan")});function Is(t,e,r=!1){let n=t.includes("defineControls")?Rs(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(d=>[n(me(d)),d]));for(let d of[...s.keys()])u.has(d)||s.delete(d);let p=Date.now();for(let[d,f]of u){let y=s.get(d);if(y&&p<y.nextAttemptAtMs)continue;if(await i(a,f)){s.delete(d);continue}let g=y?.intervalMs??sl;s.set(d,{nextAttemptAtMs:p+g,intervalMs:Math.min(g*2,ll)})}},"pollCompileErrorRecovery"),reset(){s.clear()}}}function cl(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 vt,vo,sl,ll,wo=O(()=>{Nr();vt=require("node:fs"),vo=require("oxc-parser");Yt();St();qt();sl=yt;l(il,"isSameError");l(al,"createErrorServer");l(bo,"moduleIdsMatch");ll=3e4;l(Eo,"createCompileErrorStream");l(cl,"readBody")});function Qt(t){return t.trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"")}var Lr,Fr,xo=O(()=>{"use strict";Lr="/__tempo/canvas-host-registration",Fr="x-tempo-canvas-host-registration";l(Qt,"normalizeCanvasRegistrationPath")});async function Ao(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 _o(){let t=new Map;return l(async function(r,n){let o=(0,Co.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 Ro(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 Co,To=O(()=>{Co=require("node:fs");l(Ao,"traceSlowRegistration");l(_o,"createRegistrationTransforms");l(Ro,"registrationReply")});function Po(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=Qt(o);i&&e.add(i)}catch{}return[...e]}async function pl(t,e){let r=(0,bt.resolve)(t.config.root,".tempo","tempo-host.tsx"),n;try{n=(0,Ve.readFileSync)(r,"utf8")}catch(u){throw new Error(`Canvas host wrapper is unavailable at ${r}: ${u instanceof Error?u.message:String(u)}`)}if(!Po(n).includes(e))throw Object.assign(new Error(`Generated canvas host wrapper does not contain ${JSON.stringify(e)}`),{statusCode:409});let i=(0,Ve.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(Qt(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 d=me(p.id),f=`/@fs/${d.replace(/^\/+/,"")}`;c=`${dl(t)}${f.slice(1)}`,await ko(t,a,(0,Ve.realpathSync)(d),d,f);break}return await ko(t,a,i,r),n.includes("tempo-incremental-canvas-registration")?c:void 0}function dl(t){let e=t.config.base||"/",r=e.startsWith("/")?e:new URL(e,"http://tempo.invalid").pathname;return r.endsWith("/")?r:`${r}/`}function No(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:Zt.get(t)??0}}async function ko(t,e,r,n,o=ul){let i=Dr.get(e);i||(i=_o(),Dr.set(e,i)),await i(r,()=>Ao(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,d])=>d!=null&&s()?.has(p)&&p.transformResult===d)},(s,c)=>{t.config.logger.info(`[tempo] canvas registration ${JSON.stringify({...No(t),status:s,module:(0,bt.relative)(t.config.root,r),elapsedMs:c})}`)}))}function Io(t){t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Expose-Headers",Fr),t.setHeader(Fr,"1")}function Mo(t,e){if(t.replace(/\\/g,"/")!==e.replace(/\\/g,"/"))return!1;try{return(0,Ve.readFileSync)(t,"utf8").includes("tempo-incremental-canvas-registration")}catch{return!1}}function Oo(t,e,r,n){let o=(0,bt.relative)(e.sourceRoot,t).replace(/\\/g,"/"),i;try{i=(0,Ve.readFileSync)(e.wrapperPath,"utf8")}catch{return}if(!Po(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 $o(t){Zt.set(t,0),Dr.delete(t.environments?.client??t)}function Lo(t){Zt.set(t,(Zt.get(t)??0)+1)}function Fo(t,e,r){let n=e.url;return n===Lr&&e.method==="OPTIONS"?(Io(r),r.writeHead(204,{"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"content-type"}),r.end(),!0):n===Lr&&e.method==="POST"?(Io(r),fl(e).then(async o=>{let i=JSON.parse(o),s=typeof i.canvasPath=="string"?Qt(i.canvasPath):"";if(!s)throw Object.assign(new Error("canvasPath must be a non-empty string"),{statusCode:400});let c,a=await Ro(pl(t,s).then(u=>{c=u}),()=>No(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 fl(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 Ve,bt,ul,Dr,Zt,Do=O(()=>{Ve=require("node:fs"),bt=require("node:path");xo();To();St();ul="/.tempo/tempo-host";l(Po,"readGeneratedCanvasPaths");l(pl,"synchronizeCanvasHostRegistrationTransform");l(dl,"viteBasePath");Dr=new WeakMap,Zt=new WeakMap;l(No,"registrationProgress");l(ko,"retransformCanvasHostWrapper");l(Io,"writeCanvasRegistrationResponseHeaders");l(Mo,"isIncrementalWrapperFile");l(Oo,"withRegisteredCanvasLoader");l($o,"resetCanvasHostRegistration");l(Lo,"noteCanvasHostRegistrationActivity");l(Fo,"handleCanvasHostRegistrationRequest");l(fl,"readBody")});var Ho=O(()=>{});var Et=Je((rd,Bo)=>{"use strict";var jo="[^\\\\/]",ml="(?=.)",Uo="[^/]",Hr="(?:\\/|$)",Vo="(?:^|\\/)",jr=`\\.{1,2}${Hr}`,gl="(?!\\.)",hl=`(?!${Vo}${jr})`,yl=`(?!\\.{0,1}${Hr})`,Sl=`(?!${jr})`,vl="[^.\\/]",bl=`${Uo}*?`,El="/",Wo={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ml,QMARK:Uo,END_ANCHOR:Hr,DOTS_SLASH:jr,NO_DOT:gl,NO_DOTS:hl,NO_DOT_SLASH:yl,NO_DOTS_SLASH:Sl,QMARK_NO_DOT:vl,STAR:bl,START_ANCHOR:Vo,SEP:El},wl={...Wo,SLASH_LITERAL:"[\\\\/]",QMARK:jo,STAR:`${jo}*?`,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:"\\"},xl={__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"};Bo.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:xl,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:Wo}}});var wt=Je(se=>{"use strict";var{REGEX_BACKSLASH:Cl,REGEX_REMOVE_BACKSLASH:Al,REGEX_SPECIAL_CHARS:_l,REGEX_SPECIAL_CHARS_GLOBAL:Rl}=Et();se.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);se.hasRegexChars=t=>_l.test(t);se.isRegexChar=t=>t.length===1&&se.hasRegexChars(t);se.escapeRegex=t=>t.replace(Rl,"\\$1");se.toPosixSlashes=t=>t.replace(Cl,"/");se.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};se.removeBackslashes=t=>t.replace(Al,e=>e==="\\"?"":e);se.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?se.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};se.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};se.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};se.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var Qo=Je((od,Yo)=>{"use strict";var Jo=wt(),{CHAR_ASTERISK:Ur,CHAR_AT:Tl,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:kl,CHAR_DOT:Vr,CHAR_EXCLAMATION_MARK:Wr,CHAR_FORWARD_SLASH:qo,CHAR_LEFT_CURLY_BRACE:Br,CHAR_LEFT_PARENTHESES:er,CHAR_LEFT_SQUARE_BRACKET:Il,CHAR_PLUS:Pl,CHAR_QUESTION_MARK:Ko,CHAR_RIGHT_CURLY_BRACE:Nl,CHAR_RIGHT_PARENTHESES:Go,CHAR_RIGHT_SQUARE_BRACKET:Ml}=Et(),Xo=l(t=>t===qo||t===rt,"isPathSeparator"),zo=l(t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},"depth"),Ol=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,d=0,f=!1,y=!1,g=!1,h=!1,v=!1,S=!1,x=!1,C=!1,T=!1,L=!1,M=0,W,N,$={value:"",depth:0,isGlob:!1},b=l(()=>u>=n,"eos"),z=l(()=>a.charCodeAt(u+1),"peek"),F=l(()=>(W=N,a.charCodeAt(++u)),"advance");for(;u<n;){N=F();let B;if(N===rt){x=$.backslashes=!0,N=F(),N===Br&&(S=!0);continue}if(S===!0||N===Br){for(M++;b()!==!0&&(N=F());){if(N===rt){x=$.backslashes=!0,F();continue}if(N===Br){M++;continue}if(S!==!0&&N===Vr&&(N=F())===Vr){if(f=$.isBrace=!0,g=$.isGlob=!0,L=!0,o===!0)continue;break}if(S!==!0&&N===kl){if(f=$.isBrace=!0,g=$.isGlob=!0,L=!0,o===!0)continue;break}if(N===Nl&&(M--,M===0)){S=!1,f=$.isBrace=!0,L=!0;break}}if(o===!0)continue;break}if(N===qo){if(i.push(u),s.push($),$={value:"",depth:0,isGlob:!1},L===!0)continue;if(W===Vr&&u===p+1){p+=2;continue}d=u+1;continue}if(r.noext!==!0&&(N===Pl||N===Tl||N===Ur||N===Ko||N===Wr)===!0&&z()===er){if(g=$.isGlob=!0,h=$.isExtglob=!0,L=!0,N===Wr&&u===p&&(T=!0),o===!0){let Z=0;for(;b()!==!0&&(N=F());){if(N===rt){x=$.backslashes=!0,F();continue}if(N===er){Z++;continue}if(N===Go&&--Z===0){L=!0;break}}continue}break}if(N===Ur){if(W===Ur&&(v=$.isGlobstar=!0),g=$.isGlob=!0,L=!0,o===!0)continue;break}if(N===Ko){if(g=$.isGlob=!0,L=!0,o===!0)continue;break}if(N===Il){for(;b()!==!0&&(B=F());){if(B===rt){x=$.backslashes=!0,F();continue}if(B===Ml){y=$.isBracket=!0,g=$.isGlob=!0,L=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&N===Wr&&u===p){C=$.negated=!0,p++;continue}if(r.noparen!==!0&&N===er){if(g=$.isGlob=!0,o===!0){let Q=1;for(;b()!==!0&&(N=F());){if(N===rt){x=$.backslashes=!0,F();continue}if(N===er){Q++;continue}if(N===Go&&--Q===0){L=!0;break}}continue}break}if(g===!0){if(L=!0,o===!0)continue;break}}r.noext===!0&&(h=!1,g=!1);let D=a,E="",w="";p>0&&(E=a.slice(0,p),a=a.slice(p),d-=p),D&&g===!0&&d>0?(D=a.slice(0,d),w=a.slice(d)):g===!0?(D="",w=a):D=a,D&&D!==""&&D!=="/"&&D!==a&&Xo(D.charCodeAt(D.length-1))&&(D=D.slice(0,-1)),r.unescape===!0&&(w&&(w=Jo.removeBackslashes(w)),D&&x===!0&&(D=Jo.removeBackslashes(D)));let te={prefix:E,input:t,start:p,base:D,glob:w,isBrace:f,isBracket:y,isGlob:g,isExtglob:h,isGlobstar:v,negated:C,negatedExtglob:T};if(r.tokens===!0&&(te.maxDepth=0,Xo(N)||s.push($),te.tokens=s),r.parts===!0||r.tokens===!0){let B;for(let X=0;X<i.length;X++){let Se=B!==void 0?B+1:p,Oe=i[X],be=t.slice(Se,Oe);r.tokens&&(X===0&&p!==0?(s[X].isPrefix=!0,s[X].value=E):s[X].value=be,zo(s[X]),te.maxDepth+=s[X].depth),Oe>=p&&(c.push(be),B=Oe)}let Q=B!==void 0?B+1:p,Z=t.slice(Q);c.push(Z),r.tokens&&B&&B+1<t.length&&(s[s.length-1].value=Z,zo(s[s.length-1]),te.maxDepth+=s[s.length-1].depth),te.slashes=i,te.parts=c}return te},"scan");Yo.exports=Ol});var rs=Je((id,ts)=>{"use strict";var xt=Et(),ue=wt(),{MAX_LENGTH:tr,POSIX_REGEX_SOURCE:$l,REGEX_NON_SPECIAL_CHARS:Ll,REGEX_SPECIAL_CHARS_BACKREF:Fl,REPLACEMENTS:Zo}=xt,Dl=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"),nt=l((t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,"syntaxError"),es=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"),Hl=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"),Kr=l(t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Hl(e))return e.replace(/\\(.)/g,"$1")},"normalizeSimpleBranch"),jl=l(t=>{let e=t.map(Kr).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"),Jr=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"),Ul=l(t=>`${t.length===1?ue.escapeRegex(t[0]):`[${t.map(r=>ue.escapeRegex(r)).join("")}]`}*`,"buildCharClassStar"),Vl=l(t=>{let e=0,r=[];for(;e<t.length;){let n=Jr(t.slice(e),!1);if(!n||n.type!=="*")return;let o=es(n.body).map(s=>s.trim());if(o.length!==1)return;let i=Kr(o[0]);if(!i||i.length!==1)return;r.push(i),e+=n.end+1}if(!(r.length<1))return r},"getStarExtglobSequenceChars"),Wl=l(t=>{let e=0,r=t.trim(),n=Jr(r);for(;n;)e++,r=n.body.trim(),n=Jr(r);return e},"repeatedExtglobRecursion"),Bl=l((t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:xt.DEFAULT_MAX_EXTGLOB_RECURSION,n=es(t).map(c=>c.trim());if(n.length>1&&(n.some(c=>c==="")||n.some(c=>/^[*?]+$/.test(c))||jl(n)))return{risky:!0};let o=[],i=!1,s=!0;for(let c of n){let a=Vl(c);if(a){i=!0,o.push(...a);continue}let u=Kr(c);if(u&&u.length===1){o.push(u);continue}if(s=!1,Wl(c)>r)return{risky:!0}}return i?s?{risky:!0,safeOutput:Ul([...new Set(o)])}:{risky:!0}:{risky:!1}},"analyzeRepeatedExtglob"),Gr=l((t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Zo[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(tr,r.maxLength):tr,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=xt.globChars(r.windows),u=xt.extglobChars(a),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:y,DOTS_SLASH:g,NO_DOT:h,NO_DOT_SLASH:v,NO_DOTS_SLASH:S,QMARK:x,QMARK_NO_DOT:C,STAR:T,START_ANCHOR:L}=a,M=l(R=>`(${c}(?:(?!${L}${R.dot?g:p}).)*?)`,"globstar"),W=r.dot?"":h,N=r.dot?x:C,$=r.bash===!0?M(r):T;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let b={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,b),o=t.length;let z=[],F=[],D=[],E=i,w,te=l(()=>b.index===o-1,"eos"),B=b.peek=(R=1)=>t[b.index+R],Q=b.advance=()=>t[++b.index]||"",Z=l(()=>t.slice(b.index+1),"remaining"),X=l((R="",J=0)=>{b.consumed+=R,b.index+=J},"consume"),Se=l(R=>{b.output+=R.output!=null?R.output:R.value,X(R.value)},"append"),Oe=l(()=>{let R=1;for(;B()==="!"&&(B(2)!=="("||B(3)==="?");)Q(),b.start++,R++;return R%2===0?!1:(b.negated=!0,b.start++,!0)},"negate"),be=l(R=>{b[R]++,D.push(R)},"increment"),le=l(R=>{b[R]--,D.pop()},"decrement"),H=l(R=>{if(E.type==="globstar"){let J=b.braces>0&&(R.type==="comma"||R.type==="brace"),_=R.extglob===!0||z.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!J&&!_&&(b.output=b.output.slice(0,-E.output.length),E.type="star",E.value="*",E.output=$,b.output+=E.output)}if(z.length&&R.type!=="paren"&&(z[z.length-1].inner+=R.value),(R.value||R.output)&&Se(R),E&&E.type==="text"&&R.type==="text"){E.output=(E.output||E.value)+R.value,E.value+=R.value;return}R.prev=E,s.push(R),E=R},"push"),Be=l((R,J)=>{let _={...u[J],conditions:1,inner:""};_.prev=E,_.parens=b.parens,_.output=b.output,_.startIndex=b.index,_.tokensIndex=s.length;let j=(r.capture?"(":"")+_.open;be("parens"),H({type:R,value:J,output:b.output?"":y}),H({type:"paren",extglob:!0,value:Q(),output:j}),z.push(_)},"extglobOpen"),ur=l(R=>{let J=t.slice(R.startIndex,b.index+1),_=t.slice(R.startIndex+2,b.index),j=Bl(_,r);if((R.type==="plus"||R.type==="star")&&j.risky){let k=j.safeOutput?(R.output?"":y)+(r.capture?`(${j.safeOutput})`:j.safeOutput):void 0,I=s[R.tokensIndex];I.type="text",I.value=J,I.output=k||ue.escapeRegex(J);for(let U=R.tokensIndex+1;U<s.length;U++)s[U].value="",s[U].output="",delete s[U].suffix;b.output=R.output+I.output,b.backtrack=!0,H({type:"paren",extglob:!0,value:w,output:""}),le("parens");return}let m=R.close+(r.capture?")":""),A;if(R.type==="negate"){let k=$;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(k=M(r)),(k!==$||te()||/^\)+$/.test(Z()))&&(m=R.close=`)$))${k}`),R.inner.includes("*")&&(A=Z())&&/^\.[^\\/.]+$/.test(A)){let I=Gr(A,{...e,fastpaths:!1}).output;m=R.close=`)${I})${k})`}R.prev.type==="bos"&&(b.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:w,output:m}),le("parens")},"extglobClose");if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let R=!1,J=t.replace(Fl,(_,j,m,A,k,I)=>A==="\\"?(R=!0,_):A==="?"?j?j+A+(k?x.repeat(k.length):""):I===0?N+(k?x.repeat(k.length):""):x.repeat(m.length):A==="."?p.repeat(m.length):A==="*"?j?j+A+(k?$:""):$:j?_:`\\${_}`);return R===!0&&(r.unescape===!0?J=J.replace(/\\/g,""):J=J.replace(/\\+/g,_=>_.length%2===0?"\\\\":_?"\\":"")),J===t&&r.contains===!0?(b.output=t,b):(b.output=ue.wrapOutput(J,b,e),b)}for(;!te();){if(w=Q(),w==="\0")continue;if(w==="\\"){let _=B();if(_==="/"&&r.bash!==!0||_==="."||_===";")continue;if(!_){w+="\\",H({type:"text",value:w});continue}let j=/^\\+/.exec(Z()),m=0;if(j&&j[0].length>2&&(m=j[0].length,b.index+=m,m%2!==0&&(w+="\\")),r.unescape===!0?w=Q():w+=Q(),b.brackets===0){H({type:"text",value:w});continue}}if(b.brackets>0&&(w!=="]"||E.value==="["||E.value==="[^")){if(r.posix!==!1&&w===":"){let _=E.value.slice(1);if(_.includes("[")&&(E.posix=!0,_.includes(":"))){let j=E.value.lastIndexOf("["),m=E.value.slice(0,j),A=E.value.slice(j+2),k=$l[A];if(k){E.value=m+k,b.backtrack=!0,Q(),!i.output&&s.indexOf(E)===1&&(i.output=y);continue}}}(w==="["&&B()!==":"||w==="-"&&B()==="]")&&(w=`\\${w}`),w==="]"&&(E.value==="["||E.value==="[^")&&(w=`\\${w}`),r.posix===!0&&w==="!"&&E.value==="["&&(w="^"),E.value+=w,Se({value:w});continue}if(b.quotes===1&&w!=='"'){w=ue.escapeRegex(w),E.value+=w,Se({value:w});continue}if(w==='"'){b.quotes=b.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:w});continue}if(w==="("){be("parens"),H({type:"paren",value:w});continue}if(w===")"){if(b.parens===0&&r.strictBrackets===!0)throw new SyntaxError(nt("opening","("));let _=z[z.length-1];if(_&&b.parens===_.parens+1){ur(z.pop());continue}H({type:"paren",value:w,output:b.parens?")":"\\)"}),le("parens");continue}if(w==="["){if(r.nobracket===!0||!Z().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(nt("closing","]"));w=`\\${w}`}else be("brackets");H({type:"bracket",value:w});continue}if(w==="]"){if(r.nobracket===!0||E&&E.type==="bracket"&&E.value.length===1){H({type:"text",value:w,output:`\\${w}`});continue}if(b.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(nt("opening","["));H({type:"text",value:w,output:`\\${w}`});continue}le("brackets");let _=E.value.slice(1);if(E.posix!==!0&&_[0]==="^"&&!_.includes("/")&&(w=`/${w}`),E.value+=w,Se({value:w}),r.literalBrackets===!1||ue.hasRegexChars(_))continue;let j=ue.escapeRegex(E.value);if(b.output=b.output.slice(0,-E.value.length),r.literalBrackets===!0){b.output+=j,E.value=j;continue}E.value=`(${c}${j}|${E.value})`,b.output+=E.value;continue}if(w==="{"&&r.nobrace!==!0){be("braces");let _={type:"brace",value:w,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};F.push(_),H(_);continue}if(w==="}"){let _=F[F.length-1];if(r.nobrace===!0||!_){H({type:"text",value:w,output:w});continue}let j=")";if(_.dots===!0){let m=s.slice(),A=[];for(let k=m.length-1;k>=0&&(s.pop(),m[k].type!=="brace");k--)m[k].type!=="dots"&&A.unshift(m[k].value);j=Dl(A,r),b.backtrack=!0}if(_.comma!==!0&&_.dots!==!0){let m=b.output.slice(0,_.outputIndex),A=b.tokens.slice(_.tokensIndex);_.value=_.output="\\{",w=j="\\}",b.output=m;for(let k of A)b.output+=k.output||k.value}H({type:"brace",value:w,output:j}),le("braces"),F.pop();continue}if(w==="|"){z.length>0&&z[z.length-1].conditions++,H({type:"text",value:w});continue}if(w===","){let _=w,j=F[F.length-1];j&&D[D.length-1]==="braces"&&(j.comma=!0,_="|"),H({type:"comma",value:w,output:_});continue}if(w==="/"){if(E.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",s.pop(),E=i;continue}H({type:"slash",value:w,output:f});continue}if(w==="."){if(b.braces>0&&E.type==="dot"){E.value==="."&&(E.output=p);let _=F[F.length-1];E.type="dots",E.output+=w,E.value+=w,_.dots=!0;continue}if(b.braces+b.parens===0&&E.type!=="bos"&&E.type!=="slash"){H({type:"text",value:w,output:p});continue}H({type:"dot",value:w,output:p});continue}if(w==="?"){if(!(E&&E.value==="(")&&r.noextglob!==!0&&B()==="("&&B(2)!=="?"){Be("qmark",w);continue}if(E&&E.type==="paren"){let j=B(),m=w;(E.value==="("&&!/[!=<:]/.test(j)||j==="<"&&!/<([!=]|\w+>)/.test(Z()))&&(m=`\\${w}`),H({type:"text",value:w,output:m});continue}if(r.dot!==!0&&(E.type==="slash"||E.type==="bos")){H({type:"qmark",value:w,output:C});continue}H({type:"qmark",value:w,output:x});continue}if(w==="!"){if(r.noextglob!==!0&&B()==="("&&(B(2)!=="?"||!/[!=<:]/.test(B(3)))){Be("negate",w);continue}if(r.nonegate!==!0&&b.index===0){Oe();continue}}if(w==="+"){if(r.noextglob!==!0&&B()==="("&&B(2)!=="?"){Be("plus",w);continue}if(E&&E.value==="("||r.regex===!1){H({type:"plus",value:w,output:d});continue}if(E&&(E.type==="bracket"||E.type==="paren"||E.type==="brace")||b.parens>0){H({type:"plus",value:w});continue}H({type:"plus",value:d});continue}if(w==="@"){if(r.noextglob!==!0&&B()==="("&&B(2)!=="?"){H({type:"at",extglob:!0,value:w,output:""});continue}H({type:"text",value:w});continue}if(w!=="*"){(w==="$"||w==="^")&&(w=`\\${w}`);let _=Ll.exec(Z());_&&(w+=_[0],b.index+=_[0].length),H({type:"text",value:w});continue}if(E&&(E.type==="globstar"||E.star===!0)){E.type="star",E.star=!0,E.value+=w,E.output=$,b.backtrack=!0,b.globstar=!0,X(w);continue}let R=Z();if(r.noextglob!==!0&&/^\([^?]/.test(R)){Be("star",w);continue}if(E.type==="star"){if(r.noglobstar===!0){X(w);continue}let _=E.prev,j=_.prev,m=_.type==="slash"||_.type==="bos",A=j&&(j.type==="star"||j.type==="globstar");if(r.bash===!0&&(!m||R[0]&&R[0]!=="/")){H({type:"star",value:w,output:""});continue}let k=b.braces>0&&(_.type==="comma"||_.type==="brace"),I=z.length&&(_.type==="pipe"||_.type==="paren");if(!m&&_.type!=="paren"&&!k&&!I){H({type:"star",value:w,output:""});continue}for(;R.slice(0,3)==="/**";){let q=t[b.index+4];if(q&&q!=="/")break;R=R.slice(3),X("/**",3)}let U=te()||b.parens>0&&R===")".repeat(b.parens)&&!z.some(q=>q.type==="negate");if(_.type==="bos"&&te()){E.type="globstar",E.value+=w,E.output=M(r),b.output=E.output,b.globstar=!0,X(w);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&!A&&U){b.output=b.output.slice(0,-(_.output+E.output).length),_.output=`(?:${_.output}`,E.type="globstar",E.output=M(r)+(r.strictSlashes?")":"|$)"),E.value+=w,b.globstar=!0,b.output+=_.output+E.output,X(w);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&R[0]==="/"){let q=R[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(_.output+E.output).length),_.output=`(?:${_.output}`,E.type="globstar",E.output=`${M(r)}${f}|${f}${q})`,E.value+=w,b.output+=_.output+E.output,b.globstar=!0,X(w+Q()),H({type:"slash",value:"/",output:""});continue}if(_.type==="bos"&&R[0]==="/"){E.type="globstar",E.value+=w,E.output=`(?:^|${f}|${M(r)}${f})`,b.output=E.output,b.globstar=!0,X(w+Q()),H({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-E.output.length),E.type="globstar",E.output=M(r),E.value+=w,b.output+=E.output,b.globstar=!0,X(w);continue}let J={type:"star",value:w,output:$};if(r.bash===!0){J.output=".*?",(E.type==="bos"||E.type==="slash")&&(J.output=W+J.output),H(J);continue}if(E&&(E.type==="bracket"||E.type==="paren")&&r.regex===!0){J.output=w,H(J);continue}(b.index===b.start||E.type==="slash"||E.type==="dot")&&(E.type==="dot"?(b.output+=v,E.output+=v):r.dot===!0?(b.output+=S,E.output+=S):(b.output+=W,E.output+=W),B()!=="*"&&(b.output+=y,E.output+=y)),H(J)}for(;b.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing","]"));b.output=ue.escapeLast(b.output,"["),le("brackets")}for(;b.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing",")"));b.output=ue.escapeLast(b.output,"("),le("parens")}for(;b.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing","}"));b.output=ue.escapeLast(b.output,"{"),le("braces")}if(r.strictSlashes!==!0&&(E.type==="star"||E.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${f}?`}),b.backtrack===!0){b.output="";for(let R of b.tokens)b.output+=R.output!=null?R.output:R.value,R.suffix&&(b.output+=R.suffix)}return b},"parse");Gr.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(tr,r.maxLength):tr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=Zo[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:c,DOTS_SLASH:a,NO_DOT:u,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:y}=xt.globChars(r.windows),g=r.dot?p:u,h=r.dot?d:u,v=r.capture?"":"?:",S={negated:!1,prefix:""},x=r.bash===!0?".*?":f;r.capture&&(x=`(${x})`);let C=l(W=>W.noglobstar===!0?x:`(${v}(?:(?!${y}${W.dot?a:i}).)*?)`,"globstar"),T=l(W=>{switch(W){case"*":return`${g}${c}${x}`;case".*":return`${i}${c}${x}`;case"*.*":return`${g}${x}${i}${c}${x}`;case"*/*":return`${g}${x}${s}${c}${h}${x}`;case"**":return g+C(r);case"**/*":return`(?:${g}${C(r)}${s})?${h}${c}${x}`;case"**/*.*":return`(?:${g}${C(r)}${s})?${h}${x}${i}${c}${x}`;case"**/.*":return`(?:${g}${C(r)}${s})?${i}${c}${x}`;default:{let N=/^(.*?)\.(\w+)$/.exec(W);if(!N)return;let $=T(N[1]);return $?$+i+N[2]:void 0}}},"create"),L=ue.removePrefix(t,S),M=T(L);return M&&r.strictSlashes!==!0&&(M+=`${s}?`),M};ts.exports=Gr});var ss=Je((ld,os)=>{"use strict";var Jl=Qo(),Xr=rs(),ns=wt(),Kl=Et(),Gl=l(t=>t&&typeof t=="object"&&!Array.isArray(t),"isObject"),Y=l((t,e,r=!1)=>{if(Array.isArray(t)){let p=t.map(f=>Y(f,e,r));return l(f=>{for(let y of p){let g=y(f);if(g)return g}return!1},"arrayMatcher")}let n=Gl(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,d=!1)=>{let{isMatch:f,match:y,output:g}=Y.test(p,s,e,{glob:t,posix:i}),h={glob:t,state:c,regex:s,posix:i,input:p,output:g,match:y,isMatch:f};return typeof o.onResult=="function"&&o.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):a(p)?(typeof o.onIgnore=="function"&&o.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof o.onMatch=="function"&&o.onMatch(h),d?h:!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?ns.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(ns.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)):Xr(t,{...e,fastpaths:!1});Y.scan=(t,e)=>Jl(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=Xr.fastpaths(t,e)),o.output||(o=Xr(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=Kl;os.exports=Y});var cs=Je((ud,ls)=>{"use strict";var is=ss(),Xl=wt();function as(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Xl.isWindows()}),is(t,e,r)}l(as,"picomatch");Object.assign(as,is);ls.exports=as});function zl(t){return Array.isArray(t)}function us(t){return zl(t)?t:t==null?[]:[t]}function Yl(t,e){if(e===!1||(0,Ae.isAbsolute)(t)||t.startsWith("**"))return rr(t);let r=rr((0,Ae.resolve)(e||"")).replace(/[-^$*+?.()|[\]{}]/g,"\\$&");return Ae.posix.join(r,rr(t))}var Ae,ps,ql,rr,zr,Ql,Zl,ec,md,ds=O(()=>{Ae=require("path");Ho();ps=dr(cs(),1);l(zl,"isArray");l(us,"ensureArray");ql=new RegExp(`\\${Ae.win32.sep}`,"g"),rr=l(function(e){return e.replace(ql,Ae.posix.sep)},"normalizePath");l(Yl,"getMatcherString");zr=l(function(e,r,n){let o=n&&n.resolve,i=l(a=>a instanceof RegExp?a:{test:l(u=>{let p=Yl(a,o);return(0,ps.default)(p,{dot:!0})(u)},"test")},"getMatcher"),s=us(e).map(i),c=us(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=rr(u);for(let d=0;d<c.length;++d){let f=c[d];if(f instanceof RegExp&&(f.lastIndex=0),f.test(p))return!1}for(let d=0;d<s.length;++d){let f=s[d];if(f instanceof RegExp&&(f.lastIndex=0),f.test(p))return!0}return!s.length},"result")},"createFilter"),Ql="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",Zl="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",ec=new Set(`${Ql} ${Zl}`.split(" "));ec.add("");md="isWellFormed"in String.prototype});var Ct,fs=O(()=>{"use strict";Ct="tempo-interact-preview"});function qr(t){switch(t.type){case"JSXIdentifier":return t.name;case"JSXNamespacedName":return`${t.namespace.name}:${t.name.name}`;case"JSXMemberExpression":return ms(t)}}function ms(t){return`${t.object.type==="JSXIdentifier"?t.object.name:ms(t.object)}.${t.property.name}`}var gs=O(()=>{"use strict";l(qr,"getTagName");l(ms,"getJSXMemberExpressionName")});function nr(t,e,r=null){if(t==null||typeof t!="object")return;if(Array.isArray(t)){for(let s of t)nr(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"&&nr(s,e,i)}var ys,hs,Ed,Ss=O(()=>{"use strict";ys=dr(require("oxc-parser/src-js/generated/visit/keys.js"),1),hs=ys.default,Ed=hs.default??hs;l(nr,"walk")});function rc(t){let e=tc.exec(t);if(e)return e[1].toLowerCase()==="c"?{lang:"jsx",sourceType:"commonjs"}:{lang:"jsx"}}function bs(t,e){return(0,vs.parseSync)(t,e,rc(t))}var vs,tc,Es=O(()=>{"use strict";vs=require("oxc-parser"),tc=/\.([cm]?)js$/i;l(rc,"sourceParseOptions");l(bs,"parseSourceFile")});function nc(t){return t===void 0?null:typeof t=="function"?t.toString():JSON.stringify(t)}function oc(t){return Object.entries(t).map(([e,r])=>{let n=nc(r);return n===null?null:` ${e}={${n}}`}).filter(e=>e!==null).join("")}function sc(t){let e=new Set;for(let r of t.openingElement.attributes??[])r.type==="JSXAttribute"&&e.add(qr(r.name));return e}function ic(t,e){return Object.fromEntries(Object.entries(t).filter(([r])=>!e.has(r)))}function ws(t,e,r){let n=bs(e,t),o=[],i=new WeakSet,s=l(u=>{for(let p of u.children){let d=mr(p);d&&i.add(d)}},"noteChildren");nr(n.program,{JSXFragment(u){s(u)},JSXElement(u,p){let d=u;s(d);let f=qr(d.openingElement.name);if(ac.has(f))return;let y=p?.type??null,g=ic(r({element:d,tagName:f,parentType:y,...i.has(d)?{isStaticJsxChild:!0}:{}}),sc(d));if(Object.keys(g).length===0)return;let h=d.openingElement,v=h.end-1;if(h.selfClosing)for(v--;v>h.start&&/\s/.test(t[v-1]);)v--;o.push({position:v,text:oc(g)})}}),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 ac,xs=O(()=>{"use strict";gs();Ss();Mt();Es();l(nc,"formatPropValue");l(oc,"formatProps");l(sc,"getExistingAttributeNames");l(ic,"removeExistingProps");ac=new Set(["Fragment","React.Fragment"]);l(ws,"annotateFile")});var lc,Yr=O(()=>{"use strict";lc=Object.freeze({$unresolved:!0})});function cc(t){let e=(0,_s.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 uc(t,e){try{if(t.endsWith(".astro"))return{program:cc(e).frontmatter?.program??{type:"Program",body:[]},errors:[]};let r=(0,As.parseSync)(t,e),n=(r.errors??[]).map(o=>({code:"unparseable_source",severity:"structural",message:o?.message??"Unable to parse asset source",span:_t(o)??_t(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 pc(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=_t(r);if(n&&e.importDeclarationSpans.push(n),r.importKind==="type")continue;let o=r.source.value,i=Ts(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):dc(o)&&e.misimports.push({source:o,span:_t(r.source)??n??{start:0,end:0}}))}}return e}function Rs(t,e,r=uc(t,e)){let{program:n}=r,o=pc(n),i=n?fc(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),d=i?.bindings.get(u);return!p&&!d?[]:[{bindingName:u,reference:p,exportKind:p?.importedName==="default"?"default":d?.exportKind??"named",start:a.start,end:a.end}]})}function Ts(t){return t===Cs||t.endsWith(`/${Cs}`)}function dc(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Ts(t)}function fc(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 d=p.id.name;p.init?(e.set(d,{name:d,statementSpan:c,exportKind:"none"}),u(d)):r.add(d)}else At(p?.id,r)},"register");for(let s of t?.body??[]){let c=_t(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=mc(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 At(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??[])At(r?.value??r?.argument,e);return}if(t.type==="ArrayPattern"){for(let r of t.elements??[])At(r,e);return}if(t.type==="AssignmentPattern"){At(t.left,e);return}t.type==="RestElement"&&At(t.argument,e)}}function mc(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function _t(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 As,_s,Cs,ks=O(()=>{As=require("oxc-parser"),_s=require("node:module");Yr();Yr();l(cc,"parseAstroAssetSource");Cs="tempo-sdk/assets";l(uc,"parseAssetProgram");l(pc,"readAssetImports");l(Rs,"parseControlsFile");l(Ts,"isTrustedAssetImportSource");l(dc,"isMisimportedAssetSdkSource");l(fc,"collectTopLevelScope");l(At,"collectPatternNames");l(mc,"unwrapTsExpression");l(_t,"toSourceSpan")});function Is(t,e,r=!1){let n=t.includes("defineControls")?Rs(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,24 +128,24 @@ if (import.meta.hot) {
128
128
  import.meta.hot.data.__tempoControlsDisposers = [];
129
129
  });
130
130
  }
131
- ${t}`}var Ps=O(()=>{Ts();c(Is,"transformControlsForHmr")});function _t(t){let e=Ve.default.resolve(t);try{return or.realpathSync.native(e)}catch(r){let n=r.code;if(n!=="ENOENT"&&n!=="ENOTDIR")throw r;let o=!1;try{o=(0,or.lstatSync)(e).isSymbolicLink()}catch(s){if(s.code!=="ENOENT"&&s.code!=="ENOTDIR")throw s}if(o)throw r;let i=Ve.default.dirname(e);if(i===e)throw r;return Ve.default.join(_t(i),Ve.default.basename(e))}}function Ns(t,e,r){return`${Ve.default.relative(_t(t),_t(e)).split(Ve.default.sep).join("/")}#${r}`}var or,Ve,Ms=O(()=>{Ft();or=require("node:fs"),Ve=dr(require("node:path"),1);c(_t,"canonicalPathAllowMissing");c(Ns,"flutterPreviewKey")});function cc(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(/[?#]/),l=(s<0?i:i.slice(0,s)).replace(/\\/g,"/"),a=s<0||i.endsWith(".astro?tempo-component")?"":i.slice(s);if(o===void 0&&l.startsWith(".")&&(l=(0,pe.resolve)((0,pe.dirname)(t),l)),!(0,pe.isAbsolute)(l)&&!/^[A-Za-z]:\//.test(l))return i;if(o!==void 0)try{l=$s.realpathSync.native(l)}catch{}return(0,pe.normalize)(l).replace(/\\/g,"/")+a}function Ls(t,e,r,n){let o=new Map;if(!e.includes("tempo-sdk/canvas"))return o;let i=Ye(t,e);for(let s of i.storyboards){if(s.kind!=="component"||s.openingElementSpan===void 0)continue;let l=s.preview?dt(s.preview):null;if(l&&!("error"in l)&&n){let g;try{let y=(0,pe.resolve)((0,pe.dirname)(_t(t)),l.file);g=Ns(n,y,l.functionName)}catch{continue}o.set(s.openingElementSpan.start,{[kn]:g,[Os]:JSON.stringify(["flutter",g.slice(0,g.lastIndexOf("#")),l.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 d=a.import?.source.replace(/\\/g,"/").replace(/[?#].*/,""),f=pe.posix.dirname(t.replace(/\\/g,"/")),h=d!==void 0&&(!d.startsWith(".")||!pe.posix.join(f,d).startsWith(`${f}/`));o.set(s.openingElementSpan.start,{[Os]:JSON.stringify([a.import?"import":"local",cc(t,a.import?.source??t,r),p]),...h?{"data-tempo-external-component":"true"}:{}})}return o}var $s,pe,Os,Fs=O(()=>{$s=require("node:fs"),pe=require("node:path");Ft();Ms();Wt();Os="data-tempo-component-reference";c(cc,"moduleIdentity");c(Ls,"canvasComponentAnnotations")});function Qr(t){let e=/\bexport\s+default\s+/.exec(t);if(!e)return null;let r=t.slice(e.index+e[0].length),n=uc.exec(r);if(n)return{kind:"function",name:n[1]??null};let o=pc.exec(r);if(o)return{kind:"class",name:o[1]??null};if(dc.test(r))return{kind:"function",name:null};let i=fc.exec(r);return i?{kind:"identifier",name:i[1]}:null}function Hs(t,e){return t?t.name===null?!0:!e||t.name===e.name?!1:Ds(t)&&Ds(e):!1}function Ds(t){return t.name===null||/^[A-Z]/.test(t.name)}var uc,pc,dc,fc,js=O(()=>{uc=/^(?:async\s+)?function(?:\s*\*)?(?:\s+([A-Za-z_$][\w$]*))?\s*\(/,pc=/^(?:abstract\s+)?class(?:\s+([A-Za-z_$][\w$]*))?(?=[\s{])/,dc=/^(?:async\s+)?(?:\([^()]*\)|[A-Za-z_$][\w$]*)\s*=>/,fc=/^([A-Za-z_$][\w$]*)[ \t]*(?:;|\r?\n|$)/;c(Qr,"readDefaultExportIdentity");c(Hs,"isDefaultExportIdentityRewrite");c(Ds,"isComponentShaped")});function Vs(t){let e=new Set;function r(l,a){let u=Is(l,a,e.has(a));return u!==l&&e.add(a),u}c(r,"transformControls");let n=new Map,o=c(l=>{let a=me(l);try{return ie.realpathSync.native(a)}catch{return a.replace(/\\/g,"/")}},"canonicalIdentityKey");async function i(l,a,u){let p=t.transformsControls(u)?r(a,u):a,d=t.stampedFilepath(u);if(d===null)return p!==a?{code:p,map:null}:null;try{let f=(0,ie.openSync)(u,"r"),h;try{let F=(0,ie.fstatSync)(f),D=(0,ie.readFileSync)(f,"utf8");h={before:F,rawSource:D,after:(0,ie.fstatSync)(f)}}finally{(0,ie.closeSync)(f)}let{before:g,after:y,rawSource:x}=h,S=["mtimeMs","ctimeMs","size","ino","dev"],w=a===x?a:void 0;if(w===void 0&&typeof l.getCombinedSourcemap=="function")try{let F=l.getCombinedSourcemap(),D=F.sourceRoot,b=F.sources.flatMap((E,te)=>{let B=E.startsWith("file:")?(0,Us.fileURLToPath)(E):E,Q=(0,ot.isAbsolute)(B)?B:(0,ot.resolve)((0,ot.dirname)(u),typeof D=="string"?D:"",B),Z=tt(Q).replace(/\\/g,"/")===u.replace(/\\/g,"/");if(!Z)try{Z=ie.realpathSync.native(Q)===ie.realpathSync.native(u)}catch{}return Z&&typeof F.sourcesContent?.[te]=="string"?[F.sourcesContent[te]]:[]});b.length===1&&(w=b[0])}catch{}let C=w===x&&S.every(F=>g[F]===y[F]),k=C?Math.trunc(g.mtimeMs):0,L=C?ke(x):"",M=o(u);n.has(M)||n.set(M,Qr(x));let W=new Map;if(a.includes("tempo-sdk/canvas")&&typeof l.resolve=="function"){let F=Ye(u,a).storyboards.flatMap(D=>D.component?.import?.source??[]);await Promise.all([...new Set(F)].map(async D=>{let b=await l.resolve(D,u,{skipSelf:!0});b&&W.set(D,b.id)}))}let P=Ls(u,a,W,t.flutterHostRoot?.()),$=ws(a,u,F=>{let D={...P.get(F.element.openingElement.start),...fo({info:F,filepath:d,modifiedtsMs:k,sourceVersion:L,computeAnnotatedProps:t.computeAnnotatedProps})};return C||(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-modifiedts"],delete D["data-tempo-source-version"]),D});if($.parseResult.errors.length>0)return null;let v=$.elementsAnnotated===0?a:$.annotatedSource,z=t.transformsControls(u)?r(v,u):v;return{code:C?po(z,d,k,L):z,map:null}}catch{return null}}c(i,"annotateJsxModule");async function s(l){let{file:a}=l,u=o(a);if(!n.has(u))return!1;let p;try{p=(0,ie.readFileSync)(a,"utf8"),p.length===0&&(p=await l.read())}catch{return!1}let d=n.get(u);if(d===void 0)return!1;let f=Qr(p);return n.set(u,f),Hs(d,f)}return c(s,"defaultExportIdentityRewritten"),{annotateJsxModule:i,defaultExportIdentityRewritten:s,forgetDefaultExportIdentity(l){n.delete(o(l))}}}var ie,ot,Us,Ws=O(()=>{ie=require("node:fs"),ot=require("node:path"),Us=require("node:url");xs();Je();Yt();Ps();Fs();Wt();js();yt();c(Vs,"createJsxModuleAnnotation")});function Bs(){let t=0,e=0,r=new WeakMap;return{observePrune(n,o){let i=++t;for(let s of o){let l=n.urlToModuleMap.get(s);l&&(r.has(l)||e++,r.set(l,i))}},observeRequest(n,o,i,s,l){if(!e||["document","iframe","frame"].includes(String(s)))return;let a=t;return async(u,p,d)=>{if(!e||u<200||u>=400||u!==304&&!/^text\/(?:javascript|css)(?:;|$)/i.test(String(p)))return;let f=u===304?l:d;if(typeof f!="string"||!n.getModuleByEtag(f))return;let h=o;i!=="/"&&h.startsWith(i)&&(h=`/${h.slice(i.length)}`);try{h=decodeURI(h).replace(/__x00__/g,"\0"),h.startsWith("/@id/")&&(h=h.slice(5));let[,g]=await n.resolveUrl(h),y=n.getModuleById(g);y&&y.transformResult?.etag===f&&(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 Js=O(()=>{c(Bs,"createPrunedModuleDeletionGuard")});function ei(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 ti(t){let e=t.intervalMs??3e3,r=new URL(mc,t.target.origin),n=null,o=!1,i=null;async function s(){try{let l=await fetch(r,{signal:AbortSignal.timeout(e)}),a=l.ok?await l.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 c(s,"poll"),s(),()=>{o=!0,i&&clearTimeout(i)}}function Gs(t){let e=t.slice(Zr.length);return e.startsWith("/")?e:`/${e}`}function Xs(t){if(!t.startsWith(Zr))return!1;let e=t.charAt(Zr.length);return e===""||e==="/"||e==="?"}function ri(t){let{target:e,config:r}=t,n=gc(r),o=!0;function i(){o||(o=!0,r.logger.info(`[tempo] Flutter dev server reachable at ${e.origin}`))}c(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`))}c(s,"noteUnreachable");function l(u,p,d){let f=(0,qs.request)({hostname:e.hostname,port:e.port,method:u.method,path:d,headers:{...zs(u.headers),host:e.host}},h=>{i(),p.writeHead(h.statusCode??502,h.statusMessage,zs(h.headers)),(0,Qs.pipeline)(h,p,()=>{})});f.on("error",h=>{if(p.headersSent||p.destroyed){p.destroy();return}s(h),p.writeHead(502,{"content-type":"application/json"}),p.end(JSON.stringify(Ks))}),p.on("close",()=>{p.writableFinished||f.destroy()}),u.pipe(f)}c(l,"forward");function a(u,p,d,f){let h=!1,g=(0,Ys.connect)({host:e.hostname,port:Number(e.port)||80},()=>{h=!0,i(),g.write(hc(u,f,e.host)),d.length>0&&g.write(d),g.pipe(p),p.pipe(g)});g.on("error",y=>{if(h){p.destroy();return}s(y);let x=JSON.stringify(Ks);p.end(`HTTP/1.1 502 Bad Gateway\r
131
+ ${t}`}var Ps=O(()=>{ks();l(Is,"transformControlsForHmr")});function Rt(t){let e=We.default.resolve(t);try{return or.realpathSync.native(e)}catch(r){let n=r.code;if(n!=="ENOENT"&&n!=="ENOTDIR")throw r;let o=!1;try{o=(0,or.lstatSync)(e).isSymbolicLink()}catch(s){if(s.code!=="ENOENT"&&s.code!=="ENOTDIR")throw s}if(o)throw r;let i=We.default.dirname(e);if(i===e)throw r;return We.default.join(Rt(i),We.default.basename(e))}}function Ns(t,e,r){return`${We.default.relative(Rt(t),Rt(e)).split(We.default.sep).join("/")}#${r}`}var or,We,Ms=O(()=>{Dt();or=require("node:fs"),We=dr(require("node:path"),1);l(Rt,"canonicalPathAllowMissing");l(Ns,"flutterPreviewKey")});function gc(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=$s.realpathSync.native(c)}catch{}return(0,pe.normalize)(c).replace(/\\/g,"/")+a}function Ls(t,e,r,n){let o=new Map;if(!e.includes("tempo-sdk/canvas"))return o;let i=Qe(t,e);for(let s of i.storyboards){if(s.kind!=="component"||s.openingElementSpan===void 0)continue;let c=s.preview?dt(s.preview):null;if(c&&!("error"in c)&&n){let g;try{let h=(0,pe.resolve)((0,pe.dirname)(Rt(t)),c.file);g=Ns(n,h,c.functionName)}catch{continue}o.set(s.openingElementSpan.start,{[Tn]:g,[Os]:JSON.stringify(["flutter",g.slice(0,g.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 d=a.import?.source.replace(/\\/g,"/").replace(/[?#].*/,""),f=pe.posix.dirname(t.replace(/\\/g,"/")),y=d!==void 0&&(!d.startsWith(".")||!pe.posix.join(f,d).startsWith(`${f}/`));o.set(s.openingElementSpan.start,{[Os]:JSON.stringify([a.import?"import":"local",gc(t,a.import?.source??t,r),p]),...y?{"data-tempo-external-component":"true"}:{}})}return o}var $s,pe,Os,Fs=O(()=>{$s=require("node:fs"),pe=require("node:path");Dt();Ms();Wt();Os="data-tempo-component-reference";l(gc,"moduleIdentity");l(Ls,"canvasComponentAnnotations")});function Qr(t){let e=/\bexport\s+default\s+/.exec(t);if(!e)return null;let r=t.slice(e.index+e[0].length),n=hc.exec(r);if(n)return{kind:"function",name:n[1]??null};let o=yc.exec(r);if(o)return{kind:"class",name:o[1]??null};if(Sc.test(r))return{kind:"function",name:null};let i=vc.exec(r);return i?{kind:"identifier",name:i[1]}:null}function Hs(t,e){return t?t.name===null?!0:!e||t.name===e.name?!1:Ds(t)&&Ds(e):!1}function Ds(t){return t.name===null||/^[A-Z]/.test(t.name)}var hc,yc,Sc,vc,js=O(()=>{hc=/^(?:async\s+)?function(?:\s*\*)?(?:\s+([A-Za-z_$][\w$]*))?\s*\(/,yc=/^(?:abstract\s+)?class(?:\s+([A-Za-z_$][\w$]*))?(?=[\s{])/,Sc=/^(?:async\s+)?(?:\([^()]*\)|[A-Za-z_$][\w$]*)\s*=>/,vc=/^([A-Za-z_$][\w$]*)[ \t]*(?:;|\r?\n|$)/;l(Qr,"readDefaultExportIdentity");l(Hs,"isDefaultExportIdentityRewrite");l(Ds,"isComponentShaped")});function Vs(t){let e=new Set;function r(c,a){let u=Is(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 ie.realpathSync.native(a)}catch{return a.replace(/\\/g,"/")}},"canonicalIdentityKey");async function i(c,a,u){let p=t.transformsControls(u)?r(a,u):a,d=t.stampedFilepath(u);if(d===null)return p!==a?{code:p,map:null}:null;try{let f=(0,ie.openSync)(u,"r"),y;try{let F=(0,ie.fstatSync)(f),D=(0,ie.readFileSync)(f,"utf8");y={before:F,rawSource:D,after:(0,ie.fstatSync)(f)}}finally{(0,ie.closeSync)(f)}let{before:g,after:h,rawSource:v}=y,S=["mtimeMs","ctimeMs","size","ino","dev"],x=a===v?a:void 0;if(x===void 0&&typeof c.getCombinedSourcemap=="function")try{let F=c.getCombinedSourcemap(),D=F.sourceRoot,E=F.sources.flatMap((w,te)=>{let B=w.startsWith("file:")?(0,Us.fileURLToPath)(w):w,Q=(0,ot.isAbsolute)(B)?B:(0,ot.resolve)((0,ot.dirname)(u),typeof D=="string"?D:"",B),Z=tt(Q).replace(/\\/g,"/")===u.replace(/\\/g,"/");if(!Z)try{Z=ie.realpathSync.native(Q)===ie.realpathSync.native(u)}catch{}return Z&&typeof F.sourcesContent?.[te]=="string"?[F.sourcesContent[te]]:[]});E.length===1&&(x=E[0])}catch{}let C=x===v&&S.every(F=>g[F]===h[F]),T=C?Math.trunc(g.mtimeMs):0,L=C?Te(v):"",M=o(u);n.has(M)||n.set(M,Qr(v));let W=new Map;if(a.includes("tempo-sdk/canvas")&&typeof c.resolve=="function"){let F=Qe(u,a).storyboards.flatMap(D=>D.component?.import?.source??[]);await Promise.all([...new Set(F)].map(async D=>{let E=await c.resolve(D,u,{skipSelf:!0});E&&W.set(D,E.id)}))}let N=Ls(u,a,W,t.flutterHostRoot?.()),$=ws(a,u,F=>{let D={...N.get(F.element.openingElement.start),...fo({info:F,filepath:d,modifiedtsMs:T,sourceVersion:L,computeAnnotatedProps:t.computeAnnotatedProps})};return C||(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-modifiedts"],delete D["data-tempo-source-version"]),D});if($.parseResult.errors.length>0)return null;let b=$.elementsAnnotated===0?a:$.annotatedSource,z=t.transformsControls(u)?r(b,u):b;return{code:C?po(z,d,T,L):z,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,ie.readFileSync)(a,"utf8"),p.length===0&&(p=await c.read())}catch{return!1}let d=n.get(u);if(d===void 0)return!1;let f=Qr(p);return n.set(u,f),Hs(d,f)}return l(s,"defaultExportIdentityRewritten"),{annotateJsxModule:i,defaultExportIdentityRewritten:s,forgetDefaultExportIdentity(c){n.delete(o(c))}}}var ie,ot,Us,Ws=O(()=>{ie=require("node:fs"),ot=require("node:path"),Us=require("node:url");xs();Ke();Yt();Ps();Fs();Wt();js();St();l(Vs,"createJsxModuleAnnotation")});function Bs(){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,d)=>{if(!e||u<200||u>=400||u!==304&&!/^text\/(?:javascript|css)(?:;|$)/i.test(String(p)))return;let f=u===304?c:d;if(typeof f!="string"||!n.getModuleByEtag(f))return;let y=o;i!=="/"&&y.startsWith(i)&&(y=`/${y.slice(i.length)}`);try{y=decodeURI(y).replace(/__x00__/g,"\0"),y.startsWith("/@id/")&&(y=y.slice(5));let[,g]=await n.resolveUrl(y),h=n.getModuleById(g);h&&h.transformResult?.etag===f&&(r.get(h)??1/0)<=a&&(r.delete(h),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 Js=O(()=>{l(Bs,"createPrunedModuleDeletionGuard")});function ei(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 ti(t){let e=t.intervalMs??3e3,r=new URL(bc,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 Gs(t){let e=t.slice(Zr.length);return e.startsWith("/")?e:`/${e}`}function Xs(t){if(!t.startsWith(Zr))return!1;let e=t.charAt(Zr.length);return e===""||e==="/"||e==="?"}function ri(t){let{target:e,config:r}=t,n=Ec(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,d){let f=(0,qs.request)({hostname:e.hostname,port:e.port,method:u.method,path:d,headers:{...zs(u.headers),host:e.host}},y=>{i(),p.writeHead(y.statusCode??502,y.statusMessage,zs(y.headers)),(0,Qs.pipeline)(y,p,()=>{})});f.on("error",y=>{if(p.headersSent||p.destroyed){p.destroy();return}s(y),p.writeHead(502,{"content-type":"application/json"}),p.end(JSON.stringify(Ks))}),p.on("close",()=>{p.writableFinished||f.destroy()}),u.pipe(f)}l(c,"forward");function a(u,p,d,f){let y=!1,g=(0,Ys.connect)({host:e.hostname,port:Number(e.port)||80},()=>{y=!0,i(),g.write(wc(u,f,e.host)),d.length>0&&g.write(d),g.pipe(p),p.pipe(g)});g.on("error",h=>{if(y){p.destroy();return}s(h);let v=JSON.stringify(Ks);p.end(`HTTP/1.1 502 Bad Gateway\r
132
132
  Content-Type: application/json\r
133
- Content-Length: ${Buffer.byteLength(x)}\r
133
+ Content-Length: ${Buffer.byteLength(v)}\r
134
134
  Connection: close\r
135
135
  \r
136
- ${x}`)}),g.on("close",()=>{h&&p.destroy()}),p.on("error",()=>g.destroy()),p.on("close",()=>g.destroy())}return c(a,"forwardUpgrade"),{prefix(u,p,d){let f=u.url??"/";if(!Xs(f))return d();l(u,p,Gs(f))},fallthrough(u,p,d){let f=u.originalUrl??u.url??"/",h=ni(f);if(h===null||h.startsWith("/@")||h.startsWith("/__tempo/")||yc(h)||Sc(u.headers.accept,h)||vc(r.root,h))return d();l(u,p,f)},upgrade(u,p,d){let f=u.url??"/";if(n(u,f))return;let h=Xs(f)?Gs(f):f;a(u,p,d,h)}}}function gc(t){let e=t.server.hmr,r=typeof e=="object"&&e.path?He.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&&ni(i)===r?!0:n.some(l=>l.startsWith("^")?new RegExp(l).test(i):i.startsWith(l))}}function hc(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
136
+ ${v}`)}),g.on("close",()=>{y&&p.destroy()}),p.on("error",()=>g.destroy()),p.on("close",()=>g.destroy())}return l(a,"forwardUpgrade"),{prefix(u,p,d){let f=u.url??"/";if(!Xs(f))return d();c(u,p,Gs(f))},fallthrough(u,p,d){let f=u.originalUrl??u.url??"/",y=ni(f);if(y===null||y.startsWith("/@")||y.startsWith("/__tempo/")||xc(y)||Cc(u.headers.accept,y)||Ac(r.root,y))return d();c(u,p,f)},upgrade(u,p,d){let f=u.url??"/";if(n(u,f))return;let y=Xs(f)?Gs(f):f;a(u,p,d,y)}}}function Ec(t){let e=t.server.hmr,r=typeof e=="object"&&e.path?je.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&&ni(i)===r?!0:n.some(c=>c.startsWith("^")?new RegExp(c).test(i):i.startsWith(c))}}function wc(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
137
137
  `)}\r
138
138
  \r
139
- `}function yc(t){return t.replace(/\/+$/,"")==="/tempo-host"}function Sc(t,e){return!!t?.includes("text/html")&&(0,He.extname)(e)===""}function vc(t,e){return e.split("/").includes("..")?!1:e.endsWith(".html")?(0,sr.existsSync)((0,He.join)(t,e)):e.endsWith("/")?(0,sr.existsSync)((0,He.join)(t,e,"index.html")):(0,sr.existsSync)((0,He.join)(t,`${e}.html`))}function ni(t){try{return decodeURIComponent(new URL(t,"http://host").pathname)}catch{return null}}function zs(t){let e={};for(let[r,n]of Object.entries(t))n===void 0||bc.has(r)||(e[r]=n);return e}var sr,qs,Ys,He,Qs,Zr,Ks,Zs,mc,bc,oi=O(()=>{sr=require("node:fs"),qs=require("node:http"),Ys=require("node:net"),He=require("node:path"),Qs=require("node:stream"),Zr="/__tempo/flutter",Ks={error:"flutter_unreachable"},Zs="**/.flutter-host/**";c(ei,"readFlutterDevServerUrl");mc="/__tempo_flutter_status";c(ti,"watchFlutterRelaunches");c(Gs,"stripFlutterPrefix");c(Xs,"isUnderFlutterPrefix");c(ri,"createFlutterForwarding");c(gc,"createViteUpgradeMatcher");c(hc,"upgradeRequestHead");c(yc,"isCanvasHostPage");c(Sc,"isHtmlNavigation");c(vc,"rootHasHtmlPage");c(ni,"decodePathname");bc=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","proxy-connection","te","trailer","transfer-encoding","upgrade"]);c(zs,"endToEndHeaders")});function Ec(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 si(){let t=new Map;return{filter(e){let r=[];for(let n of e){let o=Ec(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 ii=O(()=>{c(Ec,"generationIdentity");c(si,"createHmrGenerationFence")});function ai(t){for(let e of t){if(e.name==="vite:react-refresh"&&e.load&&!ir.has(e)){ir.add(e);let i=e.load,s=typeof i=="function"?i:i.handler,l=c(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 d=`${p}
139
+ `}function xc(t){return t.replace(/\/+$/,"")==="/tempo-host"}function Cc(t,e){return!!t?.includes("text/html")&&(0,je.extname)(e)===""}function Ac(t,e){return e.split("/").includes("..")?!1:e.endsWith(".html")?(0,sr.existsSync)((0,je.join)(t,e)):e.endsWith("/")?(0,sr.existsSync)((0,je.join)(t,e,"index.html")):(0,sr.existsSync)((0,je.join)(t,`${e}.html`))}function ni(t){try{return decodeURIComponent(new URL(t,"http://host").pathname)}catch{return null}}function zs(t){let e={};for(let[r,n]of Object.entries(t))n===void 0||_c.has(r)||(e[r]=n);return e}var sr,qs,Ys,je,Qs,Zr,Ks,Zs,bc,_c,oi=O(()=>{sr=require("node:fs"),qs=require("node:http"),Ys=require("node:net"),je=require("node:path"),Qs=require("node:stream"),Zr="/__tempo/flutter",Ks={error:"flutter_unreachable"},Zs="**/.flutter-host/**";l(ei,"readFlutterDevServerUrl");bc="/__tempo_flutter_status";l(ti,"watchFlutterRelaunches");l(Gs,"stripFlutterPrefix");l(Xs,"isUnderFlutterPrefix");l(ri,"createFlutterForwarding");l(Ec,"createViteUpgradeMatcher");l(wc,"upgradeRequestHead");l(xc,"isCanvasHostPage");l(Cc,"isHtmlNavigation");l(Ac,"rootHasHtmlPage");l(ni,"decodePathname");_c=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","proxy-connection","te","trailer","transfer-encoding","upgrade"]);l(zs,"endToEndHeaders")});function Rc(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 si(){let t=new Map;return{filter(e){let r=[];for(let n of e){let o=Rc(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 ii=O(()=>{l(Rc,"generationIdentity");l(si,"createHmrGenerationFence")});function ai(t){for(let e of t){if(e.name==="vite:react-refresh"&&e.load&&!ir.has(e)){ir.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 d=`${p}
140
140
  globalThis[Symbol.for("tempo.react-refresh.family")] = (type) => allFamiliesByType.get(type);
141
141
  globalThis[Symbol.for("tempo.react-refresh.flush")] = performReactRefresh;
142
- `;return typeof u=="string"?d:{...u,code:d}},"wrapped");e.load=typeof i=="function"?l:{...i,handler:l}}if(e.name!=="vite:react-babel"||!e.transform||ir.has(e))continue;ir.add(e);let r=e.transform,n=typeof r=="function"?r:r.handler,o=c(async function(...i){let s=await n.apply(this,i);if(!s)return s;let l=typeof s=="string"?s:s.code;if(!l)return s;let a=l.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,d)=>`const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
142
+ `;return typeof u=="string"?d:{...u,code:d}},"wrapped");e.load=typeof i=="function"?c:{...i,handler:c}}if(e.name!=="vite:react-babel"||!e.transform||ir.has(e))continue;ir.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,d)=>`const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
143
143
  ${p}
144
144
  return currentExports;
145
145
  });
146
146
  import.meta.hot.accept(async (nextExports) => {
147
147
  const currentExports = await __tempoReactRefreshExports;${d}
148
- });`);return a===l?s:typeof s=="string"?a:{...s,code:a}},"wrapped");e.transform=typeof r=="function"?o:{...r,handler:o}}}var ir,li=O(()=>{ir=new WeakSet;c(ai,"installSynchronousReactRefreshBoundary")});function ui(){let t=new Map,e=c(r=>{let n=[],o=r,i=!1;for(;;){let s=t.get(o);if(s!==void 0){i=s;break}n.push(o);let l=xc(o);if(l!==void 0){i=l?.name===ci;break}let a=(0,Rt.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(wc))return!0;let n=r;try{n=ar.realpathSync.native(r)}catch{}return e((0,Rt.dirname)(n))}}function xc(t){let e;try{e=(0,ar.readFileSync)((0,Rt.join)(t,"package.json"),"utf8")}catch{return}try{let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}var ar,Rt,ci,wc,pi=O(()=>{ar=require("node:fs"),Rt=require("node:path"),ci="tempo-sdk",wc=`/node_modules/${ci}/`;c(ui,"createSdkFileMatcher");c(xc,"readPackageManifest")});function di(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) {
148
+ });`);return a===c?s:typeof s=="string"?a:{...s,code:a}},"wrapped");e.transform=typeof r=="function"?o:{...r,handler:o}}}var ir,li=O(()=>{ir=new WeakSet;l(ai,"installSynchronousReactRefreshBoundary")});function ui(){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=kc(o);if(c!==void 0){i=c?.name===ci;break}let a=(0,Tt.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(Tc))return!0;let n=r;try{n=ar.realpathSync.native(r)}catch{}return e((0,Tt.dirname)(n))}}function kc(t){let e;try{e=(0,ar.readFileSync)((0,Tt.join)(t,"package.json"),"utf8")}catch{return}try{let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}var ar,Tt,ci,Tc,pi=O(()=>{ar=require("node:fs"),Tt=require("node:path"),ci="tempo-sdk",Tc=`/node_modules/${ci}/`;l(ui,"createSdkFileMatcher");l(kc,"readPackageManifest")});function di(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) {
149
149
  const pending = mod || {
150
150
  id: path,
151
151
  callbacks: [],
@@ -165,20 +165,20 @@ ${p}
165
165
  });
166
166
  }
167
167
  });
168
- }`)}var fi=O(()=>{c(di,"preservePendingViteModuleUpdates")});function kt(t){return t.replace(/\\/g,"/")}function gi(t){let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?"":e.slice(r+1).toLowerCase()}function kc(t){let e=kt(t);return mi.has(gi(e))?!Cc.some(r=>e.includes(r)):!1}function Tc(t){if(t.includes("*"))return!0;let e=gi(kt(t));return e!==""&&e!=="css"&&mi.has(e)}function Ic(t,e){if(t.deps===null)return!1;let r=kt(e),n=!1;for(let o of t.deps){let i=kt(o);if(i===r)return!1;!n&&Tc(i)&&(n=!0)}return n}function hi(t){let e=t.debounceMs??Ac,r=t.maxPokesPerPair??_c,n=new Set,o=new Map,i=new Set,s=null,l=Number.NEGATIVE_INFINITY,a=!1,u=c(()=>{s=null,l=Date.now(),i.clear();let p=[...n];n.clear();for(let d of p)t.emitChange(d)},"flush");return{handleWatcherFile(p){if(a||!kc(p))return!1;let d=!1;for(let f of t.listCssEntries()){if(!Ic(f,p))continue;let h=`${f.cssFile}\0${kt(p)}`;if(!i.has(h)){let g=o.get(h)??0;if(g>=r)continue;o.size>=Rc&&o.clear(),o.set(h,g+1),i.add(h)}n.add(f.cssFile),d=!0}if(d&&s===null){let h=Date.now()-l>=e?0:e;s=setTimeout(u,h),s.unref?.()}return d},dispose(){a=!0,n.clear(),o.clear(),i.clear(),s!==null&&(clearTimeout(s),s=null)}}}var mi,Cc,Ac,_c,Rc,yi=O(()=>{mi=new Set(["ts","tsx","js","jsx","mjs","cjs","html","mdx","md","svelte","vue","astro"]),Cc=["/node_modules/","/.git/","/.vite/","/.tempo/"],Ac=100,_c=2,Rc=2e4;c(kt,"normalizeSlashes");c(gi,"fileExtension");c(kc,"isScannableSourceFile");c(Tc,"isScanDep");c(Ic,"cssEntryNeedsRescanFor");c(hi,"createTailwindScanNet")});function Si(t,e){try{let r=xe(t);if(r.kind!=="ok")throw new Error(r.message);let n=oe(V(V(r.root.frontmatter)?.program)?.body),o=new Set,i=new Map,s=new Map,l=new Set;for(let f of n){if(f.type==="ImportDeclaration")for(let g of oe(f.specifiers)){let y=String(V(g.local)?.name),x=String(V(f.source)?.value),S=g.type==="ImportDefaultSpecifier"?"default":String(V(g.imported)?.name??V(g.imported)?.value);x==="tempo-sdk/astro/controls"&&S==="defineAstroControls"?o.add(y):i.set(y,{source:x,name:S})}let h=f.type==="ExportNamedDeclaration"?V(f.declaration):f;if(h?.type==="VariableDeclaration"&&h.kind==="const")for(let g of oe(h.declarations)){let y=V(g.id),x=V(g.init);y?.type==="Identifier"&&x&&s.set(String(y.name),x)}}let a=n.flatMap(f=>{let h=f.type==="ExpressionStatement"?V(f.expression):null;return h?.type==="CallExpression"&&o.has(String(V(h.callee)?.name))?[h]:[]});if(a.length>1)throw new Error("Keep one defineAstroControls declaration in this component");let u=c((f,h=new Set)=>{let g=we(f);if(g.known)return g.value;if(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","ParenthesizedExpression"].includes(f.type))return u(V(f.expression),h);if(f.type==="Identifier"){let y=String(f.name);if(h.has(y))throw new Error(`Controls contain a constant cycle through ${y}`);let x=s.get(y);if(x)return u(x,new Set([...h,y]));let S=i.get(y);if(S){l.add(S.source);let w=e?.(S.source,S.name);if(w!==void 0)return w}throw new Error(`Control value ${y} must resolve to a static constant`)}if(f.type==="ArrayExpression"){if(!Array.isArray(f.elements)||f.elements.some(y=>!V(y)||V(y)?.type==="SpreadElement"))throw new Error("Controls arrays cannot contain holes or spreads");return oe(f.elements).map(y=>u(y,h))}if(f.type==="ObjectExpression"){let y=Object.create(null);for(let x of oe(f.properties)){let S=V(x.key),w=V(x.value);if(x.type!=="Property"||x.computed||x.method||x.kind!=="init"||!S||!w)throw new Error("Controls require ordinary static object properties");let C=S.type==="Identifier"?S.name:S.value;if(typeof C!="string"&&typeof C!="number")throw new Error("Invalid control property");y[C]=u(w,h)}return y}if(f.type==="MemberExpression"){let y=u(V(f.object),h),x=V(f.property),S=f.computed?u(x,h):String(x.name);if(y&&typeof y=="object"&&(typeof S=="string"||typeof S=="number")&&Object.prototype.hasOwnProperty.call(y,S))return y[S]}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=oe(a[0].arguments);if(p.length!==1)throw new Error("defineAstroControls takes one controls object");let d=u(p[0]);if(!d||Array.isArray(d)||typeof d!="object")throw new Error("defineAstroControls requires a controls object");return{kind:"ok",declared:!0,controls:d,dependencies:[...l]}}catch(r){return{kind:"error",message:r instanceof Error?r.message:String(r)}}}var vi=O(()=>{"use strict";Xe();c(Si,"readAstroControls")});var bi={};Pt(bi,{readAstroControlsMetadata:()=>Pc});async function Pc(t,e,r,n=[]){let o=new Set([t]),i=new Set,s=new Map,l=new Map,a=c(async(d,f)=>{let h=`${d}#${f??"controls"}`;if(i.has(h)||i.size>16)return{kind:"error",message:"Controls have cyclic or excessively deep imports"};i.add(h);try{o.add(d),r(d);let g=l.get(d)??(0,Tt.readFileSync)(d,"utf8");if(f!==void 0){if(d.endsWith(".astro")){let w=xe(g);if(w.kind!=="ok"||!w.frontmatter)return{kind:"error",message:"This Astro file has no static exported constant"};g=g.slice(w.frontmatter.contentStart,w.frontmatter.contentEnd)}let y=(0,en.parseSync)(d.endsWith(".astro")?`${d}.ts`:d,g);if(y.errors.length)return{kind:"error",message:"Controls dependency cannot be parsed"};let x;for(let w of y.program.body){if(w.type==="ExportDefaultDeclaration"&&f==="default"&&(x=g.slice(w.declaration.start,w.declaration.end)),w.type!=="ExportNamedDeclaration")continue;let C=w.declaration;if(C?.type==="VariableDeclaration"&&C.kind==="const")for(let k of C.declarations)k.id.type==="Identifier"&&k.id.name===f&&(x=f);for(let k of w.specifiers){if((k.exported.type==="Identifier"?k.exported.name:k.exported.value)!==f)continue;let M=k.local.type==="Identifier"?k.local.name:k.local.value;if(w.source){let W=await e(w.source.value,d);return W?await a(W,M):{kind:"error",message:`Cannot resolve ${w.source.value}`}}x=M}}if(!x)return{kind:"error",message:`${f} is not a static exported constant`};let S="__tempoReadControls";for(;g.includes(S);)S+="_";g=`---
168
+ }`)}var fi=O(()=>{l(di,"preservePendingViteModuleUpdates")});function kt(t){return t.replace(/\\/g,"/")}function gi(t){let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?"":e.slice(r+1).toLowerCase()}function Oc(t){let e=kt(t);return mi.has(gi(e))?!Ic.some(r=>e.includes(r)):!1}function $c(t){if(t.includes("*"))return!0;let e=gi(kt(t));return e!==""&&e!=="css"&&mi.has(e)}function Lc(t,e){if(t.deps===null)return!1;let r=kt(e),n=!1;for(let o of t.deps){let i=kt(o);if(i===r)return!1;!n&&$c(i)&&(n=!0)}return n}function hi(t){let e=t.debounceMs??Pc,r=t.maxPokesPerPair??Nc,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 d of p)t.emitChange(d)},"flush");return{handleWatcherFile(p){if(a||!Oc(p))return!1;let d=!1;for(let f of t.listCssEntries()){if(!Lc(f,p))continue;let y=`${f.cssFile}\0${kt(p)}`;if(!i.has(y)){let g=o.get(y)??0;if(g>=r)continue;o.size>=Mc&&o.clear(),o.set(y,g+1),i.add(y)}n.add(f.cssFile),d=!0}if(d&&s===null){let y=Date.now()-c>=e?0:e;s=setTimeout(u,y),s.unref?.()}return d},dispose(){a=!0,n.clear(),o.clear(),i.clear(),s!==null&&(clearTimeout(s),s=null)}}}var mi,Ic,Pc,Nc,Mc,yi=O(()=>{mi=new Set(["ts","tsx","js","jsx","mjs","cjs","html","mdx","md","svelte","vue","astro"]),Ic=["/node_modules/","/.git/","/.vite/","/.tempo/"],Pc=100,Nc=2,Mc=2e4;l(kt,"normalizeSlashes");l(gi,"fileExtension");l(Oc,"isScannableSourceFile");l($c,"isScanDep");l(Lc,"cssEntryNeedsRescanFor");l(hi,"createTailwindScanNet")});function Si(t,e){try{let r=xe(t);if(r.kind!=="ok")throw new Error(r.message);let n=oe(V(V(r.root.frontmatter)?.program)?.body),o=new Set,i=new Map,s=new Map,c=new Set;for(let f of n){if(f.type==="ImportDeclaration")for(let g of oe(f.specifiers)){let h=String(V(g.local)?.name),v=String(V(f.source)?.value),S=g.type==="ImportDefaultSpecifier"?"default":String(V(g.imported)?.name??V(g.imported)?.value);v==="tempo-sdk/astro/controls"&&S==="defineAstroControls"?o.add(h):i.set(h,{source:v,name:S})}let y=f.type==="ExportNamedDeclaration"?V(f.declaration):f;if(y?.type==="VariableDeclaration"&&y.kind==="const")for(let g of oe(y.declarations)){let h=V(g.id),v=V(g.init);h?.type==="Identifier"&&v&&s.set(String(h.name),v)}}let a=n.flatMap(f=>{let y=f.type==="ExpressionStatement"?V(f.expression):null;return y?.type==="CallExpression"&&o.has(String(V(y.callee)?.name))?[y]:[]});if(a.length>1)throw new Error("Keep one defineAstroControls declaration in this component");let u=l((f,y=new Set)=>{let g=we(f);if(g.known)return g.value;if(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","ParenthesizedExpression"].includes(f.type))return u(V(f.expression),y);if(f.type==="Identifier"){let h=String(f.name);if(y.has(h))throw new Error(`Controls contain a constant cycle through ${h}`);let v=s.get(h);if(v)return u(v,new Set([...y,h]));let S=i.get(h);if(S){c.add(S.source);let x=e?.(S.source,S.name);if(x!==void 0)return x}throw new Error(`Control value ${h} must resolve to a static constant`)}if(f.type==="ArrayExpression"){if(!Array.isArray(f.elements)||f.elements.some(h=>!V(h)||V(h)?.type==="SpreadElement"))throw new Error("Controls arrays cannot contain holes or spreads");return oe(f.elements).map(h=>u(h,y))}if(f.type==="ObjectExpression"){let h=Object.create(null);for(let v of oe(f.properties)){let S=V(v.key),x=V(v.value);if(v.type!=="Property"||v.computed||v.method||v.kind!=="init"||!S||!x)throw new Error("Controls require ordinary static object properties");let C=S.type==="Identifier"?S.name:S.value;if(typeof C!="string"&&typeof C!="number")throw new Error("Invalid control property");h[C]=u(x,y)}return h}if(f.type==="MemberExpression"){let h=u(V(f.object),y),v=V(f.property),S=f.computed?u(v,y):String(v.name);if(h&&typeof h=="object"&&(typeof S=="string"||typeof S=="number")&&Object.prototype.hasOwnProperty.call(h,S))return h[S]}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=oe(a[0].arguments);if(p.length!==1)throw new Error("defineAstroControls takes one controls object");let d=u(p[0]);if(!d||Array.isArray(d)||typeof d!="object")throw new Error("defineAstroControls requires a controls object");return{kind:"ok",declared:!0,controls:d,dependencies:[...c]}}catch(r){return{kind:"error",message:r instanceof Error?r.message:String(r)}}}var vi=O(()=>{"use strict";ze();l(Si,"readAstroControls")});var bi={};Nt(bi,{readAstroControlsMetadata:()=>Fc});async function Fc(t,e,r,n=[]){let o=new Set([t]),i=new Set,s=new Map,c=new Map,a=l(async(d,f)=>{let y=`${d}#${f??"controls"}`;if(i.has(y)||i.size>16)return{kind:"error",message:"Controls have cyclic or excessively deep imports"};i.add(y);try{o.add(d),r(d);let g=c.get(d)??(0,It.readFileSync)(d,"utf8");if(f!==void 0){if(d.endsWith(".astro")){let x=xe(g);if(x.kind!=="ok"||!x.frontmatter)return{kind:"error",message:"This Astro file has no static exported constant"};g=g.slice(x.frontmatter.contentStart,x.frontmatter.contentEnd)}let h=(0,en.parseSync)(d.endsWith(".astro")?`${d}.ts`:d,g);if(h.errors.length)return{kind:"error",message:"Controls dependency cannot be parsed"};let v;for(let x of h.program.body){if(x.type==="ExportDefaultDeclaration"&&f==="default"&&(v=g.slice(x.declaration.start,x.declaration.end)),x.type!=="ExportNamedDeclaration")continue;let C=x.declaration;if(C?.type==="VariableDeclaration"&&C.kind==="const")for(let T of C.declarations)T.id.type==="Identifier"&&T.id.name===f&&(v=f);for(let T of x.specifiers){if((T.exported.type==="Identifier"?T.exported.name:T.exported.value)!==f)continue;let M=T.local.type==="Identifier"?T.local.name:T.local.value;if(x.source){let W=await e(x.source.value,d);return W?await a(W,M):{kind:"error",message:`Cannot resolve ${x.source.value}`}}v=M}}if(!v)return{kind:"error",message:`${f} is not a static exported constant`};let S="__tempoReadControls";for(;g.includes(S);)S+="_";g=`---
169
169
  import { defineAstroControls as ${S} } from "tempo-sdk/astro/controls";
170
170
  ${g}
171
- ${S}({value: ${x}});
172
- ---`}for(let y=0;y<64;y++){let x,S=Si(g,(k,L)=>{let M=`${d}:${k}#${L}`;if(s.has(M))return s.get(M);x??={specifier:k,name:L}});if(!x)return S;let w=await e(x.specifier,d);if(!w||w.startsWith("\0"))return{kind:"error",message:`Cannot statically read controls import ${x.specifier}`};let C=await a(w,x.name);if(C.kind==="error")return C;s.set(`${d}:${x.specifier}#${x.name}`,C.controls.value)}return{kind:"error",message:"Controls exceed the static dependency budget"}}catch(g){return{kind:"error",message:g instanceof Error?g.message:String(g)}}finally{i.delete(h)}},"read"),u=await a(t),p=!1;try{for(let d of new Set(n)){if(r(d),o.add(d),!(0,Tt.existsSync)(d))continue;let f=(0,Tt.readFileSync)(d,"utf8"),h=(0,en.parseSync)(d,f);if(h.errors.length)throw new Error("Shared component controls cannot be parsed");let g=new Set,y=new Set;for(let C of h.program.body)if(C.type==="ImportDeclaration")for(let k of C.specifiers)C.source.value==="tempo-sdk/assets"&&k.type==="ImportSpecifier"&&(k.imported.type==="Identifier"?k.imported.name:k.imported.value)==="defineControls"&&g.add(k.local.name),k.type==="ImportDefaultSpecifier"&&C.source.value.endsWith(".astro?tempo-component")&&await e(C.source.value.replace(/\?tempo-component$/,""),d)===t&&y.add(k.local.name);let x=h.program.body.flatMap(C=>{let k=C.type==="ExpressionStatement"?C.expression:null;return k?.type==="CallExpression"&&k.callee.type==="Identifier"&&g.has(k.callee.name)&&k.arguments[0]?.type==="Identifier"&&y.has(k.arguments[0].name)?[k]:[]});if(!x.length)continue;if(x.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 S=x[0].arguments[1];if(!S)throw new Error("defineControls requires a controls object");let w="__tempoReadSharedControls";for(;f.includes(w);)w+="_";l.set(d,`---
173
- import {defineAstroControls as ${w}} from "tempo-sdk/astro/controls";
171
+ ${S}({value: ${v}});
172
+ ---`}for(let h=0;h<64;h++){let v,S=Si(g,(T,L)=>{let M=`${d}:${T}#${L}`;if(s.has(M))return s.get(M);v??={specifier:T,name:L}});if(!v)return S;let x=await e(v.specifier,d);if(!x||x.startsWith("\0"))return{kind:"error",message:`Cannot statically read controls import ${v.specifier}`};let C=await a(x,v.name);if(C.kind==="error")return C;s.set(`${d}:${v.specifier}#${v.name}`,C.controls.value)}return{kind:"error",message:"Controls exceed the static dependency budget"}}catch(g){return{kind:"error",message:g instanceof Error?g.message:String(g)}}finally{i.delete(y)}},"read"),u=await a(t),p=!1;try{for(let d of new Set(n)){if(r(d),o.add(d),!(0,It.existsSync)(d))continue;let f=(0,It.readFileSync)(d,"utf8"),y=(0,en.parseSync)(d,f);if(y.errors.length)throw new Error("Shared component controls cannot be parsed");let g=new Set,h=new Set;for(let C of y.program.body)if(C.type==="ImportDeclaration")for(let T of C.specifiers)C.source.value==="tempo-sdk/assets"&&T.type==="ImportSpecifier"&&(T.imported.type==="Identifier"?T.imported.name:T.imported.value)==="defineControls"&&g.add(T.local.name),T.type==="ImportDefaultSpecifier"&&C.source.value.endsWith(".astro?tempo-component")&&await e(C.source.value.replace(/\?tempo-component$/,""),d)===t&&h.add(T.local.name);let v=y.program.body.flatMap(C=>{let T=C.type==="ExpressionStatement"?C.expression:null;return T?.type==="CallExpression"&&T.callee.type==="Identifier"&&g.has(T.callee.name)&&T.arguments[0]?.type==="Identifier"&&h.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 S=v[0].arguments[1];if(!S)throw new Error("defineControls requires a controls object");let x="__tempoReadSharedControls";for(;f.includes(x);)x+="_";c.set(d,`---
173
+ import {defineAstroControls as ${x}} from "tempo-sdk/astro/controls";
174
174
  ${f}
175
- ${w}(${f.slice(S.start,S.end)});
176
- ---`),u=await a(d),p=!0}}catch(d){u={kind:"error",message:d instanceof Error?d.message:String(d)}}return u.kind==="ok"?{...u.declared?{controls:u.controls,...p?{shared:!0}:{}}:{},dependencies:[...o]}:{error:u.message,dependencies:[...o]}}var Tt,en,Ei=O(()=>{Tt=require("node:fs");vi();Xe();en=require("oxc-parser");c(Pc,"readAstroControlsMetadata")});function Ci(){let t=(0,G.dirname)((0,Ti.fileURLToPath)(Ce("index.ts")));for(let e of[(0,G.join)(t,"canvas","interact-projection.ts"),(0,G.join)(t,"canvas","interact-projection.js")])if((0,ae.existsSync)(e))return e.replace(/\\/g,"/");return null}function st(t){return t.replace(/[?#].*$/,"")}function Fc(t){return new URL(t,"http://tempo.local").pathname.replace(/\/+$/,"")==="/tempo-host"}function Dc(t){if(!Fc(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 _i(t){return t.startsWith("./")||t.startsWith("../")}function Uc(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 Vc(t,e){let r=me(t);try{return ae.realpathSync.native(r)===ae.realpathSync.native(e)}catch{return r.replace(/\\/g,"/")===e.replace(/\\/g,"/")}}function Ri(t){try{return ae.realpathSync.native(t)}catch{return t}}function Wc(t){return/<meta[^>]+name=["']tempo-project-root["'][^>]*>/i.test(t)}function Bc(t){return/<meta[^>]+name=["']tempo-source-identity-root["'][^>]*>/i.test(t)}function Jc(t){return new RegExp(`<meta[^>]+name=["']${ge.TEMPO_WORKSPACE_NONCE_META_NAME}["'][^>]*>`,"i").test(t)}function Kc(t){return(t??[]).some(e=>e.name===ge.TEMPO_VUE_ANNOTATION_PLUGIN_NAME&&e.api?.enabled===!0)}function Gc(t,e,r,n,o){let i=r.url;if(!i?.startsWith("/__tempo/"))return o();if(i===ge.TEMPO_HOST_IDENTITY_ENDPOINT&&r.method==="GET"){let s=(0,ge.createTempoHostIdentity)("vite",{root:e.config?.root,pluginActive:!0,...Kc(e.config?.plugins)?{capabilities:{vueSourceAnnotation:1}}:{}});n.statusCode=200,n.setHeader("Cache-Control","no-store"),n.setHeader("Content-Type","application/json; charset=utf-8"),n.setHeader(ge.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),n.end(JSON.stringify(s));return}Fo(e,r,n)||t.handleRequest(r,n)||o()}function zc(t){let e=hi({listCssEntries:c(function*(){let n=t.moduleGraph?.fileToModulesMap??new Map;for(let[o,i]of n)if(o.endsWith(".css"))for(let s of i){let l=[];for(let a of s.importedModules??[]){let u=a.file??a.url??a.id;u&&l.push(u)}yield{cssFile:o,deps:l}}},"listCssEntries"),emitChange:c(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=c(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 Ii(t={}){let e=t.enabled??!!process.env.TEMPO,r=e?ei(process.env):null,n=t.include===void 0?Nc:t.include,o=t.exclude===void 0?Mc:t.exclude,i=ui(),s=zr(n,o),l=c(m=>s(m)&&!i(m),"filter"),a=zr(["**/*.tsx","**/*.jsx","**/*.ts","**/*.js"],o),u=c(m=>a(m)&&!i(m),"controlsFilter"),p=new Map,d=c((m,A,T)=>{let I=new Set(T);for(let[U,q]of p)if(q.has(m)){let Oe=A.getModuleById(U);Oe&&(A.invalidateModule(Oe),I.add(Oe))}return[...I]},"invalidateAstroDescriptors"),f=process.cwd(),h=Vs({stampedFilepath:c(m=>l(m)?(0,G.relative)(f,m):null,"stampedFilepath"),transformsControls:u,computeAnnotatedProps:t.computeAnnotatedProps,flutterHostRoot:c(()=>f,"flutterHostRoot")}),g=f,y="serve",x=!0,S=Eo({onErrorFile:c(m=>b(m),"onErrorFile")}),w=new Map,C,k=new Map,L=!1,M=!1,W=!1,P=null,$=new WeakSet,v=Bs(),z=si(),F=So(),D=F.recordCoverage,b=c(m=>{D(m)},"pinErroneousRevisionCoverage"),E=c(async m=>await h.defaultExportIdentityRewritten(m)?(C?.ws.send({type:"full-reload",path:"*"}),!0):!1,"repairDefaultExportIdentityRewrite"),te=c(()=>(0,G.resolve)(f,".tempo","tempo-host.tsx"),"wrapperPath"),B=c(m=>Mo(m,te()),"isIncrementalRegistration"),Q=c((m,A,T)=>Oo(m,{wrapperPath:te(),sourceRoot:g},A,T),"invalidateCanvasLoader"),Z=c((m,A,T)=>{let I=`${A}\0${m}`;for(w.delete(I),w.set(I,{specifier:m,importer:A,packageName:T});w.size>Hc;){let U=w.keys().next().value;if(U===void 0)break;w.delete(U)}J()},"rememberUnresolvedImport"),X=c(m=>{for(let[A,T]of w)Vc(T.importer,m)&&w.delete(A);J()},"forgetUnresolvedImportsFrom"),Se=c(m=>{k.get(m)?.watcher.close(),k.delete(m)},"closeUnresolvedImportWatcher"),Me=c(()=>{P!==null&&(clearTimeout(P),P=null)},"cancelUnresolvedImportWatchRearm"),be=c(()=>{P!==null||!C||w.size===0||(P=setTimeout(()=>{P=null,C&&w.size>0&&(J(),_())},jc),P.unref?.())},"scheduleUnresolvedImportWatchRearm"),le=c(()=>{Me();for(let m of[...k.keys()])Se(m)},"closeUnresolvedImportWatchers"),H=c(()=>[...w.values()].some(m=>m.packageName!==void 0),"hasUnresolvedBarePackages"),We=c(m=>{let A=(0,G.dirname)(st(m.importer)),T;for(;;){try{if((0,ae.statSync)((0,G.join)(A,"node_modules")).isDirectory())return(0,G.join)(A,"node_modules",m.packageName)}catch{}if(T===void 0)try{(0,ae.statSync)((0,G.join)(A,"package.json")).isFile()&&(T=A)}catch{}let I=(0,G.dirname)(A);if(I===A)break;A=I}return(0,G.join)(T??f,"node_modules",m.packageName)},"packageWatchTarget"),ur=c(m=>m.packageName?We(m):(0,G.resolve)((0,G.dirname)(st(m.importer)),st(m.specifier)),"unresolvedImportWatchTarget"),R=c(m=>{let A=m;for(;;){try{if((0,ae.statSync)(A).isDirectory())return A}catch{}let T=(0,G.dirname)(A);if(T===A)return;A=T}},"nearestExistingDirectory");function J(){if(!C||w.size===0){le();return}let m=new Map;for(let A of w.values()){let T=ur(A),I=R(T);if(!I)continue;let U=m.get(I);m.set(I,{recursive:U?.recursive===!0||I===T})}for(let[A,T]of[...k]){let I=m.get(A);(!I||I.recursive!==T.recursive)&&Se(A)}for(let[A,T]of m)if(!k.has(A))try{let I=(0,ae.watch)(A,{recursive:T.recursive},_);k.set(A,{watcher:I,recursive:T.recursive}),I.on("error",()=>{Se(A),be()}),T.recursive&&_()}catch{Se(A),be()}[...m.keys()].every(A=>k.has(A))&&Me()}c(J,"syncUnresolvedImportWatcher");function _(){if(L||M){W=!0;return}L=!0,queueMicrotask(()=>{L=!1,j()})}c(_,"scheduleUnresolvedImportResolution");async function j(){let m=C;if(!(!m||M)){M=!0;try{do{W=!1,J();let A=!1;for(let[T,I]of[...w]){let U;if(_i(I.specifier)){let q=I.specifier.search(/[?#]/),Oe=q<0?I.specifier:I.specifier.slice(0,q),K=(0,G.resolve)((0,G.dirname)(st(I.importer)),Oe),ce=[K,...Ai.map(de=>`${K}${de}`),...Ai.map(de=>(0,G.join)(K,`index${de}`))];for(let de of ce)try{if((0,ae.statSync)(de).isFile()){U=de;break}}catch{}}if(!U&&I.packageName)try{U=(0,ki.createRequire)(st(I.importer)).resolve(I.specifier)}catch{}U&&(m.watcher.add(U),w.delete(T),S.errorServer.clearErrorForModules([I.importer]),A=!0)}A&&m.ws.send({type:"full-reload",path:"*"}),J()}while(W)}finally{M=!1}}}return c(j,"runUnresolvedImportResolution"),{name:"tempo-annotate",apply:"serve",enforce:"pre",config(m,A){if(!e||A.command!=="serve")return;lo(m),co(m);let T=["react","react-dom"].filter(U=>!m.resolve?.dedupe?.includes(U)),I=oo(m.root);return{resolve:{dedupe:T,...I.length?{alias:I}:{}},...m.css?.devSourcemap===void 0?{css:{devSourcemap:!0}}:{},...r&&m.server?.watch!==null?{server:{watch:{ignored:[Zs]}}}:{}}},resolveId:{order:"pre",async handler(m,A,T){if(m.endsWith(".astro?tempo-component")){let I=await this.resolve(m.slice(0,-16),A,{...T,skipSelf:!0});return I?`\0tempo:astro-component:${encodeURIComponent(I.id)}.js`:null}if(e&&m===Gt)return Xt;if(m===wi)return tn;if(m===xi&&A===tn){let I=await this.resolve(m,A,{...T,skipSelf:!0});return I||Ci()}if(e&&A&&!A.startsWith("\0")){let I=Uc(m);if(!_i(m)&&!I)return null;try{let U=await this.resolve(m,A,{...T,skipSelf:!0});return U||Z(m,A,I),U}catch(U){throw Z(m,A,I),U}}return null}},load:{order:"pre",async handler(m){if(m.startsWith("\0tempo:astro-component:")){let A=decodeURIComponent(m.slice(23,-3)),{readAstroControlsMetadata:T}=await Promise.resolve().then(()=>(Ei(),bi)),I=await T(A,async(U,q)=>(await this.resolve(U,q,{skipSelf:!0}))?.id??null,U=>C?.watcher.add(U),[(0,G.resolve)(g,"tempo/controls.ts"),(0,G.resolve)(f,"controls.ts")]);return p.set(m,new Set(I.dependencies)),`export default {kind:"astro-component",module:${JSON.stringify(A.replaceAll("\\","/"))},__tempoAstroControls:${JSON.stringify(I).replaceAll("<","\\u003c")}};`}return e&&m===Xt?Pr:m===tn?`import { installTempoInteractProjectionSource } from ${JSON.stringify(xi)};
175
+ ${x}(${f.slice(S.start,S.end)});
176
+ ---`),u=await a(d),p=!0}}catch(d){u={kind:"error",message:d instanceof Error?d.message:String(d)}}return u.kind==="ok"?{...u.declared?{controls:u.controls,...p?{shared:!0}:{}}:{},dependencies:[...o]}:{error:u.message,dependencies:[...o]}}var It,en,Ei=O(()=>{It=require("node:fs");vi();ze();en=require("oxc-parser");l(Fc,"readAstroControlsMetadata")});function Ci(){let t=(0,G.dirname)((0,ki.fileURLToPath)(Ce("index.ts")));for(let e of[(0,G.join)(t,"canvas","interact-projection.ts"),(0,G.join)(t,"canvas","interact-projection.js")])if((0,ae.existsSync)(e))return e.replace(/\\/g,"/");return null}function st(t){return t.replace(/[?#].*$/,"")}function Wc(t){return new URL(t,"http://tempo.local").pathname.replace(/\/+$/,"")==="/tempo-host"}function Bc(t){if(!Wc(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 _i(t){return t.startsWith("./")||t.startsWith("../")}function Gc(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 Xc(t,e){let r=me(t);try{return ae.realpathSync.native(r)===ae.realpathSync.native(e)}catch{return r.replace(/\\/g,"/")===e.replace(/\\/g,"/")}}function Ri(t){try{return ae.realpathSync.native(t)}catch{return t}}function zc(t){return/<meta[^>]+name=["']tempo-project-root["'][^>]*>/i.test(t)}function qc(t){return/<meta[^>]+name=["']tempo-source-identity-root["'][^>]*>/i.test(t)}function Yc(t){return new RegExp(`<meta[^>]+name=["']${ge.TEMPO_WORKSPACE_NONCE_META_NAME}["'][^>]*>`,"i").test(t)}function Qc(t){return(t??[]).some(e=>e.name===ge.TEMPO_VUE_ANNOTATION_PLUGIN_NAME&&e.api?.enabled===!0)}function Zc(t,e,r,n,o){let i=r.url;if(!i?.startsWith("/__tempo/"))return o();if(i===ge.TEMPO_HOST_IDENTITY_ENDPOINT&&r.method==="GET"){let s=(0,ge.createTempoHostIdentity)("vite",{root:e.config?.root,pluginActive:!0,...Qc(e.config?.plugins)?{capabilities:{vueSourceAnnotation:1}}:{}});n.statusCode=200,n.setHeader("Cache-Control","no-store"),n.setHeader("Content-Type","application/json; charset=utf-8"),n.setHeader(ge.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),n.end(JSON.stringify(s));return}Fo(e,r,n)||t.handleRequest(r,n)||o()}function tu(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 Ii(t={}){let e=t.enabled??!!process.env.TEMPO,r=e?ei(process.env):null,n=t.include===void 0?Dc:t.include,o=t.exclude===void 0?Hc:t.exclude,i=ui(),s=zr(n,o),c=l(m=>s(m)&&!i(m),"filter"),a=zr(["**/*.tsx","**/*.jsx","**/*.ts","**/*.js"],o),u=l(m=>a(m)&&!i(m),"controlsFilter"),p=new Map,d=l((m,A,k)=>{let I=new Set(k);for(let[U,q]of p)if(q.has(m)){let $e=A.getModuleById(U);$e&&(A.invalidateModule($e),I.add($e))}return[...I]},"invalidateAstroDescriptors"),f=process.cwd(),y=Vs({stampedFilepath:l(m=>c(m)?(0,G.relative)(f,m):null,"stampedFilepath"),transformsControls:u,computeAnnotatedProps:t.computeAnnotatedProps,flutterHostRoot:l(()=>f,"flutterHostRoot")}),g=f,h="serve",v=!0,S=Eo({onErrorFile:l(m=>E(m),"onErrorFile")}),x=new Map,C,T=new Map,L=!1,M=!1,W=!1,N=null,$=new WeakSet,b=Bs(),z=si(),F=So(),D=F.recordCoverage,E=l(m=>{D(m)},"pinErroneousRevisionCoverage"),w=l(async m=>await y.defaultExportIdentityRewritten(m)?(C?.ws.send({type:"full-reload",path:"*"}),!0):!1,"repairDefaultExportIdentityRewrite"),te=l(()=>(0,G.resolve)(f,".tempo","tempo-host.tsx"),"wrapperPath"),B=l(m=>Mo(m,te()),"isIncrementalRegistration"),Q=l((m,A,k)=>Oo(m,{wrapperPath:te(),sourceRoot:g},A,k),"invalidateCanvasLoader"),Z=l((m,A,k)=>{let I=`${A}\0${m}`;for(x.delete(I),x.set(I,{specifier:m,importer:A,packageName:k});x.size>Jc;){let U=x.keys().next().value;if(U===void 0)break;x.delete(U)}J()},"rememberUnresolvedImport"),X=l(m=>{for(let[A,k]of x)Xc(k.importer,m)&&x.delete(A);J()},"forgetUnresolvedImportsFrom"),Se=l(m=>{T.get(m)?.watcher.close(),T.delete(m)},"closeUnresolvedImportWatcher"),Oe=l(()=>{N!==null&&(clearTimeout(N),N=null)},"cancelUnresolvedImportWatchRearm"),be=l(()=>{N!==null||!C||x.size===0||(N=setTimeout(()=>{N=null,C&&x.size>0&&(J(),_())},Kc),N.unref?.())},"scheduleUnresolvedImportWatchRearm"),le=l(()=>{Oe();for(let m of[...T.keys()])Se(m)},"closeUnresolvedImportWatchers"),H=l(()=>[...x.values()].some(m=>m.packageName!==void 0),"hasUnresolvedBarePackages"),Be=l(m=>{let A=(0,G.dirname)(st(m.importer)),k;for(;;){try{if((0,ae.statSync)((0,G.join)(A,"node_modules")).isDirectory())return(0,G.join)(A,"node_modules",m.packageName)}catch{}if(k===void 0)try{(0,ae.statSync)((0,G.join)(A,"package.json")).isFile()&&(k=A)}catch{}let I=(0,G.dirname)(A);if(I===A)break;A=I}return(0,G.join)(k??f,"node_modules",m.packageName)},"packageWatchTarget"),ur=l(m=>m.packageName?Be(m):(0,G.resolve)((0,G.dirname)(st(m.importer)),st(m.specifier)),"unresolvedImportWatchTarget"),R=l(m=>{let A=m;for(;;){try{if((0,ae.statSync)(A).isDirectory())return A}catch{}let k=(0,G.dirname)(A);if(k===A)return;A=k}},"nearestExistingDirectory");function J(){if(!C||x.size===0){le();return}let m=new Map;for(let A of x.values()){let k=ur(A),I=R(k);if(!I)continue;let U=m.get(I);m.set(I,{recursive:U?.recursive===!0||I===k})}for(let[A,k]of[...T]){let I=m.get(A);(!I||I.recursive!==k.recursive)&&Se(A)}for(let[A,k]of m)if(!T.has(A))try{let I=(0,ae.watch)(A,{recursive:k.recursive},_);T.set(A,{watcher:I,recursive:k.recursive}),I.on("error",()=>{Se(A),be()}),k.recursive&&_()}catch{Se(A),be()}[...m.keys()].every(A=>T.has(A))&&Oe()}l(J,"syncUnresolvedImportWatcher");function _(){if(L||M){W=!0;return}L=!0,queueMicrotask(()=>{L=!1,j()})}l(_,"scheduleUnresolvedImportResolution");async function j(){let m=C;if(!(!m||M)){M=!0;try{do{W=!1,J();let A=!1;for(let[k,I]of[...x]){let U;if(_i(I.specifier)){let q=I.specifier.search(/[?#]/),$e=q<0?I.specifier:I.specifier.slice(0,q),K=(0,G.resolve)((0,G.dirname)(st(I.importer)),$e),ce=[K,...Ai.map(de=>`${K}${de}`),...Ai.map(de=>(0,G.join)(K,`index${de}`))];for(let de of ce)try{if((0,ae.statSync)(de).isFile()){U=de;break}}catch{}}if(!U&&I.packageName)try{U=(0,Ti.createRequire)(st(I.importer)).resolve(I.specifier)}catch{}U&&(m.watcher.add(U),x.delete(k),S.errorServer.clearErrorForModules([I.importer]),A=!0)}A&&m.ws.send({type:"full-reload",path:"*"}),J()}while(W)}finally{M=!1}}}return l(j,"runUnresolvedImportResolution"),{name:"tempo-annotate",apply:"serve",enforce:"pre",config(m,A){if(!e||A.command!=="serve")return;lo(m),co(m);let k=["react","react-dom"].filter(U=>!m.resolve?.dedupe?.includes(U)),I=oo(m.root);return{resolve:{dedupe:k,...I.length?{alias:I}:{}},...m.css?.devSourcemap===void 0?{css:{devSourcemap:!0}}:{},...r&&m.server?.watch!==null?{server:{watch:{ignored:[Zs]}}}:{}}},resolveId:{order:"pre",async handler(m,A,k){if(m.endsWith(".astro?tempo-component")){let I=await this.resolve(m.slice(0,-16),A,{...k,skipSelf:!0});return I?`\0tempo:astro-component:${encodeURIComponent(I.id)}.js`:null}if(e&&m===Gt)return Xt;if(m===wi)return tn;if(m===xi&&A===tn){let I=await this.resolve(m,A,{...k,skipSelf:!0});return I||Ci()}if(e&&A&&!A.startsWith("\0")){let I=Gc(m);if(!_i(m)&&!I)return null;try{let U=await this.resolve(m,A,{...k,skipSelf:!0});return U||Z(m,A,I),U}catch(U){throw Z(m,A,I),U}}return null}},load:{order:"pre",async handler(m){if(m.startsWith("\0tempo:astro-component:")){let A=decodeURIComponent(m.slice(23,-3)),{readAstroControlsMetadata:k}=await Promise.resolve().then(()=>(Ei(),bi)),I=await k(A,async(U,q)=>(await this.resolve(U,q,{skipSelf:!0}))?.id??null,U=>C?.watcher.add(U),[(0,G.resolve)(g,"tempo/controls.ts"),(0,G.resolve)(f,"controls.ts")]);return p.set(m,new Set(I.dependencies)),`export default {kind:"astro-component",module:${JSON.stringify(A.replaceAll("\\","/"))},__tempoAstroControls:${JSON.stringify(I).replaceAll("<","\\u003c")}};`}return e&&m===Xt?Pr:m===tn?`import { installTempoInteractProjectionSource } from ${JSON.stringify(xi)};
177
177
  let stop;
178
178
  const releaseOwner = () => {
179
179
  if (window.__tempoInteractProjectionOwner === "vite") delete window.__tempoInteractProjectionOwner;
180
180
  };
181
- if (window.parent !== window && !window.__tempoInteractProjectionOwner && (window.name === ${JSON.stringify(xt)} || window.name.startsWith(${JSON.stringify(`${xt}:`)}))) {
181
+ if (window.parent !== window && !window.__tempoInteractProjectionOwner && (window.name === ${JSON.stringify(Ct)} || window.name.startsWith(${JSON.stringify(`${Ct}:`)}))) {
182
182
  window.__tempoInteractProjectionOwner = "vite";
183
183
  const stopSource = installTempoInteractProjectionSource();
184
184
  stop = () => {
@@ -189,9 +189,9 @@ if (window.parent !== window && !window.__tempoInteractProjectionOwner && (windo
189
189
  if (import.meta.hot) import.meta.hot.dispose(() => {
190
190
  stop?.();
191
191
  releaseOwner();
192
- });`:(!e||y==="build"||m.startsWith("\0")||await F.settled(m),null)}},_tempoErrorServer:S.errorServer,_tempoHotUpdateState:{lastHotUpdateMtimeMs(m){return F.lastHotUpdateMtimeMs(m)}},_tempoUnresolvedImportState:{get size(){return w.size},get barePackageCount(){return[...w.values()].filter(m=>m.packageName!==void 0).length},get hasBarePackageWatcher(){return k.size>0&&H()},get barePackageWatchPath(){return H()?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 P!==null},emitUnresolvedImportWatcherErrorForTesting(){for(let{watcher:m}of k.values())m.emit("error",new Error("Simulated unresolved-import watcher failure"))}},configResolved(m){e&&(y=m.command,x=m.server?.hmr!==!1,y==="serve"&&x&&ai(m.plugins??[]),f=Ri(t.root??m.root),g=t.sourceIdentityRoot?Ri((0,G.resolve)(m.root,t.sourceIdentityRoot)):f)},configureServer(m){if(!e||y!=="serve")return;let A=m.config?.base??"/",T=to(A);$o(m),F.installCoverage(m);let I=Ci(),U=m.config?.server?.fs?.allow;if(Array.isArray(U)){let K=[g,...I?[(0,G.dirname)(I)]:[]];for(let ce of K)U.includes(ce)||U.push(ce)}C=m,S.attach(m),J(),m.watcher?.once?.("close",le),m.httpServer?.once("close",le),m.middlewares.use((K,ce,de)=>{if(K.url?.split(/[?#]/)[0]===Kt(A)){T(K,ce,de);return}let _e=m.environments?.client?.moduleGraph;if(_e&&K.url&&(K.method==="GET"||K.method==="HEAD")){let ve=v.observeRequest(_e,K.url,m.config.base,K.headers["sec-fetch-dest"],K.headers["if-none-match"]);ve&&ce.once("finish",()=>{ve(ce.statusCode,ce.getHeader("content-type"),ce.getHeader("etag"))})}let Re=K.url?.match(/^\/tempo-assets\/([a-zA-Z0-9._-]+)(?:\?.*)?$/)?.[1];if(Re){let ve=["public","static"].map(Ee=>(0,G.join)(g,Ee,"tempo-assets",Re)).find(Ee=>(0,ae.existsSync)(Ee));ve&&(K.url=`/@fs/${ve.replace(/\\/g,"/")}`)}Gc(S,m,K,ce,de)});let q=r?ri({target:r,config:m.config}):null;if(q&&(m.middlewares.use(q.prefix),m.httpServer?.on("upgrade",q.upgrade)),r){let K=ti({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",K),m.watcher?.once?.("close",K)}F.installSweep(m,{sweepIntervalMs:Xc,listExtraFiles:c(()=>S.errorServer.errorFiles,"listExtraFiles"),afterSweep:c(()=>S.pollRecovery(m),"afterSweep")}),zc(m);let Oe=c(K=>{let ce=K.send.bind(K);K.send=((...de)=>{let _e=de[0];if(typeof _e=="object"&&_e!==null&&"type"in _e){let Re=_e;if(Re.type==="prune"){let ve=m.environments?.client?.moduleGraph;ve&&v.observePrune(ve,Re.paths??[])}if(Re.type==="error")S.recordHmrError(Re.err);else if(Re.type==="update"&&!$.has(_e)){$.add(_e);let ve=Re,Ee=ve.updates,at=Ee?z.filter(Ee):void 0;Ee&&at&&at.length!==Ee.length&&(ve.updates=at);let Vi=at?.map(pr=>pr.path).filter(pr=>typeof pr=="string")??[];if(S.errorServer.clearErrorForModules(Vi),Ee&&Ee.length>0&&at?.length===0)return}}return ce(...de)})},"interceptHmrSend");return Oe(m.ws),()=>{let K=m.environments?.client?.hot;K&&K!==m.ws&&Oe(K),q&&m.middlewares.use(q.fallthrough)}},closeBundle(){p.clear(),C=void 0,F.clear(),z.clear(),v.clear(),S.reset(),le()},hotUpdate:{order:"post",async handler(m){let A=d(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),B(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"&&X(m.file),m.type==="update"&&S.hasActiveCompileError(m.file)&&await S.recover(m.server,m.file))return[];if(m.type==="delete")return h.forgetDefaultExportIdentity(m.file),v.suppressDeletion(this.environment.moduleGraph,m.modules)?[]:void 0;if(m.type==="update"&&await E(m))return[];if(m.type==="update")return Q(m.file,this.environment.moduleGraph,m.modules)}},handleHotUpdate:{order:"post",async handler(m){let A=d(m.file,m.server.moduleGraph,m.modules);if(m.modules.splice(0,m.modules.length,...A),!!e)return B(m.file)?[]:(m.modules.length>0&&F.observeUpdate(m.server,m.file),X(m.file),S.hasActiveCompileError(m.file)&&await S.recover(m.server,m.file)?[]:await E(m)?[]:Q(m.file,m.server.moduleGraph,m.modules))}},transformIndexHtml(m,A){if(!e||y!=="serve")return;let T=[{tag:"script",attrs:{src:Kt(C?.config.base??"/")},injectTo:"head-prepend"}];x&&T.push({tag:"script",attrs:{type:"module",src:Gt},injectTo:"head-prepend"}),Wc(m)||T.push({tag:"meta",attrs:{name:Oc,content:f},injectTo:"head"}),Bc(m)||T.push({tag:"meta",attrs:{name:$c,content:g},injectTo:"head"});let I=(0,ge.createTempoHostIdentity)("vite",{root:f,pluginActive:!0}).workspaceNonce;I&&!Jc(m)&&T.push({tag:"meta",attrs:{name:ge.TEMPO_WORKSPACE_NONCE_META_NAME,content:I},injectTo:"head"});let U=A?.originalUrl??A?.path,q=U?Dc(U):!1;return U&&!q&&(T.push({tag:"script",children:Lc,injectTo:"head-prepend"}),T.push({tag:"script",attrs:{type:"module",src:wi},injectTo:"head-prepend"})),T.length>0?T:void 0},async transform(m,A){if(!e||y==="build"||(C&&Lo(C),A.startsWith("\0")))return null;let T=st(A);if(T.replace(/\\/g,"/").endsWith("/vite/dist/client/client.mjs")){let I=di(m);return I===m?null:{code:I,map:null}}return h.annotateJsxModule(this,m,T)}}}var ae,ki,G,Ti,ge,Nc,Mc,Oc,$c,wi,tn,xi,Lc,Hc,Ai,jc,Xc,Pi=O(()=>{Ir();Lt();Nr();so();uo();wo();Do();ae=require("node:fs"),ki=require("node:module"),G=require("node:path"),Ti=require("node:url");ds();fs();Ws();Js();oi();ii();ge=require("@tempo-sdk-public/host-identity");yt();li();pi();fi();yi();qt();Nc=["**/*.tsx","**/*.jsx"],Mc=["**/node_modules/**"],Oc="tempo-project-root",$c="tempo-source-identity-root",wi="/@tempo/interact-projection",tn="\0tempo:interact-projection",xi="tempo-sdk/canvas/interact-projection";c(Ci,"resolveOwnInteractProjectionModule");Lc=`
192
+ });`:(!e||h==="build"||m.startsWith("\0")||await F.settled(m),null)}},_tempoErrorServer:S.errorServer,_tempoHotUpdateState:{lastHotUpdateMtimeMs(m){return F.lastHotUpdateMtimeMs(m)}},_tempoUnresolvedImportState:{get size(){return x.size},get barePackageCount(){return[...x.values()].filter(m=>m.packageName!==void 0).length},get hasBarePackageWatcher(){return T.size>0&&H()},get barePackageWatchPath(){return H()?T.keys().next().value:void 0},get hasUnresolvedImportWatcher(){return T.size>0},get unresolvedImportWatchPath(){return T.keys().next().value},get unresolvedImportWatchPaths(){return[...T.keys()]},get hasUnresolvedImportWatchRearm(){return N!==null},emitUnresolvedImportWatcherErrorForTesting(){for(let{watcher:m}of T.values())m.emit("error",new Error("Simulated unresolved-import watcher failure"))}},configResolved(m){e&&(h=m.command,v=m.server?.hmr!==!1,h==="serve"&&v&&ai(m.plugins??[]),f=Ri(t.root??m.root),g=t.sourceIdentityRoot?Ri((0,G.resolve)(m.root,t.sourceIdentityRoot)):f)},configureServer(m){if(!e||h!=="serve")return;let A=m.config?.base??"/",k=to(A);$o(m),F.installCoverage(m);let I=Ci(),U=m.config?.server?.fs?.allow;if(Array.isArray(U)){let K=[g,...I?[(0,G.dirname)(I)]:[]];for(let ce of K)U.includes(ce)||U.push(ce)}C=m,S.attach(m),J(),m.watcher?.once?.("close",le),m.httpServer?.once("close",le),m.middlewares.use((K,ce,de)=>{if(K.url?.split(/[?#]/)[0]===Kt(A)){k(K,ce,de);return}let _e=m.environments?.client?.moduleGraph;if(_e&&K.url&&(K.method==="GET"||K.method==="HEAD")){let ve=b.observeRequest(_e,K.url,m.config.base,K.headers["sec-fetch-dest"],K.headers["if-none-match"]);ve&&ce.once("finish",()=>{ve(ce.statusCode,ce.getHeader("content-type"),ce.getHeader("etag"))})}let Re=K.url?.match(/^\/tempo-assets\/([a-zA-Z0-9._-]+)(?:\?.*)?$/)?.[1];if(Re){let ve=["public","static"].map(Ee=>(0,G.join)(g,Ee,"tempo-assets",Re)).find(Ee=>(0,ae.existsSync)(Ee));ve&&(K.url=`/@fs/${ve.replace(/\\/g,"/")}`)}Zc(S,m,K,ce,de)});let q=r?ri({target:r,config:m.config}):null;if(q&&(m.middlewares.use(q.prefix),m.httpServer?.on("upgrade",q.upgrade)),r){let K=ti({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",K),m.watcher?.once?.("close",K)}F.installSweep(m,{sweepIntervalMs:eu,listExtraFiles:l(()=>S.errorServer.errorFiles,"listExtraFiles"),afterSweep:l(()=>S.pollRecovery(m),"afterSweep")}),tu(m);let $e=l(K=>{let ce=K.send.bind(K);K.send=((...de)=>{let _e=de[0];if(typeof _e=="object"&&_e!==null&&"type"in _e){let Re=_e;if(Re.type==="prune"){let ve=m.environments?.client?.moduleGraph;ve&&b.observePrune(ve,Re.paths??[])}if(Re.type==="error")S.recordHmrError(Re.err);else if(Re.type==="update"&&!$.has(_e)){$.add(_e);let ve=Re,Ee=ve.updates,at=Ee?z.filter(Ee):void 0;Ee&&at&&at.length!==Ee.length&&(ve.updates=at);let Vi=at?.map(pr=>pr.path).filter(pr=>typeof pr=="string")??[];if(S.errorServer.clearErrorForModules(Vi),Ee&&Ee.length>0&&at?.length===0)return}}return ce(...de)})},"interceptHmrSend");return $e(m.ws),()=>{let K=m.environments?.client?.hot;K&&K!==m.ws&&$e(K),q&&m.middlewares.use(q.fallthrough)}},closeBundle(){p.clear(),C=void 0,F.clear(),z.clear(),b.clear(),S.reset(),le()},hotUpdate:{order:"post",async handler(m){let A=d(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),B(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"&&X(m.file),m.type==="update"&&S.hasActiveCompileError(m.file)&&await S.recover(m.server,m.file))return[];if(m.type==="delete")return y.forgetDefaultExportIdentity(m.file),b.suppressDeletion(this.environment.moduleGraph,m.modules)?[]:void 0;if(m.type==="update"&&await w(m))return[];if(m.type==="update")return Q(m.file,this.environment.moduleGraph,m.modules)}},handleHotUpdate:{order:"post",async handler(m){let A=d(m.file,m.server.moduleGraph,m.modules);if(m.modules.splice(0,m.modules.length,...A),!!e)return B(m.file)?[]:(m.modules.length>0&&F.observeUpdate(m.server,m.file),X(m.file),S.hasActiveCompileError(m.file)&&await S.recover(m.server,m.file)?[]:await w(m)?[]:Q(m.file,m.server.moduleGraph,m.modules))}},transformIndexHtml(m,A){if(!e||h!=="serve")return;let k=[{tag:"script",attrs:{src:Kt(C?.config.base??"/")},injectTo:"head-prepend"}];v&&k.push({tag:"script",attrs:{type:"module",src:Gt},injectTo:"head-prepend"}),zc(m)||k.push({tag:"meta",attrs:{name:jc,content:f},injectTo:"head"}),qc(m)||k.push({tag:"meta",attrs:{name:Uc,content:g},injectTo:"head"});let I=(0,ge.createTempoHostIdentity)("vite",{root:f,pluginActive:!0}).workspaceNonce;I&&!Yc(m)&&k.push({tag:"meta",attrs:{name:ge.TEMPO_WORKSPACE_NONCE_META_NAME,content:I},injectTo:"head"});let U=A?.originalUrl??A?.path,q=U?Bc(U):!1;return U&&!q&&(k.push({tag:"script",children:Vc,injectTo:"head-prepend"}),k.push({tag:"script",attrs:{type:"module",src:wi},injectTo:"head-prepend"})),k.length>0?k:void 0},async transform(m,A){if(!e||h==="build"||(C&&Lo(C),A.startsWith("\0")))return null;let k=st(A);if(k.replace(/\\/g,"/").endsWith("/vite/dist/client/client.mjs")){let I=di(m);return I===m?null:{code:I,map:null}}return y.annotateJsxModule(this,m,k)}}}var ae,Ti,G,ki,ge,Dc,Hc,jc,Uc,wi,tn,xi,Vc,Jc,Ai,Kc,eu,Pi=O(()=>{Ir();Ft();Nr();so();uo();wo();Do();ae=require("node:fs"),Ti=require("node:module"),G=require("node:path"),ki=require("node:url");ds();fs();Ws();Js();oi();ii();ge=require("@tempo-sdk-public/host-identity");St();li();pi();fi();yi();qt();Dc=["**/*.tsx","**/*.jsx"],Hc=["**/node_modules/**"],jc="tempo-project-root",Uc="tempo-source-identity-root",wi="/@tempo/interact-projection",tn="\0tempo:interact-projection",xi="tempo-sdk/canvas/interact-projection";l(Ci,"resolveOwnInteractProjectionModule");Vc=`
193
193
  (function() {
194
- if (window.parent === window || (window.name !== ${JSON.stringify(xt)} && !window.name.startsWith(${JSON.stringify(`${xt}:`)}))) return;
194
+ if (window.parent === window || (window.name !== ${JSON.stringify(Ct)} && !window.name.startsWith(${JSON.stringify(`${Ct}:`)}))) return;
195
195
  var roots = new Map();
196
196
  var existing = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
197
197
  if (existing) {
@@ -220,6 +220,6 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
220
220
  checkDCE: function() {},
221
221
  onScheduleFiberRoot: function() {}
222
222
  };
223
- })();`;c(st,"cleanModuleId");c(Fc,"isCanvasHostRequest");c(Dc,"isDeclarativeCanvasHostRequest");Hc=256,Ai=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"],jc=1e3;c(_i,"isRelativeImportSpecifier");c(Uc,"barePackageName");c(Vc,"resolvedIdMatchesFile");c(Ri,"resolveCanonicalRoot");c(Wc,"hasRootMetaTag");c(Bc,"hasSourceIdentityRootMetaTag");c(Jc,"hasWorkspaceNonceMetaTag");c(Kc,"runsVueSourceAnnotation");c(Gc,"handleTempoMiddleware");Xc=ht;c(zc,"installTailwindScanNet");c(Ii,"tempoVitePlugin")});var $i={};Pt($i,{astroAnnotationPlugins:()=>Mi,default:()=>qc,tempoAstro:()=>rn,withTempoAstro:()=>Oi});function rn(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[l,a]=process.versions.node.split(".").map(Number);if(l<22||l===22&&a<12)throw new Error("Tempo Astro support requires Node 22.12 or newer");let p=(0,Ni.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 d=ye.realpathSync.native((0,It.fileURLToPath)(e.root)),{root:f,tempoRoot:h,canvasesRoot:g}=An(d,t.root,t.canvasesRoot),y=(0,It.fileURLToPath)(i()),x=[g,(0,he.resolve)(h,".tempo/library-canvases"),(0,he.resolve)(h,".tempo/asset-edit-previews")],S=Xn(f,x,y,t.styles?.map(k=>(0,he.resolve)(d,k))??_n(d));o({pattern:"/__tempo/astro/[...storyboard]",entrypoint:S.entrypoint,prerender:!1}),s("head-inline",ro(await Tr())),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(f).replaceAll("<","\\u003c")};document.head.append(m)}`);let w=(0,It.fileURLToPath)(new URL(Ce("astro.ts").endsWith(".ts")?"./astro/document-client.ts":"./astro/document-client.js",Ce("astro.ts")));s("page",`import { startAstroDocumentClient } from ${JSON.stringify(w)}; startAstroDocumentClient(import.meta.hot);`),n({vite:{plugins:[{name:"tempo:astro-identity",enforce:"pre",configureServer(k){k.middlewares.use((L,M,W)=>{if(L.method!=="GET"||L.url?.split("?")[0]!==it.TEMPO_HOST_IDENTITY_ENDPOINT)return W();M.setHeader(it.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),M.setHeader("Cache-Control","no-store"),M.setHeader("Content-Type","application/json"),M.end(JSON.stringify({...(0,it.createTempoHostIdentity)("astro",{root:h,pluginActive:!0}),capabilities:{astroComponents:1}}))})}},qn(f,[...x,(0,he.resolve)(y,"*.astro")]),...Mi(f,y),Ii({root:f,enabled:!0}),S.plugin]}})}}}}function Mi(t,e){let r=new Set,n=new WeakMap,o=c(l=>{let a=n.get(l);return a||(a=new Map,n.set(l,a)),a},"receiptMap"),i=(0,It.fileURLToPath)(new URL("./astro/runtime.js",Ce("astro.ts"))),s=Ce("astro.ts").endsWith(".ts")?i.replace(/\.js$/,".ts"):i;return[{name:"tempo:astro-source",enforce:"pre",transform:{order:"pre",handler(l,a,u){let p=a.endsWith(".astro"),d=u?.ssr&&/\.[jt]sx?$/.test(a);if(!p&&!d||a.includes("?")||!(0,he.isAbsolute)(a))return;let f=o(this.environment);f.delete(a);let h;try{h=ye.realpathSync.native(a)}catch{return}if(e&&!(0,he.relative)(e,h).startsWith(".."))return;let g=(0,he.relative)(t,h).replaceAll("\\","/");if(!g||g.startsWith("../")||(0,he.isAbsolute)(g)||g.split("/").includes("node_modules"))return;let y=(0,ye.openSync)(h,"r"),x;try{let w=(0,ye.fstatSync)(y),C=(0,ye.readFileSync)(y,"utf8"),k=(0,ye.fstatSync)(y);if(l!==C||!["mtimeMs","ctimeMs","size","ino","dev"].every(M=>w[M]===k[M]))return;let L=p?xe(l):null;if(L&&L.kind!=="ok")return;x={filepath:g,sourceVersion:L?.sourceVersion??ke(l),modifiedTs:Math.trunc(w.mtimeMs)}}finally{(0,ye.closeSync)(y)}if(d){f.set(a,{metadata:x});return}let S=En(l,x,a);return S.kind!=="ok"&&this.error(S.message),f.set(a,{metadata:x,occurrenceFactory:S.occurrenceFactory}),{code:S.code,map:S.map}}}},{name:"tempo:astro-compiled",enforce:"post",transform:{order:"post",handler(l,a){let u=c(f=>{r.has(a)||(r.add(a),this.warn(f))},"warn");if(e&&a.endsWith(".astro")&&!(0,he.relative)(e,a).startsWith(".."))return br(l,a,null,s,"$$tempoStoryboardHostId",u);let p=o(this.environment),d=p.get(a);if(d)return p.delete(a),d.occurrenceFactory?br(l,a,d.metadata,s,d.occurrenceFactory,u):xn(l,a,d.metadata,s)}}}]}function Oi(t){return t instanceof Promise?t.then(e=>Oi(e)):{...t,integrations:[...t.integrations??[],rn()]}}var ye,Ni,he,It,it,qc,Li=O(()=>{ye=require("node:fs"),Ni=require("node:module"),he=require("node:path"),It=require("node:url");Je();wn();Xe();it=require("@tempo-sdk-public/host-identity");Cn();Rn();zn();Yn();Ir();Pi();Lt();c(rn,"tempoAstro");c(Mi,"astroAnnotationPlugins");qc=rn;c(Oi,"withTempoAstro")});var ji={};Pt(ji,{astroHostId:()=>Di,instrumentCreateComponent:()=>eu,instrumentFrameworkComponent:()=>Zc,instrumentRenderComponent:()=>tu});function Zc(t,e){return(typeof t=="function"||t&&typeof t=="object"&&"$$typeof"in t)&&Object.isExtensible(t)&&!Object.prototype.hasOwnProperty.call(t,lr)&&Object.defineProperty(t,lr,{value:e}),t}function Di(){return globalThis.crypto.randomUUID()}function on(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 Hi(t,e){if(!t||typeof t!="object")return t;if(t[Qc]&&t.content)return{...t,content:Hi(t.content,e)};if(!t[Yc])return t;let r=[...t.htmlParts];return r[r.length-1]+=on("m",e),Object.assign(Object.create(Object.getPrototypeOf(t)),t,{htmlParts:r})}function eu(t,e){return(...r)=>{let n=c(s=>function(...l){return sn(s.apply(this,l),a=>Hi(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,lr,{value:e}),i}}function tu(t){return(e,r,n,o={},...i)=>{let s=o[Fi];if(!s)return t(e,r,n,o,...i);let l={...o};return delete l[Fi],sn(t(e,r,n,l,...i),a=>({render(u){let p=Di();return u.write((0,nn.markHTMLString)(on("b",{occurrence:p,source:s,definition:n?.[lr]??null}))),sn(a.render(u),()=>u.write((0,nn.markHTMLString)(on("e",{occurrence:p}))))}}))}}var nn,Fi,lr,Yc,Qc,Ui=O(()=>{nn=require("astro/runtime/server/index.js"),Fi="__tempo_astro_callsite__",lr=Symbol.for("tempo.astro.definition"),Yc=Symbol.for("astro.renderTemplateResult"),Qc=Symbol.for("astro.headAndContent");c(Zc,"instrumentFrameworkComponent");c(Di,"astroHostId");c(on,"comment");c(sn,"thenOrValue");c(Hi,"withReceipt");c(eu,"instrumentCreateComponent");c(tu,"instrumentRenderComponent")});var nu={};Pt(nu,{getEntry:()=>ru});module.exports=fr(nu);var cr={};function ru(t){if(cr[t])return cr[t];switch(t){case"astro":return cr[t]=(Li(),fr($i));case"astro/runtime":return cr[t]=(Ui(),fr(ji));default:throw new Error("Unknown Tempo runtime entry: "+t)}}c(ru,"getEntry");0&&(module.exports={getEntry});
223
+ })();`;l(st,"cleanModuleId");l(Wc,"isCanvasHostRequest");l(Bc,"isDeclarativeCanvasHostRequest");Jc=256,Ai=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"],Kc=1e3;l(_i,"isRelativeImportSpecifier");l(Gc,"barePackageName");l(Xc,"resolvedIdMatchesFile");l(Ri,"resolveCanonicalRoot");l(zc,"hasRootMetaTag");l(qc,"hasSourceIdentityRootMetaTag");l(Yc,"hasWorkspaceNonceMetaTag");l(Qc,"runsVueSourceAnnotation");l(Zc,"handleTempoMiddleware");eu=yt;l(tu,"installTailwindScanNet");l(Ii,"tempoVitePlugin")});var $i={};Nt($i,{astroAnnotationPlugins:()=>Mi,default:()=>ru,tempoAstro:()=>rn,withTempoAstro:()=>Oi});function rn(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,Ni.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 d=ye.realpathSync.native((0,Pt.fileURLToPath)(e.root)),{root:f,tempoRoot:y,canvasesRoot:g}=An(d,t.root,t.canvasesRoot),h=(0,Pt.fileURLToPath)(i()),v=[g,(0,he.resolve)(y,".tempo/library-canvases"),(0,he.resolve)(y,".tempo/asset-edit-previews")],S=Xn(f,v,h,t.styles?.map(T=>(0,he.resolve)(d,T))??_n(d));o({pattern:"/__tempo/astro/[...storyboard]",entrypoint:S.entrypoint,prerender:!1}),s("head-inline",ro(await kr())),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(f).replaceAll("<","\\u003c")};document.head.append(m)}`);let x=(0,Pt.fileURLToPath)(new URL(Ce("astro.ts").endsWith(".ts")?"./astro/document-client.ts":"./astro/document-client.js",Ce("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((L,M,W)=>{if(L.method!=="GET"||L.url?.split("?")[0]!==it.TEMPO_HOST_IDENTITY_ENDPOINT)return W();M.setHeader(it.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),M.setHeader("Cache-Control","no-store"),M.setHeader("Content-Type","application/json"),M.end(JSON.stringify({...(0,it.createTempoHostIdentity)("astro",{root:y,pluginActive:!0}),capabilities:{astroComponents:1}}))})}},qn(f,[...v,(0,he.resolve)(h,"*.astro")]),...Mi(f,h),Ii({root:f,enabled:!0}),S.plugin]}})}}}}function Mi(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,Pt.fileURLToPath)(new URL("./astro/runtime.js",Ce("astro.ts"))),s=Ce("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"),d=u?.ssr&&/\.[jt]sx?$/.test(a);if(!p&&!d||a.includes("?")||!(0,he.isAbsolute)(a))return;let f=o(this.environment);f.delete(a);let y;try{y=ye.realpathSync.native(a)}catch{return}if(e&&!(0,he.relative)(e,y).startsWith(".."))return;let g=(0,he.relative)(t,y).replaceAll("\\","/");if(!g||g.startsWith("../")||(0,he.isAbsolute)(g)||g.split("/").includes("node_modules"))return;let h=(0,ye.openSync)(y,"r"),v;try{let x=(0,ye.fstatSync)(h),C=(0,ye.readFileSync)(h,"utf8"),T=(0,ye.fstatSync)(h);if(c!==C||!["mtimeMs","ctimeMs","size","ino","dev"].every(M=>x[M]===T[M]))return;let L=p?xe(c):null;if(L&&L.kind!=="ok")return;v={filepath:g,sourceVersion:L?.sourceVersion??Te(c),modifiedTs:Math.trunc(x.mtimeMs)}}finally{(0,ye.closeSync)(h)}if(d){f.set(a,{metadata:v});return}let S=En(c,v,a);return S.kind!=="ok"&&this.error(S.message),f.set(a,{metadata:v,occurrenceFactory:S.occurrenceFactory}),{code:S.code,map:S.map}}}},{name:"tempo:astro-compiled",enforce:"post",transform:{order:"post",handler(c,a){let u=l(f=>{r.has(a)||(r.add(a),this.warn(f))},"warn");if(e&&a.endsWith(".astro")&&!(0,he.relative)(e,a).startsWith(".."))return br(c,a,null,s,"$$tempoStoryboardHostId",u);let p=o(this.environment),d=p.get(a);if(d)return p.delete(a),d.occurrenceFactory?br(c,a,d.metadata,s,d.occurrenceFactory,u):xn(c,a,d.metadata,s)}}}]}function Oi(t){return t instanceof Promise?t.then(e=>Oi(e)):{...t,integrations:[...t.integrations??[],rn()]}}var ye,Ni,he,Pt,it,ru,Li=O(()=>{ye=require("node:fs"),Ni=require("node:module"),he=require("node:path"),Pt=require("node:url");Ke();wn();ze();it=require("@tempo-sdk-public/host-identity");Cn();Rn();zn();Yn();Ir();Pi();Ft();l(rn,"tempoAstro");l(Mi,"astroAnnotationPlugins");ru=rn;l(Oi,"withTempoAstro")});var ji={};Nt(ji,{astroHostId:()=>Di,instrumentCreateComponent:()=>iu,instrumentFrameworkComponent:()=>su,instrumentRenderComponent:()=>au});function su(t,e){return(typeof t=="function"||t&&typeof t=="object"&&"$$typeof"in t)&&Object.isExtensible(t)&&!Object.prototype.hasOwnProperty.call(t,lr)&&Object.defineProperty(t,lr,{value:e}),t}function Di(){return globalThis.crypto.randomUUID()}function on(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 Hi(t,e){if(!t||typeof t!="object")return t;if(t[ou]&&t.content)return{...t,content:Hi(t.content,e)};if(!t[nu])return t;let r=[...t.htmlParts];return r[r.length-1]+=on("m",e),Object.assign(Object.create(Object.getPrototypeOf(t)),t,{htmlParts:r})}function iu(t,e){return(...r)=>{let n=l(s=>function(...c){return sn(s.apply(this,c),a=>Hi(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,lr,{value:e}),i}}function au(t){return(e,r,n,o={},...i)=>{let s=o[Fi];if(!s)return t(e,r,n,o,...i);let c={...o};return delete c[Fi],sn(t(e,r,n,c,...i),a=>({render(u){let p=Di();return u.write((0,nn.markHTMLString)(on("b",{occurrence:p,source:s,definition:n?.[lr]??null}))),sn(a.render(u),()=>u.write((0,nn.markHTMLString)(on("e",{occurrence:p}))))}}))}}var nn,Fi,lr,nu,ou,Ui=O(()=>{nn=require("astro/runtime/server/index.js"),Fi="__tempo_astro_callsite__",lr=Symbol.for("tempo.astro.definition"),nu=Symbol.for("astro.renderTemplateResult"),ou=Symbol.for("astro.headAndContent");l(su,"instrumentFrameworkComponent");l(Di,"astroHostId");l(on,"comment");l(sn,"thenOrValue");l(Hi,"withReceipt");l(iu,"instrumentCreateComponent");l(au,"instrumentRenderComponent")});var cu={};Nt(cu,{getEntry:()=>lu});module.exports=fr(cu);var cr={};function lu(t){if(cr[t])return cr[t];switch(t){case"astro":return cr[t]=(Li(),fr($i));case"astro/runtime":return cr[t]=(Ui(),fr(ji));default:throw new Error("Unknown Tempo runtime entry: "+t)}}l(lu,"getEntry");0&&(module.exports={getEntry});
224
224
 
225
225
  return module.exports;};