sveld 0.40.4 → 0.40.5

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.
@@ -0,0 +1 @@
1
+ import{I,Se}from"./chunk-ep5n8z9k.js";import{Ut,te,Jt,Vt,Gt,Fe,Kt,ne}from"./chunk-xv4tka7y.js";export{ne as ComponentParser,Vt as deriveLiteralDetailType,Jt as extractJsDocDeprecatedAndTags,Ut as extractJsDocReturnType,te as extractJsDocType,Se as formatParseError,Gt as literalDetailToTypeText,I as parseModule,Fe as parseSvelte,Kt as parseSvelteScripts};
@@ -1,4 +1,4 @@
1
- import{n,W}from"./chunk-yv6ea3ve.js";import{readdirSync as P,readFileSync as T,statSync as _}from"node:fs";import{createRequire as x}from"node:module";import c from"node:path";var k=/[^A-Za-z0-9_-]/g,R=/[^A-Za-z0-9_$]/g,I=/^[0-9]/,C=2,g=7,f=`TypeScript ${g} or later, which provides \`typescript/async\` (\`typescript/unstable/async\` in 7.0)`,w=["typescript/async","typescript/unstable/async"];function A(e){if(!e)return!1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=g}async function b(e){let t;try{let i=x(c.join(e,"package.json")).resolve("typescript/package.json");t=JSON.parse(T(i,"utf8")).version}catch{return{installed:!1}}if(!A(t))return{installed:!0,version:t};for(let s of w)try{let i=await import(s);return{installed:!0,version:t,module:i}}catch{}return{installed:!0,version:t}}class d{api=null;usesFileSystemLayer=!1;tsconfigPath;overlay=new Map;constructor(e){this.tsconfigPath=e}static async create(e=process.cwd(),{importTs:t=b}={}){let s=await t(e);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${f}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${f}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=W(e,["tsconfig.json"]);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${e}"`};let r=new d(i);return r.usesFileSystemLayer=typeof s.module.API.prototype?.createSnapshot==="function",r.api=r.usesFileSystemLayer?new s.module.API({cwd:e}):new s.module.API({cwd:e,fs:r.createFileSystem()}),{ok:!0,resolver:r}}async checkExamples(e){let t=new Map,s=[];for(let r of e)for(let a of r.sources){let o=this.exampleFileName(r.filePath,r.moduleName,a.id);this.overlay.set(o,N(a)),s.push({filePath:r.filePath,source:a,file:o})}if(s.length===0)return t;let i=this.usesFileSystemLayer?await this.api.createSnapshot({openProjects:[this.tsconfigPath],fileSystem:{kind:"layer",files:Object.fromEntries(this.overlay)}}):await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((r)=>r.file)}});try{let r=await i.getDefaultProjectForFile(s[0].file);if(!r)return t;await Promise.all(s.map(async({filePath:a,source:o,file:p})=>{let[y,h]=await Promise.all([r.program.getSyntacticDiagnostics(p),r.program.getSemanticDiagnostics(p)]),u=[...y,...h];if(u.length===0)return;let S=this.overlay.get(p)??"",E=u.map((l)=>j(l,S)).sort((l,v)=>l.line-v.line).map((l)=>`Line ${l.line}: ${l.text}`).join(`
1
+ import{n,H}from"./chunk-ep5n8z9k.js";import{readdirSync as P,readFileSync as T,statSync as _}from"node:fs";import{createRequire as x}from"node:module";import c from"node:path";var k=/[^A-Za-z0-9_-]/g,R=/[^A-Za-z0-9_$]/g,I=/^[0-9]/,C=2,g=7,f=`TypeScript ${g} or later, which provides \`typescript/async\` (\`typescript/unstable/async\` in 7.0)`,w=["typescript/async","typescript/unstable/async"];function A(e){if(!e)return!1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=g}async function b(e){let t;try{let i=x(c.join(e,"package.json")).resolve("typescript/package.json");t=JSON.parse(T(i,"utf8")).version}catch{return{installed:!1}}if(!A(t))return{installed:!0,version:t};for(let s of w)try{let i=await import(s);return{installed:!0,version:t,module:i}}catch{}return{installed:!0,version:t}}class d{api=null;usesFileSystemLayer=!1;tsconfigPath;overlay=new Map;constructor(e){this.tsconfigPath=e}static async create(e=process.cwd(),{importTs:t=b}={}){let s=await t(e);if(!s.installed)return{ok:!1,reason:"not-installed",message:`requires the \`typescript\` package to be installed (${f}); none was found`};if(!s.module)return{ok:!1,reason:"unsupported-version",message:`requires ${f}; found \`typescript@${s.version??"unknown"}\` installed, which does not expose that module`};let i=H(e,["tsconfig.json"]);if(!i)return{ok:!1,reason:"no-tsconfig",message:`could not locate a tsconfig.json starting from "${e}"`};let r=new d(i);return r.usesFileSystemLayer=typeof s.module.API.prototype?.createSnapshot==="function",r.api=r.usesFileSystemLayer?new s.module.API({cwd:e}):new s.module.API({cwd:e,fs:r.createFileSystem()}),{ok:!0,resolver:r}}async checkExamples(e){let t=new Map,s=[];for(let r of e)for(let a of r.sources){let o=this.exampleFileName(r.filePath,r.moduleName,a.id);this.overlay.set(o,N(a)),s.push({filePath:r.filePath,source:a,file:o})}if(s.length===0)return t;let i=this.usesFileSystemLayer?await this.api.createSnapshot({openProjects:[this.tsconfigPath],fileSystem:{kind:"layer",files:Object.fromEntries(this.overlay)}}):await this.api.updateSnapshot({openProject:this.tsconfigPath,fileChanges:{created:s.map((r)=>r.file)}});try{let r=await i.getDefaultProjectForFile(s[0].file);if(!r)return t;await Promise.all(s.map(async({filePath:a,source:o,file:p})=>{let[y,h]=await Promise.all([r.program.getSyntacticDiagnostics(p),r.program.getSemanticDiagnostics(p)]),u=[...y,...h];if(u.length===0)return;let S=this.overlay.get(p)??"",E=u.map((l)=>j(l,S)).sort((l,v)=>l.line-v.line).map((l)=>`Line ${l.line}: ${l.text}`).join(`
2
2
  `),m=t.get(a)??[];m.push({id:o.id,name:o.name,message:E}),t.set(a,m)}))}finally{await i.dispose?.()}return t}async dispose(){this.overlay.clear(),await this.api?.close?.()}createFileSystem(){return{readFile:(e)=>this.overlay.get(n(e)),fileExists:(e)=>this.overlay.has(n(e))?!0:void 0,getAccessibleEntries:(e)=>{let t=n(e),s=Array.from(this.overlay.keys()).filter((a)=>n(c.dirname(a))===t);if(s.length===0)return;let i=[],r=[];try{for(let a of P(e)){let o=c.join(e,a);try{(_(o).isDirectory()?r:i).push(a)}catch{}}}catch{}for(let a of s){let o=c.basename(a);if(!i.includes(o))i.push(o)}return{files:i,directories:r}}}}exampleFileName(e,t,s){let i=c.dirname(c.resolve(e)),r=s.replace(k,"_");return n(c.join(i,`__sveld_example_${t}_${r}.ts`))}}function F(e){let t=e.replace(R,"_");if(t===""||I.test(t))return`_${t}`;return t}function N(e){return`const ${F(e.name)} = null as unknown as (${e.type});
3
3
  ${e.code}
4
4
  `}function j(e,t){let s=e.pos??0,i=t.slice(0,s).split(`
@@ -0,0 +1,40 @@
1
+ import{v,M,F,x,N,ve,K,Ce,Te,z,C,p,o,i,P,t,A,c,m,w,Be,be,k,l,B,_,r,T,b,E,re,ie,a,q,R,j,h,u,X,d,se,Y,oe,Pe,Q,ae,Ve,Ae,le,Z,g,S,s,pe,Ge,We,He,ce,e,Ue,Je,ue,Ke,ze,qe,Xe,Ye,Qe,Ze,we,et,tt,ke,nt,rt,it,st,De,Ne,ot,_e,at,lt,D,pt,ct,ut,dt,ft,mt,ht,gt,yt,$e,xt,Et,St,vt,Ct,Tt,de,bt,Pt,At,Re,wt,kt,Dt,Nt,f,_t,$t,Rt,fe,me,V,It,Lt,Ot,he,ge,I,ye,L}from"./chunk-ep5n8z9k.js";function li(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLocator:void 0,parsedJsDocByText:new Map,jsDocBlocksByStart:new Map,functionDocCommentStarts:new Set,rest_props:void 0,extends:void 0,customElementTag:void 0,customElement:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],pendingConstDefaultCandidates:[],pendingContextKeyCandidates:[],pendingDispatchEscapeCandidates:[],deferredEventNoSourceDiagnostics:[],runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitVariableTypesByName:new Map,explicitVariableTypeNodesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,additionalTypeDependencyNodes:[],additionalImportedTypes:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,activeScopes:[],slots:new Map,snippetPropLocals:new Set,jsDocSlots:new Map,renderedSlots:new Set,slotsUntracked:!1,cssParts:[],cssProperties:[],deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,typedDispatcherEventNames:new Set,explicitDefaultPropNames:new Set,untypedJsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,typeCasts:{constAssertions:new WeakSet,typeAssertions:new WeakMap},contexts:new Map,typedefs:new Map,typedefMembersByName:new Map,variableInfoCache:void 0,sveldIgnoreDirectives:new Map,propIgnoreCodes:new Map}}function pi(n,y){return n.propLocalToPublicName.get(y)??y}function Cr(n,y,O=y){n.propLocalToPublicName.set(O,y)}function ci(n,y){return n.props.get(pi(n,y))}function Jn(n,y){return ci(n,y)?.type}function Mt(n,y,O,G,W){n.diagnosticRecords.push(di(n,y,O,G,W))}function di(n,y,O,G,W){return a({component:n.componentFilePath,kind:y,name:O,message:G,...W?{source:W}:{},...ui(n,y,O)?{ignored:!0}:{}})}function Ao(n,y){return`${n}:${y}`}function hn(n,y,O,G){if(!G||G.length===0)return;let W=Ao(y,O),H=n.sveldIgnoreDirectives.get(W)??new Set;for(let J of G)H.add(J);n.sveldIgnoreDirectives.set(W,H)}function Un(n,y,O){if(hn(n,"prop-unknown-type",y,O),hn(n,"bind-this-type-mismatch",y,O),O&&O.length>0)n.propIgnoreCodes.set(y,O)}function ui(n,y,O){let G=n.sveldIgnoreDirectives.get(Ao(y,O));if(!G)return!1;return G.has("")||G.has(q[y])}var fi="/**",No="*",br="*/",ql="```",mi=/^\s+/,ko=/\s/,Kl=/^@[^\s/]+(?=\s|$)/,Yl=/^@(\S+)\s*/,Ql=new Set(["extends","extendProps","generics","template","typedef"]);function zn(n){let y=0;while(y<n.length){let O=n.charCodeAt(y);if(O!==32&&O!==9&&O!==13&&O!==10&&!ko.test(n[y]))break;y++}return y}function Zl(n,y){let O=n.slice(zn(n)),G=!1;if(y)O=O.slice(fi.length),G=!0;else if(O.startsWith(No)&&!O.startsWith(br))O=O.slice(No.length),G=!0;let W=O.slice(0,zn(O));O=O.slice(W.length);let H=O.trimEnd(),J=H.endsWith(br)?H.slice(0,-br.length).trimEnd():O;return{indent:G?W.slice(1):W,content:J}}function ep(n,y,O){let G=O>y&&n.charCodeAt(O-1)===13?O-1:O;return n.slice(y,G)}function tp(n){let y=[],O=0;while(!0){let G=n.indexOf(fi,O);if(G===-1)break;let W=n.lastIndexOf(`
2
+ `,G-1)+1;if(n.charCodeAt(G+fi.length)===42||n.slice(W,G).trim()!==""){O=G+1;continue}let H=[],J=W,ee=!1,U=0;while(J<=n.length){let Ee=n.indexOf(`
3
+ `,J),Se=Ee===-1?n.length:Ee,xe=ep(n,J,Se),{indent:Le,content:Me}=Zl(xe,H.length===0);H.push({raw:xe,start:J,number:H.length,indent:Le,content:Me});let Ie=xe.trimEnd();if(Ie.endsWith(br)){ee=!0,U=J+Ie.length,O=Se;break}if(Ee===-1)break;J=Ee+1}if(!ee)break;y.push({start:G,end:U,lines:H})}return y}function np(n){let y=n;if(y.length>0&&y[0].content==="")y=y.slice(1);if(y.length>0&&y[y.length-1].content==="")y=y.slice(0,-1);return y}function rp(n){let y=[[]],O=!1;for(let G of n){if(Kl.test(G.content)&&!O)y.push([G]);else y[y.length-1].push(G);if(Xn(G.content))O=!O}return y}function Xn(n){return ip(n,ql)%2===1}function ip(n,y){let O=0,G=n.indexOf(y);while(G!==-1)O++,G=n.indexOf(y,G+y.length);return O}function wo(n){return n.map((y)=>y.indent+y.content).join(`
4
+ `)}function op(n){let y=0;while(y<n.length-1&&n[y].content.trim()==="")y++;if(n[y].content[0]!=="{")return null;let O=n.slice(y).map((U)=>U.content).join(`
5
+ `),G=E(O,0);if(G===-1)return null;let W=[],H=G+1;for(let U=y;H>0;U++){let Ee=n[U].content.length;W.push(Math.min(H,Ee)),H-=Ee+1}let J=y+W.length-1;return{type:W.map((U,Ee)=>{let Se=y+Ee,xe=n[Se].content.slice(0,U);if(n[Se].content=n[Se].content.slice(U).replace(mi,""),Se>0)n[Se].continuesType=!0;return Ee===0?xe:n[Se].indent+xe}).join(`
6
+ `).slice(1,-1),endIndex:J}}function sp(n){let y=n.content.match(mi)?.[0]??"",O=n.content.slice(y.length),G=0,W=0,H=O[0]==='"'||O[0]==="'"?O.indexOf(O[0],1):-1;if(H===-1)for(let Se of O){if(G===0&&ko.test(Se))break;if(Se==="[")G++;if(Se==="]")G--;W++}else W=H+1;let J=G===0?O.slice(0,W):"";if(!J)return null;let ee=J,U=!1,Ee;if(J.startsWith("[")&&J.endsWith("]")){U=!0;let xe=J.slice(1,-1).split("=");if(ee=xe[0].trim(),xe.length>1)Ee=xe.slice(1).join("=").trim();if(!ee)return null}if(ee.length>1&&(ee[0]==='"'||ee[0]==="'")&&ee[ee.length-1]===ee[0])ee=ee.slice(1,-1);return n.content=O.slice(W).replace(mi,""),{name:ee,optional:U,default:Ee}}function ap(n){let y=n[0],O=y.content.match(Yl),G=O?O[1]:"",W=O?y.content.slice(O[0].length):y.content,H=W.trimEnd(),J=n.slice(1).map((Me)=>Me.indent+Me.content),ee=(H?[H,...J]:J).join(`
7
+ `);y.content=W,y.tag=G;let U=op(n),Ee=U?.type??"",Se=U?.endIndex??0;if(Ql.has(G))while(Se<n.length-1&&n[Se].content.trim()==="")Se++;let xe=sp(n[Se]),Le=wo(n.slice(Se));return{tag:G,name:xe?.name??"",type:Ee,optional:xe?.optional??!1,default:xe?.default,description:Le,text:ee,lines:n}}function lp(n,y,O){let G=np(n);for(let[J,ee]of G.entries())ee.number=J;let W=rp(G),H=W.slice(1).map(ap);return{description:wo(W[0]),tags:H,start:y,end:O,lines:G}}function qn(n){return tp(n).map(({start:y,end:O,lines:G})=>lp(G,y,O))}var pp=/\s/;function gi(n,y,O){let G=y;while(G<O){let W=n[G];if(W==="/"&&n[G+1]==="/"){let H=n.indexOf(`
8
+ `,G+2);if(H===-1||H>=O)return!0;G=H+1}else if(W==="/"&&n[G+1]==="*"&&n[G+2]!=="*"){let H=n.indexOf("*/",G+2);if(H===-1||H+2>O)return!1;G=H+2}else if(W===" "||W===`
9
+ `||W==="\t"||W==="\r"||pp.test(W))G++;else return!1}return!0}var cp=/^-\s*/;function xr(n){let y=[],O,G=!1;for(let W of n){let H=Xn(W);if(O!==void 0){if(H)y.push(W.trim()),O=void 0;else y.push(W.slice(Math.min(O,zn(W))).trimEnd());continue}let J=W.trim();if(J===""){G=y.length>0;continue}if(G)y.push("");if(G=!1,y.push(J),H)O=zn(W)}return y.join(`
10
+ `).trimEnd()}function Mn(n){return n?.replace(cp,"").trim()}function _o(n){let y=n.name?`${n.name} ${n.description}`:n.description;return Mn(xr(y.split(`
11
+ `)))}function yi(n){let y=0;while(n[y+1]?.continuesType)y++;return y}var vr=new Set(["since","example","see"]),hi=new Set(["bindable","default","required"]);function Ro(n){return n.length>0?n.map((y)=>({name:y.tag,body:y.text})):void 0}function Pr(n){let y=n.trim();return y===""?!0:y}function Mo(n){let y=n.startsWith("/*")?n:`/*${n}`;return y.endsWith("*/")?y:`${y}*/`}function sn(n){return n==="*"?"any":n.trim()}function Ei(n){return Dr(qn(Mo(n)))}function Ut(n){let{returns:y}=Ei(n);return y?sn(y.type):void 0}function te(n){let{type:y}=Ei(n);return y?sn(y.type):void 0}function Jt(n){let{deprecated:y,passthrough:O,internal:G}=Ei(n);return{deprecated:y,tags:Ro(O),internal:G}}var dp=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated","ignore","internal","csspart","cssprop","cssproperty"]);function Ti(n,y){let O=n.parsedJsDocByText.get(y);if(O===void 0)O=qn(y),n.parsedJsDocByText.set(y,O);return O}function Dr(n){let y=n[0]?.tags??[],O,G=[],W,H,J,ee=!1,U=[],Ee=[],Se=[];for(let xe of y)if(xe.tag==="type")O=xe;else if(xe.tag==="param")G.push(xe);else if(xe.tag==="returns"||xe.tag==="return")W=xe;else if(xe.tag==="deprecated")J??=Pr(xe.text);else if(xe.tag==="ignore"||xe.tag==="internal")ee=!0;else if(xe.tag==="sveld-ignore")Se.push(xe.name);else if(vr.has(xe.tag))Ee.push(xe);else if(xe.tag==="bindable"){if(xe.type)continue;let Le=`${xe.name}${xe.description?` ${xe.description}`:""}`.trim();if(Le==="readonly"||Le==="writable")H??=Le}else if(!dp.has(xe.tag))U.push(xe);return{type:O,param:G,returns:W,binding:H,deprecated:J,internal:ee,additional:U,passthrough:Ee,ignore:Se,description:n[0]?.description}}function up(n,y){let O=n.jsDocBlocksByStart.get(y.start);return O?.end===y.end?[O]:void 0}function Io(n,y,O){if(!y||y.length===0||O===void 0||!n.source)return;for(let G=y.length-1;G>=0;G--){let W=y[G];if(!W||typeof W!=="object"||!("value"in W)||!("end"in W))continue;if(typeof W.end!=="number"||!("start"in W)||typeof W.start!=="number")continue;if("type"in W&&W.type==="Line"||!String(W.value).startsWith("*"))continue;if(gi(n.source,W.end,O))return W}return}var fp=new Set(["ArrowFunctionExpression","FunctionExpression"]);function Fo(n){let y=new Set,O=(W)=>{let{leadingComments:H,start:J}=W,ee=Io(n,H,J);if(ee)y.add(ee.start)};for(let W of n.funcDecls.values())O(W);let G=[{root:n.parsed?.module,isModule:!0},{root:n.parsed?.instance,isModule:!1}];for(let{root:W,isModule:H}of G)for(let J of W?.content.body??[]){let ee=J.type==="ExportNamedDeclaration",U=J.type==="ExportNamedDeclaration"?J.declaration:J;if(U?.type==="FunctionDeclaration"){if(ee)O(J)}else if(U?.type==="ClassDeclaration"&&H){O(ee?J:U);for(let Ee of U.body.body)if(Ee.type==="MethodDefinition")O(Ee)}else if(U?.type==="VariableDeclaration"&&(H||!ee||U.kind==="const")&&U.declarations.length===1&&fp.has(U.declarations[0].init?.type??""))O(J)}return y}var mp=new Set(["slot","snippet","event","typedef","callback","restProps","extends","extendProps","csspart","cssprop","cssproperty"]);function qt(n,y){let O=Io(n,y?.leadingComments,y?.start);return O&&Sp(n,O)}function gp(n,y,O){let G=n;if(y)G=`${n} extends ${y}`;if(O)G+=` = ${O}`;return G}var yp=/^[^\s,]+/,Lo=/^\s*,\s*([^\s,]+)/;function Si(n,y){let O=n.optional?n.name:yp.exec(n.name)?.[0];if(!O)return[];let G=[{name:O,constraint:gp(O,y,n.default)}],W=`${n.optional?"":n.name.slice(O.length)} ${n.description}`;for(let H=Lo.exec(W);H;H=Lo.exec(W))G.push({name:H[1],constraint:H[1]}),W=W.slice(H[0].length);return G}var hp=new Set(["","any","object","Object"]),Ep=/^[A-Za-z_$][\w$]*$/;function Tp(n){let y=new Map;for(let{name:O,type:G,optional:W}of n){let[H,J,...ee]=O.split(".");if(!J||ee.length>0)continue;let U=y.get(H)??[],Ee=Ep.test(J)?J:JSON.stringify(J);U.push(`${Ee}${W?"?":""}: ${sn(G)||"any"}`),y.set(H,U)}return n.filter((O)=>!O.name.includes(".")).map((O)=>{let G=y.get(O.name),W=sn(O.type),H=Mn(xr(O.description.split(`
12
+ `)));return{name:O.name,type:G&&hp.has(W)?`{ ${G.join("; ")} }`:W,...H?{description:H}:{},optional:O.optional}})}function Sp(n,y){let O=up(n,y)??Ti(n,Mo(y.value));if(O[0]?.tags.some(({tag:Se})=>mp.has(Se)))return;let G=Dr(O),W=G.param.length>0?Tp(G.param):void 0,H;if(n.functionDocCommentStarts.has(y.start)){let Se=G.additional.filter((xe)=>xe.tag==="template"&&xe.name);if(Se.length>0)H=Se.flatMap((xe)=>Si(xe,sn(xe.type))).map(({constraint:xe})=>xe).join(", ")}let J=G.additional.filter((Se)=>Se.tag!=="template"&&Se.tag!=="generics"),ee=G.description?.trim(),U=(Se)=>{let xe=[...ee?[ee]:[],...Se.map((Le)=>`@${Le.tag}${Le.text?` ${Le.text}`:""}`)];return xe.length>0?xe.join(`
13
+ `):void 0},Ee=J.find((Se)=>Se.tag==="default"&&Se.text.trim());return{type:G.type?sn(G.type.type):void 0,params:W,returnType:G.returns?sn(G.returns.type):void 0,description:U(J),binding:G.binding,deprecated:G.deprecated,tags:Ro(G.passthrough),sveldIgnore:G.ignore.length>0?G.ignore:void 0,internal:G.internal,typeParameters:H,...Ee?{explicitDefault:Ee.text.trim(),descriptionWithoutDefault:U(J.filter((Se)=>Se!==Ee))}:{}}}var Cp=/[^\S\r\n]*[\r\n]+\s*/g;function Oo(n,y){if(!n.source||y<0||y>n.source.length)return;return n.sourceLocator??=ve(n.source),n.sourceLocator(y)}function Ar(n,y,O){if(y===void 0||O===void 0||O<y)return;let G=Oo(n,y),W=Oo(n,O);if(!G||!W)return;return{start:G,end:W}}function Ci(n){if(!i(n))return{};return{start:typeof n.start==="number"?n.start:void 0,end:typeof n.end==="number"?n.end:void 0}}function je(n,y){let{start:O,end:G}=Ci(y);return Ar(n,O,G)}function un(n,y){if(!y||y.length===0)return;let O=[...y];while(O.length>1){let U=O[O.length-1];if(U.tag!==void 0||!U.raw.trim().endsWith("*/"))break;O.pop()}let G=O[0],W=G.raw.indexOf(`@${G.tag??""}`),H=G.start+Math.max(W,0),J=O[O.length-1],ee=J.start+J.raw.length;return Ar(n,H,ee)}function Yt(n,y,O){return n.source?.slice(y,O)}function En(n,y){let{start:O,end:G}=Ci(y);if(O===void 0||G===void 0)return;return Yt(n,O,G)}var bp=/\s+/g;function nn(n,y){return En(n,y)?.replace(Cp," ")}var xp=/^[ \t]*/,vp=/\r?\n/g;function Tn(n,y){let{source:O}=n,{start:G,end:W}=Ci(y);if(O===void 0||G===void 0||W===void 0)return;let H=[];for(let Le of n.parsed?.comments??[])if(Le.start>=G&&Le.end<=W)H.push({start:Le.start,end:Le.end});o(y,{enter(Le){if(Le.type==="TemplateElement"){let Me=O.slice(Le.start,Le.end).replace(vp,"\\n");H.push({start:Le.start,end:Le.end,text:Me})}else if(Le.type==="Literal"&&(typeof Le.value==="string"||("regex"in Le)))H.push({start:Le.start,end:Le.end,text:O.slice(Le.start,Le.end)})}}),H.sort((Le,Me)=>Le.start-Me.start);let J=(Le)=>Le.replace(bp,(Me)=>Me.includes(`
14
+ `)?Me.slice(Me.lastIndexOf(`
15
+ `)):" "),ee="",U="",Ee=G;for(let Le of H){if(U+=O.slice(Ee,Le.start),Ee=Le.end,Le.text===void 0){U+=" ";continue}ee+=J(U)+Le.text,U=""}ee+=J(U+O.slice(Ee,W));let Se=O.lastIndexOf(`
16
+ `,G-1)+1,xe=xp.exec(O.slice(Se,G))?.[0]??"";return ee.split(`
17
+ `).map((Le,Me)=>(Me>0&&Le.startsWith(xe)?Le.slice(xe.length):Le).trimEnd()).filter((Le,Me)=>Me===0||Le!=="").join(`
18
+ `).trim()}function Go(n){return n.type==="Identifier"?n.name:n.right.name}function Vo(n){return n.type==="Identifier"?n.name:Vo(n.left)}function jo(n,y,O){let G=y?.start,W=y?.end;if(G===void 0||W===void 0)return;return Yt(n,G+O,W)?.trim()}function rn(n,y){return jo(n,y,1)}function vn(n,y){return jo(n,y,0)}function gn(n,y,O,G,W=new Set){if(!y)return;let H=(J)=>gn(n,J,O,G,W);o(y,{enter(J){switch(J.type){case"TSInterfaceDeclaration":for(let ee of J.extends??[])Bo(n,ee.expression,ee.typeParameters?.params,O,G,W);return $o(J.body.body,H),p;case"TSTypeAliasDeclaration":case"TSTypeAnnotation":return H(J.typeAnnotation),p;case"TSTypeLiteral":return $o(J.members,H),p;case"TSTypeReference":return Bo(n,J.typeName,J.typeArguments?.params,O,G,W),p}}})}function Pp(n,y){let O=new Map;for(let G of Array.from(y).sort()){let W=n.valueImportBindingsByLocalName.get(G)??n.additionalImportedTypes.get(G),H=n.typeImportBindingsByLocalName.get(G)??(W?{...W,specifierType:"named"}:void 0);if(!H)continue;let J=O.get(H.source)??{default:[],named:[],namespace:[]};if(H.specifierType==="default")J.default.push(H.localName);else if(H.specifierType==="namespace")J.namespace.push(H.localName);else J.named.push({imported:H.importedName,local:H.localName});O.set(H.source,J)}return Array.from(O.entries()).sort(([G],[W])=>u(G,W)).map(([G,W])=>{if(W.namespace.length>0)return W.namespace.map((U)=>`import type * as ${U} from "${G}";`).join(`
19
+ `);let H=W.named.map(({imported:U,local:Ee})=>{if(!U||U===Ee)return Ee;return`${U} as ${Ee}`}),J=W.default[0],ee=H.length>0?`{ ${H.join(", ")} }`:"";if(J&&ee)return`import type ${J}, ${ee} from "${G}";`;if(J)return`import type ${J} from "${G}";`;return`import type ${ee} from "${G}";`})}function Bo(n,y,O,G,W,H){let J=Vo(y);if(n.typeImportBindingsByLocalName.has(J)||n.valueImportBindingsByLocalName.has(J))G.add(J);let ee=n.localTypeDeclarationsByName.get(J);if(ee&&!H.has(J))W.add(J),H.add(J),gn(n,ee.node,G,W,H),H.delete(J);for(let U of O??[])gn(n,U,G,W,H)}function $o(n,y){for(let O of n)if(O.type==="TSPropertySignature")y(O.typeAnnotation?.typeAnnotation)}function Xt(n,y){if(y)n.additionalTypeDependencyNodes.push(y)}function Dp(n){if(!n.const)return;let y=n.id.name,O=[];for(let G of n.members){let W=G.initializer;if(W?.type!=="Literal")return;let H=W.value;if(typeof H==="string")O.push(JSON.stringify(H));else if(typeof H==="number")O.push(String(H));else return}if(O.length===0)return;return`type ${y} = ${O.join(" | ")};`}function Wo(n,y){let O=Dp(y);if(O)return O;let G=Yt(n,y.start,y.end)?.trim();return G?`declare ${G}`:void 0}var Ap=/\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*$/;function Np(n,y,O){if(y===void 0)return;let G=Yt(n,y,O),W=G&&Ap.exec(G);return W?te(W[0]):void 0}function Yn(n,y){let O=[],G="start"in y&&typeof y.start==="number"?y.start:void 0,W=(H)=>y.params.length===1?"arg":`arg${H}`;for(let[H,J]of y.params.entries()){let ee=Np(n,G,J.start);G=J.end;let U=J.type==="TSParameterProperty"?J.parameter:J;if(U.type==="RestElement"){Xt(n,U.typeAnnotation?.typeAnnotation),O.push({name:U.argument.type==="Identifier"?U.argument.name:"rest",type:rn(n,U.typeAnnotation)??ee,optional:!1,rest:!0});continue}let Ee=U.type==="AssignmentPattern",Se=Ee?U.left:U,xe="typeAnnotation"in Se?Se.typeAnnotation:void 0;Xt(n,xe?.typeAnnotation),O.push({name:Se.type==="Identifier"?Se.name:W(H),type:rn(n,xe)??ee,optional:Ee||"optional"in U&&U.optional===!0,rest:!1})}Xt(n,y.returnType?.typeAnnotation);for(let H of y.typeParameters?.params??[])Xt(n,H.constraint),Xt(n,H.default);return{params:O,returnType:rn(n,y.returnType),typeParameters:vn(n,y.typeParameters)||void 0}}function In(n,y,O="any"){let{params:G,returnType:W,typeParameters:H}=Yn(n,y),J=G.map(({name:U,type:Ee,optional:Se,rest:xe})=>xe?`...${U}: ${Ee??"any[]"}`:`${U}${Se?"?":""}: ${Ee??"any"}`),ee=W!==void 0||H!==void 0||G.some((U)=>U.type!==void 0);return{signature:`${H??""}(${J.join(", ")}) => ${W??O}`,hasAnnotations:ee}}function Kn(n){return n.length>0?n.slice():void 0}function Ho(n){let y=Kn(n.pendingCallDefaultCandidates),O=Kn(n.pendingConstDefaultCandidates.filter((ee)=>ee.location!=="props"||!n.explicitDefaultPropNames.has(ee.propName))),G=Kn(n.pendingContextKeyCandidates),W=Kn(n.pendingDispatchEscapeCandidates);if(!y&&!O&&!G&&!W)return;let H=Kn(n.deferredEventNoSourceDiagnostics),J=W&&n.untypedJsDocEventNames.size>0?Array.from(n.untypedJsDocEventNames):void 0;return{...y?{pendingCallDefaultCandidates:y}:{},...O?{pendingConstDefaultCandidates:O}:{},...G?{pendingContextKeyCandidates:G}:{},...W?{pendingDispatchEscapeCandidates:W}:{},...H?{deferredEventNoSourceDiagnostics:H}:{},...J?{untypedJsDocEventNames:J}:{}}}function Jo(n){let y=new Set,O=new Set;for(let U of n.additionalTypeDependencyNodes)gn(n,U,y,O);for(let U of n.additionalImportedTypes.keys())y.add(U);let G=Array.from(n.localTypeDeclarationsByName.values()).filter((U)=>U.exported).sort((U,Ee)=>U.start-Ee.start);for(let U of G)gn(n,U.node,y,O);let W=G.map((U)=>`export ${U.code}`),H=n.typedRunesPropsDeclarations.length===1?n.typedRunesPropsDeclarations[0]:void 0,J=H?.canonicalType;if(H&&J){for(let U of H.referencedImportedTypes)y.add(U);for(let U of H.referencedLocalTypes)O.add(U)}if(!J&&y.size===0&&O.size===0&&W.length===0)return;let ee=Array.from(O).map((U)=>n.localTypeDeclarationsByName.get(U)).filter((U)=>U!==void 0&&!U.exported).sort((U,Ee)=>U.start-Ee.start).map((U)=>U.code);return{...J?{canonicalPropsType:J}:{},canonicalPropNames:H&&J?Array.from(H.props.keys()).sort():[],localTypeDeclarations:ee,...W.length>0?{moduleTypeDeclarations:W}:{},typeImportStatements:Pp(n,y)}}function kp(n,y,O,G,W){for(let H of n){if(H.type!=="Block"||H.start<O||H.end>G)continue;W.push({start:H.start,end:H.end,isJsDoc:H.end-H.start>4&&y.startsWith("/**",H.start)})}}function wp(n,y){for(let O of n){let{start:G}=O,W=O.type==="ExportNamedDeclaration"?O.declaration:O;if(W?.type==="FunctionDeclaration"){if(W.id?.name)y.push({name:W.id.name,start:G})}else if(W?.type==="VariableDeclaration"){for(let H of W.declarations)if(H.id.type==="Identifier"&&H.id.name)y.push({name:H.id.name,start:G})}}}function Lp(n,y,O){let G=0,W=n.length;while(G<W){let H=G+W>>>1;if(n[H].end<=y)G=H+1;else W=H}for(let H=G-1;H>=0;H--){let J=n[H];if(!J.isJsDoc)continue;return gi(O,J.end,y)?J:void 0}return}function _p(n){let y=new Map;if(!n.source)return y;let O=[],G=[],W=n.parsed?.comments??[];for(let H of[n.parsed?.module,n.parsed?.instance]){let J=H?.content;if(!J)continue;kp(W,n.source,J.start,J.end,O),wp(J.body,G)}O.sort((H,J)=>H.end-J.end);for(let H of G){let J=Lp(O,H.start,n.source);if(!J)continue;let ee=Ti(n,n.source.slice(J.start,J.end)),{type:U,description:Ee,ignore:Se,internal:xe}=Dr(ee);if(Se.length>0)hn(n,"context-any-type",H.name,Se);if(!U&&!Ee&&!xe)continue;y.set(H.name,{type:U?sn(U.type):void 0,description:Ee||U&&_o(U),internal:xe||void 0})}return y}function zo(n,y){return n.variableInfoCache??=_p(n),n.variableInfoCache.get(y)}function Pn(n,y){let O=ci(n,y);if(O?.type)return{type:O.type,description:O.description,internal:O.internal};let G=zo(n,y),W=n.explicitVariableTypesByName.get(y);if(W)return{type:W,description:G?.description,internal:G?.internal};if(!G?.type)return null;return{type:G.type,description:G.description,internal:G.internal}}function Dn(n,y){let O=Pn(n,y);if(O&&O.type===n.explicitVariableTypesByName.get(y))Xt(n,n.explicitVariableTypeNodesByName.get(y));return O}function bi(n,y){let O=zo(n,y);return{...O?.description?{description:O.description}:{},...O?.internal?{internal:!0}:{}}}function an(n,y){for(let G of n.vars)if(G.declarations.some((W)=>W.id.type==="Identifier"&&W.id.name===y))return Uo(n,G);let O=n.funcDecls.get(y);return O&&Uo(n,O)}function Uo(n,y){let O=qt(n,y);if(O)return O;for(let G of[n.parsed?.instance,n.parsed?.module])for(let W of G?.content.body??[])if(W.type==="ExportNamedDeclaration"&&W.declaration===y)return qt(n,W);return}var Rp=/\w/,Mp=/^readonly\s+/;function xi(n,y){let O=n.trim();if(!O.startsWith("{")||!O.endsWith("}"))return;let G=r(O.slice(1,-1),";,").map((W)=>W.trim().replace(Mp,""));for(let W of G){if(!W.startsWith(y))continue;let H=W.slice(y.length);if(Rp.test(H.charAt(0)))continue;let J=H.trimStart(),ee=J.startsWith("?");if(ee)J=J.slice(1).trimStart();if(!J.startsWith(":"))continue;let U=J.slice(1).trim();return ee?`${U} | undefined`:U}return}function Xo(n,y){if(y.computed||y.object.type!=="Identifier"||y.property.type!=="Identifier")return;let O=y.object.name,G=y.property.name;if(n.wholePropsLocals.has(O))return Jn(n,G);let W=Jn(n,O)??Pn(n,O)?.type;if(!W)return;return xi(W,G)}function Qn(n,y,O){if(!y)return;Cr(n,y);let G=n.props.get(y);n.props.set(y,G?{...G,...O}:O)}function Nr(n,y,O,G){if(y.pendingCallDefault)n.pendingCallDefaultCandidates.push({propName:O,location:G,...y.pendingCallDefault});if(y.pendingConstDefault)n.pendingConstDefaultCandidates.push({propName:O,location:G,...y.pendingConstDefault})}var Ip=new Map([["Date","Date"],["Map","Map<any, any>"],["Set","Set<any>"],["WeakMap","WeakMap<object, any>"],["WeakSet","WeakSet<object>"],["Array","any[]"],["RegExp","RegExp"],["Regexp","RegExp"],["Error","Error"]]);function ln(n,y,O=0){let G=Bp(n,y,O),W=y&&typeof y==="object"?es(n,y):void 0;return W===void 0?G:{...G,type:W}}var Fp=/^\s*\(\s*$/;function es(n,y){let{constAssertions:O,typeAssertions:G}=n.typeCasts;if(O.has(y))return pn(y,"const");let W=G.get(y);if(W)return Xt(n,W),nn(n,W);return Op(n,y)}function Op(n,y){let O="start"in y&&typeof y.start==="number"?y.start:void 0;if(O===void 0)return;let G=n.parsed?.comments.findLast((W)=>W.end<=O);if(G?.type!=="Block"||!G.value.startsWith("*"))return;if(!Fp.test(Yt(n,G.end,O)??""))return;return te(G.value)}function Zn(n){return n&&typeof n==="object"&&"type"in n?n:void 0}function Bp(n,y,O){let G=Zn(y);if(!G)return{value:void 0,type:void 0,isFunction:!1};let W=Zo(n,G),H=(J,ee)=>({value:J,type:ee,isFunction:!1,defaultValue:W});switch(G.type){case"ObjectExpression":case"ArrayExpression":return H(Tn(n,G),pn(G,"widen"));case"BinaryExpression":return H(Tn(n,G),tn(n,G,O));case"ArrowFunctionExpression":case"FunctionExpression":return{...H(Qo(n,G),rs(n,G)),isFunction:!0};case"UnaryExpression":return H(Tn(n,G),tn(n,G,O));case"LogicalExpression":case"ConditionalExpression":case"SequenceExpression":{let J=Tn(n,G),ee=J!==void 0&&G.type==="SequenceExpression"?`(${J})`:J;return H(ee,tn(n,G,O))}case"NewExpression":{let{callee:J}=G,ee=t(J)?Ip.get(J.name)??J.name:void 0;return H(En(n,G),ee)}case"CallExpression":return $p(n,G,W,O);case"Identifier":{let{name:J}=G;if(O<5){let ee=nr(n,J);if(ee){let Ee=ln(n,Hp(ee),O+1),Se=an(n,J);return{...Ee,resolvedType:Se?.type??Ee.resolvedType,resolvedDescription:Se?.description??Ee.resolvedDescription,resolvedParams:Se?.params??Ee.resolvedParams,resolvedReturnType:Se?.returnType??Ee.resolvedReturnType}}let U=n.funcDecls.get(J);if(U){let Ee=an(n,J);return{value:Qo(n,U),type:void 0,isFunction:!0,defaultValue:Zo(n,U),resolvedType:Ee?.type??ns(n,Ee,U),resolvedDescription:Ee?.description,resolvedParams:Ee?.params,resolvedReturnType:Ee?.returnType}}}return qo(H(En(n,G)),n.valueImportBindingsByLocalName.get(J))}case"MemberExpression":return qo(H(En(n,G),tc(G)?"number":void 0),ae(n,G));case"TemplateLiteral":return H(En(n,G),"string");case"Literal":return typeof G.raw==="string"?H(G.raw,An(G)):H(void 0);default:return H(void 0)}}function qo(n,y){if(!y)return n;let{source:O,importedName:G,members:W}=y;return{...n,pendingConstDefault:{importSource:O,importedName:G,...W?{members:W}:{}}}}function $p(n,y,O,G){let W=En(n,y),{callee:H}=y,J=t(H)?H.name:void 0;if((J==="$derived"||J==="$state")&&y.arguments.length===1&&G<5)return{...ln(n,y.arguments[0],G+1),value:W,defaultValue:O};let ee={value:W,type:void 0,isFunction:!1,defaultValue:O};if(J){let U=Jp(n,J);if(U?.declared)return{...ee,resolvedType:U.type};if(U)return{...ee,type:U.type};if(n.funcDecls.has(J)||ts(n,J))return{...ee,pendingCallDefault:{calleeName:J}};let Ee=n.valueImportBindingsByLocalName.get(J);if(Ee)return{...ee,pendingCallDefault:{calleeName:J,importSource:Ee.source,importedName:Ee.importedName}}}return{...ee,pendingCallDefault:{calleeName:J??En(n,H)??"call"}}}function An(n){if("regex"in n&&n.regex)return"RegExp";if("bigint"in n&&n.bigint)return"bigint";return n.value==null?void 0:typeof n.value}var Gp=new Set(["-","*","/","%","**","<<",">>",">>>","&","|","^"]),Vp=new Set(["==","!=","===","!==","<","<=",">",">=","in","instanceof"]);function tn(n,y,O){let G=Zn(y);if(!G)return;switch(G.type){case"UnaryExpression":{let{operator:W,argument:H}=G;if(W==="!"||W==="delete")return"boolean";if(W==="typeof")return"string";if(W==="void")return;if(W==="+")return"number";return tn(n,H,O)==="bigint"?"bigint":"number"}case"BinaryExpression":{let{operator:W}=G;if(Vp.has(W))return"boolean";let H=tn(n,G.left,O),J=tn(n,G.right,O);if(H==="bigint"&&J==="bigint")return"bigint";if(Gp.has(W))return"number";if(W!=="+")return;if(H==="string"||J==="string")return"string";if(H==="number"&&J==="number")return"number";return}case"LogicalExpression":return Ko([tn(n,G.left,O),tn(n,G.right,O)]);case"ConditionalExpression":return Ko([tn(n,G.consequent,O),tn(n,G.alternate,O)]);case"SequenceExpression":return tn(n,G.expressions[G.expressions.length-1],O);case"Identifier":{let{name:W}=G;if(W==="NaN"||W==="Infinity")return"number";if(W==="undefined")return;let H=Pn(n,W)?.type;if(H)return H;if(O>=5)return;return tn(n,nr(n,W),O+1)}default:{if(O>=5)return;let W=ln(n,G,O+1);return W.type??W.resolvedType}}}function Ko(n){let y=new Set;for(let O of n){if(O===void 0)return;y.add(O.includes("=>")?`(${O})`:O)}return y.size===1?n[0]:[...y].join(" | ")}function pn(n,y){let O=Zn(n),G=y==="widen";switch(O?.type){case"Literal":if("regex"in O&&O.regex)return"RegExp";if(O.value===null)return"null";return G?An(O):O.raw??void 0;case"TemplateLiteral":if(O.expressions.length>0)return;return G?"string":`\`${O.quasis[0]?.value.raw??""}\``;case"Identifier":return O.name==="undefined"?"undefined":void 0;case"UnaryExpression":{let{operator:W,argument:H}=O;if(W!=="-"||H.type!=="Literal")return;let J=An(H);if(J!=="number"&&J!=="bigint")return;return G?J:`-${H.raw}`}case"ArrayExpression":{let W=[];for(let ee of O.elements){let U=ee===null?void 0:pn(ee,y);if(U===void 0)return;W.push(U)}if(y==="literal")return`[${W.join(", ")}]`;if(y==="const")return`readonly [${W.join(", ")}]`;let H=new Set(W);if(H.size===0)return"any[]";let J=[...H].join(" | ");return H.size===1?`${J}[]`:`(${J})[]`}case"ObjectExpression":{let W=new Map;for(let J of O.properties){if(J.type!=="Property"||J.kind!=="init"||J.computed||J.method||J.shorthand)return;let{key:ee}=J,U=ee.type==="Identifier"?ee.name:ee.type==="Literal"?ee.raw:void 0,Ee=pn(J.value,y);if(U===void 0||Ee===void 0)return;W.delete(U),W.set(U,Ee)}if(W.size===0)return"{}";let H=y==="const"?"readonly ":"";return`{ ${[...W].map(([J,ee])=>`${H}${J}: ${ee}`).join("; ")} }`}default:return}}function er(n,y,O=!1){let G=nr(n,y);if(G===void 0){let H=n.funcDecls.get(y);return H&&Yo(n,y,H,O)}if(G.type==="ArrowFunctionExpression"||G.type==="FunctionExpression")return es(n,G)??Yo(n,y,G,O);if(G.type==="CallExpression"){let H=tr(n,G);if(H)return H;let J=nn(n,G.callee);if(J==="$state"||J==="$state.raw"||J==="$derived"){let ee=G.typeArguments?.params[0];if(ee)return Xt(n,ee),nn(n,ee);if(J==="$state.raw")return ln(n,G.arguments[0],1).type}}let W=ln(n,G);return W.type??W.resolvedType}function Yo(n,y,O,G){let W=G?rr(O):ir(O),H=In(n,O,W);if(H.hasAnnotations)return H.signature;let J=an(n,y);if(J?.type)return J.type;return G?Pi(J,O)??On(n,O):ns(n,J,O)}var jp=new Map([["writable","Writable"],["readable","Readable"],["derived","Readable"],["readonly","Readable"]]),Wp=/^(?:import\("svelte\/store"\)\.)?(?:Writable|Readable)<([\s\S]*)>$/;function tr(n,y){let O=t(y.callee)?n.valueImportBindingsByLocalName.get(y.callee.name):void 0,G=O?.source==="svelte/store"?jp.get(O.importedName):void 0;if(!G)return;let W=O?.importedName==="derived",H=y.typeArguments?.params[W?1:0],J;if(H)Xt(n,H),J=nn(n,H);else if(O?.importedName==="readonly"){let[ee]=y.arguments;J=(t(ee)?Dn(n,ee.name)?.type??er(n,ee.name):ee?.type==="CallExpression"?tr(n,ee):void 0)?.trim().match(Wp)?.[1]}else if(W){let ee=y.arguments[1];J=(ee?.type==="ArrowFunctionExpression"||ee?.type==="FunctionExpression")&&ee.params.length<2?ir(ee):void 0}else{let[ee]=y.arguments;J=(t(ee)?Dn(n,ee.name)?.type:void 0)??tn(n,ee,0)}return`import("svelte/store").${G}<${J??"any"}>`}function Hp(n){if(n.type!=="CallExpression"||n.arguments.length!==1)return n;let[y]=n.arguments;if(y.type==="SpreadElement")return n;let{callee:O}=n;return O.type==="Identifier"&&(O.name==="$state"||O.name==="$derived")||O.type==="MemberExpression"&&t(O.object)&&O.object.name==="$state"&&t(O.property)&&O.property.name==="raw"?y:n}function nr(n,y,O=!1){for(let G of n.vars){if(O&&G.kind!=="const")continue;for(let W of G.declarations)if(t(W.id)&&W.id.name===y&&W.init)return W.init}return}function Fn(n,y){return nr(n,y,!0)}function Jp(n,y){let O=an(n,y);if(O?.returnType)return{type:O.returnType,declared:!0};let G=n.funcDecls.get(y)??ts(n,y);if(!G)return;let W=zp(n,G)??Up(n,y);if(W)return{type:W,declared:!0};let H=ir(G);return H==="any"?void 0:{type:H,declared:!1}}function ts(n,y){let O=nr(n,y);return O?.type==="ArrowFunctionExpression"||O?.type==="FunctionExpression"?O:void 0}function Up(n,y){for(let O of n.vars)for(let G of O.declarations){let W=G.id;if(!t(W)||W.name!==y)continue;let H=W.typeAnnotation?.typeAnnotation;if(!H)return;return re(Yt(n,H.start,H.end))}return}function zp(n,y){let O=y.returnType?.typeAnnotation;return O&&Yt(n,O.start,O.end)}function ns(n,y,O){let G=y?.returnType??"any",W=y?.params;if(W&&W.length>0)return`(${h(W)}) => ${G}`;if(y?.returnType)return`() => ${G}`;return rs(n,O)}function rs(n,y){let O=ir(y),G=In(n,y,O);if(G.hasAnnotations)return G.signature;return`(${Xp(y)}) => ${O}`}function Xp({params:n}){let y=[];for(let O of n){if(!t(O))return"...args: any[]";y.push(`${O.name}: any`)}return y.length>0?y.join(", "):"...args: any[]"}function On(n,y){let O=rr(y),G=In(n,y,O);if(G.hasAnnotations)return G.signature;return`(${is(y)}) => ${O}`}function is(n){let y=(G)=>n.params.length===1?"arg":`arg${G}`;return n.params.map((G,W)=>{if(G.type==="RestElement")return`...${t(G.argument)?G.argument.name:"args"}: any[]`;if(G.type==="AssignmentPattern")return`${t(G.left)?G.left.name:y(W)}?: any`;return`${t(G)?G.name:y(W)}: any`}).join(", ")}function Pi(n,y){if(!n?.params?.length&&!n?.returnType)return;return`(${n.params?.length?h(n.params):is(y)}) => ${n.returnType??rr(y)}`}function rr(n){return qp(n)?n.async?"Promise<void>":"void":ir(n)}function qp(n){return!n.generator&&n.body.type==="BlockStatement"&&Z(n.body).every((y)=>y===null)}function ir(n){if(n.async||n.generator)return"any";let{body:y}=n,O=y.type==="BlockStatement"?Z(y):[y],G=new Set(O.map(Kp)),[W]=G;return G.size===1&&W?W:"any"}function Kp(n){let y=Zn(n);switch(y?.type){case"Literal":{let{value:O}=y;if(typeof O==="string")return"string";if(typeof O==="number")return"number";if(typeof O==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let{callee:O}=y;if(!t(O))return null;if(O.name==="String")return"string";if(O.name==="Number")return"number";if(O.name==="Boolean")return"boolean";return null}default:return null}}function Yp(n,{params:y}){if(y.length===0)return"";return Yt(n,y[0].start,y[y.length-1].end)??""}function Qo(n,y){if(y.generator)return;let{body:O}=y,G=Yp(n,y),W=y.async?"async ":"",H=(U,Ee)=>U.type==="ObjectExpression"?`(${Ee})`:Ee;if(O.type!=="BlockStatement"){let U=Tn(n,O);return U===void 0?void 0:`${W}(${G}) => ${H(O,U)}`}let J=O.body;if(J.length===0)return`${W}(${G}) => {}`;let[ee]=J;if(J.length===1&&ee.type==="ReturnStatement"&&ee.argument){let U=Tn(n,ee.argument);if(U!==void 0)return`${W}(${G}) => ${H(ee.argument,U)}`}return}function Qp(n){switch(n.type){case"Literal":case"UnaryExpression":return"literal";case"TemplateLiteral":return n.expressions.length===0?"literal":"expression";case"ArrayExpression":return"array";case"ObjectExpression":return"object";case"ArrowFunctionExpression":case"FunctionExpression":case"FunctionDeclaration":return"function";default:return"expression"}}function Zo(n,y){let O=Tn(n,y);if(!O)return;let G=Qp(y);if(G!=="literal"&&G!=="array"&&G!=="object")return{raw:O,kind:G};let W=vi(y);if(W.ok)return{raw:O,kind:G,value:W.value};return{raw:O,kind:y.type==="UnaryExpression"?"expression":G}}function vi(n){let y=Zn(n);switch(y?.type){case"Literal":return typeof y.value==="bigint"||"regex"in y?{ok:!1}:{ok:!0,value:y.value};case"UnaryExpression":{let{operator:O,argument:G}=y;if(G.type!=="Literal")return{ok:!1};let{value:W}=G;if(typeof W==="number"){if(O==="-")return{ok:!0,value:-W};if(O==="+")return{ok:!0,value:W}}if(typeof W==="boolean"&&O==="!")return{ok:!0,value:!W};return{ok:!1}}case"TemplateLiteral":{let{expressions:O,quasis:G}=y;if(O.length>0||G.length!==1)return{ok:!1};return{ok:!0,value:G[0].value.cooked??G[0].value.raw}}case"ArrayExpression":{let O=[];for(let G of y.elements){if(!G)return{ok:!1};let W=vi(G);if(!W.ok)return{ok:!1};O.push(W.value)}return{ok:!0,value:O}}case"ObjectExpression":{let O={};for(let G of y.properties){if(G.type!=="Property"||G.computed)return{ok:!1};let W=l(G.key);if(!W)return{ok:!1};let H=vi(G.value);if(!H.ok)return{ok:!1};O[W]=H.value}return{ok:!0,value:O}}default:return{ok:!1}}}var Zp=new Set(["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"]),ec=new Set(["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"]);function tc({object:n,property:y}){if(!t(n)||!t(y))return!1;if(n.name==="Number")return Zp.has(y.name);if(n.name==="Math")return ec.has(y.name);return!1}function or(n,y,O){if(!y||n.has(y))return;n.set(y,O)}function kr(n,y){for(let O=n.activeScopes.length-1;O>=0;O-=1){let G=n.activeScopes[O]?.get(y);if(!G)continue;return G.kind==="prop"?G.publicPropName:void 0}return}function Nn(n,y){for(let O=n.activeScopes.length-1;O>=0;O-=1){let G=n.activeScopes[O];if(G===n.componentScope)return!1;if(G?.has(y))return!0}return!1}function wr(n,y){let O=y;while(A(O))O=O.object;return t(O)&&Nn(n,O.name)}function Zt(n,y=new Set){if(n)for(let O of Te(n))y.add(O.name);return y}function Di(n,y){if(!y||typeof y!=="object"||!("type"in y))return;if(y.type==="Identifier"){let O=kr(n,y.name);if(O)n.reactive_vars.add(O);return}if(y.type!=="ObjectPattern"&&y.type!=="ArrayPattern")return;for(let O of Zt(y)){let G=kr(n,O);if(G)n.reactive_vars.add(G)}}function $n(n){if(!n||typeof n!=="object"||!("type"in n))return!1;switch(String(n.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"AwaitBlock":return!0;default:return!1}}function os(n){if(!n||typeof n!=="object"||!("type"in n))return!1;let y=String(n.type);return y==="FunctionDeclaration"||y==="FunctionExpression"||y==="ArrowFunctionExpression"}function nc(n){let y=[];if(n.id.type==="Identifier")return y.push({kind:"local",name:n.id.name}),y;if(n.id.type!=="ObjectPattern")return y;for(let O of n.id.properties){if(O.type==="RestElement"){if(O.argument.type==="Identifier")y.push({kind:"local",name:O.argument.name});continue}if(O.computed)continue;let G=l(O.key);if(!G)continue;let W=O.value.type==="AssignmentPattern"?O.value.left:O.value;if(W.type!=="Identifier"||!W.name)continue;y.push({kind:"prop",name:W.name,publicPropName:G})}return y}function ss(n,y,O,G){let W=n.kind==="var"?O:y;for(let H of n.declarations){if(G?.allowRunesProps&&m(H.init,"$props")){for(let J of nc(H))or(J.kind==="prop"?y:O,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}for(let J of Zt(H.id))or(W,J,G?.forceProp?{kind:"prop",publicPropName:J}:{kind:"local"})}}function Bn(n,...y){for(let O of y)for(let G of Zt(O))or(n,G,{kind:"local"})}function as(n,y,O,G){switch(n.type){case"VariableDeclaration":ss(n,y,O,G);break;case"FunctionDeclaration":case"ClassDeclaration":Bn(y,n.id);break}}function rc(n,y){for(let{local:O,exported:G}of y){if(O.type!=="Identifier")continue;let W=G.type==="Identifier"?G.name:String(G.value);if(n.componentScope.get(O.name)?.kind==="prop")continue;n.componentScope.set(O.name,{kind:"prop",publicPropName:W})}}function ic(n,y){let O=n.componentScope;for(let G of y?.content.body??[])if(G.type==="ImportDeclaration")Bn(O,...G.specifiers.map((W)=>W.local));else if(G.type!=="ExportNamedDeclaration")as(G,O,O,{allowRunesProps:!0});else if(!G.declaration){if(G.source==null)rc(n,G.specifiers)}else if(G.declaration.type==="VariableDeclaration")ss(G.declaration,O,O,{forceProp:!0});else if(G.declaration.type==="FunctionDeclaration"&&G.declaration.id?.name){let{name:W}=G.declaration.id;or(O,W,{kind:"prop",publicPropName:W})}}function ls(n){n.componentScope.clear(),n.activeScopes.length=0,ic(n,n.parsed?.instance)}function ps(n){return{varScopeStack:[n.componentScope]}}function cs(n,y,O){if(!$n(O))return;let G=new Map,W=y.varScopeStack[y.varScopeStack.length-1]??n.componentScope;switch(O.type){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":Bn(G,O.id,...O.params.map((H)=>H.type==="TSParameterProperty"?H.parameter:H));break;case"BlockStatement":for(let H of O.body)as(H,G,W);break;case"CatchClause":Bn(G,O.param);break;case"EachBlock":if(Bn(G,O.context),typeof O.index==="string")or(G,O.index,{kind:"local"});break;case"AwaitBlock":Bn(G,O.value,O.error);break}if(os(O))y.varScopeStack.push(G);return G}function ds(n,y){if(os(y))n.varScopeStack.pop()}function sr(n,y,O=!0){let G=Dn(n,y);if(G||!O)return G;let W=er(n,y,!0);if(!W)return null;let H=!an(n,y)?.params?.length;return{type:W,...bi(n,y),inferred:H}}var oc=/\bany\b/;function Ai(n,y,O,G,W,H){if(W==="any"||!oc.test(W))return;Mt(n,"context-any-type",O,`Context "${y}" ${G} is inferred as "${W}"; annotate it to replace "any".`,je(n,H))}function sc(n,y,O){if(!t(y))return null;let G=Fn(n,y.name);if(c(G))return Es(n,G,O).properties;let W=sr(n,y.name);return W?d(W.type):null}function ac(n,y){return n.properties.some((O)=>O.type==="Property"&&O.kind==="get"&&l(O.key)===y)}function us(n,y,O){if(!y||typeof y!=="object"||!(O in y))return;let G=y[O];if(!G||typeof G!=="object"||!("typeAnnotation"in G))return;return nn(n,G.typeAnnotation)}function lc(n){let y=n?.body.body;if(y?.length!==1||y[0].type!=="ReturnStatement")return;return y[0].argument??void 0}function pc(n,y,O,G,W){let H=()=>(Mt(n,"context-any-type",O,`Context "${y}" property "${O}" has no type annotation; defaulted to "any".`,je(n,G)),{type:"any"});if(t(W))return sr(n,W.name)??H();if(W?.type==="ArrowFunctionExpression"||W?.type==="FunctionExpression")return{type:On(n,W),inferred:!0};if(P(W))return{type:An(W)??"null"};if(W?.type==="MemberExpression"&&!W.computed&&t(W.object)&&t(W.property)){let Ee=sr(n,W.object.name)?.type,Se=Ee&&xi(Ee,W.property.name);if(Se)return{type:Se}}if(W===void 0)return{type:"any"};let J=W.type==="CallExpression"?tr(n,W):void 0;if(J)return{type:J,inferred:!0};let ee=ln(n,W),U=ee.type??ee.resolvedType;return U?{type:U,inferred:!0}:H()}function Es(n,y,O){let G=[],W=!1;for(let H of y.properties){if(H.type==="SpreadElement"){let Me=sc(n,H.argument,O);if(Me)G.push(...Me);else W=!0,Mt(n,"spread-unresolved",O,`Context "${O}" spreads a value sveld can't resolve; its shape is widened to "Record<string, any>".`,je(n,H));continue}if(H.type!=="Property")continue;let J=l(H.key);if(!J)continue;if(H.kind==="set"&&ac(y,J))continue;let ee=H.kind==="get"||H.kind==="set"?H.value:void 0,U=qt(n,H),Ee=!ee&&(H.value.type==="ArrowFunctionExpression"||H.value.type==="FunctionExpression")?H.value:void 0,Se=!U?.type&&Ee?Pi(U,Ee):void 0,xe=ee?H.kind==="get"?us(n,ee,"returnType"):us(n,ee.params[0],"typeAnnotation"):U?.type??Se,Le=xe?{type:xe,description:U?.description,inferred:Se!==void 0&&!U?.params?.length}:pc(n,O,J,H,H.kind==="get"?lc(ee):H.kind==="set"?void 0:H.value);if(Le.inferred)Ai(n,O,J,`property "${J}"`,Le.type,H);G.push({name:J,type:Le.type,description:Le.description||U?.description||void 0,optional:!1,...Le.internal?{internal:!0}:{}})}return{properties:G,hasUnresolvedSpread:W}}function fs(n,y,O){let{properties:G,hasUnresolvedSpread:W}=Es(n,y,O);return{key:O,typeName:X(O),properties:G,description:void 0,...W?{hasUnresolvedSpread:W}:{}}}function ms(n,y,O){if(c(y))return fs(n,y,O);let G=X(O),W=(Ee)=>({key:O,typeName:G,type:Ee,properties:[]});if(y.type==="CallExpression"){let Ee=tr(n,y);if(Ee)Ai(n,O,O,"value",Ee,y);return Ee?W(Ee):null}if(y.type==="Literal"&&y.value===null&&y.raw==="null")return W("null");if(t(y)&&y.name==="undefined")return W("undefined");if(!t(y))return null;let H=y.name,J=sr(n,H,!1),ee=J?void 0:Fn(n,H);if(c(ee)){let{internal:Ee}=bi(n,H);return{...fs(n,ee,O),...Ee?{internal:Ee}:{}}}let U=J??sr(n,H);if(U){if(U.inferred)Ai(n,O,H,`variable "${H}"`,U.type,y);let Ee=d(U.type);return{key:O,typeName:G,...Ee?{}:{type:U.type},properties:Ee??[],description:U.description||void 0,...U.internal?{internal:!0}:{}}}return Mt(n,"context-any-type",H,`Context "${O}" variable "${H}" has no type annotation; defaulted to "any".`,je(n,y)),W("any")}function gs(n){let y=n.callee,O=y.type==="Identifier"&&y.name==="Symbol",G=y.type==="MemberExpression"&&!y.computed&&y.object.type==="Identifier"&&y.object.name==="Symbol"&&y.property.type==="Identifier"&&y.property.name==="for";if(!O&&!G)return null;let W=n.arguments[0];if(W?.type==="Literal"&&typeof W.value==="string")return W.value;if(W?.type==="TemplateLiteral"&&W.quasis.length===1)return W.quasis[0].value.cooked??"";return""}function ys(n){return{kind:"pending",importSource:n.source,importedName:n.importedName,...n.members?{members:n.members}:{}}}function Ts(n,y,O=0){if(!y||typeof y!=="object"||!("type"in y))return{kind:"unresolved"};let G=y;if(G.type==="Literal"||G.type==="TemplateLiteral"){let W=k(G);return W==null?{kind:"unresolved"}:{kind:"resolved",key:W}}if(G.type==="CallExpression"||G.type==="NewExpression"){let W=gs(G);return W==null?{kind:"unresolved"}:{kind:"resolved",key:W}}if(G.type==="Identifier"){if(O>=5)return{kind:"unresolved"};let W=Fn(n,G.name);if(W&&typeof W==="object"&&"type"in W){let J=W;if((J.type==="CallExpression"||J.type==="NewExpression")&&gs(J)==="")return{kind:"resolved",key:G.name};return Ts(n,J,O+1)}let H=O===0&&Nn(n,G.name)?void 0:n.valueImportBindingsByLocalName.get(G.name);return H?ys(H):{kind:"unresolved"}}if(G.type==="MemberExpression"){let W=O===0&&wr(n,G)?void 0:ae(n,G);if(W)return ys(W)}return{kind:"unresolved"}}function hs(n,y,O,G,W){let H=nn(n,G)??"";Mt(n,"context-value-unresolved",y,`setContext(${O}, ${H}): the value isn't an object literal or a variable, so sveld can't describe its shape; the context is skipped.`,W)}function Ss(n,y,O){let G=y.arguments[0];if(!G)return;let W=Ts(n,G);if(W.kind==="unresolved"||W.kind==="resolved"&&!W.key){let Se=nn(n,G)??"";Mt(n,"context-key-unresolved",Se,`setContext key \`${Se}\` isn't a string literal, const-bound string, Symbol(), or imported \`export const\` string; the context is skipped.`,je(n,y));return}let H=y.arguments[1];if(!H)return;let J=je(n,y),ee=qt(n,O)?.internal===!0;if(W.kind==="pending"){let Se=oe(W),xe=ms(n,H,Se);if(xe)n.pendingContextKeyCandidates.push({importSource:W.importSource,importedName:W.importedName,...W.members?{members:W.members}:{},...xe.type===void 0?{}:{type:xe.type},properties:xe.properties,description:xe.description,...xe.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...xe.internal||ee?{internal:!0}:{},source:J});else hs(n,Se,Se,H,J);return}let U=W.key,Ee=ms(n,H,U);if(!Ee){hs(n,U,JSON.stringify(U),H,J);return}if(n.contexts.has(U)){Mt(n,"context-duplicate-key",U,`setContext("${U}", ...) was called more than once; only the first call's shape is used.`,J);return}n.contexts.set(U,{...Ee,...ee?{internal:!0}:{},source:J})}var cc=/\n/g,dc=/^[A-Za-z_$][\w$]*$/;function Ni(n,y){return{variableType:(O)=>{if(y?.has(O))return;return Dn(n,O)?.type??er(n,O)}}}function ar(n,y,O){if(!y||typeof y!=="object"||!("type"in y))return O;if(t(y)){if(!Nn(n,y.name))return O;let W=O??new Set;return W.add(y.name),W}let G=O;if(c(y)){for(let W of y.properties)if(W.type==="Property")G=ar(n,W.value,G)}else if(y.type==="ArrayExpression")for(let W of y.elements)G=ar(n,W,G);return G}function Cs(n,y){if(t(y))return n.variableType(y.name);return Vt(n,y)}function Vt(n,y){if(!y||typeof y!=="object"||!("type"in y))return;if(c(y))return uc(n,y);if(y.type==="ArrayExpression")return fc(n,y);return}function bs(n,y){return Cs(n,y)??(P(y)?An(y)??"null":"any")}function ki(n,y){if(P(y)&&y.raw==="null")return"null";let O=Cs(n,y);if(O!==void 0)return O;let G=P(y)?y.value:void 0;return G==null?"":Gt(G)}function uc(n,y){if(y.properties.length===0)return"Record<string, never>";let O=[],G=!1;for(let W of y.properties){let H=W.type==="Property"&&!W.computed?l(W.key):void 0;if(W.type!=="Property"||!H){G=!0;continue}O.push({name:H,type:bs(n,W.value)})}if(!G)return lr(O);if(O.length===0)return"Record<string, any>";return lr([...O,{name:"[key: string]",type:"any"}])}function fc(n,y){let O=new Set(y.elements.filter((G)=>G!=null).map((G)=>bs(n,G)));if(O.size===0)return"any[]";if(O.size===1)return`${[...O][0]}[]`;return`(${[...O].join(" | ")})[]`}function xs(n,y){for(let[O,G]of n.arguments.entries()){if(t(G)&&G.name===y)return{argumentIndex:O};if(!c(G))continue;for(let W of G.properties){if(W.type!=="Property"||!t(W.value))continue;if(W.value.name!==y)continue;let H=!W.computed&&t(W.key)?W.key.name:void 0;return{argumentIndex:O,property:H??""}}}return}function Gt(n){return typeof n==="string"?JSON.stringify(n):String(n)}function Sn(n,{name:y,detail:O,has_argument:G,description:W,deprecated:H,tags:J,internal:ee,source:U}){let Ee=!G&&!O?"null":O||void 0,Se=n.events.get(y);if(Se?.type==="forwarded")n.events.set(y,{type:"dispatched",name:y,detail:Ee,description:W||Se.description,deprecated:H??Se.deprecated,tags:J??Se.tags,...ee||Se.internal?{internal:!0}:{},source:U||Se.source});else if(Se){let xe=n.untypedJsDocEventNames.delete(y);n.events.set(y,{...Se,detail:Se.detail===void 0||xe?Ee:Se.detail,description:Se.description||W,deprecated:Se.deprecated??H,tags:Se.tags??J,...Se.internal||ee?{internal:!0}:{},source:U||Se.source})}else n.events.set(y,{type:"dispatched",name:y,detail:Ee,description:W,deprecated:H,tags:J,...ee?{internal:!0}:{},source:U})}function vs(n,y){let O=y.arguments[0],G=be(O,"CustomEvent");if(!G&&!be(O,"Event"))return;let W=O.arguments[0],H=P(W)?W.value:void 0;if(H==null)return;let J=G?O.arguments[1]:void 0,ee=!1,U;if(c(J)){let Ee=J.properties.find((Se)=>Se.type==="Property"&&t(Se.key)&&Se.key.name==="detail");if(Ee?.type==="Property")ee=!0,U=Ee.value}return{name:String(H),detail:U,hasArgument:ee,nestedBoundNames:ar(n,U),source:je(n,y)}}function Ps(n,y){Sn(n,{name:y.name,detail:ki(Ni(n,y.nestedBoundNames),y.detail),has_argument:y.hasArgument,source:y.source})}function lr(n,y=!1){if(n.length===0)return"null";let O=n.map(({name:G,type:W,description:H,optional:J,default:ee})=>{let U=J?"?":"",Ee=dc.test(G)||G.startsWith("[")?G:JSON.stringify(G),Se=ee?`@default ${ee}`:"",xe=j(H&&Se?`${H} ${Se}`:H||Se);if(xe){if(y)return`${xe.includes(`
20
+ `)?`/**
21
+ ${xe.split(`
22
+ `).map((Me)=>Me?` * ${Me}`:" *").join(`
23
+ `)}
24
+ */`:`/** ${xe} */`}
25
+ ${Ee}${U}: ${W};`;return`/** ${xe.replace(cc," ")} */ ${Ee}${U}: ${W};`}return`${Ee}${U}: ${W};`}).join(y?`
26
+ `:" ");return y?`{
27
+ ${O}
28
+ }`:`{ ${O} }`}function mc({hasTypeScriptType:n,hasJSDocType:y,inferredType:O,finalType:G}){if(n)return"typescript";if(y)return"jsdoc";if(O!==void 0)return"default";if(G!==void 0)return"inferred";return"unknown"}function pr(n){let y=n.explicitType??n.jsdocType??n.resolvedType??n.typeSeed,O=n.jsdocParams??n.resolvedParams,G=n.jsdocReturnType??n.resolvedReturnType;if((n.isFunctionDeclaration||n.initializerIsFunction)&&y===n.typeSeed&&(G||n.isFunctionDeclaration&&O?.length))y=`${n.jsdocTypeParameters?`<${n.jsdocTypeParameters}>`:""}(${h(O??[])}) => ${G??"any"}`;let H=n.jsdocDescription??n.resolvedDescription;if(H===void 0&&y!==void 0)H=n.typedefs?.get(y)?.description;let J=mc({hasTypeScriptType:n.explicitType!==void 0,hasJSDocType:n.jsdocType!==void 0||n.jsdocParams!==void 0||n.jsdocReturnType!==void 0||n.resolvedType!==void 0,inferredType:n.inferredTypeForSource,finalType:y}),ee=n.initializerIsFunction||n.isFunctionDeclaration||!!n.jsdocParams?.length||n.jsdocReturnType!==void 0||ie(n.jsdocType)||ie(n.resolvedType)||ie(n.explicitType),U=ee?n.jsdocTypeParameters:void 0;return{type:y,typeSource:J,description:H,params:O,returnType:G,isFunction:ee,typeParameters:U}}function cr(n,y,O){if(O?.explicitDefault===void 0)return O;return n.explicitDefaultPropNames.add(y),{...O,description:O.descriptionWithoutDefault}}function dr(n){return{binding:n?.binding,deprecated:n?.deprecated,tags:n?.tags,...n?.internal?{internal:!0}:{}}}function Lr(n){if(n?.type==="Identifier")return n.name;return typeof n?.value==="string"?n.value:void 0}function Ds(n,y){for(let O of n?.body??[]){let G=O.type==="ExportNamedDeclaration"&&O.declaration?O.declaration:O;if(G.type==="VariableDeclaration"){let W=G.declarations.find((H)=>H.id.type==="Identifier"?H.id.name===y:Zt(H.id).has(y));if(W)return{declaration:G,declarator:W,statement:O}}else if((G.type==="FunctionDeclaration"||G.type==="ClassDeclaration")&&G.id?.name===y)return{declaration:G,statement:O}}return}function gc(n,y){for(let O of n?.body??[]){if(O.type!=="LabeledStatement"||O.label.name!=="$")continue;if(O.body.type!=="ExpressionStatement")continue;let G=O.body.expression;if(G.type!=="AssignmentExpression"||G.operator!=="=")continue;if(G.left.type.startsWith("TS"))continue;if(!Zt(G.left).has(y))continue;let W={type:"VariableDeclarator",id:G.left,init:G.right,start:G.start,end:G.end};return{declaration:{type:"VariableDeclaration",kind:"let",declarations:[W],start:O.start,end:O.end},declarator:W,statement:O}}return}function yc(n){if(n==="var")return"let";if(n==="using"||n==="await using")return"const";return n}function wi(n,y,O,G,W){let H=Lr(O.local),J=Lr(O.exported);if(!H||!J)return;if(y.source!=null)return{localName:H,exportedName:J};let ee=Ds(G,H);if(!ee&&W==="instance")ee=Ds(n.parsed?.module?.content,H)??gc(G,H);return{localName:H,exportedName:J,...ee}}function Li(n,y,O,G){let W=y.source?.value,H=typeof W==="string"?`it re-exports from "${W}"`:n.valueImportBindingsByLocalName.has(O)?"it re-exports an imported binding":"no matching local declaration was found";Mt(n,"export-unresolved",G,`export "${G}" was skipped because ${H}; sveld only resolves exports of a local declaration.`,je(n,y))}function ur(n,y,O){if(!O)return qt(n,y);let G=y.specifiers.length===1?qt(n,y):void 0,W=qt(n,O.statement);if(!G||!W)return G??W;let H=Object.fromEntries(Object.entries(G).filter(([,J])=>J!==void 0));return{...W,...H,internal:G.internal||W.internal}}function _i(n,y,O,G){let W=[];if(y.type==="FunctionDeclaration"){if(!y.id)return W;let ee=n.scriptLanguage==="ts"?In(n,y,rr(y)):void 0;return W.push({prop_name:O?.exportedName??y.id.name,kind:"function",isFunctionDeclaration:!0,value:void 0,typeSeed:ee?.hasAnnotations?void 0:On(n,y),explicitType:ee?.hasAnnotations?ee.signature:void 0,initializerIsFunction:!0,isRequired:!1,localName:y.id.name,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0}),W}if(y.type!=="VariableDeclaration")return W;let H=yc(y.kind),J=O?.declarator?[O.declarator]:y.declarations;for(let{id:ee,init:U}of J){if(ee.type!=="Identifier"){for(let jt of Zt(ee)){if(O&&O.localName!==jt)continue;W.push({prop_name:O?.exportedName??jt,kind:H,isFunctionDeclaration:!1,value:void 0,typeSeed:void 0,explicitType:void 0,initializerIsFunction:!1,isRequired:!1,localName:jt,defaultValue:void 0,inferredTypeForSource:void 0,resolvedJSDoc:void 0})}continue}let Ee=ee.name,Se=O?.exportedName??Ee,xe=U==null?{isFunction:!1}:ln(n,U),{value:Le,isFunction:Me,defaultValue:Ie}=xe,Ht=H==="const"&&(U?.type==="ObjectExpression"||U?.type==="ArrayExpression")&&!n.typeCasts.constAssertions.has(U),Ft=(H==="const"&&(U?.type==="ArrowFunctionExpression"||U?.type==="FunctionExpression")?On(n,U):void 0)??(Ht?pn(U,"literal"):void 0)??xe.type;Nr(n,xe,Se,G),W.push({prop_name:Se,kind:H,isFunctionDeclaration:!1,value:Le,typeSeed:Ft,explicitType:hc(n,ee),initializerIsFunction:Me,isRequired:H==="let"&&U==null,localName:Ee,defaultValue:Ie,inferredTypeForSource:Ft,resolvedJSDoc:xe})}return W}function hc(n,y){return Xt(n,y.typeAnnotation?.typeAnnotation),rn(n,y.typeAnnotation)}function Ri(n,y,O){let{resolvedJSDoc:G}=y;return pr({explicitType:y.explicitType,typeSeed:y.typeSeed,inferredTypeForSource:y.inferredTypeForSource,jsdocType:O?.type,jsdocDescription:O?.description,jsdocParams:O?.params,jsdocReturnType:O?.returnType,jsdocTypeParameters:O?.typeParameters,resolvedType:G?.resolvedType,resolvedDescription:G?.resolvedDescription,resolvedParams:G?.resolvedParams,resolvedReturnType:G?.resolvedReturnType,initializerIsFunction:y.initializerIsFunction,isFunctionDeclaration:y.isFunctionDeclaration,typedefs:n.typedefs})}function Ec(n,y,O){Mt(n,"export-unresolved",O,`export "${O}" was skipped because a class can't be a prop; export it from the module script instead.`,je(n,y))}function As(n,y,O,G){if(O.type==="ClassDeclaration"){if(O.id)Ec(n,y,G?.exportedName??O.id.name);return}let W=_i(n,O,G,"props");if(W.length===0)return;let H=ur(n,y,G);for(let J of W){let{prop_name:ee,kind:U,localName:Ee}=J,Se=cr(n,ee,H),{type:xe,typeSource:Le,description:Me,params:Ie,returnType:Ht,isFunction:zt,typeParameters:Ft}=Ri(n,J,Se);Un(n,ee,H?.sveldIgnore),Qn(n,ee,{name:ee,...Ee!==void 0&&Ee!==ee?{localName:Ee}:{},kind:U,description:Me,...dr(H),type:xe,typeSource:Le,value:Se?.explicitDefault??J.value,defaultValue:J.defaultValue,params:Ie,returnType:Ht,typeParameters:Ft,isFunction:zt,isFunctionDeclaration:J.isFunctionDeclaration,isRequired:J.isRequired,constant:U==="const",reactive:n.reactive_vars.has(ee),source:je(n,y)})}}function Ns(n,y,O){if(y.declaration!=null){As(n,y,y.declaration);return}for(let G of y.specifiers){let W=wi(n,y,G,O,"instance");if(!W)continue;if(W.declaration)As(n,y,W.declaration,W);else Li(n,y,W.localName,W.exportedName)}}function Tc(n){if(!n||typeof n!=="object"||!("type"in n))return;let y=String(n.type),O=B(y);if(!O&&!_(y))return;let G="name"in n&&typeof n.name==="string"?n.name:void 0;if(!G)return;if(O)return{type:"InlineComponent",name:G};let W={type:"Element",name:G};if(G==="svelte:element"&&"tag"in n&&n.tag&&typeof n.tag==="object"){let H=n.tag;if(H.type==="Literal"&&typeof H.value==="string")W.thisValue=H.value}return W}function ws(n,y,O){let G=Tc(y);if(!G)return;if(n.rest_props!==void 0&&!(n.rest_props.type==="InlineComponent"&&G.type==="Element"))return;n.rest_props=G;let W=y&&typeof y==="object"&&"tag"in y?y.tag:void 0;n.restPropsTagLocal=G.name==="svelte:element"&&t(W)?W.name:void 0,n.restPropsSource=je(n,O)}function ks(n,y){let O=w(y);if(m(O,"$derived"))O=w(O.arguments[0]);if(!c(O))return;for(let G of O.properties){if(G.type!=="SpreadElement"||!t(G.argument))continue;let{name:W}=G.argument;if(W==="$$restProps"||n.restPropLocals.has(W))return W}return}function Ls(n,y){let O=new Map;for(let G of y?.content.body??[]){if(G.type==="VariableDeclaration"){for(let{id:J,init:ee}of G.declarations){let U=t(J)?ks(n,ee):void 0;if(U&&t(J))O.set(J.name,U)}continue}if(G.type!=="LabeledStatement"||G.label.name!=="$")continue;if(G.body.type!=="ExpressionStatement")continue;let W=G.body.expression;if(W.type!=="AssignmentExpression"||W.operator!=="="||!t(W.left))continue;let H=ks(n,W.right);if(H)O.set(W.left.name,H)}return O}var Sc=/^[A-Za-z_$][\w$]*/,Cc=/[A-Za-z_$][\w$]*/g,bc=/^(?:(?:const|in|out)\s+)+/;function _s(n){let y=r(n,",").map((G)=>G.trim()).filter((G)=>G.length>0);if(y.length===0)return null;return[y.map((G)=>G.replace(bc,"").match(Sc)?.[0]??G).join(", "),y.join(", ")]}function Rs(n,y,O){let G=n.scriptGenericsAttribute?.value;if(!G)return;for(let[W]of G.matchAll(Cc)){if(n.typeImportBindingsByLocalName.has(W))y.add(W);if(O.has(W))continue;let H=n.localTypeDeclarationsByName.get(W);if(!H)continue;O.add(W),gn(n,H.node,y,O)}}function _r(n,y,O){if(n.generics)n.generics=[`${n.generics[0]}, ${y}`,`${n.generics[1]}, ${O}`];else n.generics=[y,O]}function Ms(n){if(!Array.isArray(n.value))return;return n.value.map((y)=>y.type==="Text"?y.data:"").join("").trim()}function Is(n){let y=[n.instance,n.module].filter((G)=>G!==void 0),O=!1;for(let G of y){let W=G.attributes.find((H)=>H.name==="lang");if(!W){O=!0;continue}if(Ms(W)?.toLowerCase()==="ts")return"ts"}return O?"js":void 0}function Fs(n,y){let O=y.instance?.attributes.find((H)=>H.name==="generics");if(!O)return;let G=je(n,O),W=Ms(O);if(!W)return;return{value:W,source:G}}var Os=/[A-Za-z_$][\w$]*/y,xc=/[\w$]/,vc=/^\s*\??\s*:/,Pc=/(?:^|[{;,(\n]|\breadonly)\s*$/,Dc=/^\s*\[/,Ac=/\b(?:keyof|readonly|unique)\s+$/,Nc=/&\s*$/,kc=/^\s*&/,wc=/(?:\||\bextends)\s*$/,Lc=/^\s*(?:\||extends\b)/,_c=/^(?:keyof|readonly|unique|typeof|infer)\s/,Rc=/^(?:abstract\s+)?new\b/;function Mc(n){let y=n.trim();if(b(y)!==-1||T(y,"?")!==-1||Rc.test(y))return 4;if(r(y,"|").length>1)return 3;if(r(y,"&").length>1)return 2;return _c.test(y)?1:0}function Ic(n,y){if(Dc.test(y))return 0;if(Ac.test(n))return 1;if(Nc.test(n)||kc.test(y))return 2;if(wc.test(n)||Lc.test(y))return 3;return 4}function Fc(n,y){for(let O=y+1;O<n.length;O++)if(n[O]==="\\")O++;else if(n[O]===n[y])return O+1;return n.length}function Oc(n,y){for(let O=y;O<n.length;O++)if(n[O]==="\\")O++;else if(n[O]==="`")return{end:O+1,opensExpression:!1};else if(n[O]==="$"&&n[O+1]==="{")return{end:O+2,opensExpression:!0};return{end:n.length,opensExpression:!1}}function Bc(n,y){if(y.size===0)return n;let O="",G=[],W=0;while(W<n.length){let H=n[W],J=G.length-1;if(H==='"'||H==="'"){let Le=Fc(n,W);O+=n.slice(W,Le),W=Le;continue}if(H==="`"||H==="}"&&G[J]===0){if(H==="}")G.pop();let{end:Le,opensExpression:Me}=Oc(n,W+1);if(Me)G.push(0);O+=n.slice(W,Le),W=Le;continue}if(J>=0&&H==="{")G[J]++;if(J>=0&&H==="}")G[J]--;Os.lastIndex=W;let ee=xc.test(n[W-1]??"")?void 0:Os.exec(n)?.[0];if(!ee){O+=H,W++;continue}W+=ee.length;let U=y.get(ee),Ee=n.slice(0,W-ee.length),Se=n.slice(W),xe=Ee.trimEnd();if(U===void 0||xe.endsWith(".")&&!xe.endsWith("...")||Pc.test(Ee)&&vc.test(Se))O+=ee;else O+=Mc(U)>Ic(Ee,Se)?`(${U})`:U}return O}function $c(n,y,O){let G=new Map,W=y.type==="TSInterfaceDeclaration"||y.type==="TSTypeAliasDeclaration"?y.typeParameters?.params:void 0,H=O.typeArguments?.params;if(!W?.length||!H?.length)return G;for(let J=0;J<W.length;J++){let ee=W[J]?.name,U=H[J];if(!ee||U?.start===void 0||U?.end===void 0)continue;let Ee=Yt(n,U.start,U.end)?.trim();if(Ee)G.set(ee,Ee)}return G}function Rr(n,y,O,G=new Set){let W=new Map;if(!y?.type)return W;let H=(ee)=>{for(let U of ee){if(U?.type!=="TSPropertySignature"||U.computed||!U.key)continue;let Ee=l(U.key);if(!Ee)continue;let Se=U.typeAnnotation?.start,xe=U.typeAnnotation?.end;if(Se===void 0||xe===void 0)continue;let Le=Yt(n,Se+1,xe)?.trim();if(!Le)continue;Xt(n,U.typeAnnotation?.typeAnnotation);let Me=qt(n,U);W.set(Ee,{type:Le,optional:U.optional===!0,source:je(n,U),...Me?{jsdoc:Me}:{}})}},J=(ee)=>{let U=Rr(n,ee,O,G);for(let[Ee,Se]of U)W.set(Ee,Se)};switch(y.type){case"TSTypeLiteral":H(y.members??[]);break;case"TSInterfaceDeclaration":for(let ee of y.extends??[]){let U={type:"TSTypeReference",typeName:ee.expression,typeArguments:ee.typeParameters,start:ee.start,end:ee.end};J(U)}H(y.body?.body??[]);break;case"TSTypeAliasDeclaration":case"TSParenthesizedType":J(y.typeAnnotation);break;case"TSTypeReference":{let ee=Go(y.typeName);if(!ee||G.has(ee))break;let U=O.get(ee);if(!U)break;G.add(ee);let Ee=Rr(n,U,O,G);G.delete(ee);let Se=$c(n,U,y);for(let[xe,Le]of Ee)W.set(xe,Se.size===0?Le:{...Le,type:Bc(Le.type,Se)});break}case"TSIntersectionType":for(let ee of y.types??[])J(ee);break}return W}function Bs(n){return new Map(Array.from(n.localTypeDeclarationsByName,([y,O])=>[y,O.node]))}function Gc(n){let y={};for(let[O,G]of Object.entries(n))y[O]={...G.attribute===void 0?{}:{attribute:G.attribute},...G.reflect===void 0?{}:{reflect:G.reflect},...G.type===void 0?{}:{type:G.type}};return y}function Mi(n,y,O){if(y.type==="ImportDeclaration"&&y.source?.value)for(let G of y.specifiers){let W=G.type==="ImportSpecifier";if(y.importKind!=="type"&&!(W&&G.importKind==="type"))continue;let H=G.local.name;n.typeImportBindingsByLocalName.set(H,{importedName:W?se(G):void 0,localName:H,source:String(y.source.value),specifierType:W?"named":G.type==="ImportDefaultSpecifier"?"default":"namespace"})}if(y.type==="TSEnumDeclaration"||y.type==="TSInterfaceDeclaration"||y.type==="TSTypeAliasDeclaration"){let G=y.type==="TSEnumDeclaration"?Wo(n,y):Yt(n,y.start,y.end)?.trim();n.localTypeDeclarationsByName.set(y.id.name,{code:G??"",node:y,start:y.start,...O?{exported:O}:{}})}}function $s(n,y){if(n.runesPropsDeclarationMetadataByDeclaratorStart.clear(),n.explicitVariableTypesByName.clear(),n.explicitVariableTypeNodesByName.clear(),n.typeImportBindingsByLocalName.clear(),n.localTypeDeclarationsByName.clear(),n.additionalTypeDependencyNodes.length=0,n.typedRunesPropsDeclarations.length=0,!n.source)return;n.scriptLanguage=Is(y);let O=y.options?.customElement;n.customElementTag=O?.tag,n.customElement=O?{...O.tag===void 0?{}:{tag:O.tag},...O.shadow==="open"||O.shadow==="none"?{shadow:O.shadow}:{},...O.props?{props:Gc(O.props)}:{},...O.extend===void 0?{}:{extend:!0}}:void 0,n.runesOptionOverride=y.options?.runes,n.scriptGenericsAttribute=Fs(n,y);let G=new Set;for(let H of y.module?.content.body??[]){if(!H?.type)continue;if(H.type==="ExportNamedDeclaration"&&H.declaration)Mi(n,H.declaration,!0);else if(H.type==="ExportNamedDeclaration"&&!H.source)for(let J of H.specifiers){if(J.local.type!=="Identifier"||J.exported.type!=="Identifier")continue;if(J.local.name===J.exported.name)G.add(J.local.name)}else Mi(n,H,!1)}for(let H of G){let J=n.localTypeDeclarationsByName.get(H);if(J)J.exported=!0}let W=y.instance?.content.body??[];for(let H of W){if(Mi(n,H,!1),H.type!=="VariableDeclaration")continue;for(let{id:J}of H.declarations){if(J.type!=="Identifier")continue;let ee=rn(n,J.typeAnnotation);if(!ee)continue;let U=J.typeAnnotation?.typeAnnotation;if(n.explicitVariableTypesByName.set(J.name,ee),U)n.explicitVariableTypeNodesByName.set(J.name,U)}}for(let H of W){if(H.type!=="VariableDeclaration")continue;for(let J of H.declarations){if(!m(w(J.init),"$props"))continue;let ee="typeAnnotation"in J.id?J.id.typeAnnotation:void 0,U=ee?void 0:Be(J.init),Ee=ee?.typeAnnotation??U,Se=ee?rn(n,ee):vn(n,U),xe=Rr(n,Ee,Bs(n)),Le=new Set,Me=new Set;gn(n,Ee,Le,Me),Rs(n,Le,Me);let Ie={canonicalType:Se,props:xe,referencedImportedTypes:Le,referencedLocalTypes:Me};if(n.runesPropsDeclarationMetadataByDeclaratorStart.set(J.start,Ie),Se)n.typedRunesPropsDeclarations.push(Ie)}}}function Vc(n,y){let O=y?.trim();if(!O)return;let G=n.typedefMembersByName.get(O)??d(O,{skipIndexSignatures:!0});return G?new Map(G.map((W)=>[W.name,W])):void 0}function jc(n){return m(n,"$bindable")?{init:n.arguments[0],bindable:!0}:{init:n,bindable:!1}}function Gs(n,y){for(let O of y.declarations){if(!m(O.init,"$props"))continue;let G=n.runesPropsDeclarationMetadataByDeclaratorStart.get(O.start),W=qt(n,y),H=G?.props.size?void 0:Vc(n,W?.type);if(O.id.type==="Identifier"){n.wholePropsLocals.add(O.id.name),n.restPropLocals.add(O.id.name);let ee=[...Array.from(H?.values()??[],(U)=>({name:U.name,member:U,typeMetadata:void 0})),...Array.from(G?.props??[],([U,Ee])=>({name:U,member:void 0,typeMetadata:Ee}))];for(let{name:U,member:Ee,typeMetadata:Se}of ee){let xe=cr(n,U,Se?.jsdoc),{type:Le,typeSource:Me,description:Ie,params:Ht,returnType:zt,isFunction:Ft}=pr({explicitType:Se?.type,jsdocType:xe?.type??Ee?.type,jsdocDescription:xe?.description??Ee?.description,jsdocParams:xe?.params,jsdocReturnType:xe?.returnType,initializerIsFunction:!1,isFunctionDeclaration:!1,typedefs:n.typedefs});Un(n,U,xe?.sveldIgnore),Qn(n,U,{name:U,kind:"let",description:Ie,...dr(xe),type:Le,typeSource:Me,value:xe?.explicitDefault,params:Ht,returnType:zt,isFunction:Ft,isFunctionDeclaration:!1,isRequired:!(Se?.optional??Ee?.optional),constant:!1,reactive:!1,source:Se?.source})}continue}if(O.id.type!=="ObjectPattern")continue;let J=O.id.properties.filter((ee)=>{if(ee.type!=="Property"||ee.computed)return!1;if(!l(ee.key))return!1;if(ee.value.type==="Identifier")return!0;return ee.value.type==="AssignmentPattern"&&ee.value.left.type==="Identifier"}).length;for(let ee of O.id.properties){if(ee.type==="RestElement"){if(ee.argument.type==="Identifier")n.restPropLocals.add(ee.argument.name);continue}let U=l(ee.key);if(!U)continue;let Ee,Se;if(ee.value.type==="Identifier")Ee=ee.value.name;else{let Do=ee.value;Ee=Do.left.name,Se=Do.right}if(!Ee)continue;if(Cr(n,U,Ee),U==="children")n.snippetPropLocals.add(Ee);let xe=H?.get(U),Le=G?.props.get(U),Me=cr(n,U,qt(n,ee)??Le?.jsdoc??(J===1&&!H?W:void 0)),{init:Ie,bindable:Ht}=jc(Se),zt=Ie==null?{isFunction:!1}:ln(n,Ie),{value:Ft,type:jt,isFunction:on,defaultValue:Vl}=zt,jl=Le?.type===void 0&&Me?.type===void 0?zt.resolvedType:void 0;Nr(n,zt,U,"props");let{type:Wl,typeSource:Hl,description:Jl,params:Ul,returnType:zl,isFunction:Xl}=pr({explicitType:Le?.type,typeSeed:jt,inferredTypeForSource:jt,jsdocType:Me?.type??xe?.type,jsdocDescription:Me?.description??xe?.description,jsdocParams:Me?.params,jsdocReturnType:Me?.returnType,resolvedType:jl,resolvedDescription:zt.resolvedDescription,resolvedParams:zt.resolvedParams,resolvedReturnType:zt.resolvedReturnType,initializerIsFunction:on,isFunctionDeclaration:!1,typedefs:n.typedefs});if(Ht)n.reactive_vars.add(U);Un(n,U,Me?.sveldIgnore),Qn(n,U,{name:U,...Ee===U?{}:{localName:Ee},kind:"let",description:Jl,...dr(Me),...Ht?{bindable:!0}:{},type:Wl,typeSource:Hl,value:Me?.explicitDefault??Ft,defaultValue:Vl,params:Ul,returnType:zl,isFunction:Xl,isFunctionDeclaration:!1,isRequired:!Ht&&Ie==null&&Le?.optional!==!0&&xe?.optional!==!0,constant:!1,reactive:Ht,source:je(n,ee)})}}}function Wc(n){let O=n.indexOf("EventDispatcher");if(O===-1)return;let G=O+15;while(n[G]===" ")G++;if(n[G]!=="<")return;let W=E(n,G);return W===-1?void 0:n.slice(G+1,W)}var Hc=/^["']|["']$/g,Jc=/\?$/,Uc=/^\{/,zc=/\}$/;function Xc(n){let y=T(n,":");if(y===-1)return;let O=n.slice(0,y).trim().replace(Jc,"").replace(Hc,""),G=n.slice(y+1).trim();if(!O||!G)return;return{name:O,type:G}}function Vs(n,y,O,G){if(y){for(let[ee,U]of Rr(n,y,Bs(n)))n.typedDispatcherEventNames.add(ee),Sn(n,{name:ee,detail:U.type,has_argument:!0,source:U.source});return}let W=an(n,O)?.type,H=W?Wc(W):void 0;if(!H)return;let J=H.trim().replace(Uc,"").replace(zc,"");for(let ee of r(J,";,")){let U=Xc(ee.trim());if(!U)continue;n.typedDispatcherEventNames.add(U.name),Sn(n,{name:U.name,detail:U.type,has_argument:!0,source:G})}}function js(n,y){if(n.syntaxMode!=="runes")return;for(let[O,G]of Array.from(n.events.entries())){if(G.type!=="dispatched")continue;if(y.has(O)||n.forwardedEvents.has(O))continue;let W=`on${O}`,H=n.props.get(W);if(!H)continue;let J=H.type!==void 0||H.params!==void 0||H.returnType!==void 0,ee=G.detail===void 0||G.detail==="undefined"||G.detail==="null"?"() => void":`(detail: ${G.detail}) => void`;n.props.set(W,{...H,description:H.description??G.description,type:J?H.type:ee,typeSource:J?H.typeSource:"inferred",isFunction:!0}),n.events.delete(O)}}var Cn=null;function bn(n){return!n||n==="default"?Cn:n}function Ii(n,y){switch(y.type){case"Identifier":return{value:y.name,replace:!0};case"Literal":return{value:typeof y.value==="string"?JSON.stringify(y.value):String(y.value),replace:!1};case"MemberExpression":return{value:Xo(n,y),replace:!1};case"ObjectExpression":case"TemplateLiteral":return{value:Yt(n,y.start,y.end),replace:!1};default:return{value:void 0,replace:!1}}}function qc(n,y,O){if(!t(y))return null;let G=Fn(n,y.name);if(c(G))return Oi(n,G,O).slot_props;let W=Pn(n,y.name);if(!W)return null;let H=d(W.type);if(!H)return null;let J={};for(let ee of H)J[ee.name]={value:ee.type,replace:!1};return J}function Fi(n,y,O,G,W){let H=qc(n,O,W);if(H)return Object.assign(y,H),!0;if(W)return!1;return Mt(n,"spread-unresolved","slot_props",`Slot props spread a value sveld can't resolve; its shape is widened to "Record<string, any>".`,je(n,G)),!1}function Oi(n,y,O){let G={},W=!1;for(let H of y.properties){if(H.type==="SpreadElement"){if(!Fi(n,G,H.argument,H,O))W=!0;continue}if(H.type!=="Property"||H.computed)continue;let J=l(H.key);if(!J)continue;G[J]=Ii(n,H.value)}return{slot_props:G,hasUnresolvedSpread:W}}function Kc(n,y){if(y.type==="Identifier"){let W=n.propLocalToPublicName.get(y.name);return W?{publicName:W,trackingName:y.name}:null}if(y.type!=="MemberExpression")return null;if(y.object.type!=="Identifier"||!n.wholePropsLocals.has(y.object.name))return null;let{property:O}=y,G;if(!y.computed&&O.type==="Identifier")G=O.name;else if(O.type==="Literal"&&O.value!=null)G=String(O.value);return G?{publicName:G,trackingName:G}:null}function Bi(n){return n.type==="ChainExpression"?n.expression:n}function Ws(n,y){let O=Bi(y),G=Kc(n,O.callee);return G&&{...G,arguments:O.arguments}}function fr(n,{slot_name:y,slot_props:O,slot_props_unresolved_spread:G,slot_fallback:W,slot_description:H,slot_deprecated:J,slot_tags:ee,slot_internal:U,source:Ee}){let Se=bn(y),xe=n.slots.get(Se);n.slots.set(Se,{name:Se,default:xe?.default??Se===Cn,fallback:W||void 0,slot_props:xe?.slot_props??(O===""?void 0:O),slot_props_unresolved_spread:xe?.slot_props_unresolved_spread||G,description:xe?.description||H?.trim()||void 0,deprecated:xe?.deprecated??J,tags:xe?.tags||ee,...xe?.internal||U?{internal:!0}:{},source:Ee||xe?.source})}var Hs=/^@component/,Yc=/\r/g,Qc=new Set(["AssignmentExpression","UpdateExpression","CallExpression","SpreadAttribute","FunctionDeclaration","ImportDeclaration","VariableDeclaration","ExportNamedDeclaration","Comment","SlotElement","RenderTag","OnDirective","BindDirective"]);function Js(n){return n&&"id"in n&&n.id&&"name"in n.id?n.id.name:void 0}function Zc(n,y,O,G){let W=O.callee.type==="Identifier"?O.callee.name:void 0;if(W==="createEventDispatcher"){let H=Js(G);if(H!==void 0)y.dispatcherName=H,y.dispatcherDeclaratorNode=G;y.dispatcherTypeArgument=O.typeArguments?.params?.[0]}if(W==="$host"){let H=Js(G);if(H!==void 0)y.hostLocalNames.add(H)}if(W==="setContext")Ss(n,O,G?.type==="ExpressionStatement"?G:null);if(O.arguments.length>0){if(y.callsWithArguments.push(O),wr(n,O.callee))y.locallyBoundCalls.add(O)}if(W)y.callees.push({name:W,arguments:O.arguments,node:O,nestedBoundDetailNames:ar(n,O.arguments[1])});if(A(O.callee)&&t(O.callee.property)&&O.callee.property.name==="dispatchEvent"&&(m(O.callee.object,"$host")||t(O.callee.object)&&y.hostLocalNames.has(O.callee.object.name))){let H=vs(n,O);if(H)y.hostDispatchedEventNames.add(H.name),y.hostDispatches.push(H)}}function ed(n,y){let O=Array.isArray(y)?y[0]:y;if(O?.type==="Text")return{value:JSON.stringify(O.raw),replace:!1};if(O?.type==="ExpressionTag")return Ii(n,O.expression);return{value:void 0,replace:!1}}function td(n,y){let O=y.attributes.find((Ee)=>("name"in Ee)&&Ee.name==="name"),G=O&&"value"in O?O.value:void 0,W=Array.isArray(G)?G[0]:void 0,H=W?.type==="Text"?W.data:void 0,J={},ee=!1;for(let Ee of y.attributes){if(Ee.type==="SpreadAttribute"){let Se=n.jsDocSlots.has(bn(H));if(!Fi(n,J,Ee.expression,Ee,Se))ee=!0;continue}if(!("value"in Ee)||Ee.name==="name"||Ee.value===!0)continue;J[Ee.name]=ed(n,Ee.value)}let U=y.fragment.nodes.map(({start:Ee,end:Se})=>Yt(n,Ee,Se)??"").join("").trim();n.renderedSlots.add(bn(H)),fr(n,{slot_name:H,slot_props:J,slot_props_unresolved_spread:ee||void 0,slot_fallback:U,source:je(n,y)})}function nd(n,y){let O=Ws(n,y.expression);if(!O){let{callee:U}=Bi(y.expression);if(A(U)&&t(U.object)&&n.wholePropsLocals.has(U.object.name))n.slotsUntracked=!0;return}let G=O.publicName==="children"?void 0:O.publicName,[W,...H]=O.arguments,J,ee=!1;if(W===void 0)J={};else if(H.length===0&&W.type==="ObjectExpression"){let U=Oi(n,W,n.jsDocSlots.has(bn(G)));J=U.slot_props,ee=U.hasUnresolvedSpread}if(n.renderedSlots.add(bn(G)),J!==void 0)fr(n,{slot_name:G,slot_props:J,slot_props_unresolved_spread:ee||void 0,source:je(n,y)});if(J!==void 0||n.slots.has(G??Cn))n.snippetPropLocals.add(O.trackingName)}function rd(n,y,O){let G=y.name;if(y.expression!=null||!G)return;if(O==null||!("name"in O)||typeof O.name!=="string"||!O.name)return;let W=B(O.type)?{type:"InlineComponent",name:O.name}:{type:"Element",name:O.name};n.forwardedEvents.set(G,W);let H=n.events.get(G),J=n.eventDescriptions.get(G);if(!H)n.events.set(G,{type:"forwarded",name:G,element:W,description:J,deprecated:void 0,source:je(n,y)});else if(H.type==="forwarded"&&J&&!H.description)n.events.set(G,{...H,description:J,source:H.source||je(n,y)})}function id(n){let{expression:y}=n;if(y.type==="Identifier")return{name:y.name,indexed:!1};if(y.type!=="MemberExpression")return;let O=y;while(O.type==="MemberExpression")O=O.object;if(O.type!=="Identifier")return;let G=n.name==="this"&&y.computed&&y.object.type==="Identifier";return{name:O.name,indexed:G}}function od(n,y,O,G){if(!O||!(_(O.type)||B(O.type)))return;let W=id(y);if(!W)return;let H=kr(n,W.name);if(!H)return;n.reactive_vars.add(H);let J=y.expression.type==="MemberExpression";if(y.name!=="this"||J&&!W.indexed)return;if(!("name"in O)||typeof O.name!=="string")return;let ee=W.indexed?"indexed":"direct",U=n.bindings.get(H)??{elements:[],components:[],target:ee};if(U.target!==ee)U.target="mixed";if(_(O.type)){let Ee=O.name,Se="tag"in O&&t(O.tag)?O.tag.name:void 0;if(!U.elements.some((Le)=>Le.tag===Ee&&Le.namespace===G&&Le.tagLocal===Se))U.elements.push({tag:Ee,namespace:G,...Se?{tagLocal:Se}:{}})}else{let Ee=O.type==="Component"?Q(n,O.name):void 0;if(!Ee)return;if(!U.components.includes(O.name))U.components.push(O.name);n.additionalImportedTypes.set(O.name,{localName:O.name,...Ee})}n.bindings.set(H,U)}function Us(n){let y={dispatcherName:void 0,dispatcherDeclaratorNode:void 0,dispatcherTypeArgument:void 0,hostLocalNames:new Set,hostDispatchedEventNames:new Set,hostDispatches:[],callees:[],callsWithArguments:[],locallyBoundCalls:new Set};ls(n),n.activeScopes.push(n.componentScope);let O=ps(n),G=new WeakMap,W=n.parsed?.options?.namespace,H=[W==="svg"||W==="mathml"?W:"html"],J=new Map,ee={enter(U,Ee){if(le(U.type))return p;let Se=cs(n,O,U);if(Se)n.activeScopes.push(Se);if(_(U.type)){let xe="name"in U?U.name:void 0,Le=xe==="svg"?"svg":xe==="math"?"mathml":H[H.length-1];G.set(U,Le),H.push(xe==="foreignObject"?"html":Le)}if(!Qc.has(U.type))return;switch(U.type){case"AssignmentExpression":Di(n,U.left);break;case"UpdateExpression":Di(n,U.argument);break;case"CallExpression":Zc(n,y,U,Ee);break;case"SpreadAttribute":{let xe=U.expression.type==="Identifier"?U.expression.name:void 0,Le=(xe!==void 0&&!Nn(n,xe)?J.get(xe):void 0)??xe,Me=n.restPropLocals.has(Le??"");if(Le==="$$restProps"||Me)ws(n,Ee,U);if((Le==="$$props"||Me)&&Ee&&B(Ee.type))n.slotsUntracked=!0;break}case"FunctionDeclaration":if(U.id?.name)n.funcDecls.set(U.id.name,U);break;case"ImportDeclaration":Y(n,U);break;case"VariableDeclaration":if(n.vars.add(U),Ee?.type==="Program"&&U.declarations.some((xe)=>m(xe.init,"$props")))Gs(n,U);break;case"ExportNamedDeclaration":Ns(n,U,Ee?.type==="Program"?Ee:null);break;case"Comment":{let xe=U.data.trim();if(Hs.test(xe))n.componentComment=xe.replace(Hs,"").replace(Yc,""),n.componentCommentSource=je(n,U);break}case"SlotElement":td(n,U);break;case"RenderTag":nd(n,U);break;case"OnDirective":rd(n,U,Ee);break;case"BindDirective":od(n,U,Ee,(Ee&&G.get(Ee))??"html");break}},leave(U){if(_(U.type))H.pop();if($n(U))n.activeScopes.pop(),ds(O,U)}};if(n.parsed?.instance)o(n.parsed.instance,ee);if(J=Ls(n,n.parsed?.instance),n.parsed?.fragment)o(n.parsed.fragment,ee);return y}var $i=new Set("abstract accessor arguments as asserts async await break case catch class const continue debugger declare default delete do else enum eval export extends false finally for function get global if implements import in infer instanceof interface intrinsic is keyof let module namespace new null of out override package private protected public readonly return satisfies set static super switch this throw true try type typeof unique var void while with yield".split(" ")),sd=new Set("any bigint boolean false never null number object string symbol true undefined unknown void".split(" ")),ad=new Set("get set new readonly static public private protected".split(" "));function zs(n){return n>=97&&n<=122||n>=65&&n<=90||n===95||n===36}function Mr(n){return n>=48&&n<=57}function Gi(n){return zs(n)||Mr(n)}class Xs{text;pos=0;constructor(n){this.text=n}readAll(){if(!this.type())return!1;return this.peek(),this.pos===this.text.length}peek(){let n=this.text,y=this.pos,O=n.charCodeAt(y);while(O===32||O===9)O=n.charCodeAt(++y);return this.pos=y,O}eat(n){if(this.peek()!==n.charCodeAt(0))return!1;return this.pos++,!0}word(){let n=this.pos;return this.skipWord()?this.text.slice(n,this.pos):void 0}skipWord(){if(!zs(this.peek()))return!1;let n=this.pos+1;while(Gi(this.text.charCodeAt(n)))n++;return this.pos=n,!0}keyword(n){this.peek();let y=this.pos+n.length;if(!this.text.startsWith(n,this.pos)||Gi(this.text.charCodeAt(y)))return!1;return this.pos=y,!0}name(){let n=this.word();return n!==void 0&&!$i.has(n)}string(){let n=this.peek();if(n!==34&&n!==39)return!1;let y=this.text;for(let O=this.pos+1;O<y.length;O++){let G=y.charCodeAt(O);if(G===n)return this.pos=O+1,!0;if(G===92||G===10||G===13||G===8232||G===8233)return!1}return!1}number(){let n=this.text,y=this.pos;if(n.charCodeAt(y)===45)y++;let O=y;while(Mr(n.charCodeAt(y)))y++;if(y===O||y-O>1&&n.charCodeAt(O)===48)return!1;if(n.charCodeAt(y)===46){let W=++y;while(Mr(n.charCodeAt(y)))y++;if(y===W)return!1}let G=n.charCodeAt(y);if(Gi(G)||G===46)return!1;return this.pos=y,!0}type(){if(this.peek()===40){let n=this.pos;if(this.functionType())return!0;this.pos=n}do do if(!this.operatorType())return!1;while(this.eat("&"));while(this.eat("|"));return!0}operatorType(){if(this.keyword("keyof"))return this.operatorType();if(!this.primaryType())return!1;while(this.eat("[")){if(this.eat("]"))continue;if(!this.type()||!this.eat("]"))return!1}return!0}primaryType(){let n=this.peek();if(n===40)return this.pos++,this.type()&&this.eat(")");if(n===123)return this.objectType();if(n===91)return this.tupleType();if(n===34||n===39)return this.string();if(n===45||Mr(n))return this.number();let y=this.word();if(y===void 0)return!1;if(y==="typeof")return this.typeQuery();if(y==="import")return this.importType(!0);if(sd.has(y)){let O=this.peek();return O!==46&&O!==60}if($i.has(y))return!1;while(this.eat("."))if(!this.skipWord())return!1;return!this.eat("<")||this.typeArguments()}typeArguments(){do if(!this.type())return!1;while(this.eat(","));return this.eat(">")}typeQuery(){if(this.keyword("import"))return this.importType(!1);do if(!this.name())return!1;while(this.eat("."));return!0}importType(n){if(!this.eat("(")||!this.string()||!this.eat(")"))return!1;while(this.eat("."))if(!this.name())return!1;return!n||!this.eat("<")||this.typeArguments()}objectType(){this.pos++;while(!this.eat("}")){if(!this.typeMember())return!1;if(!this.eat(";")&&!this.eat(",")&&this.peek()!==125)return!1}return!0}typeMember(){let n=this.peek();if(this.eat("[")){let y=this.peek();if(y===34||y===39){if(!this.string()||!this.eat("]"))return!1}else return this.name()&&this.eat(":")&&this.type()&&this.eat("]")&&this.eat(":")&&this.type()}else if(n===34||n===39){if(!this.string())return!1}else{let y=this.word();if(y===void 0||ad.has(y))return!1}return this.eat("?"),this.eat(":")&&this.type()}tupleType(){if(this.pos++,this.eat("]"))return!0;do if(!this.type())return!1;while(this.eat(","));return this.eat("]")}functionType(){if(this.pos++,!this.eat(")")){let n=new Set;for(;;){this.peek();let y=this.text.startsWith("...",this.pos);if(y)this.pos+=3;let O=this.word();if(O===void 0||$i.has(O)||n.has(O))return!1;if(n.add(O),!y)this.eat("?");if(!this.eat(":")||!this.type())return!1;if(y||!this.eat(","))break}if(!this.eat(")"))return!1}if(this.peek(),!this.text.startsWith("=>",this.pos))return!1;return this.pos+=2,this.type()}}function ld(n){return new Xs(n).readAll()}var pd=s.extend(pe);function Ir(n,y={}){return ld(n)||cd(n,y.inline??!1)}function cd(n,y){let O=!1,G=new pd(y?{ecmaVersion:16,sourceType:"module",onComment:(W,H,J,ee)=>{if(!W&&ee===n.length)O=!0}}:{ecmaVersion:16,sourceType:"module"},n);try{return G.parseWholeType(),!O}catch(W){if(W instanceof SyntaxError)return!1;throw W}}var Vi=/<!--[\s\S]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/y;function Or(n){return n.charCodeAt(0)===65279?n.slice(1):n}function fn(n){return n>=48&&n<=57}function Qt(n){if(n===32||n<=13&&n>=9)return!0;if(n<160)return!1;return n===160||n===5760||n>=8192&&n<=8202||n===8232||n===8233||n===8239||n===8287||n===12288||n===65279}function Wt(n,y){let O=y;while(O<n.length&&Qt(n.charCodeAt(O)))O++;return O}function Br(n){let y=n.indexOf("<");while(y!==-1){let O=n.charCodeAt(y+1);if(O===33||O===115){Vi.lastIndex=y;let G=Vi.exec(n);if(G){if(O===115)return G[2]==="ts";y=n.indexOf("<",Vi.lastIndex);continue}}y=n.indexOf("<",y+1)}return!1}function $r(n,y){let O=n.indexOf("</script",y);while(O!==-1){if(n.charCodeAt(Wt(n,O+8))===Fr)return O;O=n.indexOf("</script",O+8)}return-1}function Gr(n,y){return Wt(n,y+8)+1}var dd=new Set("area base br col command embed hr img input keygen link meta param source track wbr".split(" "));function mr(n){return dd.has(n)||n.charCodeAt(0)===33&&n.toLowerCase()==="!doctype"}function Vr(n,y){let O=y;while(O<n.length){let G=n.charCodeAt(O);if(G===47&&n.charCodeAt(O+1)===42){let W=n.indexOf("*/",O+2);O=W===-1?n.length:W+2}else if(G===34||G===39){O++;while(O<n.length){let W=n.charCodeAt(O);if(W===G||W===10)break;O+=W===92?2:1}O++}else if(G===60&&n.startsWith("</style",O))break;else O++}return Math.min(O,n.length)}var ud=34,fd=39,qs=47,Ks=61,Fr=62,cn=(n)=>n===ud||n===fd;function kn(n,y,O){let G=y;for(;G<n.length;G++){let W=n.charCodeAt(G);if(Qt(W)||W===qs||W===Fr)break;if(O&&(cn(W)||W===Ks))break}return G}function jr(n,y){let O=n.charCodeAt(y);return Qt(O)||cn(O)||O===Ks||O===60||O===Fr||O===96||O===qs&&n.charCodeAt(y+1)===Fr}var wn=0,Oe=1,mn=2,Bt=3,Zs=0,Ys=1,ea=2,yr=3,Ui=4,Gn=4,Hi=5,Wr=6,ta=7,md={await:Oe,case:Oe,default:Oe,delete:Oe,extends:Oe,in:Oe,instanceof:Oe,new:Oe,of:Oe,return:Oe,throw:Oe,typeof:Oe,void:Oe,yield:Oe,do:mn,else:mn,finally:mn,try:mn,for:Gn,if:Gn,while:Gn,with:Gn,import:Hi,export:Wr,require:ta},na=10,Ji=Array(zi(128,0)).fill(null);for(let n of Object.entries(md)){let y=zi(n[0].charCodeAt(0),n[0].length),O=Ji[y]??[];O.push(n),Ji[y]=O}function zi(n,y){return n*(na+1)+y}function ra(n,y,O){let G=n.charCodeAt(y);if(G>=128||O-y>na)return Bt;let W=zi(G,O-y),H=Ji[W];if(H===null)return Bt;for(let J=0;J<H.length;J++)if(n.startsWith(H[J][0],y))return H[J][1];return Bt}var ia=new Uint8Array(128);for(let n of["az","AZ","09","__","$$","\\\\"])for(let y=n.charCodeAt(0);y<=n.charCodeAt(1);y++)ia[y]=1;function Ln(n){return n>=128?!Qt(n):ia[n]===1}function oa(n,y,O,G=!1){gd(n,yd(n,y,G),y,G,O,void 0,void 0)}function gd(n,y,O,G,W,H,J){let ee=[],U=n.startsWith("#!")?la(n,2):0,Ee=wn,Se=!1,xe=!1,Le=-1,Me=()=>{if(Ee=wn,ee.length===0)Le=-1};while(U<=y){let Ie=n.charCodeAt(U);if(Ie===32||Ie===10||Qt(Ie)){U++;continue}if(Ie===47){let Ft=Xi(n,U);if(Ft!==-1){U=Ft;continue}}let Ht=Se,zt=xe;if(Se=!1,xe=!1,Ln(Ie)||Ie===35){let Ft=U;U=pa(n,U+1);let jt=Ht?Bt:ra(n,Ft,U);if(J!==void 0&&(jt===Hi||jt===ta))J(Ft,Ee===wn||Ee===Bt);if(W!==void 0&&ee.length===0&&(jt===Wr?O||ua(n,U,G):jt===Hi&&da(n,U)))U=Math.max(U,W(Le!==-1&&jt===Wr?Le:Ft,Ft)),Me();else if(jt===Wr)Ee=mn;else if(jt===Gn)xe=!0,Ee=Bt;else Ee=jt===Oe||jt===mn?jt:Bt;continue}switch(U++,Ie){case 34:case 39:{let Ft=U-1;U=qi(n,U,Ie),H?.(Ft,U,!1),Ee=Bt;break}case 96:{let Ft=U;U=Jr(n,U,ee),H?.(Ft,Qs(n,U),!0),Ee=n.charCodeAt(U-1)===123?Oe:Bt;break}case 47:{let Ft=Ee===Bt?-1:ca(n,U);if(Ft===-1)Ee=Oe;else U=Hr(n,Ft),Ee=Bt;break}case 40:ee.push(zt?Ys:Zs),Ee=Oe;break;case 41:Ee=ee.pop()===Ys?mn:Bt;break;case 123:ee.push(Ee===Oe?yr:ea),Ee=wn;break;case 125:{let Ft=ee.pop();if(Ft===Ui){let jt=U;U=Jr(n,U,ee),H?.(jt,Qs(n,U),!0),Ee=n.charCodeAt(U-1)===123?Oe:Bt}else if(Ft===yr)Ee=Bt;else Me();break}case 59:Me();break;case 44:Ee=ee[ee.length-1]===yr?wn:Oe;break;case 93:Ee=Bt;break;case 46:if(fn(n.charCodeAt(U)))U=Hr(n,U),Ee=Bt;else if(n.startsWith("..",U))U+=2,Ee=Oe;else Se=!0,Ee=Oe;break;case 63:if(n.charCodeAt(U)===46&&!fn(n.charCodeAt(U+1)))U++,Se=!0;Ee=Oe;break;case 33:Ee=Ee===Bt&&!Qt(n.charCodeAt(U-2))?Bt:Oe;break;case 43:case 45:if(n.charCodeAt(U)===Ie&&Ee===Bt)U++;else Ee=Oe;break;case 61:if(Ee=n.charCodeAt(U)===62?mn:Oe,Ee===mn)U++;break;case 64:if(ee.length===0&&Le===-1)Le=U-1;Ee=Oe;break;default:Ee=Oe}}}function sa(n,y,O){let G=n.length,W=[],H=y,J=Oe,ee=!1;while(H<G){let U=n.charCodeAt(H);if(U===32||U===10||Qt(U)){H++;continue}if(U===47){let Se=Xi(n,H);if(Se!==-1){H=Se;continue}}let Ee=ee;if(ee=!1,Ln(U)||U===35){let Se=H;if(H=pa(n,H+1),!Ee&&O?.(Se,H))return-1;let xe=Ee?Bt:ra(n,Se,H);J=xe===Oe||xe===mn||xe===Gn?Oe:Bt;continue}switch(H++,U){case 34:case 39:H=qi(n,H,U),J=Bt;break;case 96:H=Jr(n,H,W),J=n.charCodeAt(H-1)===123?Oe:Bt;break;case 47:{let Se=J===Bt?-1:ca(n,H);if(Se===-1)J=Oe;else H=Hr(n,Se),J=Bt;break}case 40:W.push(Zs),J=Oe;break;case 41:if(W.length===0)return H-1;W.pop(),J=Bt;break;case 123:W.push(J===Oe?yr:ea),J=wn;break;case 125:{if(W.length===0)return H-1;let Se=W.pop();if(Se===Ui)H=Jr(n,H,W),J=n.charCodeAt(H-1)===123?Oe:Bt;else J=Se===yr?Bt:wn;break}case 93:J=Bt;break;case 46:if(fn(n.charCodeAt(H)))H=Hr(n,H),J=Bt;else if(n.startsWith("..",H))H+=2,J=Oe;else ee=!0,J=Oe;break;case 63:if(n.charCodeAt(H)===46&&!fn(n.charCodeAt(H+1)))H++,ee=!0;J=Oe;break;case 33:J=J===Bt&&!Qt(n.charCodeAt(H-2))?Bt:Oe;break;case 43:case 45:if(n.charCodeAt(H)===U&&J===Bt)H++;else J=Oe;break;case 61:if(n.charCodeAt(H)===62)H++;J=Oe;break;default:J=Oe}}return G}function aa(n){return n===10||n===13||n===8232||n===8233}function la(n,y){for(let O=y;O<n.length;O++)if(aa(n.charCodeAt(O)))return O;return n.length}function Xi(n,y){let O=n.charCodeAt(y+1);if(O===47)return la(n,y+2);if(O!==42)return-1;let G=n.indexOf("*/",y+2);return G===-1?n.length:G+2}function pa(n,y){let O=y;while(O<n.length){let G=n.charCodeAt(O);if(G===92)O+=2;else if(Ln(G))O++;else break}return O}function Hr(n,y){let O=y;while(O<n.length&&Ln(n.charCodeAt(O)))O++;return O}function qi(n,y,O){for(let G=y;G<n.length;G++){let W=n.charCodeAt(G);if(W===O)return G+1;if(W===92)G+=n.startsWith(`\r
29
+ `,G+1)?2:1;else if(W===10||W===13)return G}return n.length}function Jr(n,y,O){for(let G=y;G<n.length;G++){let W=n.charCodeAt(G);if(W===96)return G+1;if(W===92)G++;else if(W===36&&n.charCodeAt(G+1)===123)return O.push(Ui),G+2}return n.length}function Qs(n,y){let O=n.charCodeAt(y-1);if(O===96)return y-1;if(O===123&&n.charCodeAt(y-2)===36)return y-2;return y}function ca(n,y){let O=!1;for(let G=y;G<n.length;G++){let W=n.charCodeAt(G);if(aa(W))return-1;if(W===92)G++;else if(W===91)O=!0;else if(W===93)O=!1;else if(W===47&&!O)return G+1}return-1}function gr(n,y){let O=y;while(O<n.length){let G=n.charCodeAt(O);if(Qt(G)){O++;continue}let W=G===47?Xi(n,O):-1;if(W===-1)return O;O=W}return n.length}function ji(n,y,O){return n.charCodeAt(y)===O.charCodeAt(0)&&n.startsWith(O,y)&&!Ln(n.charCodeAt(y+O.length))}function da(n,y){let O=n.charCodeAt(gr(n,y));return O!==40&&O!==46}function ua(n,y,O){let G=gr(n,y);if(ji(n,G,"import"))return!0;if(ji(n,G,"type"))G=gr(n,G+4);let W=n.charCodeAt(G);if(W===42)return!0;if(W!==123)return!1;if(O)return!0;for(G++;G<n.length;G++){let H=n.charCodeAt(G);if(H===125)break;if(H===34||H===39)G=qi(n,G+1,H)-1;else if(H===47)G=Math.max(G,gr(n,G)-1)}return ji(n,gr(n,G+1),"from")}var Wi=/import|export/g;function yd(n,y,O){let G=-1;Wi.lastIndex=0;for(let W=Wi.exec(n);W!==null;W=Wi.exec(n)){let H=W.index,J=H+6;if(!Ln(n.charCodeAt(H-1))&&!Ln(n.charCodeAt(J))&&(n.charCodeAt(H)===105?da(n,J):y||ua(n,J,O)))G=H}return G}var fa={li:["li"],dt:["dt","dd"],dd:["dt","dd"],p:"address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul".split(" "),rt:["rt","rp"],rp:["rt","rp"],optgroup:["optgroup"],option:["option","optgroup"],thead:["tbody","tfoot"],tbody:["tbody","tfoot"],tfoot:["tbody"],tr:["tr","tbody"],td:["td","th","tr"],th:["td","th","tr"]};function Ur(n,y){return Object.hasOwn(fa,n)&&fa[n].includes(y)}var ma="{",ha=60,Yi=62,_n=47,Ea=61,Er=123,ga=/\s*>/y,Ki=/<\/textarea(\s[^>]*)?>/iy,hd=["cript","tyle","velte:options"],ya="</svelte:options";function Qi(n){let y=Or(n).trimEnd();return Sa(y,Br(y),null)}function Ta(n){let y={tags:[],comments:[]};return Sa(n,!1,y),y}function Sa(n,y,O){let G={typescript:y,instance:null,module:null,css:null,options:null},W=Ed(n),H=[],J=0;while(J<=W){let ee=n.charCodeAt(J);if(ee===ha)J=Cd(n,J,H,G,O);else if(ee===Er)J=Sd(n,J,H);else J++}return G}function Ed(n){let y=-1,O=n.indexOf("<s");while(O!==-1){let G=Td(n,O+2);if(G!==-1){let W=n.charCodeAt(G);if(G===n.length||Qt(W)||W===_n||W===Yi)y=O}O=n.indexOf("<s",O+2)}return y}function Td(n,y){for(let O of hd)if(n.startsWith(O,y))return y+O.length;return-1}function Tr(n,y){return Math.min(sa(n,y)+1,n.length)}function Sd(n,y,O){let G=Wt(n,y+1),W=n.charCodeAt(G),H=n.charCodeAt(G+1);if(W===35||W===58||W===64||W===_n&&H!==_n&&H!==42){G++;while(G<n.length){let J=n.charCodeAt(G);if(J<97||J>122)break;G++}if(W===35)O.push(ma);else if(W===_n){let J=O.lastIndexOf(ma);if(J!==-1)O.length=J}}return Tr(n,G)}function Cd(n,y,O,G,W){if(n.startsWith("!--",y+1)){let Se=n.indexOf("-->",y+4),xe=Se===-1?n.length:Se+3;if(W&&O.length===0)W.comments.push(y,xe);return xe}if(n.charCodeAt(y+1)===_n){let Se=y+2,xe=n.slice(Se,kn(n,Se,!1)),Le=O.lastIndexOf(xe);if(Le!==-1)O.length=Le;return hr(n,Wt(n,Se+xe.length))}let H=n.slice(y+1,kn(n,y+1,!1)),J=Wt(n,y+1+H.length),ee=O[O.length-1];if(ee!==void 0&&Ur(ee,H))O.pop();let U=O.length===0;if(W&&U&&(H==="script"||H==="style"||H==="svelte:options"))W.tags.push(y);if(U&&(H==="script"||H==="style")){let Se=[];if(J=hr(n,vd(n,J,Se)),H==="script"){let Le=bd(n,y,J,Se);if(Le.context==="module")G.module??=Le;else G.instance??=Le;return Le.end}let xe=xd(n,y,J,Se);return G.css??=xe,xe.end}let Ee=U&&H==="svelte:options"?[]:null;if(J=Pd(n,J,Ee),n.charCodeAt(J)===_n||mr(H)){if(n.charCodeAt(J)===_n)J++;J=hr(n,J)}else{if(J=hr(n,J),H==="textarea")return Ad(n,J);if(H==="script"||H==="style"){let Se=`</${H}>`,xe=n.indexOf(Se,J);return xe===-1?n.length:xe+Se.length}if(Ee&&n.startsWith(ya,J))J=hr(n,Wt(n,J+ya.length));else return O.push(H),J}if(Ee)G.options??={start:y,end:J,attributes:Ee};return J}function hr(n,y){return n.charCodeAt(y)===Yi?y+1:y}function bd(n,y,O,G){let W=$r(n,O),H=W===-1?n.length:W,J=G.some((ee)=>ee.name==="module"||ee.name==="context");return{start:y,end:W===-1?n.length:Gr(n,W),context:J?"module":"default",attributes:G,content:{start:O,end:H}}}function xd(n,y,O,G){let W=Vr(n,O),H=W;if(n.startsWith("</style",H)){H+=7,ga.lastIndex=H;let J=ga.exec(n);if(J)H+=J[0].length}return{start:y,end:H,attributes:G,content:{start:O,end:W}}}function vd(n,y,O){let G=y;for(;;){let W=G,H=kn(n,G,!0);if(H===W)return G;G=H;let J=!0;if(n.charCodeAt(G)===Ea){let ee=Wt(n,G+1),U=n.charCodeAt(ee),Ee=-1;if(cn(U)){let xe=n.indexOf(n[ee],ee+1);if(xe!==-1)Ee=xe+1}if(Ee===-1){Ee=ee;while(Ee<n.length&&n.charCodeAt(Ee)!==Yi&&!Qt(n.charCodeAt(Ee)))Ee++}let Se=cn(U)?1:0;J=n.slice(ee+Se,Ee-Se),G=Ee}O.push({name:n.slice(W,H),value:J,start:W,end:G}),G=Wt(n,G)}}function Pd(n,y,O){let G=y;for(;;){for(;;){if(n.startsWith("/*",G)){let U=n.indexOf("*/",G+2);G=U===-1?n.length:U+2}else if(n.startsWith("//",G)){let U=n.indexOf(`
30
+ `,G+2);G=U===-1?n.length:U}else break;G=Wt(n,G)}let W=G;if(n.charCodeAt(G)===Er){G=Wt(n,Tr(n,G+1));continue}let H=kn(n,G,!0);if(H===W)return G;let J=H,ee=!0;if(G=Wt(n,H),n.charCodeAt(G)===Ea){let U=Wt(n,G+1);J=n.startsWith("/>",U)?U+1:Dd(n,U),ee=cn(n.charCodeAt(U))?n.slice(U+1,Math.max(U+1,J-1)):n.slice(U,J),G=Wt(n,J)}O?.push({name:n.slice(W,H),value:ee,start:W,end:J})}}function Dd(n,y){let O=n.charCodeAt(y);if(cn(O)){let W=y+1;while(W<n.length){let H=n.charCodeAt(W);if(H===O)return W+1;W=H===Er?Tr(n,W+1):W+1}return n.length}let G=y;while(G<n.length&&!jr(n,G))G=n.charCodeAt(G)===Er?Tr(n,G+1):G+1;return G}function Ad(n,y){let O=y;while(O<n.length){let G=n.charCodeAt(O);if(G===ha){if(Ki.lastIndex=O,Ki.test(n))return Ki.lastIndex}O=G===Er?Tr(n,O+1):O+1}return n.length}var Ca={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",bgsound:"HTMLUnknownElement",blink:"HTMLUnknownElement",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",isindex:"HTMLUnknownElement",kbd:"HTMLElement",keygen:"HTMLUnknownElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",listing:"HTMLPreElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",multicol:"HTMLUnknownElement",nav:"HTMLElement",nextid:"HTMLUnknownElement",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",spacer:"HTMLUnknownElement",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",xmp:"HTMLPreElement"},ba={a:"SVGAElement",animate:"SVGAnimateElement",animateMotion:"SVGAnimateMotionElement",animateTransform:"SVGAnimateTransformElement",circle:"SVGCircleElement",clipPath:"SVGClipPathElement",defs:"SVGDefsElement",desc:"SVGDescElement",ellipse:"SVGEllipseElement",feBlend:"SVGFEBlendElement",feColorMatrix:"SVGFEColorMatrixElement",feComponentTransfer:"SVGFEComponentTransferElement",feComposite:"SVGFECompositeElement",feConvolveMatrix:"SVGFEConvolveMatrixElement",feDiffuseLighting:"SVGFEDiffuseLightingElement",feDisplacementMap:"SVGFEDisplacementMapElement",feDistantLight:"SVGFEDistantLightElement",feDropShadow:"SVGFEDropShadowElement",feFlood:"SVGFEFloodElement",feFuncA:"SVGFEFuncAElement",feFuncB:"SVGFEFuncBElement",feFuncG:"SVGFEFuncGElement",feFuncR:"SVGFEFuncRElement",feGaussianBlur:"SVGFEGaussianBlurElement",feImage:"SVGFEImageElement",feMerge:"SVGFEMergeElement",feMergeNode:"SVGFEMergeNodeElement",feMorphology:"SVGFEMorphologyElement",feOffset:"SVGFEOffsetElement",fePointLight:"SVGFEPointLightElement",feSpecularLighting:"SVGFESpecularLightingElement",feSpotLight:"SVGFESpotLightElement",feTile:"SVGFETileElement",feTurbulence:"SVGFETurbulenceElement",filter:"SVGFilterElement",foreignObject:"SVGForeignObjectElement",g:"SVGGElement",image:"SVGImageElement",line:"SVGLineElement",linearGradient:"SVGLinearGradientElement",marker:"SVGMarkerElement",mask:"SVGMaskElement",metadata:"SVGMetadataElement",mpath:"SVGMPathElement",path:"SVGPathElement",pattern:"SVGPatternElement",polygon:"SVGPolygonElement",polyline:"SVGPolylineElement",radialGradient:"SVGRadialGradientElement",rect:"SVGRectElement",script:"SVGScriptElement",set:"SVGSetElement",stop:"SVGStopElement",style:"SVGStyleElement",svg:"SVGSVGElement",switch:"SVGSwitchElement",symbol:"SVGSymbolElement",text:"SVGTextElement",textPath:"SVGTextPathElement",title:"SVGTitleElement",tspan:"SVGTSpanElement",use:"SVGUseElement",view:"SVGViewElement"},xa=new Set(["a","annotation","annotation-xml","maction","math","merror","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mphantom","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","semantics"]);function zr(n,y){return Object.hasOwn(n,y)?n[y]:void 0}function va(n,y="html"){if(y==="svg")return zr(ba,n)??"SVGElement";if(y==="mathml")return xa.has(n)?"MathMLElement":zr(Ca,n)??"MathMLElement";return zr(Ca,n)??zr(ba,n)??(xa.has(n)?"MathMLElement":"HTMLElement")}var Pa=new Map;function Da(n){let y=Pa.get(n);if(y!==void 0)return y;let O=Ir(n,{inline:!0});return Pa.set(n,O),O}var Nd=/^["']|["']$/g,kd=/^([\w$]+)\s+extends\s/,wd=/^\{\s*\}$/;function Vn(n){return Array.from(n.values())}function Zi(n,y){if(!n||typeof n!=="object"||!("type"in n)){y.dynamic=!0;return}if(n.type==="Literal"){let{value:O}=n;if(typeof O==="string"||typeof O==="number")y.names.push(String(O));else y.dynamic=!0}else if(n.type==="ConditionalExpression"){let O=n;Zi(O.consequent,y),Zi(O.alternate,y)}else if(n.type==="TemplateLiteral"){let O=n.quasis.map((G)=>G.value.cooked??G.value.raw);if(O.length===1)y.names.push(O[0]);else y.patterns.push(new RegExp(`^${O.map(R).join("[^]*")}$`))}else y.dynamic=!0}function Ld(n,y){let{dispatcherName:O,callees:G}=y,W=new Set(y.hostDispatchedEventNames),H=[],J=!1;for(let ee of y.hostDispatches)Ps(n,ee);if(O!==void 0){Vs(n,y.dispatcherTypeArgument,O,je(n,y.dispatcherDeclaratorNode));for(let ee of G){if(ee.name!==O||ee.arguments.length===0)continue;let U={names:[],patterns:[],dynamic:!1};if(Zi(ee.arguments[0],U),H.push(...U.patterns),J||=U.dynamic,U.names.length===0)continue;let Ee=ee.arguments[1],Se=ki(Ni(n,ee.nestedBoundDetailNames),Ee);for(let xe of U.names)Sn(n,{name:xe,detail:Se,has_argument:Boolean(Ee),source:je(n,ee.node)}),W.add(xe)}}for(let[ee,U]of n.forwardedEvents){let Ee=n.events.get(ee);if(Ee&&Ee.type==="dispatched"&&!W.has(ee)){let Se=n.eventDescriptions.get(ee),xe={type:"forwarded",name:ee,element:U,description:Se,deprecated:Ee.deprecated,tags:Ee.tags,source:Ee.source};if(Ee.internal)xe.internal=!0;if(Ee.detail!==void 0&&Ee.detail!=="undefined")xe.detail=Ee.detail;n.events.set(ee,xe)}}return{names:W,mayDispatch:(ee)=>J||H.some((U)=>U.test(ee))}}function _d(n){return`(typeof ${n} extends abstract new (...args: any) => infer I ? I : typeof ${n} extends (...args: any) => infer R ? R : never)`}function Aa(n,y){let O=[...Na(n,y),...n.components.sort().map(_d)].join(" | ");return n.target==="indexed"?`(null | ${O})[]`:`null | ${O}`}function Na(n,y){return n.elements.sort((O,G)=>O.tag<G.tag?-1:O.tag>G.tag?1:0).map(({tag:O,namespace:G,tagLocal:W})=>{let H=W&&y?.get(W);return H?`HTMLElementTagNameMap[${H}]`:va(O,G)})}function Rd(n){let y=n.syntaxMode==="runes"?new Set(Array.from(n.snippetPropLocals,(O)=>pi(n,O))):new Set;return Vn(n.props).filter((O)=>!(y.has(O.name)&&n.slots.has(O.name==="children"?Cn:O.name))).map((O)=>{let G=O.reactive||n.reactive_vars.has(O.name),W=n.bindings.get(O.name),H=W?.target==="indexed"&&O.type!==void 0&&!O.type.endsWith("[]"),J=O.typeSource==="typescript"||O.typeSource==="jsdoc";if(!W||W.target==="mixed"||H||J)return{...O,reactive:G};return{...O,type:Aa(W),typeSource:"inferred",reactive:G}})}function Md(n){return Vn(n.slots).map((y)=>{let{slot_props_unresolved_spread:O,...G}=y;if(!y.slot_props)return G;if(typeof y.slot_props==="string")return wd.test(y.slot_props)?{...G,slot_props:"Record<string, never>"}:G;let W=[];for(let[ee,U]of Object.entries(y.slot_props)){if(U.replace&&U.value!==void 0)U.value=Jn(n,U.value);U.value??="any",W.push(`${ee}: ${U.value}`)}let H=O?" & Record<string, any>":"",J=W.length===0?O?"Record<string, any>":"Record<string, never>":W.length===1?`{ ${W[0]} }${H}`:`{
31
+ ${W.join(`;
32
+ `)};
33
+ }${H}`;return{...G,slot_props:J}}).sort((y,O)=>{let G=y.name??"",W=O.name??"";if(G<W)return-1;if(G>W)return 1;return 0})}function Id(n,y,O){if(n.deferredSlotBlockGenerics.length>0){let G=[...y.map((W)=>W.type??""),...O.map((W)=>W.slot_props??"")].join(`
34
+ `);for(let{name:W,constraint:H}of n.deferredSlotBlockGenerics){if(!new RegExp(`\\b${R(W)}\\b`).test(G))continue;_r(n,W,H)}}if(n.scriptGenericsAttribute){if(n.generics)Mt(n,"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.',n.scriptGenericsAttribute.source);n.generics=_s(n.scriptGenericsAttribute.value)}}function Fd(n){return Vn(n.events).map((y)=>y.type==="forwarded"?{...y,element:y.element.name}:y).sort(ye)}function Od(n,y){let O=new Map(n.pendingCallDefaultCandidates.filter((G)=>G.location==="props").map((G)=>[G.propName,G]));for(let G of y)if(G.typeSource==="unknown"){let W=O.get(G.name),H=W?W.importSource?`Prop "${G.name}" default calls "${W.calleeName}()" imported from "${W.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${G.name}" default calls "${W.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${G.name}" type could not be inferred; falling back to "any".`;Mt(n,"prop-unknown-type",G.name,H,G.source)}}function Xr(n,y,O,G){if(y===void 0||Da(y))return!0;let W=Ir(y)?"has a `//` comment, which would comment out the code after it in the .d.ts":"is not valid TypeScript";return Mt(n,"type-syntax-error",O,`Type \`${y}\` of "${O}" ${W}; falling back to "any".`,G),!1}function Bd(n,y,O,G,W){for(let H of y)if(H.typeSource==="jsdoc"&&!Xr(n,H.type,H.name,H.source))H.type="any";for(let H of O)if(H.type==="dispatched"&&!Xr(n,H.detail,H.name,H.source))H.detail="any";for(let H of G)if(!Xr(n,H.slot_props,H.name??"default",H.source))H.slot_props="any";for(let H of W)if(!Xr(n,H.type,H.name,H.source))H.type="any",H.ts=`type ${H.name} = any;`}function $d(n,y){let{dispatcherName:O}=y,G=[];if(O===void 0)return G;let W=[];for(let J of y.callsWithArguments){let ee=xs(J,O);if(ee)W.push({call:J,...ee})}if(W.length>0)hn(n,"dispatch-escapes",O,an(n,O)?.sveldIgnore);let H=ui(n,"dispatch-escapes",O);for(let{call:J,argumentIndex:ee,property:U}of W){let Ee=y.locallyBoundCalls.has(J)?void 0:Pe(n,J.callee);if(!Ee){G.push(J);continue}let Se=je(n,J);n.pendingDispatchEscapeCandidates.push({importSource:Ee.source,importedName:Ee.importedName,...Ee.members?{members:Ee.members}:{},calleeText:nn(n,J.callee)??Ee.importedName,dispatcherName:O,argumentIndex:ee,...U===void 0?{}:{property:U},...Se?{source:Se}:{},...H?{ignored:H}:{}})}return G}function Gd(n,y,O){for(let G of n.jsDocEventNames){if(y.names.has(G)||y.mayDispatch(G))continue;if(n.forwardedEvents.has(G)||n.typedDispatcherEventNames.has(G))continue;if(n.props.has(`on${G}`))continue;if(O.length>0)continue;let W=di(n,"event-no-source",G,`@event "${G}" has no matching dispatch or callback prop.`,n.jsDocEventSources.get(G));if(n.pendingDispatchEscapeCandidates.length>0)n.deferredEventNoSourceDiagnostics.push(W);else n.diagnosticRecords.push(W)}}function Vd(n){if(n.slotsUntracked)return;let y=n.syntaxMode==="runes";for(let[O,{tag:G,source:W}]of n.jsDocSlots){let H=O??"children";if(n.renderedSlots.has(O)||y&&n.props.has(H))continue;let J=O===Cn?"default <slot>":`<slot name="${O}">`,ee=y?`{@render ${H}()} or "${H}" prop`:J,U=O===Cn?`@${G} documents the default slot, but the component has no ${ee}.`:`@${G} "${O}" has no matching ${ee} in the component.`;Mt(n,"slot-not-rendered",O??"default",U,W)}}function jd(n){let y=n.rest_props;if(y?.type!=="InlineComponent")return;let O=Q(n,y.name),G=n.extends?.import.replace(Nd,"");if(O?.importedName==="default"&&O.source===G)return;Mt(n,"rest-props-unresolved","$$restProps",`$$restProps is only spread onto component "${y.name}"; sveld cannot infer its rest-prop type. Spread onto a plain element or add an @restProps tag.`,n.restPropsSource)}function Wd(n,y){let O=y.typedefs.filter((W)=>W.internal).map((W)=>{let H=W.name.split("<")[0];return{name:H,regex:new RegExp(`\\b${H}\\b`)}});if(O.length===0)return;let G=(W,H,J)=>{if(!H)return;for(let{name:ee,regex:U}of O){if(!U.test(H))continue;Mt(n,"internal-typedef-referenced",W,`"${W}" references "${ee}", which is @internal and excluded from output; the generated .d.ts will contain a dangling reference to it.`,J)}};for(let W of[...y.props,...y.moduleExports]){if(W.internal)continue;G(W.name,W.type,W.source)}for(let W of y.typedefs){if(W.internal)continue;G(W.name,W.ts)}for(let W of y.events){if(W.internal||W.type!=="dispatched")continue;G(W.name,W.detail,W.source)}for(let W of y.slots){if(W.internal)continue;G(W.name??"default",W.slot_props,W.source)}for(let W of y.contexts){if(W.internal)continue;if(W.type!==void 0)G(W.typeName,W.type,W.source);for(let H of W.properties)G(H.name,H.type)}}function Hd(n){let y=new Set;for(let O of r(n?.[1]??"",",")){let G=O.trim().match(kd)?.[1];if(G)y.add(G)}return y}function Jd(n,y){let O=Hd(n.generics),G=new Map;for(let W of y){let H=W.type?.trim();if(H&&O.has(H))G.set(W.localName??W.name,H)}return G}function Ud(n,y,O){if(O.size===0)return;let G=n.rest_props,W=n.restPropsTagLocal===void 0?void 0:O.get(n.restPropsTagLocal);if(G?.type==="Element"&&G.name==="svelte:element"&&!G.thisValue&&W)n.rest_props={...G,thisType:W};for(let[H,J]of y.entries()){let ee=n.bindings.get(J.name);if(J.typeSource!=="inferred"||!ee?.elements.some(({tagLocal:U})=>U&&O.has(U)))continue;y[H]={...J,type:Aa(ee,O)}}}var zd=/^(?:(?:HTML|SVG|MathML)\w*)?Element$|^HTMLElementTagNameMap\[[\w$]+\]$/;function Xd(n,y,O){for(let G of y){if(G.typeSource!=="typescript"&&G.typeSource!=="jsdoc")continue;let W=n.bindings.get(G.name);if(W?.target!=="direct"||W.components.length>0||G.type===void 0)continue;let H=({tag:Me,tagLocal:Ie})=>Me==="svelte:element"&&!(Ie&&O.has(Ie));if(W.elements.some(H))continue;let J=(Me)=>Me==="null"||Me==="undefined",ee=r(G.type,"|").map((Me)=>Me.trim()).filter(Boolean),U=ee.filter(J),Ee=ee.filter((Me)=>!J(Me));if(!Ee.every((Me)=>zd.test(Me)))continue;let Se=[...new Set(Na(W,O))];if(Ee.every((Me)=>Se.includes(Me)))continue;let xe=W.elements.map(({tag:Me,tagLocal:Ie})=>Me==="svelte:element"?`<svelte:element this={${Ie}}>`:`<${Me}>`),Le=(J(ee[0]??"")?[...U,...Se]:[...Se,...U]).join(" | ");Mt(n,"bind-this-type-mismatch",G.name,`Prop "${G.name}" is declared as "${G.type}", but \`bind:this\` only binds it to ${qd(xe)}. Declare "${Le}" instead.`,G.source)}}function qd(n){return n.length<2?n.join(""):`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function ka(n,y){let O=Ld(n,y);js(n,O.names);let G=Rd(n);n.activeScopes.length=0;let W=Md(n);Id(n,G,W);let H=Jd(n,G);Ud(n,G,H);let J=Vn(n.moduleExports),ee=Fd(n),U=Vn(n.typedefs),Ee=Vn(n.contexts);Od(n,G),Xd(n,G,H),Bd(n,G,ee,W,U);let Se=$d(n,y);Gd(n,O,Se),Vd(n);let{dispatcherName:xe}=y;for(let Ht of Se){let zt=nn(n,Ht.callee)??"";Mt(n,"dispatch-escapes",xe??"",`\`${xe}\` is passed to \`${zt}\`, which sveld can't follow: it only reads a function imported from another module, by name, as its default export, or through a namespace import. Document the events dispatched there with @event tags.`,je(n,Ht))}jd(n),Wd(n,{props:G,moduleExports:J,typedefs:U,events:ee,slots:W,contexts:Ee});let Le={source:Ar(n,0,n.source?.length),syntaxMode:n.syntaxMode,...n.scriptLanguage?{scriptLanguage:n.scriptLanguage}:{},props:G,moduleExports:J,slots:W,events:ee,typedefs:U,generics:n.generics,rest_props:n.rest_props,extends:n.extends,componentComment:n.componentComment,componentCommentSource:n.componentCommentSource,contexts:Ee,customElementTag:n.customElementTag,customElement:n.customElement,...n.cssParts.length>0?{cssParts:n.cssParts.slice()}:{},...n.cssProperties.length>0?{cssProperties:n.cssProperties.slice()}:{},diagnostics:n.diagnosticRecords.slice()},Me=Jo(n);if(Me)Le[v]=Me;if(n.propIgnoreCodes.size>0)Le[M]=Object.fromEntries(n.propIgnoreCodes);let Ie=Ho(n);return Ie?{component:Le,pending:Ie}:{component:Le}}function Kd(n){if(n.computed)return;if(n.key.type==="Identifier")return n.key.name;if(n.key.type==="Literal"&&(typeof n.key.value==="string"||typeof n.key.value==="number"))return String(n.key.value);return}function wa(n){return n==="private"||n==="protected"}function jn(n){return{...n?.description?{description:n.description}:{},...n?.deprecated===void 0?{}:{deprecated:n.deprecated},...n?.tags?{tags:n.tags}:{}}}function _a(n){return n?.slice(1,-1).trim()||void 0}function Yd(n){let y=n?.type==="TSParameterProperty"?n.parameter:n;return y?.type==="AssignmentPattern"?pn(y.right,"widen"):void 0}function eo(n,y,O){let G=Yn(n,y),W=new Map((O?.params??[]).map((U)=>[U.name,U])),H=G.params.map(({name:U,type:Ee,optional:Se,rest:xe},Le)=>{let Me=W.get(U);return{name:xe?`...${U}`:U,type:Ee??Me?.type??Yd(y.params[Le])??(xe?"any[]":"any"),...Me?.description?{description:Me.description}:{},...!xe&&(Se||Me?.optional)?{optional:!0}:{}}}),J=G.returnType??O?.returnType??(y.async?"Promise<any>":void 0),ee=_a(G.typeParameters)??O?.typeParameters;return{...H.length>0?{params:H}:{},...J?{returnType:J}:{},...ee?{typeParameters:ee}:{}}}function Ra(n,y){let O=[],G=new Map,W=new Set,H=new Set,J,ee=-1;for(let Se of y.body.body){if(Se.type==="TSIndexSignature"){let[zt]=Se.parameters;if(!zt)continue;Xt(n,Se.typeAnnotation?.typeAnnotation),O.push({kind:"index",name:`[${zt.name}: ${rn(n,zt.typeAnnotation)??"string"}]`,type:rn(n,Se.typeAnnotation)??"any",...Se.static?{static:!0}:{},...Se.readonly?{readonly:!0}:{}});continue}if(Se.type!=="MethodDefinition"&&Se.type!=="PropertyDefinition")continue;if(wa(Se.accessibility))continue;let xe=Kd(Se);if(xe===void 0)continue;let Le=qt(n,Se);if(Le?.internal)continue;let Me=`${Se.static?"static ":""}${xe}`,Ie={...Se.static?{static:!0}:{},...Se.optional?{optional:!0}:{},...Se.abstract?{abstract:!0}:{}};if(Se.type!=="MethodDefinition"){if(Xt(n,Se.typeAnnotation?.typeAnnotation),!Se.static)H.add(xe);O.push({kind:"property",name:xe,type:rn(n,Se.typeAnnotation)??Le?.type??pn(Se.value,"widen")??"any",...Ie,...Se.readonly?{readonly:!0}:{},...jn(Le)});continue}let Ht=Se.typeParameters?{...Se.value,typeParameters:Se.typeParameters}:Se.value;if(Se.kind==="constructor"){let zt=eo(n,Ht,Le);O.push({kind:"constructor",name:"constructor",params:zt.params,...jn(Le)}),ee=O.length,J=Ht.type==="FunctionExpression"?Ht.body.body:void 0;for(let[Ft,jt]of Ht.params.entries()){if(jt.type!=="TSParameterProperty"||wa(jt.accessibility))continue;let on=zt.params?.[Ft];if(!on)continue;H.add(on.name),O.push({kind:"property",name:on.name,type:on.type,...jt.readonly?{readonly:!0}:{},...on.description?{description:on.description}:{}})}continue}if(Se.kind==="get"||Se.kind==="set"){let zt=eo(n,Ht,Le),Ft=Se.kind==="get"?zt.returnType??Le?.type:zt.params?.[0]?.type??Le?.type,jt=G.get(Me);if(jt){if(Se.kind==="set")jt.readonly=void 0;if(Ft&&Ft!=="any"&&(jt.type==="any"||Se.kind==="get"))jt.type=Ft;if(!jt.description&&!jt.deprecated)Object.assign(jt,jn(Le));continue}let on={kind:"property",name:xe,type:Ft??"any",...Ie,...Se.kind==="get"?{readonly:!0}:{},...jn(Le)};G.set(Me,on),O.push(on);continue}if(Ht.type==="TSDeclareMethod"&&!Se.abstract)W.add(Me);else if(Ht.type!=="TSDeclareMethod"&&W.has(Me))continue;O.push({kind:"method",name:xe,...Ie,...eo(n,Ht,Le),...jn(Le)})}if(n.scriptLanguage!=="ts"&&J)O.splice(ee,0,...Zd(n,J,H));for(let Se of y.typeParameters?.params??[])Xt(n,Se.constraint),Xt(n,Se.default);let U=_a(vn(n,y.typeParameters)),Ee=Qd(n,y);return{members:O,...U?{typeParameters:U}:{},...Ee}}function Qd(n,y){let O={},G=y.superClass;if(G){if(O.extends=vn(n,{start:G.start,end:y.superTypeParameters?.end??G.end}),G.type==="Identifier")La(n,G,y.superTypeParameters)}let W=(y.implements??[]).map((H)=>(La(n,H.expression,H.typeParameters),vn(n,H))).filter((H)=>Boolean(H));if(W.length>0)O.implements=W;return O}function La(n,y,O){Xt(n,{type:"TSTypeReference",typeName:y,start:y.start,end:O?.end??y.end,...O?{typeArguments:O}:{}})}function Zd(n,y,O){let G=[];for(let W of y){let H=W.type==="ExpressionStatement"?W.expression:void 0;if(H?.type!=="AssignmentExpression"||H.operator!=="=")continue;let J=H.left;if(J.type!=="MemberExpression"||J.computed||J.object.type!=="ThisExpression")continue;let ee=J.property.type==="Identifier"?J.property.name:void 0;if(!ee||O.has(ee))continue;O.add(ee);let U=qt(n,W);if(U?.internal)continue;G.push({kind:"property",name:ee,type:U?.type??"any",...jn(U)})}return G}var eu=/^[A-Za-z_$][\w$]*(?=\s*(?:<|$))/;function qr(n,y,O){if(!y)return;let G=n.moduleExports.get(y);n.moduleExports.set(y,G?{...G,...O}:O)}function Ma(n,y,O,G){let W=qt(n,y);qr(n,O==="*"?`* from ${G.from}`:O,{name:O,kind:"re-export",description:W?.description,deprecated:W?.deprecated,tags:W?.tags,...W?.internal?{internal:!0}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,reExport:G,source:je(n,y)})}function Ia(n,y){Mt(n,"module-export-conflict","default",`export "default" was skipped because it collides with the component's own default export.`,je(n,y))}function tu(n,y,O,G){let W=O.id?.name;if(!W)return;let H=G?.exportedName??W,J=ur(n,y,G),{members:ee,typeParameters:U,extends:Ee,implements:Se}=Ra(n,O),xe=U??J?.typeParameters;qr(n,H,{name:H,...W===H?{}:{localName:W},kind:"class",description:J?.description,deprecated:J?.deprecated,tags:J?.tags,...J?.internal?{internal:!0}:{},type:`typeof ${W}`,...xe?{typeParameters:xe}:{},members:ee,...O.abstract?{abstract:!0}:{},...Ee?{extends:Ee}:{},...Se?{implements:Se}:{},isFunction:!1,isFunctionDeclaration:!1,isRequired:!1,constant:!1,reactive:!1,source:je(n,y)})}function Fa(n,y,O,G){if(O.type==="ClassDeclaration"){tu(n,y,O,G);return}let W=_i(n,O,G,"moduleExports");if(W.length===0)return;let H=ur(n,y,G);for(let J of W){let{prop_name:ee,kind:U}=J,{type:Ee,typeSource:Se,description:xe,params:Le,returnType:Me,isFunction:Ie,typeParameters:Ht}=Ri(n,J,H);qr(n,ee,{name:ee,kind:U,description:xe,deprecated:H?.deprecated,tags:H?.tags,...H?.internal?{internal:!0}:{},type:Ee,typeSource:Se,value:J.value,defaultValue:J.defaultValue,params:Le,returnType:Me,typeParameters:Ht,isFunction:Ie,isFunctionDeclaration:J.isFunctionDeclaration,isRequired:!1,constant:U==="const",reactive:!1,source:je(n,y)})}}function nu(n,y){return n.parsed?.fragment.nodes.find((O)=>O.type==="SnippetBlock"&&O.expression.name===y)}function ru(n,y){let O;try{O=I(`function f<${y}>() {}`,{typescript:!0})}catch{return}let G=O.body[0];if(G?.type!=="FunctionDeclaration")return;for(let W of G.typeParameters?.params??[])Xt(n,W.constraint),Xt(n,W.default)}function iu(n,y,O,G){let W=Yn(n,{params:O.parameters}).params,J=W.map((Se,xe)=>{let Le=O.parameters[xe];if(Se.type||Le?.type!=="AssignmentPattern")return Se;return{...Se,type:pn(Le.right,"widen")}}).map((Se)=>`${Se.name}${Se.optional?"?":""}: ${Se.type??"any"}`).join(", ");if(O.typeParams)ru(n,O.typeParams);let ee=O.typeParams?`<${O.typeParams}>(${J}) => ReturnType<Snippet>`:J?`Snippet<[${J}]>`:"Snippet",U=ur(n,y,G),Ee=G.exportedName;qr(n,Ee,{name:Ee,...G.localName===Ee?{}:{localName:G.localName},kind:"const",description:U?.description,deprecated:U?.deprecated,tags:U?.tags,...U?.internal?{internal:!0}:{},type:ee,typeSource:n.scriptLanguage==="ts"&&W.every((Se)=>Se.type)?"typescript":"inferred",isFunction:O.typeParams!==void 0,isFunctionDeclaration:!1,isRequired:!1,constant:!0,reactive:!1,source:je(n,y)})}function ou(n){let y=Array.from(n.moduleExports.values()).filter((G)=>G.kind==="class"),O=new Set(y.map((G)=>G.localName??G.name));for(let G of y){if(!G.extends)continue;let W=eu.exec(G.extends)?.[0];if(W&&(O.has(W)||n.valueImportBindingsByLocalName.has(W)||n.typeImportBindingsByLocalName.has(W)))continue;Mt(n,"export-unresolved",G.name,`class "${G.name}" extends \`${G.extends}\`, which isn't imported or an exported class, so the .d.ts declares it without \`extends\` and its inherited members are missing. Export the base class from the module script.`,G.source),G.extends=void 0}}function Oa(n){let y=n.parsed?.module;if(!y)return;let O=Ve(y);o(y,{enter(G,W){if(G.type==="ImportDeclaration")Y(n,G);if(G.type==="FunctionDeclaration"&&G.id?.name)n.funcDecls.set(G.id.name,G);if(G.type==="VariableDeclaration")n.vars.add(G);if(G.type==="ExportNamedDeclaration"){if(G.declaration!=null){Fa(n,G,G.declaration);return}let H=G.source?.value,J=W?.type==="Program"?W:null;for(let ee of G.specifiers){let U=wi(n,G,ee,J,"module");if(!U)continue;if(U.exportedName==="default"){Ia(n,G);continue}let Ee=typeof H==="string"?{from:H,imported:U.localName}:O.get(U.localName),Se=U.declaration||Ee?void 0:nu(n,U.localName);if(U.declaration)Fa(n,G,U.declaration,U);else if(Se)iu(n,G,Se,U);else if(Ee)Ma(n,G,U.exportedName,Ee);else if(!n.localTypeDeclarationsByName.get(U.localName)?.exported)Li(n,G,U.localName,U.exportedName)}}if(G.type==="ExportAllDeclaration"&&typeof G.source.value==="string"){let H=(G.exported&&Lr(G.exported))??"*";if(H==="default"){Ia(n,G);return}Ma(n,G,H,{from:G.source.value,imported:"*"})}}}),ou(n)}var su=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376],au=/[:!]/;function lu(n){let y;return()=>(y??=pu(n),y)}function pu(n){let y=new Map,O=0,G="";for(let W of n.split(" ")){let H=W.search(au);G=G.slice(0,Number.parseInt(W[0],36))+W.slice(1,H);let J=Number.parseInt(W.slice(H+1),36);if(y.set(`${G};`,J),W[H]==="!")y.set(G,J);O=Math.max(O,G.length+1)}return{table:y,longest:O}}var $a=lu("0amp!12 1pos:13 0gt!1q 0lt!1o 0quot!y"),to=(n)=>n>=48&&n<=57,cu=(n)=>to(n)||n>=65&&n<=70||n>=97&&n<=102,Ba=(n)=>to(n)||n>=65&&n<=90||n>=97&&n<=122,Kr=0;function du(n,y,O,G){if(n.charCodeAt(y)===35){let ee=(n.charCodeAt(y+1)|32)===120,U=y+(ee?2:1),Ee=U;while(Ee<n.length&&(ee?cu:to)(n.charCodeAt(Ee)))Ee++;if(Ee===U)return 0;return Kr=n.charCodeAt(Ee)===59?Ee+1:Ee,Number.parseInt(n.slice(U,Ee),ee?16:10)}let{table:W,longest:H}=G(),J=y;while(J-y<H&&Ba(n.charCodeAt(J)))J++;if(n.charCodeAt(J)===59){let ee=W.get(n.slice(y,J+1));if(ee!==void 0)return Kr=J+1,ee}for(let ee=J;ee>y;ee--){let U=W.get(n.slice(y,ee));if(U===void 0)continue;if(O){let Ee=n.charCodeAt(ee);if(Ba(Ee)||Ee===95||Ee===61)continue}return Kr=ee,U}return 0}function uu(n,y){if(n===10&&!y)return 32;if(n<128)return n;if(n<=159)return su[n-128];if(n>=55296&&n<=57343)return 0;if(n<=196607)return n;if(n>=917504&&n<=917631||n>=917760&&n<=917999)return n;return 0}function Wn(n,y,O){let G=n.indexOf("&");if(G===-1)return n;let W="",H=0;while(G!==-1){let J=du(n,G+1,y,O);if(J)W+=n.slice(H,G)+String.fromCodePoint(uu(J,y)),H=Kr;G=n.indexOf("&",J?H:G+1)}return W+n.slice(H)}var Ga=new WeakMap;function no(n,y){let O=Ga.get(n);if(O===void 0)Ga.set(n,[y]);else O.push(y)}var fu=/\r(?!\n)|[\u2028\u2029]/,rl=/\s*}/y;function so(n,y){let O=n.codePointAt(y);if(O===void 0||!g(O,!0))return y;let G=y+(O<=65535?1:2),W=n.codePointAt(G);while(W!==void 0&&S(W,!0))G+=W<=65535?1:2,W=n.codePointAt(G);return G}class il{source;index=0;loc;lfOnly;isTypeScript;typescript;entityNames;css;script;comments;root;stack;fragments;metaTags=new Set;lastAutoClosedTag;nextAngle=-1;nextBrace=-1;constructor(n,y,O,G={}){if(this.source=n,this.loc=G.loc??!1,this.lfOnly=this.loc&&!fu.test(n),this.isTypeScript=Br(n),this.typescript=O.typescript,this.isTypeScript&&!this.typescript)ce();this.entityNames=O.entityNames,this.css=G.css??!0,this.script=G.script??!0,this.comments=G.comments??!0,this.root={type:"Root",start:0,end:y,css:null,js:[],options:null,fragment:{type:"Fragment",nodes:[]},comments:[]},this.stack=[this.root],this.fragments=[this.root.fragment]}match(n){if(n.length===1)return this.source.charCodeAt(this.index)===n.charCodeAt(0);return this.source.startsWith(n,this.index)}matchRegex(n){return n.lastIndex=this.index,n.exec(this.source)?.[0]??null}eat(n,y=!1){if(this.match(n))return this.index+=n.length,!0;if(y)D(this.index,n);return!1}read(n){let y=this.matchRegex(n);if(y)this.index+=y.length;return y}readUntil(n){if(this.index>=this.source.length)f(this.source.length);let y=this.source.indexOf(n,this.index),O=y===-1?this.source.length:y,G=this.source.slice(this.index,O);return this.index=O,G}allowWhitespace(){this.index=Wt(this.source,this.index)}requireWhitespace(){if(!Qt(this.source.charCodeAt(this.index)))pt(this.index);this.allowWhitespace()}eatClosingBrace(){this.allowWhitespace(),this.eat("}",!0)}sourceLocation(n,y){return this.loc?{start:x(n),end:x(y)}:void 0}readIdentifierName(){let n=this.index,y=so(this.source,n),O=this.source.slice(n,y);if(this.index=y,fe.has(O))_t(n,O);let G={type:"Identifier",name:O,start:n,end:y};if(this.loc)G.loc=this.sourceLocation(n,y);return G}current(){return this.stack[this.stack.length-1]}append(n){this.fragments[this.fragments.length-1].nodes.push(n)}open(n,y){this.append(n),this.stack.push(n),this.fragments.push(y)}setFragment(n){this.fragments[this.fragments.length-1]=n}close(){this.stack.pop(),this.fragments.pop()}}var mu={"||":1,"??":1,"&&":2,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"+":9,"-":9,"*":10,"/":10,"%":10};function ao(n,y,O,G){return{type:"Literal",start:y,end:O,value:G,raw:n.slice(y,O)}}function Va(n,y){let O=n.charCodeAt(y);if(O===34||O===39){for(let W=y+1;W<n.length;W++){let H=n.charCodeAt(W);if(H===O)return ao(n,y,W+1,n.slice(y+1,W));if(H===92||H===10||H===13)return null}return null}let G=y;for(;G<n.length;G++){let W=n.charCodeAt(G);if(W<48||W>57)break}if(G===y||O===48&&G-y>1)return null;return ao(n,y,G,Number(n.slice(y,G)))}function gu(n,y,O){let G=so(n,y);if(G===y)return Va(n,y);let W=n.slice(y,G);if(W==="true"||W==="false"||W==="null")return ao(n,y,G,W==="null"?null:W==="true");if(fe.has(W))return null;let H={type:"Identifier",start:y,end:G,name:W};for(let J=G;;){let ee=n.charCodeAt(J);if(ee===40){let Se=yu(n,J+1,O);if(!Se)return null;H={type:"CallExpression",start:y,end:Se.end,callee:H,arguments:Se.arguments,optional:!1},J=Se.end;continue}let U,Ee;if(ee===46){if(Ee=so(n,J+1),Ee===J+1)return null;U={type:"Identifier",start:J+1,end:Ee,name:n.slice(J+1,Ee)}}else if(ee===91){if(U=Va(n,J+1),!U||n.charCodeAt(U.end)!==93)return null;Ee=U.end+1}else return H;H={type:"MemberExpression",start:y,end:Ee,object:H,property:U,computed:ee===91,optional:!1},J=Ee}}function yu(n,y,O){let G=[],W=Wt(n,y);if(n.charCodeAt(W)===41)return{arguments:G,end:W+1};for(;;){let H=Qr(n,W,O);if(!H)return null;G.push(H),W=Wt(n,H.end);let J=n.charCodeAt(W);if(J===41)return{arguments:G,end:W+1};if(J!==44)return null;if(W=Wt(n,W+1),n.charCodeAt(W)===41)return null}}function fo(n,y,O){let G=n.charCodeAt(y),W=n.charCodeAt(y+1);if(!(G===33&&W!==61)&&!(G===45&&W!==45&&W!==61))return gu(n,y,O);let H=fo(n,Wt(n,y+1),O);if(!H)return null;return{type:"UnaryExpression",start:y,end:H.end,operator:G===33?"!":"-",prefix:!0,argument:H}}function ja(n,y,O){let G=n.charCodeAt(y),W=n.charCodeAt(y+1);switch(G){case 124:return W===124&&n.charCodeAt(y+2)!==61?"||":null;case 38:return W===38&&n.charCodeAt(y+2)!==61?"&&":null;case 63:return W===63&&n.charCodeAt(y+2)!==61?"??":null;case 61:if(W!==61)return null;return n.charCodeAt(y+2)===61?"===":"==";case 33:if(W!==61)return null;return n.charCodeAt(y+2)===61?"!==":"!=";case 60:case 62:if(O||W===G)return null;if(W===61)return G===60?"<=":">=";return G===60?"<":">";case 43:return W===43||W===61?null:"+";case 45:return W===45||W===61?null:"-";case 42:return W===42||W===61?null:"*";case 47:return W===47||W===42||W===61?null:"/";case 37:return W===61?null:"%";default:return null}}function lo(n,y,O,G){if(ol(n.charCodeAt(y.end)))return y;let W=Wt(n,y.end),H=ja(n,W,G);if(H===null)return y;let J=mu[H];if(J<=O)return y;let ee=fo(n,Wt(n,W+H.length),G);if(!ee)return null;let U=lo(n,ee,H==="??"?2:J,G);if(!U)return null;let Ee;if(H==="||"||H==="&&"||H==="??"){let Se=ja(n,Wt(n,U.end),G);if(H==="??"?Se==="||"||Se==="&&":Se==="??")return null;Ee={type:"LogicalExpression",start:y.start,end:U.end,left:y,operator:H,right:U}}else Ee={type:"BinaryExpression",start:y.start,end:U.end,left:y,operator:H,right:U};return lo(n,Ee,O,G)}function Qr(n,y,O){let G=fo(n,y,O);if(!G)return null;let W=lo(n,G,-1,O);if(!W||ol(n.charCodeAt(W.end)))return W;let H=Wt(n,W.end);if(n.charCodeAt(H)!==63)return W;let J=n.charCodeAt(H+1);if(J===46||J===63)return null;let ee=Qr(n,Wt(n,H+1),O);if(!ee)return null;let U=Wt(n,ee.end);if(n.charCodeAt(U)!==58)return null;let Ee=Qr(n,Wt(n,U+1),O);if(!Ee)return null;return{type:"ConditionalExpression",start:W.start,end:Ee.end,test:W,consequent:ee,alternate:Ee}}function ol(n){return n===125||n===41||n===44||n===58}function hu(n,y){let O=n.charCodeAt(Wt(n,y));return O===125||O===41}function Eu(n,y,O){let G=Qr(n,y,O);return G&&hu(n,G.end)?G:null}function dn(n){switch(n.loc={start:N(n.start),end:N(n.end)},n.type){case"MemberExpression":dn(n.object),dn(n.property);break;case"CallExpression":dn(n.callee);for(let y of n.arguments)dn(y);break;case"UnaryExpression":dn(n.argument);break;case"BinaryExpression":case"LogicalExpression":dn(n.left),dn(n.right);break;case"ConditionalExpression":dn(n.test),dn(n.consequent),dn(n.alternate);break}}function en(n){let y=!n.loc||n.lfOnly?Eu(n.source,n.index,n.isTypeScript):null;if(y){if(n.index=y.end,n.loc)dn(y);return y}let{node:O,end:G}=V(n,n.source,n.index);return n.index=G,O}var Tu=new Set(["server","client","worker","test","default"]);function Su(n,y,O){let{source:G,index:W}=n;if(W>=G.length)f(G.length);let H=$r(G,W);if(H===-1)De(G.length,"script");n.index=Gr(G,H);let J=n.script?me(n,G.slice(0,H),W):{type:"Program",start:W,end:H,body:[],sourceType:"module"};if(J.start=W,J.loc)Object.assign(J.loc.start,N(y)),Object.assign(J.loc.end,N(n.index));else if(n.loc)J.loc={start:N(y),end:N(n.index)};let ee="default";for(let U of O){if(Tu.has(U.name))mt(U,U.name);if(U.name==="module"){if(U.value!==!0)dt(U,U.name);ee="module"}if(U.name==="context"){let Ee=U.value;if(!Array.isArray(Ee)||Ee.length!==1||Ee[0].type!=="Text"||Ee[0].data!=="module")ft(U);ee="module"}}return{type:"Script",start:y,end:n.index,context:ee,content:J,attributes:O}}var Cu=/(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of(\s+|(?=[.#[*:&])))/y,bu=/\d+(\.\d+)?%/y,xu=/\\[0-9a-fA-F]{1,6}(\r\n|\s)?/y,vu=/\s*>/y,xn=-1,sl=34,Pu=35,Du=36,Au=38,al=39,Nu=40,ku=41,ti=42,wu=43,Lu=45,_u=46,ll=47,po=58,Ru=59,Mu=60,Wa=61,Iu=62,Fu=91,mo=92,Ou=93,Bu=94,pl=123,co=124,$u=125,cl=126,Zr=[];function Gu(n,y,O){let G=n.index;Zr=[];let W=n.css?ju(n):Vu(n),H=n.index;return n.eat("</style",!0),n.read(vu),{type:"StyleSheet",start:y,end:n.index,attributes:O,children:W,comments:Zr,content:{start:G,end:H,styles:n.source.slice(G,H),comment:null}}}function Vu(n){return n.index=Vr(n.source,n.index),[]}function ju(n){let y=[];for(;;){if(Hn(n,!0),n.match("</style")||n.index>=n.source.length)break;y.push(n.match("@")?dl(n):ul(n))}return y}function dl(n){let y=n.index;n.eat("@",!0);let O=Rn(n),G=go(n,!0),W=null;if(n.match("{"))W=gl(n);else n.eat(";",!0);return{type:"Atrule",start:y,end:n.index,name:O,prelude:G,block:W}}function ul(n){let y=n.index;return{type:"Rule",prelude:fl(n,!1),block:gl(n),start:y,end:n.index}}function fl(n,y){let O=[];Hn(n,!0);let G=n.index;while(n.index<n.source.length){O.push(Wu(n,y));let W=n.index;if(Hn(n,!0),n.match(y?")":"{"))return{type:"SelectorList",start:G,end:W,children:O};n.eat(",",!0),Hn(n,!0)}return f(n.source.length)}function Ha(n,y){return{type:"RelativeSelector",combinator:n,selectors:[],start:y,end:-1}}function Wu(n,y){let{source:O,index:G}=n,W=[],H=Ha(null,n.index);while(n.index<O.length){let J=n.index,ee=O.charCodeAt(J),U=H.selectors;if(ee===Au)n.index++,U.push({type:"NestingSelector",name:"&",start:J,end:n.index});else if(ee===ti)n.index++,U.push(Ja(n,J,"*"));else if(ee===Pu)n.index++,U.push({type:"IdSelector",name:Rn(n),start:J,end:n.index});else if(ee===_u)n.index++,U.push({type:"ClassSelector",name:Rn(n),start:J,end:n.index});else if(ee===po){let Le=O.charCodeAt(J+1)===po;n.index+=Le?2:1;let Me=Rn(n),Ie=null;if(n.eat("("))Ie=fl(n,!0),n.eat(")",!0);if(Le)U.push({type:"PseudoElementSelector",name:Me,start:J,end:n.index,...Ie&&{args:Ie}});else U.push({type:"PseudoClassSelector",name:Me,args:Ie,start:J,end:n.index})}else if(ee===Fu)n.index++,U.push(Hu(n,J));else{let Le=y?n.read(Cu):null,Me=!Le&&fn(ee)?n.read(bu):null;if(Le)U.push({type:"Nth",value:Le,start:J,end:n.index});else if(Me)U.push({type:"Percentage",value:Me,start:J,end:n.index});else if(ml(O,J)===0){let Ie=Rn(n);U.push(Ja(n,J,Ie))}}let Ee=n.index;Hn(n,!1);let Se=n.match(",")||n.match(y?")":"{");if(n.index=Ee,Se)return H.end=Ee,W.push(H),{type:"ComplexSelector",start:G,end:Ee,children:W};let xe=Ju(n);if(xe){if(H.selectors.length>0)H.end=Ee,W.push(H);if(H=Ha(xe,xe.start),n.allowWhitespace(),n.match(",")||n.match(y?")":"{"))et(n.index)}}return f(O.length)}function Ja(n,y,O){let G=O,W;if(n.eat("|"))W=G,G=n.eat("*")?"*":Rn(n);return{type:"TypeSelector",name:G,...W!==void 0&&{namespace:W},start:y,end:n.index}}function Hu(n,y){let O=n.source;n.allowWhitespace();let G=Rn(n);n.allowWhitespace();let W=null,H=null,J=O.charCodeAt(n.index);if(J===Wa)H="=";else if((J===cl||J===Bu||J===Du||J===ti||J===co)&&O.charCodeAt(n.index+1)===Wa)H=O.slice(n.index,n.index+2);if(H)n.index+=H.length,n.allowWhitespace(),W=qu(n);n.allowWhitespace();let ee=n.index;while(hl(O.charCodeAt(n.index)))n.index++;let U=n.index>ee?O.slice(ee,n.index):null;return n.allowWhitespace(),n.eat("]",!0),{type:"AttributeSelector",start:y,end:n.index,name:G,matcher:H,value:W,flags:U}}function ml(n,y){let O=n.charCodeAt(y);if(O===wu||O===cl||O===Iu)return 1;if(O===co&&n.charCodeAt(y+1)===co)return 2;return 0}function Ju(n){let y=n.index;n.allowWhitespace();let O=n.index,G=ml(n.source,O);if(G>0){n.index+=G;let W=n.index;return n.allowWhitespace(),{type:"Combinator",name:n.source.slice(O,W),start:O,end:W}}if(n.index!==y)return{type:"Combinator",name:" ",start:y,end:n.index};return null}function gl(n){let y=n.index;n.eat("{",!0);let O=[];while(n.index<n.source.length){if(Hn(n,!0),n.match("}"))break;O.push(Uu(n))}return n.eat("}",!0),{type:"Block",start:y,end:n.index,children:O}}function Uu(n){if(n.match("@"))return dl(n);let y=n.index;go(n,!1);let O=n.source.charCodeAt(n.index);return n.index=y,O===pl?ul(n):zu(n)}function zu(n){let{source:y,index:O}=n;if(O>=y.length)f(y.length);let G=O;while(G<y.length){let U=y.charCodeAt(G);if(U===po||Qt(U))break;G++}let W=y.slice(O,G);n.index=G,n.allowWhitespace(),n.eat(":");let H=n.index;n.allowWhitespace();let J=go(n,!0);if(!J&&!W.startsWith("--"))Ze({start:O,end:H});let ee=n.index;if(!n.match("}"))n.eat(";",!0);return{type:"Declaration",start:O,end:ee,property:W,value:J}}function go(n,y){let O=n.source,G=O.length,W="",H=n.index,J=null,ee=!1,U=!1,Ee=xn,Se=n.index;while(Se<G){let xe=O.charCodeAt(Se);if(ee){ee=!1,Se++;continue}if(xe===mo){ee=!0,Se++;continue}if(xe===Ee)Ee=xn;else if(xe===ku)U=!1;else if(Ee===xn&&(xe===sl||xe===al))Ee=xe;else if(xe===Nu){if(Xu(O,W,H,Se))U=!0}else if((xe===Ru||xe===pl||xe===$u)&&!U&&Ee===xn){if(n.index=Se,!y)return"";if(W+=O.slice(H,Se),J){let Le=W.length-W.trimStart().length;for(let Me of J)Me.position=Math.max(0,(Me.position??0)-Le)}return W.trim()}else if(xe===ll&&!U&&Ee===xn&&O.charCodeAt(Se+1)===ti){W+=O.slice(H,Se),n.index=Se;let Le=yl(n);if(y)Le.position=W.length,Zr.push(Le),J??=[],J.push(Le);Se=n.index,H=Se;continue}Se++}return n.index=G,f(G)}function Xu(n,y,O,G){if(G-O>=3)return n.charCodeAt(G-3)===117&&n.charCodeAt(G-2)===114&&n.charCodeAt(G-1)===108;return(y+n.slice(O,G)).endsWith("url")}function qu(n){let y=n.source,O=xn;if(n.eat('"'))O=sl;else if(n.eat("'"))O=al;let G=n.index,W=!1,H=G;while(H<y.length){let J=y.charCodeAt(H);if(W)W=!1;else if(J===mo)W=!0;else if(O===xn?J===Ou||Qt(J):J===O)return n.index=O===xn?H:H+1,y.slice(G,H).trim();H++}return n.index=H,f(y.length)}function Rn(n){let{source:y,index:O}=n,G=y.charCodeAt(O);if(fn(G)||G===Lu&&fn(y.charCodeAt(O+1)))we(O);let W="",H=O,J=O;while(J<y.length){let ee=y.charCodeAt(J);if(ee===mo){W+=y.slice(H,J),n.index=J;let U=n.matchRegex(xu);if(U){let Ee=String.fromCodePoint(Number.parseInt(U.slice(1),16));W+=Ee==="\\"?"\\\\":Ee,J+=U.length}else W+=`\\${y[J+1]}`,J+=2;H=J}else if(ee>=160||Ku(ee))J++;else break}if(W+=y.slice(H,J),n.index=J,W==="")we(O);return W}function Hn(n,y){let O=n.source;n.allowWhitespace();for(;;){let G=O.charCodeAt(n.index);if(G===ll&&O.charCodeAt(n.index+1)===ti){let W=yl(n);if(y)Zr.push(W)}else if(G===Mu&&n.eat("<!--"))n.readUntil("-->"),n.eat("-->",!0);else break;n.allowWhitespace()}}function yl(n){let y=n.index;n.eat("/*",!0);let O=n.readUntil("*/");return n.eat("*/",!0),{type:"CSSComment",value:O,start:y,end:n.index}}function hl(n){return n>=65&&n<=90||n>=97&&n<=122}function Ku(n){return hl(n)||fn(n)||n===95||n===45}var ro=/<\/textarea(\s[^>]*)?>/iy,Yu=/^![a-zA-Z]+$/,Qu=/^[a-zA-Z][a-zA-Z0-9]*:[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]$/,Zu=/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u,io="\\u200C\\u200D",ef=new RegExp(`^(?:\\p{Lu}[$${io}\\p{ID_Continue}.]*|\\p{ID_Start}[$${io}\\p{ID_Continue}]*(?:\\.[$${io}\\p{ID_Continue}]+)+)$`,"u"),tf=new Map([["use","UseDirective"],["animate","AnimateDirective"],["bind","BindDirective"],["class","ClassDirective"],["style","StyleDirective"],["on","OnDirective"],["let","LetDirective"],["in","TransitionDirective"],["out","TransitionDirective"],["transition","TransitionDirective"]]),yo=new Map([["svelte:head",["SvelteHead",!0]],["svelte:options",["SvelteOptions",!0]],["svelte:window",["SvelteWindow",!0]],["svelte:document",["SvelteDocument",!0]],["svelte:body",["SvelteBody",!0]],["svelte:element",["SvelteElement",!1]],["svelte:component",["SvelteComponent",!1]],["svelte:self",["SvelteSelf",!1]],["svelte:fragment",["SvelteFragment",!1]],["svelte:boundary",["SvelteBoundary",!1]]]),Ua=[...yo.keys()],nf=`${Ua.slice(0,-1).join(", ")} or ${Ua.at(-1)}`,rf=62,za=123;function ni(n,y){let O=n.index;if(O>=n.source.length)f(n.source.length);let G=kn(n.source,O,y);return n.index=G,{name:n.source.slice(O,G),start:O,end:G,loc:n.sourceLocation(O,G)}}var Sr=(n,y,O,G=O)=>({start:n,end:y,type:"Text",raw:O,data:G});function of(n){let y=n.charCodeAt(0);if(y>=97&&y<=122&&!n.includes("."))return!1;return ef.test(n)}function sf(n){let y=!0;for(let O=0;O<n.length&&y;O++){let G=n.charCodeAt(O);y=G>=97&&G<=122||O>0&&G>=48&&G<=57}return y&&n.length>0||Yu.test(n)||Qu.test(n)||Zu.test(n)}function Xa(n,y){for(let O=n.length-1;O>=0;O--){let G=y(n[O]);if(G!==void 0)return G}return!1}function af(n,y,O){let G=yo.get(y);if(G)return G[0];if(O)return"Component";if(y==="title"){if(Xa(n.stack,({type:W})=>{if(W==="SvelteHead")return!0;return W==="RegularElement"||W==="Component"?!1:void 0}))return"TitleElement"}if(y==="slot"){if(!Xa(n.stack,(W)=>W.type==="RegularElement"&&W.attributes.some((H)=>H.type==="Attribute"&&H.name==="shadowrootmode")?!0:void 0))return"SlotElement"}return"RegularElement"}function ho(n){let y=n.index++;if(n.eat("!--")){let O=n.readUntil("-->");n.eat("-->",!0),n.append({type:"Comment",start:y,end:n.index,data:O})}else if(n.eat("/"))lf(n,y);else cf(n,y)}function lf(n,y){let{name:O}=ni(n,!1);if(n.allowWhitespace(),n.eat(">",!0),mr(O))Rt(y);let G=n.current();while(!("name"in G)||G.name!==O){if(G.type==="RegularElement"){if(n.lastAutoClosedTag?.tag!==O)El(n,G,y,`</${O}>`)}else{let W=n.lastAutoClosedTag;if(W?.tag===O)st(y,O,W.reason);it(y,O)}G.end=y,n.close(),G=n.current()}if(G.end=n.index,n.close(),n.stack.length<(n.lastAutoClosedTag?.depth??0))n.lastAutoClosedTag=void 0}function El(n,y,O,G){no(n.root,{code:"element_implicitly_closed",start:y.start,end:y.fragment.nodes[0]?.start??O,by:G,closing:`</${y.name}>`})}function pf(n,y,O){return{type:n,start:y,end:-1,name:O}}function cf(n,y){let O=ni(n,!1),{name:G}=O,W=yo.get(G);if(!W&&G.startsWith("svelte:"))vt(O,nf);let H=of(G);if(!H&&!sf(G))Dt(O);if(W?.[1]){if(n.metaTags.has(G))xt(y,G);if(n.current().type!=="Root")St(y,G);n.metaTags.add(G)}let J=pf(af(n,G,H),y,G);if(n.loc)J.name_loc=O.loc;J.attributes=[],J.fragment={type:"Fragment",nodes:[]},n.allowWhitespace();let ee=n.current();if(ee.type==="RegularElement"&&Ur(ee.name,G))El(n,ee,y,`<${G}>`),ee.end=y,n.close(),n.lastAutoClosedTag={tag:ee.name,reason:G,depth:n.stack.length};if((G==="script"||G==="style")&&n.current().type==="Root"){let U=[];J.attributes=U,Ya(n,U,yf),uf(n,J,y,U);return}if(Ya(n,J.attributes,Ef),J.type==="SvelteComponent"){let U=qa(J);if(!U)yt(y);if(!oo(U.value))gt(U.start);J.expression=Ka(U.value)}else if(J.type==="SvelteElement"){let U=qa(J);if(!U)$e(y);if(U.value===!0)$e(U);if(!oo(U.value))no(n.root,{code:"svelte_element_invalid_this",start:U.start,end:U.end});J.tag=oo(U.value)?Ka(U.value):gf(U.value[0])}if(!n.eat("/")&&!mr(G))if(n.eat(">",!0),G==="textarea")J.fragment.nodes=Sl(n,(U,Ee)=>(ro.lastIndex=Ee,ro.test(U)),"inside <textarea>"),n.read(ro);else if(G==="script"||G==="style")J.fragment.nodes.push(df(n,`</${G}>`));else{n.open(J,J.fragment);return}else n.eat(">",!0);J.end=n.index,n.append(J)}function df(n,y){let O=n.index,G=n.source.indexOf(y,O);n.index=G===-1?n.source.length:G;let W=Sr(O,n.index,n.source.slice(O,n.index));return n.eat(y,!0),W}function uf(n,y,O,G){n.eat(">",!0);let W=ff(n.root.fragment.nodes,O);if(y.name==="style"){let ee=Gu(n,O,G);if(ee.content.comment=W,n.root.css)ht(O);n.root.css=ee;return}let H=Su(n,O,G);if(W&&n.comments)H.content.leadingComments=[{type:"Line",value:W.data}];let J=H.context==="module"?"module":"instance";if(n.root[J])ut(O);n.root[J]=H}function ff(n,y){let O=n.length-1;if(O<0||n[O].end!==y)return null;for(let G=O;G>=0;G--){let W=n[G];if(W.type==="Comment")return W;if(W.type!=="Text"||W.data.trim())return null}return null}var mf=(n)=>n.type==="Attribute"&&n.name==="this";function qa(n){let y=n.attributes.find(mf);if(y)n.attributes.splice(n.attributes.indexOf(y),1);return y}function oo(n){if(n===!0)return!1;if(!Array.isArray(n))return!0;return n.length===1&&n[0].type==="ExpressionTag"}function Ka(n){return(Array.isArray(n)?n[0]:n).expression}function gf(n){if(n.type!=="Text")return n.expression;return{type:"Literal",value:n.data,raw:`'${n.raw}'`,start:n.start,end:n.end}}function Ya(n,y,O){let G=new Set;for(;;){let W=O(n);if(!W)return;let{type:H}=W;if(H==="Attribute"||H==="BindDirective"||H==="StyleDirective"||H==="ClassDirective"){let J=`${H==="BindDirective"?"Attribute":H}${W.name}`;if(G.has(J))Ue(W);if(W.name!=="this")G.add(J)}y.push(W),n.allowWhitespace()}}function Eo(n,y,O,G,W){return n.loc?{type:"Attribute",start:O,end:G,name:y.name,name_loc:y.loc,value:W}:{type:"Attribute",start:O,end:G,name:y.name,value:W}}function Tl(n){if(cn(n.source.charCodeAt(n.index)))D(n.index,"=")}function yf(n){let y=n.index,O=ni(n,!0);if(!O.name)return null;let G=!0;if(n.eat("=")){n.allowWhitespace();let{source:W}=n,H=n.index,J=cn(W.charCodeAt(H)),ee=-1;if(J){let Se=W.indexOf(W[H],H+1);if(Se!==-1)ee=Se+1}if(ee===-1){ee=H;while(ee<W.length&&W.charCodeAt(ee)!==rf&&!Qt(W.charCodeAt(ee)))ee++;if(ee===H)Ne(H)}n.index=ee;let U=J?1:0,Ee=W.slice(H+U,ee-U);G=[Sr(ee-Ee.length-U,ee-U,Ee,Wn(Ee,!0,n.entityNames))]}return Tl(n),Eo(n,O,y,n.index,G)}function hf(n){let y=n.index,O=n.match("/*");if(!O&&!n.match("//"))return!1;n.index+=2;let G=n.readUntil(O?"*/":`
35
+ `);if(O)n.eat("*/");let W={type:O?"Block":"Line",start:y,end:n.index,value:G},H=n.sourceLocation(y,n.index);if(H)W.loc=H;if(n.comments)n.root.comments.push(W);return!0}function Ef(n){while(hf(n))n.allowWhitespace();let y=n.index;if(n.eat("{"))return Tf(n,y);let O=ni(n,!0);if(!O.name)return null;let G=n.index;n.allowWhitespace();let W=!0;if(n.eat("=")){if(n.allowWhitespace(),n.match("/>"))W=[Sr(n.index,n.index+1,"/")],n.index++;else W=bf(n);G=n.index}else Tl(n);let H=O.name.indexOf(":"),J=H>0?tf.get(O.name.slice(0,H)):void 0;return J?Cf(n,J,O,H,y,G,W):Eo(n,O,y,G,W)}function Tf(n,y){if(n.allowWhitespace(),n.eat("@attach")){n.requireWhitespace();let W=en(n);return n.eatClosingBrace(),{type:"AttachTag",start:y,end:n.index,expression:W}}if(n.eat("...")){let W=en(n);return n.eatClosingBrace(),{type:"SpreadAttribute",start:y,end:n.index,expression:W}}let O=n.readIdentifierName();if(O.name==="")Je(y);n.eatClosingBrace();let G={type:"ExpressionTag",start:O.start,end:O.end,expression:O};return Eo(n,O,y,n.index,G)}function Sf(n){if(n===!0)return;return Array.isArray(n)?n[0]:n}function Cf(n,y,O,G,W,H,J){let[ee,...U]=O.name.slice(G+1).split("|");if(ee==="")rt({start:W,end:W+G+1},O.name);let Ee={start:W,end:H,type:y,name:ee};if(n.loc)Ee.name_loc=O.loc;if(y==="StyleDirective")return Ee.modifiers=U,Ee.value=J,Ee;let Se=Sf(J);if(Se&&(Array.isArray(J)&&J.length>1||Se.type==="Text"))nt(Se.start);if(Ee.expression=Se?.expression??null,Ee.modifiers=U,y==="TransitionDirective"){let xe=O.name.slice(0,G);Ee.intro=xe!=="out",Ee.outro=xe!=="in"}if((y==="BindDirective"||y==="ClassDirective")&&!Ee.expression)Ee.expression={start:W+G+1,end:H,type:"Identifier",name:ee};return Ee}function bf(n){let y=n.source.charCodeAt(n.index),O=cn(y);if(O){if(n.index++,n.source.charCodeAt(n.index)===y)return n.index++,[Sr(n.index-1,n.index-1,"")]}let G;try{G=Sl(n,O?(W,H)=>W.charCodeAt(H)===y:jr,"in attribute value",O?y:void 0)}catch(W){let H=W instanceof e&&W.code==="js_parse_error"?W.position?.[0]:void 0;if(H!==void 0&&n.source.startsWith("/>",H-1))n.index=H,D(H,O?String.fromCharCode(y):"}");throw W}if(O)n.index++;else if(G.length===0)Ne(n.index);return O||G.length>1||G[0].type==="Text"?G:G[0]}function Sl(n,y,O,G){let{source:W}=n,H=[],J=n.index,ee=(U)=>{if(U<=J)return;let Ee=W.slice(J,U);H.push(Sr(J,U,Ee,Wn(Ee,!0,n.entityNames)))};while(n.index<W.length){let U=n.index;if(y(W,U))return ee(U),H;if(W.charCodeAt(U)!==za){if(n.index++,G!==void 0)while(n.index<W.length&&W.charCodeAt(n.index)!==za&&W.charCodeAt(n.index)!==G)n.index++;continue}n.index++;let Ee=W.charCodeAt(n.index);if(Ee===35||Ee===64){n.index++;let xe=n.index;while(n.index<W.length&&W.charCodeAt(n.index)>=97&&W.charCodeAt(n.index)<=122)n.index++;let Le=W.slice(xe,n.index);(Ee===35?qe:Nt)(U,Le,O)}ee(U),n.allowWhitespace();let Se=en(n);n.eatClosingBrace(),H.push({type:"ExpressionTag",start:U,end:n.index,expression:Se}),J=n.index}f(W.length)}var xf=new Map([["html","html"],["svg","svg"],["mathml","mathml"],["http://www.w3.org/2000/svg","svg"],["http://www.w3.org/1998/Math/MathML","mathml"]]),vf=new Map([["type",(n,y)=>{if(y!=="String"&&y!=="Number"&&y!=="Boolean"&&y!=="Array"&&y!=="Object")return!1;return n.type=y,!0}],["reflect",(n,y)=>{if(typeof y!=="boolean")return!1;return n.reflect=y,!0}],["attribute",(n,y)=>{if(typeof y!=="string")return!1;return n.attribute=y,!0}]]),Qa="[a-z0-9_.\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}-]",Pf=new RegExp(`^[a-z]${Qa}*-${Qa}*$`,"u"),Df=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ")),Yr=(n)=>(y,O)=>{let G=ei(O);if(typeof G!=="boolean")de(O,"true or false");y[n]=G},Af=new Map([["runes",Yr("runes")],["immutable",Yr("immutable")],["preserveWhitespace",Yr("preserveWhitespace")],["accessors",Yr("accessors")],["namespace",(n,y)=>{let O=xf.get(ei(y));if(!O)de(y,'"html", "mathml" or "svg"');n.namespace=O}],["css",(n,y)=>{if(ei(y)!=="injected")de(y,'"injected"');n.css="injected"}],["tag",(n,y)=>Ct(y)],["customElement",(n,y)=>{let O=wf(y);if(O)n.customElement=O}]]);function Nf(n){let y=[],O={start:n.start,end:n.end,attributes:y};for(let G of n.attributes){if(G.type!=="Attribute")Tt(G);y.push(G);let W=Af.get(G.name);if(!W)kt(G,G.name);W(O,G)}return O}function ei({value:n}){if(n===!0)return!0;let y=Array.isArray(n)?n:[n];if(y.length===0)return!0;if(y.length>1)return null;let[O]=y;if(O.type==="Text")return O.data;return O.expression.type==="Literal"?O.expression.value:null}function Za(n,y){if(typeof y!=="string")Re(n);if(!y)return;if(!Pf.test(y))Re(n);if(Df.has(y))wt(n)}function uo(n){return n.type==="Property"&&!n.computed&&n.key.type==="Identifier"}function kf(n,y){let O=new Map;for(let G of n.properties){if(!uo(G))y();if(!O.has(G.key.name))O.set(G.key.name,G.value)}return O}function wf(n){let y=()=>bt(n);if(n.value===!0)y();let O=Array.isArray(n.value)?n.value[0]:n.value;if(O.type==="Text"){let Se=ei(n);return Za(n,Se),{tag:Se}}let{expression:G}=O;if(G.type!=="ObjectExpression"){if(G.type==="Literal"&&G.value===null)return;y()}let W=kf(G,y),H={},J=W.get("tag");if(J){let Se=J.type==="Literal"?J.value:void 0;Za(null,Se),H.tag=Se}let ee=W.get("props");if(ee){let Se=()=>Pt(n);if(ee.type!=="ObjectExpression")Se();H.props={};for(let xe of ee.properties){if(!uo(xe)||xe.value.type!=="ObjectExpression")Se();let Le={};H.props[xe.key.name]=Le;for(let Me of xe.value.properties){if(!uo(Me)||Me.value.type!=="Literal")Se();if(!vf.get(Me.key.name)?.(Le,Me.value.value))Se()}}}let U=W.get("shadow");if(U)if(U.type==="ObjectExpression")H.shadow=U;else if(U.type==="Literal"&&(U.value==="open"||U.value==="none"))H.shadow=U.value;else At(n);let Ee=W.get("extend");if(Ee)H.extend=Ee;return H}var Lf={"{":"}","(":")","[":"]"};function To(n,y,O=Lf){let G=Object.values(O),W=[],H=y;while(H<n.length){let J=n[H++];if(J==="'"||J==='"'||J==="`")H=_f(n,H,J);else if(J===">"&&n[H-2]==="="&&G.includes(">"));else if(Object.hasOwn(O,J))W.push(J);else if(G.includes(J)){let ee=O[W.pop()??""];if(J!==ee)D(H-1,ee);if(W.length===0)return H}}f(n.length)}function _f(n,y,O){let G=y;while(G<n.length){let W=n[G++];if(W===O)return G;if(W==="\\")G++;else if(O==="`"&&W==="$"&&n[G]==="{")G=To(n,G)}$t(y)}var Rf=/\?(?=\s*:)/g;function ri(n){let y=n.index,O=n.readIdentifierName();if(O.name!=="")return{...O,typeAnnotation:el(n)};let G=n.source[n.index];if(G!=="{"&&G!=="[")at(n.index);n.index=To(n.source,y);let W=It(n,n.source.slice(0,n.index),y)??Mf(n,y);Ce(W,"ObjectPattern","ArrayPattern");let H=el(n);if(W.typeAnnotation=H,H)W.end=H.end;return W}function Mf(n,y){let{node:O}=V(n,`${n.source.slice(0,n.index)} = 1`,y);return Ce(O,"AssignmentExpression"),O.left}function el(n){let y=n.index;if(n.allowWhitespace(),!n.eat(":")){n.index=y;return}let O="_ as ",G=n.index-O.length,W=n.source.slice(0,G)+O+n.source.slice(n.index).replace(Rf," "),H=V(n,W,G).node;if(H.type==="AssignmentExpression"){let J=H.right.start;while(W[J]!=="=")J-=1;H=V(n,W.slice(0,J),G).node}if(H.type==="SequenceExpression")H=H.expressions[0];return n.index=H.end,{type:"TSTypeAnnotation",start:y,end:n.index,typeAnnotation:H.type==="TSAsExpression"?H.typeAnnotation:void 0}}var If={IfBlock:"if",EachBlock:"each",KeyBlock:"key",AwaitBlock:"await",SnippetBlock:"snippet"},yn=()=>({type:"Fragment",nodes:[]});function Ff(n,y){if(n.eat("if")){n.requireWhitespace();let O=en(n);n.eatClosingBrace();let G=yn();n.open({type:"IfBlock",elseif:!1,start:y,end:-1,test:O,consequent:G,alternate:null},G)}else if(n.eat("each"))Bf(n,y);else if(n.eat("await")){n.requireWhitespace();let O=en(n);n.allowWhitespace();let G={type:"AwaitBlock",start:y,end:-1,expression:O,value:null,error:null,pending:null,then:null,catch:null},W=yn();if(n.eat("then"))G.value=tl(n),G.then=W;else if(n.eat("catch"))G.error=tl(n),G.catch=W;else G.pending=W;n.eat("}",!0),n.open(G,W)}else if(n.eat("key")){n.requireWhitespace();let O=en(n);n.eatClosingBrace();let G=yn();n.open({type:"KeyBlock",start:y,end:-1,expression:O,fragment:G},G)}else if(n.eat("snippet"))$f(n,y);else ot(n.index)}function tl(n){if(n.matchRegex(rl))return n.allowWhitespace(),null;n.requireWhitespace();let y=ri(n);return n.allowWhitespace(),y}function Of(n){let y={assertion:null},O=n.end,G=(H)=>{if(H.type==="TSAsExpression"&&H.end===n.end)return y.assertion=H,O=H.expression.end,H.expression;return K(H,G),H},W=n;if(n.type==="TSAsExpression")y.assertion=n,W=n.expression,O=W.end;else K(n,G);return W.end=O,{expression:W,assertion:y.assertion}}function Bf(n,y){n.requireWhitespace();let O=n.source,G;while(!G)try{G=en(n)}catch(U){let Ee=((U instanceof e?U.position:void 0)?.[0]??y)-2;while(Ee>y&&n.source.slice(Ee,Ee+2)!=="as")Ee-=1;if(Ee<=y)throw n.source=O,U;n.source=O.slice(0,Ee)}if(n.source=O,n.allowWhitespace(),!n.match("as")){if(G.type==="SequenceExpression")G=G.expressions[0];let U=Of(G);if(G=U.expression,U.assertion){let Ee=U.assertion.typeAnnotation.start-2;while(n.source.slice(Ee,Ee+2)!=="as")Ee-=1;n.index=Ee}}let W=null,H,J;if(n.eat("as"))n.requireWhitespace(),W=ri(n);else n.index=G.end;if(n.allowWhitespace(),n.eat(",")){if(n.allowWhitespace(),H=n.readIdentifierName().name,!H)_e(n.index);n.allowWhitespace()}if(n.eat("("))n.allowWhitespace(),J=en(n),n.allowWhitespace(),n.eat(")",!0),n.allowWhitespace();n.eat("}",!0);let ee=yn();n.open({type:"EachBlock",start:y,end:-1,expression:G,body:ee,context:W,index:H,key:J},ee)}function $f(n,y){n.requireWhitespace();let O=n.readIdentifierName();if(O.name==="")_e(n.index);n.allowWhitespace();let G=n.index,W;if(n.isTypeScript&&n.match("<")){let U=To(n.source,G,{"<":">"});W=n.source.slice(G+1,U-1),n.index=U}n.allowWhitespace(),n.eat("(",!0);let H=1;while(n.index<n.source.length&&(!n.match(")")||H!==1)){if(n.match("("))H++;if(n.match(")"))H--;n.index+=1}n.eat(")",!0);let{node:J}=V(n,`${n.source.slice(0,n.index)} => {}`,G,!0);n.eatClosingBrace();let ee=yn();n.open({type:"SnippetBlock",start:y,end:-1,expression:O,typeParams:W,parameters:J.type==="ArrowFunctionExpression"?J.params:void 0,body:ee},ee)}function Gf(n,y){let O=n.index-1,G=n.current();if(G.type==="IfBlock"){if(!n.eat("else"))D(O,"{:else} or {:else if}");if(n.eat("if"))ze(O);if(G.alternate)ue(O,"{:else}");if(n.allowWhitespace(),G.alternate=yn(),n.setFragment(G.alternate),n.eat("if")){n.requireWhitespace();let W=en(n);n.eatClosingBrace();let H=yn();n.open({start:y,end:-1,type:"IfBlock",elseif:!0,test:W,consequent:H,alternate:null},H)}else n.eatClosingBrace()}else if(G.type==="EachBlock"){if(!n.eat("else"))D(O,"{:else}");if(G.fallback)ue(O,"{:else}");n.eatClosingBrace(),G.fallback=yn(),n.setFragment(G.fallback)}else if(G.type==="AwaitBlock"){let W;if(n.eat("then"))W="then";else if(n.eat("catch"))W="catch";else D(O,"{:then ...} or {:catch ...}");if(G[W])ue(O,`{:${W}}`);if(!n.eat("}")){n.requireWhitespace();let J=ri(n);if(W==="then")G.value=J;else G.error=J;n.eatClosingBrace()}let H=yn();G[W]=H,n.setFragment(H)}else Ke(O)}function Vf(n){let y=n.current(),O=If[y.type];if(!O)Ye(n.index-1);n.eat(O,!0),n.eatClosingBrace();while(y.type==="IfBlock"&&y.elseif)y.end=n.index,n.close(),y=n.current();y.end=n.index,n.close()}function jf(n){return n.type==="CallExpression"||n.type==="ChainExpression"&&n.expression.type==="CallExpression"}function Wf(n,y){if(n.eat("html")){n.requireWhitespace();let O=en(n);n.eatClosingBrace(),n.append({type:"HtmlTag",start:y,end:n.index,expression:O})}else if(n.eat("debug")){let O=[];if(!n.read(rl)){let G=en(n),W=G.type==="SequenceExpression"?G.expressions:[G];for(let H of W){if(H.type!=="Identifier")tt(H.start);O.push(H)}n.eatClosingBrace()}n.append({type:"DebugTag",start:y,end:n.index,identifiers:O})}else if(n.eat("const")){n.requireWhitespace();let O=ri(n);n.allowWhitespace(),n.eat("=",!0),n.allowWhitespace();let G=n.index,W=en(n),H=n.index;if(W.type==="SequenceExpression"&&!n.source.slice(G,W.start).includes("("))Qe(W);n.eatClosingBrace();let J={type:"VariableDeclarator",id:O,init:W,start:O.start,end:H};n.append({type:"ConstTag",start:y,end:n.index,declaration:{type:"VariableDeclaration",kind:"const",declarations:[J],start:y+2,end:n.index-1}})}else if(n.eat("render")){n.requireWhitespace();let O=en(n);if(!jf(O))ct(O);n.eatClosingBrace(),n.append({type:"RenderTag",start:y,end:n.index,expression:O})}else lt(n.index)}var Hf=/(?:var|interface|enum)\b/y,Jf=/(?:let|const|type)\b/y;function Uf(n){let y=n.index;if(n.index+=1,n.allowWhitespace(),n.eat("#"))Ff(n,y);else if(n.eat(":"))Gf(n,y);else if(n.eat("@"))Wf(n,y);else if(n.match("/")&&!n.match("/*")&&!n.match("//"))n.index+=1,Vf(n);else if(!zf(n,y)){let O=en(n);n.eatClosingBrace(),n.append({type:"ExpressionTag",start:y,end:n.index,expression:O})}}function zf(n,y){let O=n.index,G=n.matchRegex(Hf);if(G)ke({start:O,end:O+G.length});if(!n.matchRegex(Jf))return!1;let W=n.root.comments.length,H=Lt(n,n.source,O);if(H.type==="ExpressionStatement")return n.root.comments.length=W,!1;if(H.type!=="VariableDeclaration"||H.kind!=="let"&&H.kind!=="const")ke(H);return n.index=H.end,n.eatClosingBrace(),n.append({type:"DeclarationTag",start:y,end:n.index,declaration:H}),!0}function Xf(n){let{source:y,index:O}=n;if(n.nextAngle<O)n.nextAngle=nl(y,"<",O);if(n.nextBrace<O)n.nextBrace=nl(y,"{",O);let G=Math.min(n.nextAngle,n.nextBrace);n.index=G;let W=y.slice(O,G);n.append({type:"Text",start:O,end:G,raw:W,data:Wn(W,!1,n.entityNames)})}function nl(n,y,O){let G=n.indexOf(y,O);return G===-1?n.length:G}function Cl(n,y,O){let G=So(n,y,O);while(G.index<G.source.length)bo(G);return Co(G)}function So(n,y,O){let G=Or(n);return F(G),new il(G.trimEnd(),G.length,O,y)}function Co(n){if(n.stack.length>1){let W=n.current();if(W.end=W.start+1,W.type==="RegularElement")De(W,W.name);Xe(W)}let{nodes:y}=n.root.fragment,O=y.findIndex((W)=>W.type==="SvelteOptions"),G=y[O];if(G?.type==="SvelteOptions"){y.splice(O,1),n.root.options=Nf(G);let{nodes:W}=G.fragment;if(W.length>0)Et({start:W[0].start,end:W[W.length-1].end},G.name)}return n.root}function bo(n){if(n.match("<"))ho(n);else if(n.match("{"))Uf(n);else Xf(n)}function bl(n,y,O){F(n);let G={isTypeScript:y.typescript??!1,typescript:O,loc:!1,comments:!1,root:{comments:[]}};return Ot(G,n,(W)=>oa(n,y.localExports??!0,W))}function xl(n,y,O){let G=So(n,y,O);return qf(G),Co(G)}function qf(n){let{source:y}=n,{tags:O,comments:G}=Ta(y),W=n.root.fragment.nodes,H=(Ee,Se)=>{if(Se<=Ee)return;let xe=y.slice(Ee,Se),Le=xe.includes("<")||xe.includes("{")?xe:Wn(xe,!1,n.entityNames);W.push({type:"Text",start:Ee,end:Se,raw:xe,data:Le})},J=0,ee=0;for(let Ee of O){for(;ee<G.length&&G[ee]<Ee;ee+=2){let Se=G[ee];if(Se<J)continue;let xe=G[ee+1];H(J,Se),W.push({type:"Comment",start:Se,end:xe,data:y.slice(Se+4,xe-3)}),J=xe}if(Ee<J)continue;H(J,Ee),n.index=Ee,ho(n);while(n.stack.length>1&&n.index<y.length)bo(n);J=n.index}let U=W.filter((Ee)=>Ee.type==="SvelteOptions");W.length=0,W.push(...U)}function vl(n={}){let y=Dl(n),{typescript:O}=y;return{parse:(G,W)=>Cl(G,W,y),parseModule:(G,W={})=>ge(G,W,O),parseImportsExports:(G,W={})=>bl(G,W,O)}}function Pl(n={}){let y=Dl(n);return{parseSections:(O,G)=>xl(O,G,y)}}function Dl(n){return{typescript:We(n.typescript),entityNames:He(n.entities)??$a}}var xo=Ge(he);var Al,Nl;function Fe(n){return Al??=vl({typescript:xo}).parse,Al(n,{css:!1})}function Kt(n){return Nl??=Pl({typescript:xo}).parseSections,Nl(n,{css:!1})}var Kf=/\s*=\s*/,Yf=/^[^"'`\s]\S*$/;function Qf(n){let y=n.indexOf("<");if(y===-1||!n.endsWith(">"))return n;let O=n.slice(0,y),G=n.slice(y+1,-1),W=r(G,",").map((H)=>H.trim().replace(Kf," = ")).join(", ");return`${O}<${W}>`}var Zf=new Set(["restProps","slot","snippet","event","typedef","callback"]),vo=new Set(["property","type"]),kl=new Set(["slot","snippet","typedef","callback"]);function ii(n){if(n.length===0)return;return Mn(n[yi(n)].content)}function wl(n){return!n||!n.tag&&!n.continuesType&&n.content.trim()===""}function em(n){return n.text.split(`
36
+ `).length===n.lines.length}function oi(n,y){if(y<=0)return n;return n.split(`
37
+ `).slice(0,-y).join(`
38
+ `).trimEnd()}var tm=new Set(["abstract","access","alias","alpha","arg","argument","async","augments","author","beta","borrows","const","constructs","copyright","defaultValue","description","emits","experimental","exports","external","fires","function","global","import","inner","instance","kind","lends","license","link","listens","member","name","override","package","private","prop","protected","public","readonly","remarks","requires","satisfies","sealed","static","summary","throws","todo","tutorial","typeParam","version","virtual","yields"]),nm=[...vr,...hi,"type","param","returns","typedef","property","callback","template","generics","slot","snippet","event","restProps","extends","extendProps","deprecated","ignore","internal","sveld-ignore","csspart","cssprop"],rm=/;$/;function im(n){let y=n.trim().replace(rm,"").trimEnd();if(!y.startsWith("{")||!y.endsWith("}"))return!1;return E(y,0)===y.length-1}var om=/[\w$]+/g,sm=new Set(["property","param","returns","return"]);function am(n,y,O){let G=[n[y].type];for(let H=y+1;sm.has(n[H]?.tag);H++)G.push(n[H].type);let W=new Set(G.join(" ").match(om));return O.some(({name:H})=>W.has(H))}function lm(n){let y=n.trim();return!y||y==="object"||y==="Object"}function Ll(n,y){if(y.usedGenericsTag&&y.usedTemplateTag&&!y.warnedMixedGenericsTags){y.warnedMixedGenericsTags=!0;let O=n.componentFilePath?` in ${n.componentFilePath}`:"";console.warn(`Warning: Both @generics and @template tags are used to declare component generics${O}; their declarations are combined in the order encountered.`)}}function _l(n,y,O,G){if(y.seenGenericNames.has(O))Mt(n,"generics-conflict",O,`Duplicate generic name "${O}".`,G);else y.seenGenericNames.add(O)}function Rl(n,y,O){if(n.generics){let W=r(n.generics[0],",").map((H)=>H.trim()).indexOf(y.trim());if(W!==-1){let H=r(n.generics[1],",").map((J)=>J.trim());H[W]=O,n.generics=[n.generics[0],H.join(", ")];return}}_r(n,y,O)}function Ml(n,{name:y,description:O,tags:G,internal:W,source:H},J,ee){if(n.typedefs.has(y))Mt(n,"typedef-duplicate",y,`Duplicate typedef/callback name "${y}"; the later declaration overwrites the earlier one.`,H);n.typedefs.set(y,{type:J,name:y,description:O||void 0,ts:ee,tags:G.length>0?G:void 0,...W?{internal:!0}:{},source:H})}function pm(n,y,O,G,W){let H=y.findIndex((J)=>J.name===O.name);if(H===-1)y.push(O);else{let J=G?` of "${G}"`:"";Mt(n,"property-duplicate",O.name,`Duplicate property "${O.name}"${J}; the later declaration overwrites the earlier one.`,W),y[H]=O}}class Il{tags;lines;commentDescription;commentDescriptionUsed=!1;isFirstTag=!0;event;typedef;callback;typeDeclaration;attachTrailingTag;pendingTags=[];pendingDeprecated;pendingInternal=!1;pendingTypeParameters=[];lineDescriptions=new Map;tagLineNumbers=new Set;consumedDescriptionLines=new Set;indentedContinuationLines=new Set;trimBodyAbove;trimThisBody;hasSlotOrSnippetTag;hasExtendsTag;ctx;generics;documentsFunction;constructor(n,y,O,G){this.ctx=n,this.generics=y,this.documentsFunction=G;let{tags:W,lines:H}=O;this.tags=W,this.lines=H,this.commentDescription=O.description,this.hasSlotOrSnippetTag=W.some((U)=>U.tag==="slot"||U.tag==="snippet"),this.hasExtendsTag=W.some((U)=>U.tag==="extends"||U.tag==="extendProps");for(let U of W)if(U.lines.length>0)this.tagLineNumbers.add(U.lines[0].number);for(let U of H)if(U.continuesType)this.tagLineNumbers.add(U.number);let J=!1,ee=!1;for(let U of H){if(!U.tag&&!U.continuesType&&U.content&&(ee||U.content.trim()!=="}"))this.lineDescriptions.set(U.number,U.content);if(U.tag!==void 0||U.continuesType)J=!0;else if(!U.content.trim());else if(J&&(U.indent||ee))this.indentedContinuationLines.add(U.number);else J=!1;if(Xn(U.content))ee=!ee}}orCommentDescription(n){if(n||!this.isFirstTag||this.commentDescriptionUsed||!this.commentDescription)return n;return this.commentDescriptionUsed=!0,this.commentDescription}typeDeclarationName(n){if(this.pendingTypeParameters.length===0)return Qf(n);let y=`${n}<${this.pendingTypeParameters.join(", ")}>`;return this.pendingTypeParameters.length=0,y}joinBlockLines(n,y){let O=y?y.text.split(`
39
+ `):[],G=y?.line;for(let W of n){if(G!==void 0&&W-G>1){let J=G+1;while(J<W&&wl(this.lines[J]))J++;if(J===W)for(let ee=G+1;ee<W;ee++)O.push("")}let H=this.lines[W];O.push(H.indent+H.content),G=W}return xr(O)}getPrecedingDescription(n){if(n.length===0)return;let y=n[0].number,O=[],G=!1;for(let W=y-1;W>=0;W--){if(this.tagLineNumbers.has(W)||this.indentedContinuationLines.has(W)||this.consumedDescriptionLines.has(W))break;if(this.lineDescriptions.has(W))O.unshift(W),G=!0;else if(G&&!wl(this.lines[W]))break}if(O.length===0)return;for(let W of O)this.consumedDescriptionLines.add(W);return this.trimBodyAbove?.(O[0]),this.joinBlockLines(O)}claimBodyLines(n,y){if(!em(n)){for(let G=1;G<n.lines.length;G++)this.consumedDescriptionLines.add(n.lines[G].number);return}let O=n.lines[n.lines.length-1].number;this.trimThisBody=(G)=>y(O-G+1)}getTagDescription(n,y,O=!1){let G=ii(n),W=y!==void 0&&Zf.has(y.tag)&&!ii(y.lines),H=O&&(y===void 0||!vo.has(y.tag)),J=[];for(let ee=1;ee<n.length;ee++){let U=n[ee];if((W||H)&&!this.indentedContinuationLines.has(U.number))continue;if(!this.lineDescriptions.get(U.number)?.trim()||this.consumedDescriptionLines.has(U.number))continue;J.push(U.number),this.consumedDescriptionLines.add(U.number)}if(J.length===0)return G;return this.joinBlockLines(J,{text:G??"",line:n[yi(n)].number})}flagDescriptionAfterEvent(n,y,O,G){let{event:W}=this;if(W===void 0||W.description)return;if(W.tagLine!==void 0&&this.indentedContinuationLines.has(W.tagLine+1))return;if(G?.tag!=="event"&&!vo.has(G?.tag??""))return;if(ii(O))return;let H=y?`@${n} "${y}"`:`@${n}`;Mt(this.ctx,"event-description-ambiguous",W.name,`Text after @event "${W.name}" was used as the description of ${H}. Move it above the tag it describes, indent it as a continuation line, or give each event its own comment block.`,un(this.ctx,O))}takePrecedingDescription(n){let{tag:y,name:O,lines:G}=this.tags[n],W=this.getPrecedingDescription(G);if(W)this.flagDescriptionAfterEvent(y,O,G,this.tags[n-1]);return W}finalizeEvent(){let{ctx:n,event:y}=this;if(y===void 0)return;this.event=void 0;let G=(y.type&&y.type!=="object"&&y.type!=="Object"?y.type:void 0)??(y.properties.length>0?lr(y.properties,!0):y.type||""),{tagLine:W}=y;if(W!==void 0){let Ee=this.tags.find((xe)=>{let Le=xe.lines[0]?.number;return Le!==void 0&&Le>W&&!vo.has(xe.tag)})?.lines[0].number,Se=Array.from(this.lineDescriptions.keys()).sort((xe,Le)=>xe-Le).filter((xe)=>xe>W&&(Ee===void 0||xe<Ee)&&!this.consumedDescriptionLines.has(xe)&&this.lineDescriptions.get(xe)?.trim());for(let xe of Se)this.consumedDescriptionLines.add(xe);if(Se.length>0)y.description=this.joinBlockLines(Se,y.description?{text:y.description,line:W}:void 0)}let{name:H,description:J,source:ee}=y,U=G===""&&(!n.events.has(H)||n.untypedJsDocEventNames.has(H));if(Sn(n,{name:H,detail:G,has_argument:!1,description:J,deprecated:y.deprecated,tags:y.tags.length>0?y.tags:void 0,internal:y.internal||void 0,source:ee}),U)n.untypedJsDocEventNames.add(H);n.eventDescriptions.set(H,J),n.jsDocEventNames.add(H),n.jsDocEventSources.set(H,ee),hn(n,"event-no-source",H,y.ignores)}finalizeTypedef(){let{ctx:n,typedef:y}=this;if(y===void 0)return;this.typedef=void 0;let{properties:O}=y,G=O.length>0,W=G?lr(O,!0):y.type||"{}",H=!G&&y.type&&im(W)?`interface ${y.name} ${W}`:`type ${y.name} = ${W};`,J=G?O.filter(({name:ee})=>!ee.includes(".")&&!ee.startsWith("[")).map(({name:ee,type:U,optional:Ee,description:Se})=>({name:ee,type:U,optional:Ee===!0,...Se?{description:Se}:{}})):d(W,{skipIndexSignatures:!0});if(J)n.typedefMembersByName.set(y.name,J);Ml(n,y,W,H)}finalizeCallback(){let{callback:n}=this;if(n===void 0)return;this.callback=void 0;let y=`(${h(n.params)}) => ${n.returnType||"void"}`;Ml(this.ctx,n,y,`type ${n.name} = ${y};`)}openTypeDeclaration(n){let{name:y,lines:O}=this.tags[n],G={name:this.typeDeclarationName(y),source:un(this.ctx,O),description:this.orCommentDescription(this.getTagDescription(O,this.tags[n+1])||this.takePrecedingDescription(n)),tags:this.pendingTags.splice(0),internal:this.pendingInternal},{tags:W}=G;if(this.pendingDeprecated!==void 0)W.push({name:"deprecated",body:this.pendingDeprecated===!0?"":this.pendingDeprecated}),this.pendingDeprecated=void 0;return this.pendingInternal=!1,this.attachTrailingTag=(H)=>W.push(H),this.isFirstTag=!1,G}readExtends(n,y){let{name:O,lines:G}=this.tags[n];if(this.ctx.extends!==void 0)Mt(this.ctx,"extend-props-duplicate",O,`A second @extends/@extendProps tag ("${O}") overwrote the first ("${this.ctx.extends.interface}"); only one is used.`,un(this.ctx,G));this.ctx.extends={interface:O,import:Yf.test(y)?JSON.stringify(y):y},this.isFirstTag=!1}readRestProps(n,y){let{name:O,description:G}=this.tags[n],W=O?G?`${O} ${G}`:O:G,H=Mn(W),J=this.orCommentDescription(H||this.takePrecedingDescription(n)),ee={type:"Element",name:y,description:J||void 0};if(this.ctx.rest_props=ee,H)this.claimBodyLines(this.tags[n],(U)=>{ee.description=Mn(oi(W,U))||void 0});this.isFirstTag=!1}readSlot(n,y){let{tag:O,name:G,lines:W}=this.tags[n],H=G==="-"||O==="snippet"&&G==="children"?void 0:G,J=this.orCommentDescription(this.getTagDescription(W,this.tags[n+1]));if(!J&&this.pendingTags.length===0)J=this.takePrecedingDescription(n);this.isFirstTag=!1;let ee=y||"Record<string, never>",U=un(this.ctx,W);if(!y)Mt(this.ctx,"slot-missing-type",H||"default",`@${O}${H?` "${H}"`:""} is missing a required {Type} annotation; falling back to "${ee}".`,U);let Ee=this.pendingTags.splice(0),Se=bn(H);this.ctx.jsDocSlots.set(Se,{tag:O,source:U}),fr(this.ctx,{slot_name:H,slot_props:ee,slot_description:J||void 0,slot_deprecated:this.pendingDeprecated,slot_tags:Ee.length>0?Ee:void 0,slot_internal:this.pendingInternal||void 0,source:U}),this.pendingDeprecated=void 0,this.pendingInternal=!1,this.typeDeclaration=void 0,this.attachTrailingTag=(xe)=>{let Le=this.ctx.slots.get(Se);if(Le)Le.tags=[...Le.tags??[],xe]}}readEvent(n,y){let{name:O,lines:G}=this.tags[n],W=ii(G)||this.takePrecedingDescription(n);this.finalizeEvent();let H=this.pendingTags.splice(0);this.event={name:O,type:y,tagLine:G.length>0?G[0].number:void 0,description:this.orCommentDescription(W),source:un(this.ctx,G),tags:H,internal:this.pendingInternal,deprecated:this.pendingDeprecated,ignores:[],properties:[]},this.pendingInternal=!1,this.pendingDeprecated=void 0,this.typeDeclaration=void 0,this.attachTrailingTag=(J)=>H.push(J),this.isFirstTag=!1}readProperty(n,y){let{name:O,optional:G,default:W,lines:H}=this.tags[n],J=this.getTagDescription(H,this.tags[n+1],this.event!==void 0),ee=this.event??(this.typedef&&lm(this.typedef.type)?this.typedef:void 0);if(ee===void 0)return;pm(this.ctx,ee.properties,{name:O,type:y,description:J,optional:G||!1,default:W},ee.name,un(this.ctx,H))}readTypedef(n,y){this.finalizeTypedef(),this.typedef={...this.openTypeDeclaration(n),type:y,properties:[]},this.typeDeclaration=this.typedef}readCallback(n){this.finalizeCallback(),this.callback={...this.openTypeDeclaration(n),params:[],returnType:void 0},this.typeDeclaration=this.callback}readGenerics(n,y){let{name:O,lines:G}=this.tags[n],W=un(this.ctx,G);for(let H of r(O,","))_l(this.ctx,this.generics,H.trim(),W);this.generics.usedGenericsTag=!0,Ll(this.ctx,this.generics),Rl(this.ctx,O,y||O),this.isFirstTag=!1}readTemplate(n,y){let{tags:O}=this,G=Si(O[n],y),W=n+1;while(O[W]?.tag==="template")W++;let H=O[W];if((H?.tag==="typedef"||H?.tag==="callback")&&!H.name.includes("<")&&am(O,W,G)){this.pendingTypeParameters.push(...G.map(({constraint:ee})=>ee));return}if(this.hasSlotOrSnippetTag&&!this.hasExtendsTag){this.ctx.deferredSlotBlockGenerics.push(...G);return}if(this.documentsFunction)return;let J=un(this.ctx,O[n].lines);for(let ee of G)_l(this.ctx,this.generics,ee.name,J),Rl(this.ctx,ee.name,ee.constraint);this.generics.usedTemplateTag=!0,Ll(this.ctx,this.generics),this.isFirstTag=!1}readDeprecated(n){let{text:y}=this.tags[n],{event:O}=this;if(!O&&this.typeDeclaration){let W={name:"deprecated",body:y};this.typeDeclaration.tags.push(W),this.claimBodyLines(this.tags[n],(H)=>{W.body=oi(y,H)});return}if((O?O.deprecated:this.pendingDeprecated)!==void 0)return;let G=(W)=>{if(O)O.deprecated=W;else this.pendingDeprecated=W};G(Pr(y)),this.claimBodyLines(this.tags[n],(W)=>{G(Pr(oi(y,W)))})}readPassthrough(n){let{tag:y,text:O,lines:G}=this.tags[n],W={name:y,body:O};if(this.claimBodyLines(this.tags[n],(H)=>{W.body=oi(O,H)}),!vr.has(y)&&!hi.has(y)){let H=tm.has(y)?void 0:L(y,nm,y.length<=4?1:2);Mt(this.ctx,"jsdoc-unknown-tag",y,H?`Unknown JSDoc tag "@${y}"; did you mean "@${H}"? Passed through unchanged.`:`Unknown JSDoc tag "@${y}"; passed through unchanged. If this is a typo, fix the tag name.`,un(this.ctx,G))}if(this.attachTrailingTag)this.attachTrailingTag(W);else this.pendingTags.push(W)}read(){let{tags:n}=this;for(let G=0;G<n.length;G++){let{tag:W,type:H,name:J,optional:ee}=n[G],U=sn(H);switch(this.trimBodyAbove=this.trimThisBody,this.trimThisBody=void 0,W){case"extends":case"extendProps":this.readExtends(G,U);break;case"restProps":this.readRestProps(G,U);break;case"slot":case"snippet":this.readSlot(G,U);break;case"csspart":{let Ee=this.getTagDescription(n[G].lines,n[G+1]);this.ctx.cssParts.push({name:J,...Ee?{description:Ee}:{}});break}case"cssprop":case"cssproperty":{let Ee=this.getTagDescription(n[G].lines,n[G+1]),Se=n[G].default;this.ctx.cssProperties.push({name:J,...U?{type:U}:{},...Se===void 0?{}:{default:Se},...Ee?{description:Ee}:{}});break}case"event":this.readEvent(G,U);break;case"type":if(this.event)this.event.type=U;break;case"param":this.callback?.params.push({name:J,type:U,optional:ee||!1});break;case"returns":case"return":if(this.callback)this.callback.returnType=U;break;case"property":this.readProperty(G,U);break;case"typedef":this.readTypedef(G,U);break;case"callback":this.readCallback(G);break;case"generics":this.readGenerics(G,U);break;case"template":this.readTemplate(G,U);break;case"deprecated":this.readDeprecated(G);break;case"ignore":case"internal":if(this.event)this.event.internal=!0;else if(this.typeDeclaration)this.typeDeclaration.internal=!0;else this.pendingInternal=!0;break;case"sveld-ignore":this.event?.ignores.push(J);break;case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:this.readPassthrough(G);break}if(kl.has(W))this.finalizeEvent()}this.finalizeEvent(),this.finalizeTypedef(),this.finalizeCallback();let y=[...this.pendingTags,...this.pendingDeprecated===void 0?[]:[{name:"deprecated"}],...this.pendingInternal?[{name:"internal"}]:[]];if(y.length===0)return;if(!n.some((G)=>G.tag==="event"||kl.has(G.tag)))return;for(let G of y)Mt(this.ctx,"jsdoc-tag-dropped",G.name,`@${G.name} could not attach to a @slot/@snippet/@event/@typedef/@callback tag in the same comment block and was dropped.`)}}function Fl(n,y=n.source){if(!y)return;let O={usedGenericsTag:!1,usedTemplateTag:!1,warnedMixedGenericsTags:!1,seenGenericNames:new Set},G=y.includes("@template")?Fo(n):new Set;n.functionDocCommentStarts=G;let W=qn(y);for(let H of W)n.jsDocBlocksByStart.set(H.start,H);for(let H of W)new Il(n,O,H,G.has(H.start)).read()}var Bl=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]),cm=Array.from(Bl);function Ol(n){return n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||n===95||n===36}function dm(n){if(n.includes("\\u"))return!0;for(let y of cm){let O=n.indexOf(y);while(O!==-1){if(!Ol(n.charCodeAt(O-1))&&!Ol(n.charCodeAt(O+y.length)))return!0;O=n.indexOf(y,O+1)}}return!1}function um(n,y){for(let O=y.length-1;O>=0;O-=1)if(y[O]?.has(n))return!0;return!1}function fm(n){let y=new Set;switch(n.type){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":if(n.type!=="ArrowFunctionExpression"&&n.id)y.add(n.id.name);for(let O of n.params)Zt(O,y);break;case"BlockStatement":si(n.body,y);break;case"CatchClause":Zt(n.param,y);break;case"EachBlock":if(Zt(n.context,y),n.index)y.add(n.index);break;case"AwaitBlock":Zt(n.value,y),Zt(n.error,y);break}return y}function si(n,y){for(let O of n??[])switch(O.type){case"ImportDeclaration":for(let G of O.specifiers)y.add(G.local.name);break;case"VariableDeclaration":for(let G of O.declarations)Zt(G.id,y);break;case"FunctionDeclaration":case"ClassDeclaration":if(O.id?.name)y.add(O.id.name);break;case"ExportNamedDeclaration":if(O.declaration)si([O.declaration],y);break}}function Po(n,y){if(!n)return!1;let O=[...y],G=!1;return o(n,{enter(W,H){if(le(W.type))return p;if($n(W))O.push(fm(W));if(W.type==="Identifier"&&Bl.has(W.name)&&z(W,H)&&!um(W.name,O))return G=!0,C},leave(W){if($n(W))O.pop()}}),G}function $l(n){if(n.runesOptionOverride!==void 0)return n.runesOptionOverride?"runes":"legacy";let y=n.parsed;if(!y)return"legacy";if(n.source!==void 0&&!dm(n.source))return"legacy";let O=new Set;si(y.module?.content.body,O);let G=new Set;return si(y.instance?.content.body,G),Po(y.module,[O])||Po(y.instance,[O,G])||Po(y.fragment,[O,G])?"runes":"legacy"}var mm=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function gm(n){if(n.type!=="TSAsExpression"&&n.type!=="TSTypeAssertion")return!1;let y="typeAnnotation"in n?n.typeAnnotation:void 0;return y?.type==="TSTypeReference"&&y.typeName.type==="Identifier"&&y.typeName.name==="const"}function ai(n,y){if(!n)return;o(n,{enter(O){if(!mm.has(O.type)||!("expression"in O)||!O.expression)return;let{expression:G}=O;if(typeof G!=="object")return G;let W=y.typeAssertions.get(O);if(y.constAssertions.has(O)||W===void 0&&gm(O))y.constAssertions.add(G);else if(W!==void 0)y.typeAssertions.set(G,W);else if((O.type==="TSAsExpression"||O.type==="TSTypeAssertion")&&"typeAnnotation"in O)y.typeAssertions.set(G,O.typeAnnotation);return G}})}var ym=/\/\/(?<!^[ \t]*\*.*\/\/)\s*@ts-[^\n\r]*/gm;function hm(n){if(!n.includes("@ts-"))return n;let y=n.charCodeAt(0)===65279?1:0,{instance:O,module:G}=Qi(n),W=[O,G].flatMap((ee)=>ee?[ee.content]:[]).sort((ee,U)=>ee.start-U.start),H="",J=0;for(let{start:ee,end:U}of W)H+=n.slice(J,ee+y),H+=n.slice(ee+y,U+y).replace(ym,""),J=U+y;return H+n.slice(J)}function Gl(n,y,O){n.componentFilePath=O;let G=hm(y);n.source=G;let W=Fe(G);if($s(n,W),n.parsed=W,n.scriptLanguage==="ts")ai(W.module,n.typeCasts),ai(W.instance,n.typeCasts),ai(W.fragment,n.typeCasts);n.syntaxMode=$l(n);let H=W.css,J=H?G.slice(0,H.start)+" ".repeat(H.end-H.start)+G.slice(H.end):G;Ae(n,W.module),Ae(n,W.instance),Fl(n,J)}class ne{ctx=li();cleanup(){this.ctx=li()}parseSvelteComponent(n,y){let{component:O,pending:G}=this.parse(n,y);if(G)O[v]={...O[v]??{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[]},...G};return O}parse(n,y){this.cleanup();let O=this.ctx;Gl(O,n,y.filePath),Oa(O);let G=Us(O);return ka(O,G)}}
40
+ export{Ut,te,Jt,Vt,Gt,Fe,Kt,ne};
package/cli-entry.js CHANGED
@@ -1,4 +1,4 @@
1
- import{L,n,$t,ye,xe,q,O,G,ee,H,U,Ie,Le,Oe}from"./chunk-yv6ea3ve.js";import{existsSync as v}from"node:fs";import{join as S}from"node:path";var f="src/index.js",m={SUCCESS:0,USAGE_ERROR:1,GENERATION_FAILURE:2,BREAKING_CHANGE:3,DIAGNOSTICS:4},x=`Usage: sveld [options]
1
+ import{L,n,Mt,xe,Ee,G,O,W,ee,U,J,Le,Oe,Me}from"./chunk-ep5n8z9k.js";import{existsSync as v}from"node:fs";import{join as S}from"node:path";var f="src/index.js",m={SUCCESS:0,USAGE_ERROR:1,GENERATION_FAILURE:2,BREAKING_CHANGE:3,DIAGNOSTICS:4},x=`Usage: sveld [options]
2
2
 
3
3
  Generate TypeScript definitions and component documentation for a Svelte
4
4
  library. With no flags, only TypeScript definitions are generated for the
@@ -18,7 +18,7 @@ Options:
18
18
  -q, --quiet Suppress progress logs (errors, the diagnostics summary, and the --check report are unaffected)
19
19
  --stdout Print the document from exactly one of --json or --markdown to stdout and write nothing to disk (rejects --types and --check)
20
20
  --cache[=<path>] Persist parsed output and skip re-parsing unchanged files (on by default, default path: node_modules/.cache/sveld/parse-cache.json; pass --cache=false to disable)
21
- --check-examples[=syntax] Check @example blocks: TS/JS against the TypeScript program, svelte/html markup against sveast; --check-examples=syntax runs only the markup path and never loads TypeScript
21
+ --check-examples[=syntax] Check @example blocks: TS/JS against the TypeScript program, svelte/html markup against svelte-ast; --check-examples=syntax runs only the markup path and never loads TypeScript
22
22
  --report-diagnostics Print unresolved-type diagnostics to stderr
23
23
  --strict[=errors] Exit with code 4 when diagnostics exist (implies --report-diagnostics); --strict=errors only fails on error-severity diagnostics
24
24
  --types-format=<format> ".d.ts" output format: "class" (default) or "component" (Svelte 5 Component<...>)
@@ -35,4 +35,4 @@ Exit codes:
35
35
  2 generation failure
36
36
  3 breaking API change detected by --check
37
37
  4 diagnostics present under --strict
38
- `,E=["help","version","glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","entry","config","cache","check","check-level","types-format","types-index-types","format"],k=new Map([["-h","--help"],["-v","--version"],["-q","--quiet"]]),b=/[A-Z]/g,w=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),R=new Set(["entry","config","cache","check","types-format"]),C=new Set(["entry","config","types-format"]);function A(o){let s=o.replace(b,(r)=>`-${r.toLowerCase()}`);return L(s,E)}function j(o,s){let r=o.indexOf("="),t=r===-1?o.slice(2):o.slice(2,r),i=r===-1?!0:o.slice(r+1),e=!1;if(r===-1&&R.has(t)){if(s!==void 0&&!s.startsWith("--")&&!k.has(s))i=s,e=!0;else if(C.has(t))return{result:{kind:"usage-error",message:`sveld: --${t} requires a value (pass --${t}=<value> or --${t} <value>).`},consumedNext:!1,flag:t}}return{result:P(t,i,o),consumedNext:e,flag:t}}function P(o,s,r){let t=(c)=>({kind:"option",option:c}),i=s===!0||s==="true",e=typeof s==="string"?s:void 0;switch(o){case"help":return{kind:"help"};case"version":return{kind:"version"};case"glob":case"types":case"json":case"markdown":case"quiet":return t({[o]:i});case"stdout":if(i)return t({stdout:!0});if(s==="false")return t({stdout:!1});return{kind:"usage-error",message:`sveld: --stdout does not take a value; got "${s}".`};case"strict":if(i)return t({strict:!0});if(s==="false")return t({strict:!1});return t({strict:s});case"report-diagnostics":return t({reportDiagnostics:i});case"check-examples":if(i)return t({checkExamples:!0});if(s==="false")return t({checkExamples:!1});return t({checkExamples:s});case"fail-fast":return t({failFast:i});case"entry":return t(e===void 0?{}:{entry:e});case"config":return t(e===void 0?{}:{config:e});case"cache":if(s==="false")return t({cache:!1});return t({cache:e??!0});case"check":if(s==="false")return t({check:!1});return t({check:e??!0});case"types-format":return t(e===void 0?{}:{typesOptions:{format:e}});case"types-index-types":return t({typesOptions:{indexTypes:i}});case"format":return t(e===void 0?{}:{format:e});case"check-level":return t(e===void 0?{}:{checkLevel:e});default:return{kind:"unknown",arg:r,suggestion:A(o)}}}function T(o){let s={},r=!1;for(let t=0;t<o.length;t++){let i=k.get(o[t])??o[t];if(!i.startsWith("--"))return{kind:"unknown",arg:i,positionalHint:r?!0:void 0};let{result:e,consumedNext:c,flag:l}=j(i,o[t+1]);if(e.kind!=="option")return e;if(s=O(s,e.option),r=w.has(l),c)t++}return{kind:"options",options:s}}function u(o,s){return o!==void 0&&!s.includes(o)}async function _(o){let s=(a)=>{console.error(a),o.exitCode=m.USAGE_ERROR},r=T(o.argv.slice(2));if(r.kind==="help"){console.log(x);return}if(r.kind==="version"){console.log($t.version);return}if(r.kind==="usage-error")return s(r.message);if(r.kind==="unknown"){let a=`sveld: unknown flag "${r.arg}".`;if(r.suggestion)a+=` Did you mean "--${r.suggestion}"?`;if(r.positionalHint)a+=" Values are passed as --flag=value or --flag value.";return console.error(a),s("Run sveld --help for a list of available flags.")}let t=r.options,i;try{i=await q(t.config,o.cwd(),!0)}catch(a){return s(a instanceof Error?a.message:String(a))}let e=O(i,t);if(G(e),e.stdout){if([e.json,e.markdown].filter(Boolean).length!==1)return s("sveld: --stdout requires exactly one of --json or --markdown.");if(e.types===!0)return s("sveld: --stdout cannot be combined with --types; type definitions span multiple files.");if(e.check)return s("sveld: --stdout cannot be combined with --check; both write their document to stdout.")}if(u(e.format,["text","json","github"]))return s(`sveld: --format must be "text", "json", or "github"; got "${e.format}".`);if(u(e.strict,[!0,!1,"errors"]))return s(`sveld: --strict must be "errors" when given a value; got "${e.strict}".`);if(u(e.checkLevel,["major","minor","patch"]))return s(`sveld: --check-level must be "major", "minor", or "patch"; got "${e.checkLevel}".`);if(u(e.checkExamples,[!0,!1,"syntax"]))return s(`sveld: --check-examples must be "syntax" when given a value; got "${e.checkExamples}".`);let c=e.typesOptions?.format;if(u(c,["class","component"]))return s(`sveld: --types-format must be "class" or "component"; got "${c}".`);H(e.quiet===!0);let l=Ie(e.entry),d;if(l.entry!==null)d=l.entry;else if(!l.configured&&v(S(o.cwd(),f)))console.error(`sveld: no entry point configured; using "${f}". Set package.json#svelte (or pass --entry) to silence this.`),d=ee(n(f));else return s(`sveld: ${l.message}`);let g;try{g=await Le(d,e,e.stdout===!0)}catch(a){if(a instanceof U)return s(`sveld: ${a.message}`);console.error(a instanceof Error?a.message:String(a)),o.exitCode=m.GENERATION_FAILURE;return}let{result:y,check:p}=g,{exitCode:h}=Oe(y,p,e,d);if(p)if(e.format==="json")o.stdout.write(xe(p));else console.log(ye(p));if(h!==m.SUCCESS)o.exitCode=h}export{_ as cli};
38
+ `,E=["help","version","glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","entry","config","cache","check","check-level","types-format","types-index-types","format"],k=new Map([["-h","--help"],["-v","--version"],["-q","--quiet"]]),b=/[A-Z]/g,w=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),R=new Set(["entry","config","cache","check","types-format"]),C=new Set(["entry","config","types-format"]);function A(o){let s=o.replace(b,(r)=>`-${r.toLowerCase()}`);return L(s,E)}function j(o,s){let r=o.indexOf("="),t=r===-1?o.slice(2):o.slice(2,r),i=r===-1?!0:o.slice(r+1),e=!1;if(r===-1&&R.has(t)){if(s!==void 0&&!s.startsWith("--")&&!k.has(s))i=s,e=!0;else if(C.has(t))return{result:{kind:"usage-error",message:`sveld: --${t} requires a value (pass --${t}=<value> or --${t} <value>).`},consumedNext:!1,flag:t}}return{result:P(t,i,o),consumedNext:e,flag:t}}function P(o,s,r){let t=(c)=>({kind:"option",option:c}),i=s===!0||s==="true",e=typeof s==="string"?s:void 0;switch(o){case"help":return{kind:"help"};case"version":return{kind:"version"};case"glob":case"types":case"json":case"markdown":case"quiet":return t({[o]:i});case"stdout":if(i)return t({stdout:!0});if(s==="false")return t({stdout:!1});return{kind:"usage-error",message:`sveld: --stdout does not take a value; got "${s}".`};case"strict":if(i)return t({strict:!0});if(s==="false")return t({strict:!1});return t({strict:s});case"report-diagnostics":return t({reportDiagnostics:i});case"check-examples":if(i)return t({checkExamples:!0});if(s==="false")return t({checkExamples:!1});return t({checkExamples:s});case"fail-fast":return t({failFast:i});case"entry":return t(e===void 0?{}:{entry:e});case"config":return t(e===void 0?{}:{config:e});case"cache":if(s==="false")return t({cache:!1});return t({cache:e??!0});case"check":if(s==="false")return t({check:!1});return t({check:e??!0});case"types-format":return t(e===void 0?{}:{typesOptions:{format:e}});case"types-index-types":return t({typesOptions:{indexTypes:i}});case"format":return t(e===void 0?{}:{format:e});case"check-level":return t(e===void 0?{}:{checkLevel:e});default:return{kind:"unknown",arg:r,suggestion:A(o)}}}function T(o){let s={},r=!1;for(let t=0;t<o.length;t++){let i=k.get(o[t])??o[t];if(!i.startsWith("--"))return{kind:"unknown",arg:i,positionalHint:r?!0:void 0};let{result:e,consumedNext:c,flag:l}=j(i,o[t+1]);if(e.kind!=="option")return e;if(s=O(s,e.option),r=w.has(l),c)t++}return{kind:"options",options:s}}function u(o,s){return o!==void 0&&!s.includes(o)}async function _(o){let s=(a)=>{console.error(a),o.exitCode=m.USAGE_ERROR},r=T(o.argv.slice(2));if(r.kind==="help"){console.log(x);return}if(r.kind==="version"){console.log(Mt.version);return}if(r.kind==="usage-error")return s(r.message);if(r.kind==="unknown"){let a=`sveld: unknown flag "${r.arg}".`;if(r.suggestion)a+=` Did you mean "--${r.suggestion}"?`;if(r.positionalHint)a+=" Values are passed as --flag=value or --flag value.";return console.error(a),s("Run sveld --help for a list of available flags.")}let t=r.options,i;try{i=await G(t.config,o.cwd(),!0)}catch(a){return s(a instanceof Error?a.message:String(a))}let e=O(i,t);if(W(e),e.stdout){if([e.json,e.markdown].filter(Boolean).length!==1)return s("sveld: --stdout requires exactly one of --json or --markdown.");if(e.types===!0)return s("sveld: --stdout cannot be combined with --types; type definitions span multiple files.");if(e.check)return s("sveld: --stdout cannot be combined with --check; both write their document to stdout.")}if(u(e.format,["text","json","github"]))return s(`sveld: --format must be "text", "json", or "github"; got "${e.format}".`);if(u(e.strict,[!0,!1,"errors"]))return s(`sveld: --strict must be "errors" when given a value; got "${e.strict}".`);if(u(e.checkLevel,["major","minor","patch"]))return s(`sveld: --check-level must be "major", "minor", or "patch"; got "${e.checkLevel}".`);if(u(e.checkExamples,[!0,!1,"syntax"]))return s(`sveld: --check-examples must be "syntax" when given a value; got "${e.checkExamples}".`);let c=e.typesOptions?.format;if(u(c,["class","component"]))return s(`sveld: --types-format must be "class" or "component"; got "${c}".`);U(e.quiet===!0);let l=Le(e.entry),d;if(l.entry!==null)d=l.entry;else if(!l.configured&&v(S(o.cwd(),f)))console.error(`sveld: no entry point configured; using "${f}". Set package.json#svelte (or pass --entry) to silence this.`),d=ee(n(f));else return s(`sveld: ${l.message}`);let g;try{g=await Oe(d,e,e.stdout===!0)}catch(a){if(a instanceof J)return s(`sveld: ${a.message}`);console.error(a instanceof Error?a.message:String(a)),o.exitCode=m.GENERATION_FAILURE;return}let{result:y,check:p}=g,{exitCode:h}=Me(y,p,e,d);if(p)if(e.format==="json")o.stdout.write(Ee(p));else console.log(xe(p));if(h!==m.SUCCESS)o.exitCode=h}export{_ as cli};
package/index.d.ts CHANGED
@@ -596,7 +596,7 @@ interface GenerateBundleOptions {
596
596
  * Check `@example` blocks on props, module exports, slots, and events.
597
597
  * `true` runs plain TS/JS examples through the TypeScript program
598
598
  * (`example-compile-error` diagnostics; requires `typescript`) and
599
- * Svelte/HTML examples through sveld's template parser (sveast)
599
+ * Svelte/HTML examples through sveld's template parser (svelte-ast)
600
600
  * (`example-syntax-error` diagnostics; no `typescript` needed). Pass
601
601
  * `"syntax"` to run only the markup path, so `typescript` is never loaded
602
602
  * even when TS/JS examples exist. Off by default.