sveld 0.37.3 → 0.37.4
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 +14 -2
- package/lib/browser.d.ts +32 -4
- package/lib/browser.js +150 -136
- package/lib/chunk-49hdrj4n.js +6 -0
- package/lib/chunk-7e36grhy.js +1 -0
- package/lib/{chunk-m2bfvdte.js → chunk-nxa0q3f3.js} +5 -5
- package/lib/chunk-rftengvg.js +331 -0
- package/lib/chunk-w37f2cq2.js +1 -0
- package/lib/{chunk-s4f6b34h.js → chunk-yzb9k33r.js} +1 -1
- package/lib/cli-entry.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/schema/component-api.schema.json +20 -1
- package/lib/chunk-ag202nwj.js +0 -317
- package/lib/chunk-n14td14g.js +0 -1
- package/lib/chunk-te52wx32.js +0 -1
- package/lib/chunk-v4be4g6y.js +0 -6
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{oe,f,s,ae,p,d,ce,g,B,r,m,U,t,n,u,R,h,pe,le,fe,X,y,de,Q,me,he,x,ye,c,P,ge,Y,xe,Te,Ee,Z,be,L,W,Se,K,ee,te,O,l,ke,we,re,v,A}from"./chunk-rftengvg.js";var mt={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 Ht(e){return e in mt}function ft(e){if(Ht(e))return mt[e];return"HTMLElement"}function it(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,sourceLineHint:void 0,parsedJsDocByText:new Map,jsDocBlocksByStart:new Map,functionDocCommentStarts:new Set,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement: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,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingContextKeyCandidates:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new Map,activeScopes:[],slots:new Map,snippetPropLocals:new Set,cssParts:[],cssProperties:[],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,sveldIgnoreDirectives:new Map}}var Ft=new Set(["Component","SvelteComponent","SvelteSelf"]),jt=new Set(["RegularElement","SvelteElement"]);function Je(e){return Ft.has(e)}function Ke(e){return jt.has(e)}function Bt({hasTypeScriptType:e,hasJSDocType:o,inferredType:a,finalType:T}){if(e)return"typescript";if(o)return"jsdoc";if(a!==void 0)return"default";if(T!==void 0)return"inferred";return"unknown"}function ze(e){let o=e.explicitType??e.jsdocType??e.resolvedType??e.typeSeed,a=e.jsdocParams??e.resolvedParams,T=e.jsdocReturnType??e.resolvedReturnType;if(e.isFunctionDeclaration&&o==="() => any"&&T){let N=e.jsdocTypeParameters?`<${e.jsdocTypeParameters}>`:"";o=a&&a.length>0?`${N}(${a.map((V)=>`${V.name}${V.optional?"?":""}: ${V.type}`).join(", ")}) => ${T}`:`${N}() => ${T}`}let b=e.jsdocDescription??e.resolvedDescription;if(b===void 0&&o!==void 0)b=e.typedefs?.get(o)?.description;let M=Bt({hasTypeScriptType:e.explicitType!==void 0,hasJSDocType:e.jsdocType!==void 0||e.jsdocParams!==void 0||e.jsdocReturnType!==void 0||e.resolvedType!==void 0,inferredType:e.inferredTypeForSource,finalType:o}),E=e.initializerIsFunction||e.isFunctionDeclaration||e.inferIsFunctionFromTypeSignature===!0&&(!!e.jsdocParams?.length||e.jsdocReturnType!==void 0||!!e.jsdocType?.includes("=>")||!!e.resolvedType?.includes("=>")||!!e.explicitType?.includes("=>")),C=E?e.jsdocTypeParameters:void 0;return{type:o,typeSource:M,description:b,params:a,returnType:T,isFunction:E,typeParameters:C}}function Vt(e){if(!e||typeof e!=="object"||!("type"in e))return;let o=String(e.type),a=Je(o);if(!a&&!Ke(o))return;let T="name"in e&&typeof e.name==="string"?e.name:void 0;if(!T)return;let b=a?{type:"InlineComponent",name:T}:{type:"Element",name:T};if(T==="svelte:element"&&"tag"in e&&e.tag&&typeof e.tag==="object"){let M=e.tag;if(M.type==="Literal"&&typeof M.value==="string")b.thisValue=M.value}return b}function yt(e,o){let a=Vt(o);if(!a)return;if(e.rest_props===void 0){e.rest_props=a;return}if(e.rest_props.type==="InlineComponent"&&a.type==="Element")e.rest_props=a}function Ce(e,o,a){if(!o||e.has(o))return;e.set(o,a)}function We(e,o){for(let a=e.activeScopes.length-1;a>=0;a-=1){let T=e.activeScopes[a]?.get(o);if(!T)continue;return T.kind==="prop"?T.publicPropName:void 0}return}function Pe(e,o=new Set){if(!e||typeof e!=="object"||!("type"in e))return o;switch(e.type){case"Identifier":o.add(e.name);break;case"AssignmentPattern":Pe(e.left,o);break;case"ArrayPattern":for(let a of e.elements)Pe(a??void 0,o);break;case"ObjectPattern":for(let a of e.properties)if(a.type==="Property")Pe(a.value,o);else if(a.type==="RestElement")Pe(a.argument,o);break;case"RestElement":Pe(e.argument,o);break}return o}function st(e,o){if(!o||typeof o!=="object"||!("type"in o))return;if(o.type==="Identifier"){let T=We(e,o.name);if(T)e.reactive_vars.add(T);return}let a=Pe(o);for(let T of a){let b=We(e,T);if(b)e.reactive_vars.add(b)}}function Ue(e){if(!e||typeof e!=="object"||!("type"in e))return!1;switch(String(e.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"AwaitBlock":return!0;default:return!1}}function gt(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let o=String(e.type);return o==="FunctionDeclaration"||o==="FunctionExpression"||o==="ArrowFunctionExpression"}function Ot(e,o){let a=e.scopeDeclarations.get(o);if(!a)a=new Map,e.scopeDeclarations.set(o,a);return a}function $t(e,o,a){let T=[];if(a.id.type==="Identifier")return T.push({kind:"local",name:a.id.name}),T;if(a.id.type!=="ObjectPattern")return T;for(let b of a.id.properties){if(b.type==="RestElement"){if(b.argument.type==="Identifier")T.push({kind:"local",name:b.argument.name});continue}if(b.computed)continue;let M=e.getPropertyName(b.key);if(!M)continue;let E;if(b.value.type==="Identifier")E=b.value.name;else if(b.value.type==="AssignmentPattern"&&b.value.left.type==="Identifier")E=b.value.left.name;if(!E)continue;T.push({kind:"prop",name:E,publicPropName:M})}return T}function at(e,o,a,T,b){if(!oe(o))return;let M=b?.allowRunesProps??!1,E=b?.forceProp??!1,C=o;for(let N of C.declarations){if(M&&p(d(N.init),"$props")){for(let G of $t(e,C,N))Ce(G.kind==="prop"?a:T,G.name,G.kind==="prop"?{kind:"prop",publicPropName:G.publicPropName}:{kind:"local"});continue}let V=C.kind==="var"?T:a,j=E?"prop":"local";for(let G of Pe(N.id))Ce(V,G,j==="prop"?{kind:"prop",publicPropName:G}:{kind:"local"})}}function Gt(e,o){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")Ce(o,e.id.name,{kind:"local"});for(let a of e.params)for(let T of Pe(a))Ce(o,T,{kind:"local"})}function Jt(e,o,a,T){if(!Array.isArray(o))return;for(let b of o){if(!b||typeof b!=="object"||!("type"in b))continue;switch(b.type){case"VariableDeclaration":at(e,b,a,T);break;case"FunctionDeclaration":if(b.id?.name)Ce(a,b.id.name,{kind:"local"});break;case"ClassDeclaration":if(b.id?.name)Ce(a,b.id.name,{kind:"local"});break}}}function Kt(e,o,a){if(!a||typeof a!=="object")return;let T="content"in a&&a.content&&typeof a.content==="object"&&"body"in a.content&&Array.isArray(a.content.body)?a.content:("body"in a)&&Array.isArray(a.body)?a:void 0;if(!T||!("body"in T)||!Array.isArray(T.body))return;for(let b of T.body){if(!b||typeof b!=="object"||!("type"in b))continue;switch(b.type){case"ImportDeclaration":for(let M of b.specifiers??[])if(M.local?.name)Ce(o.componentScope,M.local.name,{kind:"local"});break;case"VariableDeclaration":at(e,b,o.componentScope,o.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(b.id?.name)Ce(o.componentScope,b.id.name,{kind:"local"});break;case"ClassDeclaration":if(b.id?.name)Ce(o.componentScope,b.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!b.declaration||typeof b.declaration!=="object"||!("type"in b.declaration))break;if(b.declaration.type==="VariableDeclaration")at(e,b.declaration,o.componentScope,o.componentScope,{forceProp:!0});else if(b.declaration.type==="FunctionDeclaration"&&b.declaration.id?.name)Ce(o.componentScope,b.declaration.id.name,{kind:"prop",publicPropName:b.declaration.id.name});break}}}function Tt(e,o){o.componentScope.clear(),o.scopeDeclarations=new Map,o.activeScopes.length=0,Kt(e,o,o.parsed?.instance)}function bt(e){return{varScopeStack:[e.componentScope]}}function xt(e,o,a,T){if(!Ue(T))return;let b=Ot(o,T),M=a.varScopeStack[a.varScopeStack.length-1]??o.componentScope;switch(String(T.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Gt(T,b);break;case"BlockStatement":Jt(e,T.body,b,M);break;case"CatchClause":if("param"in T)for(let C of Pe(T.param))Ce(b,C,{kind:"local"});break;case"EachBlock":{let C=T;for(let N of Pe(C.context))Ce(b,N,{kind:"local"});if(typeof C.index==="string")Ce(b,C.index,{kind:"local"});else if(C.index&&"name"in C.index)Ce(b,C.index.name,{kind:"local"});break}case"AwaitBlock":{let C=T;for(let N of Pe(C.value))Ce(b,N,{kind:"local"});for(let N of Pe(C.error))Ce(b,N,{kind:"local"});break}}if(gt(T))a.varScopeStack.push(b);return b}function ht(e,o){if(gt(o))e.varScopeStack.pop()}var Pt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function zt(e,o){switch(o?.type){case"MemberExpression":return o.computed||e===o.object;case"MethodDefinition":return!!o.computed;case"MetaProperty":return e===o.meta;case"PropertyDefinition":return o.computed||e===o.value;case"Property":return o.computed||e===o.value;case"ExportSpecifier":case"ImportSpecifier":return e===o.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}var Wt=Array.from(Pt);function St(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Ut(e){if(e.includes("\\u"))return!0;for(let o of Wt){let a=e.indexOf(o);while(a!==-1){if(!St(e.charCodeAt(a-1))&&!St(e.charCodeAt(a+o.length)))return!0;a=e.indexOf(o,a+1)}}return!1}function Xt(e,o){for(let a=o.length-1;a>=0;a-=1)if(o[a]?.has(e))return!0;return!1}function qt(e){let o=new Set;if(!e||typeof e!=="object"||!("type"in e))return o;switch(String(e.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let a=e;if(a.id?.name)o.add(a.id.name);for(let T of a.params??[])Pe(T,o);break}case"BlockStatement":tt(e.body,o);break;case"CatchClause":Pe(e.param,o);break;case"EachBlock":{let a=e;if(Pe(a.context,o),typeof a.index==="string")o.add(a.index);else if(a.index?.name)o.add(a.index.name);break}case"AwaitBlock":{let a=e;Pe(a.value,o),Pe(a.error,o);break}}return o}function tt(e,o){if(!Array.isArray(e))return;for(let a of e){if(!a||typeof a!=="object"||!("type"in a))continue;switch(String(a.type)){case"ImportDeclaration":for(let T of a.specifiers??[])if(T.local?.name)o.add(T.local.name);break;case"VariableDeclaration":for(let T of a.declarations??[])Pe(T.id,o);break;case"FunctionDeclaration":case"ClassDeclaration":{let T=a.id?.name;if(T)o.add(T);break}case"ExportNamedDeclaration":{let T=a.declaration;if(T&&typeof T==="object"&&"type"in T)tt([T],o);break}}}}function ct(e,o){if(!e||typeof e!=="object")return!1;return pt(e,void 0,[...o])}function pt(e,o,a){if(re(e.type))return!1;let T=Ue(e);if(T)a.push(qt(e));let b=!1;if(o&&e.type==="Identifier"&&e.name!==void 0&&Pt.has(e.name)&&!o.type.startsWith("TS")&&zt(e,o)&&!Xt(e.name,a))b=!0;else for(let M in e){if(M==="leadingComments")continue;let E=e[M];if(!E||typeof E!=="object")continue;if(Array.isArray(E)){for(let C=0;C<E.length;C++){let N=E[C];if(N&&typeof N==="object"&&typeof N.type==="string"){if(pt(N,e,a)){b=!0;break}}}if(b)break}else if(typeof E.type==="string"){if(pt(E,e,a)){b=!0;break}}}if(T)a.pop();return b}function Et(e){if(!e||typeof e!=="object")return;if("content"in e){let o=e.content,a=o&&typeof o==="object"&&"body"in o?o.body:void 0;if(Array.isArray(a))return a}if("body"in e&&Array.isArray(e.body))return e.body;return}function vt(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let o=e.parsed;if(!o)return"legacy";if(e.source!==void 0&&!Ut(e.source))return"legacy";let a=new Set;tt(Et(o.module),a);let T=new Set;return tt(Et(o.instance),T),ct(o.module,[a])||ct(o.instance,[a,T])||ct(o.fragment,[a,T])?"runes":"legacy"}var Yt=/[A-Za-z_$][\w$]*/g;function Qt(e,o,a){let T=new Map,b=o.typeParameters?.params,M=a.typeArguments?.params;if(!b?.length||!M?.length)return T;for(let E=0;E<b.length;E++){let C=b[E]?.name,N=M[E];if(!C||N?.start===void 0||N?.end===void 0)continue;let V=n(e,N.start,N.end)?.trim();if(V)T.set(C,V)}return T}function Zt(e,o){if(o.size===0)return e;return e.replace(Yt,(a)=>o.get(a)??a)}function Be(e,o,a,T,b=new Set){let M=new Map;if(!a?.type)return M;let E=(C)=>{for(let N of C){if(N?.type!=="TSPropertySignature"||N.computed)continue;if(!N.key)continue;let V=e.getPropertyName(N.key);if(!V)continue;let j=N.typeAnnotation?.start,G=N.typeAnnotation?.end;if(j===void 0||G===void 0)continue;let ue=n(o,j+1,G)?.trim();if(!ue)continue;P(o,N.typeAnnotation?.typeAnnotation),M.set(V,{type:ue,optional:N.optional===!0,source:t(o,N)})}};switch(a.type){case"TSTypeLiteral":E(a.members??[]);break;case"TSInterfaceDeclaration":E(a.body?.body??[]);break;case"TSTypeAliasDeclaration":{let C=Be(e,o,a.typeAnnotation,T,b);for(let[N,V]of C)M.set(N,V);break}case"TSTypeReference":{let C=he(a.typeName);if(!C||b.has(C))break;let N=T.get(C);if(!N)break;b.add(C);let V=Be(e,o,N,T,b);b.delete(C);let j=Qt(o,N,a);for(let[G,ue]of V)M.set(G,j.size===0?ue:{...ue,type:Zt(ue.type,j)});break}case"TSIntersectionType":for(let C of a.types??[]){let N=Be(e,o,C,T,b);for(let[V,j]of N)M.set(V,j)}break;case"TSParenthesizedType":{let C=Be(e,o,a.typeAnnotation,T,b);for(let[N,V]of C)M.set(N,V);break}}return M}function en(e){let o={};for(let[a,T]of Object.entries(e))o[a]={...T.attribute===void 0?{}:{attribute:T.attribute},...T.reflect===void 0?{}:{reflect:T.reflect},...T.type===void 0?{}:{type:T.type}};return o}function Ct(e,o,a){if(o.runesPropsDeclarationMetadataByDeclaratorStart.clear(),o.explicitPropTypesByName.clear(),o.explicitVariableTypesByName.clear(),o.typeImportBindingsByLocalName.clear(),o.localTypeDeclarationsByName.clear(),o.additionalTypeDependencyNodes.length=0,o.typedRunesPropsDeclarations.length=0,!o.source)return;let T=a;o.scriptLanguage=e.resolveScriptLanguage(T);let b=T.options?.customElement;o.customElementTag=b?.tag,o.customElement=b?{...b.tag===void 0?{}:{tag:b.tag},...b.shadow==="open"||b.shadow==="none"?{shadow:b.shadow}:{},...b.props?{props:en(b.props)}:{},...b.extend===void 0?{}:{extend:!0}}:void 0,o.runesOptionOverride=T.options?.runes,o.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(T);let M=T.instance?.content?.body??[];for(let E of M){if(!E?.type)continue;if(E.type==="ImportDeclaration"&&E.source?.value)for(let C of E.specifiers??[]){let N=C.local?.name;if(!N)continue;if(!(E.importKind==="type"||C.importKind==="type"))continue;let j,G;if(C.type==="ImportSpecifier")j="named",G=C.imported?.type==="Identifier"?C.imported.name:typeof C.imported?.value==="string"?C.imported.value:void 0;else if(C.type==="ImportDefaultSpecifier")j="default";else if(C.type==="ImportNamespaceSpecifier")j="namespace";if(!j)continue;o.typeImportBindingsByLocalName.set(N,{importedName:G,localName:N,source:String(E.source.value),specifierType:j})}if((E.type==="TSInterfaceDeclaration"||E.type==="TSTypeAliasDeclaration")&&E.id?.name&&E.start!==void 0&&E.end!==void 0)o.localTypeDeclarationsByName.set(E.id.name,{code:n(o,E.start,E.end)?.trim()??"",node:E,start:E.start});if(E.type==="TSEnumDeclaration"&&E.id?.name&&E.start!==void 0&&E.end!==void 0)o.localTypeDeclarationsByName.set(E.id.name,{code:ge(o,E)??"",node:E,start:E.start});if(E.type==="ExportNamedDeclaration"&&E.declaration?.type==="VariableDeclaration")for(let C of E.declaration.declarations??[]){if(C.id?.type!=="Identifier"||!C.id.name)continue;let N=x(o,C.id.typeAnnotation);if(N)o.explicitPropTypesByName.set(C.id.name,N),P(o,C.id.typeAnnotation?.typeAnnotation)}else if(E.type==="VariableDeclaration")for(let C of E.declarations??[]){if(C.id?.type!=="Identifier"||!C.id.name)continue;let N=x(o,C.id.typeAnnotation);if(N)o.explicitVariableTypesByName.set(C.id.name,N)}}for(let E of M){if(!E||typeof E!=="object"||!("declarations"in E))continue;for(let C of E.declarations??[]){if(!p(d(C.init),"$props"))continue;let N=C.id?.typeAnnotation?void 0:ce(C.init),V=C.id?.typeAnnotation?.typeAnnotation??N,j=C.id?.typeAnnotation?x(o,C.id.typeAnnotation):ye(o,N),G=Be(e,o,V,new Map(Array.from(o.localTypeDeclarationsByName.entries(),([De,He])=>[De,He.node]))),ue=new Set,Me=new Set;if(c(o,V,ue,Me),Ee(o,ue,Me),C.start!==void 0){let De={canonicalType:j,props:G,referencedImportedTypes:ue,referencedLocalTypes:Me};if(o.runesPropsDeclarationMetadataByDeclaratorStart.set(C.start,De),j)o.typedRunesPropsDeclarations.push(De)}}}}function Dt(e,o,a){for(let T of a.declarations){if(!p(d(T.init),"$props"))continue;if(T.id.type==="Identifier"){o.wholePropsLocals.add(T.id.name),o.restPropLocals.add(T.id.name);let E=Q(o,T.start);if(E)for(let[C,N]of E.props)R(e,o,C,{name:C,kind:"let",type:N.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!N.optional,constant:!1,reactive:!1,source:N.source});continue}if(T.id.type!=="ObjectPattern")continue;let b=l(o,e,a),M=T.id.properties.filter((E)=>{if(E.type!=="Property"||E.computed)return!1;if(!e.getPropertyName(E.key))return!1;if(E.value.type==="Identifier")return!0;return E.value.type==="AssignmentPattern"&&E.value.left.type==="Identifier"}).length;for(let E of T.id.properties){if(E.type==="RestElement"){if(E.argument.type==="Identifier")o.restPropLocals.add(E.argument.name);continue}let C=e.getPropertyName(E.key);if(!C)continue;let N,V;if(E.value.type==="Identifier")N=E.value.name;else{let Ge=E.value;N=Ge.left.name,V=Ge.right}if(!N)continue;if(e.trackPropLocalName(C,N),C==="children")o.snippetPropLocals.add(N);let j=ke(o,e,E)??(M===1?b:void 0),G=me(o,T.start,C),{init:ue,bindable:Me}=pe(V),De=ue==null?{isFunction:!1}:h(e,o,ue),{value:He,type:Xe,isFunction:je,defaultValue:Ve}=De,Oe=G?.type===void 0&&j?.type===void 0?De.resolvedType:void 0;if(De.pendingCallDefault)o.pendingCallDefaultCandidates.push({propName:C,location:"props",...De.pendingCallDefault});let{type:qe,typeSource:$e,description:Ye,params:Qe,returnType:Ze,isFunction:et}=ze({explicitType:G?.type,typeSeed:Xe,inferredTypeForSource:Xe,jsdocType:j?.type,jsdocDescription:j?.description,jsdocParams:j?.params,jsdocReturnType:j?.returnType,resolvedType:Oe,resolvedDescription:De.resolvedDescription,resolvedParams:De.resolvedParams,resolvedReturnType:De.resolvedReturnType,initializerIsFunction:je,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(Me)o.reactive_vars.add(C);m(o,"prop-unknown-type",C,j?.sveldIgnore),R(e,o,C,{name:C,...N===C?{}:{localName:N},kind:"let",description:Ye,binding:j?.binding,deprecated:j?.deprecated,tags:j?.tags,...j?.internal?{internal:!0}:{},...Me?{bindable:!0}:{},type:qe,typeSource:$e,value:He,defaultValue:Ve,params:Qe,returnType:Ze,isFunction:et,isFunctionDeclaration:!1,isRequired:!Me&&ue==null&&G?.optional!==!0,constant:!1,reactive:Me,source:t(o,E)})}}}function tn(e){let a=e.indexOf("EventDispatcher");if(a===-1)return;let T=a+15;while(e[T]===" ")T++;if(e[T]!=="<")return;let b=0,M=T;for(;T<e.length;T++)if(e[T]==="<")b++;else if(e[T]===">"){if(b--,b===0)return e.slice(M+1,T)}return}function nn(e){let o=[],a=0,T=0;for(let b=0;b<e.length;b++){let M=e[b];if(M==="{"||M==="("||M==="["||M==="<")a++;else if(M==="}"||M===")"||M==="]"||M===">")a=Math.max(a-1,0);else if(a===0&&(M===";"||M===","))o.push(e.slice(T,b)),T=b+1}return o.push(e.slice(T)),o.map((b)=>b.trim()).filter((b)=>b.length>0)}var rn=/^["']|["']$/g,on=/\?$/,an=/^\{/,sn=/\}$/;function cn(e){let o=0;for(let a=0;a<e.length;a++){let T=e[a];if(T==="{"||T==="("||T==="["||T==="<")o++;else if(T==="}"||T===")"||T==="]"||T===">")o=Math.max(o-1,0);else if(o===0&&T===":"){let b=e.slice(0,a).trim().replace(on,"").replace(rn,""),M=e.slice(a+1).trim();if(!b||!M)return;return{name:b,type:M}}}return}function Mt(e,o,a,T,b){if(a){let N=new Map(Array.from(o.localTypeDeclarationsByName.entries(),([j,G])=>[j,G.node])),V=Be(e,o,a,N);for(let[j,G]of V)y(o,{name:j,detail:G.type,has_argument:!0,source:G.source});return}let M=e.resolveLocalVarJSDoc(T)?.type,E=M?tn(M):void 0;if(!E)return;let C=E.trim().replace(an,"").replace(sn,"");for(let N of nn(C)){let V=cn(N);if(!V)continue;y(o,{name:V.name,detail:V.type,has_argument:!0,source:b})}}function Nt(e,o){if(e.syntaxMode!=="runes")return;for(let[a,T]of Array.from(e.events.entries())){if(T.type!=="dispatched")continue;if(o.has(a)||e.forwardedEvents.has(a))continue;let b=`on${a}`,M=e.props.get(b);if(!M)continue;let E=M.type!==void 0||M.params!==void 0||M.returnType!==void 0,C=T.detail===void 0||T.detail==="undefined"||T.detail==="null"?"() => void":`(detail: ${T.detail}) => void`;e.props.set(b,{...M,description:M.description??T.description,type:E?M.type:C,typeSource:E?M.typeSource:"inferred",isFunction:!0}),e.events.delete(a)}}var kt=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function lt(e){return e!==null&&typeof e==="object"&&typeof e.type==="string"}function Lt(e){if(!kt.has(e.type))return e;let o=e.expression;while(o&&kt.has(o.type))o=o.expression;return o??e}function nt(e){if(!lt(e))return;dt(e)}function dt(e){for(let o in e){if(o==="leadingComments")continue;let a=e[o];if(!a||typeof a!=="object")continue;if(Array.isArray(a))for(let T=0;T<a.length;T++){let b=a[T];if(!lt(b))continue;let M=Lt(b);if(M!==b)a[T]=M;dt(M)}else if(lt(a)){let T=Lt(a);if(T!==a)e[o]=T;dt(T)}}}function pn(e,o,a,T,b){for(let M of e){if(M.type!=="Block"||M.start<a||M.end>T)continue;let E=o.slice(M.start,M.end);b.push({end:M.end,isJsDoc:E.startsWith("/**")&&E.length>4,text:E})}}function wt(e,o,a){if(!e||typeof e!=="object"||!("type"in e))return;let T=e;if(T.type==="FunctionDeclaration"){if(T.id?.type==="Identifier"&&T.id.name)a.push({name:T.id.name,start:o});return}if(T.type==="VariableDeclaration"){for(let b of T.declarations??[])if(b?.id?.type==="Identifier"&&b.id.name)a.push({name:b.id.name,start:o})}}function ln(e){let o=[];for(let a of e){if(!a||typeof a!=="object"||!("type"in a))continue;let T=a;if(T.start===void 0)continue;if(T.type==="ExportNamedDeclaration"&&T.declaration)wt(T.declaration,T.start,o);else wt(T,T.start,o)}return o}function dn(e,o,a){let T;for(let b of e){if(b.end>o)break;if(!b.isJsDoc)continue;if(!ee.test(a.slice(b.end,o)))continue;T=b}return T}function Rt(e,o){let a=new Map;if(!e.source)return a;let T=[e.parsed?.module,e.parsed?.instance],b=[],M=[],E=e.parsed?.comments??[];for(let C of T){let N=C?.content;if(!N?.body||N.start===void 0||N.end===void 0)continue;pn(E,e.source,N.start,N.end,b),M.push(...ln(N.body))}b.sort((C,N)=>C.end-N.end);for(let C of M){let N=dn(b,C.start,e.source);if(!N)continue;let V=te(e,N.text),{type:j,description:G,ignore:ue,internal:Me}=O(V);if(ue.length>0)m(e,"context-any-type",C.name,ue);if(!j)continue;a.set(C.name,{type:o.aliasType(j.type),description:G||j.description,internal:Me||void 0})}return a}function ut(e){if(e?.type==="Identifier")return e.name;return typeof e?.value==="string"?e.value:void 0}function At(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var un=null,It=/^@component/,mn=/\r/g,fn=/^\{\s*\}$/,yn=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);class i{ctx=it();static mapToArray(e){return Array.from(e,([o,a])=>a)}static getStaticAttributeValue(e){if(!Array.isArray(e.value))return;return e.value.map((o)=>o.data??o.raw??"").join("").trim()}resolveScriptLanguage(e){let o=[e.instance,e.module].filter((T)=>T!==void 0),a=!1;for(let T of o){let b=T.attributes?.find((E)=>E.name==="lang");if(!b){a=!0;continue}if(i.getStaticAttributeValue(b)?.toLowerCase()==="ts")return"ts"}return a?"js":void 0}resolveScriptGenericsAttribute(e){let o=e.instance?.attributes?.find((E)=>E.name==="generics");if(!o)return;let a=t(this.ctx,o),T=e.instance?.attributes?.find((E)=>E.name==="lang");if((T?i.getStaticAttributeValue(T)?.toLowerCase():void 0)!=="ts"){r(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',a);return}let M=i.getStaticAttributeValue(o);if(!M)return;return{value:M,source:a}}resolvePublicPropName(e){return this.ctx.propLocalToPublicName.get(e)??e}trackPropLocalName(e,o=e){this.ctx.propLocalToPublicName.set(o,e)}getPropByLocalOrPublic(e){return this.ctx.props.get(this.resolvePublicPropName(e))}getPropTypeByLocalOrPublic(e){return this.getPropByLocalOrPublic(e)?.type}getExplicitPropType(e){return this.ctx.explicitPropTypesByName.get(e)}getPropertyName(e){if(!e||typeof e!=="object"||!("type"in e))return;if(s(e))return e.name;if(f(e))return e.value==null?void 0:String(e.value);return}isNumericConstant(e){if(!e||typeof e!=="object"||!("type"in e))return!1;if(e.type!=="MemberExpression")return!1;let o=e,a=o.object&&"name"in o.object?o.object.name:void 0,T=o.property&&"name"in o.property?o.property.name:void 0;if(!a||!T)return!1;if(a==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(T);if(a==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(T);return!1}resolveLocalVarJSDoc(e){for(let a of this.ctx.vars)if(a.declarations.some((b)=>b.id&&typeof b.id==="object"&&("type"in b.id)&&b.id.type==="Identifier"&&("name"in b.id)&&b.id.name===e))return l(this.ctx,this,a);let o=this.ctx.funcDecls.get(e);if(o)return l(this.ctx,this,o);return}addModuleExport(e,o){if(u(e)===void 0)return;if(this.ctx.moduleExports.has(e)){let a=this.ctx.moduleExports.get(e);this.ctx.moduleExports.set(e,{...a,...o})}else this.ctx.moduleExports.set(e,o)}resolveExportSpecifier(e,o){let a=ut(o.local),T=ut(o.exported);if(!a||!T)return;if(e.source!=null)return{localName:a,exportedName:T};for(let b of this.ctx.vars){let M=b.declarations.find((E)=>E.id.type==="Identifier"&&E.id.name===a);if(M)return{localName:a,exportedName:T,declaration:b,declarator:M}}return{localName:a,exportedName:T}}recordUnresolvedExportSpecifier(e,o,a){let T=e.source?.value,b=typeof T==="string"?`it re-exports from "${T}"`:this.ctx.valueImportBindingsByLocalName.has(o)?"it re-exports an imported binding":"no matching local declaration was found";r(this.ctx,"export-unresolved",a,`export "${a}" was skipped because ${b}; sveld only resolves exports of a local declaration.`,t(this.ctx,e))}aliasType(e){if(e==="*")return"any";return e.trim()}findVariableTypeAndDescription(e){let o=this.getPropByLocalOrPublic(e);if(o?.type)return{type:o.type,description:o.description,internal:o.internal};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=Rt(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let a=this.ctx.variableInfoCache.get(e),T=this.ctx.explicitVariableTypesByName.get(e);if(T)return{type:T,description:a?.description,internal:a?.internal};return a??null}accumulateGeneric(e,o){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${e}`,`${this.ctx.generics[1]}, ${o}`];else this.ctx.generics=[e,o]}cleanup(){this.ctx=it()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(e){if(!e.includes("@ts-"))return e;return i.SCRIPT_BLOCK_REGEX.lastIndex=0,e.replace(i.SCRIPT_BLOCK_REGEX,(o,a,T,b)=>{i.TS_DIRECTIVE_REGEX.lastIndex=0;let M=T.replace(i.TS_DIRECTIVE_REGEX,"");return a+M+b})}parseSvelteComponent(e,o){this.cleanup(),this.ctx.componentFilePath=o.filePath;let a=i.stripTypeScriptDirectivesFromScripts(e);this.ctx.source=a;let T=A(a);if(Ct(this,this.ctx,T),this.ctx.parsed=T,this.ctx.scriptLanguage==="ts")nt(this.ctx.parsed.module),nt(this.ctx.parsed.instance),nt(this.ctx.parsed.fragment);this.ctx.syntaxMode=vt(this.ctx);let b=this.ctx.parsed.css,M=b?.start!==void 0&&b?.end!==void 0?a.slice(0,b.start)+" ".repeat(b.end-b.start)+a.slice(b.end):a;K(this.ctx,this.ctx.parsed?.module),K(this.ctx,this.ctx.parsed?.instance),we(this.ctx,this,M);let E={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(this.ctx.parsed?.module){let S=Se(this.ctx.parsed.module),D=(_,H,w)=>{let k=l(this.ctx,this,_);this.addModuleExport(H==="*"?`* from ${w.from}`:H,{name:H,kind:"re-export",description:k?.description,deprecated:k?.deprecated,tags:k?.tags,...k?.internal?{internal:!0}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,reExport:w,source:t(this.ctx,_)})},I=(_,H,w)=>{let k=[];if(H.type==="FunctionDeclaration"){let q=H;if(!q.id?.name)return;let J=this.ctx.scriptLanguage==="ts"?Y(this.ctx,q):void 0;k.push({prop_name:q.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:J?.hasAnnotations?void 0:"() => any",explicitType:J?.hasAnnotations?J.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(H.type==="VariableDeclaration"){let q=H,J=At(q.kind),ne=w?.declarator?[w.declarator]:q.declarations;for(let ie of ne){if(!ie||typeof ie!=="object"||!("id"in ie))continue;let{id:se,init:ve}=ie;if(!se||typeof se!=="object"||!("name"in se))continue;let Ne=se.name,Ie=w?.exportedName??Ne,z=ve==null?{isFunction:!1}:h(this,this.ctx,ve),{value:Le,type:Ae,isFunction:Re,defaultValue:_e}=z,Fe=z;if(Fe.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:Ne,location:"moduleExports",...Fe.pendingCallDefault});k.push({prop_name:Ie,kind:J,isFunctionDeclaration:!1,value:Le,typeSeed:Ae,explicitType:this.getExplicitPropType(Ne),initializerIsFunction:Re,defaultValue:_e,inferredTypeForSource:Ae,resolvedJSDoc:Fe})}if(k.length===0)return}else return;let F=l(this.ctx,this,_);for(let{prop_name:q,kind:J,isFunctionDeclaration:ne,value:ie,typeSeed:se,explicitType:ve,initializerIsFunction:Ne,defaultValue:Ie,inferredTypeForSource:z,resolvedJSDoc:Le}of k){let{type:Ae,typeSource:Re,description:_e,params:Fe,returnType:rt,isFunction:ot,typeParameters:_t}=ze({explicitType:ve,typeSeed:se,inferredTypeForSource:z,jsdocType:F?.type,jsdocDescription:F?.description,jsdocParams:F?.params,jsdocReturnType:F?.returnType,jsdocTypeParameters:F?.typeParameters,resolvedType:Le?.resolvedType,resolvedDescription:Le?.resolvedDescription,resolvedParams:Le?.resolvedParams,resolvedReturnType:Le?.resolvedReturnType,initializerIsFunction:Ne,isFunctionDeclaration:ne,typedefs:this.ctx.typedefs});this.addModuleExport(q,{name:q,kind:J,description:_e,deprecated:F?.deprecated,tags:F?.tags,...F?.internal?{internal:!0}:{},type:Ae,typeSource:Re,value:ie,defaultValue:Ie,params:Fe,returnType:rt,typeParameters:_t,isFunction:ot,isFunctionDeclaration:ne,isRequired:!1,constant:J==="const",reactive:!1,source:t(this.ctx,_)})}};v(this.ctx.parsed?.module,(_)=>{if(_.type==="ImportDeclaration")W(this.ctx,_);if(_.type==="FunctionDeclaration"){let H=_;if(H.id?.name)this.ctx.funcDecls.set(H.id.name,H)}if(_.type==="VariableDeclaration")this.ctx.vars.add(_);if(_.type==="ExportNamedDeclaration"){if(_.declaration!=null){I(_,_.declaration);return}let H=_.source?.value;for(let w of _.specifiers){let k=this.resolveExportSpecifier(_,w);if(!k)continue;if(k.exportedName==="default"){r(this.ctx,"module-export-conflict",k.exportedName,`export "default" was skipped because it collides with the component's own default export.`,t(this.ctx,_));continue}let F=typeof H==="string"?{from:H,imported:k.localName}:S.get(k.localName);if(k.declaration)I(_,k.declaration,k);else if(F)D(_,k.exportedName,F);else this.recordUnresolvedExportSpecifier(_,k.localName,k.exportedName)}}if(_.type==="ExportAllDeclaration"&&typeof _.source.value==="string"){let H=(_.exported&&ut(_.exported))??"*";D(_,H,{from:_.source.value,imported:"*"})}})}let C,N,V,j=new Set,G=new Set,ue=[];Tt(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Me=bt(this.ctx),De=(S,D,I)=>{let _=[];if(D.type==="FunctionDeclaration"){let w=D;if(!w.id?.name)return;let k=w.id.name,F=this.ctx.scriptLanguage==="ts"?Y(this.ctx,w):void 0;_.push({prop_name:k,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:F?.hasAnnotations?void 0:"() => any",explicitType:F?.hasAnnotations?F.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:w.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(D.type==="VariableDeclaration"){let w=D,k=At(w.kind),F=I?.declarator?[I.declarator]:w.declarations;for(let q of F){if(!q||typeof q!=="object"||!("id"in q))continue;let{id:J,init:ne}=q;if(!J||typeof J!=="object"||!("name"in J))continue;let ie=J.name,se=I?.exportedName??ie,ve=k==="let"&&ne==null,Ne=ne==null?{isFunction:!1}:h(this,this.ctx,ne),{value:Ie,type:z,isFunction:Le,defaultValue:Ae}=Ne,Re=Ne;if(Re.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:se,location:"props",...Re.pendingCallDefault});_.push({prop_name:se,kind:k,isFunctionDeclaration:!1,value:Ie,typeSeed:z,explicitType:this.getExplicitPropType(ie),initializerIsFunction:Le,isRequired:ve,localName:ie,defaultValue:Ae,inferredTypeForSource:z,resolvedJSDoc:Re})}if(_.length===0)return}else return;let H=l(this.ctx,this,S);for(let{prop_name:w,kind:k,isFunctionDeclaration:F,value:q,typeSeed:J,explicitType:ne,initializerIsFunction:ie,isRequired:se,localName:ve,defaultValue:Ne,inferredTypeForSource:Ie,resolvedJSDoc:z}of _){let{type:Le,typeSource:Ae,description:Re,params:_e,returnType:Fe,isFunction:rt,typeParameters:ot}=ze({explicitType:ne,typeSeed:J,inferredTypeForSource:Ie,jsdocType:H?.type,jsdocDescription:H?.description,jsdocParams:H?.params,jsdocReturnType:H?.returnType,jsdocTypeParameters:H?.typeParameters,resolvedType:z?.resolvedType,resolvedDescription:z?.resolvedDescription,resolvedParams:z?.resolvedParams,resolvedReturnType:z?.resolvedReturnType,initializerIsFunction:ie,isFunctionDeclaration:F,typedefs:this.ctx.typedefs});m(this.ctx,"prop-unknown-type",w,H?.sveldIgnore),R(this,this.ctx,w,{name:w,...ve!==void 0&&ve!==w?{localName:ve}:{},kind:k,description:Re,binding:H?.binding,deprecated:H?.deprecated,tags:H?.tags,...H?.internal?{internal:!0}:{},type:Le,typeSource:Ae,value:q,defaultValue:Ne,params:_e,returnType:Fe,typeParameters:ot,isFunction:rt,isFunctionDeclaration:F,isRequired:se,constant:k==="const",reactive:this.ctx.reactive_vars.has(w),source:t(this.ctx,S)})}};if(v(E,(S,D,I)=>{let _=xt(this,this.ctx,Me,S);if(_)this.ctx.activeScopes.push(_);let H=S.type;if(!yn.has(H))return;if(S.type==="AssignmentExpression")st(this.ctx,S.left);if(S.type==="UpdateExpression")st(this.ctx,S.argument);if(S.type==="CallExpression"){let w=S,k=w.callee&&typeof w.callee==="object"&&"name"in w.callee?w.callee.name:void 0;if(k==="createEventDispatcher"){if(D&&typeof D==="object"&&"id"in D&&D.id&&typeof D.id==="object"&&"name"in D.id)C=D.id.name,N=D;V=w.typeArguments?.params?.[0]}if(k==="$host"){if(D&&typeof D==="object"&&"id"in D&&D.id&&typeof D.id==="object"&&"name"in D.id)j.add(D.id.name)}if(k==="setContext")le(this.ctx,this,S,D??void 0);if(k)ue.push({name:k,arguments:w.arguments,node:w});if(ae(w.callee)&&s(w.callee.property)&&w.callee.property.name==="dispatchEvent"&&(p(w.callee.object,"$host")||s(w.callee.object)&&j.has(w.callee.object.name))){let F=de(this.ctx,w);if(F)G.add(F)}}if(H==="SpreadAttribute"){let w=S;if(w.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(w.expression?.name??""))yt(this.ctx,D)}if(S.type==="FunctionDeclaration"){let w=S;if(w.id?.name)this.ctx.funcDecls.set(w.id.name,w)}if(S.type==="ImportDeclaration")W(this.ctx,S);if(S.type==="VariableDeclaration"){if(this.ctx.vars.add(S),D&&typeof D==="object"&&"type"in D&&D.type==="Program"&&S.declarations.some((w)=>p(d(w.init),"$props")))Dt(this,this.ctx,S)}if(S.type==="ExportNamedDeclaration"){if(S.declaration!=null){De(S,S.declaration);return}for(let w of S.specifiers){let k=this.resolveExportSpecifier(S,w);if(!k)continue;if(k.declaration)De(S,k.declaration,k);else this.recordUnresolvedExportSpecifier(S,k.localName,k.exportedName)}}if(H==="Comment"){let k=S?.data?.trim()??"";if(It.test(k))this.ctx.componentComment=k.replace(It,"").replace(mn,""),this.ctx.componentCommentSource=t(this.ctx,S)}if(H==="SlotElement"){let w=S,k=w.attributes?.find((ne)=>ne.name==="name")?.value,F=(Array.isArray(k)?k[0]:void 0)?.data,q=(w.attributes||[]).filter((ne)=>ne.name!=="name").reduce((ne,ie)=>{let se={value:void 0,replace:!1},ve=ie.value;if(ve===void 0||ve===!0)return ne;let Ne=Array.isArray(ve)?ve[0]:ve;if(Ne){let{type:Ie,expression:z,raw:Le,start:Ae,end:Re}=Ne;if(Ie==="Text"&&Le!==void 0)se.value=JSON.stringify(Le);else if(!Array.isArray(ve)&&Ie==="ExpressionTag"&&z&&typeof z==="object"&&"type"in z&&z.type==="Identifier"&&"name"in z&&z.name===ie.name)se.value=z.name,se.replace=!0;if(z&&typeof z==="object"&&"type"in z){if(z.type==="Literal"&&"value"in z){let _e=z.value;se.value=typeof _e==="string"?JSON.stringify(_e):String(_e)}else if(z.type==="MemberExpression")se.value=B(this.ctx,this,z);else if(z.type!=="Identifier"){if(Ae!==void 0&&Re!==void 0){if(z.type==="ObjectExpression"||z.type==="TemplateLiteral")se.value=n(this.ctx,Ae+1,Re-1)}}}}if(ie.name)ne[ie.name]=se;return ne},{}),J=w.fragment?.nodes?.map(({start:ne,end:ie})=>{if(ne===void 0||ie===void 0)return"";return n(this.ctx,ne,ie)??""}).join("").trim();L(this.ctx,{slot_name:F,slot_props:q,slot_fallback:J,source:t(this.ctx,S)})}if(H==="RenderTag"){let w=S,k=be(this.ctx,w.expression);if(k){let F,q=!1;if(k.arguments.length===0)F={};else if(k.arguments.length===1&&typeof k.arguments[0]==="object"&&k.arguments[0]&&"type"in k.arguments[0]&&k.arguments[0].type==="ObjectExpression"){let ie=Z(this.ctx,this,k.arguments[0]);F=ie.slot_props,q=ie.hasUnresolvedSpread}else if(k.arguments.length===1)r(this.ctx,"syntax-skipped",k.publicName,`{@render ${k.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,t(this.ctx,S));let J=k.publicName==="children"?void 0:k.publicName,ne=J===void 0?un:J;if(F!==void 0)L(this.ctx,{slot_name:J,slot_props:F,slot_props_unresolved_spread:q||void 0,source:t(this.ctx,S)});if(F!==void 0||this.ctx.slots.has(ne))this.ctx.snippetPropLocals.add(k.trackingName)}}if(H==="OnDirective"){let w=S;if(w.expression==null&&w.name){if(D!=null&&typeof D==="object"&&"name"in D){let k=typeof D.name==="string"?D.name:void 0,F="type"in D?String(D.type):void 0;if(k&&F){let q=Je(F)?{type:"InlineComponent",name:k}:{type:"Element",name:k};this.ctx.forwardedEvents.set(w.name,q);let J=this.ctx.events.get(w.name),ne=this.ctx.eventDescriptions.get(w.name),ie=J?.deprecated,se=J?.internal;if(!J)this.ctx.events.set(w.name,{type:"forwarded",name:w.name,element:q,description:ne,deprecated:ie,...se?{internal:!0}:{},source:t(this.ctx,S)});else if(J.type==="forwarded"&&ne&&!J.description)this.ctx.events.set(w.name,{...J,description:ne,deprecated:J.deprecated??ie,...J.internal||se?{internal:!0}:{},source:J.source||t(this.ctx,S)})}}}}if(H==="BindDirective"&&D&&typeof D==="object"&&"type"in D&&(Ke(String(D.type))||Je(String(D.type)))){let w=S;if(w.expression?.name){let k=We(this.ctx,w.expression.name);if(k)this.ctx.reactive_vars.add(k)}if(Ke(String(D.type))&&w.name==="this"&&w.expression?.name&&"name"in D&&typeof D.name==="string"){let k=We(this.ctx,w.expression.name);if(!k)return;let F=D.name;if(this.ctx.bindings.has(k)){let q=this.ctx.bindings.get(k);if(q&&!q.elements.includes(F))this.ctx.bindings.set(k,{...q,elements:[...q.elements,F]})}else this.ctx.bindings.set(k,{elements:[F]})}}},(S)=>{if(Ue(S))this.ctx.activeScopes.pop(),ht(Me,S)},{skipTypeOnlySubtrees:!0}),C!==void 0){Mt(this,this.ctx,V,C,t(this.ctx,N));for(let S of ue)if(S.name===C){let D=S.arguments[0],I=D&&typeof D==="object"&&"value"in D?D.value:void 0,_=S.arguments[1],H=fe(this,_),w=H===void 0&&_&&typeof _==="object"&&"value"in _?_.value:void 0;if(I!=null)y(this.ctx,{name:String(I),detail:H??(w==null?"":X(w)),has_argument:Boolean(_),source:t(this.ctx,S.node)})}}let He=new Set(G);if(C!==void 0){for(let S of ue)if(S.name===C){let D=S.arguments[0],I=D&&typeof D==="object"&&"value"in D?D.value:void 0;if(I!=null)He.add(String(I))}}this.ctx.forwardedEvents.forEach((S,D)=>{let I=this.ctx.events.get(D);if(I&&I.type==="dispatched"&&!He.has(D)){let _=this.ctx.eventDescriptions.get(D),H={type:"forwarded",name:D,element:S,description:_,deprecated:I.deprecated,tags:I.tags,source:I.source};if(I.internal)H.internal=!0;if(I.detail!==void 0&&I.detail!=="undefined")H.detail=I.detail;this.ctx.events.set(D,H)}}),Nt(this.ctx,He);let Xe=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(S)=>this.resolvePublicPropName(S))):new Set,je=i.mapToArray(this.ctx.props).filter((S)=>!Xe.has(S.name)).map((S)=>{if(this.ctx.bindings.has(S.name)){let D=this.ctx.bindings.get(S.name)?.elements.sort().map((I)=>ft(I)).join(" | ");return{...S,type:`null | ${D}`,typeSource:"inferred",reactive:S.reactive||this.ctx.reactive_vars.has(S.name)}}return{...S,reactive:S.reactive||this.ctx.reactive_vars.has(S.name)}});this.ctx.activeScopes.length=0;let Ve=i.mapToArray(this.ctx.slots).map((S)=>{let{slot_props_unresolved_spread:D,...I}=S;if(!S.slot_props)return I;if(typeof S.slot_props==="string")return fn.test(S.slot_props)?{...I,slot_props:"Record<string, never>"}:I;let _=S.slot_props,H=[];for(let F of Object.keys(_)){if(_[F].replace&&_[F].value!==void 0)_[F].value=this.getPropTypeByLocalOrPublic(_[F].value);if(_[F].value===void 0)_[F].value="any";H.push(`${F}: ${_[F].value}`)}let w=D?" & Record<string, any>":"",k=H.length===0?D?"Record<string, any>":"Record<string, never>":H.length===1?`{ ${H[0]} }${w}`:`{
|
|
2
|
+
${H.join(`;
|
|
3
|
+
`)};
|
|
4
|
+
}${w}`;return{...I,slot_props:k}}).sort((S,D)=>{let I=S.name??"",_=D.name??"";if(I<_)return-1;if(I>_)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let S=[...je.map((D)=>D.type??""),...Ve.map((D)=>D.slot_props??"")].join(`
|
|
5
|
+
`);for(let{name:D,constraint:I}of this.ctx.deferredSlotBlockGenerics){let _=D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${_}\\b`).test(S))continue;this.accumulateGeneric(D,I)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)r(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=Te(this.ctx.scriptGenericsAttribute.value)}let Oe=i.mapToArray(this.ctx.moduleExports),qe=i.mapToArray(this.ctx.events).map((S)=>{switch(S.type){case"forwarded":return{...S,element:S.element.name};case"dispatched":return S;default:return S}}).sort((S,D)=>{let I=S.name.localeCompare(D.name);if(I!==0)return I;let _=S.type.localeCompare(D.type);if(_!==0)return _;if(S.type==="forwarded"&&D.type==="forwarded"){let H=S.element.localeCompare(D.element);if(H!==0)return H}return(S.detail??"").localeCompare(D.detail??"")}),$e=i.mapToArray(this.ctx.typedefs),Ye=i.mapToArray(this.ctx.contexts),Qe={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((S)=>S.location==="props").map((S)=>[S.propName,S])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((S)=>S.location==="moduleExports").map((S)=>[S.propName,S]))};for(let S of je)if(S.typeSource==="unknown"){let D=Qe.props.get(S.name);if(D)S.type="any";let I=D?D.importSource?`Prop "${S.name}" default calls "${D.calleeName}()" imported from "${D.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${S.name}" default calls "${D.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${S.name}" type could not be inferred; falling back to "${S.type??"any"}".`;r(this.ctx,"prop-unknown-type",S.name,I,S.source)}for(let S of Oe)if(S.typeSource==="unknown"&&Qe.moduleExports.has(S.name))S.type="any";for(let S of this.ctx.jsDocEventNames){if(He.has(S))continue;if(this.ctx.forwardedEvents.has(S))continue;if(this.ctx.props.has(`on${S}`))continue;r(this.ctx,"event-no-source",S,`@event "${S}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(S))}if(this.ctx.rest_props?.type==="InlineComponent")r(this.ctx,"rest-props-unresolved","$$restProps",`$$restProps is only spread onto component "${this.ctx.rest_props.name}"; sveld cannot infer its rest-prop type. Spread onto a plain element or add an @restProps tag.`);let Ze=$e.filter((S)=>S.internal).map((S)=>S.name.split("<")[0]);if(Ze.length>0){let S=Ze.map((I)=>({name:I,regex:new RegExp(`\\b${I}\\b`)})),D=(I,_,H)=>{if(!_)return;for(let{name:w,regex:k}of S){if(!k.test(_))continue;r(this.ctx,"internal-typedef-referenced",I,`"${I}" references "${w}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,H)}};for(let I of je){if(I.internal)continue;D(I.name,I.type,I.source)}for(let I of Oe){if(I.internal)continue;D(I.name,I.type,I.source)}for(let I of $e){if(I.internal)continue;D(I.name,I.ts)}for(let I of qe){if(I.internal||I.type!=="dispatched")continue;D(I.name,I.detail,I.source)}for(let I of Ve){if(I.internal)continue;D(I.name??"default",I.slot_props,I.source)}for(let I of Ye){if(I.internal)continue;for(let _ of I.properties)D(_.name,_.type)}}let et={source:U(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:je,moduleExports:Oe,slots:Ve,events:qe,typedefs:$e,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:Ye,customElementTag:this.ctx.customElementTag,customElement:this.ctx.customElement,...this.ctx.cssParts.length>0?{cssParts:this.ctx.cssParts.slice()}:{},...this.ctx.cssProperties.length>0?{cssProperties:this.ctx.cssProperties.slice()}:{},diagnostics:this.ctx.diagnosticRecords.slice()},Ge=xe(this.ctx);if(Ge)et[g]=Ge;return et}}
|
|
6
|
+
export{i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i}from"./chunk-49hdrj4n.js";export{i as default};
|