sveld 0.36.6 → 0.36.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/browser.js CHANGED
@@ -7,7 +7,7 @@ var s4=Object.defineProperty;var n4=(q)=>q;function a4(q,Q){this[q]=n4.bind(null
7
7
  }`:`{ ${Y} }`}var $3=/[A-Za-z_$][\w$]*/g;function M3(q,Q){if(!Q)return!1;let Z=new Set(Q[0].split(",").map((Y)=>Y.trim()));for(let[Y]of q.matchAll($3))if(Z.has(Y))return!0;return!1}function J9(q,Q){if(Q===void 0)return;return q.runesPropsDeclarationMetadataByDeclaratorStart.get(Q)}function r6(q,Q,Z){return J9(q,Q)?.props.get(Z)}function t6(q){if(!q||typeof q!=="object"||!("type"in q))return;if(q.type==="Identifier"&&"name"in q&&typeof q.name==="string")return q.name;if(q.type==="TSQualifiedName"&&"right"in q&&q.right&&typeof q.right==="object"&&"name"in q.right&&typeof q.right.name==="string")return q.right.name;return}function e6(q){if(!q||typeof q!=="object"||!("type"in q))return;if(q.type==="Identifier"&&"name"in q&&typeof q.name==="string")return q.name;if(q.type==="TSQualifiedName"&&"left"in q&&q.left&&typeof q.left==="object")return e6(q.left);return}function Y0(q,Q){let Z=Q?.start,Y=Q?.end;if(Z===void 0||Y===void 0)return;return e(q,Z+1,Y)?.trim()}function q7(q,Q){let Z=Q?.start,Y=Q?.end;if(Z===void 0||Y===void 0)return;return e(q,Z,Y)?.trim()}function L8(q,Q,Z,Y,H=new Set){if(!Q?.type)return;switch(Q.type){case"TSInterfaceDeclaration":L8(q,{type:"TSTypeLiteral",members:Q.body?.body},Z,Y,H);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":L8(q,Q.typeAnnotation,Z,Y,H);return;case"TSIntersectionType":case"TSUnionType":for(let j of Q.types??[])L8(q,j,Z,Y,H);return;case"TSTypeLiteral":for(let j of Q.members??[]){if(j?.type!=="TSPropertySignature")continue;L8(q,j.typeAnnotation?.typeAnnotation,Z,Y,H)}return;case"TSTypeReference":{let j=e6(Q.typeName);if(j){if(q.typeImportBindingsByLocalName.has(j))Z.add(j);let K=q.localTypeDeclarationsByName.get(j);if(K&&!H.has(j))Y.add(j),H.add(j),L8(q,K.node,Z,Y,H),H.delete(j)}if("typeParameters"in Q&&Q.typeParameters&&typeof Q.typeParameters==="object"){let K=Q.typeParameters;for(let X of K.params??[])L8(q,X,Z,Y,H)}return}case"TSArrayType":case"TSRestType":case"TSOptionalType":case"TSIndexedAccessType":case"TSTypeOperator":case"TSExpressionWithTypeArguments":case"TSTupleType":case"TSConditionalType":case"TSInferType":case"TSMappedType":case"TSFunctionType":case"TSConstructorType":case"TSTypeQuery":case"TSImportType":case"TSLiteralType":case"TSTypePredicate":case"TSNamedTupleMember":break;default:break}for(let j of Object.values(Q)){if(!j||typeof j!=="object")continue;if(Array.isArray(j)){for(let K of j){if(!K||typeof K!=="object"||!("type"in K))continue;L8(q,K,Z,Y,H)}continue}if("type"in j)L8(q,j,Z,Y,H)}}function w3(q,Q){let Z=new Map;for(let Y of Array.from(Q).sort()){let H=q.typeImportBindingsByLocalName.get(Y);if(!H)continue;let j=Z.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});Z.set(H.source,j)}return Array.from(Z.entries()).sort(([Y],[H])=>Y.localeCompare(H)).map(([Y,H])=>{if(H.namespace.length>0)return H.namespace.map((W)=>`import type * as ${W} from "${Y}";`).join(`
8
8
  `);let j=H.named.map(({imported:W,local:B})=>{if(!W||W===B)return B;return`${W} as ${B}`}),K=H.default[0],X=j.length>0?`{ ${j.join(", ")} }`:"";if(K&&X)return`import type ${K}, ${X} from "${Y}";`;if(K)return`import type ${K} from "${Y}";`;return`import type ${X} from "${Y}";`})}function Q7(q){let Q=q.pendingCallDefaultCandidates.length>0?q.pendingCallDefaultCandidates.slice():void 0;if(q.typedRunesPropsDeclarations.length!==1)return Q?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:Q}:void 0;let[Z]=q.typedRunesPropsDeclarations;if(!Z.canonicalType)return Q?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:Q}:void 0;let Y=Array.from(Z.referencedLocalTypes).map((H)=>q.localTypeDeclarationsByName.get(H)).filter((H)=>H!==void 0).sort((H,j)=>H.start-j.start).map((H)=>H.code);return{canonicalPropsType:Z.canonicalType,canonicalPropNames:Array.from(Z.props.keys()).sort(),localTypeDeclarations:Y,typeImportStatements:w3(q,Z.referencedImportedTypes),referencesComponentGenerics:M3(Z.canonicalType,q.generics),...Q?{pendingCallDefaultCandidates:Q}:{}}}var A3=/^[A-Za-z_$][\w$]*/,C3=/[A-Za-z_$][\w$]*/g,Z7=/^(?:const|in|out)\s+/;function S1(q){let Q=[],Z=0,Y=0;for(let H=0;H<q.length;H++){let j=q[H];if(j==="<"||j==="("||j==="["||j==="{")Z++;else if(j===">"||j===")"||j==="]"||j==="}")Z=Math.max(Z-1,0);else if(j===","&&Z===0)Q.push(q.slice(Y,H)),Y=H+1}return Q.push(q.slice(Y)),Q}function Y7(q){let Q=S1(q).map((Y)=>Y.trim()).filter((Y)=>Y.length>0);if(Q.length===0)return null;return[Q.map((Y)=>{let H=Y;while(Z7.test(H))H=H.replace(Z7,"");return H.match(A3)?.[0]??Y}).join(", "),Q.join(", ")]}function H7(q,Q,Z){let Y=q.scriptGenericsAttribute?.value;if(!Y)return;for(let[H]of Y.matchAll(C3)){if(q.typeImportBindingsByLocalName.has(H))Q.add(H);if(Z.has(H))continue;let j=q.localTypeDeclarationsByName.get(H);if(!j)continue;Z.add(H),L8(q,j.node,Q,Z)}}var L3=/\n/,I3=/\r$/,G1=/^\s+/,S3=/\s/,P3=/^@[^\s/]+(?=\s|$)/,D3=/^@(\S+)\s*/;function k3(q){let Q=[],Z=0;for(let Y of q.split(L3))Q.push({text:Y.replace(I3,""),start:Z}),Z+=Y.length+1;return Q}function N3(q,Q){let Z=q.replace(G1,""),Y=!1;if(Q)Z=Z.slice(3),Y=!0;else if(Z.startsWith("*")&&!Z.startsWith("*/"))Z=Z.slice(1),Y=!0;let H=Z.match(G1)?.[0]??"";Z=Z.slice(H.length);let j=Z.trimEnd(),K=j.endsWith("*/")?j.slice(0,-2):Z;return{indent:Y?H.slice(1):H,separator:H,content:K}}function b3(q){let Q=[],Z=k3(q),Y=null,H=0;for(let j of Z){if(Y===null){let B=j.text.replace(G1,"");if(!B.startsWith("/**")||B.startsWith("/***"))continue;Y=[],H=j.start+(j.text.length-B.length)}let{indent:K,separator:X,content:W}=N3(j.text,Y.length===0);if(Y.push({raw:j.text,start:j.start,number:Y.length,indent:K,separator:X,content:W}),j.text.trimEnd().endsWith("*/"))Q.push({start:H,lines:Y}),Y=null}return Q}function T3(q){let Q=q;if(Q.length>0&&Q[0].content==="")Q=Q.slice(1);if(Q.length>0&&Q[Q.length-1].content==="")Q=Q.slice(0,-1);return Q}function E3(q){let Q=[[]],Z=!1;for(let Y of q){if(P3.test(Y.content)&&!Z)Q.push([Y]);else Q[Q.length-1].push(Y);if(Y.content.split("```").length%2===0)Z=!Z}return Q}function J7(q){return q.map((Q)=>Q.indent+Q.content).join(`
9
9
  `)}function v3(q,Q){let Z=Q;while(Z<q.length-1&&q[Z].content.trim()==="")Z++;if(q[Z].content[0]!=="{")return null;let Y=0,H=[],j=Z;for(;j<q.length;j++){let W=q[j].content,B=0;for(let U of W){if(U==="{")Y++;else if(U==="}")Y--;if(B++,Y===0)break}if(H.push(B),Y===0)break}if(Y!==0)return null;let K=j;return{type:H.map((W,B)=>{let U=Z+B,$=q[U].content.slice(0,W);return q[U].content=q[U].content.slice(W).replace(G1,""),B===0?$:q[U].indent+$}).join(`
10
- `).slice(1,-1),endIndex:K}}function h3(q){let Q=q.content.match(G1)?.[0]??"",Z=q.content.slice(Q.length),Y=0,H=0;for(let B of Z){if(Y===0&&S3.test(B))break;if(B==="[")Y++;if(B==="]")Y--;H++}let j=Y===0?Z.slice(0,H):"";if(!j)return null;let K=j,X=!1,W;if(j.startsWith("[")&&j.endsWith("]")){X=!0;let U=j.slice(1,-1).split("=");if(K=U[0].trim(),U.length>1)W=U.slice(1).join("=").trim();if(!K)return null}return q.content=Z.slice(H).replace(G1,""),{name:K,optional:X,default:W}}function y3(q){let Q=q[0],Z=Q.content.match(D3),Y=Z?Z[1]:"",H=Z?Q.content.slice(Z[0].length):Q.content,j=H.trimEnd(),K=q.slice(1).map((R)=>R.separator+R.content),X=(j?[j,...K]:K).join(`
10
+ `).slice(1,-1),endIndex:K}}function h3(q){let Q=q.content.match(G1)?.[0]??"",Z=q.content.slice(Q.length),Y=0,H=0;for(let B of Z){if(Y===0&&S3.test(B))break;if(B==="[")Y++;if(B==="]")Y--;H++}let j=Y===0?Z.slice(0,H):"";if(!j)return null;let K=j,X=!1,W;if(j.startsWith("[")&&j.endsWith("]")){X=!0;let U=j.slice(1,-1).split("=");if(K=U[0].trim(),U.length>1)W=U.slice(1).join("=").trim();if(!K)return null}if(K.length>1&&(K[0]==='"'||K[0]==="'")&&K[K.length-1]===K[0])K=K.slice(1,-1);return q.content=Z.slice(H).replace(G1,""),{name:K,optional:X,default:W}}function y3(q){let Q=q[0],Z=Q.content.match(D3),Y=Z?Z[1]:"",H=Z?Q.content.slice(Z[0].length):Q.content,j=H.trimEnd(),K=q.slice(1).map((R)=>R.separator+R.content),X=(j?[j,...K]:K).join(`
11
11
  `);Q.content=H,Q.tag=Y;let W=v3(q,0),B=W?.type??"",U=0;if(W){U=W.endIndex;while(U<q.length-1&&q[U].content.trim()==="")U++}let $=h3(q[U]),w=J7(q.slice(W?W.endIndex:0));return{tag:Y,name:$?.name??"",type:B,optional:$?.optional??!1,default:$?.default,description:w,raw:X,lines:q}}function f3(q,Q){let Z=T3(q);Z.forEach((j,K)=>{j.number=K});let Y=E3(Z),H=Y.slice(1).map(y3);return{description:J7(Y[0]),tags:H,start:Q,lines:Z}}function P1(q){return b3(q).map(({start:Q,lines:Z})=>f3(Z,Q))}var g3=null;function _3(q,Q,Z){let Y={value:void 0,replace:!1};if(!Z||typeof Z!=="object"||!("type"in Z))return Y;if(Z.type==="Identifier")Y.value=Z.name,Y.replace=!0;else if(Z.type==="Literal")Y.value=String(Z.value);else if(Z.type==="MemberExpression")Y.value=q0(q,Q,Z);else if((Z.type==="ObjectExpression"||Z.type==="TemplateLiteral")&&"start"in Z&&"end"in Z&&typeof Z.start==="number"&&typeof Z.end==="number")Y.value=e(q,Z.start,Z.end);return Y}function K7(q,Q,Z){let Y={};for(let H of Z.properties){if(H.type!=="Property"||H.computed)continue;let j=Q.getPropertyName(H.key);if(!j)continue;Y[j]=_3(q,Q,H.value)}return Y}function x3(q,Q){if(!Q||typeof Q!=="object"||!("type"in Q))return null;if(Q.type==="Identifier"){let j=Q,K=q.propLocalToPublicName.get(j.name);if(!K)return null;return{publicName:K,trackingName:j.name}}if(Q.type!=="MemberExpression")return null;let Z=Q,Y=Z.object&&typeof Z.object==="object"&&"type"in Z.object&&Z.object.type==="Identifier"?Z.object.name:void 0;if(!Y||!q.wholePropsLocals.has(Y))return null;let H;if(!Z.computed&&Z.property&&typeof Z.property==="object"&&"type"in Z.property){if(Z.property.type==="Identifier")H=Z.property.name;else if(Z.property.type==="Literal"&&Z.property.value!=null)H=String(Z.property.value)}else if(Z.computed&&Z.property&&typeof Z.property==="object"&&"type"in Z.property&&Z.property.type==="Literal"&&"value"in Z.property&&Z.property.value!=null)H=String(Z.property.value);if(!H)return null;return{publicName:H,trackingName:H}}function j7(q,Q){let Z=Q;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="ChainExpression")Z=Z.expression;if(!Z||typeof Z!=="object"||!("type"in Z)||Z.type!=="CallExpression")return null;let Y=Z;if(!Y.callee||typeof Y.callee!=="object"||!("type"in Y.callee))return null;let H=x3(q,Y.callee);if(!H)return null;return{...H,arguments:Y.arguments}}function D1(q,{slot_name:Q,slot_props:Z,slot_fallback:Y,slot_description:H,slot_deprecated:j,slot_tags:K,source:X}){let W=Q===void 0||Q==="",B=W?g3:Q??"",U=C8(Y),$=Z===void 0||Z===""?void 0:Z,w=H?.trim()||void 0;if(q.slots.has(B)){let R=q.slots.get(B);if(R)q.slots.set(B,{...R,default:R.default??W,fallback:U,slot_props:R.slot_props===void 0?$:R.slot_props,description:R.description||w,deprecated:R.deprecated??j,tags:R.tags||K,source:X||R.source})}else q.slots.set(B,{name:B,default:W,fallback:U,slot_props:Z,description:w,deprecated:j,tags:K,source:X})}var u3=/\s*=\s*/;function V7(q){let Q=q.indexOf("<");if(Q===-1||!q.endsWith(">"))return q;let Z=q.slice(0,Q),Y=q.slice(Q+1,-1),H=S1(Y).map((j)=>j.trim().replace(u3," = ")).join(", ");return`${Z}<${H}>`}var K9=/^\s*$/,m3=/;$/,l3=/^-\s*/;function J1(q){if(q===void 0)return;let Q=q.replace(l3,"").trim();return Q===""?"":Q}function k1(q){if(!q||q.length===0)return;return q[0].content}var X7=new Set(["since","example"]);function c3(q){let Q=q.trim();return Q===""?!0:Q}function W7(q,Q){return c3(`${q??""}${Q?` ${Q}`:""}`)}function d3(q){let Q=q.trim().replace(m3,"").trimEnd();if(!Q.startsWith("{")||!Q.endsWith("}"))return!1;let Z=0,Y=null;for(let H=0;H<Q.length;H++){let j=Q[H];if(Y!==null){if(j==="\\"){H++;continue}if(j===Y)Y=null;continue}if(j==='"'||j==="'"||j==="`"){Y=j;continue}if(j==="{"||j==="["||j==="(")Z++;else if(j==="}"||j==="]"||j===")"){if(Z--,Z===0&&H<Q.length-1)return!1}}return Z===0}function i3(q){let Q=q;if(!Q.startsWith("/*"))Q=`/*${Q}`;if(!Q.endsWith("*/"))Q+="*/";return Q}function j9(q){let Q=q[0]?.tags??[],Z=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),Y,H=[],j,K,X,W=[],B=[];for(let U of Q)if(U.tag==="type")Y=U;else if(U.tag==="param")H.push(U);else if(U.tag==="returns"||U.tag==="return")j=U;else if(U.tag==="deprecated")X??=W7(U.name,U.description);else if(X7.has(U.tag))B.push(U);else if(U.tag==="bindable"){if(U.type)continue;let $=`${U.name}${U.description?` ${U.description}`:""}`.trim();if($==="readonly"||$==="writable")K??=$}else if(!Z.has(U.tag))W.push(U);return{type:Y,param:H,returns:j,binding:K,deprecated:X,additional:W,passthrough:B,description:q[0]?.description}}function p3(q){if(!q||q.length===0)return;let Q=q[q.length-1];return Q&&typeof Q==="object"&&"value"in Q?Q:void 0}function o3(q,Q,Z){if(!Q||Q.length===0||Z===void 0||!q.source)return;for(let Y=Q.length-1;Y>=0;Y--){let H=Q[Y];if(!H||typeof H!=="object"||!("value"in H)||!("end"in H))continue;if(typeof H.end!=="number")continue;let j=q.source.slice(H.end,Z);if(K9.test(j))return H}return}function a8(q,Q,Z){if(!Z?.leadingComments)return;let Y=o3(q,Z.leadingComments,Z.start);if(!Y)return;return s3(Q,[Y])}function z7(q,Q,Z){if(!Z?.leadingComments)return;return a8(q,Q,Z)}function s3(q,Q){if(!Q)return;let Z=p3(Q);if(!Z)return;let Y=P1(i3(Z.value)),{type:H,param:j,returns:K,binding:X,deprecated:W,additional:B,passthrough:U,description:$}=j9(Y),w,R,I,D;if(H)w=q.aliasType(H.type);if(j.length>0)R=j.filter((x)=>!x.name.includes(".")).map((x)=>({name:x.name,type:q.aliasType(x.type),description:J1(x.description),optional:x.optional||!1}));if(K)I=q.aliasType(K.type);let L=C8($?.trim());if(L||B.length>0){let x=[];if(L)x.push(L);for(let h of B){let n=`@${h.tag}${h.name?` ${h.name}`:""}${h.description?` ${h.description}`:""}`;x.push(n)}D=x.join(`
12
12
  `)}let b=U.length>0?U.map((x)=>({name:x.tag,body:x.raw})):void 0;return{type:w,params:R,returnType:I,description:D,binding:X,deprecated:W,tags:b}}function U7(q,Q,Z=q.source){if(!Z)return;for(let{tags:Y,description:H,lines:j}of P1(Z)){let K,X,W,B,U,$,w=[],R=[],I,D,L,b=[],x,h,n=[],g,t=!1,a=!0,J=[],V,z=new Map,O=new Set,F=new Set;for(let k of Y)if(k.lines.length>0)O.add(k.lines[0].number);for(let k of j)if(!k.tag&&k.content&&k.content.trim()!=="}")z.set(k.number,k.content);let M=(k)=>{if(!k||k.length===0)return;let y=k[0].number,u=[],l=[],s=!1;for(let _=y-1;_>=0;_--){if(O.has(_))break;let p=z.get(_);if(p)u.unshift(p),l.unshift(_),s=!0;else if(s){let c=j[_];if(!(!c||!c.tag&&(!c.content||c.content.trim()==="")))break}}if(u.length===0)return;for(let _ of l)F.add(_);return u.join(`
13
13
  `).trim()},A=()=>{if(K!==void 0){let k=X&&X!=="object"&&X!=="Object"?X:void 0,y;if(k)y=k;else if(R.length>0)y=H9(R,K,!0);else y=X||"";if($!==void 0){let u;for(let _ of Y){let p=_.lines[0]?.number;if(typeof p!=="number")continue;if(p<=$)continue;if(_.tag==="property"||_.tag==="type")continue;u=p;break}let l=[],s=Array.from(z.keys()).sort((_,p)=>_-p);for(let _ of s){if(_<=$)continue;if(u!==void 0&&_>=u)continue;if(F.has(_))continue;let c=z.get(_)?.trim();if(c)l.push(c),F.add(_)}if(l.length>0){let _=l.join(`
@@ -85,7 +85,7 @@ https://svelte.dev/e/void_element_invalid_content`)}var h0=Z8,s9=h0.extend(e2())
85
85
  ${z.join(`;
86
86
  `)};
87
87
  }`;return{...J,slot_props:O}}).sort((J,V)=>{let z=J.name??"",O=V.name??"";if(z<O)return-1;if(z>O)return 1;return 0});if(this.ctx.deferredSlotBlockGenerics.length>0){let J=[...D.map((V)=>V.type??""),...L.map((V)=>V.slot_props??"")].join(`
