sveld 0.35.2 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -6
- package/lib/browser.d.ts +660 -39
- package/lib/browser.js +172 -172
- package/lib/chunk-0fqdg2xa.js +20 -0
- package/lib/chunk-2vwf7nck.js +1 -0
- package/lib/chunk-8myyzjb1.js +4 -0
- package/lib/{chunk-v4q9vw0y.js → chunk-as5hgj7e.js} +57 -57
- package/lib/{chunk-zva3xjwa.js → chunk-denfbw92.js} +1 -1
- package/lib/chunk-h1r040pg.js +6 -0
- package/lib/chunk-m538qnhp.js +230 -0
- package/lib/chunk-r4rrncmd.js +1 -0
- package/lib/{chunk-1p4ka68s.js → chunk-t9d5k3p7.js} +1 -1
- package/lib/{chunk-8xw75w8t.js → chunk-tmj7vnjr.js} +2 -2
- package/lib/chunk-xryt7ad2.js +3 -0
- package/lib/cli-entry.js +1 -1
- package/lib/index.d.ts +767 -10
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/ComponentParser.d.ts +0 -560
- package/lib/ast-guards.d.ts +0 -16
- package/lib/brands.d.ts +0 -11
- package/lib/bundle.d.ts +0 -174
- package/lib/check.d.ts +0 -43
- package/lib/chunk-72hx9e9w.js +0 -20
- package/lib/chunk-7qz0hzgw.js +0 -217
- package/lib/chunk-cxrw7gzr.js +0 -2
- package/lib/chunk-jdnsv86e.js +0 -1
- package/lib/chunk-pmj8c3yv.js +0 -6
- package/lib/chunk-s9mzxa4y.js +0 -1
- package/lib/chunk-xkrgedm4.js +0 -4
- package/lib/cli-entry.d.ts +0 -12
- package/lib/cli.d.ts +0 -28
- package/lib/create-exports.d.ts +0 -32
- package/lib/dependency-graph.d.ts +0 -20
- package/lib/diagnostics.d.ts +0 -34
- package/lib/element-tag-map.d.ts +0 -146
- package/lib/example-check.d.ts +0 -24
- package/lib/get-svelte-entry.d.ts +0 -3
- package/lib/load-config.d.ts +0 -62
- package/lib/parse-cache.d.ts +0 -28
- package/lib/parse-entry-exports.d.ts +0 -30
- package/lib/parse-exports.d.ts +0 -25
- package/lib/parsed-component-metadata.d.ts +0 -13
- package/lib/parser/bindings.d.ts +0 -4
- package/lib/parser/context.d.ts +0 -72
- package/lib/parser/contexts.d.ts +0 -19
- package/lib/parser/diagnostics.d.ts +0 -8
- package/lib/parser/events.d.ts +0 -21
- package/lib/parser/generics.d.ts +0 -24
- package/lib/parser/jsdoc.d.ts +0 -55
- package/lib/parser/prop-shared.d.ts +0 -84
- package/lib/parser/props.d.ts +0 -71
- package/lib/parser/rest-props.d.ts +0 -4
- package/lib/parser/runes-detection.d.ts +0 -13
- package/lib/parser/runes-props.d.ts +0 -18
- package/lib/parser/scopes.d.ts +0 -56
- package/lib/parser/slots.d.ts +0 -24
- package/lib/parser/source-position.d.ts +0 -26
- package/lib/parser/type-resolution.d.ts +0 -17
- package/lib/parser/typescript-casts.d.ts +0 -1
- package/lib/parser/utils.d.ts +0 -1
- package/lib/parser/variable-jsdoc.d.ts +0 -12
- package/lib/parser-stack.d.ts +0 -20
- package/lib/path.d.ts +0 -2
- package/lib/plugin.d.ts +0 -85
- package/lib/resolve-alias.d.ts +0 -30
- package/lib/resolve-types.d.ts +0 -52
- package/lib/sveld.d.ts +0 -29
- package/lib/svelte-parse.d.ts +0 -4
- package/lib/svelte-version.d.ts +0 -1
- package/lib/validate.d.ts +0 -13
- package/lib/watch.d.ts +0 -34
- package/lib/writer/MarkdownWriterBase.d.ts +0 -26
- package/lib/writer/Writer.d.ts +0 -31
- package/lib/writer/WriterMarkdown.d.ts +0 -31
- package/lib/writer/built-in-writers.d.ts +0 -1
- package/lib/writer/document-model.d.ts +0 -34
- package/lib/writer/format-generated-ts.d.ts +0 -8
- package/lib/writer/markdown-format-utils.d.ts +0 -20
- package/lib/writer/markdown-render-utils.d.ts +0 -10
- package/lib/writer/registry.d.ts +0 -17
- package/lib/writer/writer-custom-elements-core.d.ts +0 -86
- package/lib/writer/writer-custom-elements.d.ts +0 -15
- package/lib/writer/writer-json.d.ts +0 -27
- package/lib/writer/writer-markdown-core.d.ts +0 -32
- package/lib/writer/writer-markdown.d.ts +0 -23
- package/lib/writer/writer-ts-definitions-core.d.ts +0 -30
- package/lib/writer/writer-ts-definitions.d.ts +0 -43
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{A as $0,B as J0,C as TO,D as y0,E as ZO,H as tO,I as v,J as r0,K as x,L as YO,M as NO,N as vO,O as gO,P as _0,Q as yO,R as xO,S as eO,T as wO,U as O1,V as uO,v as hO,w as U0,x as Q0,y as nO,z as C0}from"./chunk-8myyzjb1.js";import{X as Z1}from"./chunk-as5hgj7e.js";class A0{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:(O)=>this.replacement=O}}replace(O,Z,$,Q){if(O&&Z)if($!=null)O[Z][$]=Q;else O[Z]=Q}remove(O,Z,$){if(O&&Z)if($!==null&&$!==void 0)O[Z].splice($,1);else delete O[Z]}}class T0 extends A0{constructor(O,Z){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:($)=>this.replacement=$},this.enter=O,this.leave=Z}visit(O,Z,$,Q){if(O){if(this.enter){let Y=this.should_skip,q=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,O,Z,$,Q),this.replacement)O=this.replacement,this.replace(Z,$,Q,O);if(this.should_remove)this.remove(Z,$,Q);let X=this.should_skip,H=this.should_remove;if(this.should_skip=Y,this.should_remove=q,this.replacement=K,X)return O;if(H)return null}let W;for(W in O){let Y=O[W];if(Y&&typeof Y==="object"){if(Array.isArray(Y)){let q=Y;for(let K=0;K<q.length;K+=1){let X=q[K];if($O(X)){if(!this.visit(X,O,W,K))K--}}}else if($O(Y))this.visit(Y,O,W,null)}}if(this.leave){let Y=this.replacement,q=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,O,Z,$,Q),this.replacement)O=this.replacement,this.replace(Z,$,Q,O);if(this.should_remove)this.remove(Z,$,Q);let K=this.should_remove;if(this.replacement=Y,this.should_remove=q,K)return null}}return O}}function $O(O){return O!==null&&typeof O==="object"&&"type"in O&&typeof O.type==="string"}function X0(O,{enter:Z,leave:$}){return new T0(Z,$).visit(O,null)}var QO={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function $1(O){return O in QO}function WO(O){if($1(O))return QO[O];return"HTMLElement"}var Q1=/\w/;function W1(O,Z){let $=O.trim();if(!$.startsWith("{")||!$.endsWith("}"))return;let Q=$.slice(1,-1),W=[],Y=0,q="";for(let K of Q)if(K==="{"||K==="<"||K==="("||K==="[")Y++,q+=K;else if(K==="}"||K===">"||K===")"||K==="]")Y--,q+=K;else if((K===";"||K===",")&&Y===0)W.push(q.trim()),q="";else q+=K;if(q.trim())W.push(q.trim());for(let K of W){if(!K.startsWith(Z))continue;let X=K.slice(Z.length);if(X.length>0&&Q1.test(X[0]))continue;let H=X.trimStart();if(H.startsWith("?"))H=H.slice(1).trimStart();if(H.startsWith(":"))return H.slice(1).trim()}return}function F0(O,Z,$){let Q=$;if(Q.computed||Q.object?.type!=="Identifier"||Q.property?.type!=="Identifier")return;let W=Q.object.name,Y=Q.property.name;if(!W||!Y)return;if(O.wholePropsLocals.has(W))return Z.getPropTypeByLocalOrPublic(Y);let q=Z.getPropTypeByLocalOrPublic(W)??Z.findVariableTypeAndDescription(W)?.type;if(!q)return;return W1(q,Y)}function N0(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1}}function K0(O,Z,$,Q,W){O.diagnosticRecords.push({component:O.componentFilePath,kind:Z,name:$,message:Q,...W?{source:W}:{}})}function n(O){return O===void 0||O===""?void 0:O}var Y1=/[\r\n]+/g;function M0(O,Z,$,Q){if(n($)===void 0)return;if(O.trackPropLocalName($),Z.props.has($)){let W=Z.props.get($);Z.props.set($,{...W,...Q})}else Z.props.set($,Q)}function H0(O,Z,$,Q=0){let W,Y,q=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:W,type:Y,isFunction:q};let K=U1(O,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let X=$;if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end)?.replace(Y1," ");if(Y=W,q=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let H=$;if(H.left&&typeof H.left==="object"&&"type"in H.left&&H.left.type==="Literal"&&"value"in H.left&&typeof H.left.value==="string")Y="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")Y=XO($),W=void 0}else if($.type==="UnaryExpression"){let X=$;if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end);if(X.argument){if(typeof X.argument==="object"&&"type"in X.argument&&X.argument.type==="UnaryExpression")Y=H0(O,Z,X.argument).type;else if(typeof X.argument==="object"&&"value"in X.argument)Y=typeof X.argument.value}}else if($.type==="NewExpression"){let X=$;if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end);if(X.callee&&typeof X.callee==="object"&&"type"in X.callee&&X.callee.type==="Identifier"){let H=X.callee.name;if(H==="Date")Y="Date";else if(H==="Map")Y="Map<any, any>";else if(H==="Set")Y="Set<any>";else if(H==="WeakMap")Y="WeakMap<object, any>";else if(H==="WeakSet")Y="WeakSet<object>";else if(H==="Array")Y="any[]";else if(H==="RegExp"||H==="Regexp")Y="RegExp";else if(H==="Error")Y="Error";else Y=H}}else if($.type==="CallExpression"){let X=$;if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end)}else if($.type==="Identifier"){let X=$;if(Q<5){let H=q1(Z,X.name);if(H){let z=H0(O,Z,H,Q+1),J=O.resolveLocalVarJSDoc(X.name);return{...z,resolvedType:J?.type??z.resolvedType,resolvedDescription:J?.description??z.resolvedDescription,resolvedParams:J?.params??z.resolvedParams,resolvedReturnType:J?.returnType??z.resolvedReturnType}}if(Z.funcDecls.has(X.name)){let z=O.resolveLocalVarJSDoc(X.name),J=Z.funcDecls.get(X.name);return{value:void 0,type:void 0,isFunction:!0,resolvedType:z?.type??X1(z,J),resolvedDescription:z?.description,resolvedParams:z?.params,resolvedReturnType:z?.returnType}}}if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end)}else if($.type==="MemberExpression"){let X=$;if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end);if(O.isNumericConstant($))Y="number"}else if($.type==="TemplateLiteral"){let X=$;if("start"in X&&"end"in X&&typeof X.start==="number"&&typeof X.end==="number")W=x(Z,X.start,X.end);Y="string"}else if("raw"in $&&typeof $.raw==="string"){if(W=$.raw,"value"in $)Y=$.value==null?void 0:typeof $.value}return{value:W,type:Y,isFunction:q,defaultValue:K}}function q1(O,Z){for(let $ of O.vars)for(let Q of $.declarations)if(Q.id&&typeof Q.id==="object"&&"type"in Q.id&&Q.id.type==="Identifier"&&"name"in Q.id&&Q.id.name===Z&&Q.init)return Q.init;return}function qO(O,Z){for(let $ of O.vars){if($.kind!=="const")continue;for(let Q of $.declarations)if(Q.id&&typeof Q.id==="object"&&"type"in Q.id&&Q.id.type==="Identifier"&&"name"in Q.id&&Q.id.name===Z&&Q.init)return Q.init}return}function X1(O,Z){let $=O?.returnType??"any",Q=O?.params;if(Q&&Q.length>0)return`(${Q.map((Y)=>`${Y.name}${Y.optional?"?":""}: ${Y.type}`).join(", ")}) => ${$}`;if(O?.returnType)return`() => ${$}`;if(Z)return XO(Z);return"(...args: any[]) => any"}function XO(O){return`(${K1(O)}) => ${G1(O)}`}function K1(O){let Z=O.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let Q of Z)if(Q&&typeof Q==="object"&&"type"in Q&&Q.type==="Identifier"&&"name"in Q&&typeof Q.name==="string")$.push(`${Q.name}: any`);else return"...args: any[]";return $.join(", ")}function G1(O){if(O.async||O.generator)return"any";let Z=O.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=z1(Z),$.length===0)return"any"}else $=[Z];let Q=null;for(let W of $){let Y=H1(W);if(!Y)return"any";if(Q===null)Q=Y;else if(Q!==Y)return"any"}return Q??"any"}function z1(O){let Z=[];return X0(O,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function H1(O){if(!O||typeof O!=="object"||!("type"in O))return null;switch(O.type){case"Literal":{let Z=O.value;if(typeof Z==="string")return"string";if(typeof Z==="number")return"number";if(typeof Z==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let Z=O.callee;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="Identifier"){let $=Z.name;if($==="String")return"string";if($==="Number")return"number";if($==="Boolean")return"boolean"}return null}default:return null}}function KO(O){if($0(O,"$bindable"))return{init:O.arguments[0],bindable:!0};return{init:O,bindable:!1}}function U1(O,Z,$){let Q=YO(Z,$);if(!Q||!$||typeof $!=="object"||!("type"in $))return;let W="expression";if($.type==="Literal"||$.type==="UnaryExpression")W="literal";else if($.type==="TemplateLiteral")W=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")W="array";else if($.type==="ObjectExpression")W="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")W="function";let Y={raw:Q,kind:W};if(W==="literal"||W==="array"||W==="object"){let q=v0(O,$);if(q.ok)Y.value=q.value}return Y}function v0(O,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return{ok:!1};if(Z.type==="Literal"){let $=Z.value;return typeof $==="bigint"?{ok:!1}:{ok:!0,value:$}}if(Z.type==="UnaryExpression"){let $=Z,Q=$.argument;if(!Q||typeof Q!=="object"||!("type"in Q)||Q.type!=="Literal")return{ok:!1};let W=Q.value;if(typeof W==="number"){if($.operator==="-")return{ok:!0,value:-W};if($.operator==="+")return{ok:!0,value:W}}if(typeof W==="boolean"&&$.operator==="!")return{ok:!0,value:!W};return{ok:!1}}if(Z.type==="TemplateLiteral"){let $=Z;if($.expressions.length>0||$.quasis.length!==1)return{ok:!1};return{ok:!0,value:$.quasis[0].value.cooked??$.quasis[0].value.raw}}if(Z.type==="ArrayExpression"){let $=Z,Q=[];for(let W of $.elements){if(!W)return{ok:!1};let Y=v0(O,W);if(!Y.ok)return{ok:!1};Q.push(Y.value)}return{ok:!0,value:Q}}if(Z.type==="ObjectExpression"){let $=Z,Q={};for(let W of $.properties){if(W.type!=="Property"||W.computed)return{ok:!1};let Y=O.getPropertyName(W.key);if(!Y)return{ok:!1};let q=v0(O,W.value);if(!q.ok)return{ok:!1};Q[Y]=q.value}return{ok:!0,value:Q}}return{ok:!1}}var j1=/[-_.:/\s]+/;function g0(O){return`${O.split(j1).map((Q)=>Q.charAt(0).toUpperCase()+Q.slice(1)).join("")}Context`}function J1(O,Z,$,Q){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let W=[];if(!C0($))return null;let Y=$;for(let q of Y.properties){if(q.type!=="Property")continue;let K=Z.getPropertyName(q.key);if(!K)continue;let X="any",H;if(Q0(q.value)){let z=q.value.name,J=Z.findVariableTypeAndDescription(z);if(J)X=J.type,H=J.description;else K0(O,"context-any-type",K,`Context "${Q}" property "${K}" has no type annotation; defaulted to "any".`,v(O,q))}else if(q.value&&typeof q.value==="object"&&"type"in q.value&&(q.value.type==="ArrowFunctionExpression"||q.value.type==="FunctionExpression"))X=`(${q.value.params?.map((L)=>{if(Q0(L))return`${L.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(U0(q.value))X=q.value.value==null?"null":typeof q.value.value;W.push({name:K,type:X,description:H,optional:!1})}return{key:Q,typeName:g0(Q),properties:W,description:void 0}}else if(Q0($)){let W=$.name,Y=Z.findVariableTypeAndDescription(W);if(Y)return{key:Q,typeName:g0(Q),properties:[{name:W,type:Y.type,description:Y.description,optional:!1}]};return K0(O,"context-any-type",W,`Context "${Q}" variable "${W}" has no type annotation; defaulted to "any".`,v(O,$)),{key:Q,typeName:g0(Q),properties:[{name:W,type:"any",description:void 0,optional:!1}]}}return null}function GO(O){let Z=O.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",Q=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!Q)return null;let W=O.arguments[0];if(!W||typeof W!=="object"||!("type"in W))return"";if(W.type==="Literal"&&typeof W.value==="string")return W.value;if(W.type==="TemplateLiteral"&&W.quasis?.length===1)return W.quasis[0].value.cooked??"";return""}function zO(O,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let Q=Z;if(Q.type==="Literal")return typeof Q.value==="string"?Q.value:Q.value==null?null:String(Q.value);if(Q.type==="TemplateLiteral"){if(Q.quasis?.length===1){let W=Q.quasis[0].value.cooked;return W==null?null:W}return null}if(Q.type==="CallExpression"||Q.type==="NewExpression")return GO(Q);if(Q.type==="Identifier"){if($>=5)return null;let W=qO(O,Q.name);if(W&&typeof W==="object"&&"type"in W){let Y=W;if((Y.type==="CallExpression"||Y.type==="NewExpression")&&GO(Y)==="")return Q.name;return zO(O,Y,$+1)}return null}return null}function HO(O,Z,$,Q){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let W=$,Y=W.arguments[0];if(!Y)return;let q=zO(O,Y);if(!q){let H=O.componentFilePath?` in ${O.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${H}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=W.arguments[1];if(!K)return;let X=J1(O,Z,K,q);if(X&&!O.contexts.has(q))O.contexts.set(q,X)}function x0(O){return typeof O==="string"?JSON.stringify(O):String(O)}function B0(O,{name:Z,detail:$,has_argument:Q,description:W,deprecated:Y,tags:q,source:K}){if(Z===void 0)return;let X=!Q&&!$?"null":n($),H=W,z=O.events.get(Z);if(z?.type==="forwarded")O.events.set(Z,{type:"dispatched",name:Z,detail:X,description:H||z.description,deprecated:Y??z.deprecated,tags:q??z.tags,source:K||z.source});else if(z){let J=z.tags??q;O.events.set(Z,{...z,detail:z.detail===void 0?X:z.detail,description:z.description||H,deprecated:z.deprecated??Y,tags:J,source:K||z.source})}else O.events.set(Z,{type:"dispatched",name:Z,detail:X,description:H,deprecated:Y,tags:q,source:K})}function UO(O,Z){let $=Z.arguments[0],Q=y0($,"CustomEvent");if(!Q&&!y0($,"Event"))return;let W=$.arguments[0],Y=U0(W)?W.value:void 0;if(Y==null)return;let q=Q?$.arguments[1]:void 0,K=!1,X;if(C0(q)){let H=q.properties.find((z)=>z.type==="Property"&&Q0(z.key)&&z.key.name==="detail");if(H?.type==="Property")K=!0,X=U0(H.value)?H.value.value:void 0}return B0(O,{name:String(Y),detail:X==null?"":x0(X),has_argument:K,source:v(O,Z)}),String(Y)}function u0(O,Z,$=!1){if(O.length===0)return"null";let Q=O.map(({name:W,type:Y,description:q,optional:K,default:X})=>{let H=K?"?":"",z=q||"";if(X&&z)z=`${z} @default ${X}`;else if(X)z=`@default ${X}`;if(z){if($)return`/** ${z} */
|
|
2
|
+
${W}${H}: ${Y};`;return`/** ${z} */ ${W}${H}: ${Y};`}return`${W}${H}: ${Y};`}).join($?`
|
|
3
|
+
`:" ");return $?`{
|
|
4
|
+
${Q}
|
|
5
|
+
}`:`{ ${Q} }`}var t;(function(O){O.start="/**",O.nostart="/***",O.delim="*",O.end="*/"})(t=t||(t={}));function m0(O){return/^\s+$/.test(O)}function jO(O){let Z=O.match(/\r+$/);return Z==null?["",O]:[O.slice(-Z[0].length),O.slice(0,-Z[0].length)]}function G0(O){let Z=O.match(/^\s+/);return Z==null?["",O]:[O.slice(0,Z[0].length),O.slice(Z[0].length)]}function JO(O){return O.split(/\n/)}function MO(O={}){return Object.assign({tag:"",name:"",type:"",optional:!1,description:"",problems:[],source:[]},O)}function l0(O={}){return Object.assign({start:"",delimiter:"",postDelimiter:"",tag:"",postTag:"",name:"",postName:"",type:"",postType:"",description:"",end:"",lineEnd:""},O)}var M1=/^@\S+/;function d0({fence:O="```"}={}){let Z=B1(O),$=(Q,W)=>Z(Q)?!W:W;return function(W){let Y=[[]],q=!1;for(let K of W){if(M1.test(K.tokens.description)&&!q)Y.push([K]);else Y[Y.length-1].push(K);q=$(K.tokens.description,q)}return Y}}function B1(O){if(typeof O==="string")return(Z)=>Z.split(O).length%2===0;return O}function c0({startLine:O=0,markers:Z=t}={}){let $=null,Q=O;return function(Y){let q=Y,K=l0();if([K.lineEnd,q]=jO(q),[K.start,q]=G0(q),$===null&&q.startsWith(Z.start)&&!q.startsWith(Z.nostart))$=[],K.delimiter=q.slice(0,Z.start.length),q=q.slice(Z.start.length),[K.postDelimiter,q]=G0(q);if($===null)return Q++,null;let X=q.trimRight().endsWith(Z.end);if(K.delimiter===""&&q.startsWith(Z.delim)&&!q.startsWith(Z.end))K.delimiter=Z.delim,q=q.slice(Z.delim.length),[K.postDelimiter,q]=G0(q);if(X){let H=q.trimRight();K.end=q.slice(H.length-Z.end.length),q=H.slice(0,-Z.end.length)}if(K.description=q,$.push({number:Q,source:Y,tokens:K}),Q++,X){let H=$.slice();return $=null,H}return null}}function i0({tokenizers:O}){return function($){var Q;let W=MO({source:$});for(let Y of O)if(W=Y(W),(Q=W.problems[W.problems.length-1])===null||Q===void 0?void 0:Q.critical)break;return W}}function P0(){return(O)=>{let{tokens:Z}=O.source[0],$=Z.description.match(/\s*(@(\S+))(\s*)/);if($===null)return O.problems.push({code:"spec:tag:prefix",message:'tag should start with "@" symbol',line:O.source[0].number,critical:!0}),O;return Z.tag=$[1],Z.postTag=$[3],Z.description=Z.description.slice($[0].length),O.tag=$[2],O}}function h0(O="compact"){let Z=L1(O);return($)=>{let Q=0,W=[];for(let[K,{tokens:X}]of $.source.entries()){let H="";if(K===0&&X.description[0]!=="{")return $;for(let z of X.description){if(z==="{")Q++;if(z==="}")Q--;if(H+=z,Q===0)break}if(W.push([X,H]),Q===0)break}if(Q!==0)return $.problems.push({code:"spec:type:unpaired-curlies",message:"unpaired curlies",line:$.source[0].number,critical:!0}),$;let Y=[],q=W[0][0].postDelimiter.length;for(let[K,[X,H]]of W.entries()){if(X.type=H,K>0)X.type=X.postDelimiter.slice(q)+H,X.postDelimiter=X.postDelimiter.slice(0,q);[X.postType,X.description]=G0(X.description.slice(H.length)),Y.push(X.type)}return Y[0]=Y[0].slice(1),Y[Y.length-1]=Y[Y.length-1].slice(0,-1),$.type=Z(Y),$}}var V1=(O)=>O.trim();function L1(O){if(O==="compact")return(Z)=>Z.map(V1).join("");else if(O==="preserve")return(Z)=>Z.join(`
|
|
6
|
+
`);else return O}var w1=(O)=>O&&O.startsWith('"')&&O.endsWith('"');function f0(){let O=(Z,{tokens:$},Q)=>$.type===""?Z:Q;return(Z)=>{let{tokens:$}=Z.source[Z.source.reduce(O,0)],Q=$.description.trimLeft(),W=Q.split('"');if(W.length>1&&W[0]===""&&W.length%2===1)return Z.name=W[1],$.name=`"${W[1]}"`,[$.postName,$.description]=G0(Q.slice($.name.length)),Z;let Y=0,q="",K=!1,X;for(let z of Q){if(Y===0&&m0(z))break;if(z==="[")Y++;if(z==="]")Y--;q+=z}if(Y!==0)return Z.problems.push({code:"spec:name:unpaired-brackets",message:"unpaired brackets",line:Z.source[0].number,critical:!0}),Z;let H=q;if(q[0]==="["&&q[q.length-1]==="]"){K=!0,q=q.slice(1,-1);let z=q.split("=");if(q=z[0].trim(),z[1]!==void 0)X=z.slice(1).join("=").trim();if(q==="")return Z.problems.push({code:"spec:name:empty-name",message:"empty name",line:Z.source[0].number,critical:!0}),Z;if(X==="")return Z.problems.push({code:"spec:name:empty-default",message:"empty default value",line:Z.source[0].number,critical:!0}),Z;if(!w1(X)&&/=(?!>)/.test(X))return Z.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:Z.source[0].number,critical:!0}),Z}if(Z.optional=K,Z.name=q,$.name=H,X!==void 0)Z.default=X;return[$.postName,$.description]=G0(Q.slice($.name.length)),Z}}function D0(O="compact",Z=t){let $=s0(O);return(Q)=>{return Q.description=$(Q.source,Z),Q}}function s0(O){if(O==="compact")return R1;if(O==="preserve")return F1;return O}function R1(O,Z=t){return O.map(({tokens:{description:$}})=>$.trim()).filter(($)=>$!=="").join(" ")}var I1=(O,{tokens:Z},$)=>Z.type===""?O:$,A1=({tokens:O})=>(O.delimiter===""?O.start:O.postDelimiter.slice(1))+O.description;function F1(O,Z=t){if(O.length===0)return"";if(O[0].tokens.description===""&&O[0].tokens.delimiter===Z.start)O=O.slice(1);let $=O[O.length-1];if($!==void 0&&$.tokens.description===""&&$.tokens.end.endsWith(Z.end))O=O.slice(0,-1);return O=O.slice(O.reduce(I1,0)),O.map(A1).join(`
|
|
7
|
+
`)}function p0({startLine:O=0,fence:Z="```",spacing:$="compact",markers:Q=t,tokenizers:W=[P0(),h0($),f0(),D0($)]}={}){if(O<0||O%1>0)throw Error("Invalid startLine");let Y=c0({startLine:O,markers:Q}),q=d0({fence:Z}),K=i0({tokenizers:W}),X=s0($);return function(H){let z=[];for(let J of JO(H)){let L=Y(J);if(L===null)continue;let F=q(L),k=F.slice(1).map(K);z.push({description:X(F[0],Q),tags:k,source:L,problems:k.reduce((u,m)=>u.concat(m.problems),[])})}return z}}function C1(O){return O.start+O.delimiter+O.postDelimiter+O.tag+O.postTag+O.type+O.postType+O.name+O.postName+O.description+O.end+O.lineEnd}function o0(){return(O)=>O.source.map(({tokens:Z})=>C1(Z)).join(`
|
|
8
|
+
`)}var P1={line:0,start:0,delimiter:0,postDelimiter:0,tag:0,postTag:0,name:0,postName:0,type:0,postType:0,description:0,end:0,lineEnd:0};var M3=Object.keys(P1);function V0(O,Z={}){return p0(Z)(O)}var N3=o0();var h1=null;function f1(O,Z,$){let Q={value:void 0,replace:!1};if(!$||typeof $!=="object"||!("type"in $))return Q;if($.type==="Identifier")Q.value=$.name,Q.replace=!0;else if($.type==="Literal")Q.value=String($.value);else if($.type==="MemberExpression")Q.value=F0(O,Z,$);else if(($.type==="ObjectExpression"||$.type==="TemplateLiteral")&&"start"in $&&"end"in $&&typeof $.start==="number"&&typeof $.end==="number")Q.value=x(O,$.start,$.end);return Q}function BO(O,Z,$){let Q={};for(let W of $.properties){if(W.type!=="Property"||W.computed)continue;let Y=Z.getPropertyName(W.key);if(!Y)continue;Q[Y]=f1(O,Z,W.value)}return Q}function D1(O,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return null;if(Z.type==="Identifier"){let Y=Z,q=O.propLocalToPublicName.get(Y.name);if(!q)return null;return{publicName:q,trackingName:Y.name}}if(Z.type!=="MemberExpression")return null;let $=Z,Q=$.object&&typeof $.object==="object"&&"type"in $.object&&$.object.type==="Identifier"?$.object.name:void 0;if(!Q||!O.wholePropsLocals.has(Q))return null;let W;if(!$.computed&&$.property&&typeof $.property==="object"&&"type"in $.property){if($.property.type==="Identifier")W=$.property.name;else if($.property.type==="Literal"&&$.property.value!=null)W=String($.property.value)}else if($.computed&&$.property&&typeof $.property==="object"&&"type"in $.property&&$.property.type==="Literal"&&"value"in $.property&&$.property.value!=null)W=String($.property.value);if(!W)return null;return{publicName:W,trackingName:W}}function VO(O,Z){let $=Z;if($&&typeof $==="object"&&"type"in $&&$.type==="ChainExpression")$=$.expression;if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return null;let Q=$;if(!Q.callee||typeof Q.callee!=="object"||!("type"in Q.callee))return null;let W=D1(O,Q.callee);if(!W)return null;return{...W,arguments:Q.arguments}}function L0(O,{slot_name:Z,slot_props:$,slot_fallback:Q,slot_description:W,slot_deprecated:Y,slot_tags:q,source:K}){let X=Z===void 0||Z==="",H=X?h1:Z??"",z=n(Q),J=$===void 0||$===""?void 0:$,L=W?.trim()||void 0;if(O.slots.has(H)){let F=O.slots.get(H);if(F)O.slots.set(H,{...F,default:F.default??X,fallback:z,slot_props:F.slot_props===void 0?J:F.slot_props,description:F.description||L,deprecated:F.deprecated??Y,tags:F.tags||q,source:K||F.source})}else O.slots.set(H,{name:H,default:X,fallback:z,slot_props:$,description:L,deprecated:Y,tags:q,source:K})}var S1=/\s*=\s*/;function LO(O){let Z=O.indexOf("<");if(Z===-1||!O.endsWith(">"))return O;let $=O.slice(0,Z),Q=O.slice(Z+1,-1),W=wO(Q).map((Y)=>Y.trim().replace(S1," = ")).join(", ");return`${$}<${W}>`}var E1=/^\s*$/,b1=/;$/,_1=/^-\s*/;function j0(O){if(O===void 0)return;let Z=O.replace(_1,"").trim();return Z===""?"":Z}function w0(O){if(!O||O.length===0)return;return O[0].tokens.description}var RO=new Set(["since","example"]);function IO(O){if(!O||O.length===0)return"";let Z=[];for(let $ of O){let Q=$.tokens;if((Q.end??"").trim()==="*/")break;if(Q.tag){let W=`${Q.name??""}${Q.postName??""}${Q.description??""}`.trimEnd();if(W)Z.push(W)}else Z.push(`${Q.postDelimiter??""}${Q.description??""}`)}return Z.join(`
|
|
9
|
+
`)}function k1(O){let Z=O.trim();return Z===""?!0:Z}function AO(O,Z){return k1(`${O??""}${Z?` ${Z}`:""}`)}function T1(O){let Z=O.trim().replace(b1,"").trimEnd();if(!Z.startsWith("{")||!Z.endsWith("}"))return!1;let $=0,Q=null;for(let W=0;W<Z.length;W++){let Y=Z[W];if(Q!==null){if(Y==="\\"){W++;continue}if(Y===Q)Q=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Q=Y;continue}if(Y==="{"||Y==="["||Y==="(")$++;else if(Y==="}"||Y==="]"||Y===")"){if($--,$===0&&W<Z.length-1)return!1}}return $===0}function N1(O){let Z=O;if(!Z.startsWith("/*"))Z=`/*${Z}`;if(!Z.endsWith("*/"))Z+="*/";return Z}function n0(O){let Z=O[0]?.tags??[],$=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),Q,W=[],Y,q,K,X=[],H=[];for(let z of Z)if(z.tag==="type")Q=z;else if(z.tag==="param")W.push(z);else if(z.tag==="returns"||z.tag==="return")Y=z;else if(z.tag==="deprecated")K??=AO(z.name,z.description);else if(RO.has(z.tag))H.push(z);else if(z.tag==="bindable"){if(z.type)continue;let J=`${z.name}${z.description?` ${z.description}`:""}`.trim();if(J==="readonly"||J==="writable")q??=J}else if(!$.has(z.tag))X.push(z);return{type:Q,param:W,returns:Y,binding:q,deprecated:K,additional:X,passthrough:H,description:O[0]?.description}}function v1(O){if(!O||O.length===0)return;let Z=O[O.length-1];return Z&&typeof Z==="object"&&"value"in Z?Z:void 0}function g1(O,Z,$){if(!Z||Z.length===0||$===void 0||!O.source)return;for(let Q=Z.length-1;Q>=0;Q--){let W=Z[Q];if(!W||typeof W!=="object"||!("value"in W)||!("end"in W))continue;if(typeof W.end!=="number")continue;let Y=O.source.slice(W.end,$);if(E1.test(Y))return W}return}function z0(O,Z,$){if(!$?.leadingComments)return;let Q=g1(O,$.leadingComments,$.start);if(!Q)return;return y1(Z,[Q])}function FO(O,Z,$){if(!$?.leadingComments)return;return z0(O,Z,$)}function y1(O,Z){if(!Z)return;let $=v1(Z);if(!$)return;let Q=V0(N1($.value),{spacing:"preserve"}),{type:W,param:Y,returns:q,binding:K,deprecated:X,additional:H,passthrough:z,description:J}=n0(Q),L,F,k,u;if(W)L=O.aliasType(W.type);if(Y.length>0)F=Y.filter((f)=>!f.name.includes(".")).map((f)=>({name:f.name,type:O.aliasType(f.type),description:j0(f.description),optional:f.optional||!1}));if(q)k=O.aliasType(q.type);let m=n(J?.trim());if(m||H.length>0){let f=[];if(m)f.push(m);for(let i of H){let e=`@${i.tag}${i.name?` ${i.name}`:""}${i.description?` ${i.description}`:""}`;f.push(e)}u=f.join(`
|
|
10
|
+
`)}let O0=z.length>0?z.map((f)=>({name:f.tag,body:IO(f.source)})):void 0;return{type:L,params:F,returnType:k,description:u,binding:K,deprecated:X,tags:O0}}function CO(O,Z,$=O.source){if(!$)return;let Q=0;for(let{tags:W,description:Y,source:q}of V0($,{spacing:"preserve"})){let K=q.map((B)=>B.source).join(`
|
|
11
|
+
`),X=$.indexOf(K,Q),H=X===-1?void 0:X;if(X!==-1)Q=X+K.length;let z,J,L,F,k,u,m=[],O0=[],f,i,e,W0=[],p,G,j=[],V,I=!1,U=!0,M=[],D,S=new Map,C=new Set,T=new Set;for(let B of W)if(B.source&&B.source.length>0)C.add(B.source[0].number);for(let B of q)if(!B.tokens.tag&&B.tokens.description&&B.tokens.description.trim()!=="}")S.set(B.number,B.tokens.description);let E=(B)=>{if(!B||B.length===0)return;let _=B[0].number,R=[],N=[],l=!1;for(let A=_-1;A>=1;A--){if(C.has(A))break;let P=S.get(A);if(P)R.unshift(P),N.unshift(A),l=!0;else if(l){let w=q.find((h)=>h.number===A);if(!(!w||!w.tokens.tag&&(!w.tokens.description||w.tokens.description.trim()==="")))break}}if(R.length===0)return;for(let A of N)T.add(A);return R.join(`
|
|
12
|
+
`).trim()},y=()=>{if(z!==void 0){let B=J&&J!=="object"&&J!=="Object"?J:void 0,_;if(B)_=B;else if(O0.length>0)_=u0(O0,z,!0);else _=J||"";if(u!==void 0){let R;for(let A of W){let P=A.source?.[0]?.number;if(typeof P!=="number")continue;if(P<=u)continue;if(A.tag==="property"||A.tag==="type")continue;R=P;break}let N=[],l=Array.from(S.keys()).sort((A,P)=>A-P);for(let A of l){if(A<=u)continue;if(R!==void 0&&A>=R)continue;if(T.has(A))continue;let w=S.get(A)?.trim();if(w)N.push(w),T.add(A)}if(N.length>0){let A=N.join(`
|
|
13
|
+
`);L=L?`${L}
|
|
14
|
+
${A}`:A}}B0(O,{name:z,detail:_,has_argument:!1,description:L,deprecated:F,tags:m.length>0?m:void 0,source:k}),O.eventDescriptions.set(z,L),O.jsDocEventNames.add(z),O.jsDocEventSources.set(z,k),O0.length=0,z=void 0,J=void 0,L=void 0,F=void 0,k=void 0,u=void 0,m=[]}},a=()=>{if(f!==void 0){let B,_;if(W0.length>0)B=u0(W0,void 0,!0),_=`type ${f} = ${B};`;else if(i)B=i,_=T1(B)?`interface ${f} ${B}`:`type ${f} = ${B};`;else B="{}",_=`type ${f} = ${B};`;O.typedefs.set(f,{type:B,name:f,description:n(e),ts:_}),W0.length=0,f=void 0,i=void 0,e=void 0}},Z0=()=>{if(p!==void 0){let R=`(${j.map(({name:l,type:A,optional:P})=>{return`${l}${P?"?":""}: ${A}`}).join(", ")}) => ${V||"void"}`,N=`type ${p} = ${R};`;O.typedefs.set(p,{type:R,name:p,description:n(G),ts:N}),j.length=0,V=void 0,p=void 0,G=void 0}},b=W.some((B)=>B.tag==="slot"||B.tag==="snippet"),r=W.some((B)=>B.tag==="extends"||B.tag==="extendProps");for(let{tag:B,type:_,name:R,description:N,optional:l,default:A,source:P}of W){let w=Z.aliasType(_),s=E(P);switch(B){case"extends":case"extendProps":if(O.extends={interface:R,import:w},U)U=!1;break;case"restProps":{let h=R?N?`${R} ${N}`:R:N,Y0=j0(h)||s;if(!Y0&&U&&!I&&Y)Y0=Y,I=!0;if(O.rest_props={type:"Element",name:w,description:Y0||void 0},U)U=!1;break}case"slot":case"snippet":{let o=j0(w0(P));if(!o&&U&&!I&&Y)o=Y,I=!0;if(!o&&M.length===0)o=s;if(U)U=!1;L0(O,{slot_name:R,slot_props:w,slot_description:o||void 0,slot_deprecated:D,slot_tags:M.length>0?[...M]:void 0,source:r0(O,q,P,H)}),M.length=0,D=void 0;break}case"event":{if(y(),z=R,J=w,u=P&&P.length>0?P[0].number:void 0,L=j0(w0(P))||s,!L&&U&&!I&&Y)L=Y,I=!0;if(k=r0(O,q,P,H),U)U=!1;break}case"type":if(z!==void 0)J=w;break;case"param":if(p!==void 0)j.push({name:R,type:w,optional:l||!1});break;case"returns":case"return":if(p!==void 0)V=w;break;case"property":{let h={name:R,type:w,description:j0(w0(P)),optional:l||!1,default:A};if(z!==void 0)O0.push(h);else if(f!==void 0)W0.push(h);break}case"typedef":{if(a(),f=LO(R),i=w,e=j0(w0(P))||s,!e&&U&&!I&&Y)e=Y,I=!0;if(U)U=!1;break}case"callback":{if(Z0(),p=LO(R),G=j0(w0(P))||s,!G&&U&&!I&&Y)G=Y,I=!0;if(U)U=!1;break}case"generics":if(O.generics=[R,w],U)U=!1;break;case"template":{let h=R;if(w)h=`${R} extends ${w}`;if(A)h+=` = ${A}`;if(b&&!r){O.deferredSlotBlockGenerics.push({name:R,constraint:h});break}if(Z.accumulateGeneric(R,h),U)U=!1;break}case"deprecated":{let h=AO(R,N);if(z===void 0)D??=h;else F??=h;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let h={name:B,body:IO(P)};if(z!==void 0&&RO.has(B))m.push(h);else M.push(h)}break}}y(),a(),Z0()}}function x1({hasTypeScriptType:O,hasJSDocType:Z,inferredType:$,finalType:Q}){if(O)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(Q!==void 0)return"inferred";return"unknown"}function R0(O){let Z=O.explicitType??O.jsdocType??O.resolvedType??O.typeSeed,$=O.jsdocParams??O.resolvedParams,Q=O.jsdocReturnType??O.resolvedReturnType;if(O.isFunctionDeclaration&&Z==="() => any"&&Q)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${Q}`:`() => ${Q}`;let W=O.jsdocDescription??O.resolvedDescription;if(W===void 0&&Z!==void 0)W=O.typedefs?.get(Z)?.description;let Y=x1({hasTypeScriptType:O.explicitType!==void 0,hasJSDocType:O.jsdocType!==void 0||O.jsdocParams!==void 0||O.jsdocReturnType!==void 0||O.resolvedType!==void 0,inferredType:O.inferredTypeForSource,finalType:Z}),q=O.initializerIsFunction||O.isFunctionDeclaration||O.inferIsFunctionFromTypeSignature===!0&&(!!O.jsdocParams?.length||O.jsdocReturnType!==void 0||!!O.jsdocType?.includes("=>")||!!O.resolvedType?.includes("=>")||!!O.explicitType?.includes("=>"));return{type:Z,typeSource:Y,description:W,params:$,returnType:Q,isFunction:q}}function u1(O){if(!O||typeof O!=="object"||!("type"in O))return;let Z=String(O.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in O&&typeof O.name==="string"?O.name:void 0;if(!$)return;let Q=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in O&&typeof O.tag==="string")Q.thisValue=O.tag;return Q}function PO(O,Z){if(O.rest_props!==void 0)return;let $=u1(Z);if($)O.rest_props=$}function d(O,Z,$){if(!Z||O.has(Z))return;O.set(Z,$)}function S0(O,Z){for(let $=O.activeScopes.length-1;$>=0;$-=1){let Q=O.activeScopes[$]?.get(Z);if(!Q)continue;return Q.kind==="prop"?Q.publicPropName:void 0}return}function g(O,Z=new Set){if(!O||typeof O!=="object"||!("type"in O))return Z;switch(O.type){case"Identifier":Z.add(O.name);break;case"AssignmentPattern":g(O.left,Z);break;case"ArrayPattern":for(let $ of O.elements)g($??void 0,Z);break;case"ObjectPattern":for(let $ of O.properties)if($.type==="Property")g($.value,Z);else if($.type==="RestElement")g($.argument,Z);break;case"RestElement":g(O.argument,Z);break}return Z}function e0(O,Z){let $=g(Z);if(!$)return;for(let Q of $){let W=S0(O,Q);if(W)O.reactive_vars.add(W)}}function E0(O){if(!O||typeof O!=="object"||!("type"in O))return!1;switch(String(O.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function fO(O){if(!O||typeof O!=="object"||!("type"in O))return!1;let Z=String(O.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function m1(O,Z){let $=O.scopeDeclarations.get(Z);if(!$)$=new Map,O.scopeDeclarations.set(Z,$);return $}function l1(O,Z,$){let Q=[];if($.id.type==="Identifier")return Q.push({kind:"local",name:$.id.name}),Q;if($.id.type!=="ObjectPattern")return Q;for(let W of $.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Q.push({kind:"local",name:W.argument.name});continue}if(W.computed)continue;let Y=O.getPropertyName(W.key);if(!Y)continue;let q;if(W.value.type==="Identifier")q=W.value.name;else if(W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier")q=W.value.left.name;if(!q)continue;Q.push({kind:"prop",name:q,publicPropName:Y})}return Q}function t0(O,Z,$,Q,W){if(!hO(Z))return;let Y=W?.allowRunesProps??!1,q=W?.forceProp??!1,K=Z;for(let X of K.declarations){if(Y&&$0(J0(X.init),"$props")){for(let J of l1(O,K,X))d(J.kind==="prop"?$:Q,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}let H=K.kind==="var"?Q:$,z=q?"prop":"local";for(let J of g(X.id))d(H,J,z==="prop"?{kind:"prop",publicPropName:J}:{kind:"local"})}}function d1(O,Z){if("id"in O&&O.id&&typeof O.id==="object"&&"name"in O.id&&typeof O.id.name==="string")d(Z,O.id.name,{kind:"local"});for(let $ of O.params)for(let Q of g($))d(Z,Q,{kind:"local"})}function c1(O,Z,$,Q){if(!Array.isArray(Z))return;for(let W of Z){if(!W||typeof W!=="object"||!("type"in W))continue;switch(W.type){case"VariableDeclaration":t0(O,W,$,Q);break;case"FunctionDeclaration":if(W.id?.name)d($,W.id.name,{kind:"local"});break;case"ClassDeclaration":if(W.id?.name)d($,W.id.name,{kind:"local"});break}}}function i1(O,Z,$){if(!$||typeof $!=="object")return;let Q="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!Q||!("body"in Q)||!Array.isArray(Q.body))return;for(let W of Q.body){if(!W||typeof W!=="object"||!("type"in W))continue;switch(W.type){case"ImportDeclaration":for(let Y of W.specifiers??[])if(Y.local?.name)d(Z.componentScope,Y.local.name,{kind:"local"});break;case"VariableDeclaration":t0(O,W,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(W.id?.name)d(Z.componentScope,W.id.name,{kind:"local"});break;case"ClassDeclaration":if(W.id?.name)d(Z.componentScope,W.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!W.declaration||typeof W.declaration!=="object"||!("type"in W.declaration))break;if(W.declaration.type==="VariableDeclaration")t0(O,W.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(W.declaration.type==="FunctionDeclaration"&&W.declaration.id?.name)d(Z.componentScope,W.declaration.id.name,{kind:"prop",publicPropName:W.declaration.id.name});break}}}function DO(O,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,i1(O,Z,Z.parsed?.instance)}function SO(O){return{varScopeStack:[O.componentScope]}}function EO(O,Z,$,Q){if(!E0(Q))return;let W=m1(Z,Q),Y=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":d1(Q,W);break;case"BlockStatement":c1(O,Q.body,W,Y);break;case"CatchClause":if("param"in Q)for(let K of g(Q.param))d(W,K,{kind:"local"});break;case"EachBlock":{let K=Q;for(let X of g(K.context))d(W,X,{kind:"local"});if(typeof K.index==="string")d(W,K.index,{kind:"local"});else if(K.index&&"name"in K.index)d(W,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in Q)for(let K of g(Q.value))d(W,K,{kind:"local"});break;case"CatchBlock":if("error"in Q)for(let K of g(Q.error))d(W,K,{kind:"local"});break}if(fO(Q))$.varScopeStack.push(W)}function bO(O,Z){if(fO(Z))O.varScopeStack.pop()}var s1=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function p1(O,Z){switch(Z?.type){case"MemberExpression":return Z.computed||O===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return O===Z.meta;case"PropertyDefinition":return Z.computed||O===Z.value;case"Property":return Z.computed||O===Z.value;case"ExportSpecifier":case"ImportSpecifier":return O===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function o1(O,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(O))return!0;return!1}function a1(O){let Z=new Set;if(!O||typeof O!=="object"||!("type"in O))return Z;switch(String(O.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=O;if($.id?.name)Z.add($.id.name);for(let Q of $.params??[])g(Q,Z);break}case"BlockStatement":b0(O.body,Z);break;case"CatchClause":g(O.param,Z);break;case"EachBlock":{let $=O;if(g($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":g(O.value,Z);break;case"CatchBlock":g(O.error,Z);break}return Z}function b0(O,Z){if(!Array.isArray(O))return;for(let $ of O){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let Q of $.specifiers??[])if(Q.local?.name)Z.add(Q.local.name);break;case"VariableDeclaration":for(let Q of $.declarations??[])g(Q.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let Q=$.id?.name;if(Q)Z.add(Q);break}case"ExportNamedDeclaration":{let Q=$.declaration;if(Q&&typeof Q==="object"&&"type"in Q)b0([Q],Z);break}}}}function OO(O,Z){if(!O||typeof O!=="object")return!1;let $=[...Z],Q=!1;return X0(O,{enter(W,Y){if(Q){this.skip();return}if(E0(W))$.push(a1(W));if(Y&&W.type==="Identifier"&&s1.has(W.name)&&!Y.type.startsWith("TS")&&p1(W,Y)&&!o1(W.name,$))Q=!0,this.skip()},leave(W){if(E0(W))$.pop()}}),Q}function _O(O){if(!O||typeof O!=="object")return;if("content"in O){let Z=O.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in O&&Array.isArray(O.body))return O.body;return}function kO(O){if(O.runesOptionOverride!==void 0)return O.runesOptionOverride?"runes":"legacy";let Z=O.parsed;if(!Z)return"legacy";let $=new Set;b0(_O(Z.module),$);let Q=new Set;return b0(_O(Z.instance),Q),OO(Z.module,[$])||OO(Z.instance,[$,Q])||OO(Z.html,[$,Q])?"runes":"legacy"}var r1=/[A-Za-z_$][\w$]*/g;function n1(O,Z,$){let Q=new Map,W=Z.typeParameters?.params,Y=$.typeArguments?.params;if(!W?.length||!Y?.length)return Q;for(let q=0;q<W.length;q++){let K=W[q]?.name,X=Y[q];if(!K||X?.start===void 0||X?.end===void 0)continue;let H=x(O,X.start,X.end)?.trim();if(H)Q.set(K,H)}return Q}function t1(O,Z){if(Z.size===0)return O;return O.replace(r1,($)=>Z.get($)??$)}function I0(O,Z,$,Q,W=new Set){let Y=new Map;if(!$?.type)return Y;let q=(K)=>{for(let X of K){if(X?.type!=="TSPropertySignature"||X.computed)continue;if(!X.key)continue;let H=O.getPropertyName(X.key);if(!H)continue;let z=X.typeAnnotation?.start,J=X.typeAnnotation?.end;if(z===void 0||J===void 0)continue;let L=x(Z,z+1,J)?.trim();if(!L)continue;Y.set(H,{type:L,optional:X.optional===!0,source:v(Z,X)})}};switch($.type){case"TSTypeLiteral":q($.members??[]);break;case"TSInterfaceDeclaration":q($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=I0(O,Z,$.typeAnnotation,Q,W);for(let[X,H]of K)Y.set(X,H);break}case"TSTypeReference":{let K=gO($.typeName);if(!K||W.has(K))break;let X=Q.get(K);if(!X)break;W.add(K);let H=I0(O,Z,X,Q,W);W.delete(K);let z=n1(Z,X,$);for(let[J,L]of H)Y.set(J,z.size===0?L:{...L,type:t1(L.type,z)});break}case"TSIntersectionType":for(let K of $.types??[]){let X=I0(O,Z,K,Q,W);for(let[H,z]of X)Y.set(H,z)}break;case"TSParenthesizedType":{let K=I0(O,Z,$.typeAnnotation,Q,W);for(let[X,H]of K)Y.set(X,H);break}}return Y}function mO(O,Z,$){if(Z.runesPropsDeclarationMetadataByDeclaratorStart.clear(),Z.explicitPropTypesByName.clear(),Z.explicitVariableTypesByName.clear(),Z.typeImportBindingsByLocalName.clear(),Z.localTypeDeclarationsByName.clear(),Z.typedRunesPropsDeclarations.length=0,!Z.source)return;let Q=$;Z.scriptLanguage=O.resolveScriptLanguage(Q),Z.customElementTag=Q.options?.customElement?.tag,Z.runesOptionOverride=Q.options?.runes,Z.scriptGenericsAttribute=O.resolveScriptGenericsAttribute(Q);let W=Q.instance?.content?.body??[];for(let Y of W){if(!Y?.type)continue;if(Y.type==="ImportDeclaration"&&Y.source?.value)for(let q of Y.specifiers??[]){let K=q.local?.name;if(!K)continue;if(!(Y.importKind==="type"||q.importKind==="type"))continue;let H,z;if(q.type==="ImportSpecifier")H="named",z=q.imported?.type==="Identifier"?q.imported.name:typeof q.imported?.value==="string"?q.imported.value:void 0;else if(q.type==="ImportDefaultSpecifier")H="default";else if(q.type==="ImportNamespaceSpecifier")H="namespace";if(!H)continue;Z.typeImportBindingsByLocalName.set(K,{importedName:z,localName:K,source:String(Y.source.value),specifierType:H})}if((Y.type==="TSInterfaceDeclaration"||Y.type==="TSTypeAliasDeclaration")&&Y.id?.name&&Y.start!==void 0&&Y.end!==void 0)Z.localTypeDeclarationsByName.set(Y.id.name,{code:x(Z,Y.start,Y.end)?.trim()??"",node:Y,start:Y.start});if(Y.type==="ExportNamedDeclaration"&&Y.declaration?.type==="VariableDeclaration")for(let q of Y.declaration.declarations??[]){if(q.id?.type!=="Identifier"||!q.id.name)continue;let K=_0(Z,q.id.typeAnnotation);if(K)Z.explicitPropTypesByName.set(q.id.name,K)}else if(Y.type==="VariableDeclaration")for(let q of Y.declarations??[]){if(q.id?.type!=="Identifier"||!q.id.name)continue;let K=_0(Z,q.id.typeAnnotation);if(K)Z.explicitVariableTypesByName.set(q.id.name,K)}}for(let Y of W){if(!Y||typeof Y!=="object"||!("declarations"in Y))continue;for(let q of Y.declarations??[]){if(!$0(J0(q.init),"$props"))continue;let K=q.id?.typeAnnotation?void 0:TO(q.init),X=q.id?.typeAnnotation?.typeAnnotation??K,H=q.id?.typeAnnotation?_0(Z,q.id.typeAnnotation):yO(Z,K),z=I0(O,Z,X,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([F,k])=>[F,k.node]))),J=new Set,L=new Set;if(xO(Z,X,J,L),uO(Z,J,L),q.start!==void 0){let F={canonicalType:H,props:z,referencedImportedTypes:J,referencedLocalTypes:L};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(q.start,F),H)Z.typedRunesPropsDeclarations.push(F)}}}}function lO(O,Z,$){for(let Q of $.declarations){if(!$0(J0(Q.init),"$props"))continue;if(Q.id.type==="Identifier"){Z.wholePropsLocals.add(Q.id.name),Z.restPropLocals.add(Q.id.name);let q=NO(Z,Q.start);if(q)for(let[K,X]of q.props)M0(O,Z,K,{name:K,kind:"let",type:X.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!X.optional,constant:!1,reactive:!1,source:X.source});continue}if(Q.id.type!=="ObjectPattern")continue;let W=z0(Z,O,$),Y=Q.id.properties.filter((q)=>{if(q.type!=="Property"||q.computed)return!1;if(!O.getPropertyName(q.key))return!1;if(q.value.type==="Identifier")return!0;return q.value.type==="AssignmentPattern"&&q.value.left.type==="Identifier"}).length;for(let q of Q.id.properties){if(q.type==="RestElement"){if(q.argument.type==="Identifier")Z.restPropLocals.add(q.argument.name);continue}let K=O.getPropertyName(q.key);if(!K)continue;let X,H;if(q.value.type==="Identifier")X=q.value.name;else{let I=q.value;X=I.left.name,H=I.right}if(!X)continue;if(O.trackPropLocalName(K,X),K==="children")Z.snippetPropLocals.add(X);let z=FO(Z,O,q)??(Y===1?W:void 0),J=vO(Z,Q.start,K),{init:L,bindable:F}=KO(H),k=L==null?{isFunction:!1}:H0(O,Z,L),{value:u,type:m,isFunction:O0,defaultValue:f}=k,i=J?.type===void 0&&z?.type===void 0?k.resolvedType:void 0,{type:e,typeSource:W0,description:p,params:G,returnType:j,isFunction:V}=R0({explicitType:J?.type,typeSeed:m,inferredTypeForSource:m,jsdocType:z?.type,jsdocDescription:z?.description,jsdocParams:z?.params,jsdocReturnType:z?.returnType,resolvedType:i,resolvedDescription:k.resolvedDescription,resolvedParams:k.resolvedParams,resolvedReturnType:k.resolvedReturnType,initializerIsFunction:O0,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(F)Z.reactive_vars.add(K);M0(O,Z,K,{name:K,...X===K?{}:{localName:X},kind:"let",description:p,binding:z?.binding,deprecated:z?.deprecated,tags:z?.tags,...F?{bindable:!0}:{},type:e,typeSource:W0,value:u,defaultValue:f,params:G,returnType:j,isFunction:V,isFunctionDeclaration:!1,isRequired:L==null&&J?.optional!==!0,constant:!1,reactive:F,source:v(Z,q)})}}}function dO(O,Z){if(O.syntaxMode!=="runes")return;for(let[$,Q]of Array.from(O.events.entries())){if(Q.type!=="dispatched")continue;if(Z.has($)||O.forwardedEvents.has($))continue;let W=`on${$}`,Y=O.props.get(W);if(!Y)continue;let q=Y.type!==void 0||Y.params!==void 0||Y.returnType!==void 0,K=Q.detail===void 0||Q.detail==="undefined"||Q.detail==="null"?"() => void":`(detail: ${Q.detail}) => void`;O.props.set(W,{...Y,description:Y.description??Q.description,type:q?Y.type:K,typeSource:q?Y.typeSource:"inferred",isFunction:!0}),O.events.delete($)}}var cO=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function k0(O){if(!O||typeof O!=="object")return;X0(O,{enter(Z){if(!cO.has(Z.type))return;let $=Z.expression;while($&&cO.has($.type))$=$.expression;if($)this.replace($)}})}var e1=/^\s*$/;function sO(O,Z,$){let Q=Z+1;while(Q<O.length){if(O[Q]==="\\"){Q+=2;continue}if(O[Q]===$)return Q+1;Q++}return Q}function pO(O,Z){let $=Z+1,Q=0;while($<O.length){let W=O[$];if(W==="\\"){$+=2;continue}if(Q===0){if(W==="`")return $+1;if(W==="$"&&O[$+1]==="{"){Q=1,$+=2;continue}$++;continue}if(W==="{")Q++;else if(W==="}")Q--;else if(W==='"'||W==="'"){$=sO(O,$,W);continue}else if(W==="`"){$=pO(O,$);continue}$++}return $}function O2(O,Z){let $=[],Q=O.length,W=0;while(W<Q){let Y=O[W];if(Y==='"'||Y==="'"){W=sO(O,W,Y);continue}if(Y==="`"){W=pO(O,W);continue}if(Y==="/"&&O[W+1]==="/"){let q=W+2;while(q<Q&&O[q]!==`
|
|
15
|
+
`)q++;W=q;continue}if(Y==="/"&&O[W+1]==="*"){let q=W,K=W+2;while(K<Q&&!(O[K]==="*"&&O[K+1]==="/"))K++;let X=Math.min(K+2,Q),H=O.slice(q,X);$.push({end:X+Z,isJsDoc:H.startsWith("/**")&&H.length>4,text:H}),W=X;continue}W++}return $}function iO(O,Z,$){if(!O||typeof O!=="object"||!("type"in O))return;let Q=O;if(Q.type==="FunctionDeclaration"){if(Q.id?.type==="Identifier"&&Q.id.name)$.push({name:Q.id.name,start:Z});return}if(Q.type==="VariableDeclaration"){for(let W of Q.declarations??[])if(W?.id?.type==="Identifier"&&W.id.name)$.push({name:W.id.name,start:Z})}}function Z2(O){let Z=[];for(let $ of O){if(!$||typeof $!=="object"||!("type"in $))continue;let Q=$;if(Q.start===void 0)continue;if(Q.type==="ExportNamedDeclaration"&&Q.declaration)iO(Q.declaration,Q.start,Z);else iO(Q,Q.start,Z)}return Z}function $2(O,Z,$){let Q;for(let W of O){if(W.end>Z)break;if(!W.isJsDoc)continue;if(!e1.test($.slice(W.end,Z)))continue;Q=W}return Q}function oO(O,Z){let $=new Map;if(!O.source)return $;let Q=[O.parsed?.module,O.parsed?.instance],W=[],Y=[];for(let q of Q){let K=q?.content;if(!K?.body||K.start===void 0||K.end===void 0)continue;W.push(...O2(O.source.slice(K.start,K.end),K.start)),Y.push(...Z2(K.body))}W.sort((q,K)=>q.end-K.end);for(let q of Y){let K=$2(W,q.start,O.source);if(!K)continue;let X=V0(K.text,{spacing:"preserve"}),{type:H,description:z}=n0(X);if(!H)continue;$.set(q.name,{type:Z.aliasType(H.type),description:z||H.description})}return $}function aO(O){if(O==="var")return"let";if(O==="using"||O==="await using")return"const";return O}var Q2=null,rO=/^@component/,W2=/\r/g,Y2=/^\{\s*\}$/;class c{ctx=N0();static mapToArray(O){return Array.from(O,([Z,$])=>$)}static getStaticAttributeValue(O){if(!Array.isArray(O.value))return;return O.value.map((Z)=>Z.data??Z.raw??"").join("").trim()}resolveScriptLanguage(O){let Z=[O.instance,O.module].filter((Q)=>Q!==void 0),$=!1;for(let Q of Z){let W=Q.attributes?.find((q)=>q.name==="lang");if(!W){$=!0;continue}if(c.getStaticAttributeValue(W)?.toLowerCase()==="ts")return"ts"}return $?"js":void 0}resolveScriptGenericsAttribute(O){let Z=O.instance?.attributes?.find((q)=>q.name==="generics");if(!Z)return;let $=v(this.ctx,Z),Q=O.instance?.attributes?.find((q)=>q.name==="lang");if((Q?c.getStaticAttributeValue(Q)?.toLowerCase():void 0)!=="ts"){K0(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',$);return}let Y=c.getStaticAttributeValue(Z);if(!Y)return;return{value:Y,source:$}}resolvePublicPropName(O){return this.ctx.propLocalToPublicName.get(O)??O}trackPropLocalName(O,Z=O){this.ctx.propLocalToPublicName.set(Z,O)}getPropByLocalOrPublic(O){return this.ctx.props.get(this.resolvePublicPropName(O))}getPropTypeByLocalOrPublic(O){return this.getPropByLocalOrPublic(O)?.type}getExplicitPropType(O){return this.ctx.explicitPropTypesByName.get(O)}getPropertyName(O){if(!O||typeof O!=="object"||!("type"in O))return;if(Q0(O))return O.name;if(U0(O))return O.value==null?void 0:String(O.value);return}isNumericConstant(O){if(!O||typeof O!=="object"||!("type"in O))return!1;if(O.type!=="MemberExpression")return!1;let Z=O,$=Z.object&&"name"in Z.object?Z.object.name:void 0,Q=Z.property&&"name"in Z.property?Z.property.name:void 0;if(!$||!Q)return!1;if($==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(Q);if($==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(Q);return!1}resolveLocalVarJSDoc(O){for(let $ of this.ctx.vars)if($.declarations.some((W)=>W.id&&typeof W.id==="object"&&("type"in W.id)&&W.id.type==="Identifier"&&("name"in W.id)&&W.id.name===O))return z0(this.ctx,this,$);let Z=this.ctx.funcDecls.get(O);if(Z)return z0(this.ctx,this,Z);return}addModuleExport(O,Z){if(n(O)===void 0)return;if(this.ctx.moduleExports.has(O)){let $=this.ctx.moduleExports.get(O);this.ctx.moduleExports.set(O,{...$,...Z})}else this.ctx.moduleExports.set(O,Z)}aliasType(O){if(O==="*")return"any";return O.trim()}findVariableTypeAndDescription(O){let Z=this.getPropByLocalOrPublic(O);if(Z?.type)return{type:Z.type,description:Z.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=oO(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let $=this.ctx.variableInfoCache.get(O),Q=this.ctx.explicitVariableTypesByName.get(O);if(Q)return{type:Q,description:$?.description};return $??null}accumulateGeneric(O,Z){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${O}`,`${this.ctx.generics[1]}, ${Z}`];else this.ctx.generics=[O,Z]}cleanup(){this.ctx=N0()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(O){return c.SCRIPT_BLOCK_REGEX.lastIndex=0,O.replace(c.SCRIPT_BLOCK_REGEX,(Z,$,Q,W)=>{c.TS_DIRECTIVE_REGEX.lastIndex=0;let Y=Q.replace(c.TS_DIRECTIVE_REGEX,"");return $+Y+W})}parseSvelteComponent(O,Z){this.cleanup(),this.ctx.componentFilePath=Z.filePath;let $=c.stripTypeScriptDirectivesFromScripts(O);this.ctx.source=$;let{modern:Q,legacy:W}=Z1($);if(mO(this,this.ctx,Q),this.ctx.parsed=W,this.ctx.scriptLanguage==="ts")k0(this.ctx.parsed.module),k0(this.ctx.parsed.instance),k0(this.ctx.parsed.html);this.ctx.syntaxMode=kO(this.ctx);let Y=this.ctx.parsed.css,q=Y?.start!==void 0&&Y?.end!==void 0?$.slice(0,Y.start)+" ".repeat(Y.end-Y.start)+$.slice(Y.end):$;if(CO(this.ctx,this,q),this.ctx.parsed?.module)X0(this.ctx.parsed?.module,{enter:(G)=>{if(G.type==="ExportNamedDeclaration"){if(G.declaration==null)return;if(!G.declaration||typeof G.declaration!=="object"||!("type"in G.declaration))return;let j,V,I=!1,U,M,D,S=!1,C,T,E;if(G.declaration.type==="FunctionDeclaration"){let R=G.declaration;if(!R.id?.name)return;j=R.id.name,V="function",U=void 0,M="() => any",S=!0,I=!0}else if(G.declaration.type==="VariableDeclaration"){let R=G.declaration,N=R.declarations[0];if(!N||typeof N!=="object"||!("id"in N))return;let{id:l,init:A}=N;if(!l||typeof l!=="object"||!("name"in l))return;let P=l.name;j=P,V=aO(R.kind);let w=A==null?{isFunction:!1}:H0(this,this.ctx,A);({value:U,type:M,isFunction:S,defaultValue:C}=w),T=M,E=w,D=this.getExplicitPropType(P)}else return;let y=z0(this.ctx,this,G),{type:a,typeSource:Z0,description:b,params:r,returnType:B,isFunction:_}=R0({explicitType:D,typeSeed:M,inferredTypeForSource:T,jsdocType:y?.type,jsdocDescription:y?.description,jsdocParams:y?.params,jsdocReturnType:y?.returnType,resolvedType:E?.resolvedType,resolvedDescription:E?.resolvedDescription,resolvedParams:E?.resolvedParams,resolvedReturnType:E?.resolvedReturnType,initializerIsFunction:S,isFunctionDeclaration:I,typedefs:this.ctx.typedefs});this.addModuleExport(j,{name:j,kind:V,description:b,deprecated:y?.deprecated,tags:y?.tags,type:a,typeSource:Z0,value:U,defaultValue:C,params:r,returnType:B,isFunction:_,isFunctionDeclaration:I,isRequired:!1,constant:V==="const",reactive:!1,source:v(this.ctx,G)})}}});let K,X=new Set,H=new Set,z=[],J={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};DO(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let L=SO(this.ctx);if(X0(J,{enter:(G,j,V)=>{EO(this,this.ctx,L,G);let I=this.ctx.scopeDeclarations.get(G);if(I)this.ctx.activeScopes.push(I);if(G.type==="AssignmentExpression")e0(this.ctx,G.left);if(G.type==="UpdateExpression")e0(this.ctx,G.argument);if(G.type==="CallExpression"){let U=G,M=U.callee&&typeof U.callee==="object"&&"name"in U.callee?U.callee.name:void 0;if(M==="createEventDispatcher"){if(j&&typeof j==="object"&&"id"in j&&j.id&&typeof j.id==="object"&&"name"in j.id)K=j.id.name}if(M==="$host"){if(j&&typeof j==="object"&&"id"in j&&j.id&&typeof j.id==="object"&&"name"in j.id)X.add(j.id.name)}if(M==="setContext")HO(this.ctx,this,G,j??void 0);if(M)z.push({name:M,arguments:U.arguments,source:v(this.ctx,U)});if(nO(U.callee)&&Q0(U.callee.property)&&U.callee.property.name==="dispatchEvent"&&($0(U.callee.object,"$host")||Q0(U.callee.object)&&X.has(U.callee.object.name))){let D=UO(this.ctx,U);if(D)H.add(D)}}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Spread"){let U=G;if(U.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(U.expression?.name??""))PO(this.ctx,j)}if(G.type==="FunctionDeclaration"){let U=G;if(U.id?.name)this.ctx.funcDecls.set(U.id.name,U)}if(G.type==="VariableDeclaration"){if(this.ctx.vars.add(G),j&&typeof j==="object"&&"type"in j&&j.type==="Program"&&G.declarations.some((U)=>$0(J0(U.init),"$props")))lO(this,this.ctx,G)}if(G.type==="ExportNamedDeclaration"){if(G.declaration==null&&G.specifiers.length===0)return;let U;if(G.declaration==null&&G.specifiers[0]?.type==="ExportSpecifier"){let w=G.specifiers[0],s=w.local&&typeof w.local==="object"&&"name"in w.local?w.local.name:void 0,h=w.exported&&typeof w.exported==="object"&&"name"in w.exported?w.exported.name:void 0;if(!s||!h)return;let o;for(let Y0 of Array.from(this.ctx.vars))if(Y0.declarations.some((q0)=>q0.id&&typeof q0.id==="object"&&("type"in q0.id)&&q0.id.type==="Identifier"&&q0.id.name===s)){o=Y0;break}G.declaration=o,U=h}if(G.declaration==null)return;if(!G.declaration||typeof G.declaration!=="object"||!("type"in G.declaration))return;let M,D=!1,S,C,T,E=!1,y=!1,a,Z0,b,r;if(G.declaration.type==="FunctionDeclaration"){let w=G.declaration;if(!w.id?.name)return;U??=w.id.name,a=w.id.name,M="function",S=void 0,C="() => any",E=!0,D=!0,y=!1}else if(G.declaration.type==="VariableDeclaration"){let w=G.declaration,s=w.declarations[0];if(!s||typeof s!=="object"||!("id"in s))return;let{id:h,init:o}=s;if(h&&typeof h==="object"&&"name"in h){let q0=h.name;a=q0,U??=q0,T=this.getExplicitPropType(q0)}else return;M=aO(w.kind),y=M==="let"&&o==null;let Y0=o==null?{isFunction:!1}:H0(this,this.ctx,o);({value:S,type:C,isFunction:E,defaultValue:Z0}=Y0),b=C,r=Y0}else return;let B=z0(this.ctx,this,G),{type:_,typeSource:R,description:N,params:l,returnType:A,isFunction:P}=R0({explicitType:T,typeSeed:C,inferredTypeForSource:b,jsdocType:B?.type,jsdocDescription:B?.description,jsdocParams:B?.params,jsdocReturnType:B?.returnType,resolvedType:r?.resolvedType,resolvedDescription:r?.resolvedDescription,resolvedParams:r?.resolvedParams,resolvedReturnType:r?.resolvedReturnType,initializerIsFunction:E,isFunctionDeclaration:D,typedefs:this.ctx.typedefs});M0(this,this.ctx,U,{name:U,...a!==void 0&&a!==U?{localName:a}:{},kind:M,description:N,binding:B?.binding,deprecated:B?.deprecated,tags:B?.tags,type:_,typeSource:R,value:S,defaultValue:Z0,params:l,returnType:A,isFunction:P,isFunctionDeclaration:D,isRequired:y,constant:M==="const",reactive:this.ctx.reactive_vars.has(U),source:v(this.ctx,G)})}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Comment"){let M=G?.data?.trim()??"";if(rO.test(M))this.ctx.componentComment=M.replace(rO,"").replace(W2,""),this.ctx.componentCommentSource=v(this.ctx,G)}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Slot"){let U=G,M=U.attributes?.find((C)=>C.name==="name")?.value?.[0]?.data,D=(U.attributes||[]).filter((C)=>C.name!=="name").reduce((C,T)=>{let E={value:void 0,replace:!1},y=T.value;if(y===void 0)return C;if(y[0]){let a=y[0],{type:Z0,expression:b,raw:r,start:B,end:_}=a;if(Z0==="Text"&&r!==void 0)E.value=JSON.stringify(r);else if(Z0==="AttributeShorthand"&&b&&typeof b==="object"&&"name"in b)E.value=b.name,E.replace=!0;if(b&&typeof b==="object"&&"type"in b){if(b.type==="Literal"&&"value"in b){let R=b.value;E.value=typeof R==="string"?JSON.stringify(R):String(R)}else if(b.type==="MemberExpression")E.value=F0(this.ctx,this,b);else if(b.type!=="Identifier"){if(B!==void 0&&_!==void 0){if(b.type==="ObjectExpression"||b.type==="TemplateLiteral")E.value=x(this.ctx,B+1,_-1)}}}}if(T.name)C[T.name]=E;return C},{}),S=U.children?.map(({start:C,end:T})=>{if(C===void 0||T===void 0)return"";return x(this.ctx,C,T)??""}).join("").trim();L0(this.ctx,{slot_name:M,slot_props:D,slot_fallback:S,source:v(this.ctx,G)})}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="RenderTag"){let U=G,M=VO(this.ctx,U.expression);if(M){let D;if(M.arguments.length===0)D={};else if(M.arguments.length===1&&typeof M.arguments[0]==="object"&&M.arguments[0]&&"type"in M.arguments[0]&&M.arguments[0].type==="ObjectExpression")D=BO(this.ctx,this,M.arguments[0]);else if(M.arguments.length===1)K0(this.ctx,"syntax-skipped",M.publicName,`{@render ${M.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,v(this.ctx,G));let S=M.publicName==="children"?void 0:M.publicName,C=S===void 0?Q2:S;if(D!==void 0)L0(this.ctx,{slot_name:S,slot_props:D,source:v(this.ctx,G)});if(D!==void 0||this.ctx.slots.has(C))this.ctx.snippetPropLocals.add(M.trackingName)}}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="EventHandler"){let U=G;if(U.expression==null&&U.name){if(j!=null&&typeof j==="object"&&"name"in j){let M=typeof j.name==="string"?j.name:void 0,D="type"in j?String(j.type):void 0;if(M&&D){let S=D==="InlineComponent"?{type:"InlineComponent",name:M}:{type:"Element",name:M};this.ctx.forwardedEvents.set(U.name,S);let C=this.ctx.events.get(U.name),T=this.ctx.eventDescriptions.get(U.name),E=C?.deprecated;if(!C)this.ctx.events.set(U.name,{type:"forwarded",name:U.name,element:S,description:T,deprecated:E,source:v(this.ctx,G)});else if(C.type==="forwarded"&&T&&!C.description)this.ctx.events.set(U.name,{...C,description:T,deprecated:C.deprecated??E,source:C.source||v(this.ctx,G)})}}}}if(j&&typeof j==="object"&&"type"in j&&(String(j.type)==="Element"||String(j.type)==="InlineComponent")&&G&&typeof G==="object"&&"type"in G&&String(G.type)==="Binding"){let U=G;if(U.expression?.name){let M=S0(this.ctx,U.expression.name);if(M)this.ctx.reactive_vars.add(M)}if(String(j.type)==="Element"&&U.name==="this"&&U.expression?.name&&"name"in j&&typeof j.name==="string"){let M=S0(this.ctx,U.expression.name);if(!M)return;let D=j.name;if(this.ctx.bindings.has(M)){let S=this.ctx.bindings.get(M);if(S&&!S.elements.includes(D))this.ctx.bindings.set(M,{...S,elements:[...S.elements,D]})}else this.ctx.bindings.set(M,{elements:[D]})}}},leave:(G)=>{if(this.ctx.scopeDeclarations.has(G))this.ctx.activeScopes.pop();bO(L,G)}}),K!==void 0){for(let G of z)if(G.name===K){let j=G.arguments[0],V=j&&typeof j==="object"&&"value"in j?j.value:void 0,I=G.arguments[1],U=I&&typeof I==="object"&&"value"in I?I.value:void 0;if(V!=null)B0(this.ctx,{name:String(V),detail:U==null?"":x0(U),has_argument:Boolean(I),source:G.source})}}let F=new Set(H);if(K!==void 0){for(let G of z)if(G.name===K){let j=G.arguments[0],V=j&&typeof j==="object"&&"value"in j?j.value:void 0;if(V!=null)F.add(String(V))}}this.ctx.forwardedEvents.forEach((G,j)=>{let V=this.ctx.events.get(j);if(V&&V.type==="dispatched"&&!F.has(j)){let I=this.ctx.eventDescriptions.get(j),U={type:"forwarded",name:j,element:G,description:I,deprecated:V.deprecated,tags:V.tags,source:V.source};if(V.detail!==void 0&&V.detail!=="undefined")U.detail=V.detail;this.ctx.events.set(j,U)}}),dO(this.ctx,F);let k=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(G)=>this.resolvePublicPropName(G))):new Set,u=c.mapToArray(this.ctx.props).filter((G)=>!k.has(G.name)).map((G)=>{if(this.ctx.bindings.has(G.name)){let j=this.ctx.bindings.get(G.name)?.elements.sort().map((V)=>WO(V)).join(" | ");return{...G,type:`null | ${j}`,typeSource:"inferred",reactive:G.reactive||this.ctx.reactive_vars.has(G.name)}}return{...G,reactive:G.reactive||this.ctx.reactive_vars.has(G.name)}});this.ctx.activeScopes.length=0;let m=c.mapToArray(this.ctx.slots).map((G)=>{if(!G.slot_props)return G;if(typeof G.slot_props==="string")return Y2.test(G.slot_props)?{...G,slot_props:"Record<string, never>"}:G;let j=G.slot_props,V=[];for(let U of Object.keys(j)){if(j[U].replace&&j[U].value!==void 0)j[U].value=this.getPropTypeByLocalOrPublic(j[U].value);if(j[U].value===void 0)j[U].value="any";V.push(`${U}: ${j[U].value}`)}let I=V.length===0?"Record<string, never>":V.length===1?`{ ${V[0]} }`:`{
|
|
16
|
+
${V.join(`;
|
|
17
|
+
`)};
|
|
18
|
+
}`;return{...G,slot_props:I}}).sort((G,j)=>{let V=G.name??"",I=j.name??"";if(V<I)return-1;if(V>I)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let G=[...u.map((j)=>j.type??""),...m.map((j)=>j.slot_props??"")].join(`
|
|
19
|
+
`);for(let{name:j,constraint:V}of this.ctx.deferredSlotBlockGenerics){let I=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${I}\\b`).test(G))continue;this.accumulateGeneric(j,V)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)K0(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=O1(this.ctx.scriptGenericsAttribute.value)}let O0=c.mapToArray(this.ctx.moduleExports),f=c.mapToArray(this.ctx.events).map((G)=>{switch(G.type){case"forwarded":return{...G,element:G.element.name};case"dispatched":return G;default:return G}}).sort((G,j)=>{let V=G.name.localeCompare(j.name);if(V!==0)return V;let I=G.type.localeCompare(j.type);if(I!==0)return I;if(G.type==="forwarded"&&j.type==="forwarded"){let U=G.element.localeCompare(j.element);if(U!==0)return U}return(G.detail??"").localeCompare(j.detail??"")}),i=c.mapToArray(this.ctx.typedefs),e=c.mapToArray(this.ctx.contexts);for(let G of u)if(G.typeSource==="unknown")K0(this.ctx,"prop-unknown-type",G.name,`Prop "${G.name}" type could not be inferred; falling back to "${G.type??"any"}".`,G.source);for(let G of this.ctx.jsDocEventNames){if(F.has(G))continue;if(this.ctx.forwardedEvents.has(G))continue;if(this.ctx.props.has(`on${G}`))continue;K0(this.ctx,"event-no-source",G,`@event "${G}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(G))}let W0={source:tO(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:u,moduleExports:O0,slots:m,events:f,typedefs:i,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:e,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},p=eO(this.ctx);if(p)W0[ZO]=p;return W0}}
|
|
20
|
+
export{c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as d}from"./chunk-0fqdg2xa.js";import{E as a,F as b,G as c}from"./chunk-8myyzjb1.js";import"./chunk-as5hgj7e.js";import"./chunk-tmj7vnjr.js";import"./chunk-t9d5k3p7.js";export{b as getParsedComponentTypeScriptMetadata,d as default,c as applyResolvedProps,a as PARSED_COMPONENT_TYPE_SCRIPT_METADATA};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function q(w){return typeof w==="object"&&w!==null}function x(w){return q(w)&&w.type==="VariableDeclaration"&&Array.isArray(w.declarations)}function I(w){return q(w)&&w.type==="Literal"}function v(w){return q(w)&&w.type==="Identifier"&&typeof w.name==="string"}function L(w){return q(w)&&w.type==="MemberExpression"}function g(w){return q(w)&&w.type==="ObjectExpression"&&Array.isArray(w.properties)}function A(w){return q(w)&&w.type==="CallExpression"}function f(w,j){if(!A(w))return!1;return!!w.callee&&q(w.callee)&&w.callee.type==="Identifier"&&w.callee.name===j}function X(w){if(q(w)&&(w.type==="TSAsExpression"||w.type==="TSSatisfiesExpression")&&"expression"in w)return X(w.expression);return w}function n(w){if(q(w)&&(w.type==="TSAsExpression"||w.type==="TSSatisfiesExpression")&&"typeAnnotation"in w)return w.typeAnnotation;return}function G(w){return q(w)&&w.type==="NewExpression"}function T(w,j){if(!G(w))return!1;return!!w.callee&&q(w.callee)&&w.callee.type==="Identifier"&&w.callee.name===j}var b=Symbol("sveld.parsedComponentTypeScriptMetadata");function l(w){return w[b]}function s(w,j){if(j.length===0)return;let F=new Set(w.props.map((E)=>E.name));for(let E of j){if(F.has(E.name))continue;F.add(E.name),w.props.push({name:E.name,kind:"let",constant:!1,type:E.type,typeSource:"typescript",...E.description?{description:E.description}:{},isFunction:E.type.includes("=>"),isFunctionDeclaration:!1,isRequired:E.isRequired,reactive:!1})}}var O=/[\r\n]+/g;function D(w){if(w.sourceLineStartOffsetsCache)return w.sourceLineStartOffsetsCache;let j=[0];if(w.source){for(let F=0;F<w.source.length;F++)if(w.source[F]===`
|
|
2
|
+
`)j.push(F+1)}return w.sourceLineStartOffsetsCache=j,j}function J(w,j){if(!w.source||j<0||j>w.source.length)return;let F=D(w),E=0,k=F.length-1;while(E<=k){let V=Math.floor((E+k)/2),C=F[V],K=F[V+1]??Number.POSITIVE_INFINITY;if(j<C)k=V-1;else if(j>=K)E=V+1;else return{line:V+1,column:j-C}}return}function W(w,j,F){if(j===void 0||F===void 0||F<j)return;let E=J(w,j),k=J(w,F);if(!E||!k)return;return{start:E,end:k}}function y(w,j){if(!j||typeof j!=="object")return;let F="start"in j&&typeof j.start==="number"?j.start:void 0,E="end"in j&&typeof j.end==="number"?j.end:void 0;return W(w,F,E)}function r(w,j,F,E){if(!F||F.length===0||E===void 0)return;let k=[...F];while(k.length>1){let z=k[k.length-1];if(z.tokens.tag||!z.source.trim().endsWith("*/"))break;k.pop()}let V=E;for(let z=0;z<k[0].number-1;z++)V+=j[z]?.source.length??0,V+=1;let C=k[0],K=C.source.indexOf(C.tokens.tag??""),U=V+Math.max(K,0),Q=E,$=k[k.length-1],Y=$.number;for(let z=0;z<Y-1;z++)Q+=j[z]?.source.length??0,Q+=1;return Q+=$.source.length,W(w,U,Q)}function Z(w,j,F){return w.source?.slice(j,F)}function p(w,j){if(!j||typeof j!=="object")return;let F="start"in j&&typeof j.start==="number"?j.start:void 0,E="end"in j&&typeof j.end==="number"?j.end:void 0;if(F===void 0||E===void 0)return;return Z(w,F,E)?.replace(O," ")}var u=/[A-Za-z_$][\w$]*/g;function _(w,j){if(!j)return!1;let F=new Set(j[0].split(",").map((E)=>E.trim()));for(let[E]of w.matchAll(u))if(F.has(E))return!0;return!1}function P(w,j){if(j===void 0)return;return w.runesPropsDeclarationMetadataByDeclaratorStart.get(j)}function a(w,j,F){return P(w,j)?.props.get(F)}function d(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"right"in w&&w.right&&typeof w.right==="object"&&"name"in w.right&&typeof w.right.name==="string")return w.right.name;return}function B(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"left"in w&&w.left&&typeof w.left==="object")return B(w.left);return}function t(w,j){let F=j?.start,E=j?.end;if(F===void 0||E===void 0)return;return Z(w,F+1,E)?.trim()}function e(w,j){let F=j?.start,E=j?.end;if(F===void 0||E===void 0)return;return Z(w,F,E)?.trim()}function H(w,j,F,E,k=new Set){if(!j?.type)return;switch(j.type){case"TSInterfaceDeclaration":H(w,{type:"TSTypeLiteral",members:j.body?.body},F,E,k);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":H(w,j.typeAnnotation,F,E,k);return;case"TSIntersectionType":case"TSUnionType":for(let V of j.types??[])H(w,V,F,E,k);return;case"TSTypeLiteral":for(let V of j.members??[]){if(V?.type!=="TSPropertySignature")continue;H(w,V.typeAnnotation?.typeAnnotation,F,E,k)}return;case"TSTypeReference":{let V=B(j.typeName);if(V){if(w.typeImportBindingsByLocalName.has(V))F.add(V);let C=w.localTypeDeclarationsByName.get(V);if(C&&!k.has(V))E.add(V),k.add(V),H(w,C.node,F,E,k),k.delete(V)}if("typeParameters"in j&&j.typeParameters&&typeof j.typeParameters==="object"){let C=j.typeParameters;for(let K of C.params??[])H(w,K,F,E,k)}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 V of Object.values(j)){if(!V||typeof V!=="object")continue;if(Array.isArray(V)){for(let C of V){if(!C||typeof C!=="object"||!("type"in C))continue;H(w,C,F,E,k)}continue}if("type"in V)H(w,V,F,E,k)}}function R(w,j){let F=new Map;for(let E of Array.from(j).sort()){let k=w.typeImportBindingsByLocalName.get(E);if(!k)continue;let V=F.get(k.source)??{default:[],named:[],namespace:[]};if(k.specifierType==="default")V.default.push(k.localName);else if(k.specifierType==="namespace")V.namespace.push(k.localName);else V.named.push({imported:k.importedName,local:k.localName});F.set(k.source,V)}return Array.from(F.entries()).sort(([E],[k])=>E.localeCompare(k)).map(([E,k])=>{if(k.namespace.length>0)return k.namespace.map((U)=>`import type * as ${U} from "${E}";`).join(`
|
|
3
|
+
`);let V=k.named.map(({imported:U,local:Q})=>{if(!U||U===Q)return Q;return`${U} as ${Q}`}),C=k.default[0],K=V.length>0?`{ ${V.join(", ")} }`:"";if(C&&K)return`import type ${C}, ${K} from "${E}";`;if(C)return`import type ${C} from "${E}";`;return`import type ${K} from "${E}";`})}function ww(w){if(w.typedRunesPropsDeclarations.length!==1)return;let[j]=w.typedRunesPropsDeclarations;if(!j.canonicalType)return;let F=Array.from(j.referencedLocalTypes).map((E)=>w.localTypeDeclarationsByName.get(E)).filter((E)=>E!==void 0).sort((E,k)=>E.start-k.start).map((E)=>E.code);return{canonicalPropsType:j.canonicalType,canonicalPropNames:Array.from(j.props.keys()).sort(),localTypeDeclarations:F,typeImportStatements:R(w,j.referencedImportedTypes),referencesComponentGenerics:_(j.canonicalType,w.generics)}}var h=/^[A-Za-z_$][\w$]*/,i=/[A-Za-z_$][\w$]*/g,M=/^(?:const|in|out)\s+/;function S(w){let j=[],F=0,E=0;for(let k=0;k<w.length;k++){let V=w[k];if(V==="<"||V==="("||V==="["||V==="{")F++;else if(V===">"||V===")"||V==="]"||V==="}")F=Math.max(F-1,0);else if(V===","&&F===0)j.push(w.slice(E,k)),E=k+1}return j.push(w.slice(E)),j}function kw(w){let j=S(w).map((E)=>E.trim()).filter((E)=>E.length>0);if(j.length===0)return null;return[j.map((E)=>{let k=E;while(M.test(k))k=k.replace(M,"");return k.match(h)?.[0]??E}).join(", "),j.join(", ")]}function Fw(w,j,F){let E=w.scriptGenericsAttribute?.value;if(!E)return;for(let[k]of E.matchAll(i)){if(w.typeImportBindingsByLocalName.has(k))j.add(k);if(F.has(k))continue;let V=w.localTypeDeclarationsByName.get(k);if(!V)continue;F.add(k),H(w,V.node,j,F)}}
|
|
4
|
+
export{q as u,x as v,I as w,v as x,L as y,g as z,f as A,X as B,n as C,T as D,b as E,l as F,s as G,W as H,y as I,r as J,Z as K,p as L,P as M,a as N,d as O,t as P,e as Q,H as R,ww as S,S as T,kw as U,Fw as V};
|