sveld 0.37.5 → 0.37.7
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 +157 -24
- package/lib/browser.d.ts +140 -7
- package/lib/browser.js +190 -162
- package/lib/{chunk-8s0hjkmq.js → chunk-0r8vwqdc.js} +9 -9
- package/lib/chunk-7w571557.js +1 -0
- package/lib/chunk-8xbe5qy3.js +356 -0
- package/lib/chunk-95xn5q1p.js +1 -0
- package/lib/chunk-aw6a570w.js +6 -0
- package/lib/chunk-mxv2ftxe.js +6 -0
- package/lib/cli-entry.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/schema/component-api.schema.json +59 -3
- package/lib/chunk-a2krprqa.js +0 -6
- package/lib/chunk-bxzbn9eg.js +0 -1
- package/lib/chunk-k2w5f49f.js +0 -331
- package/lib/chunk-x9qsjgpb.js +0 -6
- package/lib/chunk-znjmdeca.js +0 -1
package/lib/chunk-x9qsjgpb.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{ae,f,s,ce,p,d,ue,g,j,r,m,W,t,n,u,R,L,h,le,fe,de,Q,y,me,Y,he,ye,x,ge,c,P,xe,Z,Te,Ee,be,K,Se,O,H,ke,ee,te,re,M,l,we,Ce,ne,v,A}from"./chunk-k2w5f49f.js";var ft={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 ft}function yt(e){if(Ht(e))return ft[e];return"HTMLElement"}function at(){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:[],pendingConstDefaultCandidates:[],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 jt=new Set(["Component","SvelteComponent","SvelteSelf"]),Bt=new Set(["RegularElement","SvelteElement"]);function Ke(e){return jt.has(e)}function ze(e){return Bt.has(e)}function Vt({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 We(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 k=e.jsdocTypeParameters?`<${e.jsdocTypeParameters}>`:"";o=a&&a.length>0?`${k}(${a.map((J)=>`${J.name}${J.optional?"?":""}: ${J.type}`).join(", ")}) => ${T}`:`${k}() => ${T}`}let b=e.jsdocDescription??e.resolvedDescription;if(b===void 0&&o!==void 0)b=e.typedefs?.get(o)?.description;let N=Vt({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:N,description:b,params:a,returnType:T,isFunction:E,typeParameters:C}}function Ot(e){if(!e||typeof e!=="object"||!("type"in e))return;let o=String(e.type),a=Ke(o);if(!a&&!ze(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 N=e.tag;if(N.type==="Literal"&&typeof N.value==="string")b.thisValue=N.value}return b}function gt(e,o){let a=Ot(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 De(e,o,a){if(!o||e.has(o))return;e.set(o,a)}function Ue(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 ct(e,o){if(!o||typeof o!=="object"||!("type"in o))return;if(o.type==="Identifier"){let T=Ue(e,o.name);if(T)e.reactive_vars.add(T);return}let a=Pe(o);for(let T of a){let b=Ue(e,T);if(b)e.reactive_vars.add(b)}}function Xe(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 Tt(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let o=String(e.type);return o==="FunctionDeclaration"||o==="FunctionExpression"||o==="ArrowFunctionExpression"}function $t(e,o){let a=e.scopeDeclarations.get(o);if(!a)a=new Map,e.scopeDeclarations.set(o,a);return a}function Gt(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 N=e.getPropertyName(b.key);if(!N)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:N})}return T}function st(e,o,a,T,b){if(!ae(o))return;let N=b?.allowRunesProps??!1,E=b?.forceProp??!1,C=o;for(let k of C.declarations){if(N&&p(d(k.init),"$props")){for(let U of Gt(e,C,k))De(U.kind==="prop"?a:T,U.name,U.kind==="prop"?{kind:"prop",publicPropName:U.publicPropName}:{kind:"local"});continue}let J=C.kind==="var"?T:a,G=E?"prop":"local";for(let U of Pe(k.id))De(J,U,G==="prop"?{kind:"prop",publicPropName:U}:{kind:"local"})}}function Jt(e,o){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")De(o,e.id.name,{kind:"local"});for(let a of e.params)for(let T of Pe(a))De(o,T,{kind:"local"})}function Kt(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":st(e,b,a,T);break;case"FunctionDeclaration":if(b.id?.name)De(a,b.id.name,{kind:"local"});break;case"ClassDeclaration":if(b.id?.name)De(a,b.id.name,{kind:"local"});break}}}function zt(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 N of b.specifiers??[])if(N.local?.name)De(o.componentScope,N.local.name,{kind:"local"});break;case"VariableDeclaration":st(e,b,o.componentScope,o.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(b.id?.name)De(o.componentScope,b.id.name,{kind:"local"});break;case"ClassDeclaration":if(b.id?.name)De(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")st(e,b.declaration,o.componentScope,o.componentScope,{forceProp:!0});else if(b.declaration.type==="FunctionDeclaration"&&b.declaration.id?.name)De(o.componentScope,b.declaration.id.name,{kind:"prop",publicPropName:b.declaration.id.name});break}}}function bt(e,o){o.componentScope.clear(),o.scopeDeclarations=new Map,o.activeScopes.length=0,zt(e,o,o.parsed?.instance)}function xt(e){return{varScopeStack:[e.componentScope]}}function ht(e,o,a,T){if(!Xe(T))return;let b=$t(o,T),N=a.varScopeStack[a.varScopeStack.length-1]??o.componentScope;switch(String(T.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Jt(T,b);break;case"BlockStatement":Kt(e,T.body,b,N);break;case"CatchClause":if("param"in T)for(let C of Pe(T.param))De(b,C,{kind:"local"});break;case"EachBlock":{let C=T;for(let k of Pe(C.context))De(b,k,{kind:"local"});if(typeof C.index==="string")De(b,C.index,{kind:"local"});else if(C.index&&"name"in C.index)De(b,C.index.name,{kind:"local"});break}case"AwaitBlock":{let C=T;for(let k of Pe(C.value))De(b,k,{kind:"local"});for(let k of Pe(C.error))De(b,k,{kind:"local"});break}}if(Tt(T))a.varScopeStack.push(b);return b}function St(e,o){if(Tt(o))e.varScopeStack.pop()}var vt=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function Wt(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 Ut=Array.from(vt);function Et(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Xt(e){if(e.includes("\\u"))return!0;for(let o of Ut){let a=e.indexOf(o);while(a!==-1){if(!Et(e.charCodeAt(a-1))&&!Et(e.charCodeAt(a+o.length)))return!0;a=e.indexOf(o,a+1)}}return!1}function qt(e,o){for(let a=o.length-1;a>=0;a-=1)if(o[a]?.has(e))return!0;return!1}function Yt(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":nt(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 nt(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)nt([T],o);break}}}}function pt(e,o){if(!e||typeof e!=="object")return!1;return lt(e,void 0,[...o])}function lt(e,o,a){if(ne(e.type))return!1;let T=Xe(e);if(T)a.push(Yt(e));let b=!1;if(o&&e.type==="Identifier"&&e.name!==void 0&&vt.has(e.name)&&!o.type.startsWith("TS")&&Wt(e,o)&&!qt(e.name,a))b=!0;else for(let N in e){if(N==="leadingComments")continue;let E=e[N];if(!E||typeof E!=="object")continue;if(Array.isArray(E)){for(let C=0;C<E.length;C++){let k=E[C];if(k&&typeof k==="object"&&typeof k.type==="string"){if(lt(k,e,a)){b=!0;break}}}if(b)break}else if(typeof E.type==="string"){if(lt(E,e,a)){b=!0;break}}}if(T)a.pop();return b}function Pt(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 Ct(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let o=e.parsed;if(!o)return"legacy";if(e.source!==void 0&&!Xt(e.source))return"legacy";let a=new Set;nt(Pt(o.module),a);let T=new Set;return nt(Pt(o.instance),T),pt(o.module,[a])||pt(o.instance,[a,T])||pt(o.fragment,[a,T])?"runes":"legacy"}var Qt=/[A-Za-z_$][\w$]*/g;function Zt(e,o,a){let T=new Map,b=o.typeParameters?.params,N=a.typeArguments?.params;if(!b?.length||!N?.length)return T;for(let E=0;E<b.length;E++){let C=b[E]?.name,k=N[E];if(!C||k?.start===void 0||k?.end===void 0)continue;let J=n(e,k.start,k.end)?.trim();if(J)T.set(C,J)}return T}function en(e,o){if(o.size===0)return e;return e.replace(Qt,(a)=>o.get(a)??a)}function Be(e,o,a,T,b=new Set){let N=new Map;if(!a?.type)return N;let E=(C)=>{for(let k of C){if(k?.type!=="TSPropertySignature"||k.computed)continue;if(!k.key)continue;let J=e.getPropertyName(k.key);if(!J)continue;let G=k.typeAnnotation?.start,U=k.typeAnnotation?.end;if(G===void 0||U===void 0)continue;let pe=n(o,G+1,U)?.trim();if(!pe)continue;P(o,k.typeAnnotation?.typeAnnotation),N.set(J,{type:pe,optional:k.optional===!0,source:t(o,k)})}};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[k,J]of C)N.set(k,J);break}case"TSTypeReference":{let C=ye(a.typeName);if(!C||b.has(C))break;let k=T.get(C);if(!k)break;b.add(C);let J=Be(e,o,k,T,b);b.delete(C);let G=Zt(o,k,a);for(let[U,pe]of J)N.set(U,G.size===0?pe:{...pe,type:en(pe.type,G)});break}case"TSIntersectionType":for(let C of a.types??[]){let k=Be(e,o,C,T,b);for(let[J,G]of k)N.set(J,G)}break;case"TSParenthesizedType":{let C=Be(e,o,a.typeAnnotation,T,b);for(let[k,J]of C)N.set(k,J);break}}return N}function tn(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 Dt(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:tn(b.props)}:{},...b.extend===void 0?{}:{extend:!0}}:void 0,o.runesOptionOverride=T.options?.runes,o.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(T);let N=T.instance?.content?.body??[];for(let E of N){if(!E?.type)continue;if(E.type==="ImportDeclaration"&&E.source?.value)for(let C of E.specifiers??[]){let k=C.local?.name;if(!k)continue;if(!(E.importKind==="type"||C.importKind==="type"))continue;let G,U;if(C.type==="ImportSpecifier")G="named",U=C.imported?.type==="Identifier"?C.imported.name:typeof C.imported?.value==="string"?C.imported.value:void 0;else if(C.type==="ImportDefaultSpecifier")G="default";else if(C.type==="ImportNamespaceSpecifier")G="namespace";if(!G)continue;o.typeImportBindingsByLocalName.set(k,{importedName:U,localName:k,source:String(E.source.value),specifierType:G})}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:xe(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 k=x(o,C.id.typeAnnotation);if(k)o.explicitPropTypesByName.set(C.id.name,k),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 k=x(o,C.id.typeAnnotation);if(k)o.explicitVariableTypesByName.set(C.id.name,k)}}for(let E of N){if(!E||typeof E!=="object"||!("declarations"in E))continue;for(let C of E.declarations??[]){if(!p(d(C.init),"$props"))continue;let k=C.id?.typeAnnotation?void 0:ue(C.init),J=C.id?.typeAnnotation?.typeAnnotation??k,G=C.id?.typeAnnotation?x(o,C.id.typeAnnotation):ge(o,k),U=Be(e,o,J,new Map(Array.from(o.localTypeDeclarationsByName.entries(),([Me,He])=>[Me,He.node]))),pe=new Set,Le=new Set;if(c(o,J,pe,Le),be(o,pe,Le),C.start!==void 0){let Me={canonicalType:G,props:U,referencedImportedTypes:pe,referencedLocalTypes:Le};if(o.runesPropsDeclarationMetadataByDeclaratorStart.set(C.start,Me),G)o.typedRunesPropsDeclarations.push(Me)}}}}function Mt(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=Y(o,T.start);if(E)for(let[C,k]of E.props)R(e,o,C,{name:C,kind:"let",type:k.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!k.optional,constant:!1,reactive:!1,source:k.source});continue}if(T.id.type!=="ObjectPattern")continue;let b=l(o,e,a),N=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 k,J;if(E.value.type==="Identifier")k=E.value.name;else{let Ge=E.value;k=Ge.left.name,J=Ge.right}if(!k)continue;if(e.trackPropLocalName(C,k),C==="children")o.snippetPropLocals.add(k);let G=we(o,e,E)??(N===1?b:void 0),U=he(o,T.start,C),{init:pe,bindable:Le}=le(J),Me=pe==null?{isFunction:!1}:h(e,o,pe),{value:He,type:qe,isFunction:je,defaultValue:Ve}=Me,Oe=U?.type===void 0&&G?.type===void 0?Me.resolvedType:void 0;L(o,Me,C,"props");let{type:Ye,typeSource:$e,description:Qe,params:Ze,returnType:et,isFunction:tt}=We({explicitType:U?.type,typeSeed:qe,inferredTypeForSource:qe,jsdocType:G?.type,jsdocDescription:G?.description,jsdocParams:G?.params,jsdocReturnType:G?.returnType,resolvedType:Oe,resolvedDescription:Me.resolvedDescription,resolvedParams:Me.resolvedParams,resolvedReturnType:Me.resolvedReturnType,initializerIsFunction:je,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(Le)o.reactive_vars.add(C);m(o,"prop-unknown-type",C,G?.sveldIgnore),R(e,o,C,{name:C,...k===C?{}:{localName:k},kind:"let",description:Qe,binding:G?.binding,deprecated:G?.deprecated,tags:G?.tags,...G?.internal?{internal:!0}:{},...Le?{bindable:!0}:{},type:Ye,typeSource:$e,value:He,defaultValue:Ve,params:Ze,returnType:et,isFunction:tt,isFunctionDeclaration:!1,isRequired:!Le&&pe==null&&U?.optional!==!0,constant:!1,reactive:Le,source:t(o,E)})}}}function nn(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,N=T;for(;T<e.length;T++)if(e[T]==="<")b++;else if(e[T]===">"){if(b--,b===0)return e.slice(N+1,T)}return}function rn(e){let o=[],a=0,T=0;for(let b=0;b<e.length;b++){let N=e[b];if(N==="{"||N==="("||N==="["||N==="<")a++;else if(N==="}"||N===")"||N==="]"||N===">")a=Math.max(a-1,0);else if(a===0&&(N===";"||N===","))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 on=/^["']|["']$/g,an=/\?$/,sn=/^\{/,cn=/\}$/;function pn(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(an,"").replace(on,""),N=e.slice(a+1).trim();if(!b||!N)return;return{name:b,type:N}}}return}function Nt(e,o,a,T,b){if(a){let k=new Map(Array.from(o.localTypeDeclarationsByName.entries(),([G,U])=>[G,U.node])),J=Be(e,o,a,k);for(let[G,U]of J)y(o,{name:G,detail:U.type,has_argument:!0,source:U.source});return}let N=e.resolveLocalVarJSDoc(T)?.type,E=N?nn(N):void 0;if(!E)return;let C=E.trim().replace(sn,"").replace(cn,"");for(let k of rn(C)){let J=pn(k);if(!J)continue;y(o,{name:J.name,detail:J.type,has_argument:!0,source:b})}}function kt(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}`,N=e.props.get(b);if(!N)continue;let E=N.type!==void 0||N.params!==void 0||N.returnType!==void 0,C=T.detail===void 0||T.detail==="undefined"||T.detail==="null"?"() => void":`(detail: ${T.detail}) => void`;e.props.set(b,{...N,description:N.description??T.description,type:E?N.type:C,typeSource:E?N.typeSource:"inferred",isFunction:!0}),e.events.delete(a)}}var Lt=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function dt(e){return e!==null&&typeof e==="object"&&typeof e.type==="string"}function wt(e){if(!Lt.has(e.type))return e;let o=e.expression;while(o&&Lt.has(o.type))o=o.expression;return o??e}function rt(e){if(!dt(e))return;ut(e)}function ut(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(!dt(b))continue;let N=wt(b);if(N!==b)a[T]=N;ut(N)}else if(dt(a)){let T=wt(a);if(T!==a)e[o]=T;ut(T)}}}function ln(e,o,a,T,b){for(let N of e){if(N.type!=="Block"||N.start<a||N.end>T)continue;let E=o.slice(N.start,N.end);b.push({end:N.end,isJsDoc:E.startsWith("/**")&&E.length>4,text:E})}}function Rt(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 dn(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)Rt(T.declaration,T.start,o);else Rt(T,T.start,o)}return o}function un(e,o,a){let T;for(let b of e){if(b.end>o)break;if(!b.isJsDoc)continue;if(!te.test(a.slice(b.end,o)))continue;T=b}return T}function At(e,o){let a=new Map;if(!e.source)return a;let T=[e.parsed?.module,e.parsed?.instance],b=[],N=[],E=e.parsed?.comments??[];for(let C of T){let k=C?.content;if(!k?.body||k.start===void 0||k.end===void 0)continue;ln(E,e.source,k.start,k.end,b),N.push(...dn(k.body))}b.sort((C,k)=>C.end-k.end);for(let C of N){let k=un(b,C.start,e.source);if(!k)continue;let J=re(e,k.text),{type:G,description:U,ignore:pe,internal:Le}=M(J);if(pe.length>0)m(e,"context-any-type",C.name,pe);if(!G)continue;a.set(C.name,{type:o.aliasType(G.type),description:U||G.description,internal:Le||void 0})}return a}function mt(e){if(e?.type==="Identifier")return e.name;return typeof e?.value==="string"?e.value:void 0}function It(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var mn=null,_t=/^@component/,fn=/\r/g,yn=/^\{\s*\}$/,gn=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);class i{ctx=at();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 N=i.getStaticAttributeValue(o);if(!N)return;return{value:N,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=mt(o.local),T=mt(o.exported);if(!a||!T)return;if(e.source!=null)return{localName:a,exportedName:T};for(let b of this.ctx.vars){let N=b.declarations.find((E)=>E.id.type==="Identifier"&&E.id.name===a);if(N)return{localName:a,exportedName:T,declaration:b,declarator:N}}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=At(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=at()}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 N=T.replace(i.TS_DIRECTIVE_REGEX,"");return a+N+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(Dt(this,this.ctx,T),this.ctx.parsed=T,this.ctx.scriptLanguage==="ts")rt(this.ctx.parsed.module),rt(this.ctx.parsed.instance),rt(this.ctx.parsed.fragment);this.ctx.syntaxMode=Ct(this.ctx);let b=this.ctx.parsed.css,N=b?.start!==void 0&&b?.end!==void 0?a.slice(0,b.start)+" ".repeat(b.end-b.start)+a.slice(b.end):a;ee(this.ctx,this.ctx.parsed?.module),ee(this.ctx,this.ctx.parsed?.instance),Ce(this.ctx,this,N);let E={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(this.ctx.parsed?.module){let S=ke(this.ctx.parsed.module),D=(F,B,I)=>{let w=l(this.ctx,this,F);this.addModuleExport(B==="*"?`* from ${I.from}`:B,{name:B,kind:"re-export",description:w?.description,deprecated:w?.deprecated,tags:w?.tags,...w?.internal?{internal:!0}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,reExport:I,source:t(this.ctx,F)})},_=(F,B,I)=>{let w=[];if(B.type==="FunctionDeclaration"){let q=B;if(!q.id?.name)return;let X=this.ctx.scriptLanguage==="ts"?Z(this.ctx,q):void 0;w.push({prop_name:q.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:X?.hasAnnotations?void 0:"() => any",explicitType:X?.hasAnnotations?X.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(B.type==="VariableDeclaration"){let q=B,X=It(q.kind),oe=I?.declarator?[I.declarator]:q.declarations;for(let ie of oe){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=I?.exportedName??Ne,z=ve==null?{isFunction:!1}:h(this,this.ctx,ve),{value:Re,type:Ae,isFunction:_e,defaultValue:Fe}=z,Je=z;L(this.ctx,z,Ne,"moduleExports"),w.push({prop_name:Ie,kind:X,isFunctionDeclaration:!1,value:Re,typeSeed:Ae,explicitType:this.getExplicitPropType(Ne),initializerIsFunction:_e,defaultValue:Fe,inferredTypeForSource:Ae,resolvedJSDoc:Je})}if(w.length===0)return}else return;let V=l(this.ctx,this,F);for(let{prop_name:q,kind:X,isFunctionDeclaration:oe,value:ie,typeSeed:se,explicitType:ve,initializerIsFunction:Ne,defaultValue:Ie,inferredTypeForSource:z,resolvedJSDoc:Re}of w){let{type:Ae,typeSource:_e,description:Fe,params:Je,returnType:ot,isFunction:it,typeParameters:Ft}=We({explicitType:ve,typeSeed:se,inferredTypeForSource:z,jsdocType:V?.type,jsdocDescription:V?.description,jsdocParams:V?.params,jsdocReturnType:V?.returnType,jsdocTypeParameters:V?.typeParameters,resolvedType:Re?.resolvedType,resolvedDescription:Re?.resolvedDescription,resolvedParams:Re?.resolvedParams,resolvedReturnType:Re?.resolvedReturnType,initializerIsFunction:Ne,isFunctionDeclaration:oe,typedefs:this.ctx.typedefs});this.addModuleExport(q,{name:q,kind:X,description:Fe,deprecated:V?.deprecated,tags:V?.tags,...V?.internal?{internal:!0}:{},type:Ae,typeSource:_e,value:ie,defaultValue:Ie,params:Je,returnType:ot,typeParameters:Ft,isFunction:it,isFunctionDeclaration:oe,isRequired:!1,constant:X==="const",reactive:!1,source:t(this.ctx,F)})}};v(this.ctx.parsed?.module,(F)=>{if(F.type==="ImportDeclaration")H(this.ctx,F);if(F.type==="FunctionDeclaration"){let B=F;if(B.id?.name)this.ctx.funcDecls.set(B.id.name,B)}if(F.type==="VariableDeclaration")this.ctx.vars.add(F);if(F.type==="ExportNamedDeclaration"){if(F.declaration!=null){_(F,F.declaration);return}let B=F.source?.value;for(let I of F.specifiers){let w=this.resolveExportSpecifier(F,I);if(!w)continue;if(w.exportedName==="default"){r(this.ctx,"module-export-conflict",w.exportedName,`export "default" was skipped because it collides with the component's own default export.`,t(this.ctx,F));continue}let V=typeof B==="string"?{from:B,imported:w.localName}:S.get(w.localName);if(w.declaration)_(F,w.declaration,w);else if(V)D(F,w.exportedName,V);else this.recordUnresolvedExportSpecifier(F,w.localName,w.exportedName)}}if(F.type==="ExportAllDeclaration"&&typeof F.source.value==="string"){let B=(F.exported&&mt(F.exported))??"*";D(F,B,{from:F.source.value,imported:"*"})}})}let C,k,J,G=new Set,U=new Set,pe=[];bt(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Le=xt(this.ctx),Me=(S,D,_)=>{let F=[];if(D.type==="FunctionDeclaration"){let I=D;if(!I.id?.name)return;let w=I.id.name,V=this.ctx.scriptLanguage==="ts"?Z(this.ctx,I):void 0;F.push({prop_name:w,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:V?.hasAnnotations?void 0:"() => any",explicitType:V?.hasAnnotations?V.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:I.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(D.type==="VariableDeclaration"){let I=D,w=It(I.kind),V=_?.declarator?[_.declarator]:I.declarations;for(let q of V){if(!q||typeof q!=="object"||!("id"in q))continue;let{id:X,init:oe}=q;if(!X||typeof X!=="object"||!("name"in X))continue;let ie=X.name,se=_?.exportedName??ie,ve=w==="let"&&oe==null,Ne=oe==null?{isFunction:!1}:h(this,this.ctx,oe),{value:Ie,type:z,isFunction:Re,defaultValue:Ae}=Ne,_e=Ne;L(this.ctx,Ne,se,"props"),F.push({prop_name:se,kind:w,isFunctionDeclaration:!1,value:Ie,typeSeed:z,explicitType:this.getExplicitPropType(ie),initializerIsFunction:Re,isRequired:ve,localName:ie,defaultValue:Ae,inferredTypeForSource:z,resolvedJSDoc:_e})}if(F.length===0)return}else return;let B=l(this.ctx,this,S);for(let{prop_name:I,kind:w,isFunctionDeclaration:V,value:q,typeSeed:X,explicitType:oe,initializerIsFunction:ie,isRequired:se,localName:ve,defaultValue:Ne,inferredTypeForSource:Ie,resolvedJSDoc:z}of F){let{type:Re,typeSource:Ae,description:_e,params:Fe,returnType:Je,isFunction:ot,typeParameters:it}=We({explicitType:oe,typeSeed:X,inferredTypeForSource:Ie,jsdocType:B?.type,jsdocDescription:B?.description,jsdocParams:B?.params,jsdocReturnType:B?.returnType,jsdocTypeParameters:B?.typeParameters,resolvedType:z?.resolvedType,resolvedDescription:z?.resolvedDescription,resolvedParams:z?.resolvedParams,resolvedReturnType:z?.resolvedReturnType,initializerIsFunction:ie,isFunctionDeclaration:V,typedefs:this.ctx.typedefs});m(this.ctx,"prop-unknown-type",I,B?.sveldIgnore),R(this,this.ctx,I,{name:I,...ve!==void 0&&ve!==I?{localName:ve}:{},kind:w,description:_e,binding:B?.binding,deprecated:B?.deprecated,tags:B?.tags,...B?.internal?{internal:!0}:{},type:Re,typeSource:Ae,value:q,defaultValue:Ne,params:Fe,returnType:Je,typeParameters:it,isFunction:ot,isFunctionDeclaration:V,isRequired:se,constant:w==="const",reactive:this.ctx.reactive_vars.has(I),source:t(this.ctx,S)})}};if(v(E,(S,D,_)=>{let F=ht(this,this.ctx,Le,S);if(F)this.ctx.activeScopes.push(F);let B=S.type;if(!gn.has(B))return;if(S.type==="AssignmentExpression")ct(this.ctx,S.left);if(S.type==="UpdateExpression")ct(this.ctx,S.argument);if(S.type==="CallExpression"){let I=S,w=I.callee&&typeof I.callee==="object"&&"name"in I.callee?I.callee.name:void 0;if(w==="createEventDispatcher"){if(D&&typeof D==="object"&&"id"in D&&D.id&&typeof D.id==="object"&&"name"in D.id)C=D.id.name,k=D;J=I.typeArguments?.params?.[0]}if(w==="$host"){if(D&&typeof D==="object"&&"id"in D&&D.id&&typeof D.id==="object"&&"name"in D.id)G.add(D.id.name)}if(w==="setContext")fe(this.ctx,this,S,D??void 0);if(w)pe.push({name:w,arguments:I.arguments,node:I});if(ce(I.callee)&&s(I.callee.property)&&I.callee.property.name==="dispatchEvent"&&(p(I.callee.object,"$host")||s(I.callee.object)&&G.has(I.callee.object.name))){let V=me(this.ctx,I);if(V)U.add(V)}}if(B==="SpreadAttribute"){let I=S;if(I.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(I.expression?.name??""))gt(this.ctx,D)}if(S.type==="FunctionDeclaration"){let I=S;if(I.id?.name)this.ctx.funcDecls.set(I.id.name,I)}if(S.type==="ImportDeclaration")H(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((I)=>p(d(I.init),"$props")))Mt(this,this.ctx,S)}if(S.type==="ExportNamedDeclaration"){if(S.declaration!=null){Me(S,S.declaration);return}for(let I of S.specifiers){let w=this.resolveExportSpecifier(S,I);if(!w)continue;if(w.declaration)Me(S,w.declaration,w);else this.recordUnresolvedExportSpecifier(S,w.localName,w.exportedName)}}if(B==="Comment"){let w=S?.data?.trim()??"";if(_t.test(w))this.ctx.componentComment=w.replace(_t,"").replace(fn,""),this.ctx.componentCommentSource=t(this.ctx,S)}if(B==="SlotElement"){let I=S,w=I.attributes?.find((oe)=>oe.name==="name")?.value,V=(Array.isArray(w)?w[0]:void 0)?.data,q=(I.attributes||[]).filter((oe)=>oe.name!=="name").reduce((oe,ie)=>{let se={value:void 0,replace:!1},ve=ie.value;if(ve===void 0||ve===!0)return oe;let Ne=Array.isArray(ve)?ve[0]:ve;if(Ne){let{type:Ie,expression:z,raw:Re,start:Ae,end:_e}=Ne;if(Ie==="Text"&&Re!==void 0)se.value=JSON.stringify(Re);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 Fe=z.value;se.value=typeof Fe==="string"?JSON.stringify(Fe):String(Fe)}else if(z.type==="MemberExpression")se.value=j(this.ctx,this,z);else if(z.type!=="Identifier"){if(Ae!==void 0&&_e!==void 0){if(z.type==="ObjectExpression"||z.type==="TemplateLiteral")se.value=n(this.ctx,Ae+1,_e-1)}}}}if(ie.name)oe[ie.name]=se;return oe},{}),X=I.fragment?.nodes?.map(({start:oe,end:ie})=>{if(oe===void 0||ie===void 0)return"";return n(this.ctx,oe,ie)??""}).join("").trim();O(this.ctx,{slot_name:V,slot_props:q,slot_fallback:X,source:t(this.ctx,S)})}if(B==="RenderTag"){let I=S,w=Se(this.ctx,I.expression);if(w){let V,q=!1;if(w.arguments.length===0)V={};else if(w.arguments.length===1&&typeof w.arguments[0]==="object"&&w.arguments[0]&&"type"in w.arguments[0]&&w.arguments[0].type==="ObjectExpression"){let ie=K(this.ctx,this,w.arguments[0]);V=ie.slot_props,q=ie.hasUnresolvedSpread}else if(w.arguments.length===1)r(this.ctx,"syntax-skipped",w.publicName,`{@render ${w.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,t(this.ctx,S));let X=w.publicName==="children"?void 0:w.publicName,oe=X===void 0?mn:X;if(V!==void 0)O(this.ctx,{slot_name:X,slot_props:V,slot_props_unresolved_spread:q||void 0,source:t(this.ctx,S)});if(V!==void 0||this.ctx.slots.has(oe))this.ctx.snippetPropLocals.add(w.trackingName)}}if(B==="OnDirective"){let I=S;if(I.expression==null&&I.name){if(D!=null&&typeof D==="object"&&"name"in D){let w=typeof D.name==="string"?D.name:void 0,V="type"in D?String(D.type):void 0;if(w&&V){let q=Ke(V)?{type:"InlineComponent",name:w}:{type:"Element",name:w};this.ctx.forwardedEvents.set(I.name,q);let X=this.ctx.events.get(I.name),oe=this.ctx.eventDescriptions.get(I.name),ie=X?.deprecated,se=X?.internal;if(!X)this.ctx.events.set(I.name,{type:"forwarded",name:I.name,element:q,description:oe,deprecated:ie,...se?{internal:!0}:{},source:t(this.ctx,S)});else if(X.type==="forwarded"&&oe&&!X.description)this.ctx.events.set(I.name,{...X,description:oe,deprecated:X.deprecated??ie,...X.internal||se?{internal:!0}:{},source:X.source||t(this.ctx,S)})}}}}if(B==="BindDirective"&&D&&typeof D==="object"&&"type"in D&&(ze(String(D.type))||Ke(String(D.type)))){let I=S;if(I.expression?.name){let w=Ue(this.ctx,I.expression.name);if(w)this.ctx.reactive_vars.add(w)}if(ze(String(D.type))&&I.name==="this"&&I.expression?.name&&"name"in D&&typeof D.name==="string"){let w=Ue(this.ctx,I.expression.name);if(!w)return;let V=D.name;if(this.ctx.bindings.has(w)){let q=this.ctx.bindings.get(w);if(q&&!q.elements.includes(V))this.ctx.bindings.set(w,{...q,elements:[...q.elements,V]})}else this.ctx.bindings.set(w,{elements:[V]})}}},(S)=>{if(Xe(S))this.ctx.activeScopes.pop(),St(Le,S)},{skipTypeOnlySubtrees:!0}),C!==void 0){Nt(this,this.ctx,J,C,t(this.ctx,k));for(let S of pe)if(S.name===C){let D=S.arguments[0],_=D&&typeof D==="object"&&"value"in D?D.value:void 0,F=S.arguments[1],B=de(this,F),I=B===void 0&&F&&typeof F==="object"&&"value"in F?F.value:void 0;if(_!=null)y(this.ctx,{name:String(_),detail:B??(I==null?"":Q(I)),has_argument:Boolean(F),source:t(this.ctx,S.node)})}}let He=new Set(U);if(C!==void 0){for(let S of pe)if(S.name===C){let D=S.arguments[0],_=D&&typeof D==="object"&&"value"in D?D.value:void 0;if(_!=null)He.add(String(_))}}this.ctx.forwardedEvents.forEach((S,D)=>{let _=this.ctx.events.get(D);if(_&&_.type==="dispatched"&&!He.has(D)){let F=this.ctx.eventDescriptions.get(D),B={type:"forwarded",name:D,element:S,description:F,deprecated:_.deprecated,tags:_.tags,source:_.source};if(_.internal)B.internal=!0;if(_.detail!==void 0&&_.detail!=="undefined")B.detail=_.detail;this.ctx.events.set(D,B)}}),kt(this.ctx,He);let qe=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)=>!qe.has(S.name)).map((S)=>{if(this.ctx.bindings.has(S.name)){let D=this.ctx.bindings.get(S.name)?.elements.sort().map((_)=>yt(_)).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,..._}=S;if(!S.slot_props)return _;if(typeof S.slot_props==="string")return yn.test(S.slot_props)?{..._,slot_props:"Record<string, never>"}:_;let F=S.slot_props,B=[];for(let V of Object.keys(F)){if(F[V].replace&&F[V].value!==void 0)F[V].value=this.getPropTypeByLocalOrPublic(F[V].value);if(F[V].value===void 0)F[V].value="any";B.push(`${V}: ${F[V].value}`)}let I=D?" & Record<string, any>":"",w=B.length===0?D?"Record<string, any>":"Record<string, never>":B.length===1?`{ ${B[0]} }${I}`:`{
|
|
2
|
-
${B.join(`;
|
|
3
|
-
`)};
|
|
4
|
-
}${I}`;return{..._,slot_props:w}}).sort((S,D)=>{let _=S.name??"",F=D.name??"";if(_<F)return-1;if(_>F)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:_}of this.ctx.deferredSlotBlockGenerics){let F=D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${F}\\b`).test(S))continue;this.accumulateGeneric(D,_)}}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=Ee(this.ctx.scriptGenericsAttribute.value)}let Oe=i.mapToArray(this.ctx.moduleExports),Ye=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 _=S.name.localeCompare(D.name);if(_!==0)return _;let F=S.type.localeCompare(D.type);if(F!==0)return F;if(S.type==="forwarded"&&D.type==="forwarded"){let B=S.element.localeCompare(D.element);if(B!==0)return B}return(S.detail??"").localeCompare(D.detail??"")}),$e=i.mapToArray(this.ctx.typedefs),Qe=i.mapToArray(this.ctx.contexts),Ze={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=Ze.props.get(S.name);if(D)S.type="any";let _=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,_,S.source)}for(let S of Oe)if(S.typeSource==="unknown"&&Ze.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 et=$e.filter((S)=>S.internal).map((S)=>S.name.split("<")[0]);if(et.length>0){let S=et.map((_)=>({name:_,regex:new RegExp(`\\b${_}\\b`)})),D=(_,F,B)=>{if(!F)return;for(let{name:I,regex:w}of S){if(!w.test(F))continue;r(this.ctx,"internal-typedef-referenced",_,`"${_}" references "${I}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,B)}};for(let _ of je){if(_.internal)continue;D(_.name,_.type,_.source)}for(let _ of Oe){if(_.internal)continue;D(_.name,_.type,_.source)}for(let _ of $e){if(_.internal)continue;D(_.name,_.ts)}for(let _ of Ye){if(_.internal||_.type!=="dispatched")continue;D(_.name,_.detail,_.source)}for(let _ of Ve){if(_.internal)continue;D(_.name??"default",_.slot_props,_.source)}for(let _ of Qe){if(_.internal)continue;for(let F of _.properties)D(F.name,F.type)}}let tt={source:W(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:Ye,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:Qe,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=Te(this.ctx);if(Ge)tt[g]=Ge;return tt}}
|
|
6
|
-
export{i};
|
package/lib/chunk-znjmdeca.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T,A}from"./chunk-k2w5f49f.js";export{T as TemplateParseNotImplementedError,A as parse};
|