88
- `);for(let{name:V,constraint:z}of this.ctx.deferredSlotBlockGenerics){let O=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${O}\\b`).test(J))continue;this.accumulateGeneric(V,z)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)l8(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=Y7(this.ctx.scriptGenericsAttribute.value)}let b=U8.mapToArray(this.ctx.moduleExports),x=U8.mapToArray(this.ctx.events).map((J)=>{switch(J.type){case"forwarded":return{...J,element:J.element.name};case"dispatched":return J;default:return J}}).sort((J,V)=>{let z=J.name.localeCompare(V.name);if(z!==0)return z;let O=J.type.localeCompare(V.type);if(O!==0)return O;if(J.type==="forwarded"&&V.type==="forwarded"){let F=J.element.localeCompare(V.element);if(F!==0)return F}return(J.detail??"").localeCompare(V.detail??"")}),h=U8.mapToArray(this.ctx.typedefs),n=U8.mapToArray(this.ctx.contexts),g={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((J)=>J.location==="props").map((J)=>[J.propName,J])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((J)=>J.location==="moduleExports").map((J)=>[J.propName,J]))};for(let J of D)if(J.typeSource==="unknown"){let V=g.props.get(J.name);if(V)J.type="any";let z=V?V.importSource?`Prop "${J.name}" default calls "${V.calleeName}()" imported from "${V.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${J.name}" default calls "${V.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${J.name}" type could not be inferred; falling back to "${J.type??"any"}".`;l8(this.ctx,"prop-unknown-type",J.name,z,J.source)}for(let J of b)if(J.typeSource==="unknown"&&g.moduleExports.has(J.name))J.type="any";for(let J of this.ctx.jsDocEventNames){if(R.has(J))continue;if(this.ctx.forwardedEvents.has(J))continue;if(this.ctx.props.has(`on${J}`))continue;l8(this.ctx,"event-no-source",J,`@event "${J}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(J))}let t={source:Q0(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:D,moduleExports:b,slots:L,events:x,typedefs:h,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:n,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},a=Q7(this.ctx);if(a)t[e1]=a;return t}}var M4="sveld",w4="0.36.6";var M6="5.56.8";var C4=1,A4=new WeakMap;function o1(q,Q={}){let Z=A4.get(q),Y=Z?.get(Q.entryExports);if(Y)return Y;let H=Array.from(q,([,K])=>{let{diagnostics:X,...W}=K;return W}).sort((K,X)=>K.moduleName.localeCompare(X.moduleName)),j={schemaVersion:C4,generator:{name:M4,version:w4,svelteVersion:M6},total:H.length,components:H};if(Q.entryExports&&Q.entryExports.length>0)j.totalExports=Q.entryExports.length,j.exports=Q.entryExports;if(!Z)Z=new Map,A4.set(q,Z);return Z.set(Q.entryExports,j),j}var I4=/^[}\])>]/,cZ=new Set(["{","(","["]),dZ=new Set(["}",")","]"]);var iZ=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,S4=/[ \t]+$/,pZ=/\s+$/,oZ=/[{([]$/,sZ=/\s/;function nZ(q){return iZ.test(q.slice(-200))}var aZ=200;function rZ(q,Q){let Z="";for(let Y=q.length-1;Y>=0&&Z.length<Q;Y--)Z=q[Y]+Z;return Z.length>Q?Z.slice(-Q):Z}function L4(q,Q){while(q.length>0&&Q.test(q[q.length-1]))q.pop()}function tZ(q){let Q="",Z=null,Y=!1;for(let H=0;H<q.length;H++){let j=q[H],K=q[H-1];if(Z){if(Q+=j,Z==="double"&&j==='"'&&K!=="\\"||Z==="single"&&j==="'"&&K!=="\\"||Z==="template"&&j==="`"&&K!=="\\")Z=null;Y=!1;continue}if(j==='"'||j==="'"||j==="`"){Z=j==='"'?"double":j==="'"?"single":"template",Q+=j,Y=!1;continue}if(sZ.test(j)){if(!Y&&Q.length>0)Q+=" ",Y=!0;continue}Q+=j,Y=!1}return Q.trimEnd()}function eZ(q,Q){let Z=0,Y="normal";for(let H=Q;H<q.length;H++){let j=q[H],K=q[H-1];if(Y==="blockComment"){if(K==="*"&&j==="/")Y="normal";continue}if(Y==="double"||Y==="single"){if(j===(Y==="double"?'"':"'")&&K!=="\\")Y="normal";continue}if(Y==="template"){if(j==="`"&&K!=="\\")Y="normal";continue}if(j==="/"&&q[H+1]==="*")Y="blockComment";else if(j==='"')Y="double";else if(j==="'")Y="single";else if(j==="`")Y="template";else if(j==="{")Z++;else if(j==="}"){if(Z--,Z===0)return H}}return-1}function P4(q){let Q=[],Z="normal";for(let Y=0;Y<q.length;Y++){let H=q[Y],j=q[Y-1];if(Z==="blockComment"){if(Q.push(H),j==="*"&&H==="/")Z="normal";continue}if(Z==="double"||Z==="single"){if(Q.push(H),H===(Z==="double"?'"':"'")&&j!=="\\")Z="normal";continue}if(Z==="template"){if(Q.push(H),H==="`"&&j!=="\\")Z="normal";continue}if(H==="/"&&q[Y+1]==="*"){Z="blockComment",Q.push(H);continue}if(H==='"'){Z="double",Q.push(H);continue}if(H==="'"){Z="single",Q.push(H);continue}if(H==="`"){Z="template",Q.push(H);continue}if(H==="{"){let K=eZ(q,Y);if(K===-1){Q.push(H);continue}let X=q.slice(Y+1,K);if(X.trim()===""){Q.push("{}"),Y=K;continue}if(!X.includes("/*")&&q[Y+1]!==`
88
+ `);for(let{name:V,constraint:z}of this.ctx.deferredSlotBlockGenerics){let O=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(!new RegExp(`\\b${O}\\b`).test(J))continue;this.accumulateGeneric(V,z)}}if(this.ctx.scriptGenericsAttribute){if(this.ctx.generics)l8(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=Y7(this.ctx.scriptGenericsAttribute.value)}let b=U8.mapToArray(this.ctx.moduleExports),x=U8.mapToArray(this.ctx.events).map((J)=>{switch(J.type){case"forwarded":return{...J,element:J.element.name};case"dispatched":return J;default:return J}}).sort((J,V)=>{let z=J.name.localeCompare(V.name);if(z!==0)return z;let O=J.type.localeCompare(V.type);if(O!==0)return O;if(J.type==="forwarded"&&V.type==="forwarded"){let F=J.element.localeCompare(V.element);if(F!==0)return F}return(J.detail??"").localeCompare(V.detail??"")}),h=U8.mapToArray(this.ctx.typedefs),n=U8.mapToArray(this.ctx.contexts),g={props:new Map(this.ctx.pendingCallDefaultCandidates.filter((J)=>J.location==="props").map((J)=>[J.propName,J])),moduleExports:new Map(this.ctx.pendingCallDefaultCandidates.filter((J)=>J.location==="moduleExports").map((J)=>[J.propName,J]))};for(let J of D)if(J.typeSource==="unknown"){let V=g.props.get(J.name);if(V)J.type="any";let z=V?V.importSource?`Prop "${J.name}" default calls "${V.calleeName}()" imported from "${V.importSource}"; falling back to "any" pending cross-file resolution.`:`Prop "${J.name}" default calls "${V.calleeName}()", but its return type could not be inferred; falling back to "any".`:`Prop "${J.name}" type could not be inferred; falling back to "${J.type??"any"}".`;l8(this.ctx,"prop-unknown-type",J.name,z,J.source)}for(let J of b)if(J.typeSource==="unknown"&&g.moduleExports.has(J.name))J.type="any";for(let J of this.ctx.jsDocEventNames){if(R.has(J))continue;if(this.ctx.forwardedEvents.has(J))continue;if(this.ctx.props.has(`on${J}`))continue;l8(this.ctx,"event-no-source",J,`@event "${J}" has no matching dispatch or callback prop.`,this.ctx.jsDocEventSources.get(J))}let t={source:Q0(this.ctx,0,this.ctx.source?.length),syntaxMode:this.ctx.syntaxMode,...this.ctx.scriptLanguage?{scriptLanguage:this.ctx.scriptLanguage}:{},props:D,moduleExports:b,slots:L,events:x,typedefs:h,generics:this.ctx.generics,rest_props:this.ctx.rest_props,extends:this.ctx.extends,componentComment:this.ctx.componentComment,componentCommentSource:this.ctx.componentCommentSource,contexts:n,customElementTag:this.ctx.customElementTag,diagnostics:this.ctx.diagnosticRecords.slice()},a=Q7(this.ctx);if(a)t[e1]=a;return t}}var M4="sveld",w4="0.36.7";var M6="5.56.8";var C4=1,A4=new WeakMap;function o1(q,Q={}){let Z=A4.get(q),Y=Z?.get(Q.entryExports);if(Y)return Y;let H=Array.from(q,([,K])=>{let{diagnostics:X,...W}=K;return W}).sort((K,X)=>K.moduleName.localeCompare(X.moduleName)),j={schemaVersion:C4,generator:{name:M4,version:w4,svelteVersion:M6},total:H.length,components:H};if(Q.entryExports&&Q.entryExports.length>0)j.totalExports=Q.entryExports.length,j.exports=Q.entryExports;if(!Z)Z=new Map,A4.set(q,Z);return Z.set(Q.entryExports,j),j}var I4=/^[}\])>]/,cZ=new Set(["{","(","["]),dZ=new Set(["}",")","]"]);var iZ=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,S4=/[ \t]+$/,pZ=/\s+$/,oZ=/[{([]$/,sZ=/\s/;function nZ(q){return iZ.test(q.slice(-200))}var aZ=200;function rZ(q,Q){let Z="";for(let Y=q.length-1;Y>=0&&Z.length<Q;Y--)Z=q[Y]+Z;return Z.length>Q?Z.slice(-Q):Z}function L4(q,Q){while(q.length>0&&Q.test(q[q.length-1]))q.pop()}function tZ(q){let Q="",Z=null,Y=!1;for(let H=0;H<q.length;H++){let j=q[H],K=q[H-1];if(Z){if(Q+=j,Z==="double"&&j==='"'&&K!=="\\"||Z==="single"&&j==="'"&&K!=="\\"||Z==="template"&&j==="`"&&K!=="\\")Z=null;Y=!1;continue}if(j==='"'||j==="'"||j==="`"){Z=j==='"'?"double":j==="'"?"single":"template",Q+=j,Y=!1;continue}if(sZ.test(j)){if(!Y&&Q.length>0)Q+=" ",Y=!0;continue}Q+=j,Y=!1}return Q.trimEnd()}function eZ(q,Q){let Z=0,Y="normal";for(let H=Q;H<q.length;H++){let j=q[H],K=q[H-1];if(Y==="blockComment"){if(K==="*"&&j==="/")Y="normal";continue}if(Y==="double"||Y==="single"){if(j===(Y==="double"?'"':"'")&&K!=="\\")Y="normal";continue}if(Y==="template"){if(j==="`"&&K!=="\\")Y="normal";continue}if(j==="/"&&q[H+1]==="*")Y="blockComment";else if(j==='"')Y="double";else if(j==="'")Y="single";else if(j==="`")Y="template";else if(j==="{")Z++;else if(j==="}"){if(Z--,Z===0)return H}}return-1}function P4(q){let Q=[],Z="normal";for(let Y=0;Y<q.length;Y++){let H=q[Y],j=q[Y-1];if(Z==="blockComment"){if(Q.push(H),j==="*"&&H==="/")Z="normal";continue}if(Z==="double"||Z==="single"){if(Q.push(H),H===(Z==="double"?'"':"'")&&j!=="\\")Z="normal";continue}if(Z==="template"){if(Q.push(H),H==="`"&&j!=="\\")Z="normal";continue}if(H==="/"&&q[Y+1]==="*"){Z="blockComment",Q.push(H);continue}if(H==='"'){Z="double",Q.push(H);continue}if(H==="'"){Z="single",Q.push(H);continue}if(H==="`"){Z="template",Q.push(H);continue}if(H==="{"){let K=eZ(q,Y);if(K===-1){Q.push(H);continue}let X=q.slice(Y+1,K);if(X.trim()===""){Q.push("{}"),Y=K;continue}if(!X.includes("/*")&&q[Y+1]!==`
89
89
  `&&!nZ(rZ(Q,aZ))){let W=P4(X).trim();if(!W.includes(`
90
90
  `)){let B=W.endsWith(";")?W.slice(0,-1):W,U=`{ ${tZ(B)} }`;if(U.length<=120){Q.push(U),Y=K;continue}}}if(Q.push(H),q[Y+1]!==`
91
91
  `)Q.push(`
@@ -7,7 +7,7 @@ function b(w){return typeof w==="object"&&w!==null}function Bq(w){return b(w)&&w
7
7
  }`:`{ ${Z} }`}var vw=/[A-Za-z_$][\w$]*/g;function Ew(w,q){if(!q)return!1;let K=new Set(q[0].split(",").map((Z)=>Z.trim()));for(let[Z]of w.matchAll(vw))if(K.has(Z))return!0;return!1}function fw(w,q){if(q===void 0)return;return w.runesPropsDeclarationMetadataByDeclaratorStart.get(q)}function _q(w,q,K){return fw(w,q)?.props.get(K)}function Lq(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"right"in w&&w.right&&typeof w.right==="object"&&"name"in w.right&&typeof w.right.name==="string")return w.right.name;return}function Ww(w){if(!w||typeof w!=="object"||!("type"in w))return;if(w.type==="Identifier"&&"name"in w&&typeof w.name==="string")return w.name;if(w.type==="TSQualifiedName"&&"left"in w&&w.left&&typeof w.left==="object")return Ww(w.left);return}function vq(w,q){let K=q?.start,Z=q?.end;if(K===void 0||Z===void 0)return;return x(w,K+1,Z)?.trim()}function Eq(w,q){let K=q?.start,Z=q?.end;if(K===void 0||Z===void 0)return;return x(w,K,Z)?.trim()}function D(w,q,K,Z,Q=new Set){if(!q?.type)return;switch(q.type){case"TSInterfaceDeclaration":D(w,{type:"TSTypeLiteral",members:q.body?.body},K,Z,Q);return;case"TSTypeAliasDeclaration":case"TSParenthesizedType":case"TSTypeAnnotation":D(w,q.typeAnnotation,K,Z,Q);return;case"TSIntersectionType":case"TSUnionType":for(let $ of q.types??[])D(w,$,K,Z,Q);return;case"TSTypeLiteral":for(let $ of q.members??[]){if($?.type!=="TSPropertySignature")continue;D(w,$.typeAnnotation?.typeAnnotation,K,Z,Q)}return;case"TSTypeReference":{let $=Ww(q.typeName);if($){if(w.typeImportBindingsByLocalName.has($))K.add($);let J=w.localTypeDeclarationsByName.get($);if(J&&!Q.has($))Z.add($),Q.add($),D(w,J.node,K,Z,Q),Q.delete($)}if("typeParameters"in q&&q.typeParameters&&typeof q.typeParameters==="object"){let J=q.typeParameters;for(let z of J.params??[])D(w,z,K,Z,Q)}return}case"TSArrayType":case"TSRestType":case"TSOptionalType":case"TSIndexedAccessType":case"TSTypeOperator":case"TSExpressionWithTypeArguments":case"TSTupleType":case"TSConditionalType":case"TSInferType":case"TSMappedType":case"TSFunctionType":case"TSConstructorType":case"TSTypeQuery":case"TSImportType":case"TSLiteralType":case"TSTypePredicate":case"TSNamedTupleMember":break;default:break}for(let $ of Object.values(q)){if(!$||typeof $!=="object")continue;if(Array.isArray($)){for(let J of $){if(!J||typeof J!=="object"||!("type"in J))continue;D(w,J,K,Z,Q)}continue}if("type"in $)D(w,$,K,Z,Q)}}function Nw(w,q){let K=new Map;for(let Z of Array.from(q).sort()){let Q=w.typeImportBindingsByLocalName.get(Z);if(!Q)continue;let $=K.get(Q.source)??{default:[],named:[],namespace:[]};if(Q.specifierType==="default")$.default.push(Q.localName);else if(Q.specifierType==="namespace")$.namespace.push(Q.localName);else $.named.push({imported:Q.importedName,local:Q.localName});K.set(Q.source,$)}return Array.from(K.entries()).sort(([Z],[Q])=>Z.localeCompare(Q)).map(([Z,Q])=>{if(Q.namespace.length>0)return Q.namespace.map((H)=>`import type * as ${H} from "${Z}";`).join(`
8
8
  `);let $=Q.named.map(({imported:H,local:j})=>{if(!H||H===j)return j;return`${H} as ${j}`}),J=Q.default[0],z=$.length>0?`{ ${$.join(", ")} }`:"";if(J&&z)return`import type ${J}, ${z} from "${Z}";`;if(J)return`import type ${J} from "${Z}";`;return`import type ${z} from "${Z}";`})}function fq(w){let q=w.pendingCallDefaultCandidates.length>0?w.pendingCallDefaultCandidates.slice():void 0;if(w.typedRunesPropsDeclarations.length!==1)return q?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:q}:void 0;let[K]=w.typedRunesPropsDeclarations;if(!K.canonicalType)return q?{canonicalPropNames:[],localTypeDeclarations:[],typeImportStatements:[],pendingCallDefaultCandidates:q}:void 0;let Z=Array.from(K.referencedLocalTypes).map((Q)=>w.localTypeDeclarationsByName.get(Q)).filter((Q)=>Q!==void 0).sort((Q,$)=>Q.start-$.start).map((Q)=>Q.code);return{canonicalPropsType:K.canonicalType,canonicalPropNames:Array.from(K.props.keys()).sort(),localTypeDeclarations:Z,typeImportStatements:Nw(w,K.referencedImportedTypes),referencesComponentGenerics:Ew(K.canonicalType,w.generics),...q?{pendingCallDefaultCandidates:q}:{}}}var Tw=/^[A-Za-z_$][\w$]*/,xw=/[A-Za-z_$][\w$]*/g,Bw=/^(?:const|in|out)\s+/;function ww(w){let q=[],K=0,Z=0;for(let Q=0;Q<w.length;Q++){let $=w[Q];if($==="<"||$==="("||$==="["||$==="{")K++;else if($===">"||$===")"||$==="]"||$==="}")K=Math.max(K-1,0);else if($===","&&K===0)q.push(w.slice(Z,Q)),Z=Q+1}return q.push(w.slice(Z)),q}function xq(w){let q=ww(w).map((Z)=>Z.trim()).filter((Z)=>Z.length>0);if(q.length===0)return null;return[q.map((Z)=>{let Q=Z;while(Bw.test(Q))Q=Q.replace(Bw,"");return Q.match(Tw)?.[0]??Z}).join(", "),q.join(", ")]}function yq(w,q,K){let Z=w.scriptGenericsAttribute?.value;if(!Z)return;for(let[Q]of Z.matchAll(xw)){if(w.typeImportBindingsByLocalName.has(Q))q.add(Q);if(K.has(Q))continue;let $=w.localTypeDeclarationsByName.get(Q);if(!$)continue;K.add(Q),D(w,$.node,q,K)}}var yw=null;function uw(w,q,K){let Z={value:void 0,replace:!1};if(!K||typeof K!=="object"||!("type"in K))return Z;if(K.type==="Identifier")Z.value=K.name,Z.replace=!0;else if(K.type==="Literal")Z.value=String(K.value);else if(K.type==="MemberExpression")Z.value=Yw(w,q,K);else if((K.type==="ObjectExpression"||K.type==="TemplateLiteral")&&"start"in K&&"end"in K&&typeof K.start==="number"&&typeof K.end==="number")Z.value=x(w,K.start,K.end);return Z}function dq(w,q,K){let Z={};for(let Q of K.properties){if(Q.type!=="Property"||Q.computed)continue;let $=q.getPropertyName(Q.key);if(!$)continue;Z[$]=uw(w,q,Q.value)}return Z}function gw(w,q){if(!q||typeof q!=="object"||!("type"in q))return null;if(q.type==="Identifier"){let $=q,J=w.propLocalToPublicName.get($.name);if(!J)return null;return{publicName:J,trackingName:$.name}}if(q.type!=="MemberExpression")return null;let K=q,Z=K.object&&typeof K.object==="object"&&"type"in K.object&&K.object.type==="Identifier"?K.object.name:void 0;if(!Z||!w.wholePropsLocals.has(Z))return null;let Q;if(!K.computed&&K.property&&typeof K.property==="object"&&"type"in K.property){if(K.property.type==="Identifier")Q=K.property.name;else if(K.property.type==="Literal"&&K.property.value!=null)Q=String(K.property.value)}else if(K.computed&&K.property&&typeof K.property==="object"&&"type"in K.property&&K.property.type==="Literal"&&"value"in K.property&&K.property.value!=null)Q=String(K.property.value);if(!Q)return null;return{publicName:Q,trackingName:Q}}function pq(w,q){let K=q;if(K&&typeof K==="object"&&"type"in K&&K.type==="ChainExpression")K=K.expression;if(!K||typeof K!=="object"||!("type"in K)||K.type!=="CallExpression")return null;let Z=K;if(!Z.callee||typeof Z.callee!=="object"||!("type"in Z.callee))return null;let Q=gw(w,Z.callee);if(!Q)return null;return{...Q,arguments:Z.arguments}}function Mw(w,{slot_name:q,slot_props:K,slot_fallback:Z,slot_description:Q,slot_deprecated:$,slot_tags:J,source:z}){let H=q===void 0||q==="",j=H?yw:q??"",Y=v(Z),U=K===void 0||K===""?void 0:K,S=Q?.trim()||void 0;if(w.slots.has(j)){let V=w.slots.get(j);if(V)w.slots.set(j,{...V,default:V.default??H,fallback:Y,slot_props:V.slot_props===void 0?U:V.slot_props,description:V.description||S,deprecated:V.deprecated??$,tags:V.tags||J,source:z||V.source})}else w.slots.set(j,{name:j,default:H,fallback:Y,slot_props:K,description:S,deprecated:$,tags:J,source:z})}var lw=/\n/,mw=/\r$/,y=/^\s+/,dw=/\s/,pw=/^@[^\s/]+(?=\s|$)/,cw=/^@(\S+)\s*/;function iw(w){let q=[],K=0;for(let Z of w.split(lw))q.push({text:Z.replace(mw,""),start:K}),K+=Z.length+1;return q}function ow(w,q){let K=w.replace(y,""),Z=!1;if(q)K=K.slice(3),Z=!0;else if(K.startsWith("*")&&!K.startsWith("*/"))K=K.slice(1),Z=!0;let Q=K.match(y)?.[0]??"";K=K.slice(Q.length);let $=K.trimEnd(),J=$.endsWith("*/")?$.slice(0,-2):K;return{indent:Z?Q.slice(1):Q,separator:Q,content:J}}function sw(w){let q=[],K=iw(w),Z=null,Q=0;for(let $ of K){if(Z===null){let j=$.text.replace(y,"");if(!j.startsWith("/**")||j.startsWith("/***"))continue;Z=[],Q=$.start+($.text.length-j.length)}let{indent:J,separator:z,content:H}=ow($.text,Z.length===0);if(Z.push({raw:$.text,start:$.start,number:Z.length,indent:J,separator:z,content:H}),$.text.trimEnd().endsWith("*/"))q.push({start:Q,lines:Z}),Z=null}return q}function aw(w){let q=w;if(q.length>0&&q[0].content==="")q=q.slice(1);if(q.length>0&&q[q.length-1].content==="")q=q.slice(0,-1);return q}function rw(w){let q=[[]],K=!1;for(let Z of w){if(pw.test(Z.content)&&!K)q.push([Z]);else q[q.length-1].push(Z);if(Z.content.split("```").length%2===0)K=!K}return q}function Uw(w){return w.map((q)=>q.indent+q.content).join(`
9
9
  `)}function nw(w,q){let K=q;while(K<w.length-1&&w[K].content.trim()==="")K++;if(w[K].content[0]!=="{")return null;let Z=0,Q=[],$=K;for(;$<w.length;$++){let H=w[$].content,j=0;for(let Y of H){if(Y==="{")Z++;else if(Y==="}")Z--;if(j++,Z===0)break}if(Q.push(j),Z===0)break}if(Z!==0)return null;let J=$;return{type:Q.map((H,j)=>{let Y=K+j,U=w[Y].content.slice(0,H);return w[Y].content=w[Y].content.slice(H).replace(y,""),j===0?U:w[Y].indent+U}).join(`
10
- `).slice(1,-1),endIndex:J}}function tw(w){let q=w.content.match(y)?.[0]??"",K=w.content.slice(q.length),Z=0,Q=0;for(let j of K){if(Z===0&&dw.test(j))break;if(j==="[")Z++;if(j==="]")Z--;Q++}let $=Z===0?K.slice(0,Q):"";if(!$)return null;let J=$,z=!1,H;if($.startsWith("[")&&$.endsWith("]")){z=!0;let Y=$.slice(1,-1).split("=");if(J=Y[0].trim(),Y.length>1)H=Y.slice(1).join("=").trim();if(!J)return null}return w.content=K.slice(Q).replace(y,""),{name:J,optional:z,default:H}}function ew(w){let q=w[0],K=q.content.match(cw),Z=K?K[1]:"",Q=K?q.content.slice(K[0].length):q.content,$=Q.trimEnd(),J=w.slice(1).map((V)=>V.separator+V.content),z=($?[$,...J]:J).join(`
10
+ `).slice(1,-1),endIndex:J}}function tw(w){let q=w.content.match(y)?.[0]??"",K=w.content.slice(q.length),Z=0,Q=0;for(let j of K){if(Z===0&&dw.test(j))break;if(j==="[")Z++;if(j==="]")Z--;Q++}let $=Z===0?K.slice(0,Q):"";if(!$)return null;let J=$,z=!1,H;if($.startsWith("[")&&$.endsWith("]")){z=!0;let Y=$.slice(1,-1).split("=");if(J=Y[0].trim(),Y.length>1)H=Y.slice(1).join("=").trim();if(!J)return null}if(J.length>1&&(J[0]==='"'||J[0]==="'")&&J[J.length-1]===J[0])J=J.slice(1,-1);return w.content=K.slice(Q).replace(y,""),{name:J,optional:z,default:H}}function ew(w){let q=w[0],K=q.content.match(cw),Z=K?K[1]:"",Q=K?q.content.slice(K[0].length):q.content,$=Q.trimEnd(),J=w.slice(1).map((V)=>V.separator+V.content),z=($?[$,...J]:J).join(`
11
11
  `);q.content=Q,q.tag=Z;let H=nw(w,0),j=H?.type??"",Y=0;if(H){Y=H.endIndex;while(Y<w.length-1&&w[Y].content.trim()==="")Y++}let U=tw(w[Y]),S=Uw(w.slice(H?H.endIndex:0));return{tag:Z,name:U?.name??"",type:j,optional:U?.optional??!1,default:U?.default,description:S,raw:z,lines:w}}function wq(w,q){let K=aw(w);K.forEach(($,J)=>{$.number=J});let Z=rw(K),Q=Z.slice(1).map(ew);return{description:Uw(Z[0]),tags:Q,start:q,lines:K}}function p(w){return sw(w).map(({start:q,lines:K})=>wq(K,q))}var qq=/\s*=\s*/;function Ow(w){let q=w.indexOf("<");if(q===-1||!w.endsWith(">"))return w;let K=w.slice(0,q),Z=w.slice(q+1,-1),Q=ww(Z).map(($)=>$.trim().replace(qq," = ")).join(", ");return`${K}<${Q}>`}var Kq=/^\s*$/,Zq=/;$/,Qq=/^-\s*/;function f(w){if(w===void 0)return;let q=w.replace(Qq,"").trim();return q===""?"":q}function m(w){if(!w||w.length===0)return;return w[0].content}var Xw=new Set(["since","example"]);function $q(w){let q=w.trim();return q===""?!0:q}function Vw(w,q){return $q(`${w??""}${q?` ${q}`:""}`)}function Jq(w){let q=w.trim().replace(Zq,"").trimEnd();if(!q.startsWith("{")||!q.endsWith("}"))return!1;let K=0,Z=null;for(let Q=0;Q<q.length;Q++){let $=q[Q];if(Z!==null){if($==="\\"){Q++;continue}if($===Z)Z=null;continue}if($==='"'||$==="'"||$==="`"){Z=$;continue}if($==="{"||$==="["||$==="(")K++;else if($==="}"||$==="]"||$===")"){if(K--,K===0&&Q<q.length-1)return!1}}return K===0}function kw(w){let q=w;if(!q.startsWith("/*"))q=`/*${q}`;if(!q.endsWith("*/"))q+="*/";return q}function Yq(w){if(w==="*")return"any";return w.trim()}function eq(w){let q=p(kw(w)),{returns:K}=Aw(q);return K?Yq(K.type):void 0}function Aw(w){let q=w[0]?.tags??[],K=new Set(["type","param","returns","return","extends","extendProps","restProps","slot","snippet","event","typedef","callback","bindable","deprecated"]),Z,Q=[],$,J,z,H=[],j=[];for(let Y of q)if(Y.tag==="type")Z=Y;else if(Y.tag==="param")Q.push(Y);else if(Y.tag==="returns"||Y.tag==="return")$=Y;else if(Y.tag==="deprecated")z??=Vw(Y.name,Y.description);else if(Xw.has(Y.tag))j.push(Y);else if(Y.tag==="bindable"){if(Y.type)continue;let U=`${Y.name}${Y.description?` ${Y.description}`:""}`.trim();if(U==="readonly"||U==="writable")J??=U}else if(!K.has(Y.tag))H.push(Y);return{type:Z,param:Q,returns:$,binding:J,deprecated:z,additional:H,passthrough:j,description:w[0]?.description}}function zq(w){if(!w||w.length===0)return;let q=w[w.length-1];return q&&typeof q==="object"&&"value"in q?q:void 0}function Hq(w,q,K){if(!q||q.length===0||K===void 0||!w.source)return;for(let Z=q.length-1;Z>=0;Z--){let Q=q[Z];if(!Q||typeof Q!=="object"||!("value"in Q)||!("end"in Q))continue;if(typeof Q.end!=="number")continue;let $=w.source.slice(Q.end,K);if(Kq.test($))return Q}return}function jq(w,q,K){if(!K?.leadingComments)return;let Z=Hq(w,K.leadingComments,K.start);if(!Z)return;return Wq(q,[Z])}function wK(w,q,K){if(!K?.leadingComments)return;return jq(w,q,K)}function Wq(w,q){if(!q)return;let K=zq(q);if(!K)return;let Z=p(kw(K.value)),{type:Q,param:$,returns:J,binding:z,deprecated:H,additional:j,passthrough:Y,description:U}=Aw(Z),S,V,F,E;if(Q)S=w.aliasType(Q.type);if($.length>0)V=$.filter((O)=>!O.name.includes(".")).map((O)=>({name:O.name,type:w.aliasType(O.type),description:f(O.description),optional:O.optional||!1}));if(J)F=w.aliasType(J.type);let _=v(U?.trim());if(_||j.length>0){let O=[];if(_)O.push(_);for(let I of j){let u=`@${I.tag}${I.name?` ${I.name}`:""}${I.description?` ${I.description}`:""}`;O.push(u)}E=O.join(`
12
12
  `)}let N=Y.length>0?Y.map((O)=>({name:O.tag,body:O.raw})):void 0;return{type:S,params:V,returnType:F,description:E,binding:z,deprecated:H,tags:N}}function qK(w,q,K=w.source){if(!K)return;for(let{tags:Z,description:Q,lines:$}of p(K)){let J,z,H,j,Y,U,S=[],V=[],F,E,_,N=[],O,I,u=[],c,h=!1,X=!0,g=[],i,d=new Map,qw=new Set,o=new Set;for(let W of Z)if(W.lines.length>0)qw.add(W.lines[0].number);for(let W of $)if(!W.tag&&W.content&&W.content.trim()!=="}")d.set(W.number,W.content);let Gw=(W)=>{if(!W||W.length===0)return;let G=W[0].number,M=[],P=[],L=!1;for(let B=G-1;B>=0;B--){if(qw.has(B))break;let R=d.get(B);if(R)M.unshift(R),P.unshift(B),L=!0;else if(L){let k=$[B];if(!(!k||!k.tag&&(!k.content||k.content.trim()==="")))break}}if(M.length===0)return;for(let B of P)o.add(B);return M.join(`
13
13
  `).trim()},Kw=()=>{if(J!==void 0){let W=z&&z!=="object"&&z!=="Object"?z:void 0,G;if(W)G=W;else if(V.length>0)G=e(V,J,!0);else G=z||"";if(U!==void 0){let M;for(let B of Z){let R=B.lines[0]?.number;if(typeof R!=="number")continue;if(R<=U)continue;if(B.tag==="property"||B.tag==="type")continue;M=R;break}let P=[],L=Array.from(d.keys()).sort((B,R)=>B-R);for(let B of L){if(B<=U)continue;if(M!==void 0&&B>=M)continue;if(o.has(B))continue;let k=d.get(B)?.trim();if(k)P.push(k),o.add(B)}if(P.length>0){let B=P.join(`
@@ -1 +1 @@
1
- import{t as d}from"./chunk-t6s3aa0t.js";import{D as a,E as b,F as c}from"./chunk-ck4qbyqp.js";import"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-0q7qnmx3.js";export{b as getParsedComponentTypeScriptMetadata,d as default,c as applyResolvedProps,a as PARSED_COMPONENT_TYPE_SCRIPT_METADATA};
1
+ import{t as d}from"./chunk-wn9w3zst.js";import{D as a,E as b,F as c}from"./chunk-4ndm4k55.js";import"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-0q7qnmx3.js";export{b as getParsedComponentTypeScriptMetadata,d as default,c as applyResolvedProps,a as PARSED_COMPONENT_TYPE_SCRIPT_METADATA};
@@ -1,7 +1,7 @@
1
- import{D as p0,E as H0,F as B1,X as h1,da as J1,u as i,x as z1}from"./chunk-ck4qbyqp.js";import{na as W1}from"./chunk-tjthqdyw.js";import{pa as f,qa as S,ra as x0,sa as u}from"./chunk-jvqe4bt1.js";import{wa as t0}from"./chunk-0q7qnmx3.js";var _j="sveld",O0="0.36.6";var Fj={name:_j,version:O0,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./lib/index.js",types:"./lib/index.d.ts",exports:{".":{types:"./lib/index.d.ts",import:"./lib/index.js",default:"./lib/index.js"},"./browser":{types:"./lib/browser.d.ts",import:"./lib/browser.js",default:"./lib/browser.js"}},scripts:{test:"bun test --parallel","test:fixtures-types":"tsc --project tsconfig.fixtures.json","test:e2e":"bun tests/test-e2e.ts",format:"biome format --write .",lint:"biome lint .","lint:fix":"biome check --write --unsafe .",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:mitata":"bun scripts/bench-mitata.ts",typecheck:"tsc --noEmit"},devDependencies:{"@biomejs/biome":"2.5.8","@types/bun":"^1.3.14","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",acorn:"^8.18.0",culls:"^0.2.0","estree-walker":"^3.0.3",mitata:"^1.0.34",svelte:"^5.56.8",typescript:"^7.0.2"},bin:{sveld:"cli.js"},files:["lib","cli.js"],repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var j0="5.56.8";var B0=1,Nj=new WeakMap;function C(j,$={}){let Z=Nj.get(j),Q=Z?.get($.entryExports);if(Q)return Q;let Y=Array.from(j,([,z])=>{let{diagnostics:J,...U}=z;return U}).sort((z,J)=>z.moduleName.localeCompare(J.moduleName)),K={schemaVersion:B0,generator:{name:_j,version:O0,svelteVersion:j0},total:Y.length,components:Y};if($.entryExports&&$.entryExports.length>0)K.totalExports=$.entryExports.length,K.exports=$.entryExports;if(!Z)Z=new Map,Nj.set(j,Z);return Z.set($.entryExports,K),K}import{readFile as W2}from"node:fs/promises";import X2 from"node:path";var xj={none:0,patch:1,minor:2,major:3};function k2(j,$){return xj[$]>xj[j]?$:j}function O2(j){return j.reduce(($,Z)=>k2($,Z.bump),"none")}function yj(j){let $=[],Z=0,Q="",Y=null;for(let K=0;K<j.length;K++){let z=j[K];if(Y){if(Q+=z,z==="\\")K++,Q+=j[K]??"";else if(z===Y)Y=null;continue}if(z==='"'||z==="'"||z==="`"){Y=z,Q+=z;continue}if(z==="<"||z==="("||z==="{"||z==="[")Z++;if(z===">"||z===")"||z==="}"||z==="]")Z--;if(z==="|"&&Z===0){$.push(Q.trim()),Q="";continue}Q+=z}return $.push(Q.trim()),new Set($.filter((K)=>K.length>0))}function d0(j,$){if(j===$)return"none";if(j===void 0||$===void 0)return"major";let Z=yj(j),Q=yj($),Y=[...Q].some((z)=>!Z.has(z)),K=[...Z].some((z)=>!Q.has(z));if(!Y&&!K)return"none";if(Y&&!K)return"minor";if(K&&!Y)return"major";return"major"}function gj(j,$,Z,Q){let Y=$==="prop"?"prop":"export",K=[],z=new Map(Z.map((U)=>[U.name,U])),J=new Map(Q.map((U)=>[U.name,U]));for(let[U,H]of J){if(z.has(U))continue;K.push({component:j,kind:$,name:U,bump:H.isRequired?"major":"minor",message:`${Y} "${U}" added${H.isRequired?" (required)":""}`})}for(let[U]of z){if(J.has(U))continue;K.push({component:j,kind:$,name:U,bump:"major",message:`${Y} "${U}" removed`})}for(let[U,H]of z){let V=J.get(U);if(!V)continue;if(H.isRequired!==V.isRequired)K.push({component:j,kind:$,name:U,bump:V.isRequired?"major":"minor",message:`${Y} "${U}" became ${V.isRequired?"required":"optional"}`});let q=d0(H.type,V.type);if(q!=="none")K.push({component:j,kind:$,name:U,bump:q,message:`${Y} "${U}" type changed from \`${H.type??"unknown"}\` to \`${V.type??"unknown"}\``})}return K}function B2(j,$,Z){let Q=[],Y=new Map($.map((z)=>[z.name,z])),K=new Map(Z.map((z)=>[z.name,z]));for(let[z]of K){if(Y.has(z))continue;Q.push({component:j,kind:"event",name:z,bump:"minor",message:`event "${z}" added`})}for(let[z]of Y){if(K.has(z))continue;Q.push({component:j,kind:"event",name:z,bump:"major",message:`event "${z}" removed`})}for(let[z,J]of Y){let U=K.get(z);if(!U)continue;if(J.type!==U.type){Q.push({component:j,kind:"event",name:z,bump:"major",message:`event "${z}" changed from ${J.type} to ${U.type}`});continue}let H=J.type==="dispatched"?J.detail:void 0,V=U.type==="dispatched"?U.detail:void 0,q=d0(H,V);if(q!=="none")Q.push({component:j,kind:"event",name:z,bump:q,message:`event "${z}" detail changed from \`${H??"unknown"}\` to \`${V??"unknown"}\``})}return Q}function Cj(j){return j.name??"default"}function L2(j,$,Z){let Q=[],Y=new Map($.map((z)=>[Cj(z),z])),K=new Map(Z.map((z)=>[Cj(z),z]));for(let[z]of K){if(Y.has(z))continue;Q.push({component:j,kind:"slot",name:z,bump:"minor",message:`slot "${z}" added`})}for(let[z]of Y){if(K.has(z))continue;Q.push({component:j,kind:"slot",name:z,bump:"major",message:`slot "${z}" removed`})}for(let[z,J]of Y){let U=K.get(z);if(!U)continue;let H=d0(J.slot_props,U.slot_props);if(H!=="none")Q.push({component:j,kind:"slot",name:z,bump:H,message:`slot "${z}" props changed from \`${J.slot_props??"none"}\` to \`${U.slot_props??"none"}\``})}return Q}var I2=new Set(["description","source","componentCommentSource","tags"]);function L0(j){if(Array.isArray(j))return j.map(L0);if(j!==null&&typeof j==="object"){let $={};for(let[Z,Q]of Object.entries(j)){if(I2.has(Z))continue;$[Z]=L0(Q)}return $}return j}var R2=["generics","rest_props","extends","contexts","typedefs"];function M2(j,$,Z){let Q=[];for(let Y of R2){let K=JSON.stringify(L0($[Y])),z=JSON.stringify(L0(Z[Y]));if(K!==z)Q.push({component:j,kind:"shape",name:Y,bump:"major",message:`"${Y}" changed (breaking)`})}return Q}function b2(j,$){let Z=$.moduleName;return[...gj(Z,"prop",j.props,$.props),...gj(Z,"moduleExport",j.moduleExports,$.moduleExports),...B2(Z,j.events,$.events),...L2(Z,j.slots,$.slots),...M2(Z,j,$)]}function D2(j,$){let Z=[],Q=new Map(j.components.map((K)=>[K.moduleName,K])),Y=new Map($.components.map((K)=>[K.moduleName,K]));for(let[K]of Y){if(Q.has(K))continue;Z.push({component:K,kind:"component",bump:"minor",message:`component "${K}" added`})}for(let[K]of Q){if(Y.has(K))continue;Z.push({component:K,kind:"component",bump:"major",message:`component "${K}" removed`})}for(let[K,z]of Q){let J=Y.get(K);if(!J)continue;Z.push(...b2(z,J))}return Z}async function A2(j){let $;try{$=await W2(X2.resolve(j),"utf-8")}catch(Z){if(Z.code==="ENOENT")return null;throw Z}try{return JSON.parse($)}catch{throw Error(`sveld: could not parse "${j}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Ej(j){if(typeof j.check==="string")return j.check;return j.jsonOptions?.outFile??"COMPONENT_API.json"}async function Pj(j,$,Z={}){let Q=await A2($);if(Q===null)return{snapshotExists:!1,snapshotFile:$,changes:[],bump:"none"};if(Q.schemaVersion!==B0)return{snapshotExists:!0,snapshotFile:$,changes:[{component:"*",kind:"shape",bump:"none",message:`snapshot schemaVersion ${Q.schemaVersion} does not match the current schemaVersion ${B0}; skipping diff`}],bump:"none"};let Y=C(j,{entryExports:Z.entryExports}),K=D2(Q,Y);return{snapshotExists:!0,snapshotFile:$,changes:K,bump:O2(K)}}var T2={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function vj(j){if(!j.snapshotExists)return`sveld --check: no snapshot found at "${j.snapshotFile}". Run \`sveld --json\` and commit the output first.`;if(j.changes.length===0)return`sveld --check: no API changes detected against "${j.snapshotFile}".`;let $=[],Z=j.changes.length;$.push(`sveld --check: ${Z} API change${Z===1?"":"s"} detected against "${j.snapshotFile}".`),$.push(`Suggested semver bump: ${j.bump}.`);let Q=new Map;for(let Y of j.changes){let K=Q.get(Y.component)??[];K.push(Y),Q.set(Y.component,K)}for(let[Y,K]of Q){$.push(""),$.push(` ${Y}`);for(let z of K)$.push(` [${T2[z.bump]}] ${z.message}`)}return $.join(`
1
+ import{D as p0,E as H0,F as B1,X as h1,da as J1,u as i,x as z1}from"./chunk-4ndm4k55.js";import{na as W1}from"./chunk-tjthqdyw.js";import{pa as f,qa as S,ra as x0,sa as u}from"./chunk-jvqe4bt1.js";import{wa as t0}from"./chunk-0q7qnmx3.js";var _j="sveld",O0="0.36.7";var Fj={name:_j,version:O0,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./lib/index.js",types:"./lib/index.d.ts",exports:{".":{types:"./lib/index.d.ts",import:"./lib/index.js",default:"./lib/index.js"},"./browser":{types:"./lib/browser.d.ts",import:"./lib/browser.js",default:"./lib/browser.js"}},scripts:{test:"bun test --parallel","test:fixtures-types":"tsc --project tsconfig.fixtures.json","test:e2e":"bun tests/test-e2e.ts",format:"biome format --write .",lint:"biome lint .","lint:fix":"biome check --write --unsafe .",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:mitata":"bun scripts/bench-mitata.ts",typecheck:"tsc --noEmit"},devDependencies:{"@biomejs/biome":"2.5.8","@types/bun":"^1.3.14","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",acorn:"^8.18.0",culls:"^0.2.0","estree-walker":"^3.0.3",mitata:"^1.0.34",svelte:"^5.56.8",typescript:"^7.0.2"},bin:{sveld:"cli.js"},files:["lib","cli.js"],repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var j0="5.56.8";var B0=1,Nj=new WeakMap;function C(j,$={}){let Z=Nj.get(j),Q=Z?.get($.entryExports);if(Q)return Q;let Y=Array.from(j,([,z])=>{let{diagnostics:J,...U}=z;return U}).sort((z,J)=>z.moduleName.localeCompare(J.moduleName)),K={schemaVersion:B0,generator:{name:_j,version:O0,svelteVersion:j0},total:Y.length,components:Y};if($.entryExports&&$.entryExports.length>0)K.totalExports=$.entryExports.length,K.exports=$.entryExports;if(!Z)Z=new Map,Nj.set(j,Z);return Z.set($.entryExports,K),K}import{readFile as W2}from"node:fs/promises";import X2 from"node:path";var xj={none:0,patch:1,minor:2,major:3};function k2(j,$){return xj[$]>xj[j]?$:j}function O2(j){return j.reduce(($,Z)=>k2($,Z.bump),"none")}function yj(j){let $=[],Z=0,Q="",Y=null;for(let K=0;K<j.length;K++){let z=j[K];if(Y){if(Q+=z,z==="\\")K++,Q+=j[K]??"";else if(z===Y)Y=null;continue}if(z==='"'||z==="'"||z==="`"){Y=z,Q+=z;continue}if(z==="<"||z==="("||z==="{"||z==="[")Z++;if(z===">"||z===")"||z==="}"||z==="]")Z--;if(z==="|"&&Z===0){$.push(Q.trim()),Q="";continue}Q+=z}return $.push(Q.trim()),new Set($.filter((K)=>K.length>0))}function d0(j,$){if(j===$)return"none";if(j===void 0||$===void 0)return"major";let Z=yj(j),Q=yj($),Y=[...Q].some((z)=>!Z.has(z)),K=[...Z].some((z)=>!Q.has(z));if(!Y&&!K)return"none";if(Y&&!K)return"minor";if(K&&!Y)return"major";return"major"}function gj(j,$,Z,Q){let Y=$==="prop"?"prop":"export",K=[],z=new Map(Z.map((U)=>[U.name,U])),J=new Map(Q.map((U)=>[U.name,U]));for(let[U,H]of J){if(z.has(U))continue;K.push({component:j,kind:$,name:U,bump:H.isRequired?"major":"minor",message:`${Y} "${U}" added${H.isRequired?" (required)":""}`})}for(let[U]of z){if(J.has(U))continue;K.push({component:j,kind:$,name:U,bump:"major",message:`${Y} "${U}" removed`})}for(let[U,H]of z){let V=J.get(U);if(!V)continue;if(H.isRequired!==V.isRequired)K.push({component:j,kind:$,name:U,bump:V.isRequired?"major":"minor",message:`${Y} "${U}" became ${V.isRequired?"required":"optional"}`});let q=d0(H.type,V.type);if(q!=="none")K.push({component:j,kind:$,name:U,bump:q,message:`${Y} "${U}" type changed from \`${H.type??"unknown"}\` to \`${V.type??"unknown"}\``})}return K}function B2(j,$,Z){let Q=[],Y=new Map($.map((z)=>[z.name,z])),K=new Map(Z.map((z)=>[z.name,z]));for(let[z]of K){if(Y.has(z))continue;Q.push({component:j,kind:"event",name:z,bump:"minor",message:`event "${z}" added`})}for(let[z]of Y){if(K.has(z))continue;Q.push({component:j,kind:"event",name:z,bump:"major",message:`event "${z}" removed`})}for(let[z,J]of Y){let U=K.get(z);if(!U)continue;if(J.type!==U.type){Q.push({component:j,kind:"event",name:z,bump:"major",message:`event "${z}" changed from ${J.type} to ${U.type}`});continue}let H=J.type==="dispatched"?J.detail:void 0,V=U.type==="dispatched"?U.detail:void 0,q=d0(H,V);if(q!=="none")Q.push({component:j,kind:"event",name:z,bump:q,message:`event "${z}" detail changed from \`${H??"unknown"}\` to \`${V??"unknown"}\``})}return Q}function Cj(j){return j.name??"default"}function L2(j,$,Z){let Q=[],Y=new Map($.map((z)=>[Cj(z),z])),K=new Map(Z.map((z)=>[Cj(z),z]));for(let[z]of K){if(Y.has(z))continue;Q.push({component:j,kind:"slot",name:z,bump:"minor",message:`slot "${z}" added`})}for(let[z]of Y){if(K.has(z))continue;Q.push({component:j,kind:"slot",name:z,bump:"major",message:`slot "${z}" removed`})}for(let[z,J]of Y){let U=K.get(z);if(!U)continue;let H=d0(J.slot_props,U.slot_props);if(H!=="none")Q.push({component:j,kind:"slot",name:z,bump:H,message:`slot "${z}" props changed from \`${J.slot_props??"none"}\` to \`${U.slot_props??"none"}\``})}return Q}var I2=new Set(["description","source","componentCommentSource","tags"]);function L0(j){if(Array.isArray(j))return j.map(L0);if(j!==null&&typeof j==="object"){let $={};for(let[Z,Q]of Object.entries(j)){if(I2.has(Z))continue;$[Z]=L0(Q)}return $}return j}var R2=["generics","rest_props","extends","contexts","typedefs"];function M2(j,$,Z){let Q=[];for(let Y of R2){let K=JSON.stringify(L0($[Y])),z=JSON.stringify(L0(Z[Y]));if(K!==z)Q.push({component:j,kind:"shape",name:Y,bump:"major",message:`"${Y}" changed (breaking)`})}return Q}function b2(j,$){let Z=$.moduleName;return[...gj(Z,"prop",j.props,$.props),...gj(Z,"moduleExport",j.moduleExports,$.moduleExports),...B2(Z,j.events,$.events),...L2(Z,j.slots,$.slots),...M2(Z,j,$)]}function D2(j,$){let Z=[],Q=new Map(j.components.map((K)=>[K.moduleName,K])),Y=new Map($.components.map((K)=>[K.moduleName,K]));for(let[K]of Y){if(Q.has(K))continue;Z.push({component:K,kind:"component",bump:"minor",message:`component "${K}" added`})}for(let[K]of Q){if(Y.has(K))continue;Z.push({component:K,kind:"component",bump:"major",message:`component "${K}" removed`})}for(let[K,z]of Q){let J=Y.get(K);if(!J)continue;Z.push(...b2(z,J))}return Z}async function A2(j){let $;try{$=await W2(X2.resolve(j),"utf-8")}catch(Z){if(Z.code==="ENOENT")return null;throw Z}try{return JSON.parse($)}catch{throw Error(`sveld: could not parse "${j}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Ej(j){if(typeof j.check==="string")return j.check;return j.jsonOptions?.outFile??"COMPONENT_API.json"}async function Pj(j,$,Z={}){let Q=await A2($);if(Q===null)return{snapshotExists:!1,snapshotFile:$,changes:[],bump:"none"};if(Q.schemaVersion!==B0)return{snapshotExists:!0,snapshotFile:$,changes:[{component:"*",kind:"shape",bump:"none",message:`snapshot schemaVersion ${Q.schemaVersion} does not match the current schemaVersion ${B0}; skipping diff`}],bump:"none"};let Y=C(j,{entryExports:Z.entryExports}),K=D2(Q,Y);return{snapshotExists:!0,snapshotFile:$,changes:K,bump:O2(K)}}var T2={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function vj(j){if(!j.snapshotExists)return`sveld --check: no snapshot found at "${j.snapshotFile}". Run \`sveld --json\` and commit the output first.`;if(j.changes.length===0)return`sveld --check: no API changes detected against "${j.snapshotFile}".`;let $=[],Z=j.changes.length;$.push(`sveld --check: ${Z} API change${Z===1?"":"s"} detected against "${j.snapshotFile}".`),$.push(`Suggested semver bump: ${j.bump}.`);let Q=new Map;for(let Y of j.changes){let K=Q.get(Y.component)??[];K.push(Y),Q.set(Y.component,K)}for(let[Y,K]of Q){$.push(""),$.push(` ${Y}`);for(let z of K)$.push(` [${T2[z.bump]}] ${z.message}`)}return $.join(`
2
2
  `)}function fj(j){let $={kind:"check-report",...j};return u($)}import{existsSync as w2}from"node:fs";import{join as S2}from"node:path";import{pathToFileURL as _2}from"node:url";var F2=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function v4(j){return j}function N2(j=process.cwd()){for(let $ of F2){let Z=S2(j,$);if(w2(Z))return Z}return null}async function x2(j){let $;try{$=await import(`${_2(j).href}?t=${Date.now()}`)}catch(Q){let Y=Q instanceof Error?Q.message:String(Q);throw Error(`sveld: failed to load config file "${j}".
3
3
  ${Y}`)}let Z=$.default;if(!i(Z)||Array.isArray(Z))throw Error(`sveld: config file "${j}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Z}async function hj(j=process.cwd()){let $=N2(j);if($===null)return{};return x2($)}function uj(...j){return Object.assign({},...j.filter(Boolean))}var l0=new Map;function $0(j){l0.set(j.name,j)}function i0(j){return l0.get(j)}function h4(){return Array.from(l0.values())}import{dirname as K2}from"node:path";import{lstatSync as L1,readdirSync as A5,readFileSync as T5,realpathSync as w5,statSync as S5}from"node:fs";import{readFile as _5}from"node:fs/promises";import{dirname as F5,isAbsolute as N5,join as x5,parse as S0,relative as $j,resolve as U0}from"node:path";function Z0(j){return j}function m(j){if(j==="")return j;return j.startsWith(".")?j:`./${j}`}import{dirname as y2,resolve as g2}from"node:path";var C2=/^(['"])(.*)\1$/;function E2(j,$){let Z=j.extends?.import;if(Z===void 0)return null;let Q=Z.replace(C2,"$2");if(!f.test(Q))return null;return g2(y2($),Q)}function Q0(j,$){let Z=new Map;for(let Q of j.values()){let Y=$(Q.filePath),K=E2(Q,Y);if(K===null)continue;let z=Z.get(K);if(z===void 0)z=new Set,Z.set(K,z);z.add(Y)}return Z}function I0(j,$){let Z=new Set,Q=[];for(let Y of j)if(!Z.has(Y))Z.add(Y),Q.push(Y);while(Q.length>0){let Y=Q.shift(),K=$.get(Y);if(K===void 0)continue;for(let z of K)if(!Z.has(z))Z.add(z),Q.push(z)}return Z}var P2={"prop-unknown-type":"Props without inferred types","context-any-type":"Context values typed as `any`","event-no-source":"@event tags with no dispatch or callback","example-compile-error":"@example blocks that failed to compile","syntax-skipped":"Component syntax sveld skipped"},v2=["prop-unknown-type","context-any-type","event-no-source","example-compile-error","syntax-skipped"];function R0(j){let $=new Set,Z=[];for(let Q of j){let Y=`${Q.component}:${Q.kind}:${Q.name}`;if($.has(Y))continue;$.add(Y),Z.push(Q)}return Z}function mj(j){if(j.length===0)return"sveld: all types resolved.";let $=[],Z=j.length;$.push(`sveld: ${Z} unresolved type${Z===1?"":"s"} found.`);for(let Q of v2){let Y=j.filter((z)=>z.kind===Q);if(Y.length===0)continue;$.push(""),$.push(`${P2[Q]} (${Y.length}):`);let K=new Map;for(let z of Y){let J=K.get(z.component)??[];J.push(z),K.set(z.component,J)}for(let[z,J]of K){$.push(` ${z}`);for(let U of J){let H=U.source?` (${z}:${U.source.start.line}:${U.source.start.column})`:"";$.push(` - ${U.message}${H}`)}}}return $.join(`
4
- `)}function cj(j){return u({kind:"diagnostics",diagnostics:j})}var f2=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,h2=new Set(["","js","jsx","ts","tsx","javascript","typescript"]);function u2(j){let $=j.trim();if($==="")return null;let Z=$.match(f2);if(Z){let Q=Z[1].toLowerCase();if(!h2.has(Q))return null;let Y=Z[2].trim();return Y===""?null:Y}if($.startsWith("<"))return null;return $}function dj(j){if(!j.isFunction)return"any";return`(${(j.params??[]).map((Z)=>`${Z.name}${Z.optional?"?":""}: any`).join(", ")}) => any`}function M0(j,$,Z,Q,Y){let K=(j??[]).filter((J)=>J.name==="example"),z=[];return K.forEach((J,U)=>{let H=u2(J.body);if(H===null)return;let V=K.length>1;z.push({id:V?`${$}#${U}`:$,name:V?`${Z} (example ${U+1})`:Z,type:Q,code:H,...Y?{source:Y}:{}})}),z}function lj(j){return j.name??"default"}function ij(j){let $=[];for(let Z of j.props)$.push(...M0(Z.tags,`prop:${Z.name}`,Z.name,dj(Z),Z.source));for(let Z of j.moduleExports)$.push(...M0(Z.tags,`export:${Z.name}`,Z.name,dj(Z),Z.source));for(let Z of j.slots)$.push(...M0(Z.tags,`slot:${lj(Z)}`,lj(Z),"any",Z.source));for(let Z of j.events)$.push(...M0(Z.tags,`event:${Z.name}`,Z.name,"any",Z.source));return $}import{createHash as m2}from"node:crypto";import{mkdirSync as c2,readFileSync as d2,writeFileSync as l2}from"node:fs";import{dirname as i2,isAbsolute as p2,join as s2,resolve as pj}from"node:path";var s0=2,r2=s2("node_modules",".cache","sveld","parse-cache.json");function r0(){return`${O0}+svelte@${j0}`}function rj(j,$){if(typeof $==="string")return p2($)?$:pj(j,$);return pj(j,r2)}function aj(j){return m2("sha256").update(j).digest("hex")}function sj(){return{formatVersion:s0,toolchainVersion:r0(),entries:{}}}function a2(j){try{let $=d2(j,"utf-8"),Z=JSON.parse($);if(Z.formatVersion!==s0||Z.toolchainVersion!==r0())return sj();return Z}catch{return sj()}}class a0{cacheFilePath;file;next=new Map;blocked=new Set;constructor(j){this.cacheFilePath=j,this.file=a2(j)}has(j,$){if(this.blocked.has(j))return!1;let Z=this.file.entries[j];return Z!==void 0&&Z.hash===$}get(j,$){if(this.blocked.has(j))return null;let Z=this.file.entries[j];if(Z===void 0||Z.hash!==$)return null;if(this.next.set(j,Z),Z.typeScriptMetadata!==void 0)Z.parsed[p0]=Z.typeScriptMetadata;return Z.parsed}set(j,$,Z){this.next.set(j,{hash:$,parsed:Z,typeScriptMetadata:Z[p0]})}invalidate(j){this.blocked.add(j)}getGeneratedText(j,$){let Z=this.next.get(j);if(Z?.generatedText===void 0||Z.generatedText.format!==$)return;return Z.generatedText.text}setGeneratedText(j,$,Z){let Q=this.next.get(j);if(Q===void 0)return;Q.generatedText={format:$,text:Z}}save(){c2(i2(this.cacheFilePath),{recursive:!0});let j={formatVersion:s0,toolchainVersion:r0(),entries:Object.fromEntries(this.next)};l2(this.cacheFilePath,JSON.stringify(j))}}import{existsSync as T0,lstatSync as $1,readFileSync as Q5}from"node:fs";import{dirname as U1,join as Y5,relative as K5,resolve as H1}from"node:path";var a=null,n0=null;function p(){if(a)return Promise.resolve(a);if(!n0)n0=Promise.all([import("./chunk-k880gdpw.js"),import("./chunk-c5sqd852.js")]).then(([j,$])=>{return a={ComponentParser:j.default,parseSvelte:$.parse},a});return n0}function b0(){if(!a)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return a}import{existsSync as ej,readFileSync as n2}from"node:fs";import{dirname as o0,isAbsolute as t2,join as o2,relative as e2,resolve as A0}from"node:path";function nj(j){if(!i(j))return{};let $=j.svelte;return typeof $==="string"?{svelte:$}:{}}function tj(j){if(!i(j))return{};let $={};if(typeof j.extends==="string")$.extends=j.extends;if(i(j.compilerOptions)){let Z={};if(typeof j.compilerOptions.baseUrl==="string")Z.baseUrl=j.compilerOptions.baseUrl;if(i(j.compilerOptions.paths)){let Q={};for(let[Y,K]of Object.entries(j.compilerOptions.paths))if(Array.isArray(K)&&K.every((z)=>typeof z==="string"))Q[Y]=K;if(Object.keys(Q).length>0)Z.paths=Q}if(Object.keys(Z).length>0)$.compilerOptions=Z}return $}var D0=new Map,oj=new Map,j5=/\/\*[\s\S]*?\*\/|\/\/.*/g,$5=/[.+?^${}()|[\]\\]/g;function Z5(j){let $=j,Z=A0($,"/");while($!==Z){for(let Q of["tsconfig.json","jsconfig.json"]){let Y=o2($,Q);if(ej(Y))return Y}$=o0($)}return null}function j1(j){if(D0.has(j))return D0.get(j)??null;try{let $=n2(j,"utf-8"),Z;try{Z=JSON.parse($)}catch{let Y=$.replace(j5,"");Z=JSON.parse(Y)}let Q=tj(Z);if(Q.extends){let Y=t2(Q.extends)?Q.extends:A0(o0(j),Q.extends),K=Y.endsWith(".json")?Y:`${Y}.json`;if(ej(K)){let z=j1(K);if(z)Q.compilerOptions={...z.compilerOptions,...Q.compilerOptions,paths:{...z.compilerOptions?.paths,...Q.compilerOptions?.paths}}}}return D0.set(j,Q),Q}catch{return D0.set(j,null),null}}function Y0(j,$){if(j.startsWith(".")||j.startsWith("/"))return j;let Z=Z5($);if(!Z)return j;let Q=j1(Z);if(!Q?.compilerOptions?.paths)return j;let{baseUrl:Y=".",paths:K}=Q.compilerOptions,z=o0(Z),J=A0(z,Y);for(let[U,H]of Object.entries(K)){let V=oj.get(U);if(!V){let W=U.split("*").map((X)=>X.replace($5,"\\$&")).join("(.*)");V=new RegExp(`^${W}$`),oj.set(U,V)}let q=j.match(V);if(q){let W=H[0];if(!W)continue;let X=W;for(let B=1;B<q.length;B++)X=X.replace("*",q[B]);return A0(J,X)}}return j}function K0(j,$){if(j.startsWith(".")||j.startsWith("/"))return j;let Z=Y0(j,$);if(Z===j)return j;let Q=e2($,Z);return Q=S(Q),Q.startsWith(".")?Q:`./${Q}`}var Z1=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],z5=/\r?\n/,J5=/^\s*\*+/;function R(j){return j&&typeof j==="object"?j:void 0}function t(j){return Array.isArray(j)?j:[]}function h(j){return z1(j)?j.name:void 0}function J0(j,$){let Z=Y0(j,$),Q=H1($,Z);if(T0(Q)&&$1(Q).isFile())return Q;for(let Y of Z1){let K=Q+Y;if(T0(K))return K}if(T0(Q)&&$1(Q).isDirectory())for(let Y of Z1){let K=Y5(Q,`index${Y}`);if(T0(K))return K}return null}function U5(j,$){let Z=j.slice(0,$).trimEnd();if(!Z.endsWith("*/"))return;let Q=Z.length-2,Y=Z.lastIndexOf("/**",Q);if(Y===-1)return;let K=[];for(let z of Z.slice(Y+3,Q).split(z5)){let J=z.replace(J5,"").trim();if(J.startsWith("@"))break;if(J)K.push(J)}return K.join(" ")||void 0}function H5(j,$){let Z=j.slice(0,$).trimEnd();if(!Z.endsWith("*/"))return;let Q=Z.length-2,Y=Z.lastIndexOf("/**",Q);if(Y===-1)return;return Z.slice(Y,Q+2)}function n(j,$){if(!$)return;return j.text.slice($.start,$.end)}function V5(j,$){let Z=R($?.typeAnnotation);if(Z?.type!=="TSTypeAnnotation")return;return n(j,R(Z.typeAnnotation))}function e0(j,$){let Z=R($.returnType);return Z?.type==="TSTypeAnnotation"?n(j,R(Z.typeAnnotation)):void 0}function Q1(j,$){let Z=t($.params).map((Y)=>n(j,Y)??"").join(", "),Q=e0(j,$);return`(${Z})${Q?` => ${Q}`:""}`}function V1(j){if(j.type==="Literal"){let $=j.value;if(typeof $==="string")return"string";if(typeof $==="number")return"number";if(typeof $==="boolean")return"boolean"}if(j.type==="TemplateLiteral")return"string";return}function q5(j){if(!j)return;let $=j.lastIndexOf("=>");if($===-1)return;return j.slice($+2).trim()||void 0}function Y1(j){if(j.async||j.generator)return;let $=R(j.body);if(!$)return;let Z=[];if($.type==="BlockStatement"){if(z0($,Z),Z.length===0)return}else Z.push($);let Q;for(let Y of Z){if(!Y)return;let K=V1(Y);if(!K)return;if(Q===void 0)Q=K;else if(Q!==K)return}return Q}function z0(j,$){for(let Z of t(j.body)){if(Z.type==="FunctionDeclaration"||Z.type==="FunctionExpression"||Z.type==="ArrowFunctionExpression")continue;if(Z.type==="ReturnStatement"){$.push(R(Z.argument)??null);continue}if(Z.type==="BlockStatement"){z0(Z,$);continue}let Q=R(Z.consequent);if(Q?.type==="BlockStatement")z0(Q,$);else if(Q?.type==="ReturnStatement")$.push(R(Q.argument)??null);let Y=R(Z.alternate);if(Y?.type==="BlockStatement")z0(Y,$);else if(Y?.type==="ReturnStatement")$.push(R(Y.argument)??null);let K=R(Z.body);if(K?.type==="BlockStatement")z0(K,$)}}function K1(j,$,Z){let Q=j.filePath,Y=U5(j.text,Z),K=H5(j.text,Z),z=K?J1(K):void 0;if($.type==="VariableDeclaration"){let J=$.kind??"const",U=[];for(let H of t($.declarations)){let V=R(H.id),q=h(V);if(!q)continue;let W=V5(j,V),X,k,B=R(H.init);if(B){if(B.type==="ArrowFunctionExpression"||B.type==="FunctionExpression"){if(!W)W=Q1(j,B);k=e0(j,B)??z??q5(W)??Y1(B)}else if(X=n(j,B),!W)W=V1(B)}U.push({name:q,kind:J,type:W,value:X,returnType:k,description:Y,declFile:Q,isTypeOnly:!1})}return U}if($.type==="FunctionDeclaration"||$.type==="TSDeclareFunction"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"function",type:Q1(j,$),returnType:e0(j,$)??z??Y1($),description:Y,declFile:Q,isTypeOnly:!1}]}if($.type==="ClassDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"class",type:J,description:Y,declFile:Q,isTypeOnly:!1}]}if($.type==="TSTypeAliasDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"type",type:n(j,R($.typeAnnotation)),description:Y,declFile:Q,isTypeOnly:!0}]}if($.type==="TSInterfaceDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"interface",type:n(j,R($.body)),description:Y,declFile:Q,isTypeOnly:!0}]}if($.type==="TSEnumDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"enum",type:J,description:Y,declFile:Q,isTypeOnly:!1}]}return[]}function G5(j){let $;try{$=Q5(j,"utf-8")}catch{return null}let Z=`<script lang="ts">
4
+ `)}function cj(j){return u({kind:"diagnostics",diagnostics:j})}var f2=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,h2=new Set(["","js","jsx","ts","tsx","javascript","typescript"]);function u2(j){let $=j.trim();if($==="")return null;let Z=$.match(f2);if(Z){let Q=Z[1].toLowerCase();if(!h2.has(Q))return null;let Y=Z[2].trim();return Y===""?null:Y}if($.startsWith("<"))return null;return $}function dj(j){if(!j.isFunction)return"any";return`(${(j.params??[]).map((Z)=>`${Z.name}${Z.optional?"?":""}: any`).join(", ")}) => any`}function M0(j,$,Z,Q,Y){let K=(j??[]).filter((J)=>J.name==="example"),z=[];return K.forEach((J,U)=>{let H=u2(J.body);if(H===null)return;let V=K.length>1;z.push({id:V?`${$}#${U}`:$,name:V?`${Z} (example ${U+1})`:Z,type:Q,code:H,...Y?{source:Y}:{}})}),z}function lj(j){return j.name??"default"}function ij(j){let $=[];for(let Z of j.props)$.push(...M0(Z.tags,`prop:${Z.name}`,Z.name,dj(Z),Z.source));for(let Z of j.moduleExports)$.push(...M0(Z.tags,`export:${Z.name}`,Z.name,dj(Z),Z.source));for(let Z of j.slots)$.push(...M0(Z.tags,`slot:${lj(Z)}`,lj(Z),"any",Z.source));for(let Z of j.events)$.push(...M0(Z.tags,`event:${Z.name}`,Z.name,"any",Z.source));return $}import{createHash as m2}from"node:crypto";import{mkdirSync as c2,readFileSync as d2,writeFileSync as l2}from"node:fs";import{dirname as i2,isAbsolute as p2,join as s2,resolve as pj}from"node:path";var s0=2,r2=s2("node_modules",".cache","sveld","parse-cache.json");function r0(){return`${O0}+svelte@${j0}`}function rj(j,$){if(typeof $==="string")return p2($)?$:pj(j,$);return pj(j,r2)}function aj(j){return m2("sha256").update(j).digest("hex")}function sj(){return{formatVersion:s0,toolchainVersion:r0(),entries:{}}}function a2(j){try{let $=d2(j,"utf-8"),Z=JSON.parse($);if(Z.formatVersion!==s0||Z.toolchainVersion!==r0())return sj();return Z}catch{return sj()}}class a0{cacheFilePath;file;next=new Map;blocked=new Set;constructor(j){this.cacheFilePath=j,this.file=a2(j)}has(j,$){if(this.blocked.has(j))return!1;let Z=this.file.entries[j];return Z!==void 0&&Z.hash===$}get(j,$){if(this.blocked.has(j))return null;let Z=this.file.entries[j];if(Z===void 0||Z.hash!==$)return null;if(this.next.set(j,Z),Z.typeScriptMetadata!==void 0)Z.parsed[p0]=Z.typeScriptMetadata;return Z.parsed}set(j,$,Z){this.next.set(j,{hash:$,parsed:Z,typeScriptMetadata:Z[p0]})}invalidate(j){this.blocked.add(j)}getGeneratedText(j,$){let Z=this.next.get(j);if(Z?.generatedText===void 0||Z.generatedText.format!==$)return;return Z.generatedText.text}setGeneratedText(j,$,Z){let Q=this.next.get(j);if(Q===void 0)return;Q.generatedText={format:$,text:Z}}save(){c2(i2(this.cacheFilePath),{recursive:!0});let j={formatVersion:s0,toolchainVersion:r0(),entries:Object.fromEntries(this.next)};l2(this.cacheFilePath,JSON.stringify(j))}}import{existsSync as T0,lstatSync as $1,readFileSync as Q5}from"node:fs";import{dirname as U1,join as Y5,relative as K5,resolve as H1}from"node:path";var a=null,n0=null;function p(){if(a)return Promise.resolve(a);if(!n0)n0=Promise.all([import("./chunk-bjwm35xb.js"),import("./chunk-c5sqd852.js")]).then(([j,$])=>{return a={ComponentParser:j.default,parseSvelte:$.parse},a});return n0}function b0(){if(!a)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return a}import{existsSync as ej,readFileSync as n2}from"node:fs";import{dirname as o0,isAbsolute as t2,join as o2,relative as e2,resolve as A0}from"node:path";function nj(j){if(!i(j))return{};let $=j.svelte;return typeof $==="string"?{svelte:$}:{}}function tj(j){if(!i(j))return{};let $={};if(typeof j.extends==="string")$.extends=j.extends;if(i(j.compilerOptions)){let Z={};if(typeof j.compilerOptions.baseUrl==="string")Z.baseUrl=j.compilerOptions.baseUrl;if(i(j.compilerOptions.paths)){let Q={};for(let[Y,K]of Object.entries(j.compilerOptions.paths))if(Array.isArray(K)&&K.every((z)=>typeof z==="string"))Q[Y]=K;if(Object.keys(Q).length>0)Z.paths=Q}if(Object.keys(Z).length>0)$.compilerOptions=Z}return $}var D0=new Map,oj=new Map,j5=/\/\*[\s\S]*?\*\/|\/\/.*/g,$5=/[.+?^${}()|[\]\\]/g;function Z5(j){let $=j,Z=A0($,"/");while($!==Z){for(let Q of["tsconfig.json","jsconfig.json"]){let Y=o2($,Q);if(ej(Y))return Y}$=o0($)}return null}function j1(j){if(D0.has(j))return D0.get(j)??null;try{let $=n2(j,"utf-8"),Z;try{Z=JSON.parse($)}catch{let Y=$.replace(j5,"");Z=JSON.parse(Y)}let Q=tj(Z);if(Q.extends){let Y=t2(Q.extends)?Q.extends:A0(o0(j),Q.extends),K=Y.endsWith(".json")?Y:`${Y}.json`;if(ej(K)){let z=j1(K);if(z)Q.compilerOptions={...z.compilerOptions,...Q.compilerOptions,paths:{...z.compilerOptions?.paths,...Q.compilerOptions?.paths}}}}return D0.set(j,Q),Q}catch{return D0.set(j,null),null}}function Y0(j,$){if(j.startsWith(".")||j.startsWith("/"))return j;let Z=Z5($);if(!Z)return j;let Q=j1(Z);if(!Q?.compilerOptions?.paths)return j;let{baseUrl:Y=".",paths:K}=Q.compilerOptions,z=o0(Z),J=A0(z,Y);for(let[U,H]of Object.entries(K)){let V=oj.get(U);if(!V){let W=U.split("*").map((X)=>X.replace($5,"\\$&")).join("(.*)");V=new RegExp(`^${W}$`),oj.set(U,V)}let q=j.match(V);if(q){let W=H[0];if(!W)continue;let X=W;for(let B=1;B<q.length;B++)X=X.replace("*",q[B]);return A0(J,X)}}return j}function K0(j,$){if(j.startsWith(".")||j.startsWith("/"))return j;let Z=Y0(j,$);if(Z===j)return j;let Q=e2($,Z);return Q=S(Q),Q.startsWith(".")?Q:`./${Q}`}var Z1=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],z5=/\r?\n/,J5=/^\s*\*+/;function R(j){return j&&typeof j==="object"?j:void 0}function t(j){return Array.isArray(j)?j:[]}function h(j){return z1(j)?j.name:void 0}function J0(j,$){let Z=Y0(j,$),Q=H1($,Z);if(T0(Q)&&$1(Q).isFile())return Q;for(let Y of Z1){let K=Q+Y;if(T0(K))return K}if(T0(Q)&&$1(Q).isDirectory())for(let Y of Z1){let K=Y5(Q,`index${Y}`);if(T0(K))return K}return null}function U5(j,$){let Z=j.slice(0,$).trimEnd();if(!Z.endsWith("*/"))return;let Q=Z.length-2,Y=Z.lastIndexOf("/**",Q);if(Y===-1)return;let K=[];for(let z of Z.slice(Y+3,Q).split(z5)){let J=z.replace(J5,"").trim();if(J.startsWith("@"))break;if(J)K.push(J)}return K.join(" ")||void 0}function H5(j,$){let Z=j.slice(0,$).trimEnd();if(!Z.endsWith("*/"))return;let Q=Z.length-2,Y=Z.lastIndexOf("/**",Q);if(Y===-1)return;return Z.slice(Y,Q+2)}function n(j,$){if(!$)return;return j.text.slice($.start,$.end)}function V5(j,$){let Z=R($?.typeAnnotation);if(Z?.type!=="TSTypeAnnotation")return;return n(j,R(Z.typeAnnotation))}function e0(j,$){let Z=R($.returnType);return Z?.type==="TSTypeAnnotation"?n(j,R(Z.typeAnnotation)):void 0}function Q1(j,$){let Z=t($.params).map((Y)=>n(j,Y)??"").join(", "),Q=e0(j,$);return`(${Z})${Q?` => ${Q}`:""}`}function V1(j){if(j.type==="Literal"){let $=j.value;if(typeof $==="string")return"string";if(typeof $==="number")return"number";if(typeof $==="boolean")return"boolean"}if(j.type==="TemplateLiteral")return"string";return}function q5(j){if(!j)return;let $=j.lastIndexOf("=>");if($===-1)return;return j.slice($+2).trim()||void 0}function Y1(j){if(j.async||j.generator)return;let $=R(j.body);if(!$)return;let Z=[];if($.type==="BlockStatement"){if(z0($,Z),Z.length===0)return}else Z.push($);let Q;for(let Y of Z){if(!Y)return;let K=V1(Y);if(!K)return;if(Q===void 0)Q=K;else if(Q!==K)return}return Q}function z0(j,$){for(let Z of t(j.body)){if(Z.type==="FunctionDeclaration"||Z.type==="FunctionExpression"||Z.type==="ArrowFunctionExpression")continue;if(Z.type==="ReturnStatement"){$.push(R(Z.argument)??null);continue}if(Z.type==="BlockStatement"){z0(Z,$);continue}let Q=R(Z.consequent);if(Q?.type==="BlockStatement")z0(Q,$);else if(Q?.type==="ReturnStatement")$.push(R(Q.argument)??null);let Y=R(Z.alternate);if(Y?.type==="BlockStatement")z0(Y,$);else if(Y?.type==="ReturnStatement")$.push(R(Y.argument)??null);let K=R(Z.body);if(K?.type==="BlockStatement")z0(K,$)}}function K1(j,$,Z){let Q=j.filePath,Y=U5(j.text,Z),K=H5(j.text,Z),z=K?J1(K):void 0;if($.type==="VariableDeclaration"){let J=$.kind??"const",U=[];for(let H of t($.declarations)){let V=R(H.id),q=h(V);if(!q)continue;let W=V5(j,V),X,k,B=R(H.init);if(B){if(B.type==="ArrowFunctionExpression"||B.type==="FunctionExpression"){if(!W)W=Q1(j,B);k=e0(j,B)??z??q5(W)??Y1(B)}else if(X=n(j,B),!W)W=V1(B)}U.push({name:q,kind:J,type:W,value:X,returnType:k,description:Y,declFile:Q,isTypeOnly:!1})}return U}if($.type==="FunctionDeclaration"||$.type==="TSDeclareFunction"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"function",type:Q1(j,$),returnType:e0(j,$)??z??Y1($),description:Y,declFile:Q,isTypeOnly:!1}]}if($.type==="ClassDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"class",type:J,description:Y,declFile:Q,isTypeOnly:!1}]}if($.type==="TSTypeAliasDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"type",type:n(j,R($.typeAnnotation)),description:Y,declFile:Q,isTypeOnly:!0}]}if($.type==="TSInterfaceDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"interface",type:n(j,R($.body)),description:Y,declFile:Q,isTypeOnly:!0}]}if($.type==="TSEnumDeclaration"){let J=h(R($.id));if(!J)return[];return[{name:J,kind:"enum",type:J,description:Y,declFile:Q,isTypeOnly:!1}]}return[]}function G5(j){let $;try{$=Q5(j,"utf-8")}catch{return null}let Z=`<script lang="ts">
5
5
  ${$}
6
6
  </script>`;try{let Q=b0().parseSvelte(Z,{modern:!0}),Y=t(Q.instance?.content?.body);return{source:{text:Z,filePath:j,dir:U1(j)},body:Y}}catch(Q){let Y=Q instanceof Error?Q.message:String(Q);return console.warn(`Warning: Failed to parse entry export module ${j}: ${Y}`),null}}function W5(j,$){for(let Z of j){if(Z.type!=="ImportDeclaration")continue;let Q=R(Z.source)?.value;if(typeof Q!=="string")continue;for(let Y of t(Z.specifiers)){if(Y.type!=="ImportSpecifier")continue;if(h(R(Y.local))===$){let K=h(R(Y.imported))??$;return{specifier:Q,importedName:K}}}}return null}function s(j,$){let Z=$.cache.get(j);if(Z)return Z;if($.computing.has(j))return[];$.computing.add(j);let Q=G5(j);if(!Q)return $.computing.delete(j),$.cache.set(j,[]),[];let{source:Y,body:K}=Q,z=[],J=new Map;for(let H of K){let V=H.type==="ExportNamedDeclaration"?R(H.declaration):H;if(!V)continue;for(let q of K1(Y,V,V.start))J.set(q.name,q)}let U=(H)=>{let V=J.get(H);if(V)return V;let q=W5(K,H);if(!q||q.specifier.endsWith(".svelte"))return null;let W=J0(q.specifier,Y.dir);if(!W)return null;return s(W,$).find((X)=>X.name===q.importedName)??null};for(let H of K){if(H.type==="ExportAllDeclaration"){let k=R(H.source)?.value;if(typeof k!=="string"||k.endsWith(".svelte"))continue;let B=J0(k,Y.dir);if(!B)continue;let G=H.exportKind==="type";for(let L of s(B,$))z.push(G?{...L,isTypeOnly:!0}:L);continue}if(H.type!=="ExportNamedDeclaration")continue;let V=R(H.declaration);if(V){z.push(...K1(Y,V,H.start));continue}let q=R(H.source)?.value,W=typeof q==="string"?q:void 0;if(W?.endsWith(".svelte"))continue;let X=H.exportKind==="type";for(let k of t(H.specifiers)){if(k.type!=="ExportSpecifier")continue;let B=h(R(k.exported)),G=h(R(k.local));if(!B||!G||G==="default"||B==="default")continue;let L=X||k.exportKind==="type",O=null;if(W){let b=J0(W,Y.dir);if(b)O=s(b,$).find((I)=>I.name===G)??null}else O=U(G);if(O?.declFile.endsWith(".svelte"))continue;if(O)z.push({...O,name:B,isTypeOnly:O.isTypeOnly||L});else z.push({name:B,kind:L?"type":"const",declFile:j,isTypeOnly:L})}}return $.computing.delete(j),$.cache.set(j,z),z}async function w0(j){await p();let $=H1(j),Z=U1($),Q=s($,{cache:new Map,computing:new Set}),Y=new Map;for(let K of Q){let{declFile:z,returnType:J,...U}=K,H=S(`./${K5(Z,z)}`);Y.set(K.name,{...U,source:H})}return Array.from(Y.values()).sort((K,z)=>K.name.localeCompare(z.name))}import{lstatSync as X5,readdirSync as k5,readFileSync as O5}from"node:fs";import{dirname as B5,join as q1,resolve as L5}from"node:path";var G1=new Map;function I5(j){return W1(j,{ecmaVersion:"latest",sourceType:"module"})}function jj(j,$,Z=new Set){let Q=G1.get(j);if(!Q)Q=I5(j),G1.set(j,Q);let Y={};for(let K of Q.body)if(K.type==="ExportDefaultDeclaration"){let z=K.declaration.name;if(z in Y)Y[z].default=!0;else Y[z]={source:m(""),default:!0}}else if(K.type==="ExportAllDeclaration"){if(!K.source)continue;let z=Y0(K.source.value,$),J=L5($,z);if(!X5(J).isFile()){let V=k5(J);for(let q of V)if(q.includes("index")){J=q1(J,q);break}}if(Z.has(J))continue;Z.add(J);let U=O5(J,"utf-8"),H=jj(U,B5(J),Z);Z.delete(J);for(let[V,q]of Object.entries(H)){let W=m(S(`./${q1(K.source.value,q.source)}`));Y[V]={...q,source:W}}}else if(K.type==="ExportNamedDeclaration")for(let z of K.specifiers){let J=z.exported.name,U=z.local.name,H=J||U;if(H in Y){if(K.type==="ExportNamedDeclaration")Y[H].mixed=!0;if(!Y[H].source)Y[H].source=m(K0(K.source?.value??"",$))}else Y[H]={source:m(K0(K.source?.value??"",$)),default:U==="default"}}else if(K.type==="ImportDeclaration"){let z=K.specifiers[0].local.name;if(z in Y){if(!Y[z].source)Y[z].source=m(K0(K.source?.value??"",$))}else Y[z]={source:m(K0(K.source?.value??"",$)),default:z==="default"}}return Y}import{existsSync as R5}from"node:fs";import{dirname as M5}from"node:path";function X1(){return{cache:new Map,computing:new Set}}var b5=/\.[^./\\]+$/;function D5(j){if(j.endsWith(".d.ts"))return null;let $=j.replace(b5,".d.ts");return R5($)?$:null}function k1(j,$,Z){let Q=M5(j);return $.map((Y)=>{if(!Y.importSource||!Y.importedName)return{candidate:Y};let K=J0(Y.importSource,Q);if(!K)return{candidate:Y,failureReason:"module-not-found"};let z=s(K,Z).find((U)=>U.name===Y.importedName);if(!z)return{candidate:Y,failureReason:"export-not-found"};if(z.returnType)return{candidate:Y,type:z.returnType};let J=D5(K);if(J){let U=s(J,Z).find((H)=>H.name===Y.importedName);if(U?.returnType)return{candidate:Y,type:U.returnType}}return{candidate:Y,failureReason:"return-type-unresolved"}})}function O1(j,$){switch($){case"module-not-found":return`Prop "${j.propName}" default calls "${j.calleeName}()", but "${j.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${j.propName}" default calls "${j.calleeName}()", but "${j.importedName}" is not exported from "${j.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${j.propName}" default calls "${j.calleeName}()" imported from "${j.importSource}", but its return type could not be resolved; falling back to "any".`}}function V0(j){return{failFast:j?.failFast,resolveTypes:j?.resolveTypes===!0,documentExports:j?.documentExports===!0,cache:j?.cache,checkExamples:j?.checkExamples===!0,dryRun:j?.dryRun===!0}}var y5=/-/g;function I1(j,$=[],Z=new Set){let Q;try{let Y=w5(j);if(Z.has(Y))return $;Z.add(Y),Q=A5(j,{withFileTypes:!0})}catch{return $}for(let Y of Q){if(Y.name.startsWith("."))continue;let K=x5(j,Y.name),z=Y.isSymbolicLink()?S5(K,{throwIfNoEntry:!1}):Y;if(!z)continue;if(z.isDirectory())I1(K,$,Z);else if(z.isFile()&&Y.name.endsWith(".svelte"))$.push(K)}return $}function g5(j){return I1(j).map(($)=>{let Z=S0($).name.replace(y5,""),Q=m(S(`./${$j(j,$)}`));return{moduleName:Z,source:Q}}).sort(($,Z)=>$.source.localeCompare(Z.source))}function C5(j){return S0(j).ext!==".svelte"}function E5(j,$){let Z=j.endsWith("/")?j:`${j}/`;return $.startsWith(Z)}function Zj(j,$){return{seenPaths:new Set(j.map(([,Z])=>$(Z.source))),seenModuleNamePaths:new Map(j.map(([Z,Q])=>[Z,$(Q.source)])),warnedModuleNames:new Set}}function Qj(j,$,Z,Q,Y){for(let{moduleName:K,source:z}of g5(j)){let J=Q(z),U=$[K];if(U&&C5(U.source)&&E5(U.source,z)){Y.seenPaths.delete(Q(U.source)),U.source=z,Y.seenPaths.add(J),Y.seenModuleNamePaths.set(K,J);continue}if(Y.seenPaths.has(J))continue;Y.seenPaths.add(J);let H=Y.seenModuleNamePaths.get(K);if(H===void 0)Y.seenModuleNamePaths.set(K,J);else if(H!==J&&!Y.warnedModuleNames.has(K))Y.warnedModuleNames.add(K),console.warn(`Warning: multiple components named "${K}" found (${S($j(j,H))} and ${S($j(j,J))}). Both are included in TypeScript definitions, but only one can be the named export.`);Z.push([K,{source:z,default:!1}])}}function Yj(j,$,Z=!1){let Q=L1(j).isFile(),Y=Q?F5(j):j,K=U0(Y),z=(H)=>N5(H)?U0(H):U0(K,H),J={};if(Q){let H=T5(j,"utf-8");try{J=jj(H,K,new Set([U0(j)]))}catch(V){if(!Z)throw V;let q=V instanceof Error?V.message:String(V);console.warn(`Warning: Failed to parse component exports from ${j}: ${q}`)}}let U=Object.entries(J);if($){let H=Zj(U,z);Qj(K,J,U,z,H)}return{exports:J,allComponentEntries:U,rootDir:K,resolveComponentFilePath:z}}async function _0(j){let $=await Promise.all(Array.from(j).map(async(Z)=>{try{let Q=await _5(Z,"utf-8");return{path:Z,content:Q}}catch(Q){return console.warn(`Warning: Failed to read file ${Z}:`,Q),{path:Z,content:null}}}));return new Map($.map(({path:Z,content:Q})=>[Z,Q]))}function d([j,$],Z,Q,Y,K={}){let z=$.source,{ext:J,name:U}=S0(z),H=j;if(Z.length===1&&j==="default")H=U;if(J===".svelte"){let V=Y(z),q=Q.get(V);if(q===null||q===void 0)return null;let W=S(z),X=K.memo?.get(V),k=K.hashes?.get(V),B=X===void 0?k===void 0?null:K.cache?.get(V,k):null,G;if(X!==void 0)G=X;else if(B)G=B;else{let L=new(b0()).ComponentParser;try{G=L.parseSvelteComponent(q,{moduleName:H,filePath:W})}catch(O){if(K.failFast)throw O;let b=O instanceof Error?O.message:String(O),I=O instanceof Error?O.stack:void 0;return K.onParseError?.({filePath:W,moduleName:H,message:b,stack:I}),null}if(k!==void 0)K.cache?.set(V,k,G);K.memo?.set(V,G)}return{moduleName:H,filePath:W,...G}}return null}function Kj(j,$){let Z=new Set;for(let Q of j)for(let[,Y]of Q)if(S0(Y.source).ext===".svelte")Z.add($(Y.source));return Z}function F0(j){if(j.length===0)return;console.error(`sveld: failed to parse ${j.length} component(s):`);for(let{filePath:$,message:Z}of j)console.error(` - ${$}: ${Z}`)}async function q0(j,$,Z={}){let Q=Z.documentExports===!0,{exports:Y,allComponentEntries:K,rootDir:z,resolveComponentFilePath:J}=Yj(j,$,Q),U=Q&&L1(j).isFile()?await w0(U0(j)):[],H=Object.entries(Y),V=Kj([H,K],J),q=await _0(V),W=new Map,X=new Map,k=Z.cache===!1?void 0:new a0(rj(z,Z.cache??!0)),B=k?new Map:void 0,G=new Set,L=new Map;if(k)for(let D of V){let M=q.get(D);if(M===null||M===void 0)continue;let T=aj(M);if(L.set(D,T),!k.has(D,T))G.add(D)}if(V.size>0&&(!k||G.size>0))await p();let O=new Map,b=new Map,I={failFast:Z.failFast===!0,onParseError:(D)=>O.set(D.filePath,D),cache:k,hashes:L,memo:b};for(let D of H){let M=d(D,H,q,J,I);if(M)W.set(M.moduleName,M)}for(let D of K){let M=d(D,K,q,J,I);if(M)X.set(M.filePath,M),B?.set(M.filePath,J(D[1].source))}if(k&&G.size>0){let D=Q0(X,J),M=I0(G,D);for(let T of M){if(G.has(T))continue;k.invalidate(T),b.delete(T)}for(let T of H){let g=J(T[1].source);if(!M.has(g)||G.has(g))continue;let v=d(T,H,q,J,I);if(v)W.set(v.moduleName,v)}for(let T of K){let g=J(T[1].source);if(!M.has(g)||G.has(g))continue;let v=d(T,K,q,J,I);if(v)X.set(v.filePath,v),B?.set(v.filePath,g)}}let A=Array.from(O.values());if(F0(A),!Z.dryRun)k?.save();let _=Z.resolveTypes?f5(W):[],y=Z.checkExamples?u5(X):[];if(_.length>0||y.length>0){let{TypeResolver:D}=await import("./chunk-fk94b2eb.js"),M=await D.create(z);try{if(_.length>0)await h5(_,M,J);if(y.length>0)await m5(y,M,J)}finally{await M?.dispose()}}let w=P5(X);if(w.length>0){await p();let D=X1();for(let{component:M,candidates:T}of w){let g=k1(J(M.filePath),T,D);v5(M,g)}}let F=R0(Array.from(X.values()).flatMap((D)=>D.diagnostics??[]));return{exports:Y,entryExports:U,components:W,allComponentsForTypes:X,errors:A,diagnostics:F,cache:k,resolvedPathByFilePath:B}}function P5(j){let $=[];for(let Z of j.values()){let Q=H0(Z)?.pendingCallDefaultCandidates?.filter((Y)=>Y.importSource!==void 0);if(!Q||Q.length===0)continue;$.push({component:Z,candidates:Q})}return $}function v5(j,$){for(let{candidate:Z,type:Q,failureReason:Y}of $){let z=(Z.location==="props"?j.props:j.moduleExports).find((J)=>J.name===Z.propName);if(z?.typeSource!=="unknown")continue;if(Q){if(z.type=Q,z.typeSource="typescript",Z.location==="props")j.diagnostics=(j.diagnostics??[]).filter((J)=>!(J.kind==="prop-unknown-type"&&J.name===Z.propName));continue}if(Z.location==="props"&&Y){let J=j.diagnostics?.find((U)=>U.kind==="prop-unknown-type"&&U.name===Z.propName);if(J)J.message=O1(Z,Y)}}}function f5(j){let $=[];for(let Z of j.values()){let Q=H0(Z);if(!Q?.canonicalPropsType||Z.props.length>0)continue;$.push({component:Z,metadata:Q})}return $}async function h5(j,$,Z){if(!$)return;let Q=await $.expandAll(j.map(({component:Y,metadata:K})=>({moduleName:Y.moduleName,metadata:K,filePath:Z(Y.filePath)})));for(let{component:Y}of j){let K=Q.get(Z(Y.filePath));if(K)B1(Y,K)}}function u5(j){let $=[];for(let Z of j.values()){let Q=ij(Z);if(Q.length===0)continue;$.push({component:Z,sources:Q})}return $}async function m5(j,$,Z){if(!$)return;let Q=await $.checkExamples(j.map(({component:Y,sources:K})=>({moduleName:Y.moduleName,filePath:Z(Y.filePath),sources:K})));for(let{component:Y,sources:K}of j){let z=Q.get(Z(Y.filePath));if(!z||z.length===0)continue;let J=new Map(K.map((H)=>[H.id,H.source])),U=Y.diagnostics??[];for(let H of z){let V=J.get(H.id);U.push({component:Y.filePath,kind:"example-compile-error",name:H.name,message:H.message,...V?{source:V}:{}})}Y.diagnostics=U}}import{existsSync as R1,readFileSync as c5}from"node:fs";import{join as M1}from"node:path";function N0(j){if(j){let Z=M1(process.cwd(),j);if(R1(Z))return Z0(j);return console.error(`Invalid entry point: ${Z}. Pass a valid --entry (or "entry" option), or unset it and`),console.error('set the "svelte" field in your package.json instead.'),null}let $=M1(process.cwd(),"package.json");if(!R1($))return console.error("Could not locate a package.json file."),console.error(`Specify an entry point with --entry (or the "entry" option) instead.
7
7
  `),null;try{let Z=nj(JSON.parse(c5($,"utf-8")));if(Z.svelte?.trim())return Z0(Z.svelte);return console.error(`Could not determine an entry point.
@@ -1,4 +1,4 @@
1
- import{$ as gZ,A as y,B as p,C as UZ,D as bQ,G as hZ,H as uQ,I as DZ,J as h,K as A,L as zQ,M as LQ,N as kZ,O as _Z,P as SZ,Q as qZ,R as YZ,S as WZ,T as BQ,U as KZ,V as HZ,W as TZ,Y as bZ,Z as OZ,_ as BZ,aa as fZ,ba as TQ,ca as FZ,ea as CZ,fa as o,ga as zZ,ha as NZ,v as nQ,w as VQ,x as s,y as EZ,z as pQ}from"./chunk-ck4qbyqp.js";import{ja as vZ}from"./chunk-5x7ma2jx.js";class OQ{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:(Q)=>this.replacement=Q}}replace(Q,Z,$,G){if(Q&&Z)if($!=null)Q[Z][$]=G;else Q[Z]=G}remove(Q,Z,$){if(Q&&Z)if($!==null&&$!==void 0)Q[Z].splice($,1);else delete Q[Z]}}class AQ extends OQ{constructor(Q,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=Q,this.leave=Z}visit(Q,Z,$,G){if(Q){if(this.enter){let q=this.should_skip,W=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let Y=this.should_skip,O=this.should_remove;if(this.should_skip=q,this.should_remove=W,this.replacement=K,Y)return Q;if(O)return null}let X;for(X in Q){let q=Q[X];if(q&&typeof q==="object"){if(Array.isArray(q)){let W=q;for(let K=0;K<W.length;K+=1){let Y=W[K];if(gQ(Y)){if(!this.visit(Y,Q,X,K))K--}}}else if(gQ(q))this.visit(q,Q,X,null)}}if(this.leave){let q=this.replacement,W=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let K=this.should_remove;if(this.replacement=q,this.should_remove=W,K)return null}}return Q}}function gQ(Q){return Q!==null&&typeof Q==="object"&&"type"in Q&&typeof Q.type==="string"}function v(Q,{enter:Z,leave:$}){return new AQ(Z,$).visit(Q,null)}var fQ={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 yZ(Q){return Q in fQ}function NQ(Q){if(yZ(Q))return fQ[Q];return"HTMLElement"}function PQ(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],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 m(Q,Z,$,G,X){Q.diagnosticRecords.push({component:Q.componentFilePath,kind:Z,name:$,message:G,...X?{source:X}:{}})}function GQ(Q,Z,$,G){if(LQ($)===void 0)return;if(Q.trackPropLocalName($),Z.props.has($)){let X=Z.props.get($);Z.props.set($,{...X,...G})}else Z.props.set($,G)}function l(Q,Z,$,G=0){let X,q,W=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:X,type:q,isFunction:W};let K=yQ(Q,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)?.replace(uQ," ");if(q=X,W=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let O=$;if(O.left&&typeof O.left==="object"&&"type"in O.left&&O.left.type==="Literal"&&"value"in O.left&&typeof O.left.value==="string")q="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")q=sQ($),X=vQ(Z,$)}else if($.type==="UnaryExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.argument){if(typeof Y.argument==="object"&&"type"in Y.argument&&Y.argument.type==="UnaryExpression")q=l(Q,Z,Y.argument).type;else if(typeof Y.argument==="object"&&"value"in Y.argument)q=typeof Y.argument.value}}else if($.type==="NewExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.callee&&typeof Y.callee==="object"&&"type"in Y.callee&&Y.callee.type==="Identifier"){let O=Y.callee.name;if(O==="Date")q="Date";else if(O==="Map")q="Map<any, any>";else if(O==="Set")q="Set<any>";else if(O==="WeakMap")q="WeakMap<object, any>";else if(O==="WeakSet")q="WeakSet<object>";else if(O==="Array")q="any[]";else if(O==="RegExp"||O==="Regexp")q="RegExp";else if(O==="Error")q="Error";else q=O}}else if($.type==="CallExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);let O=Y.callee,L=O&&typeof O==="object"&&"type"in O&&O.type==="Identifier"?O.name:void 0;if((L==="$derived"||L==="$state")&&Y.arguments.length===1&&G<5)return{...l(Q,Z,Y.arguments[0],G+1),value:X,defaultValue:K};if(L){let J=xZ(Q,Z,L);if(J)return{value:X,type:void 0,isFunction:!1,defaultValue:K,resolvedType:J};if(Z.funcDecls.has(L)||mZ(Z,L))return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L}};let B=Z.valueImportBindingsByLocalName.get(L);if(B)return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L,importSource:B.source,importedName:B.importedName}}}return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L??uZ(Z,O)}}}else if($.type==="Identifier"){let Y=$;if(G<5){let O=xQ(Z,Y.name);if(O){let L=l(Q,Z,O,G+1),J=Q.resolveLocalVarJSDoc(Y.name);return{...L,resolvedType:J?.type??L.resolvedType,resolvedDescription:J?.description??L.resolvedDescription,resolvedParams:J?.params??L.resolvedParams,resolvedReturnType:J?.returnType??L.resolvedReturnType}}if(Z.funcDecls.has(Y.name)){let L=Q.resolveLocalVarJSDoc(Y.name),J=Z.funcDecls.get(Y.name);return{value:J?vQ(Z,J):void 0,type:void 0,isFunction:!0,defaultValue:J?yQ(Q,Z,J):void 0,resolvedType:L?.type??cZ(L,J),resolvedDescription:L?.description,resolvedParams:L?.params,resolvedReturnType:L?.returnType}}}if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)}else if($.type==="MemberExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Q.isNumericConstant($))q="number"}else if($.type==="TemplateLiteral"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);q="string"}else if("raw"in $&&typeof $.raw==="string"){if(X=$.raw,"value"in $)q=$.value==null?void 0:typeof $.value}return{value:X,type:q,isFunction:W,defaultValue:K}}function xQ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init;return}function mQ(Q,Z){for(let $ of Q.vars){if($.kind!=="const")continue;for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init}return}function uZ(Q,Z){if(Z&&typeof Z==="object"&&"start"in Z&&"end"in Z&&typeof Z.start==="number"&&typeof Z.end==="number")return A(Q,Z.start,Z.end)??"call";return"call"}function xZ(Q,Z,$){let G=Q.resolveLocalVarJSDoc($);if(G?.returnType)return G.returnType;let X=Z.funcDecls.get($)??lQ(Z,$);if(!X)return;let q=dZ(Z,X);if(q)return q;let W=lZ(Z,$);if(W)return W;let K=dQ(X);return K==="any"?void 0:K}function mZ(Q,Z){return lQ(Q,Z)!==void 0}function lQ(Q,Z){let $=xQ(Q,Z);if(!$||typeof $!=="object"||!("type"in $))return;if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")return $;return}function lZ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations){let X=G.id;if(!X||typeof X!=="object"||!("type"in X)||X.type!=="Identifier"||!("name"in X)||X.name!==Z)continue;let q=X.typeAnnotation;if(q?.type!=="TSTypeAnnotation")return;let W=q.typeAnnotation;if(!W||typeof W.start!=="number"||typeof W.end!=="number")return;return sZ(A(Q,W.start,W.end))}return}function sZ(Q){if(!Q)return;let Z=Q.lastIndexOf("=>");if(Z===-1)return;return Q.slice(Z+2).trim()||void 0}function dZ(Q,Z){let $=Z.returnType;if($?.type!=="TSTypeAnnotation")return;let G=$.typeAnnotation;if(!G||typeof G.start!=="number"||typeof G.end!=="number")return;return A(Q,G.start,G.end)}function cZ(Q,Z){let $=Q?.returnType??"any",G=Q?.params;if(G&&G.length>0)return`(${G.map((q)=>`${q.name}${q.optional?"?":""}: ${q.type}`).join(", ")}) => ${$}`;if(Q?.returnType)return`() => ${$}`;if(Z)return sQ(Z);return"(...args: any[]) => any"}function sQ(Q){return`(${iZ(Q)}) => ${dQ(Q)}`}function iZ(Q){let Z=Q.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let G of Z)if(G&&typeof G==="object"&&"type"in G&&G.type==="Identifier"&&"name"in G&&typeof G.name==="string")$.push(`${G.name}: any`);else return"...args: any[]";return $.join(", ")}function dQ(Q){if(Q.async||Q.generator)return"any";let Z=Q.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=pZ(Z),$.length===0)return"any"}else $=[Z];let G=null;for(let X of $){let q=oZ(X);if(!q)return"any";if(G===null)G=q;else if(G!==q)return"any"}return G??"any"}function pZ(Q){let Z=[];return v(Q,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function oZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return null;switch(Q.type){case"Literal":{let Z=Q.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=Q.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 cQ(Q){if(y(Q,"$bindable"))return{init:Q.arguments[0],bindable:!0};return{init:Q,bindable:!1}}function rZ(Q,Z){let $=Z.params;if(!Array.isArray($)||$.length===0)return"";let G=$[0],X=$[$.length-1];if(typeof G.start!=="number"||typeof X.end!=="number")return"";return A(Q,G.start,X.end)??""}function vQ(Q,Z){if(Z.generator)return;let $=Z.body;if(!$||typeof $!=="object"||!("type"in $))return;let G=rZ(Q,Z),X=Z.async?"async ":"",q=(K,Y)=>K&&typeof K==="object"&&("type"in K)&&K.type==="ObjectExpression"?`(${Y})`:Y;if($.type!=="BlockStatement"){let K=zQ(Q,$);return K===void 0?void 0:`${X}(${G}) => ${q($,K)}`}let W=$.body;if(W.length===0)return`${X}(${G}) => {}`;if(W.length===1){let K=W[0];if(K&&typeof K==="object"&&"type"in K&&K.type==="ReturnStatement"){let Y=K.argument;if(Y){let O=zQ(Q,Y);if(O!==void 0)return`${X}(${G}) => ${q(Y,O)}`}}}return}function yQ(Q,Z,$){let G=zQ(Z,$);if(!G||!$||typeof $!=="object"||!("type"in $))return;let X="expression";if($.type==="Literal"||$.type==="UnaryExpression")X="literal";else if($.type==="TemplateLiteral")X=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")X="array";else if($.type==="ObjectExpression")X="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"||$.type==="FunctionDeclaration")X="function";let q={raw:G,kind:X};if(X==="literal"||X==="array"||X==="object"){let W=EQ(Q,$);if(W.ok)q.value=W.value}return q}function EQ(Q,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,G=$.argument;if(!G||typeof G!=="object"||!("type"in G)||G.type!=="Literal")return{ok:!1};let X=G.value;if(typeof X==="number"){if($.operator==="-")return{ok:!0,value:-X};if($.operator==="+")return{ok:!0,value:X}}if(typeof X==="boolean"&&$.operator==="!")return{ok:!0,value:!X};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,G=[];for(let X of $.elements){if(!X)return{ok:!1};let q=EQ(Q,X);if(!q.ok)return{ok:!1};G.push(q.value)}return{ok:!0,value:G}}if(Z.type==="ObjectExpression"){let $=Z,G={};for(let X of $.properties){if(X.type!=="Property"||X.computed)return{ok:!1};let q=Q.getPropertyName(X.key);if(!q)return{ok:!1};let W=EQ(Q,X.value);if(!W.ok)return{ok:!1};G[q]=W.value}return{ok:!0,value:G}}return{ok:!1}}var aZ=/[-_.:/\s]+/;function hQ(Q){return`${Q.split(aZ).map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join("")}Context`}function nZ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let X=[];if(!pQ($))return null;let q=$;for(let W of q.properties){if(W.type!=="Property")continue;let K=Z.getPropertyName(W.key);if(!K)continue;let Y="any",O;if(s(W.value)){let L=W.value.name,J=Z.findVariableTypeAndDescription(L);if(J)Y=J.type,O=J.description;else m(Q,"context-any-type",K,`Context "${G}" property "${K}" has no type annotation; defaulted to "any".`,h(Q,W))}else if(W.value&&typeof W.value==="object"&&"type"in W.value&&(W.value.type==="ArrowFunctionExpression"||W.value.type==="FunctionExpression"))Y=`(${W.value.params?.map((B)=>{if(s(B))return`${B.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(VQ(W.value))Y=W.value.value==null?"null":typeof W.value.value;X.push({name:K,type:Y,description:O,optional:!1})}return{key:G,typeName:hQ(G),properties:X,description:void 0}}else if(s($)){let X=$.name,q=Z.findVariableTypeAndDescription(X);if(q)return{key:G,typeName:hQ(G),properties:[{name:X,type:q.type,description:q.description,optional:!1}]};return m(Q,"context-any-type",X,`Context "${G}" variable "${X}" has no type annotation; defaulted to "any".`,h(Q,$)),{key:G,typeName:hQ(G),properties:[{name:X,type:"any",description:void 0,optional:!1}]}}return null}function iQ(Q){let Z=Q.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",G=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!G)return null;let X=Q.arguments[0];if(!X||typeof X!=="object"||!("type"in X))return"";if(X.type==="Literal"&&typeof X.value==="string")return X.value;if(X.type==="TemplateLiteral"&&X.quasis?.length===1)return X.quasis[0].value.cooked??"";return""}function oQ(Q,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let G=Z;if(G.type==="Literal")return typeof G.value==="string"?G.value:G.value==null?null:String(G.value);if(G.type==="TemplateLiteral"){if(G.quasis?.length===1){let X=G.quasis[0].value.cooked;return X==null?null:X}return null}if(G.type==="CallExpression"||G.type==="NewExpression")return iQ(G);if(G.type==="Identifier"){if($>=5)return null;let X=mQ(Q,G.name);if(X&&typeof X==="object"&&"type"in X){let q=X;if((q.type==="CallExpression"||q.type==="NewExpression")&&iQ(q)==="")return G.name;return oQ(Q,q,$+1)}return null}return null}function rQ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let X=$,q=X.arguments[0];if(!q)return;let W=oQ(Q,q);if(!W){let O=Q.componentFilePath?` in ${Q.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${O}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=X.arguments[1];if(!K)return;let Y=nZ(Q,Z,K,W);if(Y&&!Q.contexts.has(W))Q.contexts.set(W,Y)}function tZ({hasTypeScriptType:Q,hasJSDocType:Z,inferredType:$,finalType:G}){if(Q)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(G!==void 0)return"inferred";return"unknown"}function XQ(Q){let Z=Q.explicitType??Q.jsdocType??Q.resolvedType??Q.typeSeed,$=Q.jsdocParams??Q.resolvedParams,G=Q.jsdocReturnType??Q.resolvedReturnType;if(Q.isFunctionDeclaration&&Z==="() => any"&&G)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${G}`:`() => ${G}`;let X=Q.jsdocDescription??Q.resolvedDescription;if(X===void 0&&Z!==void 0)X=Q.typedefs?.get(Z)?.description;let q=tZ({hasTypeScriptType:Q.explicitType!==void 0,hasJSDocType:Q.jsdocType!==void 0||Q.jsdocParams!==void 0||Q.jsdocReturnType!==void 0||Q.resolvedType!==void 0,inferredType:Q.inferredTypeForSource,finalType:Z}),W=Q.initializerIsFunction||Q.isFunctionDeclaration||Q.inferIsFunctionFromTypeSignature===!0&&(!!Q.jsdocParams?.length||Q.jsdocReturnType!==void 0||!!Q.jsdocType?.includes("=>")||!!Q.resolvedType?.includes("=>")||!!Q.explicitType?.includes("=>"));return{type:Z,typeSource:q,description:X,params:$,returnType:G,isFunction:W}}function eZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return;let Z=String(Q.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in Q&&typeof Q.name==="string"?Q.name:void 0;if(!$)return;let G=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in Q&&typeof Q.tag==="string")G.thisValue=Q.tag;return G}function aQ(Q,Z){if(Q.rest_props!==void 0)return;let $=eZ(Z);if($)Q.rest_props=$}function k(Q,Z,$){if(!Z||Q.has(Z))return;Q.set(Z,$)}function JQ(Q,Z){for(let $=Q.activeScopes.length-1;$>=0;$-=1){let G=Q.activeScopes[$]?.get(Z);if(!G)continue;return G.kind==="prop"?G.publicPropName:void 0}return}function P(Q,Z=new Set){if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(Q.type){case"Identifier":Z.add(Q.name);break;case"AssignmentPattern":P(Q.left,Z);break;case"ArrayPattern":for(let $ of Q.elements)P($??void 0,Z);break;case"ObjectPattern":for(let $ of Q.properties)if($.type==="Property")P($.value,Z);else if($.type==="RestElement")P($.argument,Z);break;case"RestElement":P(Q.argument,Z);break}return Z}function kQ(Q,Z){let $=P(Z);if(!$)return;for(let G of $){let X=JQ(Q,G);if(X)Q.reactive_vars.add(X)}}function MQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;switch(String(Q.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function tQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;let Z=String(Q.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function Q0(Q,Z){let $=Q.scopeDeclarations.get(Z);if(!$)$=new Map,Q.scopeDeclarations.set(Z,$);return $}function Z0(Q,Z,$){let G=[];if($.id.type==="Identifier")return G.push({kind:"local",name:$.id.name}),G;if($.id.type!=="ObjectPattern")return G;for(let X of $.id.properties){if(X.type==="RestElement"){if(X.argument.type==="Identifier")G.push({kind:"local",name:X.argument.name});continue}if(X.computed)continue;let q=Q.getPropertyName(X.key);if(!q)continue;let W;if(X.value.type==="Identifier")W=X.value.name;else if(X.value.type==="AssignmentPattern"&&X.value.left.type==="Identifier")W=X.value.left.name;if(!W)continue;G.push({kind:"prop",name:W,publicPropName:q})}return G}function DQ(Q,Z,$,G,X){if(!nQ(Z))return;let q=X?.allowRunesProps??!1,W=X?.forceProp??!1,K=Z;for(let Y of K.declarations){if(q&&y(p(Y.init),"$props")){for(let J of Z0(Q,K,Y))k(J.kind==="prop"?$:G,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}let O=K.kind==="var"?G:$,L=W?"prop":"local";for(let J of P(Y.id))k(O,J,L==="prop"?{kind:"prop",publicPropName:J}:{kind:"local"})}}function $0(Q,Z){if("id"in Q&&Q.id&&typeof Q.id==="object"&&"name"in Q.id&&typeof Q.id.name==="string")k(Z,Q.id.name,{kind:"local"});for(let $ of Q.params)for(let G of P($))k(Z,G,{kind:"local"})}function G0(Q,Z,$,G){if(!Array.isArray(Z))return;for(let X of Z){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"VariableDeclaration":DQ(Q,X,$,G);break;case"FunctionDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break}}}function X0(Q,Z,$){if(!$||typeof $!=="object")return;let G="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!G||!("body"in G)||!Array.isArray(G.body))return;for(let X of G.body){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"ImportDeclaration":for(let q of X.specifiers??[])if(q.local?.name)k(Z.componentScope,q.local.name,{kind:"local"});break;case"VariableDeclaration":DQ(Q,X,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!X.declaration||typeof X.declaration!=="object"||!("type"in X.declaration))break;if(X.declaration.type==="VariableDeclaration")DQ(Q,X.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(X.declaration.type==="FunctionDeclaration"&&X.declaration.id?.name)k(Z.componentScope,X.declaration.id.name,{kind:"prop",publicPropName:X.declaration.id.name});break}}}function eQ(Q,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,X0(Q,Z,Z.parsed?.instance)}function QZ(Q){return{varScopeStack:[Q.componentScope]}}function ZZ(Q,Z,$,G){if(!MQ(G))return;let X=Q0(Z,G),q=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(G.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":$0(G,X);break;case"BlockStatement":G0(Q,G.body,X,q);break;case"CatchClause":if("param"in G)for(let K of P(G.param))k(X,K,{kind:"local"});break;case"EachBlock":{let K=G;for(let Y of P(K.context))k(X,Y,{kind:"local"});if(typeof K.index==="string")k(X,K.index,{kind:"local"});else if(K.index&&"name"in K.index)k(X,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in G)for(let K of P(G.value))k(X,K,{kind:"local"});break;case"CatchBlock":if("error"in G)for(let K of P(G.error))k(X,K,{kind:"local"});break}if(tQ(G))$.varScopeStack.push(X)}function $Z(Q,Z){if(tQ(Z))Q.varScopeStack.pop()}var U0=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function q0(Q,Z){switch(Z?.type){case"MemberExpression":return Z.computed||Q===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return Q===Z.meta;case"PropertyDefinition":return Z.computed||Q===Z.value;case"Property":return Z.computed||Q===Z.value;case"ExportSpecifier":case"ImportSpecifier":return Q===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function Y0(Q,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(Q))return!0;return!1}function W0(Q){let Z=new Set;if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=Q;if($.id?.name)Z.add($.id.name);for(let G of $.params??[])P(G,Z);break}case"BlockStatement":jQ(Q.body,Z);break;case"CatchClause":P(Q.param,Z);break;case"EachBlock":{let $=Q;if(P($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":P(Q.value,Z);break;case"CatchBlock":P(Q.error,Z);break}return Z}function jQ(Q,Z){if(!Array.isArray(Q))return;for(let $ of Q){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let G of $.specifiers??[])if(G.local?.name)Z.add(G.local.name);break;case"VariableDeclaration":for(let G of $.declarations??[])P(G.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let G=$.id?.name;if(G)Z.add(G);break}case"ExportNamedDeclaration":{let G=$.declaration;if(G&&typeof G==="object"&&"type"in G)jQ([G],Z);break}}}}function _Q(Q,Z){if(!Q||typeof Q!=="object")return!1;let $=[...Z],G=!1;return v(Q,{enter(X,q){if(G){this.skip();return}if(MQ(X))$.push(W0(X));if(q&&X.type==="Identifier"&&U0.has(X.name)&&!q.type.startsWith("TS")&&q0(X,q)&&!Y0(X.name,$))G=!0,this.skip()},leave(X){if(MQ(X))$.pop()}}),G}function GZ(Q){if(!Q||typeof Q!=="object")return;if("content"in Q){let Z=Q.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in Q&&Array.isArray(Q.body))return Q.body;return}function XZ(Q){if(Q.runesOptionOverride!==void 0)return Q.runesOptionOverride?"runes":"legacy";let Z=Q.parsed;if(!Z)return"legacy";let $=new Set;jQ(GZ(Z.module),$);let G=new Set;return jQ(GZ(Z.instance),G),_Q(Z.module,[$])||_Q(Z.instance,[$,G])||_Q(Z.html,[$,G])?"runes":"legacy"}var K0=/[A-Za-z_$][\w$]*/g;function H0(Q,Z,$){let G=new Map,X=Z.typeParameters?.params,q=$.typeArguments?.params;if(!X?.length||!q?.length)return G;for(let W=0;W<X.length;W++){let K=X[W]?.name,Y=q[W];if(!K||Y?.start===void 0||Y?.end===void 0)continue;let O=A(Q,Y.start,Y.end)?.trim();if(O)G.set(K,O)}return G}function O0(Q,Z){if(Z.size===0)return Q;return Q.replace(K0,($)=>Z.get($)??$)}function UQ(Q,Z,$,G,X=new Set){let q=new Map;if(!$?.type)return q;let W=(K)=>{for(let Y of K){if(Y?.type!=="TSPropertySignature"||Y.computed)continue;if(!Y.key)continue;let O=Q.getPropertyName(Y.key);if(!O)continue;let L=Y.typeAnnotation?.start,J=Y.typeAnnotation?.end;if(L===void 0||J===void 0)continue;let B=A(Z,L+1,J)?.trim();if(!B)continue;q.set(O,{type:B,optional:Y.optional===!0,source:h(Z,Y)})}};switch($.type){case"TSTypeLiteral":W($.members??[]);break;case"TSInterfaceDeclaration":W($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}case"TSTypeReference":{let K=WZ($.typeName);if(!K||X.has(K))break;let Y=G.get(K);if(!Y)break;X.add(K);let O=UQ(Q,Z,Y,G,X);X.delete(K);let L=H0(Z,Y,$);for(let[J,B]of O)q.set(J,L.size===0?B:{...B,type:O0(B.type,L)});break}case"TSIntersectionType":for(let K of $.types??[]){let Y=UQ(Q,Z,K,G,X);for(let[O,L]of Y)q.set(O,L)}break;case"TSParenthesizedType":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}}return q}function LZ(Q,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 G=$;Z.scriptLanguage=Q.resolveScriptLanguage(G),Z.customElementTag=G.options?.customElement?.tag,Z.runesOptionOverride=G.options?.runes,Z.scriptGenericsAttribute=Q.resolveScriptGenericsAttribute(G);let X=G.instance?.content?.body??[];for(let q of X){if(!q?.type)continue;if(q.type==="ImportDeclaration"&&q.source?.value)for(let W of q.specifiers??[]){let K=W.local?.name;if(!K)continue;if(!(q.importKind==="type"||W.importKind==="type"))continue;let O,L;if(W.type==="ImportSpecifier")O="named",L=W.imported?.type==="Identifier"?W.imported.name:typeof W.imported?.value==="string"?W.imported.value:void 0;else if(W.type==="ImportDefaultSpecifier")O="default";else if(W.type==="ImportNamespaceSpecifier")O="namespace";if(!O)continue;Z.typeImportBindingsByLocalName.set(K,{importedName:L,localName:K,source:String(q.source.value),specifierType:O})}if((q.type==="TSInterfaceDeclaration"||q.type==="TSTypeAliasDeclaration")&&q.id?.name&&q.start!==void 0&&q.end!==void 0)Z.localTypeDeclarationsByName.set(q.id.name,{code:A(Z,q.start,q.end)?.trim()??"",node:q,start:q.start});if(q.type==="ExportNamedDeclaration"&&q.declaration?.type==="VariableDeclaration")for(let W of q.declaration.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitPropTypesByName.set(W.id.name,K)}else if(q.type==="VariableDeclaration")for(let W of q.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitVariableTypesByName.set(W.id.name,K)}}for(let q of X){if(!q||typeof q!=="object"||!("declarations"in q))continue;for(let W of q.declarations??[]){if(!y(p(W.init),"$props"))continue;let K=W.id?.typeAnnotation?void 0:UZ(W.init),Y=W.id?.typeAnnotation?.typeAnnotation??K,O=W.id?.typeAnnotation?BQ(Z,W.id.typeAnnotation):KZ(Z,K),L=UQ(Q,Z,Y,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([T,f])=>[T,f.node]))),J=new Set,B=new Set;if(HZ(Z,Y,J,B),OZ(Z,J,B),W.start!==void 0){let T={canonicalType:O,props:L,referencedImportedTypes:J,referencedLocalTypes:B};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(W.start,T),O)Z.typedRunesPropsDeclarations.push(T)}}}}function VZ(Q,Z,$){for(let G of $.declarations){if(!y(p(G.init),"$props"))continue;if(G.id.type==="Identifier"){Z.wholePropsLocals.add(G.id.name),Z.restPropLocals.add(G.id.name);let W=qZ(Z,G.start);if(W)for(let[K,Y]of W.props)GQ(Q,Z,K,{name:K,kind:"let",type:Y.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!Y.optional,constant:!1,reactive:!1,source:Y.source});continue}if(G.id.type!=="ObjectPattern")continue;let X=o(Z,Q,$),q=G.id.properties.filter((W)=>{if(W.type!=="Property"||W.computed)return!1;if(!Q.getPropertyName(W.key))return!1;if(W.value.type==="Identifier")return!0;return W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier"}).length;for(let W of G.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Z.restPropLocals.add(W.argument.name);continue}let K=Q.getPropertyName(W.key);if(!K)continue;let Y,O;if(W.value.type==="Identifier")Y=W.value.name;else{let M=W.value;Y=M.left.name,O=M.right}if(!Y)continue;if(Q.trackPropLocalName(K,Y),K==="children")Z.snippetPropLocals.add(Y);let L=zZ(Z,Q,W)??(q===1?X:void 0),J=YZ(Z,G.start,K),{init:B,bindable:T}=cQ(O),f=B==null?{isFunction:!1}:l(Q,Z,B),{value:e,type:QQ,isFunction:qQ,defaultValue:RQ}=f,wQ=J?.type===void 0&&L?.type===void 0?f.resolvedType:void 0;if(f.pendingCallDefault)Z.pendingCallDefaultCandidates.push({propName:K,location:"props",...f.pendingCallDefault});let{type:IQ,typeSource:YQ,description:WQ,params:KQ,returnType:U,isFunction:H}=XQ({explicitType:J?.type,typeSeed:QQ,inferredTypeForSource:QQ,jsdocType:L?.type,jsdocDescription:L?.description,jsdocParams:L?.params,jsdocReturnType:L?.returnType,resolvedType:wQ,resolvedDescription:f.resolvedDescription,resolvedParams:f.resolvedParams,resolvedReturnType:f.resolvedReturnType,initializerIsFunction:qQ,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(T)Z.reactive_vars.add(K);GQ(Q,Z,K,{name:K,...Y===K?{}:{localName:Y},kind:"let",description:WQ,binding:L?.binding,deprecated:L?.deprecated,tags:L?.tags,...T?{bindable:!0}:{},type:IQ,typeSource:YQ,value:e,defaultValue:RQ,params:KQ,returnType:U,isFunction:H,isFunctionDeclaration:!1,isRequired:B==null&&J?.optional!==!0,constant:!1,reactive:T,source:h(Z,W)})}}}function JZ(Q,Z){if(Q.syntaxMode!=="runes")return;for(let[$,G]of Array.from(Q.events.entries())){if(G.type!=="dispatched")continue;if(Z.has($)||Q.forwardedEvents.has($))continue;let X=`on${$}`,q=Q.props.get(X);if(!q)continue;let W=q.type!==void 0||q.params!==void 0||q.returnType!==void 0,K=G.detail===void 0||G.detail==="undefined"||G.detail==="null"?"() => void":`(detail: ${G.detail}) => void`;Q.props.set(X,{...q,description:q.description??G.description,type:W?q.type:K,typeSource:W?q.typeSource:"inferred",isFunction:!0}),Q.events.delete($)}}var MZ=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function FQ(Q){if(!Q||typeof Q!=="object")return;v(Q,{enter(Z){if(!MZ.has(Z.type))return;let $=Z.expression;while($&&MZ.has($.type))$=$.expression;if($)this.replace($)}})}function CQ(Q,Z){let $=Z.source?.value;if(typeof $!=="string"||Z.importKind==="type")return;for(let G of Z.specifiers??[]){if(G.type!=="ImportSpecifier"||G.importKind==="type")continue;let X=G.local?.name;if(!X)continue;let q=G.imported?.name??(typeof G.imported?.value==="string"?G.imported.value:X);Q.valueImportBindingsByLocalName.set(X,{localName:X,importedName:q,source:$})}}function SQ(Q,Z){if(!Z)return;v(Z,{enter($){if($.type==="ImportDeclaration")CQ(Q,$);if($.type==="FunctionDeclaration"){let G=$;if(G.id?.name)Q.funcDecls.set(G.id.name,G)}}})}function RZ(Q,Z,$){let G=Z+1;while(G<Q.length){if(Q[G]==="\\"){G+=2;continue}if(Q[G]===$)return G+1;G++}return G}function wZ(Q,Z){let $=Z+1,G=0;while($<Q.length){let X=Q[$];if(X==="\\"){$+=2;continue}if(G===0){if(X==="`")return $+1;if(X==="$"&&Q[$+1]==="{"){G=1,$+=2;continue}$++;continue}if(X==="{")G++;else if(X==="}")G--;else if(X==='"'||X==="'"){$=RZ(Q,$,X);continue}else if(X==="`"){$=wZ(Q,$);continue}$++}return $}function z0(Q,Z){let $=[],G=Q.length,X=0;while(X<G){let q=Q[X];if(q==='"'||q==="'"){X=RZ(Q,X,q);continue}if(q==="`"){X=wZ(Q,X);continue}if(q==="/"&&Q[X+1]==="/"){let W=X+2;while(W<G&&Q[W]!==`
1
+ import{$ as gZ,A as y,B as p,C as UZ,D as bQ,G as hZ,H as uQ,I as DZ,J as h,K as A,L as zQ,M as LQ,N as kZ,O as _Z,P as SZ,Q as qZ,R as YZ,S as WZ,T as BQ,U as KZ,V as HZ,W as TZ,Y as bZ,Z as OZ,_ as BZ,aa as fZ,ba as TQ,ca as FZ,ea as CZ,fa as o,ga as zZ,ha as NZ,v as nQ,w as VQ,x as s,y as EZ,z as pQ}from"./chunk-4ndm4k55.js";import{ja as vZ}from"./chunk-5x7ma2jx.js";class OQ{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:(Q)=>this.replacement=Q}}replace(Q,Z,$,G){if(Q&&Z)if($!=null)Q[Z][$]=G;else Q[Z]=G}remove(Q,Z,$){if(Q&&Z)if($!==null&&$!==void 0)Q[Z].splice($,1);else delete Q[Z]}}class AQ extends OQ{constructor(Q,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=Q,this.leave=Z}visit(Q,Z,$,G){if(Q){if(this.enter){let q=this.should_skip,W=this.should_remove,K=this.replacement;if(this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let Y=this.should_skip,O=this.should_remove;if(this.should_skip=q,this.should_remove=W,this.replacement=K,Y)return Q;if(O)return null}let X;for(X in Q){let q=Q[X];if(q&&typeof q==="object"){if(Array.isArray(q)){let W=q;for(let K=0;K<W.length;K+=1){let Y=W[K];if(gQ(Y)){if(!this.visit(Y,Q,X,K))K--}}}else if(gQ(q))this.visit(q,Q,X,null)}}if(this.leave){let q=this.replacement,W=this.should_remove;if(this.replacement=null,this.should_remove=!1,this.leave.call(this.context,Q,Z,$,G),this.replacement)Q=this.replacement,this.replace(Z,$,G,Q);if(this.should_remove)this.remove(Z,$,G);let K=this.should_remove;if(this.replacement=q,this.should_remove=W,K)return null}}return Q}}function gQ(Q){return Q!==null&&typeof Q==="object"&&"type"in Q&&typeof Q.type==="string"}function v(Q,{enter:Z,leave:$}){return new AQ(Z,$).visit(Q,null)}var fQ={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 yZ(Q){return Q in fQ}function NQ(Q){if(yZ(Q))return fQ[Q];return"HTMLElement"}function PQ(){return{syntaxMode:"legacy",scriptLanguage:void 0,source:void 0,parsed:void 0,runesOptionOverride:void 0,sourceLineStartOffsetsCache:void 0,rest_props:void 0,extends:void 0,customElementTag:void 0,componentComment:void 0,componentCommentSource:void 0,generics:null,scriptGenericsAttribute:void 0,diagnosticRecords:[],componentFilePath:"",props:new Map,moduleExports:new Map,propLocalToPublicName:new Map,reactive_vars:new Set,funcDecls:new Map,vars:new Set,valueImportBindingsByLocalName:new Map,pendingCallDefaultCandidates:[],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 m(Q,Z,$,G,X){Q.diagnosticRecords.push({component:Q.componentFilePath,kind:Z,name:$,message:G,...X?{source:X}:{}})}function GQ(Q,Z,$,G){if(LQ($)===void 0)return;if(Q.trackPropLocalName($),Z.props.has($)){let X=Z.props.get($);Z.props.set($,{...X,...G})}else Z.props.set($,G)}function l(Q,Z,$,G=0){let X,q,W=!1;if(!$||typeof $!=="object"||!("type"in $))return{value:X,type:q,isFunction:W};let K=yQ(Q,Z,$);if($.type==="ObjectExpression"||$.type==="BinaryExpression"||$.type==="ArrayExpression"||$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)?.replace(uQ," ");if(q=X,W=$.type==="ArrowFunctionExpression"||$.type==="FunctionExpression",$.type==="BinaryExpression"){let O=$;if(O.left&&typeof O.left==="object"&&"type"in O.left&&O.left.type==="Literal"&&"value"in O.left&&typeof O.left.value==="string")q="string"}if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")q=sQ($),X=vQ(Z,$)}else if($.type==="UnaryExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.argument){if(typeof Y.argument==="object"&&"type"in Y.argument&&Y.argument.type==="UnaryExpression")q=l(Q,Z,Y.argument).type;else if(typeof Y.argument==="object"&&"value"in Y.argument)q=typeof Y.argument.value}}else if($.type==="NewExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Y.callee&&typeof Y.callee==="object"&&"type"in Y.callee&&Y.callee.type==="Identifier"){let O=Y.callee.name;if(O==="Date")q="Date";else if(O==="Map")q="Map<any, any>";else if(O==="Set")q="Set<any>";else if(O==="WeakMap")q="WeakMap<object, any>";else if(O==="WeakSet")q="WeakSet<object>";else if(O==="Array")q="any[]";else if(O==="RegExp"||O==="Regexp")q="RegExp";else if(O==="Error")q="Error";else q=O}}else if($.type==="CallExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);let O=Y.callee,L=O&&typeof O==="object"&&"type"in O&&O.type==="Identifier"?O.name:void 0;if((L==="$derived"||L==="$state")&&Y.arguments.length===1&&G<5)return{...l(Q,Z,Y.arguments[0],G+1),value:X,defaultValue:K};if(L){let J=xZ(Q,Z,L);if(J)return{value:X,type:void 0,isFunction:!1,defaultValue:K,resolvedType:J};if(Z.funcDecls.has(L)||mZ(Z,L))return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L}};let B=Z.valueImportBindingsByLocalName.get(L);if(B)return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L,importSource:B.source,importedName:B.importedName}}}return{value:X,type:void 0,isFunction:!1,defaultValue:K,pendingCallDefault:{calleeName:L??uZ(Z,O)}}}else if($.type==="Identifier"){let Y=$;if(G<5){let O=xQ(Z,Y.name);if(O){let L=l(Q,Z,O,G+1),J=Q.resolveLocalVarJSDoc(Y.name);return{...L,resolvedType:J?.type??L.resolvedType,resolvedDescription:J?.description??L.resolvedDescription,resolvedParams:J?.params??L.resolvedParams,resolvedReturnType:J?.returnType??L.resolvedReturnType}}if(Z.funcDecls.has(Y.name)){let L=Q.resolveLocalVarJSDoc(Y.name),J=Z.funcDecls.get(Y.name);return{value:J?vQ(Z,J):void 0,type:void 0,isFunction:!0,defaultValue:J?yQ(Q,Z,J):void 0,resolvedType:L?.type??cZ(L,J),resolvedDescription:L?.description,resolvedParams:L?.params,resolvedReturnType:L?.returnType}}}if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end)}else if($.type==="MemberExpression"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);if(Q.isNumericConstant($))q="number"}else if($.type==="TemplateLiteral"){let Y=$;if("start"in Y&&"end"in Y&&typeof Y.start==="number"&&typeof Y.end==="number")X=A(Z,Y.start,Y.end);q="string"}else if("raw"in $&&typeof $.raw==="string"){if(X=$.raw,"value"in $)q=$.value==null?void 0:typeof $.value}return{value:X,type:q,isFunction:W,defaultValue:K}}function xQ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init;return}function mQ(Q,Z){for(let $ of Q.vars){if($.kind!=="const")continue;for(let G of $.declarations)if(G.id&&typeof G.id==="object"&&"type"in G.id&&G.id.type==="Identifier"&&"name"in G.id&&G.id.name===Z&&G.init)return G.init}return}function uZ(Q,Z){if(Z&&typeof Z==="object"&&"start"in Z&&"end"in Z&&typeof Z.start==="number"&&typeof Z.end==="number")return A(Q,Z.start,Z.end)??"call";return"call"}function xZ(Q,Z,$){let G=Q.resolveLocalVarJSDoc($);if(G?.returnType)return G.returnType;let X=Z.funcDecls.get($)??lQ(Z,$);if(!X)return;let q=dZ(Z,X);if(q)return q;let W=lZ(Z,$);if(W)return W;let K=dQ(X);return K==="any"?void 0:K}function mZ(Q,Z){return lQ(Q,Z)!==void 0}function lQ(Q,Z){let $=xQ(Q,Z);if(!$||typeof $!=="object"||!("type"in $))return;if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression")return $;return}function lZ(Q,Z){for(let $ of Q.vars)for(let G of $.declarations){let X=G.id;if(!X||typeof X!=="object"||!("type"in X)||X.type!=="Identifier"||!("name"in X)||X.name!==Z)continue;let q=X.typeAnnotation;if(q?.type!=="TSTypeAnnotation")return;let W=q.typeAnnotation;if(!W||typeof W.start!=="number"||typeof W.end!=="number")return;return sZ(A(Q,W.start,W.end))}return}function sZ(Q){if(!Q)return;let Z=Q.lastIndexOf("=>");if(Z===-1)return;return Q.slice(Z+2).trim()||void 0}function dZ(Q,Z){let $=Z.returnType;if($?.type!=="TSTypeAnnotation")return;let G=$.typeAnnotation;if(!G||typeof G.start!=="number"||typeof G.end!=="number")return;return A(Q,G.start,G.end)}function cZ(Q,Z){let $=Q?.returnType??"any",G=Q?.params;if(G&&G.length>0)return`(${G.map((q)=>`${q.name}${q.optional?"?":""}: ${q.type}`).join(", ")}) => ${$}`;if(Q?.returnType)return`() => ${$}`;if(Z)return sQ(Z);return"(...args: any[]) => any"}function sQ(Q){return`(${iZ(Q)}) => ${dQ(Q)}`}function iZ(Q){let Z=Q.params;if(!Array.isArray(Z)||Z.length===0)return"...args: any[]";let $=[];for(let G of Z)if(G&&typeof G==="object"&&"type"in G&&G.type==="Identifier"&&"name"in G&&typeof G.name==="string")$.push(`${G.name}: any`);else return"...args: any[]";return $.join(", ")}function dQ(Q){if(Q.async||Q.generator)return"any";let Z=Q.body,$;if(Z&&typeof Z==="object"&&"type"in Z&&Z.type==="BlockStatement"){if($=pZ(Z),$.length===0)return"any"}else $=[Z];let G=null;for(let X of $){let q=oZ(X);if(!q)return"any";if(G===null)G=q;else if(G!==q)return"any"}return G??"any"}function pZ(Q){let Z=[];return v(Q,{enter($){if($.type==="FunctionDeclaration"||$.type==="FunctionExpression"||$.type==="ArrowFunctionExpression"){this.skip();return}if($.type==="ReturnStatement")Z.push($.argument??null)}}),Z}function oZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return null;switch(Q.type){case"Literal":{let Z=Q.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=Q.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 cQ(Q){if(y(Q,"$bindable"))return{init:Q.arguments[0],bindable:!0};return{init:Q,bindable:!1}}function rZ(Q,Z){let $=Z.params;if(!Array.isArray($)||$.length===0)return"";let G=$[0],X=$[$.length-1];if(typeof G.start!=="number"||typeof X.end!=="number")return"";return A(Q,G.start,X.end)??""}function vQ(Q,Z){if(Z.generator)return;let $=Z.body;if(!$||typeof $!=="object"||!("type"in $))return;let G=rZ(Q,Z),X=Z.async?"async ":"",q=(K,Y)=>K&&typeof K==="object"&&("type"in K)&&K.type==="ObjectExpression"?`(${Y})`:Y;if($.type!=="BlockStatement"){let K=zQ(Q,$);return K===void 0?void 0:`${X}(${G}) => ${q($,K)}`}let W=$.body;if(W.length===0)return`${X}(${G}) => {}`;if(W.length===1){let K=W[0];if(K&&typeof K==="object"&&"type"in K&&K.type==="ReturnStatement"){let Y=K.argument;if(Y){let O=zQ(Q,Y);if(O!==void 0)return`${X}(${G}) => ${q(Y,O)}`}}}return}function yQ(Q,Z,$){let G=zQ(Z,$);if(!G||!$||typeof $!=="object"||!("type"in $))return;let X="expression";if($.type==="Literal"||$.type==="UnaryExpression")X="literal";else if($.type==="TemplateLiteral")X=$.expressions.length===0?"literal":"expression";else if($.type==="ArrayExpression")X="array";else if($.type==="ObjectExpression")X="object";else if($.type==="ArrowFunctionExpression"||$.type==="FunctionExpression"||$.type==="FunctionDeclaration")X="function";let q={raw:G,kind:X};if(X==="literal"||X==="array"||X==="object"){let W=EQ(Q,$);if(W.ok)q.value=W.value}return q}function EQ(Q,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,G=$.argument;if(!G||typeof G!=="object"||!("type"in G)||G.type!=="Literal")return{ok:!1};let X=G.value;if(typeof X==="number"){if($.operator==="-")return{ok:!0,value:-X};if($.operator==="+")return{ok:!0,value:X}}if(typeof X==="boolean"&&$.operator==="!")return{ok:!0,value:!X};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,G=[];for(let X of $.elements){if(!X)return{ok:!1};let q=EQ(Q,X);if(!q.ok)return{ok:!1};G.push(q.value)}return{ok:!0,value:G}}if(Z.type==="ObjectExpression"){let $=Z,G={};for(let X of $.properties){if(X.type!=="Property"||X.computed)return{ok:!1};let q=Q.getPropertyName(X.key);if(!q)return{ok:!1};let W=EQ(Q,X.value);if(!W.ok)return{ok:!1};G[q]=W.value}return{ok:!0,value:G}}return{ok:!1}}var aZ=/[-_.:/\s]+/;function hQ(Q){return`${Q.split(aZ).map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join("")}Context`}function nZ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $))return null;if($.type==="ObjectExpression"){let X=[];if(!pQ($))return null;let q=$;for(let W of q.properties){if(W.type!=="Property")continue;let K=Z.getPropertyName(W.key);if(!K)continue;let Y="any",O;if(s(W.value)){let L=W.value.name,J=Z.findVariableTypeAndDescription(L);if(J)Y=J.type,O=J.description;else m(Q,"context-any-type",K,`Context "${G}" property "${K}" has no type annotation; defaulted to "any".`,h(Q,W))}else if(W.value&&typeof W.value==="object"&&"type"in W.value&&(W.value.type==="ArrowFunctionExpression"||W.value.type==="FunctionExpression"))Y=`(${W.value.params?.map((B)=>{if(s(B))return`${B.name||"arg"}: any`;return"arg: any"}).join(", ")||""}) => any`;else if(VQ(W.value))Y=W.value.value==null?"null":typeof W.value.value;X.push({name:K,type:Y,description:O,optional:!1})}return{key:G,typeName:hQ(G),properties:X,description:void 0}}else if(s($)){let X=$.name,q=Z.findVariableTypeAndDescription(X);if(q)return{key:G,typeName:hQ(G),properties:[{name:X,type:q.type,description:q.description,optional:!1}]};return m(Q,"context-any-type",X,`Context "${G}" variable "${X}" has no type annotation; defaulted to "any".`,h(Q,$)),{key:G,typeName:hQ(G),properties:[{name:X,type:"any",description:void 0,optional:!1}]}}return null}function iQ(Q){let Z=Q.callee;if(!Z||typeof Z!=="object"||!("type"in Z))return null;let $=Z.type==="Identifier"&&Z.name==="Symbol",G=Z.type==="MemberExpression"&&!Z.computed&&Z.object.type==="Identifier"&&Z.object.name==="Symbol"&&Z.property.type==="Identifier"&&Z.property.name==="for";if(!$&&!G)return null;let X=Q.arguments[0];if(!X||typeof X!=="object"||!("type"in X))return"";if(X.type==="Literal"&&typeof X.value==="string")return X.value;if(X.type==="TemplateLiteral"&&X.quasis?.length===1)return X.quasis[0].value.cooked??"";return""}function oQ(Q,Z,$=0){if(!Z||typeof Z!=="object"||!("type"in Z))return null;let G=Z;if(G.type==="Literal")return typeof G.value==="string"?G.value:G.value==null?null:String(G.value);if(G.type==="TemplateLiteral"){if(G.quasis?.length===1){let X=G.quasis[0].value.cooked;return X==null?null:X}return null}if(G.type==="CallExpression"||G.type==="NewExpression")return iQ(G);if(G.type==="Identifier"){if($>=5)return null;let X=mQ(Q,G.name);if(X&&typeof X==="object"&&"type"in X){let q=X;if((q.type==="CallExpression"||q.type==="NewExpression")&&iQ(q)==="")return G.name;return oQ(Q,q,$+1)}return null}return null}function rQ(Q,Z,$,G){if(!$||typeof $!=="object"||!("type"in $)||$.type!=="CallExpression")return;let X=$,q=X.arguments[0];if(!q)return;let W=oQ(Q,q);if(!W){let O=Q.componentFilePath?` in ${Q.componentFilePath}`:"";console.warn(`Warning: Could not resolve setContext key${O}. Use a string literal, const-bound string, or Symbol(). Skipping context type generation.`);return}let K=X.arguments[1];if(!K)return;let Y=nZ(Q,Z,K,W);if(Y&&!Q.contexts.has(W))Q.contexts.set(W,Y)}function tZ({hasTypeScriptType:Q,hasJSDocType:Z,inferredType:$,finalType:G}){if(Q)return"typescript";if(Z)return"jsdoc";if($!==void 0)return"default";if(G!==void 0)return"inferred";return"unknown"}function XQ(Q){let Z=Q.explicitType??Q.jsdocType??Q.resolvedType??Q.typeSeed,$=Q.jsdocParams??Q.resolvedParams,G=Q.jsdocReturnType??Q.resolvedReturnType;if(Q.isFunctionDeclaration&&Z==="() => any"&&G)Z=$&&$.length>0?`(${$.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}) => ${G}`:`() => ${G}`;let X=Q.jsdocDescription??Q.resolvedDescription;if(X===void 0&&Z!==void 0)X=Q.typedefs?.get(Z)?.description;let q=tZ({hasTypeScriptType:Q.explicitType!==void 0,hasJSDocType:Q.jsdocType!==void 0||Q.jsdocParams!==void 0||Q.jsdocReturnType!==void 0||Q.resolvedType!==void 0,inferredType:Q.inferredTypeForSource,finalType:Z}),W=Q.initializerIsFunction||Q.isFunctionDeclaration||Q.inferIsFunctionFromTypeSignature===!0&&(!!Q.jsdocParams?.length||Q.jsdocReturnType!==void 0||!!Q.jsdocType?.includes("=>")||!!Q.resolvedType?.includes("=>")||!!Q.explicitType?.includes("=>"));return{type:Z,typeSource:q,description:X,params:$,returnType:G,isFunction:W}}function eZ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return;let Z=String(Q.type);if(Z!=="InlineComponent"&&Z!=="Element")return;let $="name"in Q&&typeof Q.name==="string"?Q.name:void 0;if(!$)return;let G=Z==="InlineComponent"?{type:"InlineComponent",name:$}:{type:"Element",name:$};if(Z==="Element"&&$==="svelte:element"&&"tag"in Q&&typeof Q.tag==="string")G.thisValue=Q.tag;return G}function aQ(Q,Z){if(Q.rest_props!==void 0)return;let $=eZ(Z);if($)Q.rest_props=$}function k(Q,Z,$){if(!Z||Q.has(Z))return;Q.set(Z,$)}function JQ(Q,Z){for(let $=Q.activeScopes.length-1;$>=0;$-=1){let G=Q.activeScopes[$]?.get(Z);if(!G)continue;return G.kind==="prop"?G.publicPropName:void 0}return}function P(Q,Z=new Set){if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(Q.type){case"Identifier":Z.add(Q.name);break;case"AssignmentPattern":P(Q.left,Z);break;case"ArrayPattern":for(let $ of Q.elements)P($??void 0,Z);break;case"ObjectPattern":for(let $ of Q.properties)if($.type==="Property")P($.value,Z);else if($.type==="RestElement")P($.argument,Z);break;case"RestElement":P(Q.argument,Z);break}return Z}function kQ(Q,Z){let $=P(Z);if(!$)return;for(let G of $){let X=JQ(Q,G);if(X)Q.reactive_vars.add(X)}}function MQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;switch(String(Q.type)){case"BlockStatement":case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"CatchClause":case"EachBlock":case"ThenBlock":case"CatchBlock":return!0;default:return!1}}function tQ(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;let Z=String(Q.type);return Z==="FunctionDeclaration"||Z==="FunctionExpression"||Z==="ArrowFunctionExpression"}function Q0(Q,Z){let $=Q.scopeDeclarations.get(Z);if(!$)$=new Map,Q.scopeDeclarations.set(Z,$);return $}function Z0(Q,Z,$){let G=[];if($.id.type==="Identifier")return G.push({kind:"local",name:$.id.name}),G;if($.id.type!=="ObjectPattern")return G;for(let X of $.id.properties){if(X.type==="RestElement"){if(X.argument.type==="Identifier")G.push({kind:"local",name:X.argument.name});continue}if(X.computed)continue;let q=Q.getPropertyName(X.key);if(!q)continue;let W;if(X.value.type==="Identifier")W=X.value.name;else if(X.value.type==="AssignmentPattern"&&X.value.left.type==="Identifier")W=X.value.left.name;if(!W)continue;G.push({kind:"prop",name:W,publicPropName:q})}return G}function DQ(Q,Z,$,G,X){if(!nQ(Z))return;let q=X?.allowRunesProps??!1,W=X?.forceProp??!1,K=Z;for(let Y of K.declarations){if(q&&y(p(Y.init),"$props")){for(let J of Z0(Q,K,Y))k(J.kind==="prop"?$:G,J.name,J.kind==="prop"?{kind:"prop",publicPropName:J.publicPropName}:{kind:"local"});continue}let O=K.kind==="var"?G:$,L=W?"prop":"local";for(let J of P(Y.id))k(O,J,L==="prop"?{kind:"prop",publicPropName:J}:{kind:"local"})}}function $0(Q,Z){if("id"in Q&&Q.id&&typeof Q.id==="object"&&"name"in Q.id&&typeof Q.id.name==="string")k(Z,Q.id.name,{kind:"local"});for(let $ of Q.params)for(let G of P($))k(Z,G,{kind:"local"})}function G0(Q,Z,$,G){if(!Array.isArray(Z))return;for(let X of Z){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"VariableDeclaration":DQ(Q,X,$,G);break;case"FunctionDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k($,X.id.name,{kind:"local"});break}}}function X0(Q,Z,$){if(!$||typeof $!=="object")return;let G="content"in $&&$.content&&typeof $.content==="object"&&"body"in $.content&&Array.isArray($.content.body)?$.content:("body"in $)&&Array.isArray($.body)?$:void 0;if(!G||!("body"in G)||!Array.isArray(G.body))return;for(let X of G.body){if(!X||typeof X!=="object"||!("type"in X))continue;switch(X.type){case"ImportDeclaration":for(let q of X.specifiers??[])if(q.local?.name)k(Z.componentScope,q.local.name,{kind:"local"});break;case"VariableDeclaration":DQ(Q,X,Z.componentScope,Z.componentScope,{allowRunesProps:!0});break;case"FunctionDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ClassDeclaration":if(X.id?.name)k(Z.componentScope,X.id.name,{kind:"local"});break;case"ExportNamedDeclaration":if(!X.declaration||typeof X.declaration!=="object"||!("type"in X.declaration))break;if(X.declaration.type==="VariableDeclaration")DQ(Q,X.declaration,Z.componentScope,Z.componentScope,{forceProp:!0});else if(X.declaration.type==="FunctionDeclaration"&&X.declaration.id?.name)k(Z.componentScope,X.declaration.id.name,{kind:"prop",publicPropName:X.declaration.id.name});break}}}function eQ(Q,Z){Z.componentScope.clear(),Z.scopeDeclarations=new WeakMap,Z.activeScopes.length=0,X0(Q,Z,Z.parsed?.instance)}function QZ(Q){return{varScopeStack:[Q.componentScope]}}function ZZ(Q,Z,$,G){if(!MQ(G))return;let X=Q0(Z,G),q=$.varScopeStack[$.varScopeStack.length-1]??Z.componentScope;switch(String(G.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":$0(G,X);break;case"BlockStatement":G0(Q,G.body,X,q);break;case"CatchClause":if("param"in G)for(let K of P(G.param))k(X,K,{kind:"local"});break;case"EachBlock":{let K=G;for(let Y of P(K.context))k(X,Y,{kind:"local"});if(typeof K.index==="string")k(X,K.index,{kind:"local"});else if(K.index&&"name"in K.index)k(X,K.index.name,{kind:"local"});break}case"ThenBlock":if("value"in G)for(let K of P(G.value))k(X,K,{kind:"local"});break;case"CatchBlock":if("error"in G)for(let K of P(G.error))k(X,K,{kind:"local"});break}if(tQ(G))$.varScopeStack.push(X)}function $Z(Q,Z){if(tQ(Z))Q.varScopeStack.pop()}var U0=new Set(["$state","$derived","$effect","$props","$bindable","$inspect","$host"]);function q0(Q,Z){switch(Z?.type){case"MemberExpression":return Z.computed||Q===Z.object;case"MethodDefinition":return!!Z.computed;case"MetaProperty":return Q===Z.meta;case"PropertyDefinition":return Z.computed||Q===Z.value;case"Property":return Z.computed||Q===Z.value;case"ExportSpecifier":case"ImportSpecifier":return Q===Z.local;case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;default:return!0}}function Y0(Q,Z){for(let $=Z.length-1;$>=0;$-=1)if(Z[$]?.has(Q))return!0;return!1}function W0(Q){let Z=new Set;if(!Q||typeof Q!=="object"||!("type"in Q))return Z;switch(String(Q.type)){case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":{let $=Q;if($.id?.name)Z.add($.id.name);for(let G of $.params??[])P(G,Z);break}case"BlockStatement":jQ(Q.body,Z);break;case"CatchClause":P(Q.param,Z);break;case"EachBlock":{let $=Q;if(P($.context,Z),typeof $.index==="string")Z.add($.index);else if($.index?.name)Z.add($.index.name);break}case"ThenBlock":P(Q.value,Z);break;case"CatchBlock":P(Q.error,Z);break}return Z}function jQ(Q,Z){if(!Array.isArray(Q))return;for(let $ of Q){if(!$||typeof $!=="object"||!("type"in $))continue;switch(String($.type)){case"ImportDeclaration":for(let G of $.specifiers??[])if(G.local?.name)Z.add(G.local.name);break;case"VariableDeclaration":for(let G of $.declarations??[])P(G.id,Z);break;case"FunctionDeclaration":case"ClassDeclaration":{let G=$.id?.name;if(G)Z.add(G);break}case"ExportNamedDeclaration":{let G=$.declaration;if(G&&typeof G==="object"&&"type"in G)jQ([G],Z);break}}}}function _Q(Q,Z){if(!Q||typeof Q!=="object")return!1;let $=[...Z],G=!1;return v(Q,{enter(X,q){if(G){this.skip();return}if(MQ(X))$.push(W0(X));if(q&&X.type==="Identifier"&&U0.has(X.name)&&!q.type.startsWith("TS")&&q0(X,q)&&!Y0(X.name,$))G=!0,this.skip()},leave(X){if(MQ(X))$.pop()}}),G}function GZ(Q){if(!Q||typeof Q!=="object")return;if("content"in Q){let Z=Q.content,$=Z&&typeof Z==="object"&&"body"in Z?Z.body:void 0;if(Array.isArray($))return $}if("body"in Q&&Array.isArray(Q.body))return Q.body;return}function XZ(Q){if(Q.runesOptionOverride!==void 0)return Q.runesOptionOverride?"runes":"legacy";let Z=Q.parsed;if(!Z)return"legacy";let $=new Set;jQ(GZ(Z.module),$);let G=new Set;return jQ(GZ(Z.instance),G),_Q(Z.module,[$])||_Q(Z.instance,[$,G])||_Q(Z.html,[$,G])?"runes":"legacy"}var K0=/[A-Za-z_$][\w$]*/g;function H0(Q,Z,$){let G=new Map,X=Z.typeParameters?.params,q=$.typeArguments?.params;if(!X?.length||!q?.length)return G;for(let W=0;W<X.length;W++){let K=X[W]?.name,Y=q[W];if(!K||Y?.start===void 0||Y?.end===void 0)continue;let O=A(Q,Y.start,Y.end)?.trim();if(O)G.set(K,O)}return G}function O0(Q,Z){if(Z.size===0)return Q;return Q.replace(K0,($)=>Z.get($)??$)}function UQ(Q,Z,$,G,X=new Set){let q=new Map;if(!$?.type)return q;let W=(K)=>{for(let Y of K){if(Y?.type!=="TSPropertySignature"||Y.computed)continue;if(!Y.key)continue;let O=Q.getPropertyName(Y.key);if(!O)continue;let L=Y.typeAnnotation?.start,J=Y.typeAnnotation?.end;if(L===void 0||J===void 0)continue;let B=A(Z,L+1,J)?.trim();if(!B)continue;q.set(O,{type:B,optional:Y.optional===!0,source:h(Z,Y)})}};switch($.type){case"TSTypeLiteral":W($.members??[]);break;case"TSInterfaceDeclaration":W($.body?.body??[]);break;case"TSTypeAliasDeclaration":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}case"TSTypeReference":{let K=WZ($.typeName);if(!K||X.has(K))break;let Y=G.get(K);if(!Y)break;X.add(K);let O=UQ(Q,Z,Y,G,X);X.delete(K);let L=H0(Z,Y,$);for(let[J,B]of O)q.set(J,L.size===0?B:{...B,type:O0(B.type,L)});break}case"TSIntersectionType":for(let K of $.types??[]){let Y=UQ(Q,Z,K,G,X);for(let[O,L]of Y)q.set(O,L)}break;case"TSParenthesizedType":{let K=UQ(Q,Z,$.typeAnnotation,G,X);for(let[Y,O]of K)q.set(Y,O);break}}return q}function LZ(Q,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 G=$;Z.scriptLanguage=Q.resolveScriptLanguage(G),Z.customElementTag=G.options?.customElement?.tag,Z.runesOptionOverride=G.options?.runes,Z.scriptGenericsAttribute=Q.resolveScriptGenericsAttribute(G);let X=G.instance?.content?.body??[];for(let q of X){if(!q?.type)continue;if(q.type==="ImportDeclaration"&&q.source?.value)for(let W of q.specifiers??[]){let K=W.local?.name;if(!K)continue;if(!(q.importKind==="type"||W.importKind==="type"))continue;let O,L;if(W.type==="ImportSpecifier")O="named",L=W.imported?.type==="Identifier"?W.imported.name:typeof W.imported?.value==="string"?W.imported.value:void 0;else if(W.type==="ImportDefaultSpecifier")O="default";else if(W.type==="ImportNamespaceSpecifier")O="namespace";if(!O)continue;Z.typeImportBindingsByLocalName.set(K,{importedName:L,localName:K,source:String(q.source.value),specifierType:O})}if((q.type==="TSInterfaceDeclaration"||q.type==="TSTypeAliasDeclaration")&&q.id?.name&&q.start!==void 0&&q.end!==void 0)Z.localTypeDeclarationsByName.set(q.id.name,{code:A(Z,q.start,q.end)?.trim()??"",node:q,start:q.start});if(q.type==="ExportNamedDeclaration"&&q.declaration?.type==="VariableDeclaration")for(let W of q.declaration.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitPropTypesByName.set(W.id.name,K)}else if(q.type==="VariableDeclaration")for(let W of q.declarations??[]){if(W.id?.type!=="Identifier"||!W.id.name)continue;let K=BQ(Z,W.id.typeAnnotation);if(K)Z.explicitVariableTypesByName.set(W.id.name,K)}}for(let q of X){if(!q||typeof q!=="object"||!("declarations"in q))continue;for(let W of q.declarations??[]){if(!y(p(W.init),"$props"))continue;let K=W.id?.typeAnnotation?void 0:UZ(W.init),Y=W.id?.typeAnnotation?.typeAnnotation??K,O=W.id?.typeAnnotation?BQ(Z,W.id.typeAnnotation):KZ(Z,K),L=UQ(Q,Z,Y,new Map(Array.from(Z.localTypeDeclarationsByName.entries(),([T,f])=>[T,f.node]))),J=new Set,B=new Set;if(HZ(Z,Y,J,B),OZ(Z,J,B),W.start!==void 0){let T={canonicalType:O,props:L,referencedImportedTypes:J,referencedLocalTypes:B};if(Z.runesPropsDeclarationMetadataByDeclaratorStart.set(W.start,T),O)Z.typedRunesPropsDeclarations.push(T)}}}}function VZ(Q,Z,$){for(let G of $.declarations){if(!y(p(G.init),"$props"))continue;if(G.id.type==="Identifier"){Z.wholePropsLocals.add(G.id.name),Z.restPropLocals.add(G.id.name);let W=qZ(Z,G.start);if(W)for(let[K,Y]of W.props)GQ(Q,Z,K,{name:K,kind:"let",type:Y.type,typeSource:"typescript",isFunction:!1,isFunctionDeclaration:!1,isRequired:!Y.optional,constant:!1,reactive:!1,source:Y.source});continue}if(G.id.type!=="ObjectPattern")continue;let X=o(Z,Q,$),q=G.id.properties.filter((W)=>{if(W.type!=="Property"||W.computed)return!1;if(!Q.getPropertyName(W.key))return!1;if(W.value.type==="Identifier")return!0;return W.value.type==="AssignmentPattern"&&W.value.left.type==="Identifier"}).length;for(let W of G.id.properties){if(W.type==="RestElement"){if(W.argument.type==="Identifier")Z.restPropLocals.add(W.argument.name);continue}let K=Q.getPropertyName(W.key);if(!K)continue;let Y,O;if(W.value.type==="Identifier")Y=W.value.name;else{let M=W.value;Y=M.left.name,O=M.right}if(!Y)continue;if(Q.trackPropLocalName(K,Y),K==="children")Z.snippetPropLocals.add(Y);let L=zZ(Z,Q,W)??(q===1?X:void 0),J=YZ(Z,G.start,K),{init:B,bindable:T}=cQ(O),f=B==null?{isFunction:!1}:l(Q,Z,B),{value:e,type:QQ,isFunction:qQ,defaultValue:RQ}=f,wQ=J?.type===void 0&&L?.type===void 0?f.resolvedType:void 0;if(f.pendingCallDefault)Z.pendingCallDefaultCandidates.push({propName:K,location:"props",...f.pendingCallDefault});let{type:IQ,typeSource:YQ,description:WQ,params:KQ,returnType:U,isFunction:H}=XQ({explicitType:J?.type,typeSeed:QQ,inferredTypeForSource:QQ,jsdocType:L?.type,jsdocDescription:L?.description,jsdocParams:L?.params,jsdocReturnType:L?.returnType,resolvedType:wQ,resolvedDescription:f.resolvedDescription,resolvedParams:f.resolvedParams,resolvedReturnType:f.resolvedReturnType,initializerIsFunction:qQ,isFunctionDeclaration:!1,inferIsFunctionFromTypeSignature:!0});if(T)Z.reactive_vars.add(K);GQ(Q,Z,K,{name:K,...Y===K?{}:{localName:Y},kind:"let",description:WQ,binding:L?.binding,deprecated:L?.deprecated,tags:L?.tags,...T?{bindable:!0}:{},type:IQ,typeSource:YQ,value:e,defaultValue:RQ,params:KQ,returnType:U,isFunction:H,isFunctionDeclaration:!1,isRequired:B==null&&J?.optional!==!0,constant:!1,reactive:T,source:h(Z,W)})}}}function JZ(Q,Z){if(Q.syntaxMode!=="runes")return;for(let[$,G]of Array.from(Q.events.entries())){if(G.type!=="dispatched")continue;if(Z.has($)||Q.forwardedEvents.has($))continue;let X=`on${$}`,q=Q.props.get(X);if(!q)continue;let W=q.type!==void 0||q.params!==void 0||q.returnType!==void 0,K=G.detail===void 0||G.detail==="undefined"||G.detail==="null"?"() => void":`(detail: ${G.detail}) => void`;Q.props.set(X,{...q,description:q.description??G.description,type:W?q.type:K,typeSource:W?q.typeSource:"inferred",isFunction:!0}),Q.events.delete($)}}var MZ=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion","TSInstantiationExpression"]);function FQ(Q){if(!Q||typeof Q!=="object")return;v(Q,{enter(Z){if(!MZ.has(Z.type))return;let $=Z.expression;while($&&MZ.has($.type))$=$.expression;if($)this.replace($)}})}function CQ(Q,Z){let $=Z.source?.value;if(typeof $!=="string"||Z.importKind==="type")return;for(let G of Z.specifiers??[]){if(G.type!=="ImportSpecifier"||G.importKind==="type")continue;let X=G.local?.name;if(!X)continue;let q=G.imported?.name??(typeof G.imported?.value==="string"?G.imported.value:X);Q.valueImportBindingsByLocalName.set(X,{localName:X,importedName:q,source:$})}}function SQ(Q,Z){if(!Z)return;v(Z,{enter($){if($.type==="ImportDeclaration")CQ(Q,$);if($.type==="FunctionDeclaration"){let G=$;if(G.id?.name)Q.funcDecls.set(G.id.name,G)}}})}function RZ(Q,Z,$){let G=Z+1;while(G<Q.length){if(Q[G]==="\\"){G+=2;continue}if(Q[G]===$)return G+1;G++}return G}function wZ(Q,Z){let $=Z+1,G=0;while($<Q.length){let X=Q[$];if(X==="\\"){$+=2;continue}if(G===0){if(X==="`")return $+1;if(X==="$"&&Q[$+1]==="{"){G=1,$+=2;continue}$++;continue}if(X==="{")G++;else if(X==="}")G--;else if(X==='"'||X==="'"){$=RZ(Q,$,X);continue}else if(X==="`"){$=wZ(Q,$);continue}$++}return $}function z0(Q,Z){let $=[],G=Q.length,X=0;while(X<G){let q=Q[X];if(q==='"'||q==="'"){X=RZ(Q,X,q);continue}if(q==="`"){X=wZ(Q,X);continue}if(q==="/"&&Q[X+1]==="/"){let W=X+2;while(W<G&&Q[W]!==`
2
2
  `)W++;X=W;continue}if(q==="/"&&Q[X+1]==="*"){let W=X,K=X+2;while(K<G&&!(Q[K]==="*"&&Q[K+1]==="/"))K++;let Y=Math.min(K+2,G),O=Q.slice(W,Y);$.push({end:Y+Z,isJsDoc:O.startsWith("/**")&&O.length>4,text:O}),X=Y;continue}X++}return $}function jZ(Q,Z,$){if(!Q||typeof Q!=="object"||!("type"in Q))return;let G=Q;if(G.type==="FunctionDeclaration"){if(G.id?.type==="Identifier"&&G.id.name)$.push({name:G.id.name,start:Z});return}if(G.type==="VariableDeclaration"){for(let X of G.declarations??[])if(X?.id?.type==="Identifier"&&X.id.name)$.push({name:X.id.name,start:Z})}}function L0(Q){let Z=[];for(let $ of Q){if(!$||typeof $!=="object"||!("type"in $))continue;let G=$;if(G.start===void 0)continue;if(G.type==="ExportNamedDeclaration"&&G.declaration)jZ(G.declaration,G.start,Z);else jZ(G,G.start,Z)}return Z}function V0(Q,Z,$){let G;for(let X of Q){if(X.end>Z)break;if(!X.isJsDoc)continue;if(!FZ.test($.slice(X.end,Z)))continue;G=X}return G}function IZ(Q,Z){let $=new Map;if(!Q.source)return $;let G=[Q.parsed?.module,Q.parsed?.instance],X=[],q=[];for(let W of G){let K=W?.content;if(!K?.body||K.start===void 0||K.end===void 0)continue;X.push(...z0(Q.source.slice(K.start,K.end),K.start)),q.push(...L0(K.body))}X.sort((W,K)=>W.end-K.end);for(let W of q){let K=V0(X,W.start,Q.source);if(!K)continue;let Y=BZ(K.text),{type:O,description:L}=CZ(Y);if(!O)continue;$.set(W.name,{type:Z.aliasType(O.type),description:L||O.description})}return $}function AZ(Q){if(Q==="var")return"let";if(Q==="using"||Q==="await using")return"const";return Q}var J0=null,PZ=/^@component/,M0=/\r/g,j0=/^\{\s*\}$/;class _{ctx=PQ();static mapToArray(Q){return Array.from(Q,([Z,$])=>$)}static getStaticAttributeValue(Q){if(!Array.isArray(Q.value))return;return Q.value.map((Z)=>Z.data??Z.raw??"").join("").trim()}resolveScriptLanguage(Q){let Z=[Q.instance,Q.module].filter((G)=>G!==void 0),$=!1;for(let G of Z){let X=G.attributes?.find((W)=>W.name==="lang");if(!X){$=!0;continue}if(_.getStaticAttributeValue(X)?.toLowerCase()==="ts")return"ts"}return $?"js":void 0}resolveScriptGenericsAttribute(Q){let Z=Q.instance?.attributes?.find((W)=>W.name==="generics");if(!Z)return;let $=h(this.ctx,Z),G=Q.instance?.attributes?.find((W)=>W.name==="lang");if((G?_.getStaticAttributeValue(G)?.toLowerCase():void 0)!=="ts"){m(this.ctx,"syntax-skipped","generics",'<script generics="..."> requires lang="ts"; the generics attribute was ignored because the script is not TypeScript.',$);return}let q=_.getStaticAttributeValue(Z);if(!q)return;return{value:q,source:$}}resolvePublicPropName(Q){return this.ctx.propLocalToPublicName.get(Q)??Q}trackPropLocalName(Q,Z=Q){this.ctx.propLocalToPublicName.set(Z,Q)}getPropByLocalOrPublic(Q){return this.ctx.props.get(this.resolvePublicPropName(Q))}getPropTypeByLocalOrPublic(Q){return this.getPropByLocalOrPublic(Q)?.type}getExplicitPropType(Q){return this.ctx.explicitPropTypesByName.get(Q)}getPropertyName(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return;if(s(Q))return Q.name;if(VQ(Q))return Q.value==null?void 0:String(Q.value);return}isNumericConstant(Q){if(!Q||typeof Q!=="object"||!("type"in Q))return!1;if(Q.type!=="MemberExpression")return!1;let Z=Q,$=Z.object&&"name"in Z.object?Z.object.name:void 0,G=Z.property&&"name"in Z.property?Z.property.name:void 0;if(!$||!G)return!1;if($==="Number")return["POSITIVE_INFINITY","NEGATIVE_INFINITY","MAX_VALUE","MIN_VALUE","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","EPSILON","NaN"].includes(G);if($==="Math")return["PI","E","LN2","LN10","LOG2E","LOG10E","SQRT2","SQRT1_2"].includes(G);return!1}resolveLocalVarJSDoc(Q){for(let $ of this.ctx.vars)if($.declarations.some((X)=>X.id&&typeof X.id==="object"&&("type"in X.id)&&X.id.type==="Identifier"&&("name"in X.id)&&X.id.name===Q))return o(this.ctx,this,$);let Z=this.ctx.funcDecls.get(Q);if(Z)return o(this.ctx,this,Z);return}addModuleExport(Q,Z){if(LQ(Q)===void 0)return;if(this.ctx.moduleExports.has(Q)){let $=this.ctx.moduleExports.get(Q);this.ctx.moduleExports.set(Q,{...$,...Z})}else this.ctx.moduleExports.set(Q,Z)}aliasType(Q){if(Q==="*")return"any";return Q.trim()}findVariableTypeAndDescription(Q){let Z=this.getPropByLocalOrPublic(Q);if(Z?.type)return{type:Z.type,description:Z.description};if(!this.ctx.variableInfoCacheBuilt)this.ctx.variableInfoCache=IZ(this.ctx,this),this.ctx.variableInfoCacheBuilt=!0;let $=this.ctx.variableInfoCache.get(Q),G=this.ctx.explicitVariableTypesByName.get(Q);if(G)return{type:G,description:$?.description};return $??null}accumulateGeneric(Q,Z){if(this.ctx.generics)this.ctx.generics=[`${this.ctx.generics[0]}, ${Q}`,`${this.ctx.generics[1]}, ${Z}`];else this.ctx.generics=[Q,Z]}cleanup(){this.ctx=PQ()}static SCRIPT_BLOCK_REGEX=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi;static TS_DIRECTIVE_REGEX=/\/\/\s*@ts-[^\n\r]*/g;static stripTypeScriptDirectivesFromScripts(Q){return _.SCRIPT_BLOCK_REGEX.lastIndex=0,Q.replace(_.SCRIPT_BLOCK_REGEX,(Z,$,G,X)=>{_.TS_DIRECTIVE_REGEX.lastIndex=0;let q=G.replace(_.TS_DIRECTIVE_REGEX,"");return $+q+X})}parseSvelteComponent(Q,Z){this.cleanup(),this.ctx.componentFilePath=Z.filePath;let $=_.stripTypeScriptDirectivesFromScripts(Q);this.ctx.source=$;let{modern:G,intoLegacy:X}=vZ($);if(LZ(this,this.ctx,G),this.ctx.parsed=X(),this.ctx.scriptLanguage==="ts")FQ(this.ctx.parsed.module),FQ(this.ctx.parsed.instance),FQ(this.ctx.parsed.html);this.ctx.syntaxMode=XZ(this.ctx);let q=this.ctx.parsed.css,W=q?.start!==void 0&&q?.end!==void 0?$.slice(0,q.start)+" ".repeat(q.end-q.start)+$.slice(q.end):$;NZ(this.ctx,this,W);let K={type:"ComponentRoot",instance:this.ctx.parsed.instance,html:this.ctx.parsed.html};if(SQ(this.ctx,this.ctx.parsed?.module),SQ(this.ctx,this.ctx.parsed?.instance),this.ctx.parsed?.module)v(this.ctx.parsed?.module,{enter:(U)=>{if(U.type==="ImportDeclaration")CQ(this.ctx,U);if(U.type==="FunctionDeclaration"){let H=U;if(H.id?.name)this.ctx.funcDecls.set(H.id.name,H)}if(U.type==="VariableDeclaration")this.ctx.vars.add(U);if(U.type==="ExportNamedDeclaration"){if(U.declaration==null)return;if(!U.declaration||typeof U.declaration!=="object"||!("type"in U.declaration))return;let H,M,F=!1,z,V,C,w=!1,j,D,R;if(U.declaration.type==="FunctionDeclaration"){let N=U.declaration;if(!N.id?.name)return;H=N.id.name,M="function",z=void 0,V="() => any",w=!0,F=!0}else if(U.declaration.type==="VariableDeclaration"){let N=U.declaration,a=N.declarations[0];if(!a||typeof a!=="object"||!("id"in a))return;let{id:n,init:HQ}=a;if(!n||typeof n!=="object"||!("name"in n))return;let ZQ=n.name;H=ZQ,M=AZ(N.kind);let E=HQ==null?{isFunction:!1}:l(this,this.ctx,HQ);if({value:z,type:V,isFunction:w,defaultValue:j}=E,D=V,R=E,C=this.getExplicitPropType(ZQ),R.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:ZQ,location:"moduleExports",...R.pendingCallDefault})}else return;let S=o(this.ctx,this,U),{type:u,typeSource:d,description:I,params:b,returnType:g,isFunction:r}=XQ({explicitType:C,typeSeed:V,inferredTypeForSource:D,jsdocType:S?.type,jsdocDescription:S?.description,jsdocParams:S?.params,jsdocReturnType:S?.returnType,resolvedType:R?.resolvedType,resolvedDescription:R?.resolvedDescription,resolvedParams:R?.resolvedParams,resolvedReturnType:R?.resolvedReturnType,initializerIsFunction:w,isFunctionDeclaration:F,typedefs:this.ctx.typedefs});this.addModuleExport(H,{name:H,kind:M,description:I,deprecated:S?.deprecated,tags:S?.tags,type:u,typeSource:d,value:z,defaultValue:j,params:b,returnType:g,isFunction:r,isFunctionDeclaration:F,isRequired:!1,constant:M==="const",reactive:!1,source:h(this.ctx,U)})}}});let Y,O=new Set,L=new Set,J=[];eQ(this,this.ctx),this.ctx.activeScopes.push(this.ctx.componentScope);let B=QZ(this.ctx);if(v(K,{enter:(U,H,M)=>{ZZ(this,this.ctx,B,U);let F=this.ctx.scopeDeclarations.get(U);if(F)this.ctx.activeScopes.push(F);if(U.type==="AssignmentExpression")kQ(this.ctx,U.left);if(U.type==="UpdateExpression")kQ(this.ctx,U.argument);if(U.type==="CallExpression"){let z=U,V=z.callee&&typeof z.callee==="object"&&"name"in z.callee?z.callee.name:void 0;if(V==="createEventDispatcher"){if(H&&typeof H==="object"&&"id"in H&&H.id&&typeof H.id==="object"&&"name"in H.id)Y=H.id.name}if(V==="$host"){if(H&&typeof H==="object"&&"id"in H&&H.id&&typeof H.id==="object"&&"name"in H.id)O.add(H.id.name)}if(V==="setContext")rQ(this.ctx,this,U,H??void 0);if(V)J.push({name:V,arguments:z.arguments,source:h(this.ctx,z)});if(EZ(z.callee)&&s(z.callee.property)&&z.callee.property.name==="dispatchEvent"&&(y(z.callee.object,"$host")||s(z.callee.object)&&O.has(z.callee.object.name))){let C=SZ(this.ctx,z);if(C)L.add(C)}}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="Spread"){let z=U;if(z.expression?.name==="$$restProps"||this.ctx.restPropLocals.has(z.expression?.name??""))aQ(this.ctx,H)}if(U.type==="FunctionDeclaration"){let z=U;if(z.id?.name)this.ctx.funcDecls.set(z.id.name,z)}if(U.type==="ImportDeclaration")CQ(this.ctx,U);if(U.type==="VariableDeclaration"){if(this.ctx.vars.add(U),H&&typeof H==="object"&&"type"in H&&H.type==="Program"&&U.declarations.some((z)=>y(p(z.init),"$props")))VZ(this,this.ctx,U)}if(U.type==="ExportNamedDeclaration"){if(U.declaration==null&&U.specifiers.length===0)return;let z;if(U.declaration==null&&U.specifiers[0]?.type==="ExportSpecifier"){let E=U.specifiers[0],c=E.local&&typeof E.local==="object"&&"name"in E.local?E.local.name:void 0,i=E.exported&&typeof E.exported==="object"&&"name"in E.exported?E.exported.name:void 0;if(!c||!i)return;let t;for(let $Q of Array.from(this.ctx.vars))if($Q.declarations.some((x)=>x.id&&typeof x.id==="object"&&("type"in x.id)&&x.id.type==="Identifier"&&x.id.name===c)){t=$Q;break}U.declaration=t,z=i}if(U.declaration==null)return;if(!U.declaration||typeof U.declaration!=="object"||!("type"in U.declaration))return;let V,C=!1,w,j,D,R=!1,S=!1,u,d,I,b;if(U.declaration.type==="FunctionDeclaration"){let E=U.declaration;if(!E.id?.name)return;z??=E.id.name,u=E.id.name,V="function",w=void 0,j="() => any",R=!0,C=!0,S=!1}else if(U.declaration.type==="VariableDeclaration"){let E=U.declaration,c=E.declarations[0];if(!c||typeof c!=="object"||!("id"in c))return;let{id:i,init:t}=c;if(i&&typeof i==="object"&&"name"in i){let x=i.name;u=x,z??=x,D=this.getExplicitPropType(x)}else return;V=AZ(E.kind),S=V==="let"&&t==null;let $Q=t==null?{isFunction:!1}:l(this,this.ctx,t);if({value:w,type:j,isFunction:R,defaultValue:d}=$Q,I=j,b=$Q,b.pendingCallDefault)this.ctx.pendingCallDefaultCandidates.push({propName:z,location:"props",...b.pendingCallDefault})}else return;let g=o(this.ctx,this,U),{type:r,typeSource:N,description:a,params:n,returnType:HQ,isFunction:ZQ}=XQ({explicitType:D,typeSeed:j,inferredTypeForSource:I,jsdocType:g?.type,jsdocDescription:g?.description,jsdocParams:g?.params,jsdocReturnType:g?.returnType,resolvedType:b?.resolvedType,resolvedDescription:b?.resolvedDescription,resolvedParams:b?.resolvedParams,resolvedReturnType:b?.resolvedReturnType,initializerIsFunction:R,isFunctionDeclaration:C,typedefs:this.ctx.typedefs});GQ(this,this.ctx,z,{name:z,...u!==void 0&&u!==z?{localName:u}:{},kind:V,description:a,binding:g?.binding,deprecated:g?.deprecated,tags:g?.tags,type:r,typeSource:N,value:w,defaultValue:d,params:n,returnType:HQ,isFunction:ZQ,isFunctionDeclaration:C,isRequired:S,constant:V==="const",reactive:this.ctx.reactive_vars.has(z),source:h(this.ctx,U)})}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="Comment"){let V=U?.data?.trim()??"";if(PZ.test(V))this.ctx.componentComment=V.replace(PZ,"").replace(M0,""),this.ctx.componentCommentSource=h(this.ctx,U)}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="Slot"){let z=U,V=z.attributes?.find((j)=>j.name==="name")?.value?.[0]?.data,C=(z.attributes||[]).filter((j)=>j.name!=="name").reduce((j,D)=>{let R={value:void 0,replace:!1},S=D.value;if(S===void 0)return j;if(S[0]){let u=S[0],{type:d,expression:I,raw:b,start:g,end:r}=u;if(d==="Text"&&b!==void 0)R.value=JSON.stringify(b);else if(d==="AttributeShorthand"&&I&&typeof I==="object"&&"name"in I)R.value=I.name,R.replace=!0;if(I&&typeof I==="object"&&"type"in I){if(I.type==="Literal"&&"value"in I){let N=I.value;R.value=typeof N==="string"?JSON.stringify(N):String(N)}else if(I.type==="MemberExpression")R.value=hZ(this.ctx,this,I);else if(I.type!=="Identifier"){if(g!==void 0&&r!==void 0){if(I.type==="ObjectExpression"||I.type==="TemplateLiteral")R.value=A(this.ctx,g+1,r-1)}}}}if(D.name)j[D.name]=R;return j},{}),w=z.children?.map(({start:j,end:D})=>{if(j===void 0||D===void 0)return"";return A(this.ctx,j,D)??""}).join("").trim();TQ(this.ctx,{slot_name:V,slot_props:C,slot_fallback:w,source:h(this.ctx,U)})}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="RenderTag"){let z=U,V=fZ(this.ctx,z.expression);if(V){let C;if(V.arguments.length===0)C={};else if(V.arguments.length===1&&typeof V.arguments[0]==="object"&&V.arguments[0]&&"type"in V.arguments[0]&&V.arguments[0].type==="ObjectExpression")C=gZ(this.ctx,this,V.arguments[0]);else if(V.arguments.length===1)m(this.ctx,"syntax-skipped",V.publicName,`{@render ${V.publicName}(...)} argument is not a plain object literal; the render call was not mapped to slot metadata.`,h(this.ctx,U));let w=V.publicName==="children"?void 0:V.publicName,j=w===void 0?J0:w;if(C!==void 0)TQ(this.ctx,{slot_name:w,slot_props:C,source:h(this.ctx,U)});if(C!==void 0||this.ctx.slots.has(j))this.ctx.snippetPropLocals.add(V.trackingName)}}if(U&&typeof U==="object"&&"type"in U&&String(U.type)==="EventHandler"){let z=U;if(z.expression==null&&z.name){if(H!=null&&typeof H==="object"&&"name"in H){let V=typeof H.name==="string"?H.name:void 0,C="type"in H?String(H.type):void 0;if(V&&C){let w=C==="InlineComponent"?{type:"InlineComponent",name:V}:{type:"Element",name:V};this.ctx.forwardedEvents.set(z.name,w);let j=this.ctx.events.get(z.name),D=this.ctx.eventDescriptions.get(z.name),R=j?.deprecated;if(!j)this.ctx.events.set(z.name,{type:"forwarded",name:z.name,element:w,description:D,deprecated:R,source:h(this.ctx,U)});else if(j.type==="forwarded"&&D&&!j.description)this.ctx.events.set(z.name,{...j,description:D,deprecated:j.deprecated??R,source:j.source||h(this.ctx,U)})}}}}if(H&&typeof H==="object"&&"type"in H&&(String(H.type)==="Element"||String(H.type)==="InlineComponent")&&U&&typeof U==="object"&&"type"in U&&String(U.type)==="Binding"){let z=U;if(z.expression?.name){let V=JQ(this.ctx,z.expression.name);if(V)this.ctx.reactive_vars.add(V)}if(String(H.type)==="Element"&&z.name==="this"&&z.expression?.name&&"name"in H&&typeof H.name==="string"){let V=JQ(this.ctx,z.expression.name);if(!V)return;let C=H.name;if(this.ctx.bindings.has(V)){let w=this.ctx.bindings.get(V);if(w&&!w.elements.includes(C))this.ctx.bindings.set(V,{...w,elements:[...w.elements,C]})}else this.ctx.bindings.set(V,{elements:[C]})}}},leave:(U)=>{if(this.ctx.scopeDeclarations.has(U))this.ctx.activeScopes.pop();$Z(B,U)}}),Y!==void 0){for(let U of J)if(U.name===Y){let H=U.arguments[0],M=H&&typeof H==="object"&&"value"in H?H.value:void 0,F=U.arguments[1],z=F&&typeof F==="object"&&"value"in F?F.value:void 0;if(M!=null)_Z(this.ctx,{name:String(M),detail:z==null?"":kZ(z),has_argument:Boolean(F),source:U.source})}}let T=new Set(L);if(Y!==void 0){for(let U of J)if(U.name===Y){let H=U.arguments[0],M=H&&typeof H==="object"&&"value"in H?H.value:void 0;if(M!=null)T.add(String(M))}}this.ctx.forwardedEvents.forEach((U,H)=>{let M=this.ctx.events.get(H);if(M&&M.type==="dispatched"&&!T.has(H)){let F=this.ctx.eventDescriptions.get(H),z={type:"forwarded",name:H,element:U,description:F,deprecated:M.deprecated,tags:M.tags,source:M.source};if(M.detail!==void 0&&M.detail!=="undefined")z.detail=M.detail;this.ctx.events.set(H,z)}}),JZ(this.ctx,T);let f=this.ctx.syntaxMode==="runes"?new Set(Array.from(this.ctx.snippetPropLocals,(U)=>this.resolvePublicPropName(U))):new Set,e=_.mapToArray(this.ctx.props).filter((U)=>!f.has(U.name)).map((U)=>{if(this.ctx.bindings.has(U.name)){let H=this.ctx.bindings.get(U.name)?.elements.sort().map((M)=>NQ(M)).join(" | ");return{...U,type:`null | ${H}`,typeSource:"inferred",reactive:U.reactive||this.ctx.reactive_vars.has(U.name)}}return{...U,reactive:U.reactive||this.ctx.reactive_vars.has(U.name)}});this.ctx.activeScopes.length=0;let QQ=_.mapToArray(this.ctx.slots).map((U)=>{if(!U.slot_props)return U;if(typeof U.slot_props==="string")return j0.test(U.slot_props)?{...U,slot_props:"Record<string, never>"}:U;let H=U.slot_props,M=[];for(let z of Object.keys(H)){if(H[z].replace&&H[z].value!==void 0)H[z].value=this.getPropTypeByLocalOrPublic(H[z].value);if(H[z].value===void 0)H[z].value="any";M.push(`${z}: ${H[z].value}`)}let F=M.length===0?"Record<string, never>":M.length===1?`{ ${M[0]} }`:`{
3
3
  ${M.join(`;
4
4
  `)};
package/lib/cli-entry.js CHANGED
@@ -1 +1 @@
1
- import{s as e}from"./chunk-44fwt51g.js";import"./chunk-ck4qbyqp.js";import"./chunk-tjthqdyw.js";import"./chunk-jvqe4bt1.js";import"./chunk-0q7qnmx3.js";export{e as cli};
1
+ import{s as e}from"./chunk-hytk5gv8.js";import"./chunk-4ndm4k55.js";import"./chunk-tjthqdyw.js";import"./chunk-jvqe4bt1.js";import"./chunk-0q7qnmx3.js";export{e as cli};
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- import{a as K,b as j,c as C,d as x,e as k,f as q,g as A,h as D,i as H,j as W,k as v,l as S,m as J,n as I,o as L,p as M,q as N,r as P,s as Q}from"./chunk-44fwt51g.js";import{t as E}from"./chunk-t6s3aa0t.js";import"./chunk-ck4qbyqp.js";import"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-jvqe4bt1.js";import"./chunk-0q7qnmx3.js";async function z(t){if(t&&"input"in t)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:R,...b}=t??{},m=await W(),f=D(R??m.entry);if(f===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let o=v(m,b,{entry:f}),p=await J(f,o.glob===!0,S(o)),y;if(o.check)y=await x(p.components,C(o),{entryExports:p.entryExports});if(await P(p,o,f),!o.dryRun)p.cache?.save();let{diagnostics:r}=p;if((o.reportDiagnostics||o.strict)&&r.length>0)console.error(A(r));if(o.strict&&r.length>0)process.exitCode=1;return{diagnostics:r,check:y}}export{z as sveld,x as runCheck,I as registerWriter,M as listWriters,L as getWriter,q as formatCheckReportJson,k as formatCheckReport,j as diffApiDocuments,H as defineConfig,N as default,Q as cli,K as buildComponentApiDocument,E as ComponentParser};
1
+ import{a as K,b as j,c as C,d as x,e as k,f as q,g as A,h as D,i as H,j as W,k as v,l as S,m as J,n as I,o as L,p as M,q as N,r as P,s as Q}from"./chunk-hytk5gv8.js";import{t as E}from"./chunk-wn9w3zst.js";import"./chunk-4ndm4k55.js";import"./chunk-5x7ma2jx.js";import"./chunk-tjthqdyw.js";import"./chunk-jvqe4bt1.js";import"./chunk-0q7qnmx3.js";async function z(t){if(t&&"input"in t)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:R,...b}=t??{},m=await W(),f=D(R??m.entry);if(f===null)throw Error('sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.');let o=v(m,b,{entry:f}),p=await J(f,o.glob===!0,S(o)),y;if(o.check)y=await x(p.components,C(o),{entryExports:p.entryExports});if(await P(p,o,f),!o.dryRun)p.cache?.save();let{diagnostics:r}=p;if((o.reportDiagnostics||o.strict)&&r.length>0)console.error(A(r));if(o.strict&&r.length>0)process.exitCode=1;return{diagnostics:r,check:y}}export{z as sveld,x as runCheck,I as registerWriter,M as listWriters,L as getWriter,q as formatCheckReportJson,k as formatCheckReport,j as diffApiDocuments,H as defineConfig,N as default,Q as cli,K as buildComponentApiDocument,E as ComponentParser};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.36.6",
3
+ "version": "0.36.7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions and component documentation for your Svelte components.",
6
6
  "type": "module",