sveld 0.36.8 → 0.36.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser.d.ts +9 -0
- package/lib/browser.js +164 -218
- package/lib/chunk-0204rbr9.js +7 -0
- package/lib/chunk-26w7fg2w.js +13 -0
- package/lib/chunk-2nrjrvnn.js +1 -0
- package/lib/chunk-bbeezhqq.js +6 -0
- package/lib/chunk-c83445g5.js +225 -0
- package/lib/chunk-d802cqsd.js +7 -0
- package/lib/chunk-n9w94djt.js +1 -0
- package/lib/chunk-nrz6c5ew.js +10 -0
- package/lib/chunk-ptdfswsv.js +2 -0
- package/lib/chunk-py1s51tb.js +16 -0
- package/lib/chunk-syz2wqmb.js +3 -0
- package/lib/cli-entry.js +1 -1
- package/lib/index.d.ts +1 -815
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/chunk-02g49ekt.js +0 -13
- package/lib/chunk-0q7qnmx3.js +0 -2
- package/lib/chunk-27bcwe2d.js +0 -225
- package/lib/chunk-4ndm4k55.js +0 -16
- package/lib/chunk-8xb689xy.js +0 -7
- package/lib/chunk-fk94b2eb.js +0 -6
- package/lib/chunk-fs34jqzg.js +0 -62
- package/lib/chunk-jvqe4bt1.js +0 -3
- package/lib/chunk-tjthqdyw.js +0 -10
- package/lib/chunk-wd7r13a5.js +0 -1
- package/lib/chunk-xzpr4ksw.js +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{$ as Tt,A as B,B as J,C as Ve,E as ke,H as lt,I as U,J as dt,K as N,L as z,M as ut,N as ie,O as ae,P as Oe,R as mt,S as ft,T as yt,U as gt,V as $e,W as Ge,X as Ke,Y as ye,Z as Je,_ as ze,ba as bt,ca as We,da as et,ea as xt,fa as ht,ga as Ce,ha as tt,ja as nt,ka as W,la as Xe,ma as St,u as _,w as Re,x as ct,y as be,z as pt}from"./chunk-py1s51tb.js";import{oa as Et}from"./chunk-d802cqsd.js";var Le={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 Pt(e){return e in Le}function we(e){if(Pt(e))return Le[e];return"HTMLElement"}function Ee(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingContextKeyCandidates:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1}}var vt=new Set(["Component","SvelteComponent","SvelteSelf"]),Mt=new Set(["RegularElement","SvelteElement"]);function te(e){return vt.has(e)}function ne(e){return Mt.has(e)}function Dt({hasTypeScriptType:e,hasJSDocType:t,inferredType:n,finalType:r}){if(e)return"typescript";if(t)return"jsdoc";if(n!==void 0)return"default";if(r!==void 0)return"inferred";return"unknown"}function re(e){let t=e.explicitType??e.jsdocType??e.resolvedType??e.typeSeed,n=e.jsdocParams??e.resolvedParams,r=e.jsdocReturnType??e.resolvedReturnType;if(e.isFunctionDeclaration&&t==="() => any"&&r)t=n&&n.length>0?`(${n.map((c)=>`${c.name}${c.optional?"?":""}: ${c.type}`).join(", ")}) => ${r}`:`() => ${r}`;let i=e.jsdocDescription??e.resolvedDescription;if(i===void 0&&t!==void 0)i=e.typedefs?.get(t)?.description;let p=Dt({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:t}),s=e.initializerIsFunction||e.isFunctionDeclaration||e.inferIsFunctionFromTypeSignature===!0&&(!!e.jsdocParams?.length||e.jsdocReturnType!==void 0||!!e.jsdocType?.includes("=>")||!!e.resolvedType?.includes("=>")||!!e.explicitType?.includes("=>"));return{type:t,typeSource:p,description:i,params:n,returnType:r,isFunction:s}}function Ct(e){if(!e||typeof e!=="object"||!("type"in e))return;let t=String(e.type),n=te(t);if(!n&&!ne(t))return;let r="name"in e&&typeof e.name==="string"?e.name:void 0;if(!r)return;let i=n?{type:"InlineComponent",name:r}:{type:"Element",name:r};if(r==="svelte:element"&&"tag"in e&&e.tag&&typeof e.tag==="object"){let p=e.tag;if(p.type==="Literal"&&typeof p.value==="string")i.thisValue=p.value}return i}function Ne(e,t){if(e.rest_props!==void 0)return;let n=Ct(t);if(n)e.rest_props=n}function k(e,t,n){if(!t||e.has(t))return;e.set(t,n)}function ue(e,t){for(let n=e.activeScopes.length-1;n>=0;n-=1){let r=e.activeScopes[n]?.get(t);if(!r)continue;return r.kind==="prop"?r.publicPropName:void 0}return}function M(e,t=new Set){if(!e||typeof e!=="object"||!("type"in e))return t;switch(e.type){case"Identifier":t.add(e.name);break;case"AssignmentPattern":M(e.left,t);break;case"ArrayPattern":for(let n of e.elements)M(n??void 0,t);break;case"ObjectPattern":for(let n of e.properties)if(n.type==="Property")M(n.value,t);else if(n.type==="RestElement")M(n.argument,t);break;case"RestElement":M(e.argument,t);break}return t}function ve(e,t){let n=M(t);if(!n)return;for(let r of n){let i=ue(e,r);if(i)e.reactive_vars.add(i)}}function me(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 Ae(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let t=String(e.type);return t==="FunctionDeclaration"||t==="FunctionExpression"||t==="ArrowFunctionExpression"}function kt(e,t){let n=e.scopeDeclarations.get(t);if(!n)n=new Map,e.scopeDeclarations.set(t,n);return n}function Lt(e,t,n){let r=[];if(n.id.type==="Identifier")return r.push({kind:"local",name:n.id.name}),r;if(n.id.type!=="ObjectPattern")return r;for(let i of n.id.properties){if(i.type==="RestElement"){if(i.argument.type==="Identifier")r.push({kind:"local",name:i.argument.name});continue}if(i.computed)continue;let p=e.getPropertyName(i.key);if(!p)continue;let s;if(i.value.type==="Identifier")s=i.value.name;else if(i.value.type==="AssignmentPattern"&&i.value.left.type==="Identifier")s=i.value.left.name;if(!s)continue;r.push({kind:"prop",name:s,publicPropName:p})}return r}function Pe(e,t,n,r,i){if(!Re(t))return;let p=i?.allowRunesProps??!1,s=i?.forceProp??!1,c=t;for(let d of c.declarations){if(p&&B(J(d.init),"$props")){for(let x of Lt(e,c,d))k(x.kind==="prop"?n:r,x.name,x.kind==="prop"?{kind:"prop",publicPropName:x.publicPropName}:{kind:"local"});continue}let f=c.kind==="var"?r:n,y=s?"prop":"local";for(let x of M(d.id))k(f,x,y==="prop"?{kind:"prop",publicPropName:x}:{kind:"local"})}}function wt(e,t){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")k(t,e.id.name,{kind:"local"});for(let n of e.params)for(let r of M(n))k(t,r,{kind:"local"})}function Nt(e,t,n,r){if(!Array.isArray(t))return;for(let i of t){if(!i||typeof i!=="object"||!("type"in i))continue;switch(i.type){case"VariableDeclaration":Pe(e,i,n,r);break;case"FunctionDeclaration":if(i.id?.name)k(n,i.id.name,{kind:"local"});break;case"ClassDeclaration":if(i.id?.name)k(n,i.id.name,{kind:"local"});break}}}function Rt(e,t,n){if(!n||typeof n!=="object")return;let r="content"in n&&n.content&&typeof n.content==="object"&&"body"in n.content&&Array.isArray(n.content.body)?n.content:("body"in n)&&Array.isArray(n.body)?n:void 0;if(!r||!("body"in r)||!Array.isArray(r.body))return;for(let i of r.body){if(!i||typeof i!=="object"||!("type"in i))continue;switch(i.type){case"ImportDeclaration":for(let p of i.specifiers??[])if(p.local?.name)k(t.componentScope,p.local.name,{kind:"local"});break;case"VariableDeclaration":Pe(e,i,t.componentScope,t.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(i.id?.name)k(t.componentScope,i.id.name,{kind:"local"});break;case"ClassDeclaration":if(i.id?.name)k(t.componentScope,i.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!i.declaration||typeof i.declaration!=="object"||!("type"in i.declaration))break;if(i.declaration.type==="VariableDeclaration")Pe(e,i.declaration,t.componentScope,t.componentScope,{forceProp:!0});else if(i.declaration.type==="FunctionDeclaration"&&i.declaration.id?.name)k(t.componentScope,i.declaration.id.name,{kind:"prop",publicPropName:i.declaration.id.name});break}}}function Ie(e,t){t.componentScope.clear(),t.scopeDeclarations=new WeakMap,t.activeScopes.length=0,Rt(e,t,t.parsed?.instance)}function He(e){return{varScopeStack:[e.componentScope]}}function je(e,t,n,r){if(!me(r))return;let i=kt(t,r),p=n.varScopeStack[n.varScopeStack.length-1]??t.componentScope;switch(String(r.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":wt(r,i);break;case"BlockStatement":Nt(e,r.body,i,p);break;case"CatchClause":if("param"in r)for(let c of M(r.param))k(i,c,{kind:"local"});break;case"EachBlock":{let c=r;for(let d of M(c.context))k(i,d,{kind:"local"});if(typeof c.index==="string")k(i,c.index,{kind:"local"});else if(c.index&&"name"in c.index)k(i,c.index.name,{kind:"local"});break}case"AwaitBlock":{let c=r;for(let d of M(c.value))k(i,d,{kind:"local"});for(let d of M(c.error))k(i,d,{kind:"local"});break}}if(Ae(r))n.varScopeStack.push(i)}function Fe(e,t){if(Ae(t))e.varScopeStack.pop()}var At=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function It(e,t){switch(t?.type){case"MemberExpression":return t.computed||e===t.object;case"MethodDefinition":return!!t.computed;case"MetaProperty":return e===t.meta;case"PropertyDefinition":return t.computed||e===t.value;case"Property":return t.computed||e===t.value;case"ExportSpecifier":case"ImportSpecifier":return e===t.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function Ht(e,t){for(let n=t.length-1;n>=0;n-=1)if(t[n]?.has(e))return!0;return!1}function jt(e){let t=new Set;if(!e||typeof e!=="object"||!("type"in e))return t;switch(String(e.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let n=e;if(n.id?.name)t.add(n.id.name);for(let r of n.params??[])M(r,t);break}case"BlockStatement":fe(e.body,t);break;case"CatchClause":M(e.param,t);break;case"EachBlock":{let n=e;if(M(n.context,t),typeof n.index==="string")t.add(n.index);else if(n.index?.name)t.add(n.index.name);break}case"AwaitBlock":{let n=e;M(n.value,t),M(n.error,t);break}}return t}function fe(e,t){if(!Array.isArray(e))return;for(let n of e){if(!n||typeof n!=="object"||!("type"in n))continue;switch(String(n.type)){case"ImportDeclaration":for(let r of n.specifiers??[])if(r.local?.name)t.add(r.local.name);break;case"VariableDeclaration":for(let r of n.declarations??[])M(r.id,t);break;case"FunctionDeclaration":case"ClassDeclaration":{let r=n.id?.name;if(r)t.add(r);break}case"ExportNamedDeclaration":{let r=n.declaration;if(r&&typeof r==="object"&&"type"in r)fe([r],t);break}}}}function Me(e,t){if(!e||typeof e!=="object")return!1;let n=[...t],r=!1;return _(e,{enter(i,p){if(r){this.skip();return}if(me(i))n.push(jt(i));if(p&&i.type==="Identifier"&&At.has(i.name)&&!p.type.startsWith("TS")&&It(i,p)&&!Ht(i.name,n))r=!0,this.skip()},leave(i){if(me(i))n.pop()}}),r}function _e(e){if(!e||typeof e!=="object")return;if("content"in e){let t=e.content,n=t&&typeof t==="object"&&"body"in t?t.body:void 0;if(Array.isArray(n))return n}if("body"in e&&Array.isArray(e.body))return e.body;return}function Be(e){if(e.runesOptionOverride!==void 0)return e.runesOptionOverride?"runes":"legacy";let t=e.parsed;if(!t)return"legacy";let n=new Set;fe(_e(t.module),n);let r=new Set;return fe(_e(t.instance),r),Me(t.module,[n])||Me(t.instance,[n,r])||Me(t.fragment,[n,r])?"runes":"legacy"}var Ft=/[A-Za-z_$][\w$]*/g;function _t(e,t,n){let r=new Map,i=t.typeParameters?.params,p=n.typeArguments?.params;if(!i?.length||!p?.length)return r;for(let s=0;s<i.length;s++){let c=i[s]?.name,d=p[s];if(!c||d?.start===void 0||d?.end===void 0)continue;let f=z(e,d.start,d.end)?.trim();if(f)r.set(c,f)}return r}function Bt(e,t){if(t.size===0)return e;return e.replace(Ft,(n)=>t.get(n)??n)}function oe(e,t,n,r,i=new Set){let p=new Map;if(!n?.type)return p;let s=(c)=>{for(let d of c){if(d?.type!=="TSPropertySignature"||d.computed)continue;if(!d.key)continue;let f=e.getPropertyName(d.key);if(!f)continue;let y=d.typeAnnotation?.start,x=d.typeAnnotation?.end;if(y===void 0||x===void 0)continue;let P=z(t,y+1,x)?.trim();if(!P)continue;p.set(f,{type:P,optional:d.optional===!0,source:N(t,d)})}};switch(n.type){case"TSTypeLiteral":s(n.members??[]);break;case"TSInterfaceDeclaration":s(n.body?.body??[]);break;case"TSTypeAliasDeclaration":{let c=oe(e,t,n.typeAnnotation,r,i);for(let[d,f]of c)p.set(d,f);break}case"TSTypeReference":{let c=Ke(n.typeName);if(!c||i.has(c))break;let d=r.get(c);if(!d)break;i.add(c);let f=oe(e,t,d,r,i);i.delete(c);let y=_t(t,d,n);for(let[x,P]of f)p.set(x,y.size===0?P:{...P,type:Bt(P.type,y)});break}case"TSIntersectionType":for(let c of n.types??[]){let d=oe(e,t,c,r,i);for(let[f,y]of d)p.set(f,y)}break;case"TSParenthesizedType":{let c=oe(e,t,n.typeAnnotation,r,i);for(let[d,f]of c)p.set(d,f);break}}return p}function Ye(e,t,n){if(t.runesPropsDeclarationMetadataByDeclaratorStart.clear(),t.explicitPropTypesByName.clear(),t.explicitVariableTypesByName.clear(),t.typeImportBindingsByLocalName.clear(),t.localTypeDeclarationsByName.clear(),t.typedRunesPropsDeclarations.length=0,!t.source)return;let r=n;t.scriptLanguage=e.resolveScriptLanguage(r),t.customElementTag=r.options?.customElement?.tag,t.runesOptionOverride=r.options?.runes,t.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(r);let i=r.instance?.content?.body??[];for(let p of i){if(!p?.type)continue;if(p.type==="ImportDeclaration"&&p.source?.value)for(let s of p.specifiers??[]){let c=s.local?.name;if(!c)continue;if(!(p.importKind==="type"||s.importKind==="type"))continue;let f,y;if(s.type==="ImportSpecifier")f="named",y=s.imported?.type==="Identifier"?s.imported.name:typeof s.imported?.value==="string"?s.imported.value:void 0;else if(s.type==="ImportDefaultSpecifier")f="default";else if(s.type==="ImportNamespaceSpecifier")f="namespace";if(!f)continue;t.typeImportBindingsByLocalName.set(c,{importedName:y,localName:c,source:String(p.source.value),specifierType:f})}if((p.type==="TSInterfaceDeclaration"||p.type==="TSTypeAliasDeclaration")&&p.id?.name&&p.start!==void 0&&p.end!==void 0)t.localTypeDeclarationsByName.set(p.id.name,{code:z(t,p.start,p.end)?.trim()??"",node:p,start:p.start});if(p.type==="ExportNamedDeclaration"&&p.declaration?.type==="VariableDeclaration")for(let s of p.declaration.declarations??[]){if(s.id?.type!=="Identifier"||!s.id.name)continue;let c=ye(t,s.id.typeAnnotation);if(c)t.explicitPropTypesByName.set(s.id.name,c)}else if(p.type==="VariableDeclaration")for(let s of p.declarations??[]){if(s.id?.type!=="Identifier"||!s.id.name)continue;let c=ye(t,s.id.typeAnnotation);if(c)t.explicitVariableTypesByName.set(s.id.name,c)}}for(let p of i){if(!p||typeof p!=="object"||!("declarations"in p))continue;for(let s of p.declarations??[]){if(!B(J(s.init),"$props"))continue;let c=s.id?.typeAnnotation?void 0:Ve(s.init),d=s.id?.typeAnnotation?.typeAnnotation??c,f=s.id?.typeAnnotation?ye(t,s.id.typeAnnotation):Je(t,c),y=oe(e,t,d,new Map(Array.from(t.localTypeDeclarationsByName.entries(),([I,R])=>[I,R.node]))),x=new Set,P=new Set;if(ze(t,d,x,P),We(t,x,P),s.start!==void 0){let I={canonicalType:f,props:y,referencedImportedTypes:x,referencedLocalTypes:P};if(t.runesPropsDeclarationMetadataByDeclaratorStart.set(s.start,I),f)t.typedRunesPropsDeclarations.push(I)}}}}function qe(e,t,n){for(let r of n.declarations){if(!B(J(r.init),"$props"))continue;if(r.id.type==="Identifier"){t.wholePropsLocals.add(r.id.name),t.restPropLocals.add(r.id.name);let s=$e(t,r.start);if(s)for(let[c,d]of s.props)ie(e,t,c,{name:c,kind:"let",type:d.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!d.optional,constant:!1,reactive:!1,source:d.source});continue}if(r.id.type!=="ObjectPattern")continue;let i=W(t,e,n),p=r.id.properties.filter((s)=>{if(s.type!=="Property"||s.computed)return!1;if(!e.getPropertyName(s.key))return!1;if(s.value.type==="Identifier")return!0;return s.value.type==="AssignmentPattern"&&s.value.left.type==="Identifier"}).length;for(let s of r.id.properties){if(s.type==="RestElement"){if(s.argument.type==="Identifier")t.restPropLocals.add(s.argument.name);continue}let c=e.getPropertyName(s.key);if(!c)continue;let d,f;if(s.value.type==="Identifier")d=s.value.name;else{let T=s.value;d=T.left.name,f=T.right}if(!d)continue;if(e.trackPropLocalName(c,d),c==="children")t.snippetPropLocals.add(d);let y=Xe(t,e,s)??(p===1?i:void 0),x=Ge(t,r.start,c),{init:P,bindable:I}=Oe(f),R=P==null?{isFunction:!1}:ae(e,t,P),{value:se,type:Q,isFunction:xe,defaultValue:he}=R,Se=x?.type===void 0&&y?.type===void 0?R.resolvedType:void 0;if(R.pendingCallDefault)t.pendingCallDefaultCandidates.push({propName:c,location:"props",...R.pendingCallDefault});let{type:ce,typeSource:pe,description:le,params:o,returnType:a,isFunction:m}=re({explicitType:x?.type,typeSeed:Q,inferredTypeForSource:Q,jsdocType:y?.type,jsdocDescription:y?.description,jsdocParams:y?.params,jsdocReturnType:y?.returnType,resolvedType:Se,resolvedDescription:R.resolvedDescription,resolvedParams:R.resolvedParams,resolvedReturnType:R.resolvedReturnType,initializerIsFunction:xe,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(I)t.reactive_vars.add(c);ie(e,t,c,{name:c,...d===c?{}:{localName:d},kind:"let",description:le,binding:y?.binding,deprecated:y?.deprecated,tags:y?.tags,...I?{bindable:!0}:{},type:ce,typeSource:pe,value:se,defaultValue:he,params:o,returnType:a,isFunction:m,isFunctionDeclaration:!1,isRequired:P==null&&x?.optional!==!0,constant:!1,reactive:I,source:N(t,s)})}}}function Ue(e,t){if(e.syntaxMode!=="runes")return;for(let[n,r]of Array.from(e.events.entries())){if(r.type!=="dispatched")continue;if(t.has(n)||e.forwardedEvents.has(n))continue;let i=`on${n}`,p=e.props.get(i);if(!p)continue;let s=p.type!==void 0||p.params!==void 0||p.returnType!==void 0,c=r.detail===void 0||r.detail==="undefined"||r.detail==="null"?"() => void":`(detail: ${r.detail}) => void`;e.props.set(i,{...p,description:p.description??r.description,type:s?p.type:c,typeSource:s?p.typeSource:"inferred",isFunction:!0}),e.events.delete(n)}}var Qe=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function ge(e){if(!e||typeof e!=="object")return;_(e,{enter(t){if(!Qe.has(t.type))return;let n=t.expression;while(n&&Qe.has(n.type))n=n.expression;if(n)this.replace(n)}})}function Te(e,t){let n=t.source?.value;if(typeof n!=="string"||t.importKind==="type")return;for(let r of t.specifiers??[]){if(r.type!=="ImportSpecifier"||r.importKind==="type")continue;let i=r.local?.name;if(!i)continue;let p=r.imported?.name??(typeof r.imported?.value==="string"?r.imported.value:i);e.valueImportBindingsByLocalName.set(i,{localName:i,importedName:p,source:n})}}function De(e,t){if(!t)return;_(t,{enter(n){if(n.type==="ImportDeclaration")Te(e,n);if(n.type==="FunctionDeclaration"){let r=n;if(r.id?.name)e.funcDecls.set(r.id.name,r)}}})}function rt(e,t,n){let r=t+1;while(r<e.length){if(e[r]==="\\"){r+=2;continue}if(e[r]===n)return r+1;r++}return r}function ot(e,t){let n=t+1,r=0;while(n<e.length){let i=e[n];if(i==="\\"){n+=2;continue}if(r===0){if(i==="`")return n+1;if(i==="$"&&e[n+1]==="{"){r=1,n+=2;continue}n++;continue}if(i==="{")r++;else if(i==="}")r--;else if(i==='"'||i==="'"){n=rt(e,n,i);continue}else if(i==="`"){n=ot(e,n);continue}n++}return n}function Vt(e,t){let n=[],r=e.length,i=0;while(i<r){let p=e[i];if(p==='"'||p==="'"){i=rt(e,i,p);continue}if(p==="`"){i=ot(e,i);continue}if(p==="/"&&e[i+1]==="/"){let s=i+2;while(s<r&&e[s]!==`
|
|
2
|
+
`)s++;i=s;continue}if(p==="/"&&e[i+1]==="*"){let s=i,c=i+2;while(c<r&&!(e[c]==="*"&&e[c+1]==="/"))c++;let d=Math.min(c+2,r),f=e.slice(s,d);n.push({end:d+t,isJsDoc:f.startsWith("/**")&&f.length>4,text:f}),i=d;continue}i++}return n}function Ze(e,t,n){if(!e||typeof e!=="object"||!("type"in e))return;let r=e;if(r.type==="FunctionDeclaration"){if(r.id?.type==="Identifier"&&r.id.name)n.push({name:r.id.name,start:t});return}if(r.type==="VariableDeclaration"){for(let i of r.declarations??[])if(i?.id?.type==="Identifier"&&i.id.name)n.push({name:i.id.name,start:t})}}function Ot(e){let t=[];for(let n of e){if(!n||typeof n!=="object"||!("type"in n))continue;let r=n;if(r.start===void 0)continue;if(r.type==="ExportNamedDeclaration"&&r.declaration)Ze(r.declaration,r.start,t);else Ze(r,r.start,t)}return t}function $t(e,t,n){let r;for(let i of e){if(i.end>t)break;if(!i.isJsDoc)continue;if(!tt.test(n.slice(i.end,t)))continue;r=i}return r}function it(e,t){let n=new Map;if(!e.source)return n;let r=[e.parsed?.module,e.parsed?.instance],i=[],p=[];for(let s of r){let c=s?.content;if(!c?.body||c.start===void 0||c.end===void 0)continue;i.push(...Vt(e.source.slice(c.start,c.end),c.start)),p.push(...Ot(c.body))}i.sort((s,c)=>s.end-c.end);for(let s of p){let c=$t(i,s.start,e.source);if(!c)continue;let d=et(c.text),{type:f,description:y}=nt(d);if(!f)continue;n.set(s.name,{type:t.aliasType(f.type),description:y||f.description})}return n}function at(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var Gt=null,st=/^@component/,Kt=/\r/g,Jt=/^\{\s*\}$/;class L{ctx=Ee();static mapToArray(e){return Array.from(e,([t,n])=>n)}static getStaticAttributeValue(e){if(!Array.isArray(e.value))return;return e.value.map((t)=>t.data??t.raw??"").join("").trim()}resolveScriptLanguage(e){let t=[e.instance,e.module].filter((r)=>r!==void 0),n=!1;for(let r of t){let i=r.attributes?.find((s)=>s.name==="lang");if(!i){n=!0;continue}if(L.getStaticAttributeValue(i)?.toLowerCase()==="ts")return"ts"}return n?"js":void 0}resolveScriptGenericsAttribute(e){let t=e.instance?.attributes?.find((s)=>s.name==="generics");if(!t)return;let n=N(this.ctx,t),r=e.instance?.attributes?.find((s)=>s.name==="lang");if((r?L.getStaticAttributeValue(r)?.toLowerCase():void 0)!=="ts"){U(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',n);return}let p=L.getStaticAttributeValue(t);if(!p)return;return{value:p,source:n}}resolvePublicPropName(e){return this.ctx.propLocalToPublicName.get(e)??e}trackPropLocalName(e,t=e){this.ctx.propLocalToPublicName.set(t,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(be(e))return e.name;if(ct(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 t=e,n=t.object&&"name"in t.object?t.object.name:void 0,r=t.property&&"name"in t.property?t.property.name:void 0;if(!n||!r)return!1;if(n==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(r);if(n==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(r);return!1}resolveLocalVarJSDoc(e){for(let n of this.ctx.vars)if(n.declarations.some((i)=>i.id&&typeof i.id==="object"&&("type"in i.id)&&i.id.type==="Identifier"&&("name"in i.id)&&i.id.name===e))return W(this.ctx,this,n);let t=this.ctx.funcDecls.get(e);if(t)return W(this.ctx,this,t);return}addModuleExport(e,t){if(ut(e)===void 0)return;if(this.ctx.moduleExports.has(e)){let n=this.ctx.moduleExports.get(e);this.ctx.moduleExports.set(e,{...n,...t})}else this.ctx.moduleExports.set(e,t)}aliasType(e){if(e==="*")return"any";return e.trim()}findVariableTypeAndDescription(e){let t=this.getPropByLocalOrPublic(e);if(t?.type)return{type:t.type,description:t.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=it(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let n=this.ctx.variableInfoCache.get(e),r=this.ctx.explicitVariableTypesByName.get(e);if(r)return{type:r,description:n?.description};return n??null}accumulateGeneric(e,t){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${e}`,`${this.ctx.generics[1]}, ${t}`];else this.ctx.generics=[e,t]}cleanup(){this.ctx=Ee()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(e){return L.SCRIPT_BLOCK_REGEX.lastIndex=0,e.replace(L.SCRIPT_BLOCK_REGEX,(t,n,r,i)=>{L.TS_DIRECTIVE_REGEX.lastIndex=0;let p=r.replace(L.TS_DIRECTIVE_REGEX,"");return n+p+i})}parseSvelteComponent(e,t){this.cleanup(),this.ctx.componentFilePath=t.filePath;let n=L.stripTypeScriptDirectivesFromScripts(e);this.ctx.source=n;let r=Et(n);if(Ye(this,this.ctx,r),this.ctx.parsed=r,this.ctx.scriptLanguage==="ts")ge(this.ctx.parsed.module),ge(this.ctx.parsed.instance),ge(this.ctx.parsed.fragment);this.ctx.syntaxMode=Be(this.ctx);let i=this.ctx.parsed.css,p=i?.start!==void 0&&i?.end!==void 0?n.slice(0,i.start)+" ".repeat(i.end-i.start)+n.slice(i.end):n;St(this.ctx,this,p);let s={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(De(this.ctx,this.ctx.parsed?.module),De(this.ctx,this.ctx.parsed?.instance),this.ctx.parsed?.module)_(this.ctx.parsed?.module,{enter:(o)=>{if(o.type==="ImportDeclaration")Te(this.ctx,o);if(o.type==="FunctionDeclaration"){let a=o;if(a.id?.name)this.ctx.funcDecls.set(a.id.name,a)}if(o.type==="VariableDeclaration")this.ctx.vars.add(o);if(o.type==="ExportNamedDeclaration"){if(o.declaration==null)return;if(!o.declaration||typeof o.declaration!=="object"||!("type"in o.declaration))return;let a,m,T=!1,l,u,b,S=!1,v,E,h;if(o.declaration.type==="FunctionDeclaration"){let H=o.declaration;if(!H.id?.name)return;a=H.id.name,m="function",l=void 0,u="() => any",S=!0,T=!0}else if(o.declaration.type==="VariableDeclaration"){let H=o.declaration,j=H.declarations[0];if(!j||typeof j!=="object"||!("id"in j))return;let{id:Y,init:de}=j;if(!Y||typeof Y!=="object"||!("name"in Y))return;let Z=Y.name;a=Z,m=at(H.kind);let C=de==null?{isFunction:!1}:ae(this,this.ctx,de);if({value:l,type:u,isFunction:S,defaultValue:v}=C,E=u,h=C,b=this.getExplicitPropType(Z),h.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:Z,location:"moduleExports",...h.pendingCallDefault})}else return;let D=W(this.ctx,this,o),{type:w,typeSource:V,description:O,params:g,returnType:A,isFunction:X}=re({explicitType:b,typeSeed:u,inferredTypeForSource:E,jsdocType:D?.type,jsdocDescription:D?.description,jsdocParams:D?.params,jsdocReturnType:D?.returnType,resolvedType:h?.resolvedType,resolvedDescription:h?.resolvedDescription,resolvedParams:h?.resolvedParams,resolvedReturnType:h?.resolvedReturnType,initializerIsFunction:S,isFunctionDeclaration:T,typedefs:this.ctx.typedefs});this.addModuleExport(a,{name:a,kind:m,description:O,deprecated:D?.deprecated,tags:D?.tags,type:w,typeSource:V,value:l,defaultValue:v,params:g,returnType:A,isFunction:X,isFunctionDeclaration:T,isRequired:!1,constant:m==="const",reactive:!1,source:N(this.ctx,o)})}}});let c,d=new Set,f=new Set,y=[];Ie(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let x=He(this.ctx);if(_(s,{enter:(o,a,m)=>{je(this,this.ctx,x,o);let T=this.ctx.scopeDeclarations.get(o);if(T)this.ctx.activeScopes.push(T);if(o.type==="AssignmentExpression")ve(this.ctx,o.left);if(o.type==="UpdateExpression")ve(this.ctx,o.argument);if(o.type==="CallExpression"){let l=o,u=l.callee&&typeof l.callee==="object"&&"name"in l.callee?l.callee.name:void 0;if(u==="createEventDispatcher"){if(a&&typeof a==="object"&&"id"in a&&a.id&&typeof a.id==="object"&&"name"in a.id)c=a.id.name}if(u==="$host"){if(a&&typeof a==="object"&&"id"in a&&a.id&&typeof a.id==="object"&&"name"in a.id)d.add(a.id.name)}if(u==="setContext")mt(this.ctx,this,o,a??void 0);if(u)y.push({name:u,arguments:l.arguments,source:N(this.ctx,l)});if(pt(l.callee)&&be(l.callee.property)&&l.callee.property.name==="dispatchEvent"&&(B(l.callee.object,"$host")||be(l.callee.object)&&d.has(l.callee.object.name))){let b=gt(this.ctx,l);if(b)f.add(b)}}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="SpreadAttribute"){let l=o;if(l.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(l.expression?.name??""))Ne(this.ctx,a)}if(o.type==="FunctionDeclaration"){let l=o;if(l.id?.name)this.ctx.funcDecls.set(l.id.name,l)}if(o.type==="ImportDeclaration")Te(this.ctx,o);if(o.type==="VariableDeclaration"){if(this.ctx.vars.add(o),a&&typeof a==="object"&&"type"in a&&a.type==="Program"&&o.declarations.some((l)=>B(J(l.init),"$props")))qe(this,this.ctx,o)}if(o.type==="ExportNamedDeclaration"){if(o.declaration==null&&o.specifiers.length===0)return;let l;if(o.declaration==null&&o.specifiers[0]?.type==="ExportSpecifier"){let C=o.specifiers[0],G=C.local&&typeof C.local==="object"&&"name"in C.local?C.local.name:void 0,K=C.exported&&typeof C.exported==="object"&&"name"in C.exported?C.exported.name:void 0;if(!G||!K)return;let q;for(let ee of Array.from(this.ctx.vars))if(ee.declarations.some((F)=>F.id&&typeof F.id==="object"&&("type"in F.id)&&F.id.type==="Identifier"&&F.id.name===G)){q=ee;break}o.declaration=q,l=K}if(o.declaration==null)return;if(!o.declaration||typeof o.declaration!=="object"||!("type"in o.declaration))return;let u,b=!1,S,v,E,h=!1,D=!1,w,V,O,g;if(o.declaration.type==="FunctionDeclaration"){let C=o.declaration;if(!C.id?.name)return;l??=C.id.name,w=C.id.name,u="function",S=void 0,v="() => any",h=!0,b=!0,D=!1}else if(o.declaration.type==="VariableDeclaration"){let C=o.declaration,G=C.declarations[0];if(!G||typeof G!=="object"||!("id"in G))return;let{id:K,init:q}=G;if(K&&typeof K==="object"&&"name"in K){let F=K.name;w=F,l??=F,E=this.getExplicitPropType(F)}else return;u=at(C.kind),D=u==="let"&&q==null;let ee=q==null?{isFunction:!1}:ae(this,this.ctx,q);if({value:S,type:v,isFunction:h,defaultValue:V}=ee,O=v,g=ee,g.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:l,location:"props",...g.pendingCallDefault})}else return;let A=W(this.ctx,this,o),{type:X,typeSource:H,description:j,params:Y,returnType:de,isFunction:Z}=re({explicitType:E,typeSeed:v,inferredTypeForSource:O,jsdocType:A?.type,jsdocDescription:A?.description,jsdocParams:A?.params,jsdocReturnType:A?.returnType,resolvedType:g?.resolvedType,resolvedDescription:g?.resolvedDescription,resolvedParams:g?.resolvedParams,resolvedReturnType:g?.resolvedReturnType,initializerIsFunction:h,isFunctionDeclaration:b,typedefs:this.ctx.typedefs});ie(this,this.ctx,l,{name:l,...w!==void 0&&w!==l?{localName:w}:{},kind:u,description:j,binding:A?.binding,deprecated:A?.deprecated,tags:A?.tags,type:X,typeSource:H,value:S,defaultValue:V,params:Y,returnType:de,isFunction:Z,isFunctionDeclaration:b,isRequired:D,constant:u==="const",reactive:this.ctx.reactive_vars.has(l),source:N(this.ctx,o)})}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="Comment"){let u=o?.data?.trim()??"";if(st.test(u))this.ctx.componentComment=u.replace(st,"").replace(Kt,""),this.ctx.componentCommentSource=N(this.ctx,o)}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="SlotElement"){let l=o,u=l.attributes?.find((E)=>E.name==="name")?.value,b=(Array.isArray(u)?u[0]:void 0)?.data,S=(l.attributes||[]).filter((E)=>E.name!=="name").reduce((E,h)=>{let D={value:void 0,replace:!1},w=h.value;if(w===void 0||w===!0)return E;let V=Array.isArray(w)?w[0]:w;if(V){let{type:O,expression:g,raw:A,start:X,end:H}=V;if(O==="Text"&&A!==void 0)D.value=JSON.stringify(A);else if(!Array.isArray(w)&&O==="ExpressionTag"&&g&&typeof g==="object"&&"type"in g&&g.type==="Identifier"&&"name"in g&&g.name===h.name)D.value=g.name,D.replace=!0;if(g&&typeof g==="object"&&"type"in g){if(g.type==="Literal"&&"value"in g){let j=g.value;D.value=typeof j==="string"?JSON.stringify(j):String(j)}else if(g.type==="MemberExpression")D.value=lt(this.ctx,this,g);else if(g.type!=="Identifier"){if(X!==void 0&&H!==void 0){if(g.type==="ObjectExpression"||g.type==="TemplateLiteral")D.value=z(this.ctx,X+1,H-1)}}}}if(h.name)E[h.name]=D;return E},{}),v=l.fragment?.nodes?.map(({start:E,end:h})=>{if(E===void 0||h===void 0)return"";return z(this.ctx,E,h)??""}).join("").trim();Ce(this.ctx,{slot_name:b,slot_props:S,slot_fallback:v,source:N(this.ctx,o)})}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="RenderTag"){let l=o,u=ht(this.ctx,l.expression);if(u){let b;if(u.arguments.length===0)b={};else if(u.arguments.length===1&&typeof u.arguments[0]==="object"&&u.arguments[0]&&"type"in u.arguments[0]&&u.arguments[0].type==="ObjectExpression")b=xt(this.ctx,this,u.arguments[0]);else if(u.arguments.length===1)U(this.ctx,"syntax-skipped",u.publicName,`{@render ${u.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,N(this.ctx,o));let S=u.publicName==="children"?void 0:u.publicName,v=S===void 0?Gt:S;if(b!==void 0)Ce(this.ctx,{slot_name:S,slot_props:b,source:N(this.ctx,o)});if(b!==void 0||this.ctx.slots.has(v))this.ctx.snippetPropLocals.add(u.trackingName)}}if(o&&typeof o==="object"&&"type"in o&&String(o.type)==="OnDirective"){let l=o;if(l.expression==null&&l.name){if(a!=null&&typeof a==="object"&&"name"in a){let u=typeof a.name==="string"?a.name:void 0,b="type"in a?String(a.type):void 0;if(u&&b){let S=te(b)?{type:"InlineComponent",name:u}:{type:"Element",name:u};this.ctx.forwardedEvents.set(l.name,S);let v=this.ctx.events.get(l.name),E=this.ctx.eventDescriptions.get(l.name),h=v?.deprecated;if(!v)this.ctx.events.set(l.name,{type:"forwarded",name:l.name,element:S,description:E,deprecated:h,source:N(this.ctx,o)});else if(v.type==="forwarded"&&E&&!v.description)this.ctx.events.set(l.name,{...v,description:E,deprecated:v.deprecated??h,source:v.source||N(this.ctx,o)})}}}}if(a&&typeof a==="object"&&"type"in a&&(ne(String(a.type))||te(String(a.type)))&&o&&typeof o==="object"&&"type"in o&&String(o.type)==="BindDirective"){let l=o;if(l.expression?.name){let u=ue(this.ctx,l.expression.name);if(u)this.ctx.reactive_vars.add(u)}if(ne(String(a.type))&&l.name==="this"&&l.expression?.name&&"name"in a&&typeof a.name==="string"){let u=ue(this.ctx,l.expression.name);if(!u)return;let b=a.name;if(this.ctx.bindings.has(u)){let S=this.ctx.bindings.get(u);if(S&&!S.elements.includes(b))this.ctx.bindings.set(u,{...S,elements:[...S.elements,b]})}else this.ctx.bindings.set(u,{elements:[b]})}}},leave:(o)=>{if(this.ctx.scopeDeclarations.has(o))this.ctx.activeScopes.pop();Fe(x,o)}}),c!==void 0){for(let o of y)if(o.name===c){let a=o.arguments[0],m=a&&typeof a==="object"&&"value"in a?a.value:void 0,T=o.arguments[1],l=T&&typeof T==="object"&&"value"in T?T.value:void 0;if(m!=null)yt(this.ctx,{name:String(m),detail:l==null?"":ft(l),has_argument:Boolean(T),source:o.source})}}let P=new Set(f);if(c!==void 0){for(let o of y)if(o.name===c){let a=o.arguments[0],m=a&&typeof a==="object"&&"value"in a?a.value:void 0;if(m!=null)P.add(String(m))}}this.ctx.forwardedEvents.forEach((o,a)=>{let m=this.ctx.events.get(a);if(m&&m.type==="dispatched"&&!P.has(a)){let T=this.ctx.eventDescriptions.get(a),l={type:"forwarded",name:a,element:o,description:T,deprecated:m.deprecated,tags:m.tags,source:m.source};if(m.detail!==void 0&&m.detail!=="undefined")l.detail=m.detail;this.ctx.events.set(a,l)}}),Ue(this.ctx,P);let I=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(o)=>this.resolvePublicPropName(o))):new Set,R=L.mapToArray(this.ctx.props).filter((o)=>!I.has(o.name)).map((o)=>{if(this.ctx.bindings.has(o.name)){let a=this.ctx.bindings.get(o.name)?.elements.sort().map((m)=>we(m)).join(" | ");return{...o,type:`null | ${a}`,typeSource:"inferred",reactive:o.reactive||this.ctx.reactive_vars.has(o.name)}}return{...o,reactive:o.reactive||this.ctx.reactive_vars.has(o.name)}});this.ctx.activeScopes.length=0;let se=L.mapToArray(this.ctx.slots).map((o)=>{if(!o.slot_props)return o;if(typeof o.slot_props==="string")return Jt.test(o.slot_props)?{...o,slot_props:"Record<string, never>"}:o;let a=o.slot_props,m=[];for(let l of Object.keys(a)){if(a[l].replace&&a[l].value!==void 0)a[l].value=this.getPropTypeByLocalOrPublic(a[l].value);if(a[l].value===void 0)a[l].value="any";m.push(`${l}: ${a[l].value}`)}let T=m.length===0?"Record<string, never>":m.length===1?`{ ${m[0]} }`:`{
|
|
3
|
+
${m.join(`;
|
|
4
|
+
`)};
|
|
5
|
+
}`;return{...o,slot_props:T}}).sort((o,a)=>{let m=o.name??"",T=a.name??"";if(m<T)return-1;if(m>T)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let o=[...R.map((a)=>a.type??""),...se.map((a)=>a.slot_props??"")].join(`
|
|
6
|
+
`);for(let{name:a,constraint:m}of this.ctx.deferredSlotBlockGenerics){let T=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${T}\\b`).test(o))continue;this.accumulateGeneric(a,m)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)U(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=bt(this.ctx.scriptGenericsAttribute.value)}let Q=L.mapToArray(this.ctx.moduleExports),xe=L.mapToArray(this.ctx.events).map((o)=>{switch(o.type){case"forwarded":return{...o,element:o.element.name};case"dispatched":return o;default:return o}}).sort((o,a)=>{let m=o.name.localeCompare(a.name);if(m!==0)return m;let T=o.type.localeCompare(a.type);if(T!==0)return T;if(o.type==="forwarded"&&a.type==="forwarded"){let l=o.element.localeCompare(a.element);if(l!==0)return l}return(o.detail??"").localeCompare(a.detail??"")}),he=L.mapToArray(this.ctx.typedefs),Se=L.mapToArray(this.ctx.contexts),ce={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((o)=>o.location==="props").map((o)=>[o.propName,o])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((o)=>o.location==="moduleExports").map((o)=>[o.propName,o]))};for(let o of R)if(o.typeSource==="unknown"){let a=ce.props.get(o.name);if(a)o.type="any";let m=a?a.importSource?`Prop "${o.name}" default calls "${a.calleeName}()" imported from "${a.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${o.name}" default calls "${a.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${o.name}" type could not be inferred; falling back to "${o.type??"any"}".`;U(this.ctx,"prop-unknown-type",o.name,m,o.source)}for(let o of Q)if(o.typeSource==="unknown"&&ce.moduleExports.has(o.name))o.type="any";for(let o of this.ctx.jsDocEventNames){if(P.has(o))continue;if(this.ctx.forwardedEvents.has(o))continue;if(this.ctx.props.has(`on${o}`))continue;U(this.ctx,"event-no-source",o,`@event "${o}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(o))}let pe={source:dt(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:R,moduleExports:Q,slots:se,events:xe,typedefs:he,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:Se,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},le=Tt(this.ctx);if(le)pe[ke]=le;return pe}}
|
|
7
|
+
export{L as t};
|