sveld 0.36.1 → 0.36.2

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.
@@ -1,20 +0,0 @@
1
- import{A as $0,B as J0,C as NO,D as y0,E as ZO,H as eO,I as v,J as r0,K as x,L as YO,M as vO,N as gO,O as yO,P as _0,Q as xO,R as uO,S as O1,T as RO,U as Z1,V as mO,v as DO,w as U0,x as Q0,y as tO,z as C0}from"./chunk-8myyzjb1.js";import{X as $1}from"./chunk-gc8z6pa7.js";class A0{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:(O)=>this.replacement=O}}replace(O,Z,$,Q){if(O&&Z)if($!=null)O[Z][$]=Q;else O[Z]=Q}remove(O,Z,$){if(O&&Z)if($!==null&&$!==void 0)O[Z].splice($,1);else delete O[Z]}}class T0 extends A0{constructor(O,Z){super();this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:($)=>this.replacement=$},this.enter=O,this.leave=Z}visit(O,Z,$,Q){if(O){if(this.enter){let Y=this.should_skip,X=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,O,Z,$,Q),this.replacement)O=this.replacement,this.replace(Z,$,Q,O);if(this.should_remove)this.remove(Z,$,Q);let q=this.should_skip,H=this.should_remove;if(this.should_skip=Y,this.should_remove=X,this.replacement=K,q)return O;if(H)return null}let W;for(W in O){let Y=O[W];if(Y&&typeof Y==="object"){if(Array.isArray(Y)){let X=Y;for(let K=0;K<X.length;K+=1){let q=X[K];if($O(q)){if(!this.visit(q,O,W,K))K--}}}else if($O(Y))this.visit(Y,O,W,null)}}if(this.leave){let Y=this.replacement,X=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,O,Z,$,Q),this.replacement)O=this.replacement,this.replace(Z,$,Q,O);if(this.should_remove)this.remove(Z,$,Q);let K=this.should_remove;if(this.replacement=Y,this.should_remove=X,K)return null}}return O}}function $O(O){return O!==null&&typeof O==="object"&&"type"in O&&typeof O.type==="string"}function K0(O,{enter:Z,leave:$}){return new T0(Z,$).visit(O,null)}var QO={a:"HTMLAnchorElement",abbr:"HTMLElement",address:"HTMLElement",applet:"HTMLUnknownElement",area:"HTMLAreaElement",article:"HTMLElement",aside:"HTMLElement",audio:"HTMLAudioElement",b:"HTMLElement",base:"HTMLBaseElement",basefont:"HTMLElement",bdi:"HTMLElement",bdo:"HTMLElement",blockquote:"HTMLQuoteElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",cite:"HTMLElement",code:"HTMLElement",col:"HTMLTableColElement",colgroup:"HTMLTableColElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",dd:"HTMLElement",del:"HTMLModElement",details:"HTMLDetailsElement",dfn:"HTMLElement",dialog:"HTMLDialogElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",dt:"HTMLElement",em:"HTMLElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",figcaption:"HTMLElement",figure:"HTMLElement",font:"HTMLFontElement",footer:"HTMLElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",h2:"HTMLHeadingElement",h3:"HTMLHeadingElement",h4:"HTMLHeadingElement",h5:"HTMLHeadingElement",h6:"HTMLHeadingElement",head:"HTMLHeadElement",header:"HTMLElement",hgroup:"HTMLElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",i:"HTMLElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",ins:"HTMLModElement",kbd:"HTMLElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",main:"HTMLElement",map:"HTMLMapElement",mark:"HTMLElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",nav:"HTMLElement",noscript:"HTMLElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",picture:"HTMLPictureElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",rp:"HTMLElement",rt:"HTMLElement",ruby:"HTMLElement",s:"HTMLElement",samp:"HTMLElement",script:"HTMLScriptElement",search:"HTMLElement",section:"HTMLElement",select:"HTMLSelectElement",slot:"HTMLSlotElement",small:"HTMLElement",source:"HTMLSourceElement",span:"HTMLSpanElement",strong:"HTMLElement",style:"HTMLStyleElement",sub:"HTMLElement",summary:"HTMLElement",sup:"HTMLElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",td:"HTMLTableCellElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",tfoot:"HTMLTableSectionElement",th:"HTMLTableCellElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",u:"HTMLElement",ul:"HTMLUListElement",var:"HTMLElement",video:"HTMLVideoElement",wbr:"HTMLElement"};function Q1(O){return O in QO}function WO(O){if(Q1(O))return QO[O];return"HTMLElement"}var W1=/\w/;function Y1(O,Z){let $=O.trim();if(!$.startsWith("{")||!$.endsWith("}"))return;let Q=$.slice(1,-1),W=[],Y=0,X="";for(let K of Q)if(K==="{"||K==="<"||K==="("||K==="[")Y++,X+=K;else if(K==="}"||K===">"||K===")"||K==="]")Y--,X+=K;else if((K===";"||K===",")&&Y===0)W.push(X.trim()),X="";else X+=K;if(X.trim())W.push(X.trim());for(let K of W){if(!K.startsWith(Z))continue;let q=K.slice(Z.length);if(q.length>0&&W1.test(q[0]))continue;let H=q.trimStart();if(H.startsWith("?"))H=H.slice(1).trimStart();if(H.startsWith(":"))return H.slice(1).trim()}return}function F0(O,Z,$){let Q=$;if(Q.computed||Q.object?.type!=="Identifier"||Q.property?.type!=="Identifier")return;let W=Q.object.name,Y=Q.property.name;if(!W||!Y)return;if(O.wholePropsLocals.has(W))return Z.getPropTypeByLocalOrPublic(Y);let X=Z.getPropTypeByLocalOrPublic(W)??Z.findVariableTypeAndDescription(W)?.type;if(!X)return;return Y1(X,Y)}function N0(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,runesPropsDeclarationMetadataByDeclaratorStart:new Map,typedRunesPropsDeclarations:[],explicitPropTypesByName:new Map,explicitVariableTypesByName:new Map,typeImportBindingsByLocalName:new Map,localTypeDeclarationsByName:new Map,wholePropsLocals:new Set,restPropLocals:new Set,componentScope:new Map,scopeDeclarations:new WeakMap,activeScopes:[],slots:new Map,snippetPropLocals:new Set,deferredSlotBlockGenerics:[],events:new Map,eventDescriptions:new Map,forwardedEvents:new Map,jsDocEventNames:new Set,jsDocEventSources:new Map,bindings:new Map,contexts:new Map,typedefs:new Map,variableInfoCache:new Map,variableInfoCacheBuilt:!1}}function q0(O,Z,$,Q,W){O.diagnosticRecords.push({component:O.componentFilePath,kind:Z,name:$,message:Q,...W?{source:W}:{}})}function n(O){return O===void 0||O===""?void 0:O}var X1=/[\r\n]+/g;function M0(O,Z,$,Q){if(n($)===void 0)return;if(O.trackPropLocalName($),Z.props.has($)){let W=Z.props.get($);Z.props.set($,{...W,...Q})}else Z.props.set($,Q)}function H0(O,Z,$,Q=0){let W,Y,X=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:W,type:Y,isFunction:X};let K=j1(O,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end)?.replace(X1," ");if(Y=W,X=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let H=$;if(H.left&&typeof H.left==="object"&&"type"in H.left&&H.left.type==="Literal"&&"value"in H.left&&typeof H.left.value==="string")Y="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")Y=KO($),W=void 0}else if($.type==="UnaryExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end);if(q.argument){if(typeof q.argument==="object"&&"type"in q.argument&&q.argument.type==="UnaryExpression")Y=H0(O,Z,q.argument).type;else if(typeof q.argument==="object"&&"value"in q.argument)Y=typeof q.argument.value}}else if($.type==="NewExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end);if(q.callee&&typeof q.callee==="object"&&"type"in q.callee&&q.callee.type==="Identifier"){let H=q.callee.name;if(H==="Date")Y="Date";else if(H==="Map")Y="Map<any, any>";else if(H==="Set")Y="Set<any>";else if(H==="WeakMap")Y="WeakMap<object, any>";else if(H==="WeakSet")Y="WeakSet<object>";else if(H==="Array")Y="any[]";else if(H==="RegExp"||H==="Regexp")Y="RegExp";else if(H==="Error")Y="Error";else Y=H}}else if($.type==="CallExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end)}else if($.type==="Identifier"){let q=$;if(Q<5){let H=K1(Z,q.name);if(H){let z=H0(O,Z,H,Q+1),J=O.resolveLocalVarJSDoc(q.name);return{...z,resolvedType:J?.type??z.resolvedType,resolvedDescription:J?.description??z.resolvedDescription,resolvedParams:J?.params??z.resolvedParams,resolvedReturnType:J?.returnType??z.resolvedReturnType}}if(Z.funcDecls.has(q.name)){let z=O.resolveLocalVarJSDoc(q.name),J=Z.funcDecls.get(q.name);return{value:void 0,type:void 0,isFunction:!0,resolvedType:z?.type??q1(z,J),resolvedDescription:z?.description,resolvedParams:z?.params,resolvedReturnType:z?.returnType}}}if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end)}else if($.type==="MemberExpression"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end);if(O.isNumericConstant($))Y="number"}else if($.type==="TemplateLiteral"){let q=$;if("start"in q&&"end"in q&&typeof q.start==="number"&&typeof q.end==="number")W=x(Z,q.start,q.end);Y="string"}else if("raw"in $&&typeof $.raw==="string"){if(W=$.raw,"value"in $)Y=$.value==null?void 0:typeof $.value}return{value:W,type:Y,isFunction:X,defaultValue:K}}function K1(O,Z){for(let $ of O.vars)for(let Q of $.declarations)if(Q.id&&typeof Q.id==="object"&&"type"in Q.id&&Q.id.type==="Identifier"&&"name"in Q.id&&Q.id.name===Z&&Q.init)return Q.init;return}function XO(O,Z){for(let $ of O.vars){if($.kind!=="const")continue;for(let Q of $.declarations)if(Q.id&&typeof Q.id==="object"&&"type"in Q.id&&Q.id.type==="Identifier"&&"name"in Q.id&&Q.id.name===Z&&Q.init)return Q.init}return}function q1(O,Z){let $=O?.returnType??"any",Q=O?.params;if(Q&&Q.length>0)return`(${Q.map((Y)=>`${Y.name}${Y.optional?"?":""}: ${Y.type}`).join(", ")}) => ${$}`;if(O?.returnType)return`() => ${$}`;if(Z)return KO(Z);return"(...args: any[]) => any"}function KO(O){return`(${G1(O)}) => ${z1(O)}`}function G1(O){let Z=O.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let Q of Z)if(Q&&typeof Q==="object"&&"type"in Q&&Q.type==="Identifier"&&"name"in Q&&typeof Q.name==="string")$.push(`${Q.name}: any`);else return"...args: any[]";return $.join(", ")}function z1(O){if(O.async||O.generator)return"any";let Z=O.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=H1(Z),$.length===0)return"any"}else $=[Z];let Q=null;for(let W of $){let Y=U1(W);if(!Y)return"any";if(Q===null)Q=Y;else if(Q!==Y)return"any"}return Q??"any"}function H1(O){let Z=[];return K0(O,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function U1(O){if(!O||typeof O!=="object"||!("type"in O))return null;switch(O.type){case"Literal":{let Z=O.value;if(typeof Z==="string")return"string";if(typeof Z==="number")return"number";if(typeof Z==="boolean")return"boolean";return null}case"TemplateLiteral":return"string";case"CallExpression":{let Z=O.callee;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="Identifier"){let $=Z.name;if($==="String")return"string";if($==="Number")return"number";if($==="Boolean")return"boolean"}return null}default:return null}}function qO(O){if($0(O,"$bindable"))return{init:O.arguments[0],bindable:!0};return{init:O,bindable:!1}}function j1(O,Z,$){let Q=YO(Z,$);if(!Q||!$||typeof $!=="object"||!("type"in $))return;let W="expression";if($.type==="Literal"||$.type==="UnaryExpression")W="literal";else if($.type==="TemplateLiteral")W=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")W="array";else if($.type==="ObjectExpression")W="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")W="function";let Y={raw:Q,kind:W};if(W==="literal"||W==="array"||W==="object"){let X=v0(O,$);if(X.ok)Y.value=X.value}return Y}function v0(O,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return{ok:!1};if(Z.type==="Literal"){let $=Z.value;return typeof $==="bigint"?{ok:!1}:{ok:!0,value:$}}if(Z.type==="UnaryExpression"){let $=Z,Q=$.argument;if(!Q||typeof Q!=="object"||!("type"in Q)||Q.type!=="Literal")return{ok:!1};let W=Q.value;if(typeof W==="number"){if($.operator==="-")return{ok:!0,value:-W};if($.operator==="+")return{ok:!0,value:W}}if(typeof W==="boolean"&&$.operator==="!")return{ok:!0,value:!W};return{ok:!1}}if(Z.type==="TemplateLiteral"){let $=Z;if($.expressions.length>0||$.quasis.length!==1)return{ok:!1};return{ok:!0,value:$.quasis[0].value.cooked??$.quasis[0].value.raw}}if(Z.type==="ArrayExpression"){let $=Z,Q=[];for(let W of $.elements){if(!W)return{ok:!1};let Y=v0(O,W);if(!Y.ok)return{ok:!1};Q.push(Y.value)}return{ok:!0,value:Q}}if(Z.type==="ObjectExpression"){let $=Z,Q={};for(let W of $.properties){if(W.type!=="Property"||W.computed)return{ok:!1};let Y=O.getPropertyName(W.key);if(!Y)return{ok:!1};let X=v0(O,W.value);if(!X.ok)return{ok:!1};Q[Y]=X.value}return{ok:!0,value:Q}}return{ok:!1}}var J1=/[-_.:/\s]+/;function g0(O){return`${O.split(J1).map((Q)=>Q.charAt(0).toUpperCase()+Q.slice(1)).join("")}Context`}function M1(O,Z,$,Q){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let W=[];if(!C0($))return null;let Y=$;for(let X of Y.properties){if(X.type!=="Property")continue;let K=Z.getPropertyName(X.key);if(!K)continue;let q="any",H;if(Q0(X.value)){let z=X.value.name,J=Z.findVariableTypeAndDescription(z);if(J)q=J.type,H=J.description;else q0(O,"context-any-type",K,`Context "${Q}" property "${K}" has no type annotation; defaulted to "any".`,v(O,X))}else if(X.value&&typeof X.value==="object"&&"type"in X.value&&(X.value.type==="ArrowFunctionExpression"||X.value.type==="FunctionExpression"))q=`(${X.value.params?.map((V)=>{if(Q0(V))return`${V.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(U0(X.value))q=X.value.value==null?"null":typeof X.value.value;W.push({name:K,type:q,description:H,optional:!1})}return{key:Q,typeName:g0(Q),properties:W,description:void 0}}else if(Q0($)){let W=$.name,Y=Z.findVariableTypeAndDescription(W);if(Y)return{key:Q,typeName:g0(Q),properties:[{name:W,type:Y.type,description:Y.description,optional:!1}]};return q0(O,"context-any-type",W,`Context "${Q}" variable "${W}" has no type annotation; defaulted to "any".`,v(O,$)),{key:Q,typeName:g0(Q),properties:[{name:W,type:"any",description:void 0,optional:!1}]}}return null}function GO(O){let Z=O.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",Q=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!Q)return null;let W=O.arguments[0];if(!W||typeof W!=="object"||!("type"in W))return"";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 zO(O,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let Q=Z;if(Q.type==="Literal")return typeof Q.value==="string"?Q.value:Q.value==null?null:String(Q.value);if(Q.type==="TemplateLiteral"){if(Q.quasis?.length===1){let W=Q.quasis[0].value.cooked;return W==null?null:W}return null}if(Q.type==="CallExpression"||Q.type==="NewExpression")return GO(Q);if(Q.type==="Identifier"){if($>=5)return null;let W=XO(O,Q.name);if(W&&typeof W==="object"&&"type"in W){let Y=W;if((Y.type==="CallExpression"||Y.type==="NewExpression")&&GO(Y)==="")return Q.name;return zO(O,Y,$+1)}return null}return null}function HO(O,Z,$,Q){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let W=$,Y=W.arguments[0];if(!Y)return;let X=zO(O,Y);if(!X){let H=O.componentFilePath?` in ${O.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${H}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=W.arguments[1];if(!K)return;let q=M1(O,Z,K,X);if(q&&!O.contexts.has(X))O.contexts.set(X,q)}function x0(O){return typeof O==="string"?JSON.stringify(O):String(O)}function B0(O,{name:Z,detail:$,has_argument:Q,description:W,deprecated:Y,tags:X,source:K}){if(Z===void 0)return;let q=!Q&&!$?"null":n($),H=W,z=O.events.get(Z);if(z?.type==="forwarded")O.events.set(Z,{type:"dispatched",name:Z,detail:q,description:H||z.description,deprecated:Y??z.deprecated,tags:X??z.tags,source:K||z.source});else if(z){let J=z.tags??X;O.events.set(Z,{...z,detail:z.detail===void 0?q:z.detail,description:z.description||H,deprecated:z.deprecated??Y,tags:J,source:K||z.source})}else O.events.set(Z,{type:"dispatched",name:Z,detail:q,description:H,deprecated:Y,tags:X,source:K})}function UO(O,Z){let $=Z.arguments[0],Q=y0($,"CustomEvent");if(!Q&&!y0($,"Event"))return;let W=$.arguments[0],Y=U0(W)?W.value:void 0;if(Y==null)return;let X=Q?$.arguments[1]:void 0,K=!1,q;if(C0(X)){let H=X.properties.find((z)=>z.type==="Property"&&Q0(z.key)&&z.key.name==="detail");if(H?.type==="Property")K=!0,q=U0(H.value)?H.value.value:void 0}return B0(O,{name:String(Y),detail:q==null?"":x0(q),has_argument:K,source:v(O,Z)}),String(Y)}function u0(O,Z,$=!1){if(O.length===0)return"null";let Q=O.map(({name:W,type:Y,description:X,optional:K,default:q})=>{let H=K?"?":"",z=X||"";if(q&&z)z=`${z} @default ${q}`;else if(q)z=`@default ${q}`;if(z){if($)return`/** ${z} */
2
- ${W}${H}: ${Y};`;return`/** ${z} */ ${W}${H}: ${Y};`}return`${W}${H}: ${Y};`}).join($?`
3
- `:" ");return $?`{
4
- ${Q}
5
- }`:`{ ${Q} }`}var e;(function(O){O.start="/**",O.nostart="/***",O.delim="*",O.end="*/"})(e||(e={}));function m0(O){return/^\s+$/.test(O)}function jO(O){let Z=O.match(/\r+$/);return Z==null?["",O]:[O.slice(-Z[0].length),O.slice(0,-Z[0].length)]}function G0(O){let Z=O.match(/^\s+/);return Z==null?["",O]:[O.slice(0,Z[0].length),O.slice(Z[0].length)]}function JO(O){return O.split(/\n/)}function MO(O={}){return Object.assign({tag:"",name:"",type:"",optional:!1,description:"",problems:[],source:[]},O)}function l0(O={}){return Object.assign({start:"",delimiter:"",postDelimiter:"",tag:"",postTag:"",name:"",postName:"",type:"",postType:"",description:"",end:"",lineEnd:""},O)}var B1=/^@[^\s/]+(?=\s|$)/;function d0({fence:O="```"}={}){let Z=V1(O),$=(Q,W)=>Z(Q)?!W:W;return function(W){let Y=[[]],X=!1;for(let K of W){if(B1.test(K.tokens.description)&&!X)Y.push([K]);else Y[Y.length-1].push(K);X=$(K.tokens.description,X)}return Y}}function V1(O){if(typeof O==="string")return(Z)=>Z.split(O).length%2===0;return O}function c0({startLine:O=0,markers:Z=e}={}){let $=null,Q=O;return function(Y){let X=Y,K=l0();if([K.lineEnd,X]=jO(X),[K.start,X]=G0(X),$===null&&X.startsWith(Z.start)&&!X.startsWith(Z.nostart))$=[],K.delimiter=X.slice(0,Z.start.length),X=X.slice(Z.start.length),[K.postDelimiter,X]=G0(X);if($===null)return Q++,null;let q=X.trimRight().endsWith(Z.end);if(K.delimiter===""&&X.startsWith(Z.delim)&&!X.startsWith(Z.end))K.delimiter=Z.delim,X=X.slice(Z.delim.length),[K.postDelimiter,X]=G0(X);if(q){let H=X.trimRight();K.end=X.slice(H.length-Z.end.length),X=H.slice(0,-Z.end.length)}if(K.description=X,$.push({number:Q,source:Y,tokens:K}),Q++,q){let H=$.slice();return $=null,H}return null}}function i0({tokenizers:O}){return function($){var Q;let W=MO({source:$});for(let Y of O)if(W=Y(W),(Q=W.problems[W.problems.length-1])===null||Q===void 0?void 0:Q.critical)break;return W}}function P0(){return(O)=>{let{tokens:Z}=O.source[0],$=Z.description.match(/\s*(@(\S+))(\s*)/);if($===null)return O.problems.push({code:"spec:tag:prefix",message:'tag should start with "@" symbol',line:O.source[0].number,critical:!0}),O;if($[1].includes("/"))return O;return Z.tag=$[1],Z.postTag=$[3],Z.description=Z.description.slice($[0].length),O.tag=$[2],O}}function h0(O="compact"){let Z=w1(O);return($)=>{let Q=0,W=[],Y=!1,X=!0;for(let{tokens:H}of $.source.values()){let z="";if(!Y&&H.description.trim())Y=!0;else if(!Y)continue;if(X&&H.description[0]!=="{")return $;X=!1;for(let J of H.description){if(J==="{")Q++;if(J==="}")Q--;if(z+=J,Q===0)break}if(W.push([H,z]),Q===0)break}if(!Y)return $;if(Q!==0)return $.problems.push({code:"spec:type:unpaired-curlies",message:"unpaired curlies",line:$.source[0].number,critical:!0}),$;let K=[],q=W[0][0].postDelimiter.length;for(let[H,[z,J]]of W.entries()){if(z.type=J,H>0)z.type=z.postDelimiter.slice(q)+J,z.postDelimiter=z.postDelimiter.slice(0,q);[z.postType,z.description]=G0(z.description.slice(J.length)),K.push(z.type)}return K[0]=K[0].slice(1),K[K.length-1]=K[K.length-1].slice(0,-1),$.type=Z(K),$}}var L1=(O)=>O.trim();function w1(O){if(O==="compact")return(Z)=>Z.map(L1).join("");else if(O==="preserve")return(Z)=>Z.join(`
6
- `);else return O}var BO=(O)=>O&&O.startsWith('"')&&O.endsWith('"');function D0(){let O=(Z,{tokens:$},Q)=>$.type===""?Z:Q;return(Z)=>{let $=Z.source.reduce(O,0),Q;if(Z.type)do{if({tokens:Q}=Z.source[$],Q.description.trim())break;$++}while(Z.source[$]);else({tokens:Q}=Z.source[$]);let W=Q.description.trimStart(),Y=W.split('"');if(Y.length>1&&Y[0]===""&&Y.length%2===1)return Z.name=Y[1],Q.name=`"${Y[1]}"`,[Q.postName,Q.description]=G0(W.slice(Q.name.length)),Z;let X=0,K="",q=!1,H;for(let J of W){if(X===0&&m0(J))break;if(J==="[")X++;if(J==="]")X--;K+=J}if(X!==0)return Z.problems.push({code:"spec:name:unpaired-brackets",message:"unpaired brackets",line:Z.source[0].number,critical:!0}),Z;let z=K;if(K[0]==="["&&K[K.length-1]==="]"){q=!0,K=K.slice(1,-1);let J=K.split("=");if(K=J[0].trim(),J[1]!==void 0)H=J.slice(1).join("=").trim();if(K==="")return Z.problems.push({code:"spec:name:empty-name",message:"empty name",line:Z.source[0].number,critical:!0}),Z;if(H==="")return Z.problems.push({code:"spec:name:empty-default",message:"empty default value",line:Z.source[0].number,critical:!0}),Z;if(!BO(H)&&/=(?!>)/.test(H))return Z.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:Z.source[0].number,critical:!0}),Z}if(!q){let J=K.search(/=(?!>)/);if(J!==-1){let V=K.slice(0,J).trim(),I=K.slice(J+1).trim();if(V==="")return Z.problems.push({code:"spec:name:empty-name",message:"empty name",line:Z.source[0].number,critical:!0}),Z;if(I==="")return Z.problems.push({code:"spec:name:empty-default",message:"empty default value",line:Z.source[0].number,critical:!0}),Z;if(/^[\p{ID_Start}$_\.][\p{ID_Continue}$_\u200c\u200d\.]*=/u.test(K)){if(!BO(I)&&/=(?!>)/.test(I))return Z.problems.push({code:"spec:name:invalid-default",message:"invalid default value syntax",line:Z.source[0].number,critical:!0}),Z;K=V,H=I}}}if(Z.optional=q,Z.name=K,Q.name=z,H!==void 0)Z.default=H;return[Q.postName,Q.description]=G0(W.slice(Q.name.length)),Z}}function f0(O="compact",Z=e){let $=s0(O);return(Q)=>{return Q.description=$(Q.source,Z),Q}}function s0(O){if(O==="compact")return R1;if(O==="preserve")return F1;return O}function R1(O,Z=e){return O.map(({tokens:{description:$}})=>$.trim()).filter(($)=>$!=="").join(" ")}var I1=(O,{tokens:Z},$)=>Z.type===""?O:$,A1=({tokens:O})=>(O.delimiter===""?O.start:O.postDelimiter.slice(1))+O.description;function F1(O,Z=e){if(O.length===0)return"";if(O[0].tokens.description===""&&O[0].tokens.delimiter===Z.start)O=O.slice(1);let $=O[O.length-1];if($!==void 0&&$.tokens.description===""&&$.tokens.end.endsWith(Z.end))O=O.slice(0,-1);return O=O.slice(O.reduce(I1,0)),O.map(A1).join(`
7
- `)}function p0({startLine:O=0,fence:Z="```",spacing:$="compact",markers:Q=e,tokenizers:W=[P0(),h0($),D0(),f0($)]}={}){if(O<0||O%1>0)throw Error("Invalid startLine");let Y=c0({startLine:O,markers:Q}),X=d0({fence:Z}),K=i0({tokenizers:W}),q=s0($);return function(H){let z=[];for(let J of JO(H)){let V=Y(J);if(V===null)continue;let I=X(V),k=I.slice(1).map(K);z.push({description:q(I[0],Q),tags:k,source:V,problems:k.reduce((u,m)=>u.concat(m.problems),[])})}return z}}function C1(O){return O.start+O.delimiter+O.postDelimiter+O.tag+O.postTag+O.type+O.postType+O.name+O.postName+O.description+O.end+O.lineEnd}function o0(){return(O)=>O.source.map(({tokens:Z})=>C1(Z)).join(`
8
- `)}var P1={line:0,start:0,delimiter:0,postDelimiter:0,tag:0,postTag:0,name:0,postName:0,type:0,postType:0,description:0,end:0,lineEnd:0};var M3=Object.keys(P1);function V0(O,Z={}){return p0(Z)(O)}var N3=o0();var h1=null;function D1(O,Z,$){let Q={value:void 0,replace:!1};if(!$||typeof $!=="object"||!("type"in $))return Q;if($.type==="Identifier")Q.value=$.name,Q.replace=!0;else if($.type==="Literal")Q.value=String($.value);else if($.type==="MemberExpression")Q.value=F0(O,Z,$);else if(($.type==="ObjectExpression"||$.type==="TemplateLiteral")&&"start"in $&&"end"in $&&typeof $.start==="number"&&typeof $.end==="number")Q.value=x(O,$.start,$.end);return Q}function VO(O,Z,$){let Q={};for(let W of $.properties){if(W.type!=="Property"||W.computed)continue;let Y=Z.getPropertyName(W.key);if(!Y)continue;Q[Y]=D1(O,Z,W.value)}return Q}function f1(O,Z){if(!Z||typeof Z!=="object"||!("type"in Z))return null;if(Z.type==="Identifier"){let Y=Z,X=O.propLocalToPublicName.get(Y.name);if(!X)return null;return{publicName:X,trackingName:Y.name}}if(Z.type!=="MemberExpression")return null;let $=Z,Q=$.object&&typeof $.object==="object"&&"type"in $.object&&$.object.type==="Identifier"?$.object.name:void 0;if(!Q||!O.wholePropsLocals.has(Q))return null;let W;if(!$.computed&&$.property&&typeof $.property==="object"&&"type"in $.property){if($.property.type==="Identifier")W=$.property.name;else if($.property.type==="Literal"&&$.property.value!=null)W=String($.property.value)}else if($.computed&&$.property&&typeof $.property==="object"&&"type"in $.property&&$.property.type==="Literal"&&"value"in $.property&&$.property.value!=null)W=String($.property.value);if(!W)return null;return{publicName:W,trackingName:W}}function LO(O,Z){let $=Z;if($&&typeof $==="object"&&"type"in $&&$.type==="ChainExpression")$=$.expression;if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return null;let Q=$;if(!Q.callee||typeof Q.callee!=="object"||!("type"in Q.callee))return null;let W=f1(O,Q.callee);if(!W)return null;return{...W,arguments:Q.arguments}}function L0(O,{slot_name:Z,slot_props:$,slot_fallback:Q,slot_description:W,slot_deprecated:Y,slot_tags:X,source:K}){let q=Z===void 0||Z==="",H=q?h1:Z??"",z=n(Q),J=$===void 0||$===""?void 0:$,V=W?.trim()||void 0;if(O.slots.has(H)){let I=O.slots.get(H);if(I)O.slots.set(H,{...I,default:I.default??q,fallback:z,slot_props:I.slot_props===void 0?J:I.slot_props,description:I.description||V,deprecated:I.deprecated??Y,tags:I.tags||X,source:K||I.source})}else O.slots.set(H,{name:H,default:q,fallback:z,slot_props:$,description:V,deprecated:Y,tags:X,source:K})}var S1=/\s*=\s*/;function wO(O){let Z=O.indexOf("<");if(Z===-1||!O.endsWith(">"))return O;let $=O.slice(0,Z),Q=O.slice(Z+1,-1),W=RO(Q).map((Y)=>Y.trim().replace(S1," = ")).join(", ");return`${$}<${W}>`}var b1=/^\s*$/,E1=/;$/,_1=/^-\s*/;function j0(O){if(O===void 0)return;let Z=O.replace(_1,"").trim();return Z===""?"":Z}function w0(O){if(!O||O.length===0)return;return O[0].tokens.description}var IO=new Set(["since","example"]);function AO(O){if(!O||O.length===0)return"";let Z=[];for(let $ of O){let Q=$.tokens;if((Q.end??"").trim()==="*/")break;if(Q.tag){let W=`${Q.name??""}${Q.postName??""}${Q.description??""}`.trimEnd();if(W)Z.push(W)}else Z.push(`${Q.postDelimiter??""}${Q.description??""}`)}return Z.join(`
9
- `)}function k1(O){let Z=O.trim();return Z===""?!0:Z}function FO(O,Z){return k1(`${O??""}${Z?` ${Z}`:""}`)}function T1(O){let Z=O.trim().replace(E1,"").trimEnd();if(!Z.startsWith("{")||!Z.endsWith("}"))return!1;let $=0,Q=null;for(let W=0;W<Z.length;W++){let Y=Z[W];if(Q!==null){if(Y==="\\"){W++;continue}if(Y===Q)Q=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Q=Y;continue}if(Y==="{"||Y==="["||Y==="(")$++;else if(Y==="}"||Y==="]"||Y===")"){if($--,$===0&&W<Z.length-1)return!1}}return $===0}function N1(O){let Z=O;if(!Z.startsWith("/*"))Z=`/*${Z}`;if(!Z.endsWith("*/"))Z+="*/";return Z}function n0(O){let Z=O[0]?.tags??[],$=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),Q,W=[],Y,X,K,q=[],H=[];for(let z of Z)if(z.tag==="type")Q=z;else if(z.tag==="param")W.push(z);else if(z.tag==="returns"||z.tag==="return")Y=z;else if(z.tag==="deprecated")K??=FO(z.name,z.description);else if(IO.has(z.tag))H.push(z);else if(z.tag==="bindable"){if(z.type)continue;let J=`${z.name}${z.description?` ${z.description}`:""}`.trim();if(J==="readonly"||J==="writable")X??=J}else if(!$.has(z.tag))q.push(z);return{type:Q,param:W,returns:Y,binding:X,deprecated:K,additional:q,passthrough:H,description:O[0]?.description}}function v1(O){if(!O||O.length===0)return;let Z=O[O.length-1];return Z&&typeof Z==="object"&&"value"in Z?Z:void 0}function g1(O,Z,$){if(!Z||Z.length===0||$===void 0||!O.source)return;for(let Q=Z.length-1;Q>=0;Q--){let W=Z[Q];if(!W||typeof W!=="object"||!("value"in W)||!("end"in W))continue;if(typeof W.end!=="number")continue;let Y=O.source.slice(W.end,$);if(b1.test(Y))return W}return}function z0(O,Z,$){if(!$?.leadingComments)return;let Q=g1(O,$.leadingComments,$.start);if(!Q)return;return y1(Z,[Q])}function CO(O,Z,$){if(!$?.leadingComments)return;return z0(O,Z,$)}function y1(O,Z){if(!Z)return;let $=v1(Z);if(!$)return;let Q=V0(N1($.value),{spacing:"preserve"}),{type:W,param:Y,returns:X,binding:K,deprecated:q,additional:H,passthrough:z,description:J}=n0(Q),V,I,k,u;if(W)V=O.aliasType(W.type);if(Y.length>0)I=Y.filter((D)=>!D.name.includes(".")).map((D)=>({name:D.name,type:O.aliasType(D.type),description:j0(D.description),optional:D.optional||!1}));if(X)k=O.aliasType(X.type);let m=n(J?.trim());if(m||H.length>0){let D=[];if(m)D.push(m);for(let i of H){let t=`@${i.tag}${i.name?` ${i.name}`:""}${i.description?` ${i.description}`:""}`;D.push(t)}u=D.join(`
10
- `)}let O0=z.length>0?z.map((D)=>({name:D.tag,body:AO(D.source)})):void 0;return{type:V,params:I,returnType:k,description:u,binding:K,deprecated:q,tags:O0}}function PO(O,Z,$=O.source){if(!$)return;let Q=0;for(let{tags:W,description:Y,source:X}of V0($,{spacing:"preserve"})){let K=X.map((B)=>B.source).join(`
11
- `),q=$.indexOf(K,Q),H=q===-1?void 0:q;if(q!==-1)Q=q+K.length;let z,J,V,I,k,u,m=[],O0=[],D,i,t,W0=[],p,G,j=[],L,A=!1,U=!0,M=[],f,S=new Map,C=new Set,T=new Set;for(let B of W)if(B.source&&B.source.length>0)C.add(B.source[0].number);for(let B of X)if(!B.tokens.tag&&B.tokens.description&&B.tokens.description.trim()!=="}")S.set(B.number,B.tokens.description);let b=(B)=>{if(!B||B.length===0)return;let _=B[0].number,R=[],N=[],l=!1;for(let F=_-1;F>=1;F--){if(C.has(F))break;let P=S.get(F);if(P)R.unshift(P),N.unshift(F),l=!0;else if(l){let w=X.find((h)=>h.number===F);if(!(!w||!w.tokens.tag&&(!w.tokens.description||w.tokens.description.trim()==="")))break}}if(R.length===0)return;for(let F of N)T.add(F);return R.join(`
12
- `).trim()},y=()=>{if(z!==void 0){let B=J&&J!=="object"&&J!=="Object"?J:void 0,_;if(B)_=B;else if(O0.length>0)_=u0(O0,z,!0);else _=J||"";if(u!==void 0){let R;for(let F of W){let P=F.source?.[0]?.number;if(typeof P!=="number")continue;if(P<=u)continue;if(F.tag==="property"||F.tag==="type")continue;R=P;break}let N=[],l=Array.from(S.keys()).sort((F,P)=>F-P);for(let F of l){if(F<=u)continue;if(R!==void 0&&F>=R)continue;if(T.has(F))continue;let w=S.get(F)?.trim();if(w)N.push(w),T.add(F)}if(N.length>0){let F=N.join(`
13
- `);V=V?`${V}
14
- ${F}`:F}}B0(O,{name:z,detail:_,has_argument:!1,description:V,deprecated:I,tags:m.length>0?m:void 0,source:k}),O.eventDescriptions.set(z,V),O.jsDocEventNames.add(z),O.jsDocEventSources.set(z,k),O0.length=0,z=void 0,J=void 0,V=void 0,I=void 0,k=void 0,u=void 0,m=[]}},a=()=>{if(D!==void 0){let B,_;if(W0.length>0)B=u0(W0,void 0,!0),_=`type ${D} = ${B};`;else if(i)B=i,_=T1(B)?`interface ${D} ${B}`:`type ${D} = ${B};`;else B="{}",_=`type ${D} = ${B};`;O.typedefs.set(D,{type:B,name:D,description:n(t),ts:_}),W0.length=0,D=void 0,i=void 0,t=void 0}},Z0=()=>{if(p!==void 0){let R=`(${j.map(({name:l,type:F,optional:P})=>{return`${l}${P?"?":""}: ${F}`}).join(", ")}) => ${L||"void"}`,N=`type ${p} = ${R};`;O.typedefs.set(p,{type:R,name:p,description:n(G),ts:N}),j.length=0,L=void 0,p=void 0,G=void 0}},E=W.some((B)=>B.tag==="slot"||B.tag==="snippet"),r=W.some((B)=>B.tag==="extends"||B.tag==="extendProps");for(let{tag:B,type:_,name:R,description:N,optional:l,default:F,source:P}of W){let w=Z.aliasType(_),s=b(P);switch(B){case"extends":case"extendProps":if(O.extends={interface:R,import:w},U)U=!1;break;case"restProps":{let h=R?N?`${R} ${N}`:R:N,Y0=j0(h)||s;if(!Y0&&U&&!A&&Y)Y0=Y,A=!0;if(O.rest_props={type:"Element",name:w,description:Y0||void 0},U)U=!1;break}case"slot":case"snippet":{let o=j0(w0(P));if(!o&&U&&!A&&Y)o=Y,A=!0;if(!o&&M.length===0)o=s;if(U)U=!1;L0(O,{slot_name:R,slot_props:w,slot_description:o||void 0,slot_deprecated:f,slot_tags:M.length>0?[...M]:void 0,source:r0(O,X,P,H)}),M.length=0,f=void 0;break}case"event":{if(y(),z=R,J=w,u=P&&P.length>0?P[0].number:void 0,V=j0(w0(P))||s,!V&&U&&!A&&Y)V=Y,A=!0;if(k=r0(O,X,P,H),U)U=!1;break}case"type":if(z!==void 0)J=w;break;case"param":if(p!==void 0)j.push({name:R,type:w,optional:l||!1});break;case"returns":case"return":if(p!==void 0)L=w;break;case"property":{let h={name:R,type:w,description:j0(w0(P)),optional:l||!1,default:F};if(z!==void 0)O0.push(h);else if(D!==void 0)W0.push(h);break}case"typedef":{if(a(),D=wO(R),i=w,t=j0(w0(P))||s,!t&&U&&!A&&Y)t=Y,A=!0;if(U)U=!1;break}case"callback":{if(Z0(),p=wO(R),G=j0(w0(P))||s,!G&&U&&!A&&Y)G=Y,A=!0;if(U)U=!1;break}case"generics":if(O.generics=[R,w],U)U=!1;break;case"template":{let h=R;if(w)h=`${R} extends ${w}`;if(F)h+=` = ${F}`;if(E&&!r){O.deferredSlotBlockGenerics.push({name:R,constraint:h});break}if(Z.accumulateGeneric(R,h),U)U=!1;break}case"deprecated":{let h=FO(R,N);if(z===void 0)f??=h;else I??=h;break}case"enum":case"class":case"implements":case"this":case"namespace":case"memberof":case"module":case"file":case"overview":break;default:{let h={name:B,body:AO(P)};if(z!==void 0&&IO.has(B))m.push(h);else M.push(h)}break}}y(),a(),Z0()}}function x1({hasTypeScriptType:O,hasJSDocType:Z,inferredType:$,finalType:Q}){if(O)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(Q!==void 0)return"inferred";return"unknown"}function R0(O){let Z=O.explicitType??O.jsdocType??O.resolvedType??O.typeSeed,$=O.jsdocParams??O.resolvedParams,Q=O.jsdocReturnType??O.resolvedReturnType;if(O.isFunctionDeclaration&&Z==="() => any"&&Q)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${Q}`:`() => ${Q}`;let W=O.jsdocDescription??O.resolvedDescription;if(W===void 0&&Z!==void 0)W=O.typedefs?.get(Z)?.description;let Y=x1({hasTypeScriptType:O.explicitType!==void 0,hasJSDocType:O.jsdocType!==void 0||O.jsdocParams!==void 0||O.jsdocReturnType!==void 0||O.resolvedType!==void 0,inferredType:O.inferredTypeForSource,finalType:Z}),X=O.initializerIsFunction||O.isFunctionDeclaration||O.inferIsFunctionFromTypeSignature===!0&&(!!O.jsdocParams?.length||O.jsdocReturnType!==void 0||!!O.jsdocType?.includes("=>")||!!O.resolvedType?.includes("=>")||!!O.explicitType?.includes("=>"));return{type:Z,typeSource:Y,description:W,params:$,returnType:Q,isFunction:X}}function u1(O){if(!O||typeof O!=="object"||!("type"in O))return;let Z=String(O.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in O&&typeof O.name==="string"?O.name:void 0;if(!$)return;let Q=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in O&&typeof O.tag==="string")Q.thisValue=O.tag;return Q}function hO(O,Z){if(O.rest_props!==void 0)return;let $=u1(Z);if($)O.rest_props=$}function d(O,Z,$){if(!Z||O.has(Z))return;O.set(Z,$)}function S0(O,Z){for(let $=O.activeScopes.length-1;$>=0;$-=1){let Q=O.activeScopes[$]?.get(Z);if(!Q)continue;return Q.kind==="prop"?Q.publicPropName:void 0}return}function g(O,Z=new Set){if(!O||typeof O!=="object"||!("type"in O))return Z;switch(O.type){case"Identifier":Z.add(O.name);break;case"AssignmentPattern":g(O.left,Z);break;case"ArrayPattern":for(let $ of O.elements)g($??void 0,Z);break;case"ObjectPattern":for(let $ of O.properties)if($.type==="Property")g($.value,Z);else if($.type==="RestElement")g($.argument,Z);break;case"RestElement":g(O.argument,Z);break}return Z}function e0(O,Z){let $=g(Z);if(!$)return;for(let Q of $){let W=S0(O,Q);if(W)O.reactive_vars.add(W)}}function b0(O){if(!O||typeof O!=="object"||!("type"in O))return!1;switch(String(O.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function fO(O){if(!O||typeof O!=="object"||!("type"in O))return!1;let Z=String(O.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function m1(O,Z){let $=O.scopeDeclarations.get(Z);if(!$)$=new Map,O.scopeDeclarations.set(Z,$);return $}function l1(O,Z,$){let Q=[];if($.id.type==="Identifier")return Q.push({kind:"local",name:$.id.name}),Q;if($.id.type!=="ObjectPattern")return Q;for(let W of $.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Q.push({kind:"local",name:W.argument.name});continue}if(W.computed)continue;let Y=O.getPropertyName(W.key);if(!Y)continue;let X;if(W.value.type==="Identifier")X=W.value.name;else if(W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier")X=W.value.left.name;if(!X)continue;Q.push({kind:"prop",name:X,publicPropName:Y})}return Q}function t0(O,Z,$,Q,W){if(!DO(Z))return;let Y=W?.allowRunesProps??!1,X=W?.forceProp??!1,K=Z;for(let q of K.declarations){if(Y&&$0(J0(q.init),"$props")){for(let J of l1(O,K,q))d(J.kind==="prop"?$:Q,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}let H=K.kind==="var"?Q:$,z=X?"prop":"local";for(let J of g(q.id))d(H,J,z==="prop"?{kind:"prop",publicPropName:J}:{kind:"local"})}}function d1(O,Z){if("id"in O&&O.id&&typeof O.id==="object"&&"name"in O.id&&typeof O.id.name==="string")d(Z,O.id.name,{kind:"local"});for(let $ of O.params)for(let Q of g($))d(Z,Q,{kind:"local"})}function c1(O,Z,$,Q){if(!Array.isArray(Z))return;for(let W of Z){if(!W||typeof W!=="object"||!("type"in W))continue;switch(W.type){case"VariableDeclaration":t0(O,W,$,Q);break;case"FunctionDeclaration":if(W.id?.name)d($,W.id.name,{kind:"local"});break;case"ClassDeclaration":if(W.id?.name)d($,W.id.name,{kind:"local"});break}}}function i1(O,Z,$){if(!$||typeof $!=="object")return;let Q="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!Q||!("body"in Q)||!Array.isArray(Q.body))return;for(let W of Q.body){if(!W||typeof W!=="object"||!("type"in W))continue;switch(W.type){case"ImportDeclaration":for(let Y of W.specifiers??[])if(Y.local?.name)d(Z.componentScope,Y.local.name,{kind:"local"});break;case"VariableDeclaration":t0(O,W,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(W.id?.name)d(Z.componentScope,W.id.name,{kind:"local"});break;case"ClassDeclaration":if(W.id?.name)d(Z.componentScope,W.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!W.declaration||typeof W.declaration!=="object"||!("type"in W.declaration))break;if(W.declaration.type==="VariableDeclaration")t0(O,W.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(W.declaration.type==="FunctionDeclaration"&&W.declaration.id?.name)d(Z.componentScope,W.declaration.id.name,{kind:"prop",publicPropName:W.declaration.id.name});break}}}function SO(O,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,i1(O,Z,Z.parsed?.instance)}function bO(O){return{varScopeStack:[O.componentScope]}}function EO(O,Z,$,Q){if(!b0(Q))return;let W=m1(Z,Q),Y=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":d1(Q,W);break;case"BlockStatement":c1(O,Q.body,W,Y);break;case"CatchClause":if("param"in Q)for(let K of g(Q.param))d(W,K,{kind:"local"});break;case"EachBlock":{let K=Q;for(let q of g(K.context))d(W,q,{kind:"local"});if(typeof K.index==="string")d(W,K.index,{kind:"local"});else if(K.index&&"name"in K.index)d(W,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in Q)for(let K of g(Q.value))d(W,K,{kind:"local"});break;case"CatchBlock":if("error"in Q)for(let K of g(Q.error))d(W,K,{kind:"local"});break}if(fO(Q))$.varScopeStack.push(W)}function _O(O,Z){if(fO(Z))O.varScopeStack.pop()}var s1=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function p1(O,Z){switch(Z?.type){case"MemberExpression":return Z.computed||O===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return O===Z.meta;case"PropertyDefinition":return Z.computed||O===Z.value;case"Property":return Z.computed||O===Z.value;case"ExportSpecifier":case"ImportSpecifier":return O===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function o1(O,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(O))return!0;return!1}function a1(O){let Z=new Set;if(!O||typeof O!=="object"||!("type"in O))return Z;switch(String(O.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=O;if($.id?.name)Z.add($.id.name);for(let Q of $.params??[])g(Q,Z);break}case"BlockStatement":E0(O.body,Z);break;case"CatchClause":g(O.param,Z);break;case"EachBlock":{let $=O;if(g($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":g(O.value,Z);break;case"CatchBlock":g(O.error,Z);break}return Z}function E0(O,Z){if(!Array.isArray(O))return;for(let $ of O){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let Q of $.specifiers??[])if(Q.local?.name)Z.add(Q.local.name);break;case"VariableDeclaration":for(let Q of $.declarations??[])g(Q.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let Q=$.id?.name;if(Q)Z.add(Q);break}case"ExportNamedDeclaration":{let Q=$.declaration;if(Q&&typeof Q==="object"&&"type"in Q)E0([Q],Z);break}}}}function OO(O,Z){if(!O||typeof O!=="object")return!1;let $=[...Z],Q=!1;return K0(O,{enter(W,Y){if(Q){this.skip();return}if(b0(W))$.push(a1(W));if(Y&&W.type==="Identifier"&&s1.has(W.name)&&!Y.type.startsWith("TS")&&p1(W,Y)&&!o1(W.name,$))Q=!0,this.skip()},leave(W){if(b0(W))$.pop()}}),Q}function kO(O){if(!O||typeof O!=="object")return;if("content"in O){let Z=O.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in O&&Array.isArray(O.body))return O.body;return}function TO(O){if(O.runesOptionOverride!==void 0)return O.runesOptionOverride?"runes":"legacy";let Z=O.parsed;if(!Z)return"legacy";let $=new Set;E0(kO(Z.module),$);let Q=new Set;return E0(kO(Z.instance),Q),OO(Z.module,[$])||OO(Z.instance,[$,Q])||OO(Z.html,[$,Q])?"runes":"legacy"}var r1=/[A-Za-z_$][\w$]*/g;function n1(O,Z,$){let Q=new Map,W=Z.typeParameters?.params,Y=$.typeArguments?.params;if(!W?.length||!Y?.length)return Q;for(let X=0;X<W.length;X++){let K=W[X]?.name,q=Y[X];if(!K||q?.start===void 0||q?.end===void 0)continue;let H=x(O,q.start,q.end)?.trim();if(H)Q.set(K,H)}return Q}function t1(O,Z){if(Z.size===0)return O;return O.replace(r1,($)=>Z.get($)??$)}function I0(O,Z,$,Q,W=new Set){let Y=new Map;if(!$?.type)return Y;let X=(K)=>{for(let q of K){if(q?.type!=="TSPropertySignature"||q.computed)continue;if(!q.key)continue;let H=O.getPropertyName(q.key);if(!H)continue;let z=q.typeAnnotation?.start,J=q.typeAnnotation?.end;if(z===void 0||J===void 0)continue;let V=x(Z,z+1,J)?.trim();if(!V)continue;Y.set(H,{type:V,optional:q.optional===!0,source:v(Z,q)})}};switch($.type){case"TSTypeLiteral":X($.members??[]);break;case"TSInterfaceDeclaration":X($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=I0(O,Z,$.typeAnnotation,Q,W);for(let[q,H]of K)Y.set(q,H);break}case"TSTypeReference":{let K=yO($.typeName);if(!K||W.has(K))break;let q=Q.get(K);if(!q)break;W.add(K);let H=I0(O,Z,q,Q,W);W.delete(K);let z=n1(Z,q,$);for(let[J,V]of H)Y.set(J,z.size===0?V:{...V,type:t1(V.type,z)});break}case"TSIntersectionType":for(let K of $.types??[]){let q=I0(O,Z,K,Q,W);for(let[H,z]of q)Y.set(H,z)}break;case"TSParenthesizedType":{let K=I0(O,Z,$.typeAnnotation,Q,W);for(let[q,H]of K)Y.set(q,H);break}}return Y}function lO(O,Z,$){if(Z.runesPropsDeclarationMetadataByDeclaratorStart.clear(),Z.explicitPropTypesByName.clear(),Z.explicitVariableTypesByName.clear(),Z.typeImportBindingsByLocalName.clear(),Z.localTypeDeclarationsByName.clear(),Z.typedRunesPropsDeclarations.length=0,!Z.source)return;let Q=$;Z.scriptLanguage=O.resolveScriptLanguage(Q),Z.customElementTag=Q.options?.customElement?.tag,Z.runesOptionOverride=Q.options?.runes,Z.scriptGenericsAttribute=O.resolveScriptGenericsAttribute(Q);let W=Q.instance?.content?.body??[];for(let Y of W){if(!Y?.type)continue;if(Y.type==="ImportDeclaration"&&Y.source?.value)for(let X of Y.specifiers??[]){let K=X.local?.name;if(!K)continue;if(!(Y.importKind==="type"||X.importKind==="type"))continue;let H,z;if(X.type==="ImportSpecifier")H="named",z=X.imported?.type==="Identifier"?X.imported.name:typeof X.imported?.value==="string"?X.imported.value:void 0;else if(X.type==="ImportDefaultSpecifier")H="default";else if(X.type==="ImportNamespaceSpecifier")H="namespace";if(!H)continue;Z.typeImportBindingsByLocalName.set(K,{importedName:z,localName:K,source:String(Y.source.value),specifierType:H})}if((Y.type==="TSInterfaceDeclaration"||Y.type==="TSTypeAliasDeclaration")&&Y.id?.name&&Y.start!==void 0&&Y.end!==void 0)Z.localTypeDeclarationsByName.set(Y.id.name,{code:x(Z,Y.start,Y.end)?.trim()??"",node:Y,start:Y.start});if(Y.type==="ExportNamedDeclaration"&&Y.declaration?.type==="VariableDeclaration")for(let X of Y.declaration.declarations??[]){if(X.id?.type!=="Identifier"||!X.id.name)continue;let K=_0(Z,X.id.typeAnnotation);if(K)Z.explicitPropTypesByName.set(X.id.name,K)}else if(Y.type==="VariableDeclaration")for(let X of Y.declarations??[]){if(X.id?.type!=="Identifier"||!X.id.name)continue;let K=_0(Z,X.id.typeAnnotation);if(K)Z.explicitVariableTypesByName.set(X.id.name,K)}}for(let Y of W){if(!Y||typeof Y!=="object"||!("declarations"in Y))continue;for(let X of Y.declarations??[]){if(!$0(J0(X.init),"$props"))continue;let K=X.id?.typeAnnotation?void 0:NO(X.init),q=X.id?.typeAnnotation?.typeAnnotation??K,H=X.id?.typeAnnotation?_0(Z,X.id.typeAnnotation):xO(Z,K),z=I0(O,Z,q,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([I,k])=>[I,k.node]))),J=new Set,V=new Set;if(uO(Z,q,J,V),mO(Z,J,V),X.start!==void 0){let I={canonicalType:H,props:z,referencedImportedTypes:J,referencedLocalTypes:V};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(X.start,I),H)Z.typedRunesPropsDeclarations.push(I)}}}}function dO(O,Z,$){for(let Q of $.declarations){if(!$0(J0(Q.init),"$props"))continue;if(Q.id.type==="Identifier"){Z.wholePropsLocals.add(Q.id.name),Z.restPropLocals.add(Q.id.name);let X=vO(Z,Q.start);if(X)for(let[K,q]of X.props)M0(O,Z,K,{name:K,kind:"let",type:q.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!q.optional,constant:!1,reactive:!1,source:q.source});continue}if(Q.id.type!=="ObjectPattern")continue;let W=z0(Z,O,$),Y=Q.id.properties.filter((X)=>{if(X.type!=="Property"||X.computed)return!1;if(!O.getPropertyName(X.key))return!1;if(X.value.type==="Identifier")return!0;return X.value.type==="AssignmentPattern"&&X.value.left.type==="Identifier"}).length;for(let X of Q.id.properties){if(X.type==="RestElement"){if(X.argument.type==="Identifier")Z.restPropLocals.add(X.argument.name);continue}let K=O.getPropertyName(X.key);if(!K)continue;let q,H;if(X.value.type==="Identifier")q=X.value.name;else{let A=X.value;q=A.left.name,H=A.right}if(!q)continue;if(O.trackPropLocalName(K,q),K==="children")Z.snippetPropLocals.add(q);let z=CO(Z,O,X)??(Y===1?W:void 0),J=gO(Z,Q.start,K),{init:V,bindable:I}=qO(H),k=V==null?{isFunction:!1}:H0(O,Z,V),{value:u,type:m,isFunction:O0,defaultValue:D}=k,i=J?.type===void 0&&z?.type===void 0?k.resolvedType:void 0,{type:t,typeSource:W0,description:p,params:G,returnType:j,isFunction:L}=R0({explicitType:J?.type,typeSeed:m,inferredTypeForSource:m,jsdocType:z?.type,jsdocDescription:z?.description,jsdocParams:z?.params,jsdocReturnType:z?.returnType,resolvedType:i,resolvedDescription:k.resolvedDescription,resolvedParams:k.resolvedParams,resolvedReturnType:k.resolvedReturnType,initializerIsFunction:O0,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(I)Z.reactive_vars.add(K);M0(O,Z,K,{name:K,...q===K?{}:{localName:q},kind:"let",description:p,binding:z?.binding,deprecated:z?.deprecated,tags:z?.tags,...I?{bindable:!0}:{},type:t,typeSource:W0,value:u,defaultValue:D,params:G,returnType:j,isFunction:L,isFunctionDeclaration:!1,isRequired:V==null&&J?.optional!==!0,constant:!1,reactive:I,source:v(Z,X)})}}}function cO(O,Z){if(O.syntaxMode!=="runes")return;for(let[$,Q]of Array.from(O.events.entries())){if(Q.type!=="dispatched")continue;if(Z.has($)||O.forwardedEvents.has($))continue;let W=`on${$}`,Y=O.props.get(W);if(!Y)continue;let X=Y.type!==void 0||Y.params!==void 0||Y.returnType!==void 0,K=Q.detail===void 0||Q.detail==="undefined"||Q.detail==="null"?"() => void":`(detail: ${Q.detail}) => void`;O.props.set(W,{...Y,description:Y.description??Q.description,type:X?Y.type:K,typeSource:X?Y.typeSource:"inferred",isFunction:!0}),O.events.delete($)}}var iO=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function k0(O){if(!O||typeof O!=="object")return;K0(O,{enter(Z){if(!iO.has(Z.type))return;let $=Z.expression;while($&&iO.has($.type))$=$.expression;if($)this.replace($)}})}var e1=/^\s*$/;function pO(O,Z,$){let Q=Z+1;while(Q<O.length){if(O[Q]==="\\"){Q+=2;continue}if(O[Q]===$)return Q+1;Q++}return Q}function oO(O,Z){let $=Z+1,Q=0;while($<O.length){let W=O[$];if(W==="\\"){$+=2;continue}if(Q===0){if(W==="`")return $+1;if(W==="$"&&O[$+1]==="{"){Q=1,$+=2;continue}$++;continue}if(W==="{")Q++;else if(W==="}")Q--;else if(W==='"'||W==="'"){$=pO(O,$,W);continue}else if(W==="`"){$=oO(O,$);continue}$++}return $}function O2(O,Z){let $=[],Q=O.length,W=0;while(W<Q){let Y=O[W];if(Y==='"'||Y==="'"){W=pO(O,W,Y);continue}if(Y==="`"){W=oO(O,W);continue}if(Y==="/"&&O[W+1]==="/"){let X=W+2;while(X<Q&&O[X]!==`
15
- `)X++;W=X;continue}if(Y==="/"&&O[W+1]==="*"){let X=W,K=W+2;while(K<Q&&!(O[K]==="*"&&O[K+1]==="/"))K++;let q=Math.min(K+2,Q),H=O.slice(X,q);$.push({end:q+Z,isJsDoc:H.startsWith("/**")&&H.length>4,text:H}),W=q;continue}W++}return $}function sO(O,Z,$){if(!O||typeof O!=="object"||!("type"in O))return;let Q=O;if(Q.type==="FunctionDeclaration"){if(Q.id?.type==="Identifier"&&Q.id.name)$.push({name:Q.id.name,start:Z});return}if(Q.type==="VariableDeclaration"){for(let W of Q.declarations??[])if(W?.id?.type==="Identifier"&&W.id.name)$.push({name:W.id.name,start:Z})}}function Z2(O){let Z=[];for(let $ of O){if(!$||typeof $!=="object"||!("type"in $))continue;let Q=$;if(Q.start===void 0)continue;if(Q.type==="ExportNamedDeclaration"&&Q.declaration)sO(Q.declaration,Q.start,Z);else sO(Q,Q.start,Z)}return Z}function $2(O,Z,$){let Q;for(let W of O){if(W.end>Z)break;if(!W.isJsDoc)continue;if(!e1.test($.slice(W.end,Z)))continue;Q=W}return Q}function aO(O,Z){let $=new Map;if(!O.source)return $;let Q=[O.parsed?.module,O.parsed?.instance],W=[],Y=[];for(let X of Q){let K=X?.content;if(!K?.body||K.start===void 0||K.end===void 0)continue;W.push(...O2(O.source.slice(K.start,K.end),K.start)),Y.push(...Z2(K.body))}W.sort((X,K)=>X.end-K.end);for(let X of Y){let K=$2(W,X.start,O.source);if(!K)continue;let q=V0(K.text,{spacing:"preserve"}),{type:H,description:z}=n0(q);if(!H)continue;$.set(X.name,{type:Z.aliasType(H.type),description:z||H.description})}return $}function rO(O){if(O==="var")return"let";if(O==="using"||O==="await using")return"const";return O}var Q2=null,nO=/^@component/,W2=/\r/g,Y2=/^\{\s*\}$/;class c{ctx=N0();static mapToArray(O){return Array.from(O,([Z,$])=>$)}static getStaticAttributeValue(O){if(!Array.isArray(O.value))return;return O.value.map((Z)=>Z.data??Z.raw??"").join("").trim()}resolveScriptLanguage(O){let Z=[O.instance,O.module].filter((Q)=>Q!==void 0),$=!1;for(let Q of Z){let W=Q.attributes?.find((X)=>X.name==="lang");if(!W){$=!0;continue}if(c.getStaticAttributeValue(W)?.toLowerCase()==="ts")return"ts"}return $?"js":void 0}resolveScriptGenericsAttribute(O){let Z=O.instance?.attributes?.find((X)=>X.name==="generics");if(!Z)return;let $=v(this.ctx,Z),Q=O.instance?.attributes?.find((X)=>X.name==="lang");if((Q?c.getStaticAttributeValue(Q)?.toLowerCase():void 0)!=="ts"){q0(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',$);return}let Y=c.getStaticAttributeValue(Z);if(!Y)return;return{value:Y,source:$}}resolvePublicPropName(O){return this.ctx.propLocalToPublicName.get(O)??O}trackPropLocalName(O,Z=O){this.ctx.propLocalToPublicName.set(Z,O)}getPropByLocalOrPublic(O){return this.ctx.props.get(this.resolvePublicPropName(O))}getPropTypeByLocalOrPublic(O){return this.getPropByLocalOrPublic(O)?.type}getExplicitPropType(O){return this.ctx.explicitPropTypesByName.get(O)}getPropertyName(O){if(!O||typeof O!=="object"||!("type"in O))return;if(Q0(O))return O.name;if(U0(O))return O.value==null?void 0:String(O.value);return}isNumericConstant(O){if(!O||typeof O!=="object"||!("type"in O))return!1;if(O.type!=="MemberExpression")return!1;let Z=O,$=Z.object&&"name"in Z.object?Z.object.name:void 0,Q=Z.property&&"name"in Z.property?Z.property.name:void 0;if(!$||!Q)return!1;if($==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(Q);if($==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(Q);return!1}resolveLocalVarJSDoc(O){for(let $ of this.ctx.vars)if($.declarations.some((W)=>W.id&&typeof W.id==="object"&&("type"in W.id)&&W.id.type==="Identifier"&&("name"in W.id)&&W.id.name===O))return z0(this.ctx,this,$);let Z=this.ctx.funcDecls.get(O);if(Z)return z0(this.ctx,this,Z);return}addModuleExport(O,Z){if(n(O)===void 0)return;if(this.ctx.moduleExports.has(O)){let $=this.ctx.moduleExports.get(O);this.ctx.moduleExports.set(O,{...$,...Z})}else this.ctx.moduleExports.set(O,Z)}aliasType(O){if(O==="*")return"any";return O.trim()}findVariableTypeAndDescription(O){let Z=this.getPropByLocalOrPublic(O);if(Z?.type)return{type:Z.type,description:Z.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=aO(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let $=this.ctx.variableInfoCache.get(O),Q=this.ctx.explicitVariableTypesByName.get(O);if(Q)return{type:Q,description:$?.description};return $??null}accumulateGeneric(O,Z){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${O}`,`${this.ctx.generics[1]}, ${Z}`];else this.ctx.generics=[O,Z]}cleanup(){this.ctx=N0()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(O){return c.SCRIPT_BLOCK_REGEX.lastIndex=0,O.replace(c.SCRIPT_BLOCK_REGEX,(Z,$,Q,W)=>{c.TS_DIRECTIVE_REGEX.lastIndex=0;let Y=Q.replace(c.TS_DIRECTIVE_REGEX,"");return $+Y+W})}parseSvelteComponent(O,Z){this.cleanup(),this.ctx.componentFilePath=Z.filePath;let $=c.stripTypeScriptDirectivesFromScripts(O);this.ctx.source=$;let{modern:Q,legacy:W}=$1($);if(lO(this,this.ctx,Q),this.ctx.parsed=W,this.ctx.scriptLanguage==="ts")k0(this.ctx.parsed.module),k0(this.ctx.parsed.instance),k0(this.ctx.parsed.html);this.ctx.syntaxMode=TO(this.ctx);let Y=this.ctx.parsed.css,X=Y?.start!==void 0&&Y?.end!==void 0?$.slice(0,Y.start)+" ".repeat(Y.end-Y.start)+$.slice(Y.end):$;if(PO(this.ctx,this,X),this.ctx.parsed?.module)K0(this.ctx.parsed?.module,{enter:(G)=>{if(G.type==="ExportNamedDeclaration"){if(G.declaration==null)return;if(!G.declaration||typeof G.declaration!=="object"||!("type"in G.declaration))return;let j,L,A=!1,U,M,f,S=!1,C,T,b;if(G.declaration.type==="FunctionDeclaration"){let R=G.declaration;if(!R.id?.name)return;j=R.id.name,L="function",U=void 0,M="() => any",S=!0,A=!0}else if(G.declaration.type==="VariableDeclaration"){let R=G.declaration,N=R.declarations[0];if(!N||typeof N!=="object"||!("id"in N))return;let{id:l,init:F}=N;if(!l||typeof l!=="object"||!("name"in l))return;let P=l.name;j=P,L=rO(R.kind);let w=F==null?{isFunction:!1}:H0(this,this.ctx,F);({value:U,type:M,isFunction:S,defaultValue:C}=w),T=M,b=w,f=this.getExplicitPropType(P)}else return;let y=z0(this.ctx,this,G),{type:a,typeSource:Z0,description:E,params:r,returnType:B,isFunction:_}=R0({explicitType:f,typeSeed:M,inferredTypeForSource:T,jsdocType:y?.type,jsdocDescription:y?.description,jsdocParams:y?.params,jsdocReturnType:y?.returnType,resolvedType:b?.resolvedType,resolvedDescription:b?.resolvedDescription,resolvedParams:b?.resolvedParams,resolvedReturnType:b?.resolvedReturnType,initializerIsFunction:S,isFunctionDeclaration:A,typedefs:this.ctx.typedefs});this.addModuleExport(j,{name:j,kind:L,description:E,deprecated:y?.deprecated,tags:y?.tags,type:a,typeSource:Z0,value:U,defaultValue:C,params:r,returnType:B,isFunction:_,isFunctionDeclaration:A,isRequired:!1,constant:L==="const",reactive:!1,source:v(this.ctx,G)})}}});let K,q=new Set,H=new Set,z=[],J={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};SO(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let V=bO(this.ctx);if(K0(J,{enter:(G,j,L)=>{EO(this,this.ctx,V,G);let A=this.ctx.scopeDeclarations.get(G);if(A)this.ctx.activeScopes.push(A);if(G.type==="AssignmentExpression")e0(this.ctx,G.left);if(G.type==="UpdateExpression")e0(this.ctx,G.argument);if(G.type==="CallExpression"){let U=G,M=U.callee&&typeof U.callee==="object"&&"name"in U.callee?U.callee.name:void 0;if(M==="createEventDispatcher"){if(j&&typeof j==="object"&&"id"in j&&j.id&&typeof j.id==="object"&&"name"in j.id)K=j.id.name}if(M==="$host"){if(j&&typeof j==="object"&&"id"in j&&j.id&&typeof j.id==="object"&&"name"in j.id)q.add(j.id.name)}if(M==="setContext")HO(this.ctx,this,G,j??void 0);if(M)z.push({name:M,arguments:U.arguments,source:v(this.ctx,U)});if(tO(U.callee)&&Q0(U.callee.property)&&U.callee.property.name==="dispatchEvent"&&($0(U.callee.object,"$host")||Q0(U.callee.object)&&q.has(U.callee.object.name))){let f=UO(this.ctx,U);if(f)H.add(f)}}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Spread"){let U=G;if(U.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(U.expression?.name??""))hO(this.ctx,j)}if(G.type==="FunctionDeclaration"){let U=G;if(U.id?.name)this.ctx.funcDecls.set(U.id.name,U)}if(G.type==="VariableDeclaration"){if(this.ctx.vars.add(G),j&&typeof j==="object"&&"type"in j&&j.type==="Program"&&G.declarations.some((U)=>$0(J0(U.init),"$props")))dO(this,this.ctx,G)}if(G.type==="ExportNamedDeclaration"){if(G.declaration==null&&G.specifiers.length===0)return;let U;if(G.declaration==null&&G.specifiers[0]?.type==="ExportSpecifier"){let w=G.specifiers[0],s=w.local&&typeof w.local==="object"&&"name"in w.local?w.local.name:void 0,h=w.exported&&typeof w.exported==="object"&&"name"in w.exported?w.exported.name:void 0;if(!s||!h)return;let o;for(let Y0 of Array.from(this.ctx.vars))if(Y0.declarations.some((X0)=>X0.id&&typeof X0.id==="object"&&("type"in X0.id)&&X0.id.type==="Identifier"&&X0.id.name===s)){o=Y0;break}G.declaration=o,U=h}if(G.declaration==null)return;if(!G.declaration||typeof G.declaration!=="object"||!("type"in G.declaration))return;let M,f=!1,S,C,T,b=!1,y=!1,a,Z0,E,r;if(G.declaration.type==="FunctionDeclaration"){let w=G.declaration;if(!w.id?.name)return;U??=w.id.name,a=w.id.name,M="function",S=void 0,C="() => any",b=!0,f=!0,y=!1}else if(G.declaration.type==="VariableDeclaration"){let w=G.declaration,s=w.declarations[0];if(!s||typeof s!=="object"||!("id"in s))return;let{id:h,init:o}=s;if(h&&typeof h==="object"&&"name"in h){let X0=h.name;a=X0,U??=X0,T=this.getExplicitPropType(X0)}else return;M=rO(w.kind),y=M==="let"&&o==null;let Y0=o==null?{isFunction:!1}:H0(this,this.ctx,o);({value:S,type:C,isFunction:b,defaultValue:Z0}=Y0),E=C,r=Y0}else return;let B=z0(this.ctx,this,G),{type:_,typeSource:R,description:N,params:l,returnType:F,isFunction:P}=R0({explicitType:T,typeSeed:C,inferredTypeForSource:E,jsdocType:B?.type,jsdocDescription:B?.description,jsdocParams:B?.params,jsdocReturnType:B?.returnType,resolvedType:r?.resolvedType,resolvedDescription:r?.resolvedDescription,resolvedParams:r?.resolvedParams,resolvedReturnType:r?.resolvedReturnType,initializerIsFunction:b,isFunctionDeclaration:f,typedefs:this.ctx.typedefs});M0(this,this.ctx,U,{name:U,...a!==void 0&&a!==U?{localName:a}:{},kind:M,description:N,binding:B?.binding,deprecated:B?.deprecated,tags:B?.tags,type:_,typeSource:R,value:S,defaultValue:Z0,params:l,returnType:F,isFunction:P,isFunctionDeclaration:f,isRequired:y,constant:M==="const",reactive:this.ctx.reactive_vars.has(U),source:v(this.ctx,G)})}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Comment"){let M=G?.data?.trim()??"";if(nO.test(M))this.ctx.componentComment=M.replace(nO,"").replace(W2,""),this.ctx.componentCommentSource=v(this.ctx,G)}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="Slot"){let U=G,M=U.attributes?.find((C)=>C.name==="name")?.value?.[0]?.data,f=(U.attributes||[]).filter((C)=>C.name!=="name").reduce((C,T)=>{let b={value:void 0,replace:!1},y=T.value;if(y===void 0)return C;if(y[0]){let a=y[0],{type:Z0,expression:E,raw:r,start:B,end:_}=a;if(Z0==="Text"&&r!==void 0)b.value=JSON.stringify(r);else if(Z0==="AttributeShorthand"&&E&&typeof E==="object"&&"name"in E)b.value=E.name,b.replace=!0;if(E&&typeof E==="object"&&"type"in E){if(E.type==="Literal"&&"value"in E){let R=E.value;b.value=typeof R==="string"?JSON.stringify(R):String(R)}else if(E.type==="MemberExpression")b.value=F0(this.ctx,this,E);else if(E.type!=="Identifier"){if(B!==void 0&&_!==void 0){if(E.type==="ObjectExpression"||E.type==="TemplateLiteral")b.value=x(this.ctx,B+1,_-1)}}}}if(T.name)C[T.name]=b;return C},{}),S=U.children?.map(({start:C,end:T})=>{if(C===void 0||T===void 0)return"";return x(this.ctx,C,T)??""}).join("").trim();L0(this.ctx,{slot_name:M,slot_props:f,slot_fallback:S,source:v(this.ctx,G)})}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="RenderTag"){let U=G,M=LO(this.ctx,U.expression);if(M){let f;if(M.arguments.length===0)f={};else if(M.arguments.length===1&&typeof M.arguments[0]==="object"&&M.arguments[0]&&"type"in M.arguments[0]&&M.arguments[0].type==="ObjectExpression")f=VO(this.ctx,this,M.arguments[0]);else if(M.arguments.length===1)q0(this.ctx,"syntax-skipped",M.publicName,`{@render ${M.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,v(this.ctx,G));let S=M.publicName==="children"?void 0:M.publicName,C=S===void 0?Q2:S;if(f!==void 0)L0(this.ctx,{slot_name:S,slot_props:f,source:v(this.ctx,G)});if(f!==void 0||this.ctx.slots.has(C))this.ctx.snippetPropLocals.add(M.trackingName)}}if(G&&typeof G==="object"&&"type"in G&&String(G.type)==="EventHandler"){let U=G;if(U.expression==null&&U.name){if(j!=null&&typeof j==="object"&&"name"in j){let M=typeof j.name==="string"?j.name:void 0,f="type"in j?String(j.type):void 0;if(M&&f){let S=f==="InlineComponent"?{type:"InlineComponent",name:M}:{type:"Element",name:M};this.ctx.forwardedEvents.set(U.name,S);let C=this.ctx.events.get(U.name),T=this.ctx.eventDescriptions.get(U.name),b=C?.deprecated;if(!C)this.ctx.events.set(U.name,{type:"forwarded",name:U.name,element:S,description:T,deprecated:b,source:v(this.ctx,G)});else if(C.type==="forwarded"&&T&&!C.description)this.ctx.events.set(U.name,{...C,description:T,deprecated:C.deprecated??b,source:C.source||v(this.ctx,G)})}}}}if(j&&typeof j==="object"&&"type"in j&&(String(j.type)==="Element"||String(j.type)==="InlineComponent")&&G&&typeof G==="object"&&"type"in G&&String(G.type)==="Binding"){let U=G;if(U.expression?.name){let M=S0(this.ctx,U.expression.name);if(M)this.ctx.reactive_vars.add(M)}if(String(j.type)==="Element"&&U.name==="this"&&U.expression?.name&&"name"in j&&typeof j.name==="string"){let M=S0(this.ctx,U.expression.name);if(!M)return;let f=j.name;if(this.ctx.bindings.has(M)){let S=this.ctx.bindings.get(M);if(S&&!S.elements.includes(f))this.ctx.bindings.set(M,{...S,elements:[...S.elements,f]})}else this.ctx.bindings.set(M,{elements:[f]})}}},leave:(G)=>{if(this.ctx.scopeDeclarations.has(G))this.ctx.activeScopes.pop();_O(V,G)}}),K!==void 0){for(let G of z)if(G.name===K){let j=G.arguments[0],L=j&&typeof j==="object"&&"value"in j?j.value:void 0,A=G.arguments[1],U=A&&typeof A==="object"&&"value"in A?A.value:void 0;if(L!=null)B0(this.ctx,{name:String(L),detail:U==null?"":x0(U),has_argument:Boolean(A),source:G.source})}}let I=new Set(H);if(K!==void 0){for(let G of z)if(G.name===K){let j=G.arguments[0],L=j&&typeof j==="object"&&"value"in j?j.value:void 0;if(L!=null)I.add(String(L))}}this.ctx.forwardedEvents.forEach((G,j)=>{let L=this.ctx.events.get(j);if(L&&L.type==="dispatched"&&!I.has(j)){let A=this.ctx.eventDescriptions.get(j),U={type:"forwarded",name:j,element:G,description:A,deprecated:L.deprecated,tags:L.tags,source:L.source};if(L.detail!==void 0&&L.detail!=="undefined")U.detail=L.detail;this.ctx.events.set(j,U)}}),cO(this.ctx,I);let k=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(G)=>this.resolvePublicPropName(G))):new Set,u=c.mapToArray(this.ctx.props).filter((G)=>!k.has(G.name)).map((G)=>{if(this.ctx.bindings.has(G.name)){let j=this.ctx.bindings.get(G.name)?.elements.sort().map((L)=>WO(L)).join(" | ");return{...G,type:`null | ${j}`,typeSource:"inferred",reactive:G.reactive||this.ctx.reactive_vars.has(G.name)}}return{...G,reactive:G.reactive||this.ctx.reactive_vars.has(G.name)}});this.ctx.activeScopes.length=0;let m=c.mapToArray(this.ctx.slots).map((G)=>{if(!G.slot_props)return G;if(typeof G.slot_props==="string")return Y2.test(G.slot_props)?{...G,slot_props:"Record<string, never>"}:G;let j=G.slot_props,L=[];for(let U of Object.keys(j)){if(j[U].replace&&j[U].value!==void 0)j[U].value=this.getPropTypeByLocalOrPublic(j[U].value);if(j[U].value===void 0)j[U].value="any";L.push(`${U}: ${j[U].value}`)}let A=L.length===0?"Record<string, never>":L.length===1?`{ ${L[0]} }`:`{
16
- ${L.join(`;
17
- `)};
18
- }`;return{...G,slot_props:A}}).sort((G,j)=>{let L=G.name??"",A=j.name??"";if(L<A)return-1;if(L>A)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let G=[...u.map((j)=>j.type??""),...m.map((j)=>j.slot_props??"")].join(`
19
- `);for(let{name:j,constraint:L}of this.ctx.deferredSlotBlockGenerics){let A=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${A}\\b`).test(G))continue;this.accumulateGeneric(j,L)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)q0(this.ctx,"syntax-skipped","generics",'Both the "generics" script attribute and @generics/@template JSDoc tags declare component generics; the script attribute takes precedence and the JSDoc declaration was ignored.',this.ctx.scriptGenericsAttribute.source);this.ctx.generics=Z1(this.ctx.scriptGenericsAttribute.value)}let O0=c.mapToArray(this.ctx.moduleExports),D=c.mapToArray(this.ctx.events).map((G)=>{switch(G.type){case"forwarded":return{...G,element:G.element.name};case"dispatched":return G;default:return G}}).sort((G,j)=>{let L=G.name.localeCompare(j.name);if(L!==0)return L;let A=G.type.localeCompare(j.type);if(A!==0)return A;if(G.type==="forwarded"&&j.type==="forwarded"){let U=G.element.localeCompare(j.element);if(U!==0)return U}return(G.detail??"").localeCompare(j.detail??"")}),i=c.mapToArray(this.ctx.typedefs),t=c.mapToArray(this.ctx.contexts);for(let G of u)if(G.typeSource==="unknown")q0(this.ctx,"prop-unknown-type",G.name,`Prop "${G.name}" type could not be inferred; falling back to "${G.type??"any"}".`,G.source);for(let G of this.ctx.jsDocEventNames){if(I.has(G))continue;if(this.ctx.forwardedEvents.has(G))continue;if(this.ctx.props.has(`on${G}`))continue;q0(this.ctx,"event-no-source",G,`@event "${G}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(G))}let W0={source:eO(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:u,moduleExports:O0,slots:m,events:D,typedefs:i,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:t,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},p=O1(this.ctx);if(p)W0[ZO]=p;return W0}}
20
- export{c as t};