sveld 0.37.2 → 0.37.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +412 -5
- package/lib/browser.d.ts +121 -24
- package/lib/browser.js +163 -145
- package/lib/chunk-49hdrj4n.js +6 -0
- package/lib/chunk-7e36grhy.js +1 -0
- package/lib/{chunk-z1dy5a6k.js → chunk-nxa0q3f3.js} +9 -9
- package/lib/chunk-rftengvg.js +331 -0
- package/lib/chunk-w37f2cq2.js +1 -0
- package/lib/chunk-yzb9k33r.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 +20 -1
- package/lib/chunk-0mgphvte.js +0 -6
- package/lib/chunk-fc72j0vd.js +0 -1
- package/lib/chunk-fj7dbych.js +0 -1
- package/lib/chunk-szfpvrdq.js +0 -6
- package/lib/chunk-xt4vdey6.js +0 -301
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{T,A}from"./chunk-rftengvg.js";export{T as TemplateParseNotImplementedError,A as parse};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{e}from"./chunk-rftengvg.js";import{existsSync as N,readdirSync as O,readFileSync as D,statSync as j}from"node:fs";import{createRequire as M}from"node:module";import f from"node:path";var F="__sveld_resolved_props__",k="__SveldResolvedProps__",L=/ \| undefined$/,G=/[^A-Za-z0-9_-]/g,U=/[^A-Za-z0-9_$]/g,B=/^[0-9]/,q=2,I=7,E=`TypeScript ${I} or later, which provides \`typescript/unstable/async\``;function z(t){if(!t)return!1;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=I}async function X(t){let n;try{let i=M(f.join(t,"package.json")).resolve("typescript/package.json");n=JSON.parse(D(i,"utf8")).version}catch{return{installed:!1}}if(!z(n))return{installed:!0,version:n};try{let s=await import("./chunk-nxa0q3f3.js");return{installed:!0,version:n,module:s}}catch{return{installed:!0,version:n}}}class A{api;symbolFlags;typeFlags;tsconfigPath;cwd;overlay=new Map;pendingOverlayDeletions=new Set;constructor(t,n,s,i,o){this.api=t,this.symbolFlags=n,this.typeFlags=s,this.tsconfigPath=i,this.cwd=o}static async create(t=process.cwd(),{importTs:n=X}={}){let s=await n(t);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${E}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${E}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=Q(t);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${t}"`};let o=s.module,r=new A(null,o.SymbolFlags,o.TypeFlags,i,t),a=new o.API({cwd:t,fs:r.createFileSystem()});return r.api=a,{ok:!0,resolver:r}}async expandAll(t){let n=new Map;if(t.length===0)return n;let s=new Map;for(let o of t){if(!o.metadata.canonicalPropsType)continue;if(o.metadata.referencesComponentGenerics)continue;let r=this.virtualFileName(o.filePath,o.moduleName);this.overlay.set(r,V(o.metadata)),s.set(r,o)}if(s.size===0)return n;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:Array.from(s.keys())}});try{let[o]=s.keys(),r=await i.getDefaultProjectForFile(o);if(!r)return n;let a=r.checker,y=await Promise.all(Array.from(s,async([c,u])=>{let p=this.overlay.get(c);if(!p)return null;let d=Z(p),l=await a.getTypeAtPosition(c,d);if(!l)return null;let m=new Map,b=await a.getPropertiesOfType(l);for(let v of b){if(!v.name||v.name.startsWith("__"))continue;m.set(v.name,{name:v.name,symbols:[v],forceOptional:!1})}if((l.flags&this.typeFlags.Union)!==0){let v=await l.getTypes(),C=await Promise.all(v.map((R)=>a.getPropertiesOfType(R)));for(let R of C)for(let T of R){if(!T.name||T.name.startsWith("__")||m.has(T.name))continue;let w=m.get(T.name);if(w)w.symbols.push(T);else m.set(T.name,{name:T.name,symbols:[T],forceOptional:!0})}}return{filePath:u.filePath,groups:Array.from(m.values())}})),g=[],P=[];y.forEach((c,u)=>{if(!c)return;c.groups.forEach((p,d)=>{for(let l of p.symbols)g.push(l),P.push({fileIndex:u,groupIndex:d})})});let S=g.length>0?await a.getTypeOfSymbol(g):[],x=await Promise.all(S.map((c)=>c?a.typeToString(c):Promise.resolve("any"))),h=new Map;g.forEach((c,u)=>{let{fileIndex:p,groupIndex:d}=P[u],l=(c.flags&this.symbolFlags.Optional)!==0,m=x[u];if(l)m=m.replace(L,"");let b=h.get(p)??new Map,_=b.get(d)??[];_.push(m),b.set(d,_),h.set(p,b)}),y.forEach((c,u)=>{if(!c)return;let p=h.get(u),d=c.groups.map((l,m)=>{let b=p?.get(m)??[],_=!(l.forceOptional||l.symbols.some((v)=>(v.flags&this.symbolFlags.Optional)!==0));return{name:l.name,type:Array.from(new Set(b)).join(" | "),isRequired:_}});d.sort((l,m)=>l.name.localeCompare(m.name)),n.set(c.filePath,d)})}finally{await i.dispose?.()}return n}async checkExamples(t){let n=new Map;if(t.length===0)return n;let s=[];for(let o of t)for(let r of o.sources){let a=this.exampleFileName(o.filePath,o.moduleName,r.id);this.overlay.set(a,H(r)),s.push({filePath:o.filePath,source:r,file:a})}if(s.length===0)return n;let i=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((o)=>o.file)}});try{let[o]=s,r=await i.getDefaultProjectForFile(o.file);if(!r)return n;await Promise.all(s.map(async({filePath:a,source:y,file:g})=>{let[P,S]=await Promise.all([r.program.getSyntacticDiagnostics(g),r.program.getSemanticDiagnostics(g)]),x=[...P,...S];if(x.length===0)return;let h=this.overlay.get(g)??"",c=x.map((p)=>J(p,h)).sort((p,d)=>p.line-d.line).map((p)=>`Line ${p.line}: ${p.text}`).join(`
|
|
2
|
+
`),u=n.get(a)??[];u.push({id:y.id,name:y.name,message:c}),n.set(a,u)}))}finally{await i.dispose?.()}return n}forgetOverlayFiles(t){for(let n of t)if(this.overlay.delete(n))this.pendingOverlayDeletions.add(n)}async openBareTypeSession(t){for(let[r,a]of t)this.overlay.set(r,a);let n=Array.from(this.pendingOverlayDeletions).filter((r)=>!t.has(r));this.pendingOverlayDeletions.clear();let s=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:Array.from(t.keys()),deleted:n}}),i=`${e(f.join(this.cwd,"node_modules"))}/`;return{resolveAt:async(r,a)=>{let y=await s.getDefaultProjectForFile(r);if(!y)return{kind:"unresolved"};let g=y.checker,P=await g.getSymbolAtPosition(r,a);if(!P)return{kind:"unresolved"};let S=await g.getAliasedSymbol(P);if(await g.isUnknownSymbol(S))return{kind:"unresolved"};let x=S.declarations??[];if(x.length===0)return{kind:"unresolved"};let h=await Promise.all(x.map((l)=>l.resolve())),c=h.findIndex((l)=>l&&e(l.getSourceFile().fileName).startsWith(i)),u=c===-1?h.findIndex((l)=>l!==void 0):c,p=u===-1?void 0:h[u];if(!p)return{kind:"unresolved"};let d=p.getSourceFile();if(await y.program.isSourceFileDefaultLibrary(d))return{kind:"default-lib"};return{kind:"resolved",filePath:d.fileName,declaredName:S.name}},dispose:()=>s.dispose?.()??Promise.resolve()}}async dispose(){this.overlay.clear(),await this.api?.close?.()}createFileSystem(){return{readFile:(t)=>this.overlay.get(e(t)),fileExists:(t)=>this.overlay.has(e(t))?!0:void 0,getAccessibleEntries:(t)=>{let n=e(t),s=Array.from(this.overlay.keys()).filter((r)=>e(f.dirname(r))===n);if(s.length===0)return;let i=[],o=[];try{for(let r of O(t)){let a=f.join(t,r);try{(j(a).isDirectory()?o:i).push(r)}catch{}}}catch{}for(let r of s){let a=f.basename(r);if(!i.includes(a))i.push(a)}return{files:i,directories:o}}}}virtualFileName(t,n){let s=f.dirname(f.resolve(t));return e(f.join(s,`__sveld_resolved_${n}.ts`))}exampleFileName(t,n,s){let i=f.dirname(f.resolve(t)),o=s.replace(G,"_");return e(f.join(i,`__sveld_example_${n}_${o}.ts`))}}function V(t){return[...t.typeImportStatements,...t.localTypeDeclarations,`type ${k} = ${t.canonicalPropsType};`,`declare const ${F}: ${k};`].join(`
|
|
3
|
+
`)}function W(t){let n=t.replace(U,"_");if(n===""||B.test(n))return`_${n}`;return n}function H(t){return`const ${W(t.name)} = null as unknown as (${t.type});
|
|
4
|
+
${t.code}
|
|
5
|
+
`}function J(t,n){let s=t.pos??0,i=n.slice(0,s).split(`
|
|
6
|
+
`).length;return{line:Math.max(1,i-q+1),text:String(t.text??"").trim()}}function Z(t){let n=t.lastIndexOf("declare const");return t.indexOf(F,n)+2}function Q(t){let n=f.resolve(t);while(!0){let s=f.join(n,"tsconfig.json");if(N(s))return s;let i=f.dirname(n);if(i===n)return null;n=i}}export{A as TypeResolver};
|
package/lib/cli-entry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ie}from"./chunk-rftengvg.js";export{ie as cli};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{j,F,J,q,ue,V,o,Ce,H,M,ne,Pe,se,D,De,_,E,G,N,I,b,S,k,z,_e,ve,w,ie}from"./chunk-rftengvg.js";import{i}from"./chunk-49hdrj4n.js";async function f(s){if(s&&"input"in s)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:m,...u}=s??{},a=await _(),n=D(m??a.entry);if(n===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let e=G(E(a,u,{entry:n}));N(e),I(e.quiet===!0);let t=await S(n,e.glob===!0,b(e)),p;if(e.check)p=await M(t.components,H(e),{entryExports:t.entryExports});if(await w(t,e,n),!e.dryRun)t.cache?.save();let c=e.reportDiagnostics||e.strict,r=F(t.diagnostics,c);if(c&&r.length>0)if(e.format==="json")process.stderr.write(V(r));else console.error(q(r));let l=0;if(p?.bump==="major")l=3;else if(J(r,e.strict).length>0)l=4;return{diagnostics:r,check:p,errors:t.errors,exitCode:l}}export{Pe as CHECK_REPORT_SCHEMA_VERSION,i as ComponentParser,ue as DIAGNOSTICS_SCHEMA_VERSION,j as DIAGNOSTIC_CODES,o as buildComponentApiDocument,ie as cli,ve as default,De as defineConfig,Ce as diffApiDocuments,ne as formatCheckReport,se as formatCheckReportJson,z as getWriter,_e as listWriters,k as registerWriter,M as runCheck,f as sveld};
|
package/package.json
CHANGED
|
@@ -202,7 +202,8 @@
|
|
|
202
202
|
"name": { "type": "string" },
|
|
203
203
|
"localName": { "type": "string" },
|
|
204
204
|
"kind": {
|
|
205
|
-
"enum": ["let", "const", "function"]
|
|
205
|
+
"enum": ["let", "const", "function", "re-export"],
|
|
206
|
+
"description": "`re-export` is module-export only: `export { x } from \"...\"`, `export * from \"...\"`, or `export { x }` of an imported binding."
|
|
206
207
|
},
|
|
207
208
|
"constant": { "type": "boolean" },
|
|
208
209
|
"type": { "type": "string" },
|
|
@@ -217,6 +218,10 @@
|
|
|
217
218
|
"items": { "$ref": "#/$defs/propParam" }
|
|
218
219
|
},
|
|
219
220
|
"returnType": { "type": "string" },
|
|
221
|
+
"typeParameters": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"description": "A function's own type parameter list from its `@template` tags, without angle brackets."
|
|
224
|
+
},
|
|
220
225
|
"isFunction": { "type": "boolean" },
|
|
221
226
|
"isFunctionDeclaration": { "type": "boolean" },
|
|
222
227
|
"isRequired": { "type": "boolean" },
|
|
@@ -233,9 +238,23 @@
|
|
|
233
238
|
"type": "array",
|
|
234
239
|
"items": { "$ref": "#/$defs/jsdocTag" }
|
|
235
240
|
},
|
|
241
|
+
"reExport": { "$ref": "#/$defs/reExport" },
|
|
236
242
|
"source": { "$ref": "#/$defs/sourceRange" }
|
|
237
243
|
}
|
|
238
244
|
},
|
|
245
|
+
"reExport": {
|
|
246
|
+
"type": "object",
|
|
247
|
+
"required": ["from", "imported"],
|
|
248
|
+
"additionalProperties": false,
|
|
249
|
+
"description": "Where a `kind: \"re-export\"` module export's binding comes from.",
|
|
250
|
+
"properties": {
|
|
251
|
+
"from": { "type": "string", "description": "Module specifier as written in the source." },
|
|
252
|
+
"imported": {
|
|
253
|
+
"type": "string",
|
|
254
|
+
"description": "Name the source module exports: `default` for a default import, `*` for `export *` or a namespace import."
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
239
258
|
"defaultValue": {
|
|
240
259
|
"type": "object",
|
|
241
260
|
"required": ["raw", "kind"],
|
package/lib/chunk-0mgphvte.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{e}from"./chunk-xt4vdey6.js";import{existsSync as A,readdirSync as O,readFileSync as M,statSync as j}from"node:fs";import{createRequire as D}from"node:module";import m from"node:path";var C="__sveld_resolved_props__",w="__SveldResolvedProps__",L=/ \| undefined$/,G=/[^A-Za-z0-9_-]/g,U=/[^A-Za-z0-9_$]/g,q=/^[0-9]/,z=2,I=7,F=`TypeScript ${I} or later, which provides \`typescript/unstable/async\``;function X(t){if(!t)return!1;let s=Number.parseInt(t,10);return Number.isFinite(s)&&s>=I}async function V(t){let s;try{let o=D(m.join(t,"package.json")).resolve("typescript/package.json");s=JSON.parse(M(o,"utf8")).version}catch{return{installed:!1}}if(!X(s))return{installed:!0,version:s};try{let n=await import("./chunk-z1dy5a6k.js");return{installed:!0,version:s,module:n}}catch{return{installed:!0,version:s}}}class k{api;symbolFlags;typeFlags;tsconfigPath;overlay=new Map;constructor(t,s,n,o){this.api=t,this.symbolFlags=s,this.typeFlags=n,this.tsconfigPath=o}static async create(t=process.cwd(),{importTs:s=V}={}){let n=await s(t);if(!n.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${F}); none was found`};if(!n.module)return{ok:!1,reason:"unsupported-version",message:`requires ${F}; found \`typescript@${n.version??"unknown"}\` installed, which does not expose that module`};let o=Q(t);if(!o)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${t}"`};let r=n.module,i=new k(null,r.SymbolFlags,r.TypeFlags,o),a=new r.API({cwd:t,fs:i.createFileSystem()});return i.api=a,{ok:!0,resolver:i}}async expandAll(t){let s=new Map;if(t.length===0)return s;let n=new Map;for(let r of t){if(!r.metadata.canonicalPropsType)continue;if(r.metadata.referencesComponentGenerics)continue;let i=this.virtualFileName(r.filePath,r.moduleName);this.overlay.set(i,B(r.metadata)),n.set(i,r)}if(n.size===0)return s;let o=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:Array.from(n.keys())}});try{let[r]=n.keys(),i=await o.getDefaultProjectForFile(r);if(!i)return s;let a=i.checker,v=await Promise.all(Array.from(n,async([l,f])=>{let c=this.overlay.get(l);if(!c)return null;let g=Z(c),p=await a.getTypeAtPosition(l,g);if(!p)return null;let u=new Map,T=await a.getPropertiesOfType(p);for(let d of T){if(!d.name||d.name.startsWith("__"))continue;u.set(d.name,{name:d.name,symbols:[d],forceOptional:!1})}if((p.flags&this.typeFlags.Union)!==0){let d=await p.getTypes(),N=await Promise.all(d.map((E)=>a.getPropertiesOfType(E)));for(let E of N)for(let h of E){if(!h.name||h.name.startsWith("__")||u.has(h.name))continue;let b=u.get(h.name);if(b)b.symbols.push(h);else u.set(h.name,{name:h.name,symbols:[h],forceOptional:!0})}}return{filePath:f.filePath,groups:Array.from(u.values())}})),y=[],_=[];v.forEach((l,f)=>{if(!l)return;l.groups.forEach((c,g)=>{for(let p of c.symbols)y.push(p),_.push({fileIndex:f,groupIndex:g})})});let R=y.length>0?await a.getTypeOfSymbol(y):[],x=await Promise.all(R.map((l)=>l?a.typeToString(l):Promise.resolve("any"))),P=new Map;y.forEach((l,f)=>{let{fileIndex:c,groupIndex:g}=_[f],p=(l.flags&this.symbolFlags.Optional)!==0,u=x[f];if(p)u=u.replace(L,"");let T=P.get(c)??new Map,S=T.get(g)??[];S.push(u),T.set(g,S),P.set(c,T)}),v.forEach((l,f)=>{if(!l)return;let c=P.get(f),g=l.groups.map((p,u)=>{let T=c?.get(u)??[],S=!(p.forceOptional||p.symbols.some((d)=>(d.flags&this.symbolFlags.Optional)!==0));return{name:p.name,type:Array.from(new Set(T)).join(" | "),isRequired:S}});g.sort((p,u)=>p.name.localeCompare(u.name)),s.set(l.filePath,g)})}finally{await o.dispose?.()}return s}async checkExamples(t){let s=new Map;if(t.length===0)return s;let n=[];for(let r of t)for(let i of r.sources){let a=this.exampleFileName(r.filePath,r.moduleName,i.id);this.overlay.set(a,J(i)),n.push({filePath:r.filePath,source:i,file:a})}if(n.length===0)return s;let o=await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:n.map((r)=>r.file)}});try{let[r]=n,i=await o.getDefaultProjectForFile(r.file);if(!i)return s;await Promise.all(n.map(async({filePath:a,source:v,file:y})=>{let[_,R]=await Promise.all([i.program.getSyntacticDiagnostics(y),i.program.getSemanticDiagnostics(y)]),x=[..._,...R];if(x.length===0)return;let P=this.overlay.get(y)??"",l=x.map((c)=>W(c,P)).sort((c,g)=>c.line-g.line).map((c)=>`Line ${c.line}: ${c.text}`).join(`
|
|
2
|
-
`),f=s.get(a)??[];f.push({id:v.id,name:v.name,message:l}),s.set(a,f)}))}finally{await o.dispose?.()}return s}async dispose(){this.overlay.clear(),await this.api?.close?.()}createFileSystem(){return{readFile:(t)=>this.overlay.get(e(t)),fileExists:(t)=>this.overlay.has(e(t))?!0:void 0,getAccessibleEntries:(t)=>{let s=e(t),n=Array.from(this.overlay.keys()).filter((i)=>e(m.dirname(i))===s);if(n.length===0)return;let o=[],r=[];try{for(let i of O(t)){let a=m.join(t,i);try{(j(a).isDirectory()?r:o).push(i)}catch{}}}catch{}for(let i of n){let a=m.basename(i);if(!o.includes(a))o.push(a)}return{files:o,directories:r}}}}virtualFileName(t,s){let n=m.dirname(m.resolve(t));return e(m.join(n,`__sveld_resolved_${s}.ts`))}exampleFileName(t,s,n){let o=m.dirname(m.resolve(t)),r=n.replace(G,"_");return e(m.join(o,`__sveld_example_${s}_${r}.ts`))}}function B(t){return[...t.typeImportStatements,...t.localTypeDeclarations,`type ${w} = ${t.canonicalPropsType};`,`declare const ${C}: ${w};`].join(`
|
|
3
|
-
`)}function H(t){let s=t.replace(U,"_");if(s===""||q.test(s))return`_${s}`;return s}function J(t){return`const ${H(t.name)} = null as unknown as (${t.type});
|
|
4
|
-
${t.code}
|
|
5
|
-
`}function W(t,s){let n=t.pos??0,o=s.slice(0,n).split(`
|
|
6
|
-
`).length;return{line:Math.max(1,o-z+1),text:String(t.text??"").trim()}}function Z(t){let s=t.lastIndexOf("declare const");return t.indexOf(C,s)+2}function Q(t){let s=m.resolve(t);while(!0){let n=m.join(s,"tsconfig.json");if(A(n))return n;let o=m.dirname(s);if(o===s)return null;s=o}}export{k as TypeResolver};
|
package/lib/chunk-fc72j0vd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T,P}from"./chunk-xt4vdey6.js";export{T as TemplateParseNotImplementedError,P as parse};
|
package/lib/chunk-fj7dbych.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i}from"./chunk-szfpvrdq.js";export{i as default};
|
package/lib/chunk-szfpvrdq.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{re,l,a,ne,p,f,ie,y,M,n,d,V,t,r,u,I,m,oe,ae,ce,G,h,ue,z,pe,le,x,fe,c,C,de,X,me,he,ge,Q,ye,R,Y,Z,L,g,xe,Te,P}from"./chunk-xt4vdey6.js";var dt={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 dt}function ut(e){if(Ht(e))return dt[e];return"HTMLElement"}function et(){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,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingContextKeyCandidates:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new Map,activeScopes:[],slots:new Map,snippetPropLocals:new Set,cssParts:[],cssProperties:[],deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1,sveldIgnoreDirectives:new Map}}var Ft=new Set(["Component","SvelteComponent","SvelteSelf"]),jt=new Set(["RegularElement","SvelteElement"]);function je(e){return Ft.has(e)}function Be(e){return jt.has(e)}function Bt({hasTypeScriptType:e,hasJSDocType:o,inferredType:s,finalType:b}){if(e)return"typescript";if(o)return"jsdoc";if(s!==void 0)return"default";if(b!==void 0)return"inferred";return"unknown"}function Ve(e){let o=e.explicitType??e.jsdocType??e.resolvedType??e.typeSeed,s=e.jsdocParams??e.resolvedParams,b=e.jsdocReturnType??e.resolvedReturnType;if(e.isFunctionDeclaration&&o==="() => any"&&b)o=s&&s.length>0?`(${s.map((E)=>`${E.name}${E.optional?"?":""}: ${E.type}`).join(", ")}) => ${b}`:`() => ${b}`;let T=e.jsdocDescription??e.resolvedDescription;if(T===void 0&&o!==void 0)T=e.typedefs?.get(o)?.description;let D=Bt({hasTypeScriptType:e.explicitType!==void 0,hasJSDocType:e.jsdocType!==void 0||e.jsdocParams!==void 0||e.jsdocReturnType!==void 0||e.resolvedType!==void 0,inferredType:e.inferredTypeForSource,finalType:o}),v=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:o,typeSource:D,description:T,params:s,returnType:b,isFunction:v}}function Vt(e){if(!e||typeof e!=="object"||!("type"in e))return;let o=String(e.type),s=je(o);if(!s&&!Be(o))return;let b="name"in e&&typeof e.name==="string"?e.name:void 0;if(!b)return;let T=s?{type:"InlineComponent",name:b}:{type:"Element",name:b};if(b==="svelte:element"&&"tag"in e&&e.tag&&typeof e.tag==="object"){let D=e.tag;if(D.type==="Literal"&&typeof D.value==="string")T.thisValue=D.value}return T}function mt(e,o){let s=Vt(o);if(!s)return;if(e.rest_props===void 0){e.rest_props=s;return}if(e.rest_props.type==="InlineComponent"&&s.type==="Element")e.rest_props=s}function ve(e,o,s){if(!o||e.has(o))return;e.set(o,s)}function Oe(e,o){for(let s=e.activeScopes.length-1;s>=0;s-=1){let b=e.activeScopes[s]?.get(o);if(!b)continue;return b.kind==="prop"?b.publicPropName:void 0}return}function Ee(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":Ee(e.left,o);break;case"ArrayPattern":for(let s of e.elements)Ee(s??void 0,o);break;case"ObjectPattern":for(let s of e.properties)if(s.type==="Property")Ee(s.value,o);else if(s.type==="RestElement")Ee(s.argument,o);break;case"RestElement":Ee(e.argument,o);break}return o}function nt(e,o){if(!o||typeof o!=="object"||!("type"in o))return;if(o.type==="Identifier"){let b=Oe(e,o.name);if(b)e.reactive_vars.add(b);return}let s=Ee(o);for(let b of s){let T=Oe(e,b);if(T)e.reactive_vars.add(T)}}function $e(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 ft(e){if(!e||typeof e!=="object"||!("type"in e))return!1;let o=String(e.type);return o==="FunctionDeclaration"||o==="FunctionExpression"||o==="ArrowFunctionExpression"}function Ot(e,o){let s=e.scopeDeclarations.get(o);if(!s)s=new Map,e.scopeDeclarations.set(o,s);return s}function $t(e,o,s){let b=[];if(s.id.type==="Identifier")return b.push({kind:"local",name:s.id.name}),b;if(s.id.type!=="ObjectPattern")return b;for(let T of s.id.properties){if(T.type==="RestElement"){if(T.argument.type==="Identifier")b.push({kind:"local",name:T.argument.name});continue}if(T.computed)continue;let D=e.getPropertyName(T.key);if(!D)continue;let v;if(T.value.type==="Identifier")v=T.value.name;else if(T.value.type==="AssignmentPattern"&&T.value.left.type==="Identifier")v=T.value.left.name;if(!v)continue;b.push({kind:"prop",name:v,publicPropName:D})}return b}function tt(e,o,s,b,T){if(!re(o))return;let D=T?.allowRunesProps??!1,v=T?.forceProp??!1,E=o;for(let N of E.declarations){if(D&&p(f(N.init),"$props")){for(let U of $t(e,E,N))ve(U.kind==="prop"?s:b,U.name,U.kind==="prop"?{kind:"prop",publicPropName:U.publicPropName}:{kind:"local"});continue}let W=E.kind==="var"?b:s,F=v?"prop":"local";for(let U of Ee(N.id))ve(W,U,F==="prop"?{kind:"prop",publicPropName:U}:{kind:"local"})}}function Gt(e,o){if("id"in e&&e.id&&typeof e.id==="object"&&"name"in e.id&&typeof e.id.name==="string")ve(o,e.id.name,{kind:"local"});for(let s of e.params)for(let b of Ee(s))ve(o,b,{kind:"local"})}function Wt(e,o,s,b){if(!Array.isArray(o))return;for(let T of o){if(!T||typeof T!=="object"||!("type"in T))continue;switch(T.type){case"VariableDeclaration":tt(e,T,s,b);break;case"FunctionDeclaration":if(T.id?.name)ve(s,T.id.name,{kind:"local"});break;case"ClassDeclaration":if(T.id?.name)ve(s,T.id.name,{kind:"local"});break}}}function Jt(e,o,s){if(!s||typeof s!=="object")return;let b="content"in s&&s.content&&typeof s.content==="object"&&"body"in s.content&&Array.isArray(s.content.body)?s.content:("body"in s)&&Array.isArray(s.body)?s:void 0;if(!b||!("body"in b)||!Array.isArray(b.body))return;for(let T of b.body){if(!T||typeof T!=="object"||!("type"in T))continue;switch(T.type){case"ImportDeclaration":for(let D of T.specifiers??[])if(D.local?.name)ve(o.componentScope,D.local.name,{kind:"local"});break;case"VariableDeclaration":tt(e,T,o.componentScope,o.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(T.id?.name)ve(o.componentScope,T.id.name,{kind:"local"});break;case"ClassDeclaration":if(T.id?.name)ve(o.componentScope,T.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!T.declaration||typeof T.declaration!=="object"||!("type"in T.declaration))break;if(T.declaration.type==="VariableDeclaration")tt(e,T.declaration,o.componentScope,o.componentScope,{forceProp:!0});else if(T.declaration.type==="FunctionDeclaration"&&T.declaration.id?.name)ve(o.componentScope,T.declaration.id.name,{kind:"prop",publicPropName:T.declaration.id.name});break}}}function yt(e,o){o.componentScope.clear(),o.scopeDeclarations=new Map,o.activeScopes.length=0,Jt(e,o,o.parsed?.instance)}function gt(e){return{varScopeStack:[e.componentScope]}}function bt(e,o,s,b){if(!$e(b))return;let T=Ot(o,b),D=s.varScopeStack[s.varScopeStack.length-1]??o.componentScope;switch(String(b.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Gt(b,T);break;case"BlockStatement":Wt(e,b.body,T,D);break;case"CatchClause":if("param"in b)for(let E of Ee(b.param))ve(T,E,{kind:"local"});break;case"EachBlock":{let E=b;for(let N of Ee(E.context))ve(T,N,{kind:"local"});if(typeof E.index==="string")ve(T,E.index,{kind:"local"});else if(E.index&&"name"in E.index)ve(T,E.index.name,{kind:"local"});break}case"AwaitBlock":{let E=b;for(let N of Ee(E.value))ve(T,N,{kind:"local"});for(let N of Ee(E.error))ve(T,N,{kind:"local"});break}}if(ft(b))s.varScopeStack.push(T);return T}function Tt(e,o){if(ft(o))e.varScopeStack.pop()}function ot(e){return e==="TSTypeAnnotation"||e==="TSTypeAliasDeclaration"||e==="TSInterfaceDeclaration"||e==="TSTypeParameterDeclaration"||e==="TSTypeParameterInstantiation"}function it(e,o,s,b){rt(e,null,null,o,s,b?.skipTypeOnlySubtrees===!0)}function rt(e,o,s,b,T,D){b(e,o,s);let v=e.type;if((v==="Identifier"||v==="Literal"||v==="Text")&&e.typeAnnotation===void 0){if(T)T(e);return}if(D&&v.charCodeAt(0)===84&&ot(v)){if(T)T(e);return}for(let E in e){if(E==="leadingComments")continue;let N=e[E];if(!N||typeof N!=="object")continue;if(Array.isArray(N))for(let W=0;W<N.length;W++){let F=N[W];if(F&&typeof F==="object"&&typeof F.type==="string")rt(F,e,E,b,T,D)}else if(typeof N.type==="string")rt(N,e,E,b,T,D)}if(T)T(e)}var St=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function Kt(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 zt=Array.from(St);function xt(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 zt){let s=e.indexOf(o);while(s!==-1){if(!xt(e.charCodeAt(s-1))&&!xt(e.charCodeAt(s+o.length)))return!0;s=e.indexOf(o,s+1)}}return!1}function Ut(e,o){for(let s=o.length-1;s>=0;s-=1)if(o[s]?.has(e))return!0;return!1}function qt(e){let o=new Set;if(!e||typeof e!=="object"||!("type"in e))return o;switch(String(e.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let s=e;if(s.id?.name)o.add(s.id.name);for(let b of s.params??[])Ee(b,o);break}case"BlockStatement":Ue(e.body,o);break;case"CatchClause":Ee(e.param,o);break;case"EachBlock":{let s=e;if(Ee(s.context,o),typeof s.index==="string")o.add(s.index);else if(s.index?.name)o.add(s.index.name);break}case"AwaitBlock":{let s=e;Ee(s.value,o),Ee(s.error,o);break}}return o}function Ue(e,o){if(!Array.isArray(e))return;for(let s of e){if(!s||typeof s!=="object"||!("type"in s))continue;switch(String(s.type)){case"ImportDeclaration":for(let b of s.specifiers??[])if(b.local?.name)o.add(b.local.name);break;case"VariableDeclaration":for(let b of s.declarations??[])Ee(b.id,o);break;case"FunctionDeclaration":case"ClassDeclaration":{let b=s.id?.name;if(b)o.add(b);break}case"ExportNamedDeclaration":{let b=s.declaration;if(b&&typeof b==="object"&&"type"in b)Ue([b],o);break}}}}function at(e,o){if(!e||typeof e!=="object")return!1;return st(e,void 0,[...o])}function st(e,o,s){if(ot(e.type))return!1;let b=$e(e);if(b)s.push(qt(e));let T=!1;if(o&&e.type==="Identifier"&&e.name!==void 0&&St.has(e.name)&&!o.type.startsWith("TS")&&Kt(e,o)&&!Ut(e.name,s))T=!0;else for(let D in e){if(D==="leadingComments")continue;let v=e[D];if(!v||typeof v!=="object")continue;if(Array.isArray(v)){for(let E=0;E<v.length;E++){let N=v[E];if(N&&typeof N==="object"&&typeof N.type==="string"){if(st(N,e,s)){T=!0;break}}}if(T)break}else if(typeof v.type==="string"){if(st(v,e,s)){T=!0;break}}}if(b)s.pop();return T}function ht(e){if(!e||typeof e!=="object")return;if("content"in e){let o=e.content,s=o&&typeof o==="object"&&"body"in o?o.body:void 0;if(Array.isArray(s))return s}if("body"in e&&Array.isArray(e.body))return e.body;return}function Et(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 s=new Set;Ue(ht(o.module),s);let b=new Set;return Ue(ht(o.instance),b),at(o.module,[s])||at(o.instance,[s,b])||at(o.fragment,[s,b])?"runes":"legacy"}var Yt=/[A-Za-z_$][\w$]*/g;function Qt(e,o,s){let b=new Map,T=o.typeParameters?.params,D=s.typeArguments?.params;if(!T?.length||!D?.length)return b;for(let v=0;v<T.length;v++){let E=T[v]?.name,N=D[v];if(!E||N?.start===void 0||N?.end===void 0)continue;let W=r(e,N.start,N.end)?.trim();if(W)b.set(E,W)}return b}function Zt(e,o){if(o.size===0)return e;return e.replace(Yt,(s)=>o.get(s)??s)}function Ae(e,o,s,b,T=new Set){let D=new Map;if(!s?.type)return D;let v=(E)=>{for(let N of E){if(N?.type!=="TSPropertySignature"||N.computed)continue;if(!N.key)continue;let W=e.getPropertyName(N.key);if(!W)continue;let F=N.typeAnnotation?.start,U=N.typeAnnotation?.end;if(F===void 0||U===void 0)continue;let Se=r(o,F+1,U)?.trim();if(!Se)continue;C(o,N.typeAnnotation?.typeAnnotation),D.set(W,{type:Se,optional:N.optional===!0,source:t(o,N)})}};switch(s.type){case"TSTypeLiteral":v(s.members??[]);break;case"TSInterfaceDeclaration":v(s.body?.body??[]);break;case"TSTypeAliasDeclaration":{let E=Ae(e,o,s.typeAnnotation,b,T);for(let[N,W]of E)D.set(N,W);break}case"TSTypeReference":{let E=le(s.typeName);if(!E||T.has(E))break;let N=b.get(E);if(!N)break;T.add(E);let W=Ae(e,o,N,b,T);T.delete(E);let F=Qt(o,N,s);for(let[U,Se]of W)D.set(U,F.size===0?Se:{...Se,type:Zt(Se.type,F)});break}case"TSIntersectionType":for(let E of s.types??[]){let N=Ae(e,o,E,b,T);for(let[W,F]of N)D.set(W,F)}break;case"TSParenthesizedType":{let E=Ae(e,o,s.typeAnnotation,b,T);for(let[N,W]of E)D.set(N,W);break}}return D}function en(e){let o={};for(let[s,b]of Object.entries(e))o[s]={...b.attribute===void 0?{}:{attribute:b.attribute},...b.reflect===void 0?{}:{reflect:b.reflect},...b.type===void 0?{}:{type:b.type}};return o}function Pt(e,o,s){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 b=s;o.scriptLanguage=e.resolveScriptLanguage(b);let T=b.options?.customElement;o.customElementTag=T?.tag,o.customElement=T?{...T.tag===void 0?{}:{tag:T.tag},...T.shadow==="open"||T.shadow==="none"?{shadow:T.shadow}:{},...T.props?{props:en(T.props)}:{},...T.extend===void 0?{}:{extend:!0}}:void 0,o.runesOptionOverride=b.options?.runes,o.scriptGenericsAttribute=e.resolveScriptGenericsAttribute(b);let D=b.instance?.content?.body??[];for(let v of D){if(!v?.type)continue;if(v.type==="ImportDeclaration"&&v.source?.value)for(let E of v.specifiers??[]){let N=E.local?.name;if(!N)continue;if(!(v.importKind==="type"||E.importKind==="type"))continue;let F,U;if(E.type==="ImportSpecifier")F="named",U=E.imported?.type==="Identifier"?E.imported.name:typeof E.imported?.value==="string"?E.imported.value:void 0;else if(E.type==="ImportDefaultSpecifier")F="default";else if(E.type==="ImportNamespaceSpecifier")F="namespace";if(!F)continue;o.typeImportBindingsByLocalName.set(N,{importedName:U,localName:N,source:String(v.source.value),specifierType:F})}if((v.type==="TSInterfaceDeclaration"||v.type==="TSTypeAliasDeclaration")&&v.id?.name&&v.start!==void 0&&v.end!==void 0)o.localTypeDeclarationsByName.set(v.id.name,{code:r(o,v.start,v.end)?.trim()??"",node:v,start:v.start});if(v.type==="TSEnumDeclaration"&&v.id?.name&&v.start!==void 0&&v.end!==void 0)o.localTypeDeclarationsByName.set(v.id.name,{code:de(o,v)??"",node:v,start:v.start});if(v.type==="ExportNamedDeclaration"&&v.declaration?.type==="VariableDeclaration")for(let E of v.declaration.declarations??[]){if(E.id?.type!=="Identifier"||!E.id.name)continue;let N=x(o,E.id.typeAnnotation);if(N)o.explicitPropTypesByName.set(E.id.name,N),C(o,E.id.typeAnnotation?.typeAnnotation)}else if(v.type==="VariableDeclaration")for(let E of v.declarations??[]){if(E.id?.type!=="Identifier"||!E.id.name)continue;let N=x(o,E.id.typeAnnotation);if(N)o.explicitVariableTypesByName.set(E.id.name,N)}}for(let v of D){if(!v||typeof v!=="object"||!("declarations"in v))continue;for(let E of v.declarations??[]){if(!p(f(E.init),"$props"))continue;let N=E.id?.typeAnnotation?void 0:ie(E.init),W=E.id?.typeAnnotation?.typeAnnotation??N,F=E.id?.typeAnnotation?x(o,E.id.typeAnnotation):fe(o,N),U=Ae(e,o,W,new Map(Array.from(o.localTypeDeclarationsByName.entries(),([Pe,Re])=>[Pe,Re.node]))),Se=new Set,Ce=new Set;if(c(o,W,Se,Ce),ge(o,Se,Ce),E.start!==void 0){let Pe={canonicalType:F,props:U,referencedImportedTypes:Se,referencedLocalTypes:Ce};if(o.runesPropsDeclarationMetadataByDeclaratorStart.set(E.start,Pe),F)o.typedRunesPropsDeclarations.push(Pe)}}}}function vt(e,o,s){for(let b of s.declarations){if(!p(f(b.init),"$props"))continue;if(b.id.type==="Identifier"){o.wholePropsLocals.add(b.id.name),o.restPropLocals.add(b.id.name);let v=z(o,b.start);if(v)for(let[E,N]of v.props)I(e,o,E,{name:E,kind:"let",type:N.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!N.optional,constant:!1,reactive:!1,source:N.source});continue}if(b.id.type!=="ObjectPattern")continue;let T=g(o,e,s),D=b.id.properties.filter((v)=>{if(v.type!=="Property"||v.computed)return!1;if(!e.getPropertyName(v.key))return!1;if(v.value.type==="Identifier")return!0;return v.value.type==="AssignmentPattern"&&v.value.left.type==="Identifier"}).length;for(let v of b.id.properties){if(v.type==="RestElement"){if(v.argument.type==="Identifier")o.restPropLocals.add(v.argument.name);continue}let E=e.getPropertyName(v.key);if(!E)continue;let N,W;if(v.value.type==="Identifier")N=v.value.name;else{let S=v.value;N=S.left.name,W=S.right}if(!N)continue;if(e.trackPropLocalName(E,N),E==="children")o.snippetPropLocals.add(N);let F=xe(o,e,v)??(D===1?T:void 0),U=pe(o,b.start,E),{init:Se,bindable:Ce}=oe(W),Pe=Se==null?{isFunction:!1}:m(e,o,Se),{value:Re,type:we,isFunction:Ie,defaultValue:_e}=Pe,Ge=U?.type===void 0&&F?.type===void 0?Pe.resolvedType:void 0;if(Pe.pendingCallDefault)o.pendingCallDefaultCandidates.push({propName:E,location:"props",...Pe.pendingCallDefault});let{type:He,typeSource:We,description:Je,params:Ke,returnType:ze,isFunction:Xe}=Ve({explicitType:U?.type,typeSeed:we,inferredTypeForSource:we,jsdocType:F?.type,jsdocDescription:F?.description,jsdocParams:F?.params,jsdocReturnType:F?.returnType,resolvedType:Ge,resolvedDescription:Pe.resolvedDescription,resolvedParams:Pe.resolvedParams,resolvedReturnType:Pe.resolvedReturnType,initializerIsFunction:Ie,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(Ce)o.reactive_vars.add(E);d(o,"prop-unknown-type",E,F?.sveldIgnore),I(e,o,E,{name:E,...N===E?{}:{localName:N},kind:"let",description:Je,binding:F?.binding,deprecated:F?.deprecated,tags:F?.tags,...F?.internal?{internal:!0}:{},...Ce?{bindable:!0}:{},type:He,typeSource:We,value:Re,defaultValue:_e,params:Ke,returnType:ze,isFunction:Xe,isFunctionDeclaration:!1,isRequired:!Ce&&Se==null&&U?.optional!==!0,constant:!1,reactive:Ce,source:t(o,v)})}}}function tn(e){let s=e.indexOf("EventDispatcher");if(s===-1)return;let b=s+15;while(e[b]===" ")b++;if(e[b]!=="<")return;let T=0,D=b;for(;b<e.length;b++)if(e[b]==="<")T++;else if(e[b]===">"){if(T--,T===0)return e.slice(D+1,b)}return}function nn(e){let o=[],s=0,b=0;for(let T=0;T<e.length;T++){let D=e[T];if(D==="{"||D==="("||D==="["||D==="<")s++;else if(D==="}"||D===")"||D==="]"||D===">")s=Math.max(s-1,0);else if(s===0&&(D===";"||D===","))o.push(e.slice(b,T)),b=T+1}return o.push(e.slice(b)),o.map((T)=>T.trim()).filter((T)=>T.length>0)}var rn=/^["']|["']$/g,on=/\?$/,an=/^\{/,sn=/\}$/;function cn(e){let o=0;for(let s=0;s<e.length;s++){let b=e[s];if(b==="{"||b==="("||b==="["||b==="<")o++;else if(b==="}"||b===")"||b==="]"||b===">")o=Math.max(o-1,0);else if(o===0&&b===":"){let T=e.slice(0,s).trim().replace(on,"").replace(rn,""),D=e.slice(s+1).trim();if(!T||!D)return;return{name:T,type:D}}}return}function Ct(e,o,s,b,T){if(s){let N=new Map(Array.from(o.localTypeDeclarationsByName.entries(),([F,U])=>[F,U.node])),W=Ae(e,o,s,N);for(let[F,U]of W)h(o,{name:F,detail:U.type,has_argument:!0,source:U.source});return}let D=e.resolveLocalVarJSDoc(b)?.type,v=D?tn(D):void 0;if(!v)return;let E=v.trim().replace(an,"").replace(sn,"");for(let N of nn(E)){let W=cn(N);if(!W)continue;h(o,{name:W.name,detail:W.type,has_argument:!0,source:T})}}function Dt(e,o){if(e.syntaxMode!=="runes")return;for(let[s,b]of Array.from(e.events.entries())){if(b.type!=="dispatched")continue;if(o.has(s)||e.forwardedEvents.has(s))continue;let T=`on${s}`,D=e.props.get(T);if(!D)continue;let v=D.type!==void 0||D.params!==void 0||D.returnType!==void 0,E=b.detail===void 0||b.detail==="undefined"||b.detail==="null"?"() => void":`(detail: ${b.detail}) => void`;e.props.set(T,{...D,description:D.description??b.description,type:v?D.type:E,typeSource:v?D.typeSource:"inferred",isFunction:!0}),e.events.delete(s)}}var Mt=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function ct(e){return e!==null&&typeof e==="object"&&typeof e.type==="string"}function kt(e){if(!Mt.has(e.type))return e;let o=e.expression;while(o&&Mt.has(o.type))o=o.expression;return o??e}function qe(e){if(!ct(e))return;pt(e)}function pt(e){for(let o in e){if(o==="leadingComments")continue;let s=e[o];if(!s||typeof s!=="object")continue;if(Array.isArray(s))for(let b=0;b<s.length;b++){let T=s[b];if(!ct(T))continue;let D=kt(T);if(D!==T)s[b]=D;pt(D)}else if(ct(s)){let b=kt(s);if(b!==s)e[o]=b;pt(b)}}}function Ye(e,o){let s=o.source?.value;if(typeof s!=="string"||o.importKind==="type")return;for(let b of o.specifiers??[]){if(b.type!=="ImportSpecifier"||b.importKind==="type")continue;let T=b.local?.name;if(!T)continue;let D=b.imported?.name??(typeof b.imported?.value==="string"?b.imported.value:T);e.valueImportBindingsByLocalName.set(T,{localName:T,importedName:D,source:s})}}function lt(e,o){if(!o)return;let s=o,b=s.type==="Program"?s.body:s.content?.body??s.body;if(!Array.isArray(b))return;for(let T of b){let D=T;if(D.type==="ImportDeclaration"){Ye(e,D);continue}let v=D.type==="ExportNamedDeclaration"&&D.declaration?D.declaration:D;if(v.type==="FunctionDeclaration"){let E=v;if(E.id?.name)e.funcDecls.set(E.id.name,E)}}}function pn(e,o,s,b,T){for(let D of e){if(D.type!=="Block"||D.start<s||D.end>b)continue;let v=o.slice(D.start,D.end);T.push({end:D.end,isJsDoc:v.startsWith("/**")&&v.length>4,text:v})}}function Nt(e,o,s){if(!e||typeof e!=="object"||!("type"in e))return;let b=e;if(b.type==="FunctionDeclaration"){if(b.id?.type==="Identifier"&&b.id.name)s.push({name:b.id.name,start:o});return}if(b.type==="VariableDeclaration"){for(let T of b.declarations??[])if(T?.id?.type==="Identifier"&&T.id.name)s.push({name:T.id.name,start:o})}}function ln(e){let o=[];for(let s of e){if(!s||typeof s!=="object"||!("type"in s))continue;let b=s;if(b.start===void 0)continue;if(b.type==="ExportNamedDeclaration"&&b.declaration)Nt(b.declaration,b.start,o);else Nt(b,b.start,o)}return o}function dn(e,o,s){let b;for(let T of e){if(T.end>o)break;if(!T.isJsDoc)continue;if(!Y.test(s.slice(T.end,o)))continue;b=T}return b}function Lt(e,o){let s=new Map;if(!e.source)return s;let b=[e.parsed?.module,e.parsed?.instance],T=[],D=[],v=e.parsed?.comments??[];for(let E of b){let N=E?.content;if(!N?.body||N.start===void 0||N.end===void 0)continue;pn(v,e.source,N.start,N.end,T),D.push(...ln(N.body))}T.sort((E,N)=>E.end-N.end);for(let E of D){let N=dn(T,E.start,e.source);if(!N)continue;let W=Z(e,N.text),{type:F,description:U,ignore:Se,internal:Ce}=L(W);if(Se.length>0)d(e,"context-any-type",E.name,Se);if(!F)continue;s.set(E.name,{type:o.aliasType(F.type),description:U||F.description,internal:Ce||void 0})}return s}function wt(e){if(e==="var")return"let";if(e==="using"||e==="await using")return"const";return e}var un=null,At=/^@component/,mn=/\r/g,fn=/^\{\s*\}$/,yn=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);class i{ctx=et();static mapToArray(e){return Array.from(e,([o,s])=>s)}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((b)=>b!==void 0),s=!1;for(let b of o){let T=b.attributes?.find((v)=>v.name==="lang");if(!T){s=!0;continue}if(i.getStaticAttributeValue(T)?.toLowerCase()==="ts")return"ts"}return s?"js":void 0}resolveScriptGenericsAttribute(e){let o=e.instance?.attributes?.find((v)=>v.name==="generics");if(!o)return;let s=t(this.ctx,o),b=e.instance?.attributes?.find((v)=>v.name==="lang");if((b?i.getStaticAttributeValue(b)?.toLowerCase():void 0)!=="ts"){n(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',s);return}let D=i.getStaticAttributeValue(o);if(!D)return;return{value:D,source:s}}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(a(e))return e.name;if(l(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,s=o.object&&"name"in o.object?o.object.name:void 0,b=o.property&&"name"in o.property?o.property.name:void 0;if(!s||!b)return!1;if(s==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(b);if(s==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(b);return!1}resolveLocalVarJSDoc(e){for(let s of this.ctx.vars)if(s.declarations.some((T)=>T.id&&typeof T.id==="object"&&("type"in T.id)&&T.id.type==="Identifier"&&("name"in T.id)&&T.id.name===e))return g(this.ctx,this,s);let o=this.ctx.funcDecls.get(e);if(o)return g(this.ctx,this,o);return}addModuleExport(e,o){if(u(e)===void 0)return;if(this.ctx.moduleExports.has(e)){let s=this.ctx.moduleExports.get(e);this.ctx.moduleExports.set(e,{...s,...o})}else this.ctx.moduleExports.set(e,o)}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=Lt(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let s=this.ctx.variableInfoCache.get(e),b=this.ctx.explicitVariableTypesByName.get(e);if(b)return{type:b,description:s?.description,internal:s?.internal};return s??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=et()}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,s,b,T)=>{i.TS_DIRECTIVE_REGEX.lastIndex=0;let D=b.replace(i.TS_DIRECTIVE_REGEX,"");return s+D+T})}parseSvelteComponent(e,o){this.cleanup(),this.ctx.componentFilePath=o.filePath;let s=i.stripTypeScriptDirectivesFromScripts(e);this.ctx.source=s;let b=P(s);if(Pt(this,this.ctx,b),this.ctx.parsed=b,this.ctx.scriptLanguage==="ts")qe(this.ctx.parsed.module),qe(this.ctx.parsed.instance),qe(this.ctx.parsed.fragment);this.ctx.syntaxMode=Et(this.ctx);let T=this.ctx.parsed.css,D=T?.start!==void 0&&T?.end!==void 0?s.slice(0,T.start)+" ".repeat(T.end-T.start)+s.slice(T.end):s;lt(this.ctx,this.ctx.parsed?.module),lt(this.ctx,this.ctx.parsed?.instance),Te(this.ctx,this,D);let v={type:"ComponentRoot",instance:this.ctx.parsed.instance,fragment:this.ctx.parsed.fragment};if(this.ctx.parsed?.module)it(this.ctx.parsed?.module,(S)=>{if(S.type==="ImportDeclaration")Ye(this.ctx,S);if(S.type==="FunctionDeclaration"){let k=S;if(k.id?.name)this.ctx.funcDecls.set(k.id.name,k)}if(S.type==="VariableDeclaration")this.ctx.vars.add(S);if(S.type==="ExportNamedDeclaration"){if(S.declaration==null&&S.specifiers.length===0)return;let k,A=!1;if(S.declaration==null&&S.specifiers[0]?.type==="ExportSpecifier"){let w=S.specifiers[0],_=w.local&&typeof w.local==="object"&&"name"in w.local?w.local.name:void 0,B=w.exported&&typeof w.exported==="object"&&"name"in w.exported?w.exported.name:void 0;if(!_||!B)return;let K;for(let H of Array.from(this.ctx.vars))if(H.declarations.some((j)=>j.id&&typeof j.id==="object"&&("type"in j.id)&&j.id.type==="Identifier"&&j.id.name===_)){K=H;break}if(!K){let H="source"in S&&S.source&&typeof S.source==="object"&&"value"in S.source?S.source.value:void 0,j=typeof H==="string"?`it re-exports from "${H}"`:this.ctx.valueImportBindingsByLocalName.has(_)?"it re-exports an imported binding":"no matching local declaration was found";n(this.ctx,"export-unresolved",B,`export "${B}" was skipped because ${j}; sveld only resolves exports of a local declaration.`,t(this.ctx,S));return}S.declaration=K,k=B,A=!0}if(S.declaration==null)return;if(!S.declaration||typeof S.declaration!=="object"||!("type"in S.declaration))return;let O=[];if(S.declaration.type==="FunctionDeclaration"){let w=S.declaration;if(!w.id?.name)return;let _=this.ctx.scriptLanguage==="ts"?X(this.ctx,w):void 0;O.push({prop_name:w.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:_?.hasAnnotations?void 0:"() => any",explicitType:_?.hasAnnotations?_.signature:void 0,initializerIsFunction:!0,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(S.declaration.type==="VariableDeclaration"){let w=S.declaration,_=wt(w.kind),B=A?w.declarations.slice(0,1):w.declarations;for(let K of B){if(!K||typeof K!=="object"||!("id"in K))continue;let{id:H,init:j}=K;if(!H||typeof H!=="object"||!("name"in H))continue;let q=H.name,te=k??q,se=j==null?{isFunction:!1}:m(this,this.ctx,j),{value:be,type:De,isFunction:ee,defaultValue:Ne}=se,Me=se;if(Me.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:q,location:"moduleExports",...Me.pendingCallDefault});O.push({prop_name:te,kind:_,isFunctionDeclaration:!1,value:be,typeSeed:De,explicitType:this.getExplicitPropType(q),initializerIsFunction:ee,defaultValue:Ne,inferredTypeForSource:De,resolvedJSDoc:Me})}if(O.length===0)return}else return;let J=g(this.ctx,this,S);for(let{prop_name:w,kind:_,isFunctionDeclaration:B,value:K,typeSeed:H,explicitType:j,initializerIsFunction:q,defaultValue:te,inferredTypeForSource:se,resolvedJSDoc:be}of O){let{type:De,typeSource:ee,description:Ne,params:Me,returnType:Le,isFunction:ke}=Ve({explicitType:j,typeSeed:H,inferredTypeForSource:se,jsdocType:J?.type,jsdocDescription:J?.description,jsdocParams:J?.params,jsdocReturnType:J?.returnType,resolvedType:be?.resolvedType,resolvedDescription:be?.resolvedDescription,resolvedParams:be?.resolvedParams,resolvedReturnType:be?.resolvedReturnType,initializerIsFunction:q,isFunctionDeclaration:B,typedefs:this.ctx.typedefs});this.addModuleExport(w,{name:w,kind:_,description:Ne,deprecated:J?.deprecated,tags:J?.tags,...J?.internal?{internal:!0}:{},type:De,typeSource:ee,value:K,defaultValue:te,params:Me,returnType:Le,isFunction:ke,isFunctionDeclaration:B,isRequired:!1,constant:_==="const",reactive:!1,source:t(this.ctx,S)})}}});let E,N,W,F=new Set,U=new Set,Se=[];yt(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let Ce=gt(this.ctx);if(it(v,(S,k,A)=>{let O=bt(this,this.ctx,Ce,S);if(O)this.ctx.activeScopes.push(O);let J=S.type;if(!yn.has(J))return;if(S.type==="AssignmentExpression")nt(this.ctx,S.left);if(S.type==="UpdateExpression")nt(this.ctx,S.argument);if(S.type==="CallExpression"){let w=S,_=w.callee&&typeof w.callee==="object"&&"name"in w.callee?w.callee.name:void 0;if(_==="createEventDispatcher"){if(k&&typeof k==="object"&&"id"in k&&k.id&&typeof k.id==="object"&&"name"in k.id)E=k.id.name,N=k;W=w.typeArguments?.params?.[0]}if(_==="$host"){if(k&&typeof k==="object"&&"id"in k&&k.id&&typeof k.id==="object"&&"name"in k.id)F.add(k.id.name)}if(_==="setContext")ae(this.ctx,this,S,k??void 0);if(_)Se.push({name:_,arguments:w.arguments,node:w});if(ne(w.callee)&&a(w.callee.property)&&w.callee.property.name==="dispatchEvent"&&(p(w.callee.object,"$host")||a(w.callee.object)&&F.has(w.callee.object.name))){let B=ue(this.ctx,w);if(B)U.add(B)}}if(J==="SpreadAttribute"){let w=S;if(w.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(w.expression?.name??""))mt(this.ctx,k)}if(S.type==="FunctionDeclaration"){let w=S;if(w.id?.name)this.ctx.funcDecls.set(w.id.name,w)}if(S.type==="ImportDeclaration")Ye(this.ctx,S);if(S.type==="VariableDeclaration"){if(this.ctx.vars.add(S),k&&typeof k==="object"&&"type"in k&&k.type==="Program"&&S.declarations.some((w)=>p(f(w.init),"$props")))vt(this,this.ctx,S)}if(S.type==="ExportNamedDeclaration"){if(S.declaration==null&&S.specifiers.length===0)return;let w,_=!1;if(S.declaration==null&&S.specifiers[0]?.type==="ExportSpecifier"){let H=S.specifiers[0],j=H.local&&typeof H.local==="object"&&"name"in H.local?H.local.name:void 0,q=H.exported&&typeof H.exported==="object"&&"name"in H.exported?H.exported.name:void 0;if(!j||!q)return;let te;for(let se of Array.from(this.ctx.vars))if(se.declarations.some((be)=>be.id&&typeof be.id==="object"&&("type"in be.id)&&be.id.type==="Identifier"&&be.id.name===j)){te=se;break}if(S.declaration=te,w=q,_=!0,!te){let se="source"in S&&S.source&&typeof S.source==="object"&&"value"in S.source?S.source.value:void 0,be=typeof se==="string"?`it re-exports from "${se}"`:this.ctx.valueImportBindingsByLocalName.has(j)?"it re-exports an imported binding":"no matching local declaration was found";n(this.ctx,"export-unresolved",q,`export "${q}" was skipped because ${be}; sveld only resolves exports of a local declaration.`,t(this.ctx,S));return}}if(S.declaration==null)return;if(!S.declaration||typeof S.declaration!=="object"||!("type"in S.declaration))return;let B=[];if(S.declaration.type==="FunctionDeclaration"){let H=S.declaration;if(!H.id?.name)return;w??=H.id.name;let j=this.ctx.scriptLanguage==="ts"?X(this.ctx,H):void 0;B.push({prop_name:w,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:j?.hasAnnotations?void 0:"() => any",explicitType:j?.hasAnnotations?j.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:H.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}else if(S.declaration.type==="VariableDeclaration"){let H=S.declaration,j=wt(H.kind),q=_?H.declarations.slice(0,1):H.declarations;for(let te of q){if(!te||typeof te!=="object"||!("id"in te))continue;let{id:se,init:be}=te;if(!se||typeof se!=="object"||!("name"in se))continue;let De=se.name,ee=w??De,Ne=j==="let"&&be==null,Me=be==null?{isFunction:!1}:m(this,this.ctx,be),{value:Le,type:ke,isFunction:Qe,defaultValue:Ze}=Me,Fe=Me;if(Fe.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:ee,location:"props",...Fe.pendingCallDefault});B.push({prop_name:ee,kind:j,isFunctionDeclaration:!1,value:Le,typeSeed:ke,explicitType:this.getExplicitPropType(De),initializerIsFunction:Qe,isRequired:Ne,localName:De,defaultValue:Ze,inferredTypeForSource:ke,resolvedJSDoc:Fe})}if(B.length===0)return}else return;let K=g(this.ctx,this,S);for(let{prop_name:H,kind:j,isFunctionDeclaration:q,value:te,typeSeed:se,explicitType:be,initializerIsFunction:De,isRequired:ee,localName:Ne,defaultValue:Me,inferredTypeForSource:Le,resolvedJSDoc:ke}of B){let{type:Qe,typeSource:Ze,description:Fe,params:Rt,returnType:It,isFunction:_t}=Ve({explicitType:be,typeSeed:se,inferredTypeForSource:Le,jsdocType:K?.type,jsdocDescription:K?.description,jsdocParams:K?.params,jsdocReturnType:K?.returnType,resolvedType:ke?.resolvedType,resolvedDescription:ke?.resolvedDescription,resolvedParams:ke?.resolvedParams,resolvedReturnType:ke?.resolvedReturnType,initializerIsFunction:De,isFunctionDeclaration:q,typedefs:this.ctx.typedefs});d(this.ctx,"prop-unknown-type",H,K?.sveldIgnore),I(this,this.ctx,H,{name:H,...Ne!==void 0&&Ne!==H?{localName:Ne}:{},kind:j,description:Fe,binding:K?.binding,deprecated:K?.deprecated,tags:K?.tags,...K?.internal?{internal:!0}:{},type:Qe,typeSource:Ze,value:te,defaultValue:Me,params:Rt,returnType:It,isFunction:_t,isFunctionDeclaration:q,isRequired:ee,constant:j==="const",reactive:this.ctx.reactive_vars.has(H),source:t(this.ctx,S)})}}if(J==="Comment"){let _=S?.data?.trim()??"";if(At.test(_))this.ctx.componentComment=_.replace(At,"").replace(mn,""),this.ctx.componentCommentSource=t(this.ctx,S)}if(J==="SlotElement"){let w=S,_=w.attributes?.find((j)=>j.name==="name")?.value,B=(Array.isArray(_)?_[0]:void 0)?.data,K=(w.attributes||[]).filter((j)=>j.name!=="name").reduce((j,q)=>{let te={value:void 0,replace:!1},se=q.value;if(se===void 0||se===!0)return j;let be=Array.isArray(se)?se[0]:se;if(be){let{type:De,expression:ee,raw:Ne,start:Me,end:Le}=be;if(De==="Text"&&Ne!==void 0)te.value=JSON.stringify(Ne);else if(!Array.isArray(se)&&De==="ExpressionTag"&&ee&&typeof ee==="object"&&"type"in ee&&ee.type==="Identifier"&&"name"in ee&&ee.name===q.name)te.value=ee.name,te.replace=!0;if(ee&&typeof ee==="object"&&"type"in ee){if(ee.type==="Literal"&&"value"in ee){let ke=ee.value;te.value=typeof ke==="string"?JSON.stringify(ke):String(ke)}else if(ee.type==="MemberExpression")te.value=M(this.ctx,this,ee);else if(ee.type!=="Identifier"){if(Me!==void 0&&Le!==void 0){if(ee.type==="ObjectExpression"||ee.type==="TemplateLiteral")te.value=r(this.ctx,Me+1,Le-1)}}}}if(q.name)j[q.name]=te;return j},{}),H=w.fragment?.nodes?.map(({start:j,end:q})=>{if(j===void 0||q===void 0)return"";return r(this.ctx,j,q)??""}).join("").trim();R(this.ctx,{slot_name:B,slot_props:K,slot_fallback:H,source:t(this.ctx,S)})}if(J==="RenderTag"){let w=S,_=ye(this.ctx,w.expression);if(_){let B,K=!1;if(_.arguments.length===0)B={};else if(_.arguments.length===1&&typeof _.arguments[0]==="object"&&_.arguments[0]&&"type"in _.arguments[0]&&_.arguments[0].type==="ObjectExpression"){let q=Q(this.ctx,this,_.arguments[0]);B=q.slot_props,K=q.hasUnresolvedSpread}else if(_.arguments.length===1)n(this.ctx,"syntax-skipped",_.publicName,`{@render ${_.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,t(this.ctx,S));let H=_.publicName==="children"?void 0:_.publicName,j=H===void 0?un:H;if(B!==void 0)R(this.ctx,{slot_name:H,slot_props:B,slot_props_unresolved_spread:K||void 0,source:t(this.ctx,S)});if(B!==void 0||this.ctx.slots.has(j))this.ctx.snippetPropLocals.add(_.trackingName)}}if(J==="OnDirective"){let w=S;if(w.expression==null&&w.name){if(k!=null&&typeof k==="object"&&"name"in k){let _=typeof k.name==="string"?k.name:void 0,B="type"in k?String(k.type):void 0;if(_&&B){let K=je(B)?{type:"InlineComponent",name:_}:{type:"Element",name:_};this.ctx.forwardedEvents.set(w.name,K);let H=this.ctx.events.get(w.name),j=this.ctx.eventDescriptions.get(w.name),q=H?.deprecated,te=H?.internal;if(!H)this.ctx.events.set(w.name,{type:"forwarded",name:w.name,element:K,description:j,deprecated:q,...te?{internal:!0}:{},source:t(this.ctx,S)});else if(H.type==="forwarded"&&j&&!H.description)this.ctx.events.set(w.name,{...H,description:j,deprecated:H.deprecated??q,...H.internal||te?{internal:!0}:{},source:H.source||t(this.ctx,S)})}}}}if(J==="BindDirective"&&k&&typeof k==="object"&&"type"in k&&(Be(String(k.type))||je(String(k.type)))){let w=S;if(w.expression?.name){let _=Oe(this.ctx,w.expression.name);if(_)this.ctx.reactive_vars.add(_)}if(Be(String(k.type))&&w.name==="this"&&w.expression?.name&&"name"in k&&typeof k.name==="string"){let _=Oe(this.ctx,w.expression.name);if(!_)return;let B=k.name;if(this.ctx.bindings.has(_)){let K=this.ctx.bindings.get(_);if(K&&!K.elements.includes(B))this.ctx.bindings.set(_,{...K,elements:[...K.elements,B]})}else this.ctx.bindings.set(_,{elements:[B]})}}},(S)=>{if($e(S))this.ctx.activeScopes.pop(),Tt(Ce,S)},{skipTypeOnlySubtrees:!0}),E!==void 0){Ct(this,this.ctx,W,E,t(this.ctx,N));for(let S of Se)if(S.name===E){let k=S.arguments[0],A=k&&typeof k==="object"&&"value"in k?k.value:void 0,O=S.arguments[1],J=ce(this,O),w=J===void 0&&O&&typeof O==="object"&&"value"in O?O.value:void 0;if(A!=null)h(this.ctx,{name:String(A),detail:J??(w==null?"":G(w)),has_argument:Boolean(O),source:t(this.ctx,S.node)})}}let Pe=new Set(U);if(E!==void 0){for(let S of Se)if(S.name===E){let k=S.arguments[0],A=k&&typeof k==="object"&&"value"in k?k.value:void 0;if(A!=null)Pe.add(String(A))}}this.ctx.forwardedEvents.forEach((S,k)=>{let A=this.ctx.events.get(k);if(A&&A.type==="dispatched"&&!Pe.has(k)){let O=this.ctx.eventDescriptions.get(k),J={type:"forwarded",name:k,element:S,description:O,deprecated:A.deprecated,tags:A.tags,source:A.source};if(A.internal)J.internal=!0;if(A.detail!==void 0&&A.detail!=="undefined")J.detail=A.detail;this.ctx.events.set(k,J)}}),Dt(this.ctx,Pe);let Re=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(S)=>this.resolvePublicPropName(S))):new Set,we=i.mapToArray(this.ctx.props).filter((S)=>!Re.has(S.name)).map((S)=>{if(this.ctx.bindings.has(S.name)){let k=this.ctx.bindings.get(S.name)?.elements.sort().map((A)=>ut(A)).join(" | ");return{...S,type:`null | ${k}`,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 Ie=i.mapToArray(this.ctx.slots).map((S)=>{let{slot_props_unresolved_spread:k,...A}=S;if(!S.slot_props)return A;if(typeof S.slot_props==="string")return fn.test(S.slot_props)?{...A,slot_props:"Record<string, never>"}:A;let O=S.slot_props,J=[];for(let B of Object.keys(O)){if(O[B].replace&&O[B].value!==void 0)O[B].value=this.getPropTypeByLocalOrPublic(O[B].value);if(O[B].value===void 0)O[B].value="any";J.push(`${B}: ${O[B].value}`)}let w=k?" & Record<string, any>":"",_=J.length===0?k?"Record<string, any>":"Record<string, never>":J.length===1?`{ ${J[0]} }${w}`:`{
|
|
2
|
-
${J.join(`;
|
|
3
|
-
`)};
|
|
4
|
-
}${w}`;return{...A,slot_props:_}}).sort((S,k)=>{let A=S.name??"",O=k.name??"";if(A<O)return-1;if(A>O)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let S=[...we.map((k)=>k.type??""),...Ie.map((k)=>k.slot_props??"")].join(`
|
|
5
|
-
`);for(let{name:k,constraint:A}of this.ctx.deferredSlotBlockGenerics){let O=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${O}\\b`).test(S))continue;this.accumulateGeneric(k,A)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)n(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=he(this.ctx.scriptGenericsAttribute.value)}let _e=i.mapToArray(this.ctx.moduleExports),Ge=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,k)=>{let A=S.name.localeCompare(k.name);if(A!==0)return A;let O=S.type.localeCompare(k.type);if(O!==0)return O;if(S.type==="forwarded"&&k.type==="forwarded"){let J=S.element.localeCompare(k.element);if(J!==0)return J}return(S.detail??"").localeCompare(k.detail??"")}),He=i.mapToArray(this.ctx.typedefs),We=i.mapToArray(this.ctx.contexts),Je={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 we)if(S.typeSource==="unknown"){let k=Je.props.get(S.name);if(k)S.type="any";let A=k?k.importSource?`Prop "${S.name}" default calls "${k.calleeName}()" imported from "${k.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${S.name}" default calls "${k.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"}".`;n(this.ctx,"prop-unknown-type",S.name,A,S.source)}for(let S of _e)if(S.typeSource==="unknown"&&Je.moduleExports.has(S.name))S.type="any";for(let S of this.ctx.jsDocEventNames){if(Pe.has(S))continue;if(this.ctx.forwardedEvents.has(S))continue;if(this.ctx.props.has(`on${S}`))continue;n(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")n(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 Ke=He.filter((S)=>S.internal).map((S)=>S.name.split("<")[0]);if(Ke.length>0){let S=Ke.map((A)=>({name:A,regex:new RegExp(`\\b${A}\\b`)})),k=(A,O,J)=>{if(!O)return;for(let{name:w,regex:_}of S){if(!_.test(O))continue;n(this.ctx,"internal-typedef-referenced",A,`"${A}" references "${w}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,J)}};for(let A of we){if(A.internal)continue;k(A.name,A.type,A.source)}for(let A of _e){if(A.internal)continue;k(A.name,A.type,A.source)}for(let A of He){if(A.internal)continue;k(A.name,A.ts)}for(let A of Ge){if(A.internal||A.type!=="dispatched")continue;k(A.name,A.detail,A.source)}for(let A of Ie){if(A.internal)continue;k(A.name??"default",A.slot_props,A.source)}for(let A of We){if(A.internal)continue;for(let O of A.properties)k(O.name,O.type)}}let ze={source:V(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:we,moduleExports:_e,slots:Ie,events:Ge,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:We,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()},Xe=me(this.ctx);if(Xe)ze[y]=Xe;return ze}}
|
|
6
|
-
export{i};
|