sveld 0.36.9 → 0.36.10

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,16 +1,16 @@
1
1
  class z{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:(e)=>this.replacement=e}}replace(e,t,n,r){if(e&&t)if(n!=null)e[t][n]=r;else e[t]=r}remove(e,t,n){if(e&&t)if(n!==null&&n!==void 0)e[t].splice(n,1);else delete e[t]}}class te extends z{constructor(e,t){super();this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:(n)=>this.replacement=n},this.enter=e,this.leave=t}visit(e,t,n,r){if(e){if(this.enter){let o=this.should_skip,a=this.should_remove,u=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,e,t,n,r),this.replacement)e=this.replacement,this.replace(t,n,r,e);if(this.should_remove)this.remove(t,n,r);let s=this.should_skip,l=this.should_remove;if(this.should_skip=o,this.should_remove=a,this.replacement=u,s)return e;if(l)return null}let i;for(i in e){let o=e[i];if(o&&typeof o==="object"){if(Array.isArray(o)){let a=o;for(let u=0;u<a.length;u+=1){let s=a[u];if(he(s)){if(!this.visit(s,e,i,u))u--}}}else if(he(o))this.visit(o,e,i,null)}}if(this.leave){let o=this.replacement,a=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,e,t,n,r),this.replacement)e=this.replacement,this.replace(t,n,r,e);if(this.should_remove)this.remove(t,n,r);let u=this.should_remove;if(this.replacement=o,this.should_remove=a,u)return null}}return e}}function he(e){return e!==null&&typeof e==="object"&&"type"in e&&typeof e.type==="string"}function be(e,{enter:t,leave:n}){return new te(t,n).visit(e,null)}function D(e){return typeof e==="object"&&e!==null}function tt(e){return D(e)&&e.type==="VariableDeclaration"&&Array.isArray(e.declarations)}function J(e){return D(e)&&e.type==="Literal"}function B(e){return D(e)&&e.type==="Identifier"&&typeof e.name==="string"}function rt(e){return D(e)&&e.type==="MemberExpression"}function q(e){return D(e)&&e.type==="ObjectExpression"&&Array.isArray(e.properties)}function Ue(e){return D(e)&&e.type==="CallExpression"}function Ee(e,t){if(!Ue(e))return!1;return!!e.callee&&D(e.callee)&&e.callee.type==="Identifier"&&e.callee.name===t}function Xe(e){if(D(e)&&(e.type==="TSAsExpression"||e.type==="TSSatisfiesExpression")&&"expression"in e)return Xe(e.expression);return e}function it(e){if(D(e)&&(e.type==="TSAsExpression"||e.type==="TSSatisfiesExpression")&&"typeAnnotation"in e)return e.typeAnnotation;return}function ze(e){return D(e)&&e.type==="NewExpression"}function re(e,t){if(!ze(e))return!1;return!!e.callee&&D(e.callee)&&e.callee.type==="Identifier"&&e.callee.name===t}function Ce(e){if(!D(e)||typeof e.type!=="string")return null;if(e.type==="Literal"){let t=e.value;if(typeof t==="string")return t;return t==null?null:String(t)}if(e.type==="TemplateLiteral"){let t=e.quasis;if(t?.length===1){let n=t[0]?.value?.cooked;return n==null?null:n}}return null}var qe=Symbol("sveld.parsedComponentTypeScriptMetadata");function st(e){return e[qe]}function at(e,t){if(t.length===0)return;let n=new Set(e.props.map((r)=>r.name));for(let r of t){if(n.has(r.name))continue;n.add(r.name),e.props.push({name:r.name,kind:"let",constant:!1,type:r.type,typeSource:"typescript",...r.description?{description:r.description}:{},isFunction:r.type.includes("=>"),isFunctionDeclaration:!1,isRequired:r.isRequired,reactive:!1})}}var He=/\w/;function Ye(e,t){let n=e.trim();if(!n.startsWith("{")||!n.endsWith("}"))return;let r=n.slice(1,-1),i=[],o=0,a="";for(let u of r)if(u==="{"||u==="<"||u==="("||u==="[")o++,a+=u;else if(u==="}"||u===">"||u===")"||u==="]")o--,a+=u;else if((u===";"||u===",")&&o===0)i.push(a.trim()),a="";else a+=u;if(a.trim())i.push(a.trim());for(let u of i){if(!u.startsWith(t))continue;let s=u.slice(t.length);if(s.length>0&&He.test(s[0]))continue;let l=s.trimStart();if(l.startsWith("?"))l=l.slice(1).trimStart();if(l.startsWith(":"))return l.slice(1).trim()}return}function xe(e,t,n){let r=n;if(r.computed||r.object?.type!=="Identifier"||r.property?.type!=="Identifier")return;let i=r.object.name,o=r.property.name;if(!i||!o)return;if(e.wholePropsLocals.has(i))return t.getPropTypeByLocalOrPublic(o);let a=t.getPropTypeByLocalOrPublic(i)??t.findVariableTypeAndDescription(i)?.type;if(!a)return;return Ye(a,o)}function ie(e,t,n,r,i){e.diagnosticRecords.push({component:e.componentFilePath,kind:t,name:n,message:r,...i?{source:i}:{}})}var oe=/[\r\n]+/g;function Qe(e){if(e.sourceLineStartOffsetsCache)return e.sourceLineStartOffsetsCache;let t=[0];if(e.source){let n=e.source.indexOf(`
2
2
  `);while(n!==-1)t.push(n+1),n=e.source.indexOf(`
3
- `,n+1)}return e.sourceLineStartOffsetsCache=t,t}function Te(e,t){if(!e.source||t<0||t>e.source.length)return;let n=Qe(e),r=0,i=n.length-1;while(r<=i){let o=Math.floor((r+i)/2),a=n[o],u=n[o+1]??Number.POSITIVE_INFINITY;if(t<a)i=o-1;else if(t>=u)r=o+1;else return{line:o+1,column:t-a}}return}function Pe(e,t,n){if(t===void 0||n===void 0||n<t)return;let r=Te(e,t),i=Te(e,n);if(!r||!i)return;return{start:r,end:i}}function K(e,t){if(!t||typeof t!=="object")return;let n="start"in t&&typeof t.start==="number"?t.start:void 0,r="end"in t&&typeof t.end==="number"?t.end:void 0;return Pe(e,n,r)}function se(e,t){if(!t||t.length===0)return;let n=[...t];while(n.length>1){let s=n[n.length-1];if(s.tag!==void 0||!s.raw.trim().endsWith("*/"))break;n.pop()}let r=n[0],i=r.raw.indexOf(`@${r.tag??""}`),o=r.start+Math.max(i,0),a=n[n.length-1],u=a.start+a.raw.length;return Pe(e,o,u)}function x(e,t,n){return e.source?.slice(t,n)}function H(e,t){if(!t||typeof t!=="object")return;let n="start"in t&&typeof t.start==="number"?t.start:void 0,r="end"in t&&typeof t.end==="number"?t.end:void 0;if(n===void 0||r===void 0)return;return x(e,n,r)?.replace(oe," ")}function A(e){return e===void 0||e===""?void 0:e}function ht(e,t,n,r){if(A(n)===void 0)return;if(e.trackPropLocalName(n),t.props.has(n)){let i=t.props.get(n);t.props.set(n,{...i,...r})}else t.props.set(n,r)}function ae(e,t,n,r=0){let i,o,a=!1;if(!n||typeof n!=="object"||!("type"in n))return{value:i,type:o,isFunction:a};let u=ke(e,t,n);if(n.type==="ObjectExpression"||n.type==="BinaryExpression"||n.type==="ArrayExpression"||n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end)?.replace(oe," ");if(o=i,a=n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression",n.type==="BinaryExpression"){let l=n;if(l.left&&typeof l.left==="object"&&"type"in l.left&&l.left.type==="Literal"&&"value"in l.left&&typeof l.left.value==="string")o="string"}if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression")o=_e(n),i=ve(t,n)}else if(n.type==="UnaryExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);if(s.argument){if(typeof s.argument==="object"&&"type"in s.argument&&s.argument.type==="UnaryExpression")o=ae(e,t,s.argument).type;else if(typeof s.argument==="object"&&"value"in s.argument)o=typeof s.argument.value}}else if(n.type==="NewExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);if(s.callee&&typeof s.callee==="object"&&"type"in s.callee&&s.callee.type==="Identifier"){let l=s.callee.name;if(l==="Date")o="Date";else if(l==="Map")o="Map<any, any>";else if(l==="Set")o="Set<any>";else if(l==="WeakMap")o="WeakMap<object, any>";else if(l==="WeakSet")o="WeakSet<object>";else if(l==="Array")o="any[]";else if(l==="RegExp"||l==="Regexp")o="RegExp";else if(l==="Error")o="Error";else o=l}}else if(n.type==="CallExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);let l=s.callee,p=l&&typeof l==="object"&&"type"in l&&l.type==="Identifier"?l.name:void 0;if((p==="$derived"||p==="$state")&&s.arguments.length===1&&r<5)return{...ae(e,t,s.arguments[0],r+1),value:i,defaultValue:u};if(p){let c=en(e,t,p);if(c)return{value:i,type:void 0,isFunction:!1,defaultValue:u,resolvedType:c};if(t.funcDecls.has(p)||nn(t,p))return{value:i,type:void 0,isFunction:!1,defaultValue:u,pendingCallDefault:{calleeName:p}};let b=t.valueImportBindingsByLocalName.get(p);if(b)return{value:i,type:void 0,isFunction:!1,defaultValue:u,pendingCallDefault:{calleeName:p,importSource:b.source,importedName:b.importedName}}}return{value:i,type:void 0,isFunction:!1,defaultValue:u,pendingCallDefault:{calleeName:p??Ze(t,l)}}}else if(n.type==="Identifier"){let s=n;if(r<5){let l=Se(t,s.name);if(l){let p=ae(e,t,l,r+1),c=e.resolveLocalVarJSDoc(s.name);return{...p,resolvedType:c?.type??p.resolvedType,resolvedDescription:c?.description??p.resolvedDescription,resolvedParams:c?.params??p.resolvedParams,resolvedReturnType:c?.returnType??p.resolvedReturnType}}if(t.funcDecls.has(s.name)){let p=e.resolveLocalVarJSDoc(s.name),c=t.funcDecls.get(s.name);return{value:c?ve(t,c):void 0,type:void 0,isFunction:!0,defaultValue:c?ke(e,t,c):void 0,resolvedType:p?.type??sn(p,c),resolvedDescription:p?.description,resolvedParams:p?.params,resolvedReturnType:p?.returnType}}}if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end)}else if(n.type==="MemberExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);if(e.isNumericConstant(n))o="number"}else if(n.type==="TemplateLiteral"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);o="string"}else if("raw"in n&&typeof n.raw==="string"){if(i=n.raw,"value"in n)o=n.value==null?void 0:typeof n.value}return{value:i,type:o,isFunction:a,defaultValue:u}}function Se(e,t){for(let n of e.vars)for(let r of n.declarations)if(r.id&&typeof r.id==="object"&&"type"in r.id&&r.id.type==="Identifier"&&"name"in r.id&&r.id.name===t&&r.init)return r.init;return}function De(e,t){for(let n of e.vars){if(n.kind!=="const")continue;for(let r of n.declarations)if(r.id&&typeof r.id==="object"&&"type"in r.id&&r.id.type==="Identifier"&&"name"in r.id&&r.id.name===t&&r.init)return r.init}return}function Ze(e,t){if(t&&typeof t==="object"&&"start"in t&&"end"in t&&typeof t.start==="number"&&typeof t.end==="number")return x(e,t.start,t.end)??"call";return"call"}function en(e,t,n){let r=e.resolveLocalVarJSDoc(n);if(r?.returnType)return r.returnType;let i=t.funcDecls.get(n)??we(t,n);if(!i)return;let o=on(t,i);if(o)return o;let a=tn(t,n);if(a)return a;let u=Ae(i);return u==="any"?void 0:u}function nn(e,t){return we(e,t)!==void 0}function we(e,t){let n=Se(e,t);if(!n||typeof n!=="object"||!("type"in n))return;if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression")return n;return}function tn(e,t){for(let n of e.vars)for(let r of n.declarations){let i=r.id;if(!i||typeof i!=="object"||!("type"in i)||i.type!=="Identifier"||!("name"in i)||i.name!==t)continue;let o=i.typeAnnotation;if(o?.type!=="TSTypeAnnotation")return;let a=o.typeAnnotation;if(!a||typeof a.start!=="number"||typeof a.end!=="number")return;return rn(x(e,a.start,a.end))}return}function rn(e){if(!e)return;let t=e.lastIndexOf("=>");if(t===-1)return;return e.slice(t+2).trim()||void 0}function on(e,t){let n=t.returnType;if(n?.type!=="TSTypeAnnotation")return;let r=n.typeAnnotation;if(!r||typeof r.start!=="number"||typeof r.end!=="number")return;return x(e,r.start,r.end)}function sn(e,t){let n=e?.returnType??"any",r=e?.params;if(r&&r.length>0)return`(${r.map((o)=>`${o.name}${o.optional?"?":""}: ${o.type}`).join(", ")}) => ${n}`;if(e?.returnType)return`() => ${n}`;if(t)return _e(t);return"(...args: any[]) => any"}function _e(e){return`(${an(e)}) => ${Ae(e)}`}function an(e){let t=e.params;if(!Array.isArray(t)||t.length===0)return"...args: any[]";let n=[];for(let r of t)if(r&&typeof r==="object"&&"type"in r&&r.type==="Identifier"&&"name"in r&&typeof r.name==="string")n.push(`${r.name}: any`);else return"...args: any[]";return n.join(", ")}function Ae(e){if(e.async||e.generator)return"any";let t=e.body,n;if(t&&typeof t==="object"&&"type"in t&&t.type==="BlockStatement"){if(n=un(t),n.length===0)return"any"}else n=[t];let r=null;for(let i of n){let o=pn(i);if(!o)return"any";if(r===null)r=o;else if(r!==o)return"any"}return r??"any"}function un(e){let t=[];return be(e,{enter(n){if(n.type==="FunctionDeclaration"||n.type==="FunctionExpression"||n.type==="ArrowFunctionExpression"){this.skip();return}if(n.type==="ReturnStatement")t.push(n.argument??null)}}),t}function pn(e){if(!e||typeof e!=="object"||!("type"in e))return null;switch(e.type){case"Literal":{let t=e.value;if(typeof t==="string")return"string";if(typeof t==="number")return"number";if(typeof t==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let t=e.callee;if(t&&typeof t==="object"&&"type"in t&&t.type==="Identifier"){let n=t.name;if(n==="String")return"string";if(n==="Number")return"number";if(n==="Boolean")return"boolean"}return null}default:return null}}function bt(e){if(Ee(e,"$bindable"))return{init:e.arguments[0],bindable:!0};return{init:e,bindable:!1}}function ln(e,t){let n=t.params;if(!Array.isArray(n)||n.length===0)return"";let r=n[0],i=n[n.length-1];if(typeof r.start!=="number"||typeof i.end!=="number")return"";return x(e,r.start,i.end)??""}function ve(e,t){if(t.generator)return;let n=t.body;if(!n||typeof n!=="object"||!("type"in n))return;let r=ln(e,t),i=t.async?"async ":"",o=(u,s)=>u&&typeof u==="object"&&("type"in u)&&u.type==="ObjectExpression"?`(${s})`:s;if(n.type!=="BlockStatement"){let u=H(e,n);return u===void 0?void 0:`${i}(${r}) => ${o(n,u)}`}let a=n.body;if(a.length===0)return`${i}(${r}) => {}`;if(a.length===1){let u=a[0];if(u&&typeof u==="object"&&"type"in u&&u.type==="ReturnStatement"){let s=u.argument;if(s){let l=H(e,s);if(l!==void 0)return`${i}(${r}) => ${o(s,l)}`}}}return}function ke(e,t,n){let r=H(t,n);if(!r||!n||typeof n!=="object"||!("type"in n))return;let i="expression";if(n.type==="Literal"||n.type==="UnaryExpression")i="literal";else if(n.type==="TemplateLiteral")i=n.expressions.length===0?"literal":"expression";else if(n.type==="ArrayExpression")i="array";else if(n.type==="ObjectExpression")i="object";else if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"||n.type==="FunctionDeclaration")i="function";let o={raw:r,kind:i};if(i==="literal"||i==="array"||i==="object"){let a=ue(e,n);if(a.ok)o.value=a.value}return o}function ue(e,t){if(!t||typeof t!=="object"||!("type"in t))return{ok:!1};if(t.type==="Literal"){let n=t.value;return typeof n==="bigint"?{ok:!1}:{ok:!0,value:n}}if(t.type==="UnaryExpression"){let n=t,r=n.argument;if(!r||typeof r!=="object"||!("type"in r)||r.type!=="Literal")return{ok:!1};let i=r.value;if(typeof i==="number"){if(n.operator==="-")return{ok:!0,value:-i};if(n.operator==="+")return{ok:!0,value:i}}if(typeof i==="boolean"&&n.operator==="!")return{ok:!0,value:!i};return{ok:!1}}if(t.type==="TemplateLiteral"){let n=t;if(n.expressions.length>0||n.quasis.length!==1)return{ok:!1};return{ok:!0,value:n.quasis[0].value.cooked??n.quasis[0].value.raw}}if(t.type==="ArrayExpression"){let n=t,r=[];for(let i of n.elements){if(!i)return{ok:!1};let o=ue(e,i);if(!o.ok)return{ok:!1};r.push(o.value)}return{ok:!0,value:r}}if(t.type==="ObjectExpression"){let n=t,r={};for(let i of n.properties){if(i.type!=="Property"||i.computed)return{ok:!1};let o=e.getPropertyName(i.key);if(!o)return{ok:!1};let a=ue(e,i.value);if(!a.ok)return{ok:!1};r[o]=a.value}return{ok:!0,value:r}}return{ok:!1}}var cn=/[-_.:/\s]+/;function pe(e){return`${e.split(cn).map((r)=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}Context`}function je(e,t,n,r){if(!n||typeof n!=="object"||!("type"in n))return null;if(n.type==="ObjectExpression"){let i=[];if(!q(n))return null;let o=n;for(let a of o.properties){if(a.type!=="Property")continue;let u=t.getPropertyName(a.key);if(!u)continue;let s="any",l;if(B(a.value)){let p=a.value.name,c=t.findVariableTypeAndDescription(p);if(c)s=c.type,l=c.description;else ie(e,"context-any-type",u,`Context "${r}" property "${u}" has no type annotation; defaulted to "any".`,K(e,a))}else if(a.value&&typeof a.value==="object"&&"type"in a.value&&(a.value.type==="ArrowFunctionExpression"||a.value.type==="FunctionExpression"))s=`(${a.value.params?.map((b)=>{if(B(b))return`${b.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(J(a.value))s=a.value.value==null?"null":typeof a.value.value;i.push({name:u,type:s,description:l,optional:!1})}return{key:r,typeName:pe(r),properties:i,description:void 0}}else if(B(n)){let i=n.name,o=t.findVariableTypeAndDescription(i);if(o)return{key:r,typeName:pe(r),properties:[{name:i,type:o.type,description:o.description,optional:!1}]};return ie(e,"context-any-type",i,`Context "${r}" variable "${i}" has no type annotation; defaulted to "any".`,K(e,n)),{key:r,typeName:pe(r),properties:[{name:i,type:"any",description:void 0,optional:!1}]}}return null}function Re(e){let t=e.callee;if(!t||typeof t!=="object"||!("type"in t))return null;let n=t.type==="Identifier"&&t.name==="Symbol",r=t.type==="MemberExpression"&&!t.computed&&t.object.type==="Identifier"&&t.object.name==="Symbol"&&t.property.type==="Identifier"&&t.property.name==="for";if(!n&&!r)return null;let i=e.arguments[0];if(!i||typeof i!=="object"||!("type"in i))return"";if(i.type==="Literal"&&typeof i.value==="string")return i.value;if(i.type==="TemplateLiteral"&&i.quasis?.length===1)return i.quasis[0].value.cooked??"";return""}function Ne(e,t,n=0){if(!t||typeof t!=="object"||!("type"in t))return{kind:"unresolved"};let r=t;if(r.type==="Literal"||r.type==="TemplateLiteral"){let i=Ce(r);return i==null?{kind:"unresolved"}:{kind:"resolved",key:i}}if(r.type==="CallExpression"||r.type==="NewExpression"){let i=Re(r);return i==null?{kind:"unresolved"}:{kind:"resolved",key:i}}if(r.type==="Identifier"){if(n>=5)return{kind:"unresolved"};let i=De(e,r.name);if(i&&typeof i==="object"&&"type"in i){let a=i;if((a.type==="CallExpression"||a.type==="NewExpression")&&Re(a)==="")return{kind:"resolved",key:r.name};return Ne(e,a,n+1)}let o=e.valueImportBindingsByLocalName.get(r.name);if(o)return{kind:"pending",importSource:o.source,importedName:o.importedName};return{kind:"unresolved"}}return{kind:"unresolved"}}function vt(e,t,n,r){if(!n||typeof n!=="object"||!("type"in n)||n.type!=="CallExpression")return;let i=n,o=i.arguments[0];if(!o)return;let a=Ne(e,o);if(a.kind==="unresolved"||a.kind==="resolved"&&!a.key){let p=e.componentFilePath?` in ${e.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${p}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let u=i.arguments[1];if(!u)return;if(a.kind==="pending"){let p=je(e,t,u,"");if(p)e.pendingContextKeyCandidates.push({importSource:a.importSource,importedName:a.importedName,properties:p.properties,description:p.description});return}let s=a.key,l=je(e,t,u,s);if(l&&!e.contexts.has(s))e.contexts.set(s,l)}function fn(e){return typeof e==="string"?JSON.stringify(e):String(e)}function le(e,{name:t,detail:n,has_argument:r,description:i,deprecated:o,tags:a,source:u}){if(t===void 0)return;let s=!r&&!n?"null":A(n),l=i,p=e.events.get(t);if(p?.type==="forwarded")e.events.set(t,{type:"dispatched",name:t,detail:s,description:l||p.description,deprecated:o??p.deprecated,tags:a??p.tags,source:u||p.source});else if(p){let c=p.tags??a;e.events.set(t,{...p,detail:p.detail===void 0?s:p.detail,description:p.description||l,deprecated:p.deprecated??o,tags:c,source:u||p.source})}else e.events.set(t,{type:"dispatched",name:t,detail:s,description:l,deprecated:o,tags:a,source:u})}function _t(e,t){let n=t.arguments[0],r=re(n,"CustomEvent");if(!r&&!re(n,"Event"))return;let i=n.arguments[0],o=J(i)?i.value:void 0;if(o==null)return;let a=r?n.arguments[1]:void 0,u=!1,s;if(q(a)){let l=a.properties.find((p)=>p.type==="Property"&&B(p.key)&&p.key.name==="detail");if(l?.type==="Property")u=!0,s=J(l.value)?l.value.value:void 0}return le(e,{name:String(o),detail:s==null?"":fn(s),has_argument:u,source:K(e,t)}),String(o)}function ce(e,t,n=!1){if(e.length===0)return"null";let r=e.map(({name:i,type:o,description:a,optional:u,default:s})=>{let l=u?"?":"",p=a||"";if(s&&p)p=`${p} @default ${s}`;else if(s)p=`@default ${s}`;if(p){if(n)return`/** ${p} */
3
+ `,n+1)}return e.sourceLineStartOffsetsCache=t,t}function Te(e,t){if(!e.source||t<0||t>e.source.length)return;let n=Qe(e),r=0,i=n.length-1;while(r<=i){let o=Math.floor((r+i)/2),a=n[o],u=n[o+1]??Number.POSITIVE_INFINITY;if(t<a)i=o-1;else if(t>=u)r=o+1;else return{line:o+1,column:t-a}}return}function Pe(e,t,n){if(t===void 0||n===void 0||n<t)return;let r=Te(e,t),i=Te(e,n);if(!r||!i)return;return{start:r,end:i}}function K(e,t){if(!t||typeof t!=="object")return;let n="start"in t&&typeof t.start==="number"?t.start:void 0,r="end"in t&&typeof t.end==="number"?t.end:void 0;return Pe(e,n,r)}function se(e,t){if(!t||t.length===0)return;let n=[...t];while(n.length>1){let s=n[n.length-1];if(s.tag!==void 0||!s.raw.trim().endsWith("*/"))break;n.pop()}let r=n[0],i=r.raw.indexOf(`@${r.tag??""}`),o=r.start+Math.max(i,0),a=n[n.length-1],u=a.start+a.raw.length;return Pe(e,o,u)}function x(e,t,n){return e.source?.slice(t,n)}function H(e,t){if(!t||typeof t!=="object")return;let n="start"in t&&typeof t.start==="number"?t.start:void 0,r="end"in t&&typeof t.end==="number"?t.end:void 0;if(n===void 0||r===void 0)return;return x(e,n,r)?.replace(oe," ")}function A(e){return e===void 0||e===""?void 0:e}function ht(e,t,n,r){if(A(n)===void 0)return;if(e.trackPropLocalName(n),t.props.has(n)){let i=t.props.get(n);t.props.set(n,{...i,...r})}else t.props.set(n,r)}function ae(e,t,n,r=0){let i,o,a=!1;if(!n||typeof n!=="object"||!("type"in n))return{value:i,type:o,isFunction:a};let u=ke(e,t,n);if(n.type==="ObjectExpression"||n.type==="BinaryExpression"||n.type==="ArrayExpression"||n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end)?.replace(oe," ");if(o=i,a=n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression",n.type==="BinaryExpression"){let l=n;if(l.left&&typeof l.left==="object"&&"type"in l.left&&l.left.type==="Literal"&&"value"in l.left&&typeof l.left.value==="string")o="string"}if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression")o=_e(n),i=ve(t,n)}else if(n.type==="UnaryExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);if(s.argument){if(typeof s.argument==="object"&&"type"in s.argument&&s.argument.type==="UnaryExpression")o=ae(e,t,s.argument).type;else if(typeof s.argument==="object"&&"value"in s.argument)o=typeof s.argument.value}}else if(n.type==="NewExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);if(s.callee&&typeof s.callee==="object"&&"type"in s.callee&&s.callee.type==="Identifier"){let l=s.callee.name;if(l==="Date")o="Date";else if(l==="Map")o="Map<any, any>";else if(l==="Set")o="Set<any>";else if(l==="WeakMap")o="WeakMap<object, any>";else if(l==="WeakSet")o="WeakSet<object>";else if(l==="Array")o="any[]";else if(l==="RegExp"||l==="Regexp")o="RegExp";else if(l==="Error")o="Error";else o=l}}else if(n.type==="CallExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);let l=s.callee,p=l&&typeof l==="object"&&"type"in l&&l.type==="Identifier"?l.name:void 0;if((p==="$derived"||p==="$state")&&s.arguments.length===1&&r<5)return{...ae(e,t,s.arguments[0],r+1),value:i,defaultValue:u};if(p){let c=en(e,t,p);if(c)return{value:i,type:void 0,isFunction:!1,defaultValue:u,resolvedType:c};if(t.funcDecls.has(p)||nn(t,p))return{value:i,type:void 0,isFunction:!1,defaultValue:u,pendingCallDefault:{calleeName:p}};let b=t.valueImportBindingsByLocalName.get(p);if(b)return{value:i,type:void 0,isFunction:!1,defaultValue:u,pendingCallDefault:{calleeName:p,importSource:b.source,importedName:b.importedName}}}return{value:i,type:void 0,isFunction:!1,defaultValue:u,pendingCallDefault:{calleeName:p??Ze(t,l)}}}else if(n.type==="Identifier"){let s=n;if(r<5){let l=Se(t,s.name);if(l){let p=ae(e,t,l,r+1),c=e.resolveLocalVarJSDoc(s.name);return{...p,resolvedType:c?.type??p.resolvedType,resolvedDescription:c?.description??p.resolvedDescription,resolvedParams:c?.params??p.resolvedParams,resolvedReturnType:c?.returnType??p.resolvedReturnType}}if(t.funcDecls.has(s.name)){let p=e.resolveLocalVarJSDoc(s.name),c=t.funcDecls.get(s.name);return{value:c?ve(t,c):void 0,type:void 0,isFunction:!0,defaultValue:c?ke(e,t,c):void 0,resolvedType:p?.type??sn(p,c),resolvedDescription:p?.description,resolvedParams:p?.params,resolvedReturnType:p?.returnType}}}if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end)}else if(n.type==="MemberExpression"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);if(e.isNumericConstant(n))o="number"}else if(n.type==="TemplateLiteral"){let s=n;if("start"in s&&"end"in s&&typeof s.start==="number"&&typeof s.end==="number")i=x(t,s.start,s.end);o="string"}else if("raw"in n&&typeof n.raw==="string"){if(i=n.raw,"value"in n)o=n.value==null?void 0:typeof n.value}return{value:i,type:o,isFunction:a,defaultValue:u}}function Se(e,t){for(let n of e.vars)for(let r of n.declarations)if(r.id&&typeof r.id==="object"&&"type"in r.id&&r.id.type==="Identifier"&&"name"in r.id&&r.id.name===t&&r.init)return r.init;return}function De(e,t){for(let n of e.vars){if(n.kind!=="const")continue;for(let r of n.declarations)if(r.id&&typeof r.id==="object"&&"type"in r.id&&r.id.type==="Identifier"&&"name"in r.id&&r.id.name===t&&r.init)return r.init}return}function Ze(e,t){if(t&&typeof t==="object"&&"start"in t&&"end"in t&&typeof t.start==="number"&&typeof t.end==="number")return x(e,t.start,t.end)??"call";return"call"}function en(e,t,n){let r=e.resolveLocalVarJSDoc(n);if(r?.returnType)return r.returnType;let i=t.funcDecls.get(n)??we(t,n);if(!i)return;let o=on(t,i);if(o)return o;let a=tn(t,n);if(a)return a;let u=Ae(i);return u==="any"?void 0:u}function nn(e,t){return we(e,t)!==void 0}function we(e,t){let n=Se(e,t);if(!n||typeof n!=="object"||!("type"in n))return;if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression")return n;return}function tn(e,t){for(let n of e.vars)for(let r of n.declarations){let i=r.id;if(!i||typeof i!=="object"||!("type"in i)||i.type!=="Identifier"||!("name"in i)||i.name!==t)continue;let o=i.typeAnnotation;if(o?.type!=="TSTypeAnnotation")return;let a=o.typeAnnotation;if(!a||typeof a.start!=="number"||typeof a.end!=="number")return;return rn(x(e,a.start,a.end))}return}function rn(e){if(!e)return;let t=e.lastIndexOf("=>");if(t===-1)return;return e.slice(t+2).trim()||void 0}function on(e,t){let n=t.returnType;if(n?.type!=="TSTypeAnnotation")return;let r=n.typeAnnotation;if(!r||typeof r.start!=="number"||typeof r.end!=="number")return;return x(e,r.start,r.end)}function sn(e,t){let n=e?.returnType??"any",r=e?.params;if(r&&r.length>0)return`(${r.map((o)=>`${o.name}${o.optional?"?":""}: ${o.type}`).join(", ")}) => ${n}`;if(e?.returnType)return`() => ${n}`;if(t)return _e(t);return"(...args: any[]) => any"}function _e(e){return`(${an(e)}) => ${Ae(e)}`}function an(e){let t=e.params;if(!Array.isArray(t)||t.length===0)return"...args: any[]";let n=[];for(let r of t)if(r&&typeof r==="object"&&"type"in r&&r.type==="Identifier"&&"name"in r&&typeof r.name==="string")n.push(`${r.name}: any`);else return"...args: any[]";return n.join(", ")}function Ae(e){if(e.async||e.generator)return"any";let t=e.body,n;if(t&&typeof t==="object"&&"type"in t&&t.type==="BlockStatement"){if(n=un(t),n.length===0)return"any"}else n=[t];let r=null;for(let i of n){let o=pn(i);if(!o)return"any";if(r===null)r=o;else if(r!==o)return"any"}return r??"any"}function un(e){let t=[];return be(e,{enter(n){if(n.type==="FunctionDeclaration"||n.type==="FunctionExpression"||n.type==="ArrowFunctionExpression"){this.skip();return}if(n.type==="ReturnStatement")t.push(n.argument??null)}}),t}function pn(e){if(!e||typeof e!=="object"||!("type"in e))return null;switch(e.type){case"Literal":{let t=e.value;if(typeof t==="string")return"string";if(typeof t==="number")return"number";if(typeof t==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let t=e.callee;if(t&&typeof t==="object"&&"type"in t&&t.type==="Identifier"){let n=t.name;if(n==="String")return"string";if(n==="Number")return"number";if(n==="Boolean")return"boolean"}return null}default:return null}}function bt(e){if(Ee(e,"$bindable"))return{init:e.arguments[0],bindable:!0};return{init:e,bindable:!1}}function ln(e,t){let n=t.params;if(!Array.isArray(n)||n.length===0)return"";let r=n[0],i=n[n.length-1];if(typeof r.start!=="number"||typeof i.end!=="number")return"";return x(e,r.start,i.end)??""}function ve(e,t){if(t.generator)return;let n=t.body;if(!n||typeof n!=="object"||!("type"in n))return;let r=ln(e,t),i=t.async?"async ":"",o=(u,s)=>u&&typeof u==="object"&&("type"in u)&&u.type==="ObjectExpression"?`(${s})`:s;if(n.type!=="BlockStatement"){let u=H(e,n);return u===void 0?void 0:`${i}(${r}) => ${o(n,u)}`}let a=n.body;if(a.length===0)return`${i}(${r}) => {}`;if(a.length===1){let u=a[0];if(u&&typeof u==="object"&&"type"in u&&u.type==="ReturnStatement"){let s=u.argument;if(s){let l=H(e,s);if(l!==void 0)return`${i}(${r}) => ${o(s,l)}`}}}return}function ke(e,t,n){let r=H(t,n);if(!r||!n||typeof n!=="object"||!("type"in n))return;let i="expression";if(n.type==="Literal"||n.type==="UnaryExpression")i="literal";else if(n.type==="TemplateLiteral")i=n.expressions.length===0?"literal":"expression";else if(n.type==="ArrayExpression")i="array";else if(n.type==="ObjectExpression")i="object";else if(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"||n.type==="FunctionDeclaration")i="function";let o={raw:r,kind:i};if(i==="literal"||i==="array"||i==="object"){let a=ue(e,n);if(a.ok)o.value=a.value}return o}function ue(e,t){if(!t||typeof t!=="object"||!("type"in t))return{ok:!1};if(t.type==="Literal"){let n=t.value;return typeof n==="bigint"?{ok:!1}:{ok:!0,value:n}}if(t.type==="UnaryExpression"){let n=t,r=n.argument;if(!r||typeof r!=="object"||!("type"in r)||r.type!=="Literal")return{ok:!1};let i=r.value;if(typeof i==="number"){if(n.operator==="-")return{ok:!0,value:-i};if(n.operator==="+")return{ok:!0,value:i}}if(typeof i==="boolean"&&n.operator==="!")return{ok:!0,value:!i};return{ok:!1}}if(t.type==="TemplateLiteral"){let n=t;if(n.expressions.length>0||n.quasis.length!==1)return{ok:!1};return{ok:!0,value:n.quasis[0].value.cooked??n.quasis[0].value.raw}}if(t.type==="ArrayExpression"){let n=t,r=[];for(let i of n.elements){if(!i)return{ok:!1};let o=ue(e,i);if(!o.ok)return{ok:!1};r.push(o.value)}return{ok:!0,value:r}}if(t.type==="ObjectExpression"){let n=t,r={};for(let i of n.properties){if(i.type!=="Property"||i.computed)return{ok:!1};let o=e.getPropertyName(i.key);if(!o)return{ok:!1};let a=ue(e,i.value);if(!a.ok)return{ok:!1};r[o]=a.value}return{ok:!0,value:r}}return{ok:!1}}var cn=/[-_.:/\s]+/;function pe(e){return`${e.split(cn).map((r)=>r.charAt(0).toUpperCase()+r.slice(1)).join("")}Context`}function je(e,t,n,r){if(!n||typeof n!=="object"||!("type"in n))return null;if(n.type==="ObjectExpression"){let i=[];if(!q(n))return null;let o=n;for(let a of o.properties){if(a.type!=="Property")continue;let u=t.getPropertyName(a.key);if(!u)continue;let s="any",l;if(B(a.value)){let p=a.value.name,c=t.findVariableTypeAndDescription(p);if(c)s=c.type,l=c.description;else ie(e,"context-any-type",u,`Context "${r}" property "${u}" has no type annotation; defaulted to "any".`,K(e,a))}else if(a.value&&typeof a.value==="object"&&"type"in a.value&&(a.value.type==="ArrowFunctionExpression"||a.value.type==="FunctionExpression"))s=`(${a.value.params?.map((b)=>{if(B(b))return`${b.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(J(a.value))s=a.value.value==null?"null":typeof a.value.value;i.push({name:u,type:s,description:l,optional:!1})}return{key:r,typeName:pe(r),properties:i,description:void 0}}else if(B(n)){let i=n.name,o=t.findVariableTypeAndDescription(i);if(o)return{key:r,typeName:pe(r),properties:[{name:i,type:o.type,description:o.description,optional:!1}]};return ie(e,"context-any-type",i,`Context "${r}" variable "${i}" has no type annotation; defaulted to "any".`,K(e,n)),{key:r,typeName:pe(r),properties:[{name:i,type:"any",description:void 0,optional:!1}]}}return null}function Ne(e){let t=e.callee;if(!t||typeof t!=="object"||!("type"in t))return null;let n=t.type==="Identifier"&&t.name==="Symbol",r=t.type==="MemberExpression"&&!t.computed&&t.object.type==="Identifier"&&t.object.name==="Symbol"&&t.property.type==="Identifier"&&t.property.name==="for";if(!n&&!r)return null;let i=e.arguments[0];if(!i||typeof i!=="object"||!("type"in i))return"";if(i.type==="Literal"&&typeof i.value==="string")return i.value;if(i.type==="TemplateLiteral"&&i.quasis?.length===1)return i.quasis[0].value.cooked??"";return""}function Re(e,t,n=0){if(!t||typeof t!=="object"||!("type"in t))return{kind:"unresolved"};let r=t;if(r.type==="Literal"||r.type==="TemplateLiteral"){let i=Ce(r);return i==null?{kind:"unresolved"}:{kind:"resolved",key:i}}if(r.type==="CallExpression"||r.type==="NewExpression"){let i=Ne(r);return i==null?{kind:"unresolved"}:{kind:"resolved",key:i}}if(r.type==="Identifier"){if(n>=5)return{kind:"unresolved"};let i=De(e,r.name);if(i&&typeof i==="object"&&"type"in i){let a=i;if((a.type==="CallExpression"||a.type==="NewExpression")&&Ne(a)==="")return{kind:"resolved",key:r.name};return Re(e,a,n+1)}let o=e.valueImportBindingsByLocalName.get(r.name);if(o)return{kind:"pending",importSource:o.source,importedName:o.importedName};return{kind:"unresolved"}}return{kind:"unresolved"}}function vt(e,t,n,r){if(!n||typeof n!=="object"||!("type"in n)||n.type!=="CallExpression")return;let i=n,o=i.arguments[0];if(!o)return;let a=Re(e,o);if(a.kind==="unresolved"||a.kind==="resolved"&&!a.key){let p=e.componentFilePath?` in ${e.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${p}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let u=i.arguments[1];if(!u)return;if(a.kind==="pending"){let p=je(e,t,u,"");if(p)e.pendingContextKeyCandidates.push({importSource:a.importSource,importedName:a.importedName,properties:p.properties,description:p.description});return}let s=a.key,l=je(e,t,u,s);if(l&&!e.contexts.has(s))e.contexts.set(s,l)}function fn(e){return typeof e==="string"?JSON.stringify(e):String(e)}function le(e,{name:t,detail:n,has_argument:r,description:i,deprecated:o,tags:a,source:u}){if(t===void 0)return;let s=!r&&!n?"null":A(n),l=i,p=e.events.get(t);if(p?.type==="forwarded")e.events.set(t,{type:"dispatched",name:t,detail:s,description:l||p.description,deprecated:o??p.deprecated,tags:a??p.tags,source:u||p.source});else if(p){let c=p.tags??a;e.events.set(t,{...p,detail:p.detail===void 0?s:p.detail,description:p.description||l,deprecated:p.deprecated??o,tags:c,source:u||p.source})}else e.events.set(t,{type:"dispatched",name:t,detail:s,description:l,deprecated:o,tags:a,source:u})}function _t(e,t){let n=t.arguments[0],r=re(n,"CustomEvent");if(!r&&!re(n,"Event"))return;let i=n.arguments[0],o=J(i)?i.value:void 0;if(o==null)return;let a=r?n.arguments[1]:void 0,u=!1,s;if(q(a)){let l=a.properties.find((p)=>p.type==="Property"&&B(p.key)&&p.key.name==="detail");if(l?.type==="Property")u=!0,s=J(l.value)?l.value.value:void 0}return le(e,{name:String(o),detail:s==null?"":fn(s),has_argument:u,source:K(e,t)}),String(o)}function ce(e,t,n=!1){if(e.length===0)return"null";let r=e.map(({name:i,type:o,description:a,optional:u,default:s})=>{let l=u?"?":"",p=a||"";if(s&&p)p=`${p} @default ${s}`;else if(s)p=`@default ${s}`;if(p){if(n)return`/** ${p} */
4
4
  ${i}${l}: ${o};`;return`/** ${p} */ ${i}${l}: ${o};`}return`${i}${l}: ${o};`}).join(n?`
5
5
  `:" ");return n?`{
6
6
  ${r}
7
- }`:`{ ${r} }`}var dn=/[A-Za-z_$][\w$]*/g;function mn(e,t){if(!t)return!1;let n=new Set(t[0].split(",").map((r)=>r.trim()));for(let[r]of e.matchAll(dn))if(n.has(r))return!0;return!1}function yn(e,t){if(t===void 0)return;return e.runesPropsDeclarationMetadataByDeclaratorStart.get(t)}function Rt(e,t,n){return yn(e,t)?.props.get(n)}function Nt(e){if(!e||typeof e!=="object"||!("type"in e))return;if(e.type==="Identifier"&&"name"in e&&typeof e.name==="string")return e.name;if(e.type==="TSQualifiedName"&&"right"in e&&e.right&&typeof e.right==="object"&&"name"in e.right&&typeof e.right.name==="string")return e.right.name;return}function Ie(e){if(!e||typeof e!=="object"||!("type"in e))return;if(e.type==="Identifier"&&"name"in e&&typeof e.name==="string")return e.name;if(e.type==="TSQualifiedName"&&"left"in e&&e.left&&typeof e.left==="object")return Ie(e.left);return}function It(e,t){let n=t?.start,r=t?.end;if(n===void 0||r===void 0)return;return x(e,n+1,r)?.trim()}function Lt(e,t){let n=t?.start,r=t?.end;if(n===void 0||r===void 0)return;return x(e,n,r)?.trim()}function j(e,t,n,r,i=new Set){if(!t?.type)return;switch(t.type){case"TSInterfaceDeclaration":j(e,{type:"TSTypeLiteral",members:t.body?.body},n,r,i);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":j(e,t.typeAnnotation,n,r,i);return;case"TSIntersectionType":case"TSUnionType":for(let o of t.types??[])j(e,o,n,r,i);return;case"TSTypeLiteral":for(let o of t.members??[]){if(o?.type!=="TSPropertySignature")continue;j(e,o.typeAnnotation?.typeAnnotation,n,r,i)}return;case"TSTypeReference":{let o=Ie(t.typeName);if(o){if(e.typeImportBindingsByLocalName.has(o))n.add(o);let a=e.localTypeDeclarationsByName.get(o);if(a&&!i.has(o))r.add(o),i.add(o),j(e,a.node,n,r,i),i.delete(o)}if("typeParameters"in t&&t.typeParameters&&typeof t.typeParameters==="object"){let a=t.typeParameters;for(let u of a.params??[])j(e,u,n,r,i)}return}case"TSArrayType":case"TSRestType":case"TSOptionalType":case"TSIndexedAccessType":case"TSTypeOperator":case"TSExpressionWithTypeArguments":case"TSTupleType":case"TSConditionalType":case"TSInferType":case"TSMappedType":case"TSFunctionType":case"TSConstructorType":case"TSTypeQuery":case"TSImportType":case"TSLiteralType":case"TSTypePredicate":case"TSNamedTupleMember":break;default:break}for(let o of Object.values(t)){if(!o||typeof o!=="object")continue;if(Array.isArray(o)){for(let a of o){if(!a||typeof a!=="object"||!("type"in a))continue;j(e,a,n,r,i)}continue}if("type"in o)j(e,o,n,r,i)}}function gn(e,t){let n=new Map;for(let r of Array.from(t).sort()){let i=e.typeImportBindingsByLocalName.get(r);if(!i)continue;let o=n.get(i.source)??{default:[],named:[],namespace:[]};if(i.specifierType==="default")o.default.push(i.localName);else if(i.specifierType==="namespace")o.namespace.push(i.localName);else o.named.push({imported:i.importedName,local:i.localName});n.set(i.source,o)}return Array.from(n.entries()).sort(([r],[i])=>r.localeCompare(i)).map(([r,i])=>{if(i.namespace.length>0)return i.namespace.map((s)=>`import type * as ${s} from "${r}";`).join(`
8
- `);let o=i.named.map(({imported:s,local:l})=>{if(!s||s===l)return l;return`${s} as ${l}`}),a=i.default[0],u=o.length>0?`{ ${o.join(", ")} }`:"";if(a&&u)return`import type ${a}, ${u} from "${r}";`;if(a)return`import type ${a} from "${r}";`;return`import type ${u} from "${r}";`})}function Ft(e){let t=e.pendingCallDefaultCandidates.length>0?e.pendingCallDefaultCandidates.slice():void 0,n=e.pendingContextKeyCandidates.length>0?e.pendingContextKeyCandidates.slice():void 0,r={...t?{pendingCallDefaultCandidates:t}:{},...n?{pendingContextKeyCandidates:n}:{}},i=t!==void 0||n!==void 0;if(e.typedRunesPropsDeclarations.length!==1)return i?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],...r}:void 0;let[o]=e.typedRunesPropsDeclarations;if(!o.canonicalType)return i?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],...r}:void 0;let a=Array.from(o.referencedLocalTypes).map((u)=>e.localTypeDeclarationsByName.get(u)).filter((u)=>u!==void 0).sort((u,s)=>u.start-s.start).map((u)=>u.code);return{canonicalPropsType:o.canonicalType,canonicalPropNames:Array.from(o.props.keys()).sort(),localTypeDeclarations:a,typeImportStatements:gn(e,o.referencedImportedTypes),referencesComponentGenerics:mn(o.canonicalType,e.generics),...r}}var hn=/^[A-Za-z_$][\w$]*/,bn=/[A-Za-z_$][\w$]*/g,Le=/^(?:const|in|out)\s+/;function fe(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="<"||o==="("||o==="["||o==="{")n++;else if(o===">"||o===")"||o==="]"||o==="}")n=Math.max(n-1,0);else if(o===","&&n===0)t.push(e.slice(r,i)),r=i+1}return t.push(e.slice(r)),t}function Bt(e){let t=fe(e).map((r)=>r.trim()).filter((r)=>r.length>0);if(t.length===0)return null;return[t.map((r)=>{let i=r;while(Le.test(i))i=i.replace(Le,"");return i.match(hn)?.[0]??r}).join(", "),t.join(", ")]}function Mt(e,t,n){let r=e.scriptGenericsAttribute?.value;if(!r)return;for(let[i]of r.matchAll(bn)){if(e.typeImportBindingsByLocalName.has(i))t.add(i);if(n.has(i))continue;let o=e.localTypeDeclarationsByName.get(i);if(!o)continue;n.add(i),j(e,o.node,t,n)}}var En=null;function Cn(e,t,n){let r={value:void 0,replace:!1};if(!n||typeof n!=="object"||!("type"in n))return r;if(n.type==="Identifier")r.value=n.name,r.replace=!0;else if(n.type==="Literal")r.value=String(n.value);else if(n.type==="MemberExpression")r.value=xe(e,t,n);else if((n.type==="ObjectExpression"||n.type==="TemplateLiteral")&&"start"in n&&"end"in n&&typeof n.start==="number"&&typeof n.end==="number")r.value=x(e,n.start,n.end);return r}function Kt(e,t,n){let r={};for(let i of n.properties){if(i.type!=="Property"||i.computed)continue;let o=t.getPropertyName(i.key);if(!o)continue;r[o]=Cn(e,t,i.value)}return r}function xn(e,t){if(!t||typeof t!=="object"||!("type"in t))return null;if(t.type==="Identifier"){let o=t,a=e.propLocalToPublicName.get(o.name);if(!a)return null;return{publicName:a,trackingName:o.name}}if(t.type!=="MemberExpression")return null;let n=t,r=n.object&&typeof n.object==="object"&&"type"in n.object&&n.object.type==="Identifier"?n.object.name:void 0;if(!r||!e.wholePropsLocals.has(r))return null;let i;if(!n.computed&&n.property&&typeof n.property==="object"&&"type"in n.property){if(n.property.type==="Identifier")i=n.property.name;else if(n.property.type==="Literal"&&n.property.value!=null)i=String(n.property.value)}else if(n.computed&&n.property&&typeof n.property==="object"&&"type"in n.property&&n.property.type==="Literal"&&"value"in n.property&&n.property.value!=null)i=String(n.property.value);if(!i)return null;return{publicName:i,trackingName:i}}function Ut(e,t){let n=t;if(n&&typeof n==="object"&&"type"in n&&n.type==="ChainExpression")n=n.expression;if(!n||typeof n!=="object"||!("type"in n)||n.type!=="CallExpression")return null;let r=n;if(!r.callee||typeof r.callee!=="object"||!("type"in r.callee))return null;let i=xn(e,r.callee);if(!i)return null;return{...i,arguments:r.arguments}}function Fe(e,{slot_name:t,slot_props:n,slot_fallback:r,slot_description:i,slot_deprecated:o,slot_tags:a,source:u}){let s=t===void 0||t==="",l=s?En:t??"",p=A(r),c=n===void 0||n===""?void 0:n,b=i?.trim()||void 0;if(e.slots.has(l)){let h=e.slots.get(l);if(h)e.slots.set(l,{...h,default:h.default??s,fallback:p,slot_props:h.slot_props===void 0?c:h.slot_props,description:h.description||b,deprecated:h.deprecated??o,tags:h.tags||a,source:u||h.source})}else e.slots.set(l,{name:l,default:s,fallback:p,slot_props:n,description:b,deprecated:o,tags:a,source:u})}var Tn=/\n/,Pn=/\r$/,M=/^\s+/,vn=/\s/,kn=/^@[^\s/]+(?=\s|$)/,Sn=/^@(\S+)\s*/;function Dn(e){let t=[],n=0;for(let r of e.split(Tn))t.push({text:r.replace(Pn,""),start:n}),n+=r.length+1;return t}function wn(e,t){let n=e.replace(M,""),r=!1;if(t)n=n.slice(3),r=!0;else if(n.startsWith("*")&&!n.startsWith("*/"))n=n.slice(1),r=!0;let i=n.match(M)?.[0]??"";n=n.slice(i.length);let o=n.trimEnd(),a=o.endsWith("*/")?o.slice(0,-2):n;return{indent:r?i.slice(1):i,separator:i,content:a}}function _n(e){let t=[],n=Dn(e),r=null,i=0;for(let o of n){if(r===null){let l=o.text.replace(M,"");if(!l.startsWith("/**")||l.startsWith("/***"))continue;r=[],i=o.start+(o.text.length-l.length)}let{indent:a,separator:u,content:s}=wn(o.text,r.length===0);if(r.push({raw:o.text,start:o.start,number:r.length,indent:a,separator:u,content:s}),o.text.trimEnd().endsWith("*/"))t.push({start:i,lines:r}),r=null}return t}function An(e){let t=e;if(t.length>0&&t[0].content==="")t=t.slice(1);if(t.length>0&&t[t.length-1].content==="")t=t.slice(0,-1);return t}function jn(e){let t=[[]],n=!1;for(let r of e){if(kn.test(r.content)&&!n)t.push([r]);else t[t.length-1].push(r);if(r.content.split("```").length%2===0)n=!n}return t}function $e(e){return e.map((t)=>t.indent+t.content).join(`
9
- `)}function Rn(e,t){let n=t;while(n<e.length-1&&e[n].content.trim()==="")n++;if(e[n].content[0]!=="{")return null;let r=0,i=[],o=n;for(;o<e.length;o++){let s=e[o].content,l=0;for(let p of s){if(p==="{")r++;else if(p==="}")r--;if(l++,r===0)break}if(i.push(l),r===0)break}if(r!==0)return null;let a=o;return{type:i.map((s,l)=>{let p=n+l,c=e[p].content.slice(0,s);return e[p].content=e[p].content.slice(s).replace(M,""),l===0?c:e[p].indent+c}).join(`
10
- `).slice(1,-1),endIndex:a}}function Nn(e){let t=e.content.match(M)?.[0]??"",n=e.content.slice(t.length),r=0,i=0;for(let l of n){if(r===0&&vn.test(l))break;if(l==="[")r++;if(l==="]")r--;i++}let o=r===0?n.slice(0,i):"";if(!o)return null;let a=o,u=!1,s;if(o.startsWith("[")&&o.endsWith("]")){u=!0;let p=o.slice(1,-1).split("=");if(a=p[0].trim(),p.length>1)s=p.slice(1).join("=").trim();if(!a)return null}if(a.length>1&&(a[0]==='"'||a[0]==="'")&&a[a.length-1]===a[0])a=a.slice(1,-1);return e.content=n.slice(i).replace(M,""),{name:a,optional:u,default:s}}function In(e){let t=e[0],n=t.content.match(Sn),r=n?n[1]:"",i=n?t.content.slice(n[0].length):t.content,o=i.trimEnd(),a=e.slice(1).map((h)=>h.separator+h.content),u=(o?[o,...a]:a).join(`
11
- `);t.content=i,t.tag=r;let s=Rn(e,0),l=s?.type??"",p=0;if(s){p=s.endIndex;while(p<e.length-1&&e[p].content.trim()==="")p++}let c=Nn(e[p]),b=$e(e.slice(s?s.endIndex:0));return{tag:r,name:c?.name??"",type:l,optional:c?.optional??!1,default:c?.default,description:b,raw:u,lines:e}}function Ln(e,t){let n=An(e);n.forEach((o,a)=>{o.number=a});let r=jn(n),i=r.slice(1).map(In);return{description:$e(r[0]),tags:i,start:t,lines:n}}function Y(e){return _n(e).map(({start:t,lines:n})=>Ln(n,t))}var Fn=/\s*=\s*/;function Oe(e){let t=e.indexOf("<");if(t===-1||!e.endsWith(">"))return e;let n=e.slice(0,t),r=e.slice(t+1,-1),i=fe(r).map((o)=>o.trim().replace(Fn," = ")).join(", ");return`${n}<${i}>`}var $n=/^\s*$/,On=/;$/,Bn=/^-\s*/;function L(e){if(e===void 0)return;let t=e.replace(Bn,"").trim();return t===""?"":t}function U(e){if(!e||e.length===0)return;return e[0].content}var Be=new Set(["since","example"]);function Mn(e){let t=e.trim();return t===""?!0:t}function Me(e,t){return Mn(`${e??""}${t?` ${t}`:""}`)}function Vn(e){let t=e.trim().replace(On,"").trimEnd();if(!t.startsWith("{")||!t.endsWith("}"))return!1;let n=0,r=null;for(let i=0;i<t.length;i++){let o=t[i];if(r!==null){if(o==="\\"){i++;continue}if(o===r)r=null;continue}if(o==='"'||o==="'"||o==="`"){r=o;continue}if(o==="{"||o==="["||o==="(")n++;else if(o==="}"||o==="]"||o===")"){if(n--,n===0&&i<t.length-1)return!1}}return n===0}function Ve(e){let t=e;if(!t.startsWith("/*"))t=`/*${t}`;if(!t.endsWith("*/"))t+="*/";return t}function Gn(e){if(e==="*")return"any";return e.trim()}function nr(e){let t=Y(Ve(e)),{returns:n}=Ge(t);return n?Gn(n.type):void 0}function Ge(e){let t=e[0]?.tags??[],n=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),r,i=[],o,a,u,s=[],l=[];for(let p of t)if(p.tag==="type")r=p;else if(p.tag==="param")i.push(p);else if(p.tag==="returns"||p.tag==="return")o=p;else if(p.tag==="deprecated")u??=Me(p.name,p.description);else if(Be.has(p.tag))l.push(p);else if(p.tag==="bindable"){if(p.type)continue;let c=`${p.name}${p.description?` ${p.description}`:""}`.trim();if(c==="readonly"||c==="writable")a??=c}else if(!n.has(p.tag))s.push(p);return{type:r,param:i,returns:o,binding:a,deprecated:u,additional:s,passthrough:l,description:e[0]?.description}}function Wn(e){if(!e||e.length===0)return;let t=e[e.length-1];return t&&typeof t==="object"&&"value"in t?t:void 0}function Jn(e,t,n){if(!t||t.length===0||n===void 0||!e.source)return;for(let r=t.length-1;r>=0;r--){let i=t[r];if(!i||typeof i!=="object"||!("value"in i)||!("end"in i))continue;if(typeof i.end!=="number")continue;let o=e.source.slice(i.end,n);if($n.test(o))return i}return}function Kn(e,t,n){if(!n?.leadingComments)return;let r=Jn(e,n.leadingComments,n.start);if(!r)return;return Un(t,[r])}function tr(e,t,n){if(!n?.leadingComments)return;return Kn(e,t,n)}function Un(e,t){if(!t)return;let n=Wn(t);if(!n)return;let r=Y(Ve(n.value)),{type:i,param:o,returns:a,binding:u,deprecated:s,additional:l,passthrough:p,description:c}=Ge(r),b,h,P,I;if(i)b=e.aliasType(i.type);if(o.length>0)h=o.filter((y)=>!y.name.includes(".")).map((y)=>({name:y.name,type:e.aliasType(y.type),description:L(y.description),optional:y.optional||!1}));if(a)P=e.aliasType(a.type);let R=A(c?.trim());if(R||l.length>0){let y=[];if(R)y.push(R);for(let w of l){let V=`@${w.tag}${w.name?` ${w.name}`:""}${w.description?` ${w.description}`:""}`;y.push(V)}I=y.join(`
12
- `)}let F=p.length>0?p.map((y)=>({name:y.tag,body:y.raw})):void 0;return{type:b,params:h,returnType:P,description:I,binding:u,deprecated:s,tags:F}}function rr(e,t,n=e.source){if(!n)return;for(let{tags:r,description:i,lines:o}of Y(n)){let a,u,s,l,p,c,b=[],h=[],P,I,R,F=[],y,w,V=[],Q,_=!1,g=!0,G=[],Z,X=new Map,de=new Set,ee=new Set;for(let f of r)if(f.lines.length>0)de.add(f.lines[0].number);for(let f of o)if(!f.tag&&f.content&&f.content.trim()!=="}")X.set(f.number,f.content);let We=(f)=>{if(!f||f.length===0)return;let T=f[0].number,m=[],v=[],N=!1;for(let d=T-1;d>=0;d--){if(de.has(d))break;let k=X.get(d);if(k)m.unshift(k),v.unshift(d),N=!0;else if(N){let E=o[d];if(!(!E||!E.tag&&(!E.content||E.content.trim()==="")))break}}if(m.length===0)return;for(let d of v)ee.add(d);return m.join(`
13
- `).trim()},me=()=>{if(a!==void 0){let f=u&&u!=="object"&&u!=="Object"?u:void 0,T;if(f)T=f;else if(h.length>0)T=ce(h,a,!0);else T=u||"";if(c!==void 0){let m;for(let d of r){let k=d.lines[0]?.number;if(typeof k!=="number")continue;if(k<=c)continue;if(d.tag==="property"||d.tag==="type")continue;m=k;break}let v=[],N=Array.from(X.keys()).sort((d,k)=>d-k);for(let d of N){if(d<=c)continue;if(m!==void 0&&d>=m)continue;if(ee.has(d))continue;let E=X.get(d)?.trim();if(E)v.push(E),ee.add(d)}if(v.length>0){let d=v.join(`
7
+ }`:`{ ${r} }`}var dn=/[A-Za-z_$][\w$]*/g;function mn(e,t){if(!t)return!1;let n=new Set(t[0].split(",").map((r)=>r.trim()));for(let[r]of e.matchAll(dn))if(n.has(r))return!0;return!1}function yn(e,t){if(t===void 0)return;return e.runesPropsDeclarationMetadataByDeclaratorStart.get(t)}function Nt(e,t,n){return yn(e,t)?.props.get(n)}function Rt(e){if(!e||typeof e!=="object"||!("type"in e))return;if(e.type==="Identifier"&&"name"in e&&typeof e.name==="string")return e.name;if(e.type==="TSQualifiedName"&&"right"in e&&e.right&&typeof e.right==="object"&&"name"in e.right&&typeof e.right.name==="string")return e.right.name;return}function Ie(e){if(!e||typeof e!=="object"||!("type"in e))return;if(e.type==="Identifier"&&"name"in e&&typeof e.name==="string")return e.name;if(e.type==="TSQualifiedName"&&"left"in e&&e.left&&typeof e.left==="object")return Ie(e.left);return}function It(e,t){let n=t?.start,r=t?.end;if(n===void 0||r===void 0)return;return x(e,n+1,r)?.trim()}function Lt(e,t){let n=t?.start,r=t?.end;if(n===void 0||r===void 0)return;return x(e,n,r)?.trim()}function j(e,t,n,r,i=new Set){if(!t?.type)return;switch(t.type){case"TSInterfaceDeclaration":j(e,{type:"TSTypeLiteral",members:t.body?.body},n,r,i);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":j(e,t.typeAnnotation,n,r,i);return;case"TSIntersectionType":case"TSUnionType":for(let o of t.types??[])j(e,o,n,r,i);return;case"TSTypeLiteral":for(let o of t.members??[]){if(o?.type!=="TSPropertySignature")continue;j(e,o.typeAnnotation?.typeAnnotation,n,r,i)}return;case"TSTypeReference":{let o=Ie(t.typeName);if(o){if(e.typeImportBindingsByLocalName.has(o))n.add(o);let a=e.localTypeDeclarationsByName.get(o);if(a&&!i.has(o))r.add(o),i.add(o),j(e,a.node,n,r,i),i.delete(o)}if("typeParameters"in t&&t.typeParameters&&typeof t.typeParameters==="object"){let a=t.typeParameters;for(let u of a.params??[])j(e,u,n,r,i)}return}case"TSArrayType":case"TSRestType":case"TSOptionalType":case"TSIndexedAccessType":case"TSTypeOperator":case"TSExpressionWithTypeArguments":case"TSTupleType":case"TSConditionalType":case"TSInferType":case"TSMappedType":case"TSFunctionType":case"TSConstructorType":case"TSTypeQuery":case"TSImportType":case"TSLiteralType":case"TSTypePredicate":case"TSNamedTupleMember":break;default:break}for(let o of Object.values(t)){if(!o||typeof o!=="object")continue;if(Array.isArray(o)){for(let a of o){if(!a||typeof a!=="object"||!("type"in a))continue;j(e,a,n,r,i)}continue}if("type"in o)j(e,o,n,r,i)}}function gn(e,t){let n=new Map;for(let r of Array.from(t).sort()){let i=e.typeImportBindingsByLocalName.get(r);if(!i)continue;let o=n.get(i.source)??{default:[],named:[],namespace:[]};if(i.specifierType==="default")o.default.push(i.localName);else if(i.specifierType==="namespace")o.namespace.push(i.localName);else o.named.push({imported:i.importedName,local:i.localName});n.set(i.source,o)}return Array.from(n.entries()).sort(([r],[i])=>r.localeCompare(i)).map(([r,i])=>{if(i.namespace.length>0)return i.namespace.map((s)=>`import type * as ${s} from "${r}";`).join(`
8
+ `);let o=i.named.map(({imported:s,local:l})=>{if(!s||s===l)return l;return`${s} as ${l}`}),a=i.default[0],u=o.length>0?`{ ${o.join(", ")} }`:"";if(a&&u)return`import type ${a}, ${u} from "${r}";`;if(a)return`import type ${a} from "${r}";`;return`import type ${u} from "${r}";`})}function Ft(e){let t=e.pendingCallDefaultCandidates.length>0?e.pendingCallDefaultCandidates.slice():void 0,n=e.pendingContextKeyCandidates.length>0?e.pendingContextKeyCandidates.slice():void 0,r={...t?{pendingCallDefaultCandidates:t}:{},...n?{pendingContextKeyCandidates:n}:{}},i=t!==void 0||n!==void 0;if(e.typedRunesPropsDeclarations.length!==1)return i?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],...r}:void 0;let[o]=e.typedRunesPropsDeclarations;if(!o.canonicalType)return i?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],...r}:void 0;let a=Array.from(o.referencedLocalTypes).map((u)=>e.localTypeDeclarationsByName.get(u)).filter((u)=>u!==void 0).sort((u,s)=>u.start-s.start).map((u)=>u.code);return{canonicalPropsType:o.canonicalType,canonicalPropNames:Array.from(o.props.keys()).sort(),localTypeDeclarations:a,typeImportStatements:gn(e,o.referencedImportedTypes),referencesComponentGenerics:mn(o.canonicalType,e.generics),...r}}var hn=/^[A-Za-z_$][\w$]*/,bn=/[A-Za-z_$][\w$]*/g,Le=/^(?:const|in|out)\s+/;function fe(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="<"||o==="("||o==="["||o==="{")n++;else if(o===">"||o===")"||o==="]"||o==="}")n=Math.max(n-1,0);else if(o===","&&n===0)t.push(e.slice(r,i)),r=i+1}return t.push(e.slice(r)),t}function Bt(e){let t=fe(e).map((r)=>r.trim()).filter((r)=>r.length>0);if(t.length===0)return null;return[t.map((r)=>{let i=r;while(Le.test(i))i=i.replace(Le,"");return i.match(hn)?.[0]??r}).join(", "),t.join(", ")]}function Mt(e,t,n){let r=e.scriptGenericsAttribute?.value;if(!r)return;for(let[i]of r.matchAll(bn)){if(e.typeImportBindingsByLocalName.has(i))t.add(i);if(n.has(i))continue;let o=e.localTypeDeclarationsByName.get(i);if(!o)continue;n.add(i),j(e,o.node,t,n)}}var En=null;function Cn(e,t,n){let r={value:void 0,replace:!1};if(!n||typeof n!=="object"||!("type"in n))return r;if(n.type==="Identifier")r.value=n.name,r.replace=!0;else if(n.type==="Literal")r.value=String(n.value);else if(n.type==="MemberExpression")r.value=xe(e,t,n);else if((n.type==="ObjectExpression"||n.type==="TemplateLiteral")&&"start"in n&&"end"in n&&typeof n.start==="number"&&typeof n.end==="number")r.value=x(e,n.start,n.end);return r}function Kt(e,t,n){let r={};for(let i of n.properties){if(i.type!=="Property"||i.computed)continue;let o=t.getPropertyName(i.key);if(!o)continue;r[o]=Cn(e,t,i.value)}return r}function xn(e,t){if(!t||typeof t!=="object"||!("type"in t))return null;if(t.type==="Identifier"){let o=t,a=e.propLocalToPublicName.get(o.name);if(!a)return null;return{publicName:a,trackingName:o.name}}if(t.type!=="MemberExpression")return null;let n=t,r=n.object&&typeof n.object==="object"&&"type"in n.object&&n.object.type==="Identifier"?n.object.name:void 0;if(!r||!e.wholePropsLocals.has(r))return null;let i;if(!n.computed&&n.property&&typeof n.property==="object"&&"type"in n.property){if(n.property.type==="Identifier")i=n.property.name;else if(n.property.type==="Literal"&&n.property.value!=null)i=String(n.property.value)}else if(n.computed&&n.property&&typeof n.property==="object"&&"type"in n.property&&n.property.type==="Literal"&&"value"in n.property&&n.property.value!=null)i=String(n.property.value);if(!i)return null;return{publicName:i,trackingName:i}}function Ut(e,t){let n=t;if(n&&typeof n==="object"&&"type"in n&&n.type==="ChainExpression")n=n.expression;if(!n||typeof n!=="object"||!("type"in n)||n.type!=="CallExpression")return null;let r=n;if(!r.callee||typeof r.callee!=="object"||!("type"in r.callee))return null;let i=xn(e,r.callee);if(!i)return null;return{...i,arguments:r.arguments}}function Fe(e,{slot_name:t,slot_props:n,slot_fallback:r,slot_description:i,slot_deprecated:o,slot_tags:a,source:u}){let s=t===void 0||t==="",l=s?En:t??"",p=A(r),c=n===void 0||n===""?void 0:n,b=i?.trim()||void 0;if(e.slots.has(l)){let h=e.slots.get(l);if(h)e.slots.set(l,{...h,default:h.default??s,fallback:p,slot_props:h.slot_props===void 0?c:h.slot_props,description:h.description||b,deprecated:h.deprecated??o,tags:h.tags||a,source:u||h.source})}else e.slots.set(l,{name:l,default:s,fallback:p,slot_props:n,description:b,deprecated:o,tags:a,source:u})}var Tn=/\n/,Pn=/\r$/,M=/^\s+/,vn=/\s/,kn=/^@[^\s/]+(?=\s|$)/,Sn=/^@(\S+)\s*/;function Dn(e){let t=[],n=0;for(let r of e.split(Tn))t.push({text:r.replace(Pn,""),start:n}),n+=r.length+1;return t}function wn(e,t){let n=e.replace(M,""),r=!1;if(t)n=n.slice(3),r=!0;else if(n.startsWith("*")&&!n.startsWith("*/"))n=n.slice(1),r=!0;let i=n.match(M)?.[0]??"";n=n.slice(i.length);let o=n.trimEnd(),a=o.endsWith("*/")?o.slice(0,-2):n;return{indent:r?i.slice(1):i,separator:i,content:a}}function _n(e){if(!e.includes("/**"))return[];let t=[],n=Dn(e),r=null,i=0;for(let o of n){if(r===null){let l=o.text.replace(M,"");if(!l.startsWith("/**")||l.startsWith("/***"))continue;r=[],i=o.start+(o.text.length-l.length)}let{indent:a,separator:u,content:s}=wn(o.text,r.length===0);if(r.push({raw:o.text,start:o.start,number:r.length,indent:a,separator:u,content:s}),o.text.trimEnd().endsWith("*/"))t.push({start:i,lines:r}),r=null}return t}function An(e){let t=e;if(t.length>0&&t[0].content==="")t=t.slice(1);if(t.length>0&&t[t.length-1].content==="")t=t.slice(0,-1);return t}function jn(e){let t=[[]],n=!1;for(let r of e){if(kn.test(r.content)&&!n)t.push([r]);else t[t.length-1].push(r);if(r.content.split("```").length%2===0)n=!n}return t}function $e(e){return e.map((t)=>t.indent+t.content).join(`
9
+ `)}function Nn(e,t){let n=t;while(n<e.length-1&&e[n].content.trim()==="")n++;if(e[n].content[0]!=="{")return null;let r=0,i=[],o=n;for(;o<e.length;o++){let s=e[o].content,l=0;for(let p of s){if(p==="{")r++;else if(p==="}")r--;if(l++,r===0)break}if(i.push(l),r===0)break}if(r!==0)return null;let a=o;return{type:i.map((s,l)=>{let p=n+l,c=e[p].content.slice(0,s);return e[p].content=e[p].content.slice(s).replace(M,""),l===0?c:e[p].indent+c}).join(`
10
+ `).slice(1,-1),endIndex:a}}function Rn(e){let t=e.content.match(M)?.[0]??"",n=e.content.slice(t.length),r=0,i=0;for(let l of n){if(r===0&&vn.test(l))break;if(l==="[")r++;if(l==="]")r--;i++}let o=r===0?n.slice(0,i):"";if(!o)return null;let a=o,u=!1,s;if(o.startsWith("[")&&o.endsWith("]")){u=!0;let p=o.slice(1,-1).split("=");if(a=p[0].trim(),p.length>1)s=p.slice(1).join("=").trim();if(!a)return null}if(a.length>1&&(a[0]==='"'||a[0]==="'")&&a[a.length-1]===a[0])a=a.slice(1,-1);return e.content=n.slice(i).replace(M,""),{name:a,optional:u,default:s}}function In(e){let t=e[0],n=t.content.match(Sn),r=n?n[1]:"",i=n?t.content.slice(n[0].length):t.content,o=i.trimEnd(),a=e.slice(1).map((h)=>h.separator+h.content),u=(o?[o,...a]:a).join(`
11
+ `);t.content=i,t.tag=r;let s=Nn(e,0),l=s?.type??"",p=0;if(s){p=s.endIndex;while(p<e.length-1&&e[p].content.trim()==="")p++}let c=Rn(e[p]),b=$e(e.slice(s?s.endIndex:0));return{tag:r,name:c?.name??"",type:l,optional:c?.optional??!1,default:c?.default,description:b,raw:u,lines:e}}function Ln(e,t){let n=An(e);n.forEach((o,a)=>{o.number=a});let r=jn(n),i=r.slice(1).map(In);return{description:$e(r[0]),tags:i,start:t,lines:n}}function Y(e){return _n(e).map(({start:t,lines:n})=>Ln(n,t))}var Fn=/\s*=\s*/;function Oe(e){let t=e.indexOf("<");if(t===-1||!e.endsWith(">"))return e;let n=e.slice(0,t),r=e.slice(t+1,-1),i=fe(r).map((o)=>o.trim().replace(Fn," = ")).join(", ");return`${n}<${i}>`}var $n=/^\s*$/,On=/;$/,Bn=/^-\s*/;function L(e){if(e===void 0)return;let t=e.replace(Bn,"").trim();return t===""?"":t}function U(e){if(!e||e.length===0)return;return e[0].content}var Be=new Set(["since","example"]);function Mn(e){let t=e.trim();return t===""?!0:t}function Me(e,t){return Mn(`${e??""}${t?` ${t}`:""}`)}function Vn(e){let t=e.trim().replace(On,"").trimEnd();if(!t.startsWith("{")||!t.endsWith("}"))return!1;let n=0,r=null;for(let i=0;i<t.length;i++){let o=t[i];if(r!==null){if(o==="\\"){i++;continue}if(o===r)r=null;continue}if(o==='"'||o==="'"||o==="`"){r=o;continue}if(o==="{"||o==="["||o==="(")n++;else if(o==="}"||o==="]"||o===")"){if(n--,n===0&&i<t.length-1)return!1}}return n===0}function Ve(e){let t=e;if(!t.startsWith("/*"))t=`/*${t}`;if(!t.endsWith("*/"))t+="*/";return t}function Gn(e){if(e==="*")return"any";return e.trim()}function nr(e){let t=Y(Ve(e)),{returns:n}=Ge(t);return n?Gn(n.type):void 0}function Ge(e){let t=e[0]?.tags??[],n=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),r,i=[],o,a,u,s=[],l=[];for(let p of t)if(p.tag==="type")r=p;else if(p.tag==="param")i.push(p);else if(p.tag==="returns"||p.tag==="return")o=p;else if(p.tag==="deprecated")u??=Me(p.name,p.description);else if(Be.has(p.tag))l.push(p);else if(p.tag==="bindable"){if(p.type)continue;let c=`${p.name}${p.description?` ${p.description}`:""}`.trim();if(c==="readonly"||c==="writable")a??=c}else if(!n.has(p.tag))s.push(p);return{type:r,param:i,returns:o,binding:a,deprecated:u,additional:s,passthrough:l,description:e[0]?.description}}function Wn(e){if(!e||e.length===0)return;let t=e[e.length-1];return t&&typeof t==="object"&&"value"in t?t:void 0}function Jn(e,t,n){if(!t||t.length===0||n===void 0||!e.source)return;for(let r=t.length-1;r>=0;r--){let i=t[r];if(!i||typeof i!=="object"||!("value"in i)||!("end"in i))continue;if(typeof i.end!=="number")continue;let o=e.source.slice(i.end,n);if($n.test(o))return i}return}function Kn(e,t,n){if(!n?.leadingComments)return;let r=Jn(e,n.leadingComments,n.start);if(!r)return;return Un(t,[r])}function tr(e,t,n){if(!n?.leadingComments)return;return Kn(e,t,n)}function Un(e,t){if(!t)return;let n=Wn(t);if(!n)return;let r=Y(Ve(n.value)),{type:i,param:o,returns:a,binding:u,deprecated:s,additional:l,passthrough:p,description:c}=Ge(r),b,h,P,I;if(i)b=e.aliasType(i.type);if(o.length>0)h=o.filter((y)=>!y.name.includes(".")).map((y)=>({name:y.name,type:e.aliasType(y.type),description:L(y.description),optional:y.optional||!1}));if(a)P=e.aliasType(a.type);let N=A(c?.trim());if(N||l.length>0){let y=[];if(N)y.push(N);for(let w of l){let V=`@${w.tag}${w.name?` ${w.name}`:""}${w.description?` ${w.description}`:""}`;y.push(V)}I=y.join(`
12
+ `)}let F=p.length>0?p.map((y)=>({name:y.tag,body:y.raw})):void 0;return{type:b,params:h,returnType:P,description:I,binding:u,deprecated:s,tags:F}}function rr(e,t,n=e.source){if(!n)return;for(let{tags:r,description:i,lines:o}of Y(n)){let a,u,s,l,p,c,b=[],h=[],P,I,N,F=[],y,w,V=[],Q,_=!1,g=!0,G=[],Z,X=new Map,de=new Set,ee=new Set;for(let f of r)if(f.lines.length>0)de.add(f.lines[0].number);for(let f of o)if(!f.tag&&f.content&&f.content.trim()!=="}")X.set(f.number,f.content);let We=(f)=>{if(!f||f.length===0)return;let T=f[0].number,m=[],v=[],R=!1;for(let d=T-1;d>=0;d--){if(de.has(d))break;let k=X.get(d);if(k)m.unshift(k),v.unshift(d),R=!0;else if(R){let E=o[d];if(!(!E||!E.tag&&(!E.content||E.content.trim()==="")))break}}if(m.length===0)return;for(let d of v)ee.add(d);return m.join(`
13
+ `).trim()},me=()=>{if(a!==void 0){let f=u&&u!=="object"&&u!=="Object"?u:void 0,T;if(f)T=f;else if(h.length>0)T=ce(h,a,!0);else T=u||"";if(c!==void 0){let m;for(let d of r){let k=d.lines[0]?.number;if(typeof k!=="number")continue;if(k<=c)continue;if(d.tag==="property"||d.tag==="type")continue;m=k;break}let v=[],R=Array.from(X.keys()).sort((d,k)=>d-k);for(let d of R){if(d<=c)continue;if(m!==void 0&&d>=m)continue;if(ee.has(d))continue;let E=X.get(d)?.trim();if(E)v.push(E),ee.add(d)}if(v.length>0){let d=v.join(`
14
14
  `);s=s?`${s}
15
- ${d}`:d}}le(e,{name:a,detail:T,has_argument:!1,description:s,deprecated:l,tags:b.length>0?b:void 0,source:p}),e.eventDescriptions.set(a,s),e.jsDocEventNames.add(a),e.jsDocEventSources.set(a,p),h.length=0,a=void 0,u=void 0,s=void 0,l=void 0,p=void 0,c=void 0,b=[]}},ye=()=>{if(P!==void 0){let f,T;if(F.length>0)f=ce(F,void 0,!0),T=`type ${P} = ${f};`;else if(I)f=I,T=Vn(f)?`interface ${P} ${f}`:`type ${P} = ${f};`;else f="{}",T=`type ${P} = ${f};`;e.typedefs.set(P,{type:f,name:P,description:A(R),ts:T}),F.length=0,P=void 0,I=void 0,R=void 0}},ge=()=>{if(y!==void 0){let m=`(${V.map(({name:N,type:d,optional:k})=>`${N}${k?"?":""}: ${d}`).join(", ")}) => ${Q||"void"}`,v=`type ${y} = ${m};`;e.typedefs.set(y,{type:m,name:y,description:A(w),ts:v}),V.length=0,Q=void 0,y=void 0,w=void 0}},Je=r.some((f)=>f.tag==="slot"||f.tag==="snippet"),Ke=r.some((f)=>f.tag==="extends"||f.tag==="extendProps");for(let{tag:f,type:T,name:m,description:v,optional:N,default:d,raw:k,lines:E}of r){let S=t.aliasType(T),W=We(E);switch(f){case"extends":case"extendProps":if(e.extends={interface:m,import:S},g)g=!1;break;case"restProps":{let C=m?v?`${m} ${v}`:m:v,ne=L(C)||W;if(!ne&&g&&!_&&i)ne=i,_=!0;if(e.rest_props={type:"Element",name:S,description:ne||void 0},g)g=!1;break}case"slot":case"snippet":{let O=L(U(E));if(!O&&g&&!_&&i)O=i,_=!0;if(!O&&G.length===0)O=W;if(g)g=!1;Fe(e,{slot_name:m,slot_props:S,slot_description:O||void 0,slot_deprecated:Z,slot_tags:G.length>0?[...G]:void 0,source:se(e,E)}),G.length=0,Z=void 0;break}case"event":{if(me(),a=m,u=S,c=E.length>0?E[0].number:void 0,s=L(U(E))||W,!s&&g&&!_&&i)s=i,_=!0;if(p=se(e,E),g)g=!1;break}case"type":if(a!==void 0)u=S;break;case"param":if(y!==void 0)V.push({name:m,type:S,optional:N||!1});break;case"returns":case"return":if(y!==void 0)Q=S;break;case"property":{let C={name:m,type:S,description:L(U(E)),optional:N||!1,default:d};if(a!==void 0)h.push(C);else if(P!==void 0)F.push(C);break}case"typedef":{if(ye(),P=Oe(m),I=S,R=L(U(E))||W,!R&&g&&!_&&i)R=i,_=!0;if(g)g=!1;break}case"callback":{if(ge(),y=Oe(m),w=L(U(E))||W,!w&&g&&!_&&i)w=i,_=!0;if(g)g=!1;break}case"generics":if(e.generics=[m,S],g)g=!1;break;case"template":{let C=m;if(S)C=`${m} extends ${S}`;if(d)C+=` = ${d}`;if(Je&&!Ke){e.deferredSlotBlockGenerics.push({name:m,constraint:C});break}if(t.accumulateGeneric(m,C),g)g=!1;break}case"deprecated":{let C=Me(m,v);if(a===void 0)Z??=C;else l??=C;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let C={name:f,body:k};if(a!==void 0&&Be.has(f))b.push(C);else G.push(C)}break}}me(),ye(),ge()}}
16
- export{be as u,D as v,tt as w,J as x,B as y,rt as z,Ee as A,Xe as B,it as C,Ce as D,qe as E,st as F,at as G,xe as H,ie as I,Pe as J,K,x as L,A as M,ht as N,ae as O,bt as P,pe as Q,vt as R,fn as S,le as T,_t as U,yn as V,Rt as W,Nt as X,It as Y,Lt as Z,j as _,Ft as $,fe as aa,Bt as ba,Mt as ca,Y as da,Kt as ea,Ut as fa,Fe as ga,$n as ha,nr as ia,Ge as ja,Kn as ka,tr as la,rr as ma};
15
+ ${d}`:d}}le(e,{name:a,detail:T,has_argument:!1,description:s,deprecated:l,tags:b.length>0?b:void 0,source:p}),e.eventDescriptions.set(a,s),e.jsDocEventNames.add(a),e.jsDocEventSources.set(a,p),h.length=0,a=void 0,u=void 0,s=void 0,l=void 0,p=void 0,c=void 0,b=[]}},ye=()=>{if(P!==void 0){let f,T;if(F.length>0)f=ce(F,void 0,!0),T=`type ${P} = ${f};`;else if(I)f=I,T=Vn(f)?`interface ${P} ${f}`:`type ${P} = ${f};`;else f="{}",T=`type ${P} = ${f};`;e.typedefs.set(P,{type:f,name:P,description:A(N),ts:T}),F.length=0,P=void 0,I=void 0,N=void 0}},ge=()=>{if(y!==void 0){let m=`(${V.map(({name:R,type:d,optional:k})=>`${R}${k?"?":""}: ${d}`).join(", ")}) => ${Q||"void"}`,v=`type ${y} = ${m};`;e.typedefs.set(y,{type:m,name:y,description:A(w),ts:v}),V.length=0,Q=void 0,y=void 0,w=void 0}},Je=r.some((f)=>f.tag==="slot"||f.tag==="snippet"),Ke=r.some((f)=>f.tag==="extends"||f.tag==="extendProps");for(let{tag:f,type:T,name:m,description:v,optional:R,default:d,raw:k,lines:E}of r){let S=t.aliasType(T),W=We(E);switch(f){case"extends":case"extendProps":if(e.extends={interface:m,import:S},g)g=!1;break;case"restProps":{let C=m?v?`${m} ${v}`:m:v,ne=L(C)||W;if(!ne&&g&&!_&&i)ne=i,_=!0;if(e.rest_props={type:"Element",name:S,description:ne||void 0},g)g=!1;break}case"slot":case"snippet":{let O=L(U(E));if(!O&&g&&!_&&i)O=i,_=!0;if(!O&&G.length===0)O=W;if(g)g=!1;Fe(e,{slot_name:m,slot_props:S,slot_description:O||void 0,slot_deprecated:Z,slot_tags:G.length>0?[...G]:void 0,source:se(e,E)}),G.length=0,Z=void 0;break}case"event":{if(me(),a=m,u=S,c=E.length>0?E[0].number:void 0,s=L(U(E))||W,!s&&g&&!_&&i)s=i,_=!0;if(p=se(e,E),g)g=!1;break}case"type":if(a!==void 0)u=S;break;case"param":if(y!==void 0)V.push({name:m,type:S,optional:R||!1});break;case"returns":case"return":if(y!==void 0)Q=S;break;case"property":{let C={name:m,type:S,description:L(U(E)),optional:R||!1,default:d};if(a!==void 0)h.push(C);else if(P!==void 0)F.push(C);break}case"typedef":{if(ye(),P=Oe(m),I=S,N=L(U(E))||W,!N&&g&&!_&&i)N=i,_=!0;if(g)g=!1;break}case"callback":{if(ge(),y=Oe(m),w=L(U(E))||W,!w&&g&&!_&&i)w=i,_=!0;if(g)g=!1;break}case"generics":if(e.generics=[m,S],g)g=!1;break;case"template":{let C=m;if(S)C=`${m} extends ${S}`;if(d)C+=` = ${d}`;if(Je&&!Ke){e.deferredSlotBlockGenerics.push({name:m,constraint:C});break}if(t.accumulateGeneric(m,C),g)g=!1;break}case"deprecated":{let C=Me(m,v);if(a===void 0)Z??=C;else l??=C;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let C={name:f,body:k};if(a!==void 0&&Be.has(f))b.push(C);else G.push(C)}break}}me(),ye(),ge()}}
16
+ export{be as u,D as v,tt as w,J as x,B as y,rt as z,Ee as A,Xe as B,it as C,Ce as D,qe as E,st as F,at as G,xe as H,ie as I,Pe as J,K,x as L,A as M,ht as N,ae as O,bt as P,pe as Q,vt as R,fn as S,le as T,_t as U,yn as V,Nt as W,Rt as X,It as Y,Lt as Z,j as _,Ft as $,fe as aa,Bt as ba,Mt as ca,Y as da,Kt as ea,Ut as fa,Fe as ga,$n as ha,nr as ia,Ge as ja,Kn as ka,tr as la,rr as ma};
package/lib/cli-entry.js CHANGED
@@ -1 +1 @@
1
- import{s as o}from"./chunk-mdth9bg3.js";import"./chunk-yzabyfqs.js";import"./chunk-nrz6c5ew.js";import"./chunk-syz2wqmb.js";import"./chunk-ptdfswsv.js";export{o as cli};
1
+ import{s as o}from"./chunk-c83445g5.js";import"./chunk-py1s51tb.js";import"./chunk-nrz6c5ew.js";import"./chunk-syz2wqmb.js";import"./chunk-ptdfswsv.js";export{o as cli};