sveld 0.40.3 → 0.40.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser.js +129 -129
- package/chunk-ep5n8z9k.js +193 -0
- package/chunk-j58p3sv3.js +1 -0
- package/{chunk-1pzasy7d.js → chunk-x82fq7xs.js} +1 -1
- package/chunk-xv4tka7y.js +40 -0
- package/cli-entry.js +3 -3
- package/cli.js +1 -1
- package/index.d.ts +3 -3
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-m252rw53.js +0 -40
- package/chunk-r6xdep4j.js +0 -1
- package/chunk-ve0g5kge.js +0 -192
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var v=Symbol("sveld.parsedComponentTypeScriptMetadata"),M=Symbol("sveld.parsedComponentPropIgnores");function $o(te){return te[M]}function No(te){return te[v]}var er=Array(2048).fill(void 0);function Zc(){er.fill(void 0)}function Do(te,ne,Fe,Vt){let Gt=Vt&2047,Kt=er[Gt];if(Kt!==void 0&&Kt.length===Fe-ne&&te.startsWith(Kt,ne))return Kt;let zt=te.slice(ne,Fe);return er[Gt]=zt,zt}var xi="",jn=[0],Jn=0,yi=0,Xn;function F(te){Zc(),xi=te,jn=[0],Jn=0,yi=0,Xn=void 0}function tr(te){while(Jn<=te){let ne=xi.indexOf(`
|
|
2
|
+
`,Jn);if(ne===-1){Jn=Number.POSITIVE_INFINITY;return}Jn=ne+1,jn.push(Jn)}}function Ro(te){let ne=[0],Fe=te.indexOf(`
|
|
3
|
+
`);while(Fe!==-1)ne.push(Fe+1),Fe=te.indexOf(`
|
|
4
|
+
`,Fe+1);return ne}function os(te,ne,Fe){let Vt=0,Gt=te.length-1;if(ne>=te[Fe])Vt=Fe;else Gt=Fe-1;if(Vt<Gt&&ne<te[Vt+1])Gt=Vt;while(Vt<Gt){let Kt=Vt+Gt+1>>>1;if(te[Kt]<=ne)Vt=Kt;else Gt=Kt-1}return Vt}function x(te){return tr(te),yi=os(jn,te,yi),{line:yi+1,column:te-jn[yi],character:te}}var Zs=/\r\n?|\n|\u2028|\u2029/g,el=/[\r\u2028\u2029]/;function Io(te){if(Xn===void 0){Xn=el.test(xi)?[]:null,Zs.lastIndex=0;while(Xn!==null&&Zs.exec(xi)!==null)Xn.push(Zs.lastIndex)}if(Xn===null)return tr(te),os(jn,te,yi);let ne=0,Fe=Xn.length;while(ne<Fe){let Vt=ne+Fe>>>1;if(Xn[Vt]<=te)ne=Vt+1;else Fe=Vt}return ne}function N(te){let{line:ne,column:Fe}=x(te);return{line:ne,column:Fe}}function Oo(te){while(jn.length<=te+1&&Jn!==Number.POSITIVE_INFINITY)tr(Jn);if(te>=jn.length)return;let ne=te+1<jn.length?jn[te+1]-1:xi.length;return xi.slice(jn[te],ne)}function ve(te){let ne,Fe=0;return(Vt)=>(ne??=Ro(te),Fe=os(ne,Vt,Fe),{line:Fe+1,column:Vt-ne[Fe]})}function Un(te){return typeof te==="object"&&te!==null&&typeof ai(te).type==="string"}function ai(te){return te}function K(te,ne){let Fe=ai(te);for(let Vt in Fe){let Gt=Fe[Vt];if(Array.isArray(Gt)){for(let Kt=0;Kt<Gt.length;Kt++)if(Un(Gt[Kt]))Gt[Kt]=ne(Gt[Kt])}else if(Un(Gt))Fe[Vt]=ne(Gt)}}function Ce(te,...ne){if(!ne.some((Fe)=>Fe===te.type))throw Error(`expected ${ne.join(" or ")}, got ${te.type}`)}function Te(te){let ne=[];return pi(te,ne),ne}function pi(te,ne){switch(te.type){case"Identifier":ne.push(te);return;case"ObjectPattern":for(let Fe of te.properties)pi(Fe.type==="RestElement"?Fe.argument:Fe.value,ne);return;case"ArrayPattern":for(let Fe of te.elements)if(Fe!==null)pi(Fe,ne);return;case"RestElement":pi(te.argument,ne);return;case"AssignmentPattern":pi(te.left,ne);return;case"TSParameterProperty":pi(te.parameter,ne);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":pi(te.expression,ne)}}function z(te,ne){if(te.type!=="Identifier")return!1;if(ne===null)return!0;switch(ne.type){case"MemberExpression":return ne.computed||te===ne.object;case"MethodDefinition":return ne.computed;case"Property":case"PropertyDefinition":return ne.computed||te===ne.value;case"ExportSpecifier":case"ImportSpecifier":return te===ne.local;case"MetaProperty":case"ImportAttribute":case"ExportAllDeclaration":case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":case"TSExportAssignment":return te===ne.expression;case"TSEnumMember":return te===ne.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!ne.type.startsWith("TS")}}var ci={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],ParenthesizedExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var un=[],vi={...ci,FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],ArrowFunctionExpression:["params","body"],ClassDeclaration:["decorators","id","superClass","body"],ClassExpression:["decorators","id","superClass","body"],MethodDefinition:["decorators","key","value"],PropertyDefinition:["decorators","key","value"],Identifier:["decorators"],CallExpression:["callee","arguments"],NewExpression:["callee","arguments"],TaggedTemplateExpression:["tag","quasi"],RestElement:["decorators","argument"],ObjectPattern:["decorators","properties"],ArrayPattern:["decorators","elements"],TSTypeAnnotation:un,TSTypeParameterDeclaration:un,TSTypeParameterInstantiation:un,TSTypeParameter:un,TSArrayType:un,TSTupleType:un,TSNamedTupleMember:un,TSOptionalType:un,TSRestType:un,TSUnionType:un,TSIntersectionType:un,TSConditionalType:un,TSInferType:un,TSParenthesizedType:un,TSTypeOperator:un,TSIndexedAccessType:un,TSMappedType:un,TSLiteralType:un,TSTypeReference:un,TSTypeQuery:un,TSImportType:un,TSTypeLiteral:un,TSPropertySignature:un,TSMethodSignature:un,TSCallSignatureDeclaration:un,TSConstructSignatureDeclaration:un,TSFunctionType:un,TSConstructorType:un,TSIndexSignature:un,TSTypePredicate:un,TSInterfaceDeclaration:un,TSInterfaceBody:un,TSExpressionWithTypeArguments:un,TSTypeAliasDeclaration:un,TSNamespaceExportDeclaration:un,TSDeclareFunction:["id"],TSDeclareMethod:un,TSAsExpression:["expression"],TSSatisfiesExpression:["expression"],TSTypeAssertion:["expression"],TSInstantiationExpression:["expression"]},tl=Object.assign(Object.create(null),ci),nl=Object.assign(Object.create(null),vi),Lo=[],C=Symbol("svelte-ast.walk.stop"),p=Symbol("svelte-ast.walk.skip");function o(te,ne,Fe){as(te,null,null,null,ne,il(Fe))}function il(te){if(te===void 0||te===ci)return rl;if(te===vi)return ol;return(ne)=>sl(te,ne.type)}function sl(te,ne){return Object.hasOwn(te,ne)?te[ne]:void 0}var rg=Object.freeze([]);function as(te,ne,Fe,Vt,Gt,Kt){let zt=Kt(te);if(zt===void 0)throw Error(`unknown node type: ${te.type}`);let Ut=Gt.enter?.(te,ne,Fe,Vt);if(Ut===C)return!0;if(Ut!==p){if(Ut!==te&&Un(Ut))return al(Ut,ne,Fe,Vt,Gt,Kt);let qt=ai(te);for(let Xt=0;Xt<zt.length;Xt++){let Jt=zt[Xt],Qt=qt[Jt];if(Array.isArray(Qt))for(let Zt=0;Zt<Qt.length;Zt++){let en=Qt[Zt];if(Un(en)&&as(en,te,Jt,Zt,Gt,Kt))return!0}else if(Un(Qt)&&as(Qt,te,Jt,null,Gt,Kt))return!0}}return Gt.leave?.(te,ne,Fe,Vt)===C}function rl(te){let ne=te.type;if(ne==="Identifier")return te.typeAnnotation===void 0&&te.decorators===void 0?Lo:ci.Identifier;if(ne==="Literal")return ci.Literal;if(ne==="Text")return ci.Text;return tl[ne]}function ol(te){let ne=te.type;if(ne==="Identifier")return te.decorators===void 0?Lo:vi.Identifier;if(ne==="Literal")return vi.Literal;if(ne==="Text")return vi.Text;return nl[ne]}function al(te,ne,Fe,Vt,Gt,Kt){if(ne===null||Fe===null)throw Error("walk can't replace the node it was called with");let zt=ai(ne),Ut=zt[Fe];if(Vt===null)zt[Fe]=te;else if(Array.isArray(Ut))Ut[Vt]=te;return as(te,ne,Fe,Vt,Gt,Kt)}function i(te){return typeof te==="object"&&te!==null}function P(te){return i(te)&&te.type==="Literal"}function t(te){return i(te)&&te.type==="Identifier"&&typeof te.name==="string"}function A(te){return i(te)&&te.type==="MemberExpression"}function c(te){return i(te)&&te.type==="ObjectExpression"&&Array.isArray(te.properties)}function pl(te){return i(te)&&te.type==="CallExpression"}function m(te,ne){return pl(te)&&t(te.callee)&&te.callee.name===ne}function w(te){return te?.type==="TSAsExpression"||te?.type==="TSSatisfiesExpression"?w(te.expression):te}function Be(te){return te?.type==="TSAsExpression"||te?.type==="TSSatisfiesExpression"?te.typeAnnotation:void 0}function cl(te){return i(te)&&te.type==="NewExpression"}function be(te,ne){return cl(te)&&t(te.callee)&&te.callee.name===ne}function k(te){if(!i(te))return null;if(te.type==="Literal")return te.value==null?null:String(te.value);if(te.type==="TemplateLiteral"){let ne=te.quasis;if(ne?.length===1)return ne[0]?.value?.cooked??null}return null}function l(te){if(t(te))return te.name;if(P(te))return te.value==null?void 0:String(te.value);return}var ll=new Set(["Component","SvelteComponent","SvelteSelf"]),ul=new Set(["RegularElement","SvelteElement"]);function B(te){return ll.has(te)}function _(te){return ul.has(te)}var hl=/\s/;function ps(te,ne,Fe=0,Vt=te.length,Gt=0){let Kt=Gt;for(let zt=Fe;zt<Vt;zt++){let Ut=te.charCodeAt(zt);if(Ut===34||Ut===39||Ut===96){zt=Mo(te,zt,Vt);continue}if(Ut===123||Ut===40||Ut===91||Ut===60)Kt++;else if(Ut===125||Ut===41||Ut===93||Ut===62&&te.charCodeAt(zt-1)!==61){if(Kt>0)Kt--}if(ne?.(zt,Kt)===!0)break}return Kt}function Mo(te,ne,Fe){let Vt=te.charCodeAt(ne);for(let Gt=ne+1;Gt<Fe;Gt++){let Kt=te.charCodeAt(Gt);if(Kt===92)Gt++;else if(Kt===Vt)return Gt}return Fe-1}function r(te,ne){let Fe=[],Vt=0;return ps(te,(Gt,Kt)=>{if(Kt===0&&ne.includes(te[Gt]))Fe.push(te.slice(Vt,Gt)),Vt=Gt+1;return!1}),Fe.push(te.slice(Vt)),Fe}function nr(te,ne,Fe=0){let Vt=-1;return ps(te,(Gt,Kt)=>{if(ne(Gt,Kt))Vt=Gt;return Vt!==-1},Fe),Vt}function T(te,ne){return nr(te,(Fe,Vt)=>Vt===0&&ne.includes(te[Fe]))}function b(te){return nr(te,(ne,Fe)=>Fe===0&&te[ne]==="="&&te[ne+1]===">")}function E(te,ne){return nr(te,(Fe,Vt)=>Vt===0,ne)}function Di(te){let ne=te.trim();return ne.startsWith("[")&&E(ne,0)===ne.length-1}function re(te){if(!te)return;let ne=b(te);if(ne===-1)return;return te.slice(ne+2).trim()||void 0}var dl=new Set(["null","undefined"]);function ie(te){if(!te)return!1;let ne=r(te,"|").map((Vt)=>Vt.trim()).filter((Vt)=>Vt&&!dl.has(Vt));if(ne.length!==1)return!1;let Fe=Ei(ne[0]);return(Fe.startsWith("(")||Fe.startsWith("<"))&&b(Fe)!==-1}function In(te){let ne="",Fe=!1,Vt=(Kt)=>{if(Fe&&ne!=="")ne+=" ";Fe=!1,ne+=Kt},Gt=0;while(Gt<te.length){let Kt=te.charCodeAt(Gt);if(Kt===34||Kt===39||Kt===96){let zt=Mo(te,Gt,te.length);Vt(te.slice(Gt,zt+1)),Gt=zt+1}else if(te.startsWith("/*",Gt)){let zt=te.indexOf("*/",Gt+2);Gt=zt===-1?te.length:zt+2,Fe=!0}else if(te.startsWith("//",Gt)){let zt=te.indexOf(`
|
|
5
|
+
`,Gt+2);Gt=zt===-1?te.length:zt+1,Fe=!0}else if(hl.test(te[Gt]))Fe=!0,Gt++;else Vt(te[Gt]),Gt++}return ne}function Ei(te){let ne=te.trim();while(ne.startsWith("(")&&E(ne,0)===ne.length-1)ne=ne.slice(1,-1).trim();return ne}function fl(te){let ne="";for(let Fe=0;Fe<te.length;Fe++){let Vt=te[Fe];if(Vt==="*"&&te[Fe+1]==="*"){if(Fe++,te[Fe+1]==="/")ne+="(?:.*/)?",Fe++;else ne+=".*";continue}if(Vt==="*"){ne+="[^/]*";continue}if(Vt==="?"){ne+="[^/]";continue}ne+=".+^$()[]{}|\\".includes(Vt)?`\\${Vt}`:Vt}return ne}function Fo(te,ne){return new RegExp(`^${fl(te)}$`).test(ne)}var ir={"prop-unknown-type":{severity:"warning",label:"Props without inferred types"},"context-any-type":{severity:"warning",label:"Context values typed as `any`"},"bind-this-type-mismatch":{severity:"warning",label:"bind:this props declared with an element type they're never bound to"},"slot-missing-type":{severity:"warning",label:"@slot/@snippet tags missing a {Type} annotation"},"slot-not-rendered":{severity:"warning",label:"@slot/@snippet tags for slots the component doesn't render"},"event-no-source":{severity:"warning",label:"@event tags with no dispatch or callback"},"dispatch-escapes":{severity:"warning",label:"Dispatchers passed to functions sveld can't follow"},"example-compile-error":{severity:"error",label:"@example blocks that failed to compile"},"example-syntax-error":{severity:"error",label:"@example blocks that failed to parse"},"syntax-skipped":{severity:"error",label:"Component syntax sveld skipped"},"type-syntax-error":{severity:"error",label:"JSDoc types that aren't valid TypeScript"},"rest-props-unresolved":{severity:"warning",label:"$$restProps spread only onto components"},"context-duplicate-key":{severity:"warning",label:"Duplicate setContext keys"},"context-key-unresolved":{severity:"warning",label:"setContext keys sveld couldn't resolve"},"context-value-unresolved":{severity:"warning",label:"setContext values sveld couldn't describe"},"spread-unresolved":{severity:"warning",label:"Unresolved spreads widened to Record<string, any>"},"export-unresolved":{severity:"warning",label:"Unresolved named export specifiers"},"module-export-conflict":{severity:"warning",label:"Module-script exports colliding with generated names"},"extend-props-target-missing":{severity:"error",label:"@extends/@extendProps targets that couldn't be verified"},"extend-props-duplicate":{severity:"warning",label:"Duplicate @extends/@extendProps tags"},"extend-props-override":{severity:"warning",label:"Own props overriding an @extends target's prop"},"jsdoc-unknown-tag":{severity:"warning",label:"Unknown JSDoc tags"},"typedef-duplicate":{severity:"warning",label:"Duplicate @typedef/@callback names"},"property-duplicate":{severity:"warning",label:"Duplicate @property names"},"generics-conflict":{severity:"warning",label:"Duplicate @generics/@template names"},"event-description-ambiguous":{severity:"warning",label:"Text after an @event read as the next tag's description"},"jsdoc-tag-dropped":{severity:"warning",label:"Passthrough JSDoc tags that couldn't attach"},"internal-typedef-referenced":{severity:"error",label:"Public types referencing an @internal typedef"},"cross-file-unresolved":{severity:"warning",label:"Imports a standalone parse couldn't read"},"export-ambiguous":{severity:"warning",label:"Ambiguous `export *` names left out of the entry exports"}};function a(te){return{...te,code:q[te.kind],severity:ir[te.kind].severity}}function Bo(te,ne){if(ne)return te;return te.filter((Fe)=>Fe.kind!=="jsdoc-unknown-tag")}function jo(te,ne){if(!ne)return[];return te.filter((Fe)=>!Fe.ignored&&(ne!=="errors"||Fe.severity==="error"))}function ml(te,ne){if(ne.code!==void 0&&ne.code!==te.code)return!1;if(ne.name!==void 0&&ne.name!==te.name)return!1;if(ne.component!==void 0&&!Fo(ne.component,te.component))return!1;return!0}function Vo(te,ne){if(!ne||ne.length===0)return te;return te.map((Fe)=>Fe.ignored||ne.some((Vt)=>ml(Fe,Vt))?{...Fe,ignored:!0}:Fe)}var Go=Object.keys(ir),q=Object.fromEntries(Go.map((te)=>[te,`sveld/${te}`]));function Wo(te){let ne=new Set,Fe=[];for(let Vt of te){let Gt=`${Vt.component}:${Vt.kind}:${Vt.name}`;if(ne.has(Gt))continue;ne.add(Gt),Fe.push(Vt)}return Fe}function Uo(te){let ne=te.filter((qt)=>!qt.ignored),Fe=te.length-ne.length,Vt=Fe>0?` (${Fe} ignored)`:"";if(ne.length===0)return`sveld: no diagnostics${Vt}.`;let Gt=[],Kt=(qt,Xt)=>`${qt} ${Xt}${qt===1?"":"s"}`,zt=ne.filter((qt)=>qt.severity==="error").length,Ut=`${Kt(zt,"error")}, ${Kt(ne.length-zt,"warning")}`;Gt.push(`sveld: ${Kt(ne.length,"diagnostic")} (${Ut})${Vt}.`);for(let qt of Go){let Xt=ne.filter((Qt)=>Qt.kind===qt);if(Xt.length===0)continue;Gt.push(""),Gt.push(`${ir[qt].label} (${Xt.length}):`);let Jt=new Map;for(let Qt of Xt){let Zt=Jt.get(Qt.component)??[];Zt.push(Qt),Jt.set(Qt.component,Zt)}for(let[Qt,Zt]of Jt){Gt.push(` ${Qt}`);for(let en of Zt){let tn=en.source?` (${Qt}:${en.source.start.line}:${en.source.start.column})`:"";Gt.push(` - ${en.message}${tn} [${en.code}]`)}}}return Gt.join(`
|
|
6
|
+
`)}function Ho(te){return te.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
7
|
+
`,"%0A")}function gl(te){return Ho(te).replaceAll(":","%3A").replaceAll(",","%2C")}function yl(te){let Fe=[["file",te.file],["line",te.line],["col",te.column],["endLine",te.endLine],["endColumn",te.endColumn],["title",te.title]].filter((Vt)=>Vt[1]!==void 0).map(([Vt,Gt])=>`${Vt}=${gl(String(Gt))}`).join(",");return`::${te.severity} ${Fe}::${Ho(te.message)}`}function Ko(te,ne){let Fe=te.filter((Gt)=>!Gt.ignored);return[...Fe.filter((Gt)=>Gt.severity==="error"),...Fe.filter((Gt)=>Gt.severity!=="error")].map(({source:Gt,...Kt})=>{let zt=Gt!==void 0&&Gt.start.line===Gt.end.line;return yl({severity:Kt.severity,title:Kt.code,message:Kt.message,file:ne(Kt.component),line:Gt?.start.line,column:zt?Gt.start.column+1:void 0,endLine:Gt?.end.line,endColumn:zt?Gt.end.column+1:void 0})}).join(`
|
|
8
|
+
`)}var je=1;function qo(te){return`${JSON.stringify({kind:"diagnostics",schemaVersion:je,diagnostics:te},null,2)}
|
|
9
|
+
`}function Si(te,ne){if(ne.length===0)return;te.diagnostics=[...te.diagnostics??[],...ne]}var xl=/\*\//g,vl=/[.*+?^${}()|[\]\\]/g;function R(te){return te.replace(vl,"\\$&")}function j(te){return te.replace(xl,"*\\/")}function h(te){return te.map((ne)=>`${ne.name}${ne.optional?"?":""}: ${ne.type}`).join(", ")}var zo;function u(te,ne){return zo??=new Intl.Collator("en"),zo.compare(te,ne)}var El=/(?:_|[^\p{ID_Continue}$])+/u,Sl=/^[\p{ID_Start}$]/u;function X(te){let Vt=`${te.split(El).map((Gt)=>Gt.charAt(0).toUpperCase()+Gt.slice(1)).join("")}Context`;return Sl.test(Vt)?Vt:`_${Vt}`}var bl=/^\{([\s\S]*)\}$/,Cl=/^[A-Za-z_$][\w$]*$/,Tl=/^readonly\s+/,wl=/^\[[\w$]+\s*:[^\]]+\]$/;function d(te,{skipIndexSignatures:ne=!1,withReadonly:Fe=!1}={}){let Vt=te.trim(),Gt=bl.exec(Vt);if(!Gt)return null;let Kt=Gt[1].trim();if(Kt==="")return[];let zt=[];for(let Ut of r(Kt,";,")){let qt=Ut.trim();if(!qt)continue;let Xt=T(qt,":");if(Xt===-1)return null;let Jt=qt.slice(0,Xt).trim(),Qt=Jt.replace(Tl,""),Zt=qt.slice(Xt+1).trim();if(!Zt)return null;if(ne&&wl.test(Qt))continue;let en=!1;if(Qt.endsWith("?"))en=!0,Qt=Qt.slice(0,-1).trim();if(!Cl.test(Qt))return null;zt.push(Fe?{name:Qt,type:Zt,optional:en,readonly:Jt!==Qt}:{name:Qt,type:Zt,optional:en})}return zt}function se({imported:te}){return te.type==="Identifier"?te.name:te.value}function Y(te,ne){let Fe=ne.source.value;if(typeof Fe!=="string"||ne.importKind==="type")return;for(let Vt of ne.specifiers){if(Vt.type!=="ImportSpecifier"||Vt.importKind==="type")continue;let Gt=Vt.local.name,Kt=se(Vt);te.valueImportBindingsByLocalName.set(Gt,{localName:Gt,importedName:Kt,source:Fe})}}function oe(te){return[te.importedName,...te.members??[]].join(".")}function Pe(te,ne){let Fe=[],Vt=ne;while(A(Vt)){if(Vt.computed||!t(Vt.property))return;Fe.unshift(Vt.property.name),Vt=Vt.object}if(!t(Vt))return;return Q(te,Vt.name,Fe)}function Q(te,ne,Fe=[]){let Vt=(Kt,zt,Ut)=>Ut.length>0?{source:Kt,importedName:zt,members:Ut}:{source:Kt,importedName:zt},Gt=te.valueImportBindingsByLocalName.get(ne);if(Gt)return Vt(Gt.source,Gt.importedName,Fe);for(let Kt of[te.parsed?.instance,te.parsed?.module])for(let zt of Kt?.content.body??[]){if(zt.type!=="ImportDeclaration")continue;let Ut=zt.source.value;if(zt.importKind==="type"||typeof Ut!=="string")continue;let qt=zt.specifiers.find((Xt)=>Xt.local.name===ne);if(qt?.type==="ImportDefaultSpecifier")return Vt(Ut,"default",Fe);if(qt?.type==="ImportNamespaceSpecifier"&&Fe.length>0)return Vt(Ut,Fe[0],Fe.slice(1))}return}function ae(te,ne){if(!A(ne))return;return Pe(te,ne)}function Ve(te){let ne=new Map;for(let Fe of te.content.body){if(Fe.type!=="ImportDeclaration"||Fe.importKind==="type")continue;let Vt=Fe.source.value;if(typeof Vt!=="string")continue;for(let Gt of Fe.specifiers){if(Gt.type==="ImportSpecifier"&&Gt.importKind==="type")continue;let Kt=Gt.local.name,zt;if(Gt.type==="ImportDefaultSpecifier")zt="default";else if(Gt.type==="ImportNamespaceSpecifier")zt="*";else zt=se(Gt);ne.set(Kt,{from:Vt,imported:zt})}}return ne}function Ae(te,ne){for(let Fe of ne?.content.body??[]){if(Fe.type==="ImportDeclaration"){Y(te,Fe);continue}let Vt=Fe.type==="ExportNamedDeclaration"&&Fe.declaration?Fe.declaration:Fe;if(Vt.type==="FunctionDeclaration"&&Vt.id?.name)te.funcDecls.set(Vt.id.name,Vt)}}function le(te){return te==="TSTypeAnnotation"||te==="TSTypeAliasDeclaration"||te==="TSInterfaceDeclaration"||te==="TSTypeParameterDeclaration"||te==="TSTypeParameterInstantiation"}function Z(te){let ne=[];return o(te,{enter(Fe){if(Fe.type==="FunctionDeclaration"||Fe.type==="FunctionExpression"||Fe.type==="ArrowFunctionExpression")return p;if(Fe.type==="ReturnStatement")ne.push(Fe.argument??null)}}),ne}var sr={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},rr="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",kl={5:rr,"5module":rr+" export import",6:rr+" const class extends export import super"},Zo=/^in(stanceof)?$/,Al=/\p{ID_Start}/u,Pl=/[\p{ID_Continue}\u200c\u200d]/u;function g(te,ne){if(te<65)return te===36;if(te<91)return!0;if(te<97)return te===95;if(te<123)return!0;if(te>65535&&ne===!1)return!1;return te>=170&&Al.test(String.fromCodePoint(te))}function S(te,ne){if(te<48)return te===36;if(te<58)return!0;if(te<65)return!1;if(te<91)return!0;if(te<97)return te===95;if(te<123)return!0;if(te>65535&&ne===!1)return!1;return te>=170&&Pl.test(String.fromCodePoint(te))}var dn=function(te,ne){if(ne===void 0)ne={};this.label=te,this.keyword=ne.keyword,this.beforeExpr=!!ne.beforeExpr,this.startsExpr=!!ne.startsExpr,this.isLoop=!!ne.isLoop,this.isAssign=!!ne.isAssign,this.prefix=!!ne.prefix,this.postfix=!!ne.postfix,this.binop=ne.binop||null,this.updateContext=null};function Pn(te,ne){return new dn(te,{beforeExpr:!0,binop:ne})}var _n={beforeExpr:!0},Tn={startsExpr:!0},cr={};function hn(te,ne){if(ne===void 0)ne={};return ne.keyword=te,cr[te]=new dn(te,ne)}var Yt={num:new dn("num",Tn),regexp:new dn("regexp",Tn),string:new dn("string",Tn),name:new dn("name",Tn),privateId:new dn("privateId",Tn),eof:new dn("eof"),bracketL:new dn("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new dn("]"),braceL:new dn("{",{beforeExpr:!0,startsExpr:!0}),braceR:new dn("}"),parenL:new dn("(",{beforeExpr:!0,startsExpr:!0}),parenR:new dn(")"),comma:new dn(",",_n),semi:new dn(";",_n),colon:new dn(":",_n),dot:new dn("."),question:new dn("?",_n),questionDot:new dn("?."),arrow:new dn("=>",_n),template:new dn("template"),invalidTemplate:new dn("invalidTemplate"),ellipsis:new dn("...",_n),backQuote:new dn("`",Tn),dollarBraceL:new dn("${",{beforeExpr:!0,startsExpr:!0}),eq:new dn("=",{beforeExpr:!0,isAssign:!0}),assign:new dn("_=",{beforeExpr:!0,isAssign:!0}),incDec:new dn("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new dn("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Pn("||",1),logicalAND:Pn("&&",2),bitwiseOR:Pn("|",3),bitwiseXOR:Pn("^",4),bitwiseAND:Pn("&",5),equality:Pn("==/!=/===/!==",6),relational:Pn("</>/<=/>=",7),bitShift:Pn("<</>>/>>>",8),plusMin:new dn("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Pn("%",10),star:Pn("*",10),slash:Pn("/",10),starstar:new dn("**",{beforeExpr:!0}),coalesce:Pn("??",1),_break:hn("break"),_case:hn("case",_n),_catch:hn("catch"),_continue:hn("continue"),_debugger:hn("debugger"),_default:hn("default",_n),_do:hn("do",{isLoop:!0,beforeExpr:!0}),_else:hn("else",_n),_finally:hn("finally"),_for:hn("for",{isLoop:!0}),_function:hn("function",Tn),_if:hn("if"),_return:hn("return",_n),_switch:hn("switch"),_throw:hn("throw",_n),_try:hn("try"),_var:hn("var"),_const:hn("const"),_while:hn("while",{isLoop:!0}),_with:hn("with"),_new:hn("new",{beforeExpr:!0,startsExpr:!0}),_this:hn("this",Tn),_super:hn("super",Tn),_class:hn("class",Tn),_extends:hn("extends",_n),_export:hn("export"),_import:hn("import",Tn),_null:hn("null",Tn),_true:hn("true",Tn),_false:hn("false",Tn),_in:hn("in",{beforeExpr:!0,binop:7}),_instanceof:hn("instanceof",{beforeExpr:!0,binop:7}),_typeof:hn("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:hn("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:hn("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},wn=/\r\n?|\n|\u2028|\u2029/,_l=new RegExp(wn.source,"g");function bi(te){return te===10||te===13||te===8232||te===8233}function ea(te,ne,Fe){if(Fe===void 0)Fe=te.length;for(var Vt=ne;Vt<Fe;Vt++){var Gt=te.charCodeAt(Vt);if(bi(Gt))return Vt<Fe-1&&Gt===13&&te.charCodeAt(Vt+1)===10?Vt+2:Vt+1}return-1}var ta=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,xn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,$l=Object.prototype,{hasOwnProperty:Nl,toString:Dl}=$l,Oi=Object.hasOwn||function(te,ne){return Nl.call(te,ne)},Xo=Array.isArray||function(te){return Dl.call(te)==="[object Array]"},Jo=Object.create(null);function cs(te){return Jo[te]||(Jo[te]=new RegExp("^(?:"+te.replace(/ /g,"|")+")$"))}function ds(te){if(te<=65535)return String.fromCharCode(te);return te-=65536,String.fromCharCode((te>>10)+55296,(te&1023)+56320)}var Rl=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ii=function(te,ne){this.line=te,this.column=ne};Ii.prototype.offset=function(te){return new Ii(this.line,this.column+te)};var fs=function(te,ne,Fe){if(this.start=ne,this.end=Fe,te.sourceFile!==null)this.source=te.sourceFile};function na(te,ne){for(var Fe=1,Vt=0;;){var Gt=ea(te,Vt,ne);if(Gt<0)return new Ii(Fe,ne-Vt);++Fe,Vt=Gt}}var or={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Yo=!1;function Il(te){var ne={};for(var Fe in or)ne[Fe]=te&&Oi(te,Fe)?te[Fe]:or[Fe];if(ne.ecmaVersion==="latest")ne.ecmaVersion=1e8;else if(ne.ecmaVersion==null){if(!Yo&&typeof console==="object"&&console.warn)Yo=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
10
|
+
Defaulting to 2020, but this will stop working in the future.`);ne.ecmaVersion=11}else if(ne.ecmaVersion>=2015)ne.ecmaVersion-=2009;if(ne.allowReserved==null)ne.allowReserved=ne.ecmaVersion<5;if(!te||te.allowHashBang==null)ne.allowHashBang=ne.ecmaVersion>=14;if(Xo(ne.onToken)){var Vt=ne.onToken;ne.onToken=function(Gt){return Vt.push(Gt)}}if(Xo(ne.onComment))ne.onComment=Ol(ne,ne.onComment);if(ne.sourceType==="commonjs"&&ne.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return ne}function Ol(te,ne){return function(Fe,Vt,Gt,Kt,zt,Ut){var qt={type:Fe?"Block":"Line",value:Vt,start:Gt,end:Kt};if(te.locations)qt.loc=new fs(this,zt,Ut);if(te.ranges)qt.range=[Gt,Kt];ne.push(qt)}}var li=1,ui=2,lr=4,ia=8,ur=16,sa=32,ms=64,ra=128,hi=256,Li=512,oa=1024,gs=li|ui|hi;function hr(te,ne){return ui|(te?lr:0)|(ne?ia:0)}var ls=0,dr=1,Hn=2,aa=3,pa=4,ca=5,s=function(te,ne,Fe){this.options=te=Il(te),this.sourceFile=te.sourceFile,this.keywords=cs(kl[te.ecmaVersion>=6?6:te.sourceType==="module"?"5module":5]);var Vt="";if(te.allowReserved!==!0){if(Vt=sr[te.ecmaVersion>=6?6:te.ecmaVersion===5?5:3],te.sourceType==="module")Vt+=" await"}this.reservedWords=cs(Vt);var Gt=(Vt?Vt+" ":"")+sr.strict;if(this.reservedWordsStrict=cs(Gt),this.reservedWordsStrictBind=cs(Gt+" "+sr.strictBind),this.input=String(ne),this.containsEsc=!1,this.pos=Fe||0,this.curLine=1,te.startLocation)this.lineStart=this.pos-te.startLocation.column,this.curLine=te.startLocation.line;else if(Fe){if(this.lineStart=this.input.lastIndexOf(`
|
|
11
|
+
`,Fe-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(wn).length}else this.lineStart=0;if(this.type=Yt.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=te.sourceType==="module",this.strict=this.inModule||te.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&te.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?ui:li),this.regexpState=null,this.privateNameStack=[]},$n={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};s.prototype.parse=function(){var te=this,ne=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return te.parseTopLevel(ne)})};$n.inFunction.get=function(){return(this.currentVarScope().flags&ui)>0};$n.inGenerator.get=function(){return(this.currentVarScope().flags&ia)>0};$n.inAsync.get=function(){return(this.currentVarScope().flags&lr)>0};$n.canAwait.get=function(){for(var te=this.scopeStack.length-1;te>=0;te--){var ne=this.scopeStack[te],Fe=ne.flags;if(Fe&(hi|Li))return!1;if(Fe&ui)return(Fe&lr)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};$n.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&li)return!0;return!1};$n.allowSuper.get=function(){var te=this.currentThisScope(),ne=te.flags;return(ne&ms)>0||this.options.allowSuperOutsideMethod};$n.allowDirectSuper.get=function(){return(this.currentThisScope().flags&ra)>0};$n.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};$n.allowNewDotTarget.get=function(){for(var te=this.scopeStack.length-1;te>=0;te--){var ne=this.scopeStack[te],Fe=ne.flags;if(Fe&(hi|Li)||Fe&ui&&!(Fe&ur))return!0}return!1};$n.allowUsing.get=function(){var te=this.currentScope(),ne=te.flags;if(ne&oa)return!1;if(!this.inModule&&ne&li)return!1;return!0};$n.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&hi)>0};s.extend=function(){var te=[],ne=arguments.length;while(ne--)te[ne]=arguments[ne];var Fe=this;for(var Vt=0;Vt<te.length;Vt++)Fe=te[Vt](Fe);return Fe};s.parse=function(te,ne){return new this(ne,te).parse()};s.parseExpressionAt=function(te,ne,Fe){var Vt=new this(Fe,te,ne);return Vt.nextToken(),Vt.parseExpression()};s.tokenizer=function(te,ne){return new this(ne,te)};Object.defineProperties(s.prototype,$n);var bn=s.prototype,Ll=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;bn.strictDirective=function(te){if(this.options.ecmaVersion<5)return!1;for(;;){xn.lastIndex=te,te+=xn.exec(this.input)[0].length;var ne=Ll.exec(this.input.slice(te));if(!ne)return!1;if((ne[1]||ne[2])==="use strict"){xn.lastIndex=te+ne[0].length;var Fe=xn.exec(this.input),Vt=Fe.index+Fe[0].length,Gt=this.input.charAt(Vt);return Gt===";"||Gt==="}"||wn.test(Fe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Gt)||Gt==="!"&&this.input.charAt(Vt+1)==="="||Gt==="i"&&Ml(this,Vt))}if(te+=ne[0].length,xn.lastIndex=te,te+=xn.exec(this.input)[0].length,this.input[te]===";")te++}};function Ml(te,ne){var Fe=ne+1,Vt=Math.min(te.input.length,ne+11);while(Fe<Vt){var Gt=te.fullCharCodeAt(Fe);if(!S(Gt,!0))break;Fe+=Gt<=65535?1:2}return Fe===ne+2&&te.input.slice(ne,Fe)==="in"||Fe===ne+10&&te.input.slice(ne,Fe)==="instanceof"}bn.eat=function(te){if(this.type===te)return this.next(),!0;else return!1};bn.isContextual=function(te){return this.type===Yt.name&&this.value===te&&!this.containsEsc};bn.eatContextual=function(te){if(!this.isContextual(te))return!1;return this.next(),!0};bn.catchStackOverflow=function(te){try{return te()}catch(ne){if(ne instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(ne.message)||/\btoo much recursion\b/i.test(ne.message)))this.raise(this.start,"Not enough stack space to parse input");else throw ne}};bn.expectContextual=function(te){if(!this.eatContextual(te))this.unexpected()};bn.canInsertSemicolon=function(){return this.type===Yt.eof||this.type===Yt.braceR||wn.test(this.input.slice(this.lastTokEnd,this.start))};bn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};bn.semicolon=function(){if(!this.eat(Yt.semi)&&!this.insertSemicolon())this.unexpected()};bn.afterTrailingComma=function(te,ne){if(this.type===te){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!ne)this.next();return!0}};bn.expect=function(te){this.eat(te)||this.unexpected()};bn.unexpected=function(te){this.raise(te!=null?te:this.start,"Unexpected token")};var ys=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};bn.checkPatternErrors=function(te,ne){if(!te)return;if(te.trailingComma>-1)this.raiseRecoverable(te.trailingComma,"Comma is not permitted after the rest element");var Fe=ne?te.parenthesizedAssign:te.parenthesizedBind;if(Fe>-1)this.raiseRecoverable(Fe,ne?"Assigning to rvalue":"Parenthesized pattern")};bn.checkExpressionErrors=function(te,ne){if(!te)return!1;var{shorthandAssign:Fe,doubleProto:Vt}=te;if(!ne)return Fe>=0||Vt>=0;if(Fe>=0)this.raise(Fe,"Shorthand property assignments are valid only in destructuring patterns");if(Vt>=0)this.raiseRecoverable(Vt,"Redefinition of __proto__ property")};bn.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};bn.isSimpleAssignTarget=function(te){if(te.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(te.expression);return te.type==="Identifier"||te.type==="MemberExpression"};var rn=s.prototype;rn.parseTopLevel=function(te){var ne=Object.create(null);if(!te.body)te.body=[];while(this.type!==Yt.eof){var Fe=this.parseStatement(null,!0,ne);te.body.push(Fe)}if(this.inModule)for(var Vt=0,Gt=Object.keys(this.undefinedExports);Vt<Gt.length;Vt+=1){var Kt=Gt[Vt];this.raiseRecoverable(this.undefinedExports[Kt].start,"Export '"+Kt+"' is not defined")}return this.adaptDirectivePrologue(te.body),this.next(),te.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(te,"Program")};var fr={kind:"loop"},Fl={kind:"switch"};rn.isLet=function(te){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;xn.lastIndex=this.pos;var ne=xn.exec(this.input),Fe=this.pos+ne[0].length,Vt=this.fullCharCodeAt(Fe);if(Vt===91||Vt===92)return!0;if(te)return!1;if(Vt===123)return!0;if(g(Vt)){var Gt=Fe;do Fe+=Vt<=65535?1:2;while(S(Vt=this.fullCharCodeAt(Fe)));if(Vt===92)return!0;var Kt=this.input.slice(Gt,Fe);if(!Zo.test(Kt))return!0}return!1};rn.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;xn.lastIndex=this.pos;var te=xn.exec(this.input),ne=this.pos+te[0].length,Fe;return!wn.test(this.input.slice(this.pos,ne))&&this.input.slice(ne,ne+8)==="function"&&(ne+8===this.input.length||!(S(Fe=this.fullCharCodeAt(ne+8))||Fe===92))};rn.isUsingKeyword=function(te,ne){if(this.options.ecmaVersion<17||!this.isContextual(te?"await":"using"))return!1;xn.lastIndex=this.pos;var Fe=xn.exec(this.input),Vt=this.pos+Fe[0].length;if(wn.test(this.input.slice(this.pos,Vt)))return!1;if(te){var Gt=Vt+5,Kt;if(this.input.slice(Vt,Gt)!=="using"||Gt===this.input.length||S(Kt=this.fullCharCodeAt(Gt))||Kt===92)return!1;xn.lastIndex=Gt;var zt=xn.exec(this.input);if(Vt=Gt+zt[0].length,zt&&wn.test(this.input.slice(Gt,Vt)))return!1}var Ut=this.fullCharCodeAt(Vt);if(!g(Ut)&&Ut!==92)return!1;var qt=Vt;do Vt+=Ut<=65535?1:2;while(S(Ut=this.fullCharCodeAt(Vt)));if(Ut===92)return!0;var Xt=this.input.slice(qt,Vt);if(Zo.test(Xt))return!1;if(ne&&!te&&Xt==="of"){xn.lastIndex=Vt;var Jt=xn.exec(this.input);if(Vt=Vt+Jt[0].length,this.input.charCodeAt(Vt)!==61||(Ut=this.input.charCodeAt(Vt+1))===61||Ut===62)return!1}return!0};rn.isAwaitUsing=function(te){return this.isUsingKeyword(!0,te)};rn.isUsing=function(te){return this.isUsingKeyword(!1,te)};rn.parseStatement=function(te,ne,Fe){var Vt=this.type,Gt=this.startNode(),Kt;if(this.isLet(te))Vt=Yt._var,Kt="let";switch(Vt){case Yt._break:case Yt._continue:return this.parseBreakContinueStatement(Gt,Vt.keyword);case Yt._debugger:return this.parseDebuggerStatement(Gt);case Yt._do:return this.parseDoStatement(Gt);case Yt._for:return this.parseForStatement(Gt);case Yt._function:if(te&&(this.strict||te!=="if"&&te!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Gt,!1,!te);case Yt._class:if(te)this.unexpected();return this.parseClass(Gt,!0);case Yt._if:return this.parseIfStatement(Gt);case Yt._return:return this.parseReturnStatement(Gt);case Yt._switch:return this.parseSwitchStatement(Gt);case Yt._throw:return this.parseThrowStatement(Gt);case Yt._try:return this.parseTryStatement(Gt);case Yt._const:case Yt._var:if(Kt=Kt||this.value,te&&Kt!=="var")this.unexpected();return this.parseVarStatement(Gt,Kt);case Yt._while:return this.parseWhileStatement(Gt);case Yt._with:return this.parseWithStatement(Gt);case Yt.braceL:return this.parseBlock(!0,Gt);case Yt.semi:return this.parseEmptyStatement(Gt);case Yt._export:case Yt._import:if(this.options.ecmaVersion>10&&Vt===Yt._import){xn.lastIndex=this.pos;var zt=xn.exec(this.input),Ut=this.pos+zt[0].length,qt=this.input.charCodeAt(Ut);if(qt===40||qt===46)return this.parseExpressionStatement(Gt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!ne)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return Vt===Yt._import?this.parseImport(Gt):this.parseExport(Gt,Fe);default:if(this.isAsyncFunction()){if(te)this.unexpected();return this.next(),this.parseFunctionStatement(Gt,!0,!te)}var Xt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Xt){if(!this.allowUsing)this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");if(te)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Xt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Gt,!1,Xt),this.semicolon(),this.finishNode(Gt,"VariableDeclaration")}var Jt=this.value,Qt=this.parseExpression();if(Vt===Yt.name&&Qt.type==="Identifier"&&this.eat(Yt.colon))return this.parseLabeledStatement(Gt,Jt,Qt,te);else return this.parseExpressionStatement(Gt,Qt)}};rn.parseBreakContinueStatement=function(te,ne){var Fe=ne==="break";if(this.next(),this.eat(Yt.semi)||this.insertSemicolon())te.label=null;else if(this.type!==Yt.name)this.unexpected();else te.label=this.parseIdent(),this.semicolon();var Vt=0;for(;Vt<this.labels.length;++Vt){var Gt=this.labels[Vt];if(te.label==null||Gt.name===te.label.name){if(Gt.kind!=null&&(Fe||Gt.kind==="loop"))break;if(te.label&&Fe)break}}if(Vt===this.labels.length)this.raise(te.start,"Unsyntactic "+ne);return this.finishNode(te,Fe?"BreakStatement":"ContinueStatement")};rn.parseDebuggerStatement=function(te){return this.next(),this.semicolon(),this.finishNode(te,"DebuggerStatement")};rn.parseDoStatement=function(te){if(this.next(),this.labels.push(fr),te.body=this.parseStatement("do"),this.labels.pop(),this.expect(Yt._while),te.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Yt.semi);else this.semicolon();return this.finishNode(te,"DoWhileStatement")};rn.parseForStatement=function(te){this.next();var ne=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(fr),this.enterScope(0),this.expect(Yt.parenL),this.type===Yt.semi){if(ne>-1)this.unexpected(ne);return this.parseFor(te,null)}var Fe=this.isLet();if(this.type===Yt._var||this.type===Yt._const||Fe){var Vt=this.startNode(),Gt=Fe?"let":this.value;return this.next(),this.parseVar(Vt,!0,Gt),this.finishNode(Vt,"VariableDeclaration"),this.parseForAfterInit(te,Vt,ne)}var Kt=this.isContextual("let"),zt=!1,Ut=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Ut){var qt=this.startNode();if(this.next(),Ut==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(qt,!0,Ut),this.finishNode(qt,"VariableDeclaration"),this.parseForAfterInit(te,qt,ne)}var Xt=this.containsEsc,Jt=new ys,Qt=this.start,Zt=ne>-1?this.parseExprSubscripts(Jt,"await"):this.parseExpression(!0,Jt);if(this.type===Yt._in||(zt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(ne>-1){if(this.type===Yt._in)this.unexpected(ne);te.await=!0}else if(zt&&this.options.ecmaVersion>=8){if(Zt.start===Qt&&!Xt&&Zt.type==="Identifier"&&Zt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)te.await=!1}if(Kt&&zt)this.raise(Zt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(Zt,!1,Jt),this.checkLValPattern(Zt),this.parseForIn(te,Zt)}else this.checkExpressionErrors(Jt,!0);if(ne>-1)this.unexpected(ne);return this.parseFor(te,Zt)};rn.parseForAfterInit=function(te,ne,Fe){if((this.type===Yt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&ne.declarations.length===1){if(this.type===Yt._in){if((ne.kind==="using"||ne.kind==="await using")&&!ne.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Fe>-1)this.unexpected(Fe)}else if(this.options.ecmaVersion>=9)te.await=Fe>-1;return this.parseForIn(te,ne)}if(Fe>-1)this.unexpected(Fe);return this.parseFor(te,ne)};rn.parseFunctionStatement=function(te,ne,Fe){return this.next(),this.parseFunction(te,Ri|(Fe?0:ar),!1,ne)};rn.parseIfStatement=function(te){return this.next(),te.test=this.parseParenExpression(),te.consequent=this.parseStatement("if"),te.alternate=this.eat(Yt._else)?this.parseStatement("if"):null,this.finishNode(te,"IfStatement")};rn.parseReturnStatement=function(te){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Yt.semi)||this.insertSemicolon())te.argument=null;else te.argument=this.parseExpression(),this.semicolon();return this.finishNode(te,"ReturnStatement")};rn.parseSwitchStatement=function(te){this.next(),te.discriminant=this.parseParenExpression(),te.cases=[],this.expect(Yt.braceL),this.labels.push(Fl),this.enterScope(oa);var ne;for(var Fe=!1;this.type!==Yt.braceR;)if(this.type===Yt._case||this.type===Yt._default){var Vt=this.type===Yt._case;if(ne)this.finishNode(ne,"SwitchCase");if(te.cases.push(ne=this.startNode()),ne.consequent=[],this.next(),Vt)ne.test=this.parseExpression();else{if(Fe)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Fe=!0,ne.test=null}this.expect(Yt.colon)}else{if(!ne)this.unexpected();ne.consequent.push(this.parseStatement(null))}if(this.exitScope(),ne)this.finishNode(ne,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(te,"SwitchStatement")};rn.parseThrowStatement=function(te){if(this.next(),wn.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return te.argument=this.parseExpression(),this.semicolon(),this.finishNode(te,"ThrowStatement")};var Bl=[];rn.parseCatchClauseParam=function(){var te=this.parseBindingAtom(),ne=te.type==="Identifier";return this.enterScope(ne?sa:0),this.checkLValPattern(te,ne?pa:Hn),this.expect(Yt.parenR),te};rn.parseTryStatement=function(te){if(this.next(),te.block=this.parseBlock(),te.handler=null,this.type===Yt._catch){var ne=this.startNode();if(this.next(),this.eat(Yt.parenL))ne.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();ne.param=null,this.enterScope(0)}ne.body=this.parseBlock(!1),this.exitScope(),te.handler=this.finishNode(ne,"CatchClause")}if(te.finalizer=this.eat(Yt._finally)?this.parseBlock():null,!te.handler&&!te.finalizer)this.raise(te.start,"Missing catch or finally clause");return this.finishNode(te,"TryStatement")};rn.parseVarStatement=function(te,ne,Fe){return this.next(),this.parseVar(te,!1,ne,Fe),this.semicolon(),this.finishNode(te,"VariableDeclaration")};rn.parseWhileStatement=function(te){return this.next(),te.test=this.parseParenExpression(),this.labels.push(fr),te.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(te,"WhileStatement")};rn.parseWithStatement=function(te){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),te.object=this.parseParenExpression(),te.body=this.parseStatement("with"),this.finishNode(te,"WithStatement")};rn.parseEmptyStatement=function(te){return this.next(),this.finishNode(te,"EmptyStatement")};rn.parseLabeledStatement=function(te,ne,Fe,Vt){for(var Gt=0,Kt=this.labels;Gt<Kt.length;Gt+=1){var zt=Kt[Gt];if(zt.name===ne)this.raise(Fe.start,"Label '"+ne+"' is already declared")}var Ut=this.type.isLoop?"loop":this.type===Yt._switch?"switch":null;for(var qt=this.labels.length-1;qt>=0;qt--){var Xt=this.labels[qt];if(Xt.statementStart===te.start)Xt.statementStart=this.start,Xt.kind=Ut;else break}return this.labels.push({name:ne,kind:Ut,statementStart:this.start}),te.body=this.parseStatement(Vt?Vt.indexOf("label")===-1?Vt+"label":Vt:"label"),this.labels.pop(),te.label=Fe,this.finishNode(te,"LabeledStatement")};rn.parseExpressionStatement=function(te,ne){return te.expression=ne,this.semicolon(),this.finishNode(te,"ExpressionStatement")};rn.parseBlock=function(te,ne,Fe){if(te===void 0)te=!0;if(ne===void 0)ne=this.startNode();if(ne.body=[],this.expect(Yt.braceL),te)this.enterScope(0);while(this.type!==Yt.braceR){var Vt=this.parseStatement(null);ne.body.push(Vt)}if(Fe)this.strict=!1;if(this.next(),te)this.exitScope();return this.finishNode(ne,"BlockStatement")};rn.parseFor=function(te,ne){return te.init=ne,this.expect(Yt.semi),te.test=this.type===Yt.semi?null:this.parseExpression(),this.expect(Yt.semi),te.update=this.type===Yt.parenR?null:this.parseExpression(),this.expect(Yt.parenR),te.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(te,"ForStatement")};rn.parseForIn=function(te,ne){var Fe=this.type===Yt._in;if(this.next(),ne.type==="VariableDeclaration"&&ne.declarations[0].init!=null&&(!Fe||this.options.ecmaVersion<8||this.strict||ne.kind!=="var"||ne.declarations[0].id.type!=="Identifier"))this.raise(ne.start,(Fe?"for-in":"for-of")+" loop variable declaration may not have an initializer");return te.left=ne,te.right=Fe?this.parseExpression():this.parseMaybeAssign(),this.expect(Yt.parenR),te.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(te,Fe?"ForInStatement":"ForOfStatement")};rn.parseVar=function(te,ne,Fe,Vt){te.declarations=[],te.kind=Fe;for(;;){var Gt=this.startNode();if(this.parseVarId(Gt,Fe),this.eat(Yt.eq))Gt.init=this.parseMaybeAssign(ne);else if(!Vt&&Fe==="const"&&!(this.type===Yt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Vt&&(Fe==="using"||Fe==="await using")&&this.options.ecmaVersion>=17&&this.type!==Yt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Fe+" declaration");else if(!Vt&&Gt.id.type!=="Identifier"&&!(ne&&(this.type===Yt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Gt.init=null;if(te.declarations.push(this.finishNode(Gt,"VariableDeclarator")),!this.eat(Yt.comma))break}return te};rn.parseVarId=function(te,ne){te.id=ne==="using"||ne==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(te.id,ne==="var"?dr:Hn,!1)};var Ri=1,ar=2,la=4;rn.parseFunction=function(te,ne,Fe,Vt,Gt){if(this.initFunction(te),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Vt){if(this.type===Yt.star&&ne&ar)this.unexpected();te.generator=this.eat(Yt.star)}if(this.options.ecmaVersion>=8)te.async=!!Vt;if(ne&Ri){if(te.id=ne&la&&this.type!==Yt.name?null:this.parseIdent(),te.id&&!(ne&ar))this.checkLValSimple(te.id,this.strict||te.generator||te.async?this.treatFunctionsAsVar?dr:Hn:aa)}var Kt=this.yieldPos,zt=this.awaitPos,Ut=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(hr(te.async,te.generator)),!(ne&Ri))te.id=this.type===Yt.name?this.parseIdent():null;return this.parseFunctionParams(te),this.parseFunctionBody(te,Fe,!1,Gt),this.yieldPos=Kt,this.awaitPos=zt,this.awaitIdentPos=Ut,this.finishNode(te,ne&Ri?"FunctionDeclaration":"FunctionExpression")};rn.parseFunctionParams=function(te){this.expect(Yt.parenL),te.params=this.parseBindingList(Yt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};rn.parseClass=function(te,ne){this.next();var Fe=this.strict;this.strict=!0,this.parseClassId(te,ne),this.parseClassSuper(te);var Vt=this.enterClassBody(),Gt=this.startNode(),Kt=!1;Gt.body=[],this.expect(Yt.braceL);while(this.type!==Yt.braceR){var zt=this.parseClassElement(te.superClass!==null);if(zt){if(Gt.body.push(zt),zt.type==="MethodDefinition"&&zt.kind==="constructor"){if(Kt)this.raiseRecoverable(zt.start,"Duplicate constructor in the same class");Kt=!0}else if(zt.key&&zt.key.type==="PrivateIdentifier"&&jl(Vt,zt))this.raiseRecoverable(zt.key.start,"Identifier '#"+zt.key.name+"' has already been declared")}}return this.strict=Fe,this.next(),te.body=this.finishNode(Gt,"ClassBody"),this.exitClassBody(),this.finishNode(te,ne?"ClassDeclaration":"ClassExpression")};rn.parseClassElement=function(te){if(this.eat(Yt.semi))return null;var ne=this.options.ecmaVersion,Fe=this.startNode(),Vt="",Gt=!1,Kt=!1,zt="method",Ut=!1;if(this.eatContextual("static")){if(ne>=13&&this.eat(Yt.braceL))return this.parseClassStaticBlock(Fe),Fe;if(this.isClassElementNameStart()||this.type===Yt.star)Ut=!0;else Vt="static"}if(Fe.static=Ut,!Vt&&ne>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Yt.star)&&!this.canInsertSemicolon())Kt=!0;else Vt="async";if(!Vt&&(ne>=9||!Kt)&&this.eat(Yt.star))Gt=!0;if(!Vt&&!Kt&&!Gt){var qt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())zt=qt;else Vt=qt}if(Vt)Fe.computed=!1,Fe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Fe.key.name=Vt,this.finishNode(Fe.key,"Identifier");else this.parseClassElementName(Fe);if(ne<13||this.type===Yt.parenL||zt!=="method"||Gt||Kt){var Xt=!Fe.static&&us(Fe,"constructor"),Jt=Xt&&te;if(Xt&&zt!=="method")this.raise(Fe.key.start,"Constructor can't have get/set modifier");Fe.kind=Xt?"constructor":zt,this.parseClassMethod(Fe,Gt,Kt,Jt)}else this.parseClassField(Fe);return Fe};rn.isClassElementNameStart=function(){return this.type===Yt.name||this.type===Yt.privateId||this.type===Yt.num||this.type===Yt.string||this.type===Yt.bracketL||this.type.keyword};rn.parseClassElementName=function(te){if(this.type===Yt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");te.computed=!1,te.key=this.parsePrivateIdent()}else this.parsePropertyName(te)};rn.parseClassMethod=function(te,ne,Fe,Vt){var Gt=te.key;if(te.kind==="constructor"){if(ne)this.raise(Gt.start,"Constructor can't be a generator");if(Fe)this.raise(Gt.start,"Constructor can't be an async method")}else if(te.static&&us(te,"prototype"))this.raise(Gt.start,"Classes may not have a static property named prototype");var Kt=te.value=this.parseMethod(ne,Fe,Vt);if(te.kind==="get"&&Kt.params.length!==0)this.raiseRecoverable(Kt.start,"getter should have no params");if(te.kind==="set"&&Kt.params.length!==1)this.raiseRecoverable(Kt.start,"setter should have exactly one param");if(te.kind==="set"&&Kt.params[0].type==="RestElement")this.raiseRecoverable(Kt.params[0].start,"Setter cannot use rest params");return this.finishNode(te,"MethodDefinition")};rn.parseClassField=function(te){if(us(te,"constructor"))this.raise(te.key.start,"Classes can't have a field named 'constructor'");else if(te.static&&us(te,"prototype"))this.raise(te.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Yt.eq))this.enterScope(Li|ms),te.value=this.parseMaybeAssign(),this.exitScope();else te.value=null;return this.semicolon(),this.finishNode(te,"PropertyDefinition")};rn.parseClassStaticBlock=function(te){te.body=[];var ne=this.labels;this.labels=[],this.enterScope(hi|ms);while(this.type!==Yt.braceR){var Fe=this.parseStatement(null);te.body.push(Fe)}return this.next(),this.exitScope(),this.labels=ne,this.finishNode(te,"StaticBlock")};rn.parseClassId=function(te,ne){if(this.type===Yt.name){if(te.id=this.parseIdent(),ne)this.checkLValSimple(te.id,Hn,!1)}else{if(ne===!0)this.unexpected();te.id=null}};rn.parseClassSuper=function(te){te.superClass=this.eat(Yt._extends)?this.parseExprSubscripts(null,!1):null};rn.enterClassBody=function(){var te={declared:Object.create(null),used:[]};return this.privateNameStack.push(te),te.declared};rn.exitClassBody=function(){var te=this.privateNameStack.pop(),{declared:ne,used:Fe}=te;if(!this.options.checkPrivateFields)return;var Vt=this.privateNameStack.length,Gt=Vt===0?null:this.privateNameStack[Vt-1];for(var Kt=0;Kt<Fe.length;++Kt){var zt=Fe[Kt];if(!Oi(ne,zt.name))if(Gt)Gt.used.push(zt);else this.raiseRecoverable(zt.start,"Private field '#"+zt.name+"' must be declared in an enclosing class")}};function jl(te,ne){var Fe=ne.key.name,Vt=te[Fe],Gt="true";if(ne.type==="MethodDefinition"&&(ne.kind==="get"||ne.kind==="set"))Gt=(ne.static?"s":"i")+ne.kind;if(Vt==="iget"&&Gt==="iset"||Vt==="iset"&&Gt==="iget"||Vt==="sget"&&Gt==="sset"||Vt==="sset"&&Gt==="sget")return te[Fe]="true",!1;else if(!Vt)return te[Fe]=Gt,!1;else return!0}function us(te,ne){var{computed:Fe,key:Vt}=te;return!Fe&&(Vt.type==="Identifier"&&Vt.name===ne||Vt.type==="Literal"&&Vt.value===ne)}rn.parseExportAllDeclaration=function(te,ne){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))te.exported=this.parseModuleExportName(),this.checkExport(ne,te.exported,this.lastTokStart);else te.exported=null;if(this.expectContextual("from"),this.type!==Yt.string)this.unexpected();if(te.source=this.parseExprAtom(),this.options.ecmaVersion>=16)te.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(te,"ExportAllDeclaration")};rn.parseExport=function(te,ne){if(this.next(),this.eat(Yt.star))return this.parseExportAllDeclaration(te,ne);if(this.eat(Yt._default))return this.checkExport(ne,"default",this.lastTokStart),te.declaration=this.parseExportDefaultDeclaration(),this.finishNode(te,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(te.declaration=this.parseExportDeclaration(te),te.declaration.type==="VariableDeclaration")this.checkVariableExport(ne,te.declaration.declarations);else this.checkExport(ne,te.declaration.id,te.declaration.id.start);if(te.specifiers=[],te.source=null,this.options.ecmaVersion>=16)te.attributes=[]}else{if(te.declaration=null,te.specifiers=this.parseExportSpecifiers(ne),this.eatContextual("from")){if(this.type!==Yt.string)this.unexpected();if(te.source=this.parseExprAtom(),this.options.ecmaVersion>=16)te.attributes=this.parseWithClause()}else{for(var Fe=0,Vt=te.specifiers;Fe<Vt.length;Fe+=1){var Gt=Vt[Fe];if(this.checkUnreserved(Gt.local),this.checkLocalExport(Gt.local),Gt.local.type==="Literal")this.raise(Gt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(te.source=null,this.options.ecmaVersion>=16)te.attributes=[]}this.semicolon()}return this.finishNode(te,"ExportNamedDeclaration")};rn.parseExportDeclaration=function(te){return this.parseStatement(null)};rn.parseExportDefaultDeclaration=function(){var te;if(this.type===Yt._function||(te=this.isAsyncFunction())){var ne=this.startNode();if(this.next(),te)this.next();return this.parseFunction(ne,Ri|la,!1,te)}else if(this.type===Yt._class){var Fe=this.startNode();return this.parseClass(Fe,"nullableID")}else{var Vt=this.parseMaybeAssign();return this.semicolon(),Vt}};rn.checkExport=function(te,ne,Fe){if(!te)return;if(typeof ne!=="string")ne=ne.type==="Identifier"?ne.name:ne.value;if(Oi(te,ne))this.raiseRecoverable(Fe,"Duplicate export '"+ne+"'");te[ne]=!0};rn.checkPatternExport=function(te,ne){var Fe=ne.type;if(Fe==="Identifier")this.checkExport(te,ne,ne.start);else if(Fe==="ObjectPattern")for(var Vt=0,Gt=ne.properties;Vt<Gt.length;Vt+=1){var Kt=Gt[Vt];this.checkPatternExport(te,Kt)}else if(Fe==="ArrayPattern")for(var zt=0,Ut=ne.elements;zt<Ut.length;zt+=1){var qt=Ut[zt];if(qt)this.checkPatternExport(te,qt)}else if(Fe==="Property")this.checkPatternExport(te,ne.value);else if(Fe==="AssignmentPattern")this.checkPatternExport(te,ne.left);else if(Fe==="RestElement")this.checkPatternExport(te,ne.argument)};rn.checkVariableExport=function(te,ne){if(!te)return;for(var Fe=0,Vt=ne;Fe<Vt.length;Fe+=1){var Gt=Vt[Fe];this.checkPatternExport(te,Gt.id)}};rn.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};rn.parseExportSpecifier=function(te){var ne=this.startNode();return ne.local=this.parseModuleExportName(),ne.exported=this.eatContextual("as")?this.parseModuleExportName():ne.local,this.checkExport(te,ne.exported,ne.exported.start),this.finishNode(ne,"ExportSpecifier")};rn.parseExportSpecifiers=function(te){var ne=[],Fe=!0;this.expect(Yt.braceL);while(!this.eat(Yt.braceR)){if(!Fe){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else Fe=!1;ne.push(this.parseExportSpecifier(te))}return ne};rn.parseImport=function(te){if(this.next(),this.type===Yt.string)te.specifiers=Bl,te.source=this.parseExprAtom();else te.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),te.source=this.type===Yt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)te.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(te,"ImportDeclaration")};rn.parseImportSpecifier=function(){var te=this.startNode();if(te.imported=this.parseModuleExportName(),this.eatContextual("as"))te.local=this.parseIdent();else this.checkUnreserved(te.imported),te.local=te.imported;return this.checkLValSimple(te.local,Hn),this.finishNode(te,"ImportSpecifier")};rn.parseImportDefaultSpecifier=function(){var te=this.startNode();return te.local=this.parseIdent(),this.checkLValSimple(te.local,Hn),this.finishNode(te,"ImportDefaultSpecifier")};rn.parseImportNamespaceSpecifier=function(){var te=this.startNode();return this.next(),this.expectContextual("as"),te.local=this.parseIdent(),this.checkLValSimple(te.local,Hn),this.finishNode(te,"ImportNamespaceSpecifier")};rn.parseImportSpecifiers=function(){var te=[],ne=!0;if(this.type===Yt.name){if(te.push(this.parseImportDefaultSpecifier()),!this.eat(Yt.comma))return te}if(this.type===Yt.star)return te.push(this.parseImportNamespaceSpecifier()),te;this.expect(Yt.braceL);while(!this.eat(Yt.braceR)){if(!ne){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else ne=!1;te.push(this.parseImportSpecifier())}return te};rn.parseWithClause=function(){var te=[];if(!this.eat(Yt._with))return te;this.expect(Yt.braceL);var ne={},Fe=!0;while(!this.eat(Yt.braceR)){if(!Fe){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else Fe=!1;var Vt=this.parseImportAttribute(),Gt=Vt.key.type==="Identifier"?Vt.key.name:Vt.key.value;if(Oi(ne,Gt))this.raiseRecoverable(Vt.key.start,"Duplicate attribute key '"+Gt+"'");ne[Gt]=!0,te.push(Vt)}return te};rn.parseImportAttribute=function(){var te=this.startNode();if(te.key=this.type===Yt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Yt.colon),this.type!==Yt.string)this.unexpected();return te.value=this.parseExprAtom(),this.finishNode(te,"ImportAttribute")};rn.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Yt.string){var te=this.parseLiteral(this.value);if(Rl.test(te.value))this.raise(te.start,"An export name cannot include a lone surrogate.");return te}return this.parseIdent(!0)};rn.adaptDirectivePrologue=function(te){for(var ne=0;ne<te.length&&this.isDirectiveCandidate(te[ne]);++ne)te[ne].directive=te[ne].expression.raw.slice(1,-1)};rn.isDirectiveCandidate=function(te){return this.options.ecmaVersion>=5&&te.type==="ExpressionStatement"&&te.expression.type==="Literal"&&typeof te.expression.value==="string"&&(this.input[te.start]==='"'||this.input[te.start]==="'")};var Nn=s.prototype;Nn.toAssignable=function(te,ne,Fe){if(this.options.ecmaVersion>=6&&te)switch(te.type){case"Identifier":if(this.inAsync&&te.name==="await")this.raise(te.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(te.type="ObjectPattern",Fe)this.checkPatternErrors(Fe,!0);for(var Vt=0,Gt=te.properties;Vt<Gt.length;Vt+=1){var Kt=Gt[Vt];if(this.toAssignable(Kt,ne),Kt.type==="RestElement"&&(Kt.argument.type==="ArrayPattern"||Kt.argument.type==="ObjectPattern"))this.raise(Kt.argument.start,"Unexpected token")}break;case"Property":if(te.kind!=="init")this.raise(te.key.start,"Object pattern can't contain getter or setter");this.toAssignable(te.value,ne);break;case"ArrayExpression":if(te.type="ArrayPattern",Fe)this.checkPatternErrors(Fe,!0);this.toAssignableList(te.elements,ne);break;case"SpreadElement":if(te.type="RestElement",this.toAssignable(te.argument,ne),te.argument.type==="AssignmentPattern")this.raise(te.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(te.operator!=="=")this.raise(te.left.end,"Only '=' operator can be used for specifying default value.");te.type="AssignmentPattern",delete te.operator,this.toAssignable(te.left,ne);break;case"ParenthesizedExpression":this.toAssignable(te.expression,ne,Fe);break;case"ChainExpression":this.raiseRecoverable(te.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ne)break;default:this.raise(te.start,"Assigning to rvalue")}else if(Fe)this.checkPatternErrors(Fe,!0);return te};Nn.toAssignableList=function(te,ne){var Fe=te.length;for(var Vt=0;Vt<Fe;Vt++){var Gt=te[Vt];if(Gt)this.toAssignable(Gt,ne)}if(Fe){var Kt=te[Fe-1];if(this.options.ecmaVersion===6&&ne&&Kt&&Kt.type==="RestElement"&&Kt.argument.type!=="Identifier")this.unexpected(Kt.argument.start)}return te};Nn.parseSpread=function(te){var ne=this.startNode();return this.next(),ne.argument=this.parseMaybeAssign(!1,te),this.finishNode(ne,"SpreadElement")};Nn.parseRestBinding=function(){var te=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Yt.name)this.unexpected();return te.argument=this.parseBindingAtom(),this.finishNode(te,"RestElement")};Nn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Yt.bracketL:var te=this.startNode();return this.next(),te.elements=this.parseBindingList(Yt.bracketR,!0,!0),this.finishNode(te,"ArrayPattern");case Yt.braceL:return this.parseObj(!0)}return this.parseIdent()};Nn.parseBindingList=function(te,ne,Fe,Vt){var Gt=[],Kt=!0;while(!this.eat(te)){if(Kt)Kt=!1;else this.expect(Yt.comma);if(ne&&this.type===Yt.comma)Gt.push(null);else if(Fe&&this.afterTrailingComma(te))break;else if(this.type===Yt.ellipsis){var zt=this.parseRestBinding();if(this.parseBindingListItem(zt),Gt.push(zt),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(te);break}else Gt.push(this.parseAssignableListItem(Vt))}return Gt};Nn.parseAssignableListItem=function(te){var ne=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ne),ne};Nn.parseBindingListItem=function(te){return te};Nn.parseMaybeDefault=function(te,ne,Fe){if(Fe=Fe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Yt.eq))return Fe;var Vt=this.startNodeAt(te,ne);return Vt.left=Fe,Vt.right=this.parseMaybeAssign(),this.finishNode(Vt,"AssignmentPattern")};Nn.checkLValSimple=function(te,ne,Fe){if(ne===void 0)ne=ls;var Vt=ne!==ls;switch(te.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(te.name))this.raiseRecoverable(te.start,(Vt?"Binding ":"Assigning to ")+te.name+" in strict mode");if(Vt){if(ne===Hn&&te.name==="let")this.raiseRecoverable(te.start,"let is disallowed as a lexically bound name");if(Fe){if(Oi(Fe,te.name))this.raiseRecoverable(te.start,"Argument name clash");Fe[te.name]=!0}if(ne!==ca)this.declareName(te.name,ne,te.start)}break;case"ChainExpression":this.raiseRecoverable(te.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Vt)this.raiseRecoverable(te.start,"Binding member expression");break;case"ParenthesizedExpression":if(Vt)this.raiseRecoverable(te.start,"Binding parenthesized expression");return this.checkLValSimple(te.expression,ne,Fe);default:this.raise(te.start,(Vt?"Binding":"Assigning to")+" rvalue")}};Nn.checkLValPattern=function(te,ne,Fe){if(ne===void 0)ne=ls;switch(te.type){case"ObjectPattern":for(var Vt=0,Gt=te.properties;Vt<Gt.length;Vt+=1){var Kt=Gt[Vt];this.checkLValInnerPattern(Kt,ne,Fe)}break;case"ArrayPattern":for(var zt=0,Ut=te.elements;zt<Ut.length;zt+=1){var qt=Ut[zt];if(qt)this.checkLValInnerPattern(qt,ne,Fe)}break;default:this.checkLValSimple(te,ne,Fe)}};Nn.checkLValInnerPattern=function(te,ne,Fe){if(ne===void 0)ne=ls;switch(te.type){case"Property":this.checkLValInnerPattern(te.value,ne,Fe);break;case"AssignmentPattern":this.checkLValPattern(te.left,ne,Fe);break;case"RestElement":this.checkLValPattern(te.argument,ne,Fe);break;default:this.checkLValPattern(te,ne,Fe)}};var On=function(te,ne,Fe,Vt,Gt){this.token=te,this.isExpr=!!ne,this.preserveSpace=!!Fe,this.override=Vt,this.generator=!!Gt},mn={b_stat:new On("{",!1),b_expr:new On("{",!0),b_tmpl:new On("${",!1),p_stat:new On("(",!1),p_expr:new On("(",!0),q_tmpl:new On("`",!0,!0,function(te){return te.tryReadTemplateToken()}),f_stat:new On("function",!1),f_expr:new On("function",!0),f_expr_gen:new On("function",!0,!1,null,!0),f_gen:new On("function",!1,!1,null,!0)},Ci=s.prototype;Ci.initialContext=function(){return[mn.b_stat]};Ci.curContext=function(){return this.context[this.context.length-1]};Ci.braceIsBlock=function(te){var ne=this.curContext();if(ne===mn.f_expr||ne===mn.f_stat)return!0;if(te===Yt.colon&&(ne===mn.b_stat||ne===mn.b_expr))return!ne.isExpr;if(te===Yt._return||te===Yt.name&&this.exprAllowed)return wn.test(this.input.slice(this.lastTokEnd,this.start));if(te===Yt._else||te===Yt.semi||te===Yt.eof||te===Yt.parenR||te===Yt.arrow)return!0;if(te===Yt.braceL)return ne===mn.b_stat;if(te===Yt._var||te===Yt._const||te===Yt.name)return!1;return!this.exprAllowed};Ci.inGeneratorContext=function(){for(var te=this.context.length-1;te>=1;te--){var ne=this.context[te];if(ne.token==="function")return ne.generator}return!1};Ci.updateContext=function(te){var ne,Fe=this.type;if(Fe.keyword&&te===Yt.dot)this.exprAllowed=!1;else if(ne=Fe.updateContext)ne.call(this,te);else this.exprAllowed=Fe.beforeExpr};Ci.overrideContext=function(te){if(this.curContext()!==te)this.context[this.context.length-1]=te};Yt.parenR.updateContext=Yt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var te=this.context.pop();if(te===mn.b_stat&&this.curContext().token==="function")te=this.context.pop();this.exprAllowed=!te.isExpr};Yt.braceL.updateContext=function(te){this.context.push(this.braceIsBlock(te)?mn.b_stat:mn.b_expr),this.exprAllowed=!0};Yt.dollarBraceL.updateContext=function(){this.context.push(mn.b_tmpl),this.exprAllowed=!0};Yt.parenL.updateContext=function(te){var ne=te===Yt._if||te===Yt._for||te===Yt._with||te===Yt._while;this.context.push(ne?mn.p_stat:mn.p_expr),this.exprAllowed=!0};Yt.incDec.updateContext=function(){};Yt._function.updateContext=Yt._class.updateContext=function(te){if(te.beforeExpr&&te!==Yt._else&&!(te===Yt.semi&&this.curContext()!==mn.p_stat)&&!(te===Yt._return&&wn.test(this.input.slice(this.lastTokEnd,this.start)))&&!((te===Yt.colon||te===Yt.braceL)&&this.curContext()===mn.b_stat))this.context.push(mn.f_expr);else this.context.push(mn.f_stat);this.exprAllowed=!1};Yt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Yt.backQuote.updateContext=function(){if(this.curContext()===mn.q_tmpl)this.context.pop();else this.context.push(mn.q_tmpl);this.exprAllowed=!1};Yt.star.updateContext=function(te){if(te===Yt._function){var ne=this.context.length-1;if(this.context[ne]===mn.f_expr)this.context[ne]=mn.f_expr_gen;else this.context[ne]=mn.f_gen}this.exprAllowed=!0};Yt.name.updateContext=function(te){var ne=!1;if(this.options.ecmaVersion>=6&&te!==Yt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())ne=!0}this.exprAllowed=ne};var an=s.prototype;an.checkPropClash=function(te,ne,Fe){if(this.options.ecmaVersion>=9&&te.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(te.computed||te.method||te.shorthand))return;var Vt=te.key,Gt;switch(Vt.type){case"Identifier":Gt=Vt.name;break;case"Literal":Gt=String(Vt.value);break;default:return}var Kt=te.kind;if(this.options.ecmaVersion>=6){if(Gt==="__proto__"&&Kt==="init"){if(ne.proto)if(Fe){if(Fe.doubleProto<0)Fe.doubleProto=Vt.start}else this.raiseRecoverable(Vt.start,"Redefinition of __proto__ property");ne.proto=!0}return}Gt="$"+Gt;var zt=ne[Gt];if(zt){var Ut;if(Kt==="init")Ut=this.strict&&zt.init||zt.get||zt.set;else Ut=zt.init||zt[Kt];if(Ut)this.raiseRecoverable(Vt.start,"Redefinition of property")}else zt=ne[Gt]={init:!1,get:!1,set:!1};zt[Kt]=!0};an.parseExpression=function(te,ne){var Fe=this;return this.catchStackOverflow(function(){var{start:Vt,startLoc:Gt}=Fe,Kt=Fe.parseMaybeAssign(te,ne);if(Fe.type===Yt.comma){var zt=Fe.startNodeAt(Vt,Gt);zt.expressions=[Kt];while(Fe.eat(Yt.comma))zt.expressions.push(Fe.parseMaybeAssign(te,ne));return Fe.finishNode(zt,"SequenceExpression")}return Kt})};an.parseMaybeAssign=function(te,ne,Fe){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(te);else this.exprAllowed=!1;var Vt=!1,Gt=-1,Kt=-1,zt=-1;if(ne)Gt=ne.parenthesizedAssign,Kt=ne.trailingComma,zt=ne.doubleProto,ne.parenthesizedAssign=ne.trailingComma=-1;else ne=new ys,Vt=!0;var Ut=this.start,qt=this.startLoc;if(this.type===Yt.parenL||this.type===Yt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=te==="await";var Xt=this.parseMaybeConditional(te,ne);if(Fe)Xt=Fe.call(this,Xt,Ut,qt);if(this.type.isAssign){var Jt=this.startNodeAt(Ut,qt);if(Jt.operator=this.value,this.type===Yt.eq)Xt=this.toAssignable(Xt,!1,ne);if(!Vt){if(ne.parenthesizedAssign=ne.trailingComma=-1,ne.shorthandAssign>=Xt.start)ne.shorthandAssign=-1;if(ne.doubleProto>=Xt.start)ne.doubleProto=-1}if(this.type===Yt.eq)this.checkLValPattern(Xt);else this.checkLValSimple(Xt);if(Jt.left=Xt,this.next(),Jt.right=this.parseMaybeAssign(te),zt>-1)ne.doubleProto=zt;return this.finishNode(Jt,"AssignmentExpression")}else if(Vt)this.checkExpressionErrors(ne,!0);if(Gt>-1)ne.parenthesizedAssign=Gt;if(Kt>-1)ne.trailingComma=Kt;return Xt};an.parseMaybeConditional=function(te,ne){var Fe=this.start,Vt=this.startLoc,Gt=this.parseExprOps(te,ne);if(this.checkExpressionErrors(ne))return Gt;if(!(Gt.type==="ArrowFunctionExpression"&&Gt.start===Fe)&&this.eat(Yt.question)){var Kt=this.startNodeAt(Fe,Vt);return Kt.test=Gt,Kt.consequent=this.parseMaybeAssign(),this.expect(Yt.colon),Kt.alternate=this.parseMaybeAssign(te),this.finishNode(Kt,"ConditionalExpression")}return Gt};an.parseExprOps=function(te,ne){var Fe=this.start,Vt=this.startLoc,Gt=this.parseMaybeUnary(ne,!1,!1,te);if(this.checkExpressionErrors(ne))return Gt;return Gt.start===Fe&&Gt.type==="ArrowFunctionExpression"?Gt:this.parseExprOp(Gt,Fe,Vt,-1,te)};an.parseExprOp=function(te,ne,Fe,Vt,Gt){var Kt=this.type.binop;if(Kt!=null&&(!Gt||this.type!==Yt._in)){if(Kt>Vt){var zt=this.type===Yt.logicalOR||this.type===Yt.logicalAND,Ut=this.type===Yt.coalesce;if(Ut)Kt=Yt.logicalAND.binop;var qt=this.value;this.next();var Xt=this.start,Jt=this.startLoc,Qt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Gt),Xt,Jt,Kt,Gt),Zt=this.buildBinary(ne,Fe,te,Qt,qt,zt||Ut);if(zt&&this.type===Yt.coalesce||Ut&&(this.type===Yt.logicalOR||this.type===Yt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(Zt,ne,Fe,Vt,Gt)}}return te};an.buildBinary=function(te,ne,Fe,Vt,Gt,Kt){if(Vt.type==="PrivateIdentifier")this.raise(Vt.start,"Private identifier can only be left side of binary expression");var zt=this.startNodeAt(te,ne);return zt.left=Fe,zt.operator=Gt,zt.right=Vt,this.finishNode(zt,Kt?"LogicalExpression":"BinaryExpression")};an.parseMaybeUnary=function(te,ne,Fe,Vt){var Gt=this.start,Kt=this.startLoc,zt;if(this.isContextual("await")&&this.canAwait)zt=this.parseAwait(Vt),ne=!0;else if(this.type.prefix){var Ut=this.startNode(),qt=this.type===Yt.incDec;if(Ut.operator=this.value,Ut.prefix=!0,this.next(),Ut.argument=this.parseMaybeUnary(null,!0,qt,Vt),this.checkExpressionErrors(te,!0),qt)this.checkLValSimple(Ut.argument);else if(this.strict&&Ut.operator==="delete"&&ua(Ut.argument))this.raiseRecoverable(Ut.start,"Deleting local variable in strict mode");else if(Ut.operator==="delete"&&pr(Ut.argument))this.raiseRecoverable(Ut.start,"Private fields can not be deleted");else ne=!0;zt=this.finishNode(Ut,qt?"UpdateExpression":"UnaryExpression")}else if(!ne&&this.type===Yt.privateId){if((Vt||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(zt=this.parsePrivateIdent(),this.type!==Yt._in)this.unexpected()}else{if(zt=this.parseExprSubscripts(te,Vt),this.checkExpressionErrors(te))return zt;while(this.type.postfix&&!this.canInsertSemicolon()){var Xt=this.startNodeAt(Gt,Kt);Xt.operator=this.value,Xt.prefix=!1,Xt.argument=zt,this.checkLValSimple(zt),this.next(),zt=this.finishNode(Xt,"UpdateExpression")}}if(!Fe&&!(zt.type==="ArrowFunctionExpression"&&zt.start===Gt)&&this.eat(Yt.starstar))if(ne)this.unexpected(this.lastTokStart);else return this.buildBinary(Gt,Kt,zt,this.parseMaybeUnary(null,!1,!1,Vt),"**",!1);else return zt};function ua(te){return te.type==="Identifier"||te.type==="ParenthesizedExpression"&&ua(te.expression)}function pr(te){return te.type==="MemberExpression"&&te.property.type==="PrivateIdentifier"||te.type==="ChainExpression"&&pr(te.expression)||te.type==="ParenthesizedExpression"&&pr(te.expression)}an.parseExprSubscripts=function(te,ne){var Fe=this.start,Vt=this.startLoc,Gt=-1,Kt=-1;if(te)Gt=te.doubleProto,Kt=te.shorthandAssign,te.doubleProto=te.shorthandAssign=-1;var zt=this.parseExprAtom(te,ne);if(zt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return zt;var Ut=this.parseSubscripts(zt,Fe,Vt,!1,ne);if(te){if(Ut.end>zt.end){if(this.checkExpressionErrors(te,!0),te.parenthesizedAssign>=Ut.start)te.parenthesizedAssign=-1;if(te.parenthesizedBind>=Ut.start)te.parenthesizedBind=-1;if(te.trailingComma>=Ut.start)te.trailingComma=-1}if(Gt>-1)te.doubleProto=Gt;if(Kt>-1)te.shorthandAssign=Kt}return Ut};an.parseSubscripts=function(te,ne,Fe,Vt,Gt){var Kt=this.options.ecmaVersion>=8&&te.type==="Identifier"&&te.name==="async"&&this.lastTokEnd===te.end&&!this.canInsertSemicolon()&&te.end-te.start===5&&this.potentialArrowAt===te.start,zt=!1;while(!0){var Ut=this.parseSubscript(te,ne,Fe,Vt,Kt,zt,Gt);if(Ut.optional)zt=!0;if(Ut.end===te.end||Ut.type==="ArrowFunctionExpression"){if(zt){var qt=this.startNodeAt(ne,Fe);qt.expression=Ut,Ut=this.finishNode(qt,"ChainExpression")}return Ut}te=Ut,Kt=!1}};an.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Yt.arrow)};an.parseSubscriptAsyncArrow=function(te,ne,Fe,Vt){return this.parseArrowExpression(this.startNodeAt(te,ne),Fe,!0,Vt)};an.parseSubscript=function(te,ne,Fe,Vt,Gt,Kt,zt){var Ut=this.options.ecmaVersion>=11,qt=Ut&&this.eat(Yt.questionDot);if(Vt&&qt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Xt=this.eat(Yt.bracketL);if(Xt||qt&&this.type!==Yt.parenL&&this.type!==Yt.backQuote||this.eat(Yt.dot)){var Jt=this.startNodeAt(ne,Fe);if(Jt.object=te,Xt)Jt.property=this.parseExpression(),this.expect(Yt.bracketR);else if(this.type===Yt.privateId&&te.type!=="Super")Jt.property=this.parsePrivateIdent();else Jt.property=this.parseIdent(this.options.allowReserved!=="never");if(Jt.computed=!!Xt,Ut)Jt.optional=qt;te=this.finishNode(Jt,"MemberExpression")}else if(!Vt&&this.eat(Yt.parenL)){var Qt=new ys,Zt=this.yieldPos,en=this.awaitPos,tn=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var sn=this.parseExprList(Yt.parenR,this.options.ecmaVersion>=8,!1,Qt);if(Gt&&!qt&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Qt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=Zt,this.awaitPos=en,this.awaitIdentPos=tn,this.parseSubscriptAsyncArrow(ne,Fe,sn,zt)}this.checkExpressionErrors(Qt,!0),this.yieldPos=Zt||this.yieldPos,this.awaitPos=en||this.awaitPos,this.awaitIdentPos=tn||this.awaitIdentPos;var nn=this.startNodeAt(ne,Fe);if(nn.callee=te,nn.arguments=sn,Ut)nn.optional=qt;te=this.finishNode(nn,"CallExpression")}else if(this.type===Yt.backQuote){if(qt||Kt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var pn=this.startNodeAt(ne,Fe);pn.tag=te,pn.quasi=this.parseTemplate({isTagged:!0}),te=this.finishNode(pn,"TaggedTemplateExpression")}return te};an.parseExprAtom=function(te,ne,Fe){if(this.type===Yt.slash)this.readRegexp();var Vt,Gt=this.potentialArrowAt===this.start;switch(this.type){case Yt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Vt=this.startNode(),this.next(),this.type===Yt.parenL&&!this.allowDirectSuper)this.raise(Vt.start,"super() call outside constructor of a subclass");if(this.type!==Yt.dot&&this.type!==Yt.bracketL&&this.type!==Yt.parenL)this.unexpected();return this.finishNode(Vt,"Super");case Yt._this:return Vt=this.startNode(),this.next(),this.finishNode(Vt,"ThisExpression");case Yt.name:var Kt=this.start,zt=this.startLoc,Ut=this.containsEsc,qt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Ut&&qt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Yt._function))return this.overrideContext(mn.f_expr),this.parseFunction(this.startNodeAt(Kt,zt),0,!1,!0,ne);if(Gt&&!this.canInsertSemicolon()){if(this.eat(Yt.arrow))return this.parseArrowExpression(this.startNodeAt(Kt,zt),[qt],!1,ne);if(this.options.ecmaVersion>=8&&qt.name==="async"&&this.type===Yt.name&&!Ut&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(qt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Yt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Kt,zt),[qt],!0,ne)}}return qt;case Yt.regexp:var Xt=this.value;return Vt=this.parseLiteral(Xt.value),Vt.regex={pattern:Xt.pattern,flags:Xt.flags},Vt;case Yt.num:case Yt.string:return this.parseLiteral(this.value);case Yt._null:case Yt._true:case Yt._false:return Vt=this.startNode(),Vt.value=this.type===Yt._null?null:this.type===Yt._true,Vt.raw=this.type.keyword,this.next(),this.finishNode(Vt,"Literal");case Yt.parenL:var Jt=this.start,Qt=this.parseParenAndDistinguishExpression(Gt,ne);if(te){if(te.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Qt))te.parenthesizedAssign=Jt;if(te.parenthesizedBind<0)te.parenthesizedBind=Jt}return Qt;case Yt.bracketL:return Vt=this.startNode(),this.next(),Vt.elements=this.parseExprList(Yt.bracketR,!0,!0,te),this.finishNode(Vt,"ArrayExpression");case Yt.braceL:return this.overrideContext(mn.b_expr),this.parseObj(!1,te);case Yt._function:return Vt=this.startNode(),this.next(),this.parseFunction(Vt,0);case Yt._class:return this.parseClass(this.startNode(),!1);case Yt._new:return this.parseNew();case Yt.backQuote:return this.parseTemplate();case Yt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Fe);else return this.unexpected();default:return this.parseExprAtomDefault()}};an.parseExprAtomDefault=function(){this.unexpected()};an.parseExprImport=function(te){var ne=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Yt.parenL&&!te)return this.parseDynamicImport(ne);else if(this.type===Yt.dot){var Fe=this.startNodeAt(ne.start,ne.loc&&ne.loc.start);return Fe.name="import",ne.meta=this.finishNode(Fe,"Identifier"),this.parseImportMeta(ne)}else this.unexpected()};an.parseDynamicImport=function(te){if(this.next(),te.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Yt.parenR))if(this.expect(Yt.comma),!this.afterTrailingComma(Yt.parenR)){if(te.options=this.parseMaybeAssign(),!this.eat(Yt.parenR)){if(this.expect(Yt.comma),!this.afterTrailingComma(Yt.parenR))this.unexpected()}}else te.options=null;else te.options=null;else if(!this.eat(Yt.parenR)){var ne=this.start;if(this.eat(Yt.comma)&&this.eat(Yt.parenR))this.raiseRecoverable(ne,"Trailing comma is not allowed in import()");else this.unexpected(ne)}return this.finishNode(te,"ImportExpression")};an.parseImportMeta=function(te){this.next();var ne=this.containsEsc;if(te.property=this.parseIdent(!0),te.property.name!=="meta")this.raiseRecoverable(te.property.start,"The only valid meta property for import is 'import.meta'");if(ne)this.raiseRecoverable(te.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(te.start,"Cannot use 'import.meta' outside a module");return this.finishNode(te,"MetaProperty")};an.parseLiteral=function(te){var ne=this.startNode();if(ne.value=te,ne.raw=this.input.slice(this.start,this.end),ne.raw.charCodeAt(ne.raw.length-1)===110)ne.bigint=ne.value!=null?ne.value.toString():ne.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(ne,"Literal")};an.parseParenExpression=function(){this.expect(Yt.parenL);var te=this.parseExpression();return this.expect(Yt.parenR),te};an.shouldParseArrow=function(te){return!this.canInsertSemicolon()};an.parseParenAndDistinguishExpression=function(te,ne){var Fe=this.start,Vt=this.startLoc,Gt,Kt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var zt=this.start,Ut=this.startLoc,qt=[],Xt=!0,Jt=!1,Qt=new ys,Zt=this.yieldPos,en=this.awaitPos,tn;this.yieldPos=0,this.awaitPos=0;while(this.type!==Yt.parenR)if(Xt?Xt=!1:this.expect(Yt.comma),Kt&&this.afterTrailingComma(Yt.parenR,!0)){Jt=!0;break}else if(this.type===Yt.ellipsis){if(tn=this.start,qt.push(this.parseParenItem(this.parseRestBinding())),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else qt.push(this.parseMaybeAssign(!1,Qt,this.parseParenItem));var sn=this.lastTokEnd,nn=this.lastTokEndLoc;if(this.expect(Yt.parenR),te&&this.shouldParseArrow(qt)&&this.eat(Yt.arrow))return this.checkPatternErrors(Qt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Zt,this.awaitPos=en,this.parseParenArrowList(Fe,Vt,qt,ne);if(!qt.length||Jt)this.unexpected(this.lastTokStart);if(tn)this.unexpected(tn);if(this.checkExpressionErrors(Qt,!0),this.yieldPos=Zt||this.yieldPos,this.awaitPos=en||this.awaitPos,qt.length>1)Gt=this.startNodeAt(zt,Ut),Gt.expressions=qt,this.finishNodeAt(Gt,"SequenceExpression",sn,nn);else Gt=qt[0]}else Gt=this.parseParenExpression();if(this.options.preserveParens){var pn=this.startNodeAt(Fe,Vt);return pn.expression=Gt,this.finishNode(pn,"ParenthesizedExpression")}else return Gt};an.parseParenItem=function(te){return te};an.parseParenArrowList=function(te,ne,Fe,Vt){return this.parseArrowExpression(this.startNodeAt(te,ne),Fe,!1,Vt)};var Vl=[];an.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var te=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Yt.dot){var ne=this.startNodeAt(te.start,te.loc&&te.loc.start);ne.name="new",te.meta=this.finishNode(ne,"Identifier"),this.next();var Fe=this.containsEsc;if(te.property=this.parseIdent(!0),te.property.name!=="target")this.raiseRecoverable(te.property.start,"The only valid meta property for new is 'new.target'");if(Fe)this.raiseRecoverable(te.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(te.start,"'new.target' can only be used in functions and class static block");return this.finishNode(te,"MetaProperty")}var Vt=this.start,Gt=this.startLoc;if(te.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Vt,Gt,!0,!1),te.callee.type==="Super")this.raiseRecoverable(Vt,"Invalid use of 'super'");if(this.eat(Yt.parenL))te.arguments=this.parseExprList(Yt.parenR,this.options.ecmaVersion>=8,!1);else te.arguments=Vl;return this.finishNode(te,"NewExpression")};an.parseTemplateElement=function(te){var ne=te.isTagged,Fe=this.startNode();if(this.type===Yt.invalidTemplate){if(!ne)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Fe.value={raw:this.value.replace(/\r\n?/g,`
|
|
12
|
+
`),cooked:null}}else Fe.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
13
|
+
`),cooked:this.value};return this.next(),Fe.tail=this.type===Yt.backQuote,this.finishNode(Fe,"TemplateElement")};an.parseTemplate=function(te){if(te===void 0)te={};var ne=te.isTagged;if(ne===void 0)ne=!1;var Fe=this.startNode();this.next(),Fe.expressions=[];var Vt=this.parseTemplateElement({isTagged:ne});Fe.quasis=[Vt];while(!Vt.tail){if(this.type===Yt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Yt.dollarBraceL),Fe.expressions.push(this.parseExpression()),this.expect(Yt.braceR),Fe.quasis.push(Vt=this.parseTemplateElement({isTagged:ne}))}return this.next(),this.finishNode(Fe,"TemplateLiteral")};an.isAsyncProp=function(te){return!te.computed&&te.key.type==="Identifier"&&te.key.name==="async"&&(this.type===Yt.name||this.type===Yt.num||this.type===Yt.string||this.type===Yt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Yt.star)&&!wn.test(this.input.slice(this.lastTokEnd,this.start))};an.parseObj=function(te,ne){var Fe=this.startNode(),Vt=!0,Gt={};Fe.properties=[],this.next();while(!this.eat(Yt.braceR)){if(!Vt){if(this.expect(Yt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Yt.braceR))break}else Vt=!1;var Kt=this.parseProperty(te,ne);if(!te)this.checkPropClash(Kt,Gt,ne);Fe.properties.push(Kt)}return this.finishNode(Fe,te?"ObjectPattern":"ObjectExpression")};an.parseProperty=function(te,ne){var Fe=this.startNode(),Vt,Gt,Kt,zt;if(this.options.ecmaVersion>=9&&this.eat(Yt.ellipsis)){if(te){if(Fe.argument=this.parseIdent(!1),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Fe,"RestElement")}if(Fe.argument=this.parseMaybeAssign(!1,ne),this.type===Yt.comma&&ne&&ne.trailingComma<0)ne.trailingComma=this.start;return this.finishNode(Fe,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Fe.method=!1,Fe.shorthand=!1,te||ne)Kt=this.start,zt=this.startLoc;if(!te)Vt=this.eat(Yt.star)}var Ut=this.containsEsc;if(this.parsePropertyName(Fe),!te&&!Ut&&this.options.ecmaVersion>=8&&!Vt&&this.isAsyncProp(Fe))Gt=!0,Vt=this.options.ecmaVersion>=9&&this.eat(Yt.star),this.parsePropertyName(Fe);else Gt=!1;return this.parsePropertyValue(Fe,te,Vt,Gt,Kt,zt,ne,Ut),this.finishNode(Fe,"Property")};an.parseGetterSetter=function(te){var ne=te.key.name;this.parsePropertyName(te),te.value=this.parseMethod(!1),te.kind=ne;var Fe=te.kind==="get"?0:1;if(te.value.params.length!==Fe){var Vt=te.value.start;if(te.kind==="get")this.raiseRecoverable(Vt,"getter should have no params");else this.raiseRecoverable(Vt,"setter should have exactly one param")}else if(te.kind==="set"&&te.value.params[0].type==="RestElement")this.raiseRecoverable(te.value.params[0].start,"Setter cannot use rest params")};an.parsePropertyValue=function(te,ne,Fe,Vt,Gt,Kt,zt,Ut){if((Fe||Vt)&&this.type===Yt.colon)this.unexpected();if(this.eat(Yt.colon))te.value=ne?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,zt),te.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Yt.parenL){if(ne)this.unexpected();te.method=!0,te.value=this.parseMethod(Fe,Vt),te.kind="init"}else if(!ne&&!Ut&&this.options.ecmaVersion>=5&&!te.computed&&te.key.type==="Identifier"&&(te.key.name==="get"||te.key.name==="set")&&(this.type!==Yt.comma&&this.type!==Yt.braceR&&this.type!==Yt.eq)){if(Fe||Vt)this.unexpected();this.parseGetterSetter(te)}else if(this.options.ecmaVersion>=6&&!te.computed&&te.key.type==="Identifier"){if(Fe||Vt)this.unexpected();if(this.checkUnreserved(te.key),te.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Gt;if(ne)te.value=this.parseMaybeDefault(Gt,Kt,this.copyNode(te.key));else if(this.type===Yt.eq&&zt){if(zt.shorthandAssign<0)zt.shorthandAssign=this.start;te.value=this.parseMaybeDefault(Gt,Kt,this.copyNode(te.key))}else te.value=this.copyNode(te.key);te.kind="init",te.shorthand=!0}else this.unexpected()};an.parsePropertyName=function(te){if(this.options.ecmaVersion>=6)if(this.eat(Yt.bracketL))return te.computed=!0,te.key=this.parseMaybeAssign(),this.expect(Yt.bracketR),te.key;else te.computed=!1;return te.key=this.type===Yt.num||this.type===Yt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};an.initFunction=function(te){if(te.id=null,this.options.ecmaVersion>=6)te.generator=te.expression=!1;if(this.options.ecmaVersion>=8)te.async=!1};an.parseMethod=function(te,ne,Fe){var Vt=this.startNode(),Gt=this.yieldPos,Kt=this.awaitPos,zt=this.awaitIdentPos;if(this.initFunction(Vt),this.options.ecmaVersion>=6)Vt.generator=te;if(this.options.ecmaVersion>=8)Vt.async=!!ne;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(hr(ne,Vt.generator)|ms|(Fe?ra:0)),this.expect(Yt.parenL),Vt.params=this.parseBindingList(Yt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Vt,!1,!0,!1),this.yieldPos=Gt,this.awaitPos=Kt,this.awaitIdentPos=zt,this.finishNode(Vt,"FunctionExpression")};an.parseArrowExpression=function(te,ne,Fe,Vt){var Gt=this.yieldPos,Kt=this.awaitPos,zt=this.awaitIdentPos;if(this.enterScope(hr(Fe,!1)|ur),this.initFunction(te),this.options.ecmaVersion>=8)te.async=!!Fe;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,te.params=this.toAssignableList(ne,!0),this.parseFunctionBody(te,!0,!1,Vt),this.yieldPos=Gt,this.awaitPos=Kt,this.awaitIdentPos=zt,this.finishNode(te,"ArrowFunctionExpression")};an.parseFunctionBody=function(te,ne,Fe,Vt){var Gt=ne&&this.type!==Yt.braceL,Kt=this.strict,zt=!1;if(Gt)te.body=this.parseMaybeAssign(Vt),te.expression=!0,this.checkParams(te,!1);else{var Ut=this.options.ecmaVersion>=7&&!this.isSimpleParamList(te.params);if(!Kt||Ut){if(zt=this.strictDirective(this.end),zt&&Ut)this.raiseRecoverable(te.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var qt=this.labels;if(this.labels=[],zt)this.strict=!0;if(this.checkParams(te,!Kt&&!zt&&!ne&&!Fe&&this.isSimpleParamList(te.params)),this.strict&&te.id)this.checkLValSimple(te.id,ca);te.body=this.parseBlock(!1,void 0,zt&&!Kt),te.expression=!1,this.adaptDirectivePrologue(te.body.body),this.labels=qt}this.exitScope()};an.isSimpleParamList=function(te){for(var ne=0,Fe=te;ne<Fe.length;ne+=1){var Vt=Fe[ne];if(Vt.type!=="Identifier")return!1}return!0};an.checkParams=function(te,ne){var Fe=Object.create(null);for(var Vt=0,Gt=te.params;Vt<Gt.length;Vt+=1){var Kt=Gt[Vt];this.checkLValInnerPattern(Kt,dr,ne?null:Fe)}};an.parseExprList=function(te,ne,Fe,Vt){var Gt=[],Kt=!0;while(!this.eat(te)){if(!Kt){if(this.expect(Yt.comma),ne&&this.afterTrailingComma(te))break}else Kt=!1;var zt=void 0;if(Fe&&this.type===Yt.comma)zt=null;else if(this.type===Yt.ellipsis){if(zt=this.parseSpread(Vt),Vt&&this.type===Yt.comma&&Vt.trailingComma<0)Vt.trailingComma=this.start}else zt=this.parseMaybeAssign(!1,Vt);Gt.push(zt)}return Gt};an.checkUnreserved=function(te){var{start:ne,end:Fe,name:Vt}=te;if(this.inGenerator&&Vt==="yield")this.raiseRecoverable(ne,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Vt==="await")this.raiseRecoverable(ne,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&gs)&&Vt==="arguments")this.raiseRecoverable(ne,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Vt==="arguments"||Vt==="await"))this.raise(ne,"Cannot use "+Vt+" in class static initialization block");if(this.keywords.test(Vt))this.raise(ne,"Unexpected keyword '"+Vt+"'");if(this.options.ecmaVersion<6&&this.input.slice(ne,Fe).indexOf("\\")!==-1)return;var Gt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Gt.test(Vt)){if(!this.inAsync&&Vt==="await")this.raiseRecoverable(ne,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(ne,"The keyword '"+Vt+"' is reserved")}};an.parseIdent=function(te){var ne=this.parseIdentNode();if(this.next(!!te),this.finishNode(ne,"Identifier"),!te){if(this.checkUnreserved(ne),ne.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=ne.start}return ne};an.parseIdentNode=function(){var te=this.startNode();if(this.type===Yt.name)te.name=this.value;else if(this.type.keyword){if(te.name=this.type.keyword,(te.name==="class"||te.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Yt.name}else this.unexpected();return te};an.parsePrivateIdent=function(){var te=this.startNode();if(this.type===Yt.privateId)te.name=this.value;else this.unexpected();if(this.next(),this.finishNode(te,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(te.start,"Private field '#"+te.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(te);return te};an.parseYield=function(te){if(!this.yieldPos)this.yieldPos=this.start;var ne=this.startNode();if(this.next(),this.type===Yt.semi||this.canInsertSemicolon()||this.type!==Yt.star&&!this.type.startsExpr)ne.delegate=!1,ne.argument=null;else ne.delegate=this.eat(Yt.star),ne.argument=this.parseMaybeAssign(te);return this.finishNode(ne,"YieldExpression")};an.parseAwait=function(te){if(!this.awaitPos)this.awaitPos=this.start;var ne=this.startNode();return this.next(),ne.argument=this.parseMaybeUnary(null,!0,!1,te),this.finishNode(ne,"AwaitExpression")};var hs=s.prototype;hs.raise=function(te,ne){var Fe=na(this.input,te);if(ne+=" ("+Fe.line+":"+Fe.column+")",this.sourceFile)ne+=" in "+this.sourceFile;var Vt=SyntaxError(ne);throw Vt.pos=te,Vt.loc=Fe,Vt.raisedAt=this.pos,Vt};hs.raiseRecoverable=hs.raise;hs.curPosition=function(){if(this.options.locations)return new Ii(this.curLine,this.pos-this.lineStart)};var Yn=s.prototype,Gl=function(te){this.flags=te,this.var=[],this.lexical=[],this.functions=[]};Yn.enterScope=function(te){this.scopeStack.push(new Gl(te))};Yn.exitScope=function(){this.scopeStack.pop()};Yn.treatFunctionsAsVarInScope=function(te){return te.flags&ui||!this.inModule&&te.flags&li};Yn.declareName=function(te,ne,Fe){var Vt=!1;if(ne===Hn){var Gt=this.currentScope();if(Vt=Gt.lexical.indexOf(te)>-1||Gt.functions.indexOf(te)>-1||Gt.var.indexOf(te)>-1,Gt.lexical.push(te),this.inModule&&Gt.flags&li)delete this.undefinedExports[te]}else if(ne===pa){var Kt=this.currentScope();Kt.lexical.push(te)}else if(ne===aa){var zt=this.currentScope();if(this.treatFunctionsAsVar)Vt=zt.lexical.indexOf(te)>-1;else Vt=zt.lexical.indexOf(te)>-1||zt.var.indexOf(te)>-1;zt.functions.push(te)}else for(var Ut=this.scopeStack.length-1;Ut>=0;--Ut){var qt=this.scopeStack[Ut];if(qt.lexical.indexOf(te)>-1&&!(qt.flags&sa&&qt.lexical[0]===te)||!this.treatFunctionsAsVarInScope(qt)&&qt.functions.indexOf(te)>-1){Vt=!0;break}if(qt.var.push(te),this.inModule&&qt.flags&li)delete this.undefinedExports[te];if(qt.flags&gs)break}if(Vt)this.raiseRecoverable(Fe,"Identifier '"+te+"' has already been declared")};Yn.checkLocalExport=function(te){if(this.scopeStack[0].lexical.indexOf(te.name)===-1&&this.scopeStack[0].var.indexOf(te.name)===-1)this.undefinedExports[te.name]=te};Yn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Yn.currentVarScope=function(){for(var te=this.scopeStack.length-1;;te--){var ne=this.scopeStack[te];if(ne.flags&(gs|Li|hi))return ne}};Yn.currentThisScope=function(){for(var te=this.scopeStack.length-1;;te--){var ne=this.scopeStack[te];if(ne.flags&(gs|Li|hi)&&!(ne.flags&ur))return ne}};var xs=function(te,ne,Fe){if(this.type="",this.start=ne,this.end=0,te.options.locations)this.loc=new fs(te,Fe);if(te.options.directSourceFile)this.sourceFile=te.options.directSourceFile;if(te.options.ranges)this.range=[ne,0]},Mi=s.prototype;Mi.startNode=function(){return new xs(this,this.start,this.startLoc)};Mi.startNodeAt=function(te,ne){return new xs(this,te,ne)};function ha(te,ne,Fe,Vt){if(te.type=ne,te.end=Fe,this.options.locations)te.loc.end=Vt;if(this.options.ranges)te.range[1]=Fe;return te}Mi.finishNode=function(te,ne){return ha.call(this,te,ne,this.lastTokEnd,this.lastTokEndLoc)};Mi.finishNodeAt=function(te,ne,Fe,Vt){return ha.call(this,te,ne,Fe,Vt)};Mi.copyNode=function(te){var ne=new xs(this,te.start,this.startLoc);for(var Fe in te)ne[Fe]=te[Fe];return ne};var da=function(){};da.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var mr=function(te){if(this.type=te.type,this.value=te.value,this.start=te.start,this.end=te.end,te.options.locations)this.loc=new fs(te,te.startLoc,te.endLoc);if(te.options.ranges)this.range=[te.start,te.end]},ln=s.prototype;ln.next=function(te){if(!te&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new mr(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ln.getToken=function(){return this.next(),new mr(this)};if(typeof Symbol<"u")ln[Symbol.iterator]=function(){var te=this;return{next:function(){var ne=te.getToken();return{done:ne.type===Yt.eof,value:ne}}}};ln.nextToken=function(){var te=this.curContext();if(!te||!te.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Yt.eof);if(te.override)return te.override(this);else this.readToken(this.fullCharCodeAtPos())};ln.readToken=function(te){if(g(te,this.options.ecmaVersion>=6)||te===92)return this.readWord();return this.getTokenFromCode(te)};ln.fullCharCodeAt=function(te){var ne=this.input.charCodeAt(te);if(ne<=55295||ne>=56320)return ne;var Fe=this.input.charCodeAt(te+1);return Fe<=56319||Fe>=57344?ne:(ne<<10)+Fe-56613888};ln.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};ln.skipBlockComment=function(){var te=this.options.onComment&&this.curPosition(),ne=this.pos,Fe=this.input.indexOf("*/",this.pos+=2);if(Fe===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Fe+2,this.options.locations)for(var Vt=void 0,Gt=ne;(Vt=ea(this.input,Gt,this.pos))>-1;)++this.curLine,Gt=this.lineStart=Vt;if(this.options.onComment)this.options.onComment(!0,this.input.slice(ne+2,Fe),ne,this.pos,te,this.curPosition())};ln.skipLineComment=function(te){var ne=this.pos,Fe=this.options.onComment&&this.curPosition(),Vt=this.input.charCodeAt(this.pos+=te);while(this.pos<this.input.length&&!bi(Vt))Vt=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(ne+te,this.pos),ne,this.pos,Fe,this.curPosition())};ln.skipSpace=function(){e:while(this.pos<this.input.length){var te=this.input.charCodeAt(this.pos);switch(te){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++this.pos,this.options.locations)++this.curLine,this.lineStart=this.pos;break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(te>8&&te<14||te>=5760&&ta.test(String.fromCharCode(te)))++this.pos;else break e}}};ln.finishToken=function(te,ne){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Fe=this.type;this.type=te,this.value=ne,this.updateContext(Fe)};ln.readToken_dot=function(){var te=this.input.charCodeAt(this.pos+1);if(te>=48&&te<=57)return this.readNumber(!0);var ne=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&te===46&&ne===46)return this.pos+=3,this.finishToken(Yt.ellipsis);else return++this.pos,this.finishToken(Yt.dot)};ln.readToken_slash=function(){var te=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(te===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.slash,1)};ln.readToken_mult_modulo_exp=function(te){var ne=this.input.charCodeAt(this.pos+1),Fe=1,Vt=te===42?Yt.star:Yt.modulo;if(this.options.ecmaVersion>=7&&te===42&&ne===42)++Fe,Vt=Yt.starstar,ne=this.input.charCodeAt(this.pos+2);if(ne===61)return this.finishOp(Yt.assign,Fe+1);return this.finishOp(Vt,Fe)};ln.readToken_pipe_amp=function(te){var ne=this.input.charCodeAt(this.pos+1);if(ne===te){if(this.options.ecmaVersion>=12){var Fe=this.input.charCodeAt(this.pos+2);if(Fe===61)return this.finishOp(Yt.assign,3)}return this.finishOp(te===124?Yt.logicalOR:Yt.logicalAND,2)}if(ne===61)return this.finishOp(Yt.assign,2);return this.finishOp(te===124?Yt.bitwiseOR:Yt.bitwiseAND,1)};ln.readToken_caret=function(){var te=this.input.charCodeAt(this.pos+1);if(te===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.bitwiseXOR,1)};ln.readToken_plus_min=function(te){var ne=this.input.charCodeAt(this.pos+1);if(ne===te){if(ne===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||wn.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Yt.incDec,2)}if(ne===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.plusMin,1)};ln.readToken_lt_gt=function(te){var ne=this.input.charCodeAt(this.pos+1),Fe=1;if(ne===te){if(Fe=te===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Fe)===61)return this.finishOp(Yt.assign,Fe+1);return this.finishOp(Yt.bitShift,Fe)}if(ne===33&&te===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(ne===61)Fe=2;return this.finishOp(Yt.relational,Fe)};ln.readToken_eq_excl=function(te){var ne=this.input.charCodeAt(this.pos+1);if(ne===61)return this.finishOp(Yt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(te===61&&ne===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Yt.arrow);return this.finishOp(te===61?Yt.eq:Yt.prefix,1)};ln.readToken_question=function(){var te=this.options.ecmaVersion;if(te>=11){var ne=this.input.charCodeAt(this.pos+1);if(ne===46){var Fe=this.input.charCodeAt(this.pos+2);if(Fe<48||Fe>57)return this.finishOp(Yt.questionDot,2)}if(ne===63){if(te>=12){var Vt=this.input.charCodeAt(this.pos+2);if(Vt===61)return this.finishOp(Yt.assign,3)}return this.finishOp(Yt.coalesce,2)}}return this.finishOp(Yt.question,1)};ln.readToken_numberSign=function(){var te=this.options.ecmaVersion,ne=35;if(te>=13){if(++this.pos,ne=this.fullCharCodeAtPos(),g(ne,!0)||ne===92)return this.finishToken(Yt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+ds(ne)+"'")};ln.getTokenFromCode=function(te){switch(te){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Yt.parenL);case 41:return++this.pos,this.finishToken(Yt.parenR);case 59:return++this.pos,this.finishToken(Yt.semi);case 44:return++this.pos,this.finishToken(Yt.comma);case 91:return++this.pos,this.finishToken(Yt.bracketL);case 93:return++this.pos,this.finishToken(Yt.bracketR);case 123:return++this.pos,this.finishToken(Yt.braceL);case 125:return++this.pos,this.finishToken(Yt.braceR);case 58:return++this.pos,this.finishToken(Yt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Yt.backQuote);case 48:var ne=this.input.charCodeAt(this.pos+1);if(ne===120||ne===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(ne===111||ne===79)return this.readRadixNumber(8);if(ne===98||ne===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(te);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(te);case 124:case 38:return this.readToken_pipe_amp(te);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(te);case 60:case 62:return this.readToken_lt_gt(te);case 61:case 33:return this.readToken_eq_excl(te);case 63:return this.readToken_question();case 126:return this.finishOp(Yt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ds(te)+"'")};ln.finishOp=function(te,ne){var Fe=this.input.slice(this.pos,this.pos+ne);return this.pos+=ne,this.finishToken(te,Fe)};ln.readRegexp=function(){var te,ne,Fe=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Fe,"Unterminated regular expression");var Vt=this.input.charAt(this.pos);if(wn.test(Vt))this.raise(Fe,"Unterminated regular expression");if(!te){if(Vt==="[")ne=!0;else if(Vt==="]"&&ne)ne=!1;else if(Vt==="/"&&!ne)break;te=Vt==="\\"}else te=!1;++this.pos}var Gt=this.input.slice(Fe,this.pos);++this.pos;var Kt=this.pos,zt=this.readWord1();if(this.containsEsc)this.unexpected(Kt);var Ut=this.regexpState||(this.regexpState=new da(this));Ut.reset(Fe,Gt,zt),this.validateRegExpFlags(Ut),this.validateRegExpPattern(Ut);var qt=null;try{qt=new RegExp(Gt,zt)}catch(Xt){}return this.finishToken(Yt.regexp,{pattern:Gt,flags:zt,value:qt})};ln.readInt=function(te,ne,Fe){var Vt=this.options.ecmaVersion>=12&&ne===void 0,Gt=Fe&&this.input.charCodeAt(this.pos)===48,Kt=this.pos,zt=0,Ut=0;for(var qt=0,Xt=ne==null?1/0:ne;qt<Xt;++qt,++this.pos){var Jt=this.input.charCodeAt(this.pos),Qt=void 0;if(Vt&&Jt===95){if(Gt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Ut===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(qt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Ut=Jt;continue}if(Jt>=97)Qt=Jt-97+10;else if(Jt>=65)Qt=Jt-65+10;else if(Jt>=48&&Jt<=57)Qt=Jt-48;else Qt=1/0;if(Qt>=te)break;Ut=Jt,zt=zt*te+Qt}if(Vt&&Ut===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Kt||ne!=null&&this.pos-Kt!==ne)return null;return zt};function Wl(te,ne){if(ne)return parseInt(te,8);return parseFloat(te.replace(/_/g,""))}function fa(te){if(typeof BigInt!=="function")return null;return BigInt(te.replace(/_/g,""))}ln.readRadixNumber=function(te){var ne=this.pos;this.pos+=2;var Fe=this.readInt(te);if(Fe==null)this.raise(this.start+2,"Expected number in radix "+te);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Fe=fa(this.input.slice(ne,this.pos)),++this.pos;else if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Yt.num,Fe)};ln.readNumber=function(te){var ne=this.pos;if(!te&&this.readInt(10,void 0,!0)===null)this.raise(ne,"Invalid number");var Fe=this.pos-ne>=2&&this.input.charCodeAt(ne)===48;if(Fe&&this.strict)this.raise(ne,"Invalid number");var Vt=this.input.charCodeAt(this.pos);if(!Fe&&!te&&this.options.ecmaVersion>=11&&Vt===110){var Gt=fa(this.input.slice(ne,this.pos));if(++this.pos,g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Yt.num,Gt)}if(Fe&&/[89]/.test(this.input.slice(ne,this.pos)))Fe=!1;if(Vt===46&&!Fe)++this.pos,this.readInt(10),Vt=this.input.charCodeAt(this.pos);if((Vt===69||Vt===101)&&!Fe){if(Vt=this.input.charCodeAt(++this.pos),Vt===43||Vt===45)++this.pos;if(this.readInt(10)===null)this.raise(ne,"Invalid number")}if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Kt=Wl(this.input.slice(ne,this.pos),Fe);return this.finishToken(Yt.num,Kt)};ln.readCodePoint=function(){var te=this.input.charCodeAt(this.pos),ne;if(te===123){if(this.options.ecmaVersion<6)this.unexpected();var Fe=++this.pos;if(ne=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ne>1114111)this.invalidStringToken(Fe,"Code point out of bounds")}else ne=this.readHexChar(4);return ne};ln.readString=function(te){var ne="",Fe=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Vt=this.input.charCodeAt(this.pos);if(Vt===te)break;if(Vt===92)ne+=this.input.slice(Fe,this.pos),ne+=this.readEscapedChar(!1),Fe=this.pos;else if(Vt===8232||Vt===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(bi(Vt))this.raise(this.start,"Unterminated string constant");++this.pos}}return ne+=this.input.slice(Fe,this.pos++),this.finishToken(Yt.string,ne)};var ma={};ln.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(te){if(te===ma)this.readInvalidTemplateToken();else throw te}this.inTemplateElement=!1};ln.invalidStringToken=function(te,ne){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ma;else this.raise(te,ne)};ln.readTmplToken=function(){var te="",ne=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Fe=this.input.charCodeAt(this.pos);if(Fe===96||Fe===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Yt.template||this.type===Yt.invalidTemplate))if(Fe===36)return this.pos+=2,this.finishToken(Yt.dollarBraceL);else return++this.pos,this.finishToken(Yt.backQuote);return te+=this.input.slice(ne,this.pos),this.finishToken(Yt.template,te)}if(Fe===92)te+=this.input.slice(ne,this.pos),te+=this.readEscapedChar(!0),ne=this.pos;else if(bi(Fe)){switch(te+=this.input.slice(ne,this.pos),++this.pos,Fe){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:te+=`
|
|
14
|
+
`;break;default:te+=String.fromCharCode(Fe);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;ne=this.pos}else++this.pos}};ln.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(Yt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
15
|
+
`)++this.pos;case`
|
|
16
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};ln.readEscapedChar=function(te){var ne=this.input.charCodeAt(++this.pos);switch(++this.pos,ne){case 110:return`
|
|
17
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ds(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(te){var Fe=this.pos-1;this.invalidStringToken(Fe,"Invalid escape sequence in template string")}default:if(ne>=48&&ne<=55){var Vt=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Gt=parseInt(Vt,8);if(Gt>255)Vt=Vt.slice(0,-1),Gt=parseInt(Vt,8);if(this.pos+=Vt.length-1,ne=this.input.charCodeAt(this.pos),(Vt!=="0"||ne===56||ne===57)&&(this.strict||te))this.invalidStringToken(this.pos-1-Vt.length,te?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Gt)}if(bi(ne)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ne)}};ln.readHexChar=function(te){var ne=this.pos,Fe=this.readInt(16,te);if(Fe===null)this.invalidStringToken(ne,"Bad character escape sequence");return Fe};ln.readWord1=function(){this.containsEsc=!1;var te="",ne=!0,Fe=this.pos,Vt=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Gt=this.fullCharCodeAtPos();if(S(Gt,Vt))this.pos+=Gt<=65535?1:2;else if(Gt===92){this.containsEsc=!0,te+=this.input.slice(Fe,this.pos);var Kt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var zt=this.readCodePoint();if(!(ne?g:S)(zt,Vt))this.invalidStringToken(Kt,"Invalid Unicode escape");te+=ds(zt),Fe=this.pos}else break;ne=!1}return te+this.input.slice(Fe,this.pos)};ln.readWord=function(){var te=this.readWord1(),ne=Yt.name;if(this.keywords.test(te))ne=cr[te];return this.finishToken(ne,te)};var Ul="8.19.0";s.acorn={Parser:s,version:Ul,defaultOptions:or,Position:Ii,SourceLocation:fs,getLineInfo:na,Node:xs,TokenType:dn,tokTypes:Yt,keywordTypes:cr,TokContext:On,tokContexts:mn,isIdentifierChar:S,isIdentifierStart:g,Token:mr,isNewLine:bi,lineBreak:wn,lineBreakG:_l,nonASCIIwhitespace:ta};function Fi(te){return(ne)=>te(ne)}function vs(...te){return s.extend(...te)}function Bi(te,ne,Fe){for(let Vt=ne;Vt<Fe;Vt++){let Gt=te.charCodeAt(Vt);if(Gt===10||Gt===13||Gt===8232||Gt===8233)return!0}return!1}var Qo=new WeakMap;function kn(te,ne){if(te===void 0)return!1;if(te.length<16)return te.includes(ne);let Fe=Qo.get(te);if(Fe===void 0||Fe.length>te.length)Fe={names:new Set,length:0},Qo.set(te,Fe);while(Fe.length<te.length)Fe.names.add(te[Fe.length++]);return Fe.names.has(ne)}var gr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,Hl=new Map([["any","TSAnyKeyword"],["bigint","TSBigIntKeyword"],["boolean","TSBooleanKeyword"],["never","TSNeverKeyword"],["null","TSNullKeyword"],["number","TSNumberKeyword"],["object","TSObjectKeyword"],["string","TSStringKeyword"],["symbol","TSSymbolKeyword"],["undefined","TSUndefinedKeyword"],["unknown","TSUnknownKeyword"],["void","TSVoidKeyword"]]),Kl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),ql=new Set("public private protected readonly override".split(" ")),zl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),Xl=new Set("var let const function class interface enum".split(" ")),ga=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),ya=1,Jl=32,Yl=256,Ql=0,Zl=1,Vi=2,eu=3,tu=4,yr=6,xa=7,Ta=256,Sr=1024,nu=8|Sr,iu=Vi|Ta,va=1,su=2,Ea=40,ru=41,ou=44,Sa=46,ba=58,ji=61,Ca=60,au=62,Es=123,pu=91,xr=42,cu=35,vr=34,Er=39,lu=SyntaxError("speculative parse failed"),pe=Fi((te)=>{let{tokTypes:ne,keywordTypes:Fe,isIdentifierChar:Vt,isIdentifierStart:Gt}=te.acorn,Kt=new te.acorn.TokenType("@");class zt extends te{inType=!1;$4=!1;$5=!1;$7=null;$l=null;$j=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Ut,qt,Xt){super(Ut,qt,Xt);let Jt=this.options.onComment;if(typeof Jt==="function")this.options.onComment=(Qt,Zt,en,tn,sn,nn)=>{if(en<this.$t)return;this.$t=tn,Jt.call(this,Qt,Zt,en,tn,sn,nn)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$l=null,this.$j=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Ut){if(Ut===64)return++this.pos,this.finishToken(Kt);return super.getTokenFromCode(Ut)}readToken_lt_gt(Ut){if(this.inType)return this.finishOp(ne.relational,1);return super.readToken_lt_gt(Ut)}$a(Ut){let qt=this.inType;this.inType=!0;let Xt=Ut();if(this.inType=qt,!qt&&this.type===ne.relational)this.pos=this.start,this.nextToken();return Xt}$1(){return this.type===ne.relational&&this.value==="<"}$p(){if(this.type===ne.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(ne.relational,"<");return this.$1()}$c(){return this.type===ne.relational&&this.value===">"}$u(){return this.type===ne.prefix&&this.value==="!"}hasPrecedingLineBreak(){return Bi(this.input,this.lastTokEnd,this.start)}$d(Ut=this.pos){return gr.lastIndex=Ut,gr.exec(this.input),gr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Ut=this.$d(),qt=Ut;while(qt<this.input.length&&Vt(this.input.charCodeAt(qt)))qt++;return this.input.slice(Ut,qt)}$b(){return!Bi(this.input,this.pos,this.$d())}$14(){return this.$b()&&Gt(this.$2())&&!Object.hasOwn(Fe,this.$3())}$15(){return{pos:this.pos,type:this.type,value:this.value,start:this.start,end:this.end,startLoc:this.startLoc,endLoc:this.endLoc,lastTokStart:this.lastTokStart,lastTokEnd:this.lastTokEnd,lastTokStartLoc:this.lastTokStartLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,context:this.context.slice(),exprAllowed:this.exprAllowed,containsEsc:this.containsEsc,inType:this.inType,$4:this.$4,$5:this.$5,$7:this.$7,scopes:this.scopeStack.length,privateNames:this.privateNameStack.length,labels:this.labels,labelCount:this.labels.length,strict:this.strict,yieldPos:this.yieldPos,awaitPos:this.awaitPos,awaitIdentPos:this.awaitIdentPos,potentialArrowAt:this.potentialArrowAt,potentialArrowInForAwait:this.potentialArrowInForAwait}}$16(Ut){this.pos=Ut.pos,this.type=Ut.type,this.value=Ut.value,this.start=Ut.start,this.end=Ut.end,this.startLoc=Ut.startLoc,this.endLoc=Ut.endLoc,this.lastTokStart=Ut.lastTokStart,this.lastTokEnd=Ut.lastTokEnd,this.lastTokStartLoc=Ut.lastTokStartLoc,this.lastTokEndLoc=Ut.lastTokEndLoc,this.curLine=Ut.curLine,this.lineStart=Ut.lineStart,this.context=Ut.context,this.exprAllowed=Ut.exprAllowed,this.containsEsc=Ut.containsEsc,this.inType=Ut.inType,this.$4=Ut.$4,this.$5=Ut.$5,this.$7=Ut.$7,this.$j=!1,this.scopeStack.length=Ut.scopes,this.privateNameStack.length=Ut.privateNames,this.labels=Ut.labels,this.labels.length=Ut.labelCount,this.strict=Ut.strict,this.yieldPos=Ut.yieldPos,this.awaitPos=Ut.awaitPos,this.awaitIdentPos=Ut.awaitIdentPos,this.potentialArrowAt=Ut.potentialArrowAt,this.potentialArrowInForAwait=Ut.potentialArrowInForAwait}raise(Ut,qt){if(this.$n>0)throw lu;return super.raise(Ut,qt)}$1y(Ut,qt){try{super.raise(Ut,qt)}catch(Xt){if(Xt instanceof SyntaxError)Xt.$1z=!0;throw Xt}throw Error("unreachable")}$g(Ut,qt=!1){let Xt=this.$15();this.$n++;try{let Jt=Ut();if(qt||Jt===void 0)this.$16(Xt);return Jt}catch(Jt){if(!(Jt instanceof SyntaxError)||!qt&&Jt.$1z)throw Jt;this.$16(Xt);return}finally{this.$n--}}$v(Ut){return this.$g(Ut,!0)===!0}$17(Ut){if(Ut.end=this.lastTokEnd,this.options.locations)Ut.loc.end=this.lastTokEndLoc}$q(Ut,qt){if(Ut.start=qt.start,this.options.locations)Ut.loc.start=qt.loc.start}$6(Ut=!1){let qt=this.startNode();return qt.typeAnnotation=this.$a(()=>(this.next(),Ut?this.$20():this.$0())),this.finishNode(qt,"TSTypeAnnotation")}$h(Ut,qt){if(qt&&this.eat(ne.question))Ut.optional=!0,this.$17(Ut);if(this.type===ne.colon)Ut.typeAnnotation=this.$6(),this.$17(Ut);return Ut}$20(){if(this.type!==ne.name&&this.type!==ne._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Gt(this.$2())){let Ut=this.startNode();if(this.next(),Ut.parameterName=this.type===ne._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Ut,!0);return Ut.asserts=!0,Ut.typeAnnotation=null,this.finishNode(Ut,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Ut=this.startNode();return Ut.parameterName=this.type===ne._this?this.$w():this.parseIdent(!0),this.$x(Ut,!1)}return this.$0()}$x(Ut,qt){this.next();let Xt=this.startNode();return Xt.typeAnnotation=this.$0(),Ut.typeAnnotation=this.finishNode(Xt,"TSTypeAnnotation"),Ut.asserts=qt,this.finishNode(Ut,"TSTypePredicate")}$w(){let Ut=this.startNode();return this.next(),this.finishNode(Ut,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Ut=this.$0();if(this.type!==ne.eof)this.unexpected();return Ut}$0(){let Ut=this.$18();if(this.$4||this.type!==ne._extends||this.hasPrecedingLineBreak())return Ut;let qt=this.startNodeAt(Ut.start,Ut.loc?.start);return this.next(),qt.checkType=Ut,qt.extendsType=this.$i(!0,()=>this.$18()),this.expect(ne.question),qt.trueType=this.$i(!1,()=>this.$0()),this.expect(ne.colon),qt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(qt,"TSConditionalType")}$i(Ut,qt){let Xt=this.$4;this.$4=Ut;let Jt=qt();return this.$4=Xt,Jt}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===ne._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",ne.bitwiseOR,()=>this.$1a("TSIntersectionType",ne.bitwiseAND,()=>this.$1b()))}$19(Ut){let qt=this.startNode();if(Ut==="TSConstructorType"){if(qt.abstract=this.isContextual("abstract"),qt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(qt,ne.arrow)),this.finishNode(qt,Ut)}$r(Ut,qt){if(this.$1())Ut.typeParameters=this.$8();if(this.expect(ne.parenL),Ut.parameters=this.parseBindingList(ne.parenR,!1,!0),this.type===qt)Ut.typeAnnotation=this.$6(!0);else if(qt===ne.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==ne.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===ne.parenR||this.type===ne.ellipsis)return!0;if(this.type===ne.name||this.type===ne._this)this.next();else if(this.type===ne.braceL||this.type===ne.bracketL)this.parseBindingAtom();else return!1;let Ut=this.type;if(Ut===ne.colon||Ut===ne.comma||Ut===ne.question||Ut===ne.eq)return!0;if(Ut!==ne.parenR)return!1;return this.next(),this.type===ne.arrow})}$1a(Ut,qt,Xt){let Jt=this.startNode(),Qt=this.eat(qt),Zt=[];do Zt.push(Xt());while(this.eat(qt));if(Zt.length===1&&!Qt)return Zt[0];return Jt.types=Zt,this.finishNode(Jt,Ut)}$1b(){if(this.type===ne.name&&!this.containsEsc){let Ut=this.value;if(Ut==="keyof"||Ut==="unique"||Ut==="readonly"){let qt=this.startNode();return this.next(),qt.operator=Ut,qt.typeAnnotation=this.$1b(),this.finishNode(qt,"TSTypeOperator")}if(Ut==="infer"){let qt=this.startNode();this.next();let Xt=this.startNode();Xt.name=this.$y();let Jt=this.$g(()=>this.$22());if(Jt)Xt.constraint=Jt;return qt.typeParameter=this.finishNode(Xt,"TSTypeParameter"),this.finishNode(qt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(ne._extends))return;let Ut=this.$i(!0,()=>this.$0());return this.$4||this.type!==ne.question?Ut:void 0}$y(){if(this.type!==ne.name&&!this.type.keyword)this.unexpected();let Ut=this.type===ne.name?this.value:this.type.keyword;return this.next(),Ut}$23(){let Ut=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(ne.bracketL)){let qt=this.startNodeAt(Ut.start,Ut.loc?.start);if(this.eat(ne.bracketR))qt.elementType=Ut,Ut=this.finishNode(qt,"TSArrayType");else qt.objectType=Ut,qt.indexType=this.$0(),this.expect(ne.bracketR),Ut=this.finishNode(qt,"TSIndexedAccessType")}return Ut}$24(){switch(this.type){case ne.name:case ne._void:case ne._null:{let Ut=Hl.get(this.value);if(Ut&&(this.type!==ne.name||!this.containsEsc&&this.$2()!==Sa)){let qt=this.startNode();return this.next(),this.finishNode(qt,Ut)}return this.$1c()}case ne.string:case ne.num:case ne._true:case ne._false:{let Ut=this.startNode();return Ut.literal=this.parseExprAtom(),this.finishNode(Ut,"TSLiteralType")}case ne.plusMin:{if(this.value!=="-")break;let Ut=this.startNode(),qt=this.startNode();if(this.next(),this.type!==ne.num)this.unexpected();return qt.operator="-",qt.prefix=!0,qt.argument=this.parseExprAtom(),Ut.literal=this.finishNode(qt,"UnaryExpression"),this.finishNode(Ut,"TSLiteralType")}case ne.backQuote:return this.$25();case ne._this:{let Ut=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let qt=this.startNodeAt(Ut.start,Ut.loc?.start);return qt.parameterName=Ut,this.$x(qt,!1)}return Ut}case ne._typeof:return this.$26();case ne._import:return this.$1d();case ne.braceL:return this.$27()?this.$28():this.$29();case ne.bracketL:return this.$2a();case ne.parenL:{let Ut=this.startNode();return this.next(),Ut.typeAnnotation=this.$0(),this.expect(ne.parenR),this.finishNode(Ut,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Ut=this.startNode();if(Ut.typeName=this.$k(),!this.hasPrecedingLineBreak()&&this.$1())Ut.typeArguments=this.$e();return this.finishNode(Ut,"TSTypeReference")}$k(){let Ut=this.parseIdent(!0);while(this.eat(ne.dot)){let qt=this.startNodeAt(Ut.start,Ut.loc?.start);qt.left=Ut,qt.right=this.parseIdent(!0),Ut=this.finishNode(qt,"TSQualifiedName")}return Ut}$26(){let Ut=this.startNode();if(this.next(),Ut.exprName=this.type===ne._import?this.$1d():this.$k(),!this.hasPrecedingLineBreak()&&this.$1())Ut.typeArguments=this.$e();return this.finishNode(Ut,"TSTypeQuery")}$1d(){let Ut=this.startNode();if(this.next(),Ut.argument=this.$1e(),this.eat(ne.dot))Ut.qualifier=this.$k();if(this.$1())Ut.typeArguments=this.$e();return this.finishNode(Ut,"TSImportType")}$z(){if(this.type!==ne.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(ne.parenL);let Ut=this.$z();return this.expect(ne.parenR),Ut}$25(){let Ut=this.startNode(),qt=this.startNode();this.next(),qt.expressions=[];let Xt=this.parseTemplateElement({isTagged:!1});qt.quasis=[Xt];while(!Xt.tail){if(this.type===ne.eof)this.raise(this.pos,"Unterminated template literal");this.expect(ne.dollarBraceL),qt.expressions.push(this.$0()),this.expect(ne.braceR),Xt=this.parseTemplateElement({isTagged:!1}),qt.quasis.push(Xt)}return this.next(),Ut.literal=this.finishNode(qt,"TemplateLiteral"),this.finishNode(Ut,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===ne.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==ne.bracketL)return!1;if(this.next(),this.type!==ne.name)return!1;return this.next(),this.type===ne._in})}$28(){let Ut=this.startNode();if(this.expect(ne.braceL),this.type===ne.plusMin)Ut.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Ut.readonly=!0;this.expect(ne.bracketL);let qt=this.startNode();if(qt.name=this.$y(),this.expect(ne._in),qt.constraint=this.$0(),Ut.typeParameter=this.finishNode(qt,"TSTypeParameter"),Ut.nameType=this.eatContextual("as")?this.$0():null,this.expect(ne.bracketR),this.type===ne.plusMin)Ut.optional=this.value,this.next(),this.expect(ne.question);else if(this.eat(ne.question))Ut.optional=!0;if(this.eat(ne.colon))Ut.typeAnnotation=this.$0();return this.semicolon(),this.expect(ne.braceR),this.finishNode(Ut,"TSMappedType")}$29(){let Ut=this.startNode();return Ut.members=this.$1f(),this.finishNode(Ut,"TSTypeLiteral")}$1f(){this.expect(ne.braceL);let Ut=[];while(!this.eat(ne.braceR))Ut.push(this.$2b());return Ut}$2b(){let Ut=this.startNode(),qt="TSPropertySignature",Xt=this.type===ne._new?this.$2():-1;if(this.type===ne.parenL||this.$1())qt="TSCallSignatureDeclaration",this.$r(Ut,ne.colon);else if(Xt===Ea||Xt===Ca)qt="TSConstructSignatureDeclaration",this.next(),this.$r(Ut,ne.colon);else{let Jt=this.type===ne._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Ut.readonly=!0;if(this.type===ne.bracketL&&this.$1g())return this.$1h(Ut);let Qt="method";if(Jt)Ut.key=Jt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Qt=this.value,this.next();this.parsePropertyName(Ut)}if(this.eat(ne.question))Ut.optional=!0;if(this.type===ne.parenL||this.$1()){if(qt="TSMethodSignature",Qt!=="method")Ut.kind=Qt;this.$r(Ut,ne.colon),Ut.kind=Qt}else if(this.type===ne.colon)Ut.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Ut,qt)}$1i(){if(!this.eat(ne.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==ne.name)return!1;return this.next(),this.type===ne.colon})}$1h(Ut){if(this.expect(ne.bracketL),Ut.parameters=[this.$h(this.parseIdent(),!1)],this.expect(ne.bracketR),this.type===ne.colon)Ut.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Ut,"TSIndexSignature")}$2a(){let Ut=this.startNode();this.expect(ne.bracketL),Ut.elementTypes=[];while(!this.eat(ne.bracketR))if(Ut.elementTypes.push(this.$2c()),this.type!==ne.bracketR)this.expect(ne.comma);return this.finishNode(Ut,"TSTupleType")}$2c(){let Ut=this.start,qt=this.startLoc,Xt=this.eat(ne.ellipsis),Jt;if((this.type===ne.name||this.type.keyword)&&this.$2d()){let Qt=this.startNode();Qt.label=this.parseIdent(!0),Qt.optional=this.eat(ne.question),this.expect(ne.colon),Qt.elementType=this.$0(),Jt=this.finishNode(Qt,"TSNamedTupleMember")}else if(Jt=this.$0(),this.eat(ne.question)){let Qt=this.startNodeAt(Jt.start,Jt.loc?.start);Qt.typeAnnotation=Jt,Jt=this.finishNode(Qt,"TSOptionalType")}if(Xt){let Qt=this.startNodeAt(Ut,qt);Qt.typeAnnotation=Jt,Jt=this.finishNode(Qt,"TSRestType")}return Jt}$2d(){let Ut=this.$d();if(this.input.charCodeAt(Ut)===63)Ut=this.$d(Ut+1);return this.input.charCodeAt(Ut)===ba}$8(){return this.$a(()=>{let Ut=this.startNode();this.next(),Ut.params=[];while(!this.$c()){let qt=this.startNode();while((this.type===ne._const||this.type===ne._in||this.isContextual("out"))&&Gt(this.$2()))qt[this.value]=!0,this.next();if(qt.name=this.$y(),this.eat(ne._extends))qt.constraint=this.$0();if(this.eat(ne.eq))qt.default=this.$0();if(Ut.params.push(this.finishNode(qt,"TSTypeParameter")),!this.$c()){if(this.expect(ne.comma),this.$c())Ut.extra={trailingComma:this.lastTokStart}}}if(this.next(),Ut.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Ut,"TSTypeParameterDeclaration")})}$e(Ut=!1){return this.$a(()=>{let qt=this.startNode();this.next(),qt.params=[];while(!this.$c())if(qt.params.push(this.$0()),!this.$c())this.expect(ne.comma);if(qt.params.length===0)this.unexpected();if(Ut){let Xt=this.input.charCodeAt(this.start+1);if(Xt===ji||Xt===au)this.unexpected()}return this.next(),this.finishNode(qt,"TSTypeParameterInstantiation")})}$1j(){let Ut=[];do{let qt=this.startNode();if(qt.expression=this.$k(),this.$1())qt.typeParameters=this.$e();Ut.push(this.finishNode(qt,"TSExpressionWithTypeArguments"))}while(this.eat(ne.comma));return Ut}$1k(Ut=!1){if(this.type!==ne.name||this.containsEsc){if(this.type===ne._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Ut);return this.$1l(this.startNode(),this.value)}$2e(Ut){switch(Ut){case"interface":case"type":case"namespace":return this.$14();case"enum":return Gt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let qt=this.$2();return this.$b()&&(qt===vr||qt===Er||Gt(qt))}case"declare":return this.$b()&&zl.has(this.$3());case"global":return this.$b()&&this.$2()===Es}return!1}$1l(Ut,qt){switch(qt){case"interface":return this.$1m(Ut);case"type":return this.$2g(Ut);case"enum":return this.$10(Ut);case"abstract":return this.$1n(Ut,!0);case"global":return Ut.global=!0,Ut.id=this.parseIdent(),Ut.body=this.$11(),this.finishNode(Ut,"TSModuleDeclaration")}return this.$2h(Ut)}$2f(Ut){let qt=this.$5;this.$5=!0;let Xt=this.startNode();this.next();let Jt=this.value;if(Jt==="const"&&this.$3()==="enum")Xt.const=!0;if(!Ut&&Xl.has(Jt))Xt.declare=!0;let Qt;if(Xt.const)Qt=this.$10(Xt);else if(Jt==="var"||Jt==="let"||Jt==="const")Qt=this.parseVarStatement(Xt,Jt,!0);else if(Jt==="function")this.next(),Qt=this.parseFunction(Xt,va,!1,!1);else if(Jt==="class")Qt=this.parseClass(Xt,!0);else Qt=this.$1l(Xt,Jt);return Qt.declare=!0,this.$5=qt,Qt}$1n(Ut,qt){return this.next(),Ut.abstract=!0,this.parseClass(Ut,qt)}$1m(Ut){if(this.next(),Ut.id=this.parseIdent(),this.checkLValSimple(Ut.id,xa),this.$1())Ut.typeParameters=this.$8();return this.$a(()=>{if(this.eat(ne._extends))Ut.extends=this.$1j();let qt=this.startNode();qt.body=this.$1f(),Ut.body=this.finishNode(qt,"TSInterfaceBody")}),this.finishNode(Ut,"TSInterfaceDeclaration")}$2g(Ut){if(this.next(),Ut.id=this.parseIdent(),this.checkLValSimple(Ut.id,yr),this.$1())Ut.typeParameters=this.$8();return Ut.typeAnnotation=this.$a(()=>(this.expect(ne.eq),this.$0())),this.semicolon(),this.finishNode(Ut,"TSTypeAliasDeclaration")}$10(Ut){if(this.type===ne._const)Ut.const=!0,this.next();this.next(),Ut.id=this.parseIdent(),this.checkLValSimple(Ut.id,iu),this.expect(ne.braceL),Ut.members=[];while(!this.eat(ne.braceR)){let qt=this.startNode();if(qt.id=this.type===ne.string?this.parseExprAtom():this.parseIdent(!0),this.eat(ne.eq))qt.initializer=this.parseMaybeAssign();if(Ut.members.push(this.finishNode(qt,"TSEnumMember")),this.type!==ne.braceR)this.expect(ne.comma)}return this.finishNode(Ut,"TSEnumDeclaration")}$2h(Ut){if(this.next(),this.type===ne.string){if(Ut.id=this.parseExprAtom(),this.type===ne.braceL)Ut.body=this.$11();else this.semicolon();return this.finishNode(Ut,"TSModuleDeclaration")}return Ut.id=this.parseIdent(),this.checkLValSimple(Ut.id,nu),this.$1o(Ut)}$1o(Ut){if(this.eat(ne.dot)){let qt=this.startNode();qt.id=this.parseIdent(),Ut.body=this.$1o(qt)}else Ut.body=this.$11();return this.finishNode(Ut,"TSModuleDeclaration")}$11(){this.enterScope(Yl);let Ut=this.startNode();this.enterScope(0),this.expect(ne.braceL),Ut.body=[];while(!this.eat(ne.braceR))Ut.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Ut,"TSModuleBlock")}$1p(Ut,qt){if(Ut.isExport=qt,Ut.id=this.parseIdent(),this.checkLValSimple(Ut.id,Vi),this.expect(ne.eq),this.isContextual("require")&&this.$2()===Ea){let Xt=this.startNode();this.next(),Xt.expression=this.$1e(),Ut.moduleReference=this.finishNode(Xt,"TSExternalModuleReference")}else Ut.moduleReference=this.$k();return this.semicolon(),this.finishNode(Ut,"TSImportEqualsDeclaration")}$2i(){let Ut=this.$d();if(this.input.charCodeAt(Ut)!==ji)return!1;let qt=this.input.charCodeAt(Ut+1);return qt!==ji&&qt!==62}parseStatement(Ut,qt,Xt){if(this.type===Kt)this.$1q(!0);let Jt=this.$1k();if(Jt)return Jt;return super.parseStatement(Ut,qt,Xt)}parseVarStatement(Ut,qt,Xt){return super.parseVarStatement(Ut,qt,Xt||this.$5)}parseVarId(Ut,qt){if(super.parseVarId(Ut,qt),Ut.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Ut.definite=!0;this.$h(Ut.id,!1)}parseCatchClauseParam(){let Ut=this.$h(this.parseBindingAtom(),!1),qt=Ut.type==="Identifier";return this.enterScope(qt?Jl:0),this.checkLValPattern(Ut,qt?tu:Vi),this.expect(ne.parenR),Ut}parseImport(Ut){if(this.next(),Ut.importKind="value",this.type===ne.string)Ut.specifiers=[],Ut.source=this.parseExprAtom();else{if(this.isContextual("type")){let qt=this.$2();if(qt===Es||qt===xr||Gt(qt)&&this.$3()!=="from")Ut.importKind="type",this.next()}if(this.type===ne.name&&this.$2i())return this.$1p(Ut,!1);Ut.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Ut.source=this.$z()}return this.$1r(Ut),this.semicolon(),this.finishNode(Ut,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=ne._with;return this.type===ne._with?super.parseWithClause():void 0}$1r(Ut){let qt=this.parseWithClause();if(qt)Ut.attributes=qt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Ut){return this.$1s("exportKind",()=>super.parseExportSpecifier(Ut))}$1s(Ut,qt){let Xt=this.isContextual("type")?this.$2():-1;if(Xt===vr||Xt===Er||Gt(Xt)&&this.$3()!=="as"){let Qt=this.startNode();this.next();let Zt=qt();return this.$q(Zt,Qt),Zt[Ut]="type",Zt}let Jt=qt();return Jt[Ut]="value",Jt}parseExport(Ut,qt){if(this.next(),this.eat(ne._import)){if(Ut.importKind="value",this.isContextual("type")&&Gt(this.$2())&&this.$3()!=="from")Ut.importKind="type",this.next();return this.$1p(Ut,!0)}if(this.eat(ne.eq))return Ut.expression=this.parseExpression(),this.semicolon(),this.finishNode(Ut,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Ut.id=this.parseIdent(),this.semicolon(),this.finishNode(Ut,"TSNamespaceExportDeclaration");if(Ut.exportKind="value",this.isContextual("type")){let Qt=this.$2();if(Qt===Es||Qt===xr)Ut.exportKind="type",this.next()}if(this.eat(ne.star))return this.parseExportAllDeclaration(Ut,qt);if(this.eat(ne._default)){if(this.isContextual("interface")&&this.$14())Ut.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Ut.declaration=this.$1n(this.startNode(),"nullableID");else Ut.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Ut,"ExportDefaultDeclaration")}let Xt=this.isContextual("declare"),Jt=this.$1k(!0);if(Jt||this.shouldParseExportStatement()){if(Ut.declaration=Jt??this.parseStatement(null),Xt||Ut.declaration.type==="TSInterfaceDeclaration"||Ut.declaration.type==="TSTypeAliasDeclaration")Ut.exportKind="type";return Ut.specifiers=[],Ut.source=null,this.finishNode(Ut,"ExportNamedDeclaration")}if(Ut.declaration=null,Ut.specifiers=this.parseExportSpecifiers(qt),this.eatContextual("from"))Ut.source=this.$z(),this.$1r(Ut);else{for(let Qt of Ut.specifiers)if(this.checkUnreserved(Qt.local),this.checkLocalExport(Qt.local),Qt.local.type==="Literal")this.raise(Qt.local.start,"A string literal cannot be used as an exported binding without `from`.");Ut.source=null}return this.semicolon(),this.finishNode(Ut,"ExportNamedDeclaration")}parseFunction(Ut,qt,Xt,Jt,Qt){let Zt=qt&va;if(Zt)this.$f=Ut,this.$o=Ut.start;super.parseFunction(Ut,qt,Xt,Jt,Qt),this.$f=null;let en=!Ut.body;if(en)Ut.type="TSDeclareFunction";if(Zt&&Ut.id){if(en){if(this.$5&&this.currentScope().flags&ya)this.declareName(Ut.id.name,Sr,Ut.id.start);this.checkLValSimple(Ut.id,Ql)}else if(!(qt&su)){let tn=eu;if(this.strict||Ut.generator||Ut.async)tn=this.treatFunctionsAsVar?Zl:Vi;this.checkLValSimple(Ut.id,tn)}}return Ut}parseFunctionParams(Ut){if(this.$1())Ut.typeParameters=this.$8();if(super.parseFunctionParams(Ut),this.type===ne.colon)Ut.returnType=this.$6(!0)}parseFunctionBody(Ut,qt,Xt,Jt){if(Xt&&this.type===ne.colon)Ut.returnType=this.$6(!0);if(qt||this.type===ne.braceL||Ut.start!==this.$o){super.parseFunctionBody(Ut,qt,Xt,Jt);return}this.semicolon(),this.exitScope()}parseMethod(Ut,qt,Xt){let Jt=this.$l;this.$l=null,this.$j=!0;let Qt=super.parseMethod(Ut,qt,Xt);if(!Qt.body)Qt.type="TSDeclareMethod";if(Jt)Qt.typeParameters=Jt;return Qt}parseBindingList(Ut,qt,Xt,Jt){let Qt=Jt===!0||this.$j;return this.$j=!1,super.parseBindingList(Ut,qt,Xt,Qt)}$s(Ut){if(!Ut&&!this.$b())return!1;let qt=this.$2();return qt===pu||qt===Es||qt===xr||qt===Sa||qt===cu||qt===vr||qt===Er||qt>=48&&qt<=57||Gt(qt)}parseAssignableListItem(Ut){let qt=this.$12(),Xt=this.start,Jt=this.startLoc,Qt,Zt=!1,en=!1;if(Ut)while(this.type===ne.name&&ql.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")Zt=!0;else if(this.value==="override")en=!0;else Qt=this.value;this.next()}let tn;if(this.type===ne._this)tn=this.startNode(),tn.name="this",this.next(),this.finishNode(tn,"Identifier");else tn=this.parseBindingAtom();let sn=this.type===ne.eq?this.parseMaybeDefault(Xt,Jt,tn):this.parseMaybeDefault(tn.start,tn.loc?.start,this.$h(tn,!0));if(qt.length>0)sn.decorators=qt;if(!Qt&&!Zt&&!en)return sn;if(sn.type!=="Identifier"&&sn.type!=="AssignmentPattern")this.raise(Xt,"A parameter property may not be declared using a binding pattern.");let nn=this.startNodeAt(Xt,Jt);if(Qt)nn.accessibility=Qt;if(Zt)nn.readonly=!0;if(en)nn.override=!0;return nn.parameter=sn,this.finishNode(nn,"TSParameterProperty")}parseBindingListItem(Ut){if(Ut.type==="RestElement")this.$h(Ut,!0);return Ut}checkLValSimple(Ut,qt,Xt){if(this.$f&&Ut===this.$f.id){this.$f=null;return}if(!qt&&ga.has(Ut.type)){this.checkLValSimple(Ut.expression,qt,Xt);return}switch(Ut.type){case"TSParameterProperty":this.checkLValInnerPattern(Ut.parameter,qt,Xt);return;case"Identifier":if(Ut.name==="this")return}super.checkLValSimple(Ut,qt,Xt)}toAssignable(Ut,qt,Xt){if(Ut&&!qt&&ga.has(Ut.type))return Ut;return super.toAssignable(Ut,qt,Xt)}declareName(Ut,qt,Xt){let Jt=this.currentScope();if(qt&Sr){this.$1t(Jt,Ut),Jt.$1u??=[],Jt.$1u.push(Ut);return}if(qt===yr||qt===xa){if(Jt.$13??=[],qt===yr&&kn(Jt.$13,Ut))this.raise(Xt,`type '${Ut}' has already been declared.`);Jt.$13.push(Ut),this.$1t(Jt,Ut);return}if(qt&Ta){if(Jt.$1v??=[],kn(Jt.$1v,Ut))return;super.declareName(Ut,Vi,Xt),Jt.$1v.push(Ut);return}super.declareName(Ut,qt,Xt)}$1t(Ut,qt){if(this.inModule&&Ut.flags&ya)delete this.undefinedExports[qt]}checkLocalExport(Ut){for(let qt=this.scopeStack.length-1;qt>=0;qt--){let Xt=this.scopeStack[qt];if(kn(Xt.$13,Ut.name)||kn(Xt.$1u,Ut.name))return}super.checkLocalExport(Ut)}checkExport(){}raiseRecoverable(Ut,qt){if(qt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Ut,qt)}$12(){let Ut=[];while(this.type===Kt)Ut.push(this.$1w());return Ut}$1q(Ut){let qt=this.$9[this.$9.length-1];while(this.type===Kt)qt.push(this.$1w());if(this.type===ne._export){if(!Ut)this.unexpected()}else if(this.type!==ne._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let Ut=this.startNode();this.next(),this.$9.push([]);let qt=this.start,Xt=this.startLoc,Jt;if(this.type===ne.parenL){if(this.next(),Jt=this.parseExpression(),this.expect(ne.parenR),this.options.preserveParens){let Zt=this.startNodeAt(qt,Xt);Zt.expression=Jt,Jt=this.finishNode(Zt,"ParenthesizedExpression")}}else{Jt=this.parseIdent(!1);while(this.eat(ne.dot)){let Zt=this.startNodeAt(qt,Xt);Zt.object=Jt,Zt.property=this.parseIdent(!0),Zt.computed=!1,Jt=this.finishNode(Zt,"MemberExpression")}}let Qt=this.$p()?this.$e(!0):void 0;if(this.eat(ne.parenL)){let Zt=this.startNodeAt(Jt.start,Jt.loc?.start);if(Zt.callee=Jt,Zt.arguments=this.parseExprList(ne.parenR,!1,!1),Qt)Zt.typeArguments=Qt;Jt=this.finishNode(Zt,"CallExpression")}else if(Qt){let Zt=this.startNodeAt(Jt.start,Jt.loc?.start);Zt.expression=Jt,Zt.typeArguments=Qt,Jt=this.finishNode(Zt,"TSInstantiationExpression")}return Ut.expression=Jt,this.$9.pop(),this.finishNode(Ut,"Decorator")}shouldParseExportStatement(){return this.type===Kt||super.shouldParseExportStatement()}parseExprAtom(Ut,qt,Xt){if(this.type===Kt)this.$1q(!1);return super.parseExprAtom(Ut,qt,Xt)}parseProperty(Ut,qt){if(Ut||this.type!==Kt)return super.parseProperty(Ut,qt);let Xt=this.$12(),Jt=super.parseProperty(Ut,qt);if(Jt.type==="SpreadElement")this.raise(Jt.start,"Decorators can't be used with SpreadElement");return Jt.decorators=Xt,Jt}parseClassId(Ut,qt){let Xt=this.$9.length-1,Jt=this.$9[Xt];if(Jt.length>0)Ut.decorators=Jt,this.$q(Ut,Jt[0]),this.$9[Xt]=[];if(!this.isContextual("implements")||qt===!0)super.parseClassId(Ut,qt);if(this.$1())Ut.typeParameters=this.$8()}parseClassSuper(Ut){if(super.parseClassSuper(Ut),Ut.superClass&&this.$1())Ut.superTypeParameters=this.$e(!0);if(this.eatContextual("implements"))Ut.implements=this.$a(()=>this.$1j())}parseClassElement(Ut){if(this.type===Kt){let en=this.$12();if(this.type===ne.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let tn=this.parseClassElement(Ut);return tn.decorators=en,this.$q(tn,en[0]),tn}if(this.eat(ne.semi))return null;let qt=this.startNode();while(this.type===ne.name&&Kl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let en=this.value;if(this.next(),en==="static"&&this.type===ne.braceL)return this.next(),this.parseClassStaticBlock(qt),qt;if(en==="public"||en==="private"||en==="protected")qt.accessibility=en;else qt[en]=!0}if(this.type===ne.bracketL&&this.$1g())return this.$1h(qt);qt.static??=!1;let Xt="",Jt=!1,Qt=!1,Zt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===ne.star)&&!this.canInsertSemicolon())Qt=!0;else Xt="async";if(!Xt&&this.eat(ne.star))Jt=!0;if(!Xt&&!Qt&&!Jt){let en=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Zt=en;else Xt=en}if(Xt)qt.computed=!1,qt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),qt.key.name=Xt,this.finishNode(qt.key,"Identifier");else this.parseClassElementName(qt);if(this.eat(ne.question))qt.optional=!0;if(this.type===ne.parenL||this.$1()||Zt!=="method"||Jt||Qt){let en=qt.key,tn=!qt.static&&!qt.computed&&(en.type==="Identifier"&&en.name==="constructor"||en.type==="Literal"&&en.value==="constructor");if(qt.kind=tn?"constructor":Zt,this.$1())qt.typeParameters=this.$8();this.$o=this.start,this.parseClassMethod(qt,Jt,Qt,tn&&Ut)}else{if(!qt.optional&&this.$u())this.next(),qt.definite=!0;if(this.type===ne.colon)qt.typeAnnotation=this.$6();this.parseClassField(qt)}return qt}parseMaybeAssign(Ut,qt,Xt){if(this.$p()){let Jt=this.$g(()=>{let Qt=this.$8(),Zt=super.parseMaybeAssign(Ut,qt,Xt);if(Zt.type!=="ArrowFunctionExpression")return;return Zt.typeParameters=Qt,this.$q(Zt,Qt),Zt});if(Jt)return Jt}return super.parseMaybeAssign(Ut,qt,Xt)}parseMaybeUnary(Ut,qt,Xt,Jt){if(this.$p()){let Qt=this.startNode();return Qt.typeAnnotation=this.$a(()=>{this.next();let Zt=this.$0();if(!this.$c())this.unexpected();return this.next(),Zt}),Qt.expression=this.parseMaybeUnary(null,!1,!1,Jt),this.finishNode(Qt,"TSTypeAssertion")}return super.parseMaybeUnary(Ut,qt,Xt,Jt)}parseMaybeConditional(Ut,qt){let Xt=this.start,Jt=this.startLoc,Qt=this.parseExprOps(Ut,qt);if(this.checkExpressionErrors(qt))return Qt;if(this.type===ne.question&&!(Qt.type==="ArrowFunctionExpression"&&Qt.start===Xt)&&!this.$2j()){this.next();let Zt=this.startNodeAt(Xt,Jt);return Zt.test=Qt,Zt.consequent=this.parseMaybeAssign(),this.expect(ne.colon),Zt.alternate=this.parseMaybeAssign(Ut),this.finishNode(Zt,"ConditionalExpression")}return Qt}$2j(){let Ut=this.$d(),qt=this.input.charCodeAt(Ut);if(qt===ba||qt===ou||qt===ru)return!0;return qt===ji&&this.input.charCodeAt(Ut+1)!==ji}parseParenItem(Ut){return this.$h(Ut,!0)}$1x(){if(this.type!==ne.colon)return!0;let Ut=this.$g(()=>{let qt=this.$6(!0);return this.type===ne.arrow&&!this.canInsertSemicolon()?qt:void 0});if(!Ut)return!1;return this.$7=Ut,!0}shouldParseArrow(Ut){return this.$1x()&&super.shouldParseArrow(Ut)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Ut,qt,Xt,Jt){if(this.$7)Ut.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Ut,qt,Xt,Jt)}parseExprList(Ut,qt,Xt,Jt){if(!this.$m)return super.parseExprList(Ut,qt,Xt,Jt);this.$m=!1;let Qt=[],Zt=!0;while(!this.eat(Ut)){if(Zt)Zt=!1;else if(this.expect(ne.comma),qt&&this.afterTrailingComma(Ut))break;if(this.type===ne.ellipsis){let en=this.parseSpread(Jt);if(this.eat(ne.question))en.optional=!0;if(this.type===ne.colon)en.typeAnnotation=this.$6();Qt.push(en)}else Qt.push(this.parseMaybeAssign(!1,Jt,this.parseParenItem))}return Qt}parseSubscript(Ut,qt,Xt,Jt,Qt,Zt,en){if(this.$u()&&!this.hasPrecedingLineBreak()){let sn=this.startNodeAt(qt,Xt);return this.exprAllowed=!1,this.next(),sn.expression=Ut,this.finishNode(sn,"TSNonNullExpression")}if(Qt&&this.$1()){let sn=this.$g(()=>this.$2k(qt,Xt,en));if(sn)return sn}let tn=this.type===ne.questionDot&&this.$2()===Ca;if(this.$1()||tn||this.type===ne.bitShift&&this.value==="<<"){let sn=this.$g(()=>{if(tn)this.next();this.$p();let nn=this.$e(!0);if(this.type===ne.parenL&&!Jt)return nn;if(this.type===ne.backQuote)return tn?void 0:nn;if(tn)return;if(this.$c()||this.type===ne.bitShift||this.type.startsExpr&&this.type!==ne.parenL&&!this.hasPrecedingLineBreak())return;return nn});if(sn){let nn=this.startNodeAt(qt,Xt);if(this.type===ne.parenL&&!Jt){if(this.next(),nn.callee=Ut,nn.arguments=this.parseExprList(ne.parenR,!0,!1),nn.typeArguments=sn,tn)Ut.optional=!0;if(tn||Zt)nn.optional=tn;return this.finishNode(nn,"CallExpression")}if(this.type===ne.backQuote)return nn.tag=Ut,nn.quasi=this.parseTemplate({isTagged:!0}),nn.typeArguments=sn,this.finishNode(nn,"TaggedTemplateExpression");return nn.expression=Ut,nn.typeArguments=sn,this.finishNode(nn,"TSInstantiationExpression")}}if(Qt&&this.type===ne.parenL)this.$m=!0;return super.parseSubscript(Ut,qt,Xt,Jt,Qt,Zt,en)}$2k(Ut,qt,Xt){let Jt=this.startNodeAt(Ut,qt);if(Jt.typeParameters=this.$8(),this.expect(ne.parenL),Jt.params=this.parseBindingList(ne.parenR,!1,!0),this.type===ne.colon)Jt.returnType=this.$6(!0);if(this.type!==ne.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Jt,Jt.params,!0,Xt)}parseDynamicImport(Ut){if(this.next(),Ut.source=this.parseMaybeAssign(),this.eat(ne.comma)&&this.type!==ne.parenR)Ut.arguments=[this.parseExpression()];return this.expect(ne.parenR),this.finishNode(Ut,"ImportExpression")}parseNew(){let Ut=super.parseNew();if(Ut.callee?.type!=="TSInstantiationExpression")return Ut;let qt=this.startNodeAt(Ut.start,Ut.loc?.start);return qt.callee=Ut.callee.expression,qt.typeArguments=Ut.callee.typeArguments,qt.arguments=Ut.arguments,this.finishNodeAt(qt,"NewExpression",Ut.end,Ut.loc?.end)}parseExprOp(Ut,qt,Xt,Jt,Qt){if(ne._in.binop>Jt&&this.type===ne.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let Zt=this.value==="satisfies",en=this.startNodeAt(qt,Xt);return en.expression=Ut,en.typeAnnotation=this.$a(()=>{if(this.next(),!Zt&&this.type===ne._const){let tn=this.startNode();return tn.typeName=this.parseIdent(!0),this.finishNode(tn,"TSTypeReference")}return this.$0()}),this.finishNode(en,Zt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(en,qt,Xt,Jt,Qt)}return super.parseExprOp(Ut,qt,Xt,Jt,Qt)}parseGetterSetter(Ut){Ut.kind=Ut.key.name,super.parseGetterSetter(Ut)}parsePropertyValue(Ut,qt,Xt,Jt,Qt,Zt,en,tn){if(!qt&&this.$1()){if(this.$l=this.$8(),this.type!==ne.parenL)this.unexpected();Ut.kind="init"}return super.parsePropertyValue(Ut,qt,Xt,Jt,Qt,Zt,en,tn)}}return zt});function Ge(te){return{support:"typescript",parser:te}}function We(te){return te&&"parser"in te?te.parser:void 0}function He(te){return te&&"names"in te?te.names:void 0}function ce(){throw Error('svelte-ast: parsing TypeScript needs `typescript` from "svelte-ast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var uu=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(te,ne,Fe){super(`${Fe}
|
|
18
|
+
https://svelte.dev/e/${ne}`);this.code=ne,this.reason=Fe;let Vt=typeof te==="number"?te:te?.start,Gt=typeof te==="number"?te:te?.end;if(Vt!==void 0)this.position=[Vt,Gt??Vt],this.start=x(this.position[0]),this.end=x(this.position[1]),this.frame=hu(this.start.line-1,this.end.column)}}var wa=(te)=>te.replace(uu,(ne)=>" ".repeat(ne.length));function hu(te,ne){let Fe=Math.max(0,te-2),Vt=[];for(let Kt=Fe;Kt<te+3;Kt++){let zt=Oo(Kt);if(zt===void 0)break;Vt.push(zt)}let Gt=String(Fe+Vt.length+1).length;return Vt.map((Kt,zt)=>{let Ut=`${String(Fe+zt+1).padStart(Gt," ")}: ${wa(Kt)}`;if(Fe+zt!==te)return Ut;return`${Ut}
|
|
19
|
+
${" ".repeat(Gt+2+wa(Kt.slice(0,ne)).length)}^`}).join(`
|
|
20
|
+
`)}function Ue(te){throw new e(te,"attribute_duplicate","Attributes need to be unique")}function Je(te){throw new e(te,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function ue(te,ne){throw new e(te,"block_duplicate_clause",`${ne} cannot appear more than once within a block`)}function Ke(te){throw new e(te,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function ze(te){throw new e(te,"block_invalid_elseif","'elseif' should be 'else if'")}function qe(te,ne,Fe){throw new e(te,"block_invalid_placement",`{#${ne} ...} block cannot be ${Fe}`)}function Xe(te){throw new e(te,"block_unclosed","Block was left open")}function Ye(te){throw new e(te,"block_unexpected_close","Unexpected block closing tag")}function Qe(te){throw new e(te,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Ze(te){throw new e(te,"css_empty_declaration","Declaration cannot be empty")}function we(te){throw new e(te,"css_expected_identifier","Expected a valid CSS identifier")}function et(te){throw new e(te,"css_selector_invalid","Invalid selector")}function tt(te){throw new e(te,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function ke(te){throw new e(te,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function nt(te){throw new e(te,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function rt(te,ne){throw new e(te,"directive_missing_name",`\`${ne}\` name cannot be empty`)}function it(te,ne){throw new e(te,"element_invalid_closing_tag",`\`</${ne}>\` attempted to close an element that was not open`)}function st(te,ne,Fe){throw new e(te,"element_invalid_closing_tag_autoclosed",`\`</${ne}>\` attempted to close element that was already automatically closed by \`<${Fe}>\` (cannot nest \`<${Fe}>\` inside \`<${ne}>\`)`)}function De(te,ne){throw new e(te,"element_unclosed",`\`<${ne}>\` was left open`)}function Ne(te){throw new e(te,"expected_attribute_value","Expected attribute value")}function ot(te){throw new e(te,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function _e(te){throw new e(te,"expected_identifier","Expected an identifier")}function at(te){throw new e(te,"expected_pattern","Expected identifier or destructure pattern")}function lt(te){throw new e(te,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function D(te,ne){throw new e(te,"expected_token",`Expected token ${ne}`)}function pt(te){throw new e(te,"expected_whitespace","Expected whitespace")}function du(te,ne){throw new e(te,"js_parse_error",`${ne}`)}function ct(te){throw new e(te,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ut(te){throw new e(te,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function dt(te,ne){throw new e(te,"script_invalid_attribute_value",`If the \`${ne}\` attribute is supplied, it must be a boolean attribute`)}function ft(te){throw new e(te,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function mt(te,ne){throw new e(te,"script_reserved_attribute",`The \`${ne}\` attribute is reserved and cannot be used`)}function ht(te){throw new e(te,"style_duplicate","A component can have a single top-level `<style>` element")}function gt(te){throw new e(te,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function yt(te){throw new e(te,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function $e(te){throw new e(te,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function xt(te,ne){throw new e(te,"svelte_meta_duplicate",`A component can only have one \`<${ne}>\` element`)}function Et(te,ne){throw new e(te,"svelte_meta_invalid_content",`<${ne}> cannot have children`)}function St(te,ne){throw new e(te,"svelte_meta_invalid_placement",`\`<${ne}>\` tags cannot be inside elements or blocks`)}function vt(te,ne){throw new e(te,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${ne}`)}function Ct(te){throw new e(te,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function Tt(te){throw new e(te,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function de(te,ne){throw new e(te,"svelte_options_invalid_attribute_value",`Value must be ${ne}, if specified`)}function bt(te){throw new e(te,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function Pt(te){throw new e(te,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function At(te){throw new e(te,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function Re(te){throw new e(te,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function wt(te){throw new e(te,"svelte_options_reserved_tagname","Tag name is reserved")}function kt(te,ne){throw new e(te,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${ne}'`)}function Dt(te){throw new e(te,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function Nt(te,ne,Fe){throw new e(te,"tag_invalid_placement",`{@${ne} ...} tag cannot be ${Fe}`)}function f(te){throw new e(te,"unexpected_eof","Unexpected end of input")}function _t(te,ne){throw new e(te,"unexpected_reserved_word",`'${ne}' is a reserved word in JavaScript and cannot be used here`)}function $t(te){throw new e(te,"unterminated_string_constant","Unterminated string constant")}function Rt(te){throw new e(te,"void_element_invalid_content","Void elements cannot have children or closing tags")}var Ti="",Pa=[],bs=0,vn=[],En=0;function fu(te,ne){Ti=te,Pa=ne,bs=0}function mu(){return bs}function gu(te,ne,Fe,Vt){bs=Vt}function yu(te,ne,Fe,Vt,Gt,Kt){bs=Vt;let zt=ne;if(te&&zt.includes(`
|
|
21
|
+
`)){let qt=Ti.lastIndexOf(`
|
|
22
|
+
`,Fe-1)+1,Xt=qt,Jt=Ti.charCodeAt(Xt);while(Jt===32||Jt===9)Jt=Ti.charCodeAt(++Xt);if(Xt>qt)zt=xu(zt,Ti.slice(qt,Xt))}let Ut={type:te?"Block":"Line",value:zt,start:Fe,end:Vt};if(Gt&&Kt)Ut.loc={start:Gt,end:Kt};Pa.push(Ut)}function xu(te,ne){let Fe=te.startsWith(ne)?ne.length:0,Vt="",Gt=te.indexOf(`
|
|
23
|
+
`,Fe);while(Gt!==-1){if(Vt+=te.slice(Fe,Gt+1),Fe=Gt+1,te.startsWith(ne,Fe))Fe+=ne.length;Gt=te.indexOf(`
|
|
24
|
+
`,Fe)}return Vt+te.slice(Fe)}function vu(te,ne,Fe){let Vt=0,Gt=ne.length;while(Vt<Gt){let Kt=Vt+Gt>>>1;if(ne[Kt].start<Fe)Vt=Kt+1;else Gt=Kt}if(Vt>=ne.length)return;if(vn=ne.slice(Vt).map(({type:Kt,value:zt,start:Ut,end:qt})=>({type:Kt,value:zt,start:Ut,end:qt})),En=0,Cr(te,void 0,!1),En<vn.length&&(vn[En].start>=te.end||te.type==="Program")){te.trailingComments??=[];while(En<vn.length)te.trailingComments.push(vn[En++])}}var Eu=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function ka(te,ne){for(let Fe=te;Fe<ne;Fe++){let Vt=Ti.charCodeAt(Fe);if(Vt!==44&&Vt!==41&&Vt!==32&&Vt!==9)return!0}return!1}function Cr(te,ne,Fe){while(En<vn.length&&vn[En].start<te.start)te.leadingComments??=[],te.leadingComments.push(vn[En++]);if(En>=vn.length)return;let Vt=vn[En].start;if(Vt<te.end||!ka(te.end,Vt)){let Gt=ai(te),Kt=Eu.get(te.type),zt=Kt===void 0?void 0:Gt[Kt],Ut=Array.isArray(zt)&&zt.length===0;for(let qt in Gt){if(En>=vn.length)return;if(qt==="type")continue;let Xt=Gt[qt];if(Array.isArray(Xt)){let Jt=qt===Kt;for(let Qt=0;Qt<Xt.length;Qt++){let Zt=Xt[Qt];if(Un(Zt))Cr(Zt,te,Jt?Qt===Xt.length-1:Ut)}}else if(Un(Xt))Cr(Xt,te,Ut)}if(En>=vn.length)return}if(ne!==void 0&&te.end===ne.end)return;if(Fe)while(En<vn.length){if(ne&&vn[En].start>=ne.end)break;te.trailingComments??=[],te.trailingComments.push(vn[En++])}else if(te.end<=vn[En].start&&!ka(te.end,vn[En].start))te.trailingComments=[vn[En++]]}var fe=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" ")),Cs=!1,Gi=1,Su=2,bu=32,Cu=256,Tu=Gi|Su|Cu,wu=2,ku=3,Au=4,Pu=/\r\n?|\n|\u2028|\u2029/,Aa=new Map;function Ss(te){if(!(te instanceof RegExp))return te;let ne=Aa.get(te);if(!ne){let Fe=new Set(te.source.slice(4,-2).split("|"));ne={test:(Vt)=>Fe.has(Vt)},Aa.set(te,ne)}return ne}var Tr=Fi((te)=>class extends te{declareName(ne,Fe,Vt){let Gt=!1;if(Fe===wu){let Kt=this.currentScope();if(Gt=kn(Kt.lexical,ne)||kn(Kt.functions,ne)||kn(Kt.var,ne),Kt.lexical.push(ne),this.inModule&&Kt.flags&Gi)delete this.undefinedExports[ne]}else if(Fe===Au)this.currentScope().lexical.push(ne);else if(Fe===ku){let Kt=this.currentScope();Gt=this.treatFunctionsAsVar?kn(Kt.lexical,ne):kn(Kt.lexical,ne)||kn(Kt.var,ne),Kt.functions.push(ne)}else for(let Kt=this.scopeStack.length-1;Kt>=0;--Kt){let zt=this.scopeStack[Kt];if(kn(zt.lexical,ne)&&!(zt.flags&bu&&zt.lexical[0]===ne)||!this.treatFunctionsAsVarInScope(zt)&&kn(zt.functions,ne)){Gt=!0;break}if(zt.var.push(ne),this.inModule&&zt.flags&Gi)delete this.undefinedExports[ne];if(zt.flags&Tu)break}if(Gt)this.raiseRecoverable(Vt,`Identifier '${ne}' has already been declared`)}}),wr=Fi((te)=>{let{keywordTypes:ne,tokTypes:Fe}=te.acorn,Vt=new Map("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this const class extends export import super".split(" ").map((Kt)=>[Kt,ne[Kt]])),Gt;return class extends te{constructor(Kt,zt,Ut){super(Kt,zt,Ut);this.keywords=Ss(this.keywords),this.reservedWords=Ss(this.reservedWords),this.reservedWordsStrict=Ss(this.reservedWordsStrict),this.reservedWordsStrictBind=Ss(this.reservedWordsStrictBind),Gt??=this.context[0]}reset(Kt,zt,Ut){if(super.reset?.(Kt,zt,Ut),this.input=Kt,this.containsEsc=!1,this.pos=zt,Ut)this.lineStart=zt-Ut.column,this.curLine=Ut.line;else this.lineStart=Kt.lastIndexOf(`
|
|
25
|
+
`,zt-1)+1,this.curLine=this.options.locations?Kt.slice(0,this.lineStart).split(Pu).length:1;this.type=Fe.eof,this.value=null,this.start=this.end=zt,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=zt;let qt=this.context;if(qt.length!==1||qt[0]!==Gt)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let Qt in this.undefinedExports){this.undefinedExports=Object.create(null);break}let Xt=this.scopeStack,Jt=Xt[0];if(Xt.length!==1||Jt.flags!==Gi||Jt.var.length>0||Jt.lexical.length>0||Jt.functions.length>0||Jt.tsTypes!==void 0||Jt.tsExportOnly!==void 0||Jt.tsEnums!==void 0)this.scopeStack=[],this.enterScope(Gi);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(Kt,zt){let Ut=super.parseParenAndDistinguishExpression(Kt,zt);if(Ut.type==="ParenthesizedExpression")Cs=!0;return Ut}checkUnreserved(Kt){if(fe.has(Kt.name))super.checkUnreserved(Kt)}canInsertSemicolon(){let Kt=this.type;return Kt===Fe.eof||Kt===Fe.braceR||Bi(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let Kt=this.input,zt=this.options.locations,Ut=this.pos,qt=Kt.charCodeAt(Ut);for(;;)if(qt===32||qt===9)qt=Kt.charCodeAt(++Ut);else if(qt===10){if(qt=Kt.charCodeAt(++Ut),zt)this.curLine++,this.lineStart=Ut}else break;if(this.pos=Ut,qt===47||qt<33||qt>=128)super.skipSpace()}readWord1(){let Kt=this.input,zt=this.pos,Ut=zt,qt=Kt.charCodeAt(Ut),Xt=0;while(qt>=97&&qt<=122||qt>=65&&qt<=90||qt>=48&&qt<=57||qt===95||qt===36)Xt=Math.imul(Xt,31)+qt|0,qt=Kt.charCodeAt(++Ut);if(qt>=128||qt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Ut,Do(Kt,zt,Ut,Xt)}readWord(){let Kt=this.readWord1();return this.finishToken(Vt.get(Kt)??Fe.name,Kt)}}}),_a=vs(Tr,wr),_u=/ \(\d+:\d+\)$/;function wi(te){return te}function $a(te){return te instanceof SyntaxError&&"pos"in te&&typeof te.pos==="number"}function Ts(te,ne,Fe,Vt,Gt,Kt=te.root.comments.length){let zt=te.root.comments;fu(ne,zt);let Ut={onComment:te.comments?yu:gu,sourceType:"module",ecmaVersion:16,locations:te.loc,preserveParens:Vt};if(te.lfOnly)Ut.startLocation=x(Fe);let qt=te.isTypeScript?te.typescript:_a;if(!qt)ce();let Xt;try{Xt=Gt(qt,Ut)}catch(Jt){if(!$a(Jt))throw Jt;du(Jt.pos,Jt.message.replace(_u,""))}if(zt.length>Kt)vu(wi(Xt),zt,Fe);return Xt}function me(te,ne,Fe=0){return wi(Ts(te,ne,0,!1,(Vt,Gt)=>{if(Fe>0&&Gt.locations)Gt.startLocation=x(Fe);let Kt=new Vt(Gt,ne,Fe).parse();return Kt.start=0,Kt},0))}function $u(te,ne){if(!ne)return{line:1,column:0};let{column:Fe}=x(te);return{line:Io(te-Fe)+1,column:Fe}}var Nu={count:0},br,Du=(te)=>te.parseExpression();function Ru(te,ne,Fe,Vt,Gt){let Kt=br;if(br=void 0,Kt?.ParserClass===te&&Kt.onComment===ne.onComment&&Kt.locations===ne.locations&&Kt.parser.reset)Kt.parser.reset(Fe,Vt,ne.startLocation);else Kt={ParserClass:te,onComment:ne.onComment,locations:ne.locations,parser:new te(ne,Fe,Vt)};let zt=Kt.parser;zt.nextToken();let Ut=Gt(zt);return zt.input="",br=Kt,Ut}function Na(te,ne,Fe,Vt){return Nu.count+=1,Cs=!1,Ts(te,ne,Fe,!0,(Gt,Kt)=>(Kt.startLocation??=$u(Fe,Kt.locations),Ru(Gt,Kt,ne,Fe,Vt)))}function V(te,ne,Fe,Vt=!1){let Gt=wi(Na(te,ne,Fe,Du)),Kt=Math.max(Gt.end,mu());return{node:Cs&&!Vt?kr(Gt):Gt,end:Kt}}function It(te,ne,Fe){let Vt=te.root.comments.length,Gt=!0,Kt=Na(te,ne,Fe,(Ut)=>{let qt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Xt=Ut.parseMaybeConditional(void 0,qt);if(Ut.type!==_a.acorn.tokTypes.eof)return Gt=!1,Xt;let Jt=Ut.toAssignable(Xt,!1,qt);return Ut.checkLValPattern(Jt),Jt});if(!Gt){te.root.comments.length=Vt;return}let zt=wi(Kt);return Cs?kr(zt):zt}function Lt(te,ne,Fe){return wi(Ts(te,ne,Fe,!1,(Vt,Gt)=>{let Kt=new Vt(Gt,ne,Fe);try{return Kt.nextToken(),Kt.parseStatement(null,!0,Object.create(null))}catch(zt){if($a(zt)&&zt.pos===ne.length)f(ne.length);throw zt}}))}function Ot(te,ne,Fe){let Vt=Ts(te,ne,0,!1,(Gt,Kt)=>{let zt=new Gt(Kt,ne,0),Ut=zt.startNode(),qt=[],Xt=Object.create(null);return Fe((Jt)=>{zt.pos=Jt,zt.context=zt.initialContext(),zt.exprAllowed=!0,zt.nextToken();let Qt=zt.parseStatement(null,!0,Xt);return qt.push(Qt),Qt.end}),Ut.body=qt,zt.finishNode(Ut,"Program")});return wi(Vt).body}function kr(te){let ne=te;while(ne.type==="ParenthesizedExpression")ne=ne.expression;return K(ne,kr),ne}var he=vs(Tr,pe,wr);function ge(te,ne,Fe){return F(te),me({isTypeScript:ne.typescript??!1,typescript:Fe,loc:ne.loc??!1,comments:ne.comments??!0,root:{comments:[]}},te)}function I(te,ne={}){return ge(te,ne,he)}function ye(te,ne){let Fe=u(te.name,ne.name);if(Fe!==0)return Fe;let Vt=u(te.type,ne.type);if(Vt!==0)return Vt;if(te.type==="forwarded"&&ne.type==="forwarded"){let Gt=u(te.element,ne.element);if(Gt!==0)return Gt}return u(te.detail??"",ne.detail??"")}function Iu(te,ne){let Fe=te.length+1,Vt=ne.length+1,Gt=Array.from({length:Fe},()=>Array(Vt).fill(0));for(let Kt=0;Kt<Fe;Kt++)Gt[Kt][0]=Kt;for(let Kt=0;Kt<Vt;Kt++)Gt[0][Kt]=Kt;for(let Kt=1;Kt<Fe;Kt++)for(let zt=1;zt<Vt;zt++){let Ut=te[Kt-1]===ne[zt-1]?0:1;if(Gt[Kt][zt]=Math.min(Gt[Kt-1][zt]+1,Gt[Kt][zt-1]+1,Gt[Kt-1][zt-1]+Ut),Kt>1&&zt>1&&te[Kt-1]===ne[zt-2]&&te[Kt-2]===ne[zt-1])Gt[Kt][zt]=Math.min(Gt[Kt][zt],Gt[Kt-2][zt-2]+1)}return Gt[Fe-1][Vt-1]}function L(te,ne,Fe=3){let Vt,Gt=Number.POSITIVE_INFINITY;for(let Kt of ne){let zt=Iu(te,Kt);if(zt<Gt)Vt=Kt,Gt=zt}return Gt<=Fe?Vt:void 0}import{readFile as zh}from"node:fs/promises";import Ur from"node:path";import Da,{sep as Ar}from"node:path";var Ln=/\.svelte$/,ki=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],Ra=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function Ai(te){if(!te.endsWith(".svelte"))return!1;let ne=te.length-7;if(ne===0)return!1;let Fe=te.charCodeAt(ne-1);return Fe!==47&&(Ar==="/"||Fe!==92)}function n(te){return Ar==="/"?te:te.split(Ar).join("/")}function Ia(te,ne){return n(Da.join(ne,Da.normalize(te)))}function Wi(te){return`${JSON.stringify(te,null,2)}
|
|
26
|
+
`}var Oa="sveld",ws="0.40.5";var Mt={name:Oa,version:ws,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"},"./browser":{types:"./dist/browser.d.ts",import:"./dist/browser.js",default:"./dist/browser.js"},"./schema/component-api.schema.json":"./schema/component-api.schema.json"},scripts:{test:"bun test --parallel","test:changed":"bivium run --suite unit","test:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"bun check --project tsconfig.fixtures.json","test:types-matrix":"bun scripts/typecheck-option-matrix.ts","test:svelte-versions":"bun scripts/typecheck-svelte-versions.ts","test:e2e":"bun tests/test-e2e.ts","test:inferred-types":"bun scripts/check-inferred-types.ts","lint:all":"bun fmt && bun lint --fix && svelte-lint --fix","lint:changed":"bun fmt --changed && bun lint --changed --fix && svelte-lint --changed --fix","lint:svelte":"svelte-lint",knip:"knip-bun",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@types/bun":"^1.4.4","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",bivium:"^0.4.0",knip:"^6.43.0",ostia:"^0.2.11",svelte:"^5.58.0","svelte-ast":"^0.12.1","svelte-lint":"^0.1.1",typescript:"^7.0.2"},bin:{sveld:"dist/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 Ui="5.58.0";var ks=1;function Qn(te){return te.some((ne)=>ne.internal)?te.filter((ne)=>!ne.internal):te}function Lu(te){return{...te,props:Qn(te.props),moduleExports:Qn(te.moduleExports),slots:Qn(te.slots),events:Qn(te.events),typedefs:Qn(te.typedefs),...te.contexts?{contexts:Qn(te.contexts).map((ne)=>({...ne,properties:Qn(ne.properties)}))}:{}}}function y(te,ne={}){let Fe=Array.from(te.values(),(Kt)=>{let{diagnostics:zt,...Ut}=Kt;return Lu(Ut)}).sort((Kt,zt)=>u(Kt.moduleName,zt.moduleName)),Vt={schemaVersion:ks,generator:{name:Oa,version:ws,svelteVersion:Ui},total:Fe.length,components:Fe},Gt=ne.entryExports?Qn(ne.entryExports):void 0;if(Gt&&Gt.length>0)Vt.totalExports=Gt.length,Vt.exports=Gt;return Vt}var Mu=" ",Fu=120,Bu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,ju=200,Ba=/\s/,Vu=/\s{2}|[^\S ]/,Gu=/["'`{}/]/g,Wu=/["'`{};/]/g,ja=9,_r=10,Uu=13,Hi=32,Ps=34,Hu=38,_s=39,Ku=40,qu=41,As=42,La=46,Nr=47,Va=59,zu=62,Xu=91,Dr=92,Ju=93,$s=96,Rr=123,Yu=124,Ir=125;function Qu(te){return Bu.test(eh(te,ju))}var Ma=[""];function Zu(te){let ne=Ma[te];if(ne===void 0)ne=Mu.repeat(te),Ma[te]=ne;return ne}function eh(te,ne){let Fe="";for(let Vt=te.length-1;Vt>=0&&Fe.length<ne;Vt--)Fe=te[Vt]+Fe;return Fe.length>ne?Fe.slice(-ne):Fe}function th(te){if(te.length===0)return!1;let ne=te[te.length-1];return ne.charCodeAt(ne.length-1)===_r}function nh(te){while(te.length>0){let ne=te[te.length-1],Fe=ne.length;while(Fe>0){let Vt=ne.charCodeAt(Fe-1);if(Vt!==Hi&&Vt!==ja)break;Fe--}if(Fe===ne.length)return;if(Fe===0){te.pop();continue}te[te.length-1]=ne.slice(0,Fe);return}}function ih(te){while(te.length>0){let ne=te[te.length-1];if(!Ba.test(ne[ne.length-1]))return;let Fe=ne.trimEnd();if(Fe.length===ne.length)return;if(Fe.length===0){te.pop();continue}te[te.length-1]=Fe;return}}function sh(te){if(te.includes("{"))return!1;let ne=0,Fe=0;for(let Vt=0;Vt<te.length;Vt++){let Gt=te.charCodeAt(Vt);if(ne!==0){if(Gt===ne&&te.charCodeAt(Vt-1)!==Dr)ne=0;continue}if(Gt===Ps||Gt===_s||Gt===$s){ne=Gt;continue}if(Gt===Va&&++Fe>=2)return!0}return!1}function rh(te){if(!Vu.test(te))return te.trimEnd();let ne="",Fe=null,Vt=!1;for(let Gt=0;Gt<te.length;Gt++){let Kt=te[Gt],zt=te[Gt-1];if(Fe){if(ne+=Kt,Fe==="double"&&Kt==='"'&&zt!=="\\"||Fe==="single"&&Kt==="'"&&zt!=="\\"||Fe==="template"&&Kt==="`"&&zt!=="\\")Fe=null;Vt=!1;continue}if(Kt==='"'||Kt==="'"||Kt==="`"){Fe=Kt==='"'?"double":Kt==="'"?"single":"template",ne+=Kt,Vt=!1;continue}if(Ba.test(Kt)){if(!Vt&&ne.length>0)ne+=" ",Vt=!0;continue}ne+=Kt,Vt=!1}return ne.trimEnd()}function Ga(te,ne){let Fe=te[ne],Vt=te.indexOf(Fe,ne+1);while(Vt!==-1&&te.charCodeAt(Vt-1)===Dr)Vt=te.indexOf(Fe,Vt+1);return Vt}function Wa(te,ne){let Fe=te.indexOf("*/",ne+1);return Fe===-1?-1:Fe+1}function oh(te){let ne=new Map,Fe=[],Vt=Gu,Gt=0;while(Gt<te.length){if(Vt.lastIndex=Gt,!Vt.test(te))break;Gt=Vt.lastIndex-1;let Kt=te.charCodeAt(Gt);if(Kt===Nr){if(te.charCodeAt(Gt+1)===As){let zt=Wa(te,Gt);if(zt===-1)break;Gt=zt}}else if(Kt===Ps||Kt===_s||Kt===$s){let zt=Ga(te,Gt);if(zt===-1)break;Gt=zt}else if(Kt===Rr)Fe.push(Gt);else if(Kt===Ir&&Fe.length>0)ne.set(Fe.pop(),Gt);Gt++}return ne}function ah(te,ne,Fe){for(let Vt=ne;Vt<Fe;Vt++)if(!$r(te.charCodeAt(Vt)))return!1;return!0}function $r(te){if(te<=Hi)return te===Hi||te>=ja&&te<=Uu;if(te<160)return!1;return te===160||te===5760||te>=8192&&te<=8202||te===8232||te===8233||te===8239||te===8287||te===12288||te===65279}function Ua(te,ne,Fe,Vt){let Gt=[],Kt=Wu,zt=ne,Ut=ne;while(Ut<Fe){if(Kt.lastIndex=Ut,!Kt.test(te))break;if(Ut=Kt.lastIndex-1,Ut>=Fe)break;let qt=te.charCodeAt(Ut);if(qt===Nr){if(te.charCodeAt(Ut+1)===As){let Xt=Wa(te,Ut);if(Xt===-1)break;Ut=Xt}Ut++;continue}if(qt===Ps||qt===_s||qt===$s){let Xt=Ga(te,Ut);if(Xt===-1)break;Ut=Xt+1;continue}if(qt===Rr){let Xt=Vt.get(Ut);if(Xt===void 0||Xt>=Fe){Ut++;continue}if(zt<Ut)Gt.push(te.slice(zt,Ut));let Jt=Ut+1;if(ah(te,Jt,Xt)){Gt.push("{}"),Ut=Xt+1,zt=Ut;continue}let Qt=te.slice(Jt,Xt),Zt=te.charCodeAt(Jt)===_r;if(!Zt&&!Qt.includes("/*")&&!sh(Qt)&&!Qu(Gt)){let en=Ua(te,Jt,Xt,Vt),tn=en.trim();if(!tn.includes(`
|
|
27
|
+
`)){let sn=tn.endsWith(";")?tn.slice(0,-1):tn,nn=`{ ${rh(sn)} }`;if(nn.length<=Fu){Gt.push(nn),Ut=Xt+1,zt=Ut;continue}}if(Gt.push("{"),en.charCodeAt(0)!==Va)Gt.push(`
|
|
28
|
+
`);if(en.length>0)Gt.push(en);Ut=Xt,zt=Xt;continue}if(Gt.push("{"),!Zt)Gt.push(`
|
|
29
|
+
`);Ut=Jt,zt=Jt;continue}if(qt===Ir){if(zt<Ut)Gt.push(te.slice(zt,Ut));if(nh(Gt),!th(Gt))Gt.push(`
|
|
30
|
+
`);Gt.push("}"),Ut++,zt=Ut;continue}if(zt<Ut)Gt.push(te.slice(zt,Ut));if(ih(Gt),Gt.push(";"),te.charCodeAt(Ut+1)!==_r)Gt.push(`
|
|
31
|
+
`);Ut++,zt=Ut}if(zt<Fe)Gt.push(te.slice(zt,Fe));return Gt.join("")}function ph(te){if(!te.includes(" "))return te;let ne="",Fe=0;for(let Vt=0;Vt<te.length;Vt++){let Gt=te.charCodeAt(Vt);if(Fe!==0){if(ne+=te[Vt],Gt===Fe&&te.charCodeAt(Vt-1)!==Dr)Fe=0;continue}if(Gt===Ps||Gt===_s||Gt===$s){Fe=Gt,ne+=te[Vt];continue}if(Gt===Hi&&ne.charCodeAt(ne.length-1)===Hi)continue;ne+=te[Vt]}return ne}function ch(te){return te===Ir||te===Ju||te===qu||te===zu}function lh(te,ne,Fe){return Fe-ne>=3&&te.charCodeAt(ne)===Nr&&te.charCodeAt(ne+1)===As&&te.charCodeAt(ne+2)===As}function Fa(te,ne,Fe){let Vt=te.indexOf("*/",ne);return Vt!==-1&&Vt+2<=Fe}function uh(te,ne,Fe){let Vt=te.charCodeAt(ne);if(Vt===Yu||Vt===Hu)return!0;return Vt===La&&ne+1<Fe&&te.charCodeAt(ne+1)!==La}function hh(te){let ne=[],Fe=[],Vt=te.length,Gt=0,Kt=!1,zt=0,Ut=0;while(Ut<=Vt){let Jt=te.indexOf(`
|
|
32
|
+
`,Ut);if(Jt===-1)Jt=Vt;let Qt=Jt+1,Zt=Ut,en=Jt;while(Zt<en&&$r(te.charCodeAt(Zt)))Zt++;while(en>Zt&&$r(te.charCodeAt(en-1)))en--;if(Zt===en){let cn=Fe.length>0?Fe[Fe.length-1]:void 0;if(cn!==void 0&&cn!==""){let fn=cn.charCodeAt(cn.length-1);if(fn!==Rr&&fn!==Ku&&fn!==Xu)ne.push(0),Fe.push("")}Ut=Qt;continue}if(Kt){if(ne.push(zt),Fe.push(` ${te.slice(Zt,en)}`),Fa(te,Zt,en))Kt=!1;Ut=Qt;continue}let tn=lh(te,Zt,en),sn=tn&&Fa(te,Zt,en);if(tn&&!sn){ne.push(Gt),Fe.push(te.slice(Zt,en)),Kt=!0,zt=Gt,Ut=Qt;continue}let nn=ch(te.charCodeAt(Zt)),pn=Math.max(0,Gt-(nn?1:0))+(uh(te,Zt,en)?1:0);if(nn&&pn===0&&Fe.length>0&&Fe[Fe.length-1]==="")ne.pop(),Fe.pop();if(ne.push(pn),Fe.push(ph(te.slice(Zt,en))),Ut=Qt,sn)continue;Gt=ps(te,void 0,Zt,en,Gt)}let qt=Fe.length;while(qt>0&&Fe[qt-1]==="")qt--;let Xt=[];for(let Jt=0;Jt<qt;Jt++){if(Jt>0)Xt.push(`
|
|
33
|
+
`);let Qt=ne[Jt];if(Qt>0)Xt.push(Zu(Qt));Xt.push(Fe[Jt])}return Xt.join("")}function Ha(te){return`${hh(Ua(te,0,te.length,oh(te)))}
|
|
34
|
+
`}var Dn="any",dh="Record<string, any>",Ki="Record<string, never>",Ya=/^[A-Za-z_$][A-Za-z0-9_$]*$/,fh=/CustomEvent/,mh=/^[A-Z]/,gh=/\n/,yh=/=>/,xh=/^\s*[(<]/,vh=/(?:^|\n)@default\b/,Eh=/^([ \t]*\*) +$/gm,Sh=/[^\S\r\n]*[\r\n]\s*/g,bh=/(^|[^.\w])Snippet(?:\s*<|\b)/,Ch=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,Th=/^const\s+/,wh=/^export /,kh=/[^\w$]/g;function Lr(te){return te.replace(Th,"")}function Vn(te){if(te.length===0)return"";return`/**
|
|
35
|
+
* ${j(te.join(`
|
|
36
|
+
* `))}
|
|
37
|
+
*/`}function qi(te){return te?te.split(`
|
|
38
|
+
`):[]}function Qa(te){if(te===void 0)return[];return(te===!0?"@deprecated":`@deprecated ${te}`).split(`
|
|
39
|
+
`)}function Mr(te){let ne=[];for(let{name:Fe,body:Vt}of te??[])if(!Vt)ne.push(`@${Fe}`);else if(Vt.includes(`
|
|
40
|
+
`))ne.push(`@${Fe}`,...Vt.split(`
|
|
41
|
+
`));else ne.push(`@${Fe} ${Vt}`);return ne}function Pi(te,ne,Fe){return[...qi(te),...Qa(ne),...Mr(Fe)]}function Za(te){if(!te)return"";return`/** ${j(te)} */`}function Fr(te){return te?.includes(`
|
|
42
|
+
`)?Vn(qi(te)):Za(te)}function Br(te,ne,Fe){let Vt=[...Mr(ne),...Qa(Fe)];if(Vt.length===0)return Fr(te);return Vn([...qi(te),...Vt])}function ep(te){if(te===void 0)return Dn;return`${te}
|
|
43
|
+
`}function Ds(te){if(te.typedefs.length===0)return"";return te.typedefs.map((ne)=>{let Fe=Vn([...qi(ne.description),...Mr(ne.tags)]);return`${Fe?`${Fe}
|
|
44
|
+
`:""}export ${ne.ts}`.replace(Eh,"$1")}).join(`
|
|
45
|
+
|
|
46
|
+
`)}var Ka=new Map;function Ah(te,ne){let Fe=Ka.get(ne);if(Fe===void 0)Fe=new RegExp(`\\b${R(ne)}\\b`),Ka.set(ne,Fe);return Fe.test(te)}var qa,za=[];function Ns(te){if(te!==qa)qa=te,za=r(te,",");return za}function Ph(te){if(te===null)return[];return te[0].split(",").map((ne,Fe)=>({name:ne.trim(),constraint:(Ns(te[1]??"")[Fe]??ne).trim()}))}function tp(te,ne){let Fe=Ph(te).filter(({name:Vt})=>Ah(ne,Vt));if(Fe.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Fe.map(({constraint:Vt})=>Lr(Vt)).join(", ")}>`,refSuffix:`<${Fe.map(({name:Vt})=>Vt).join(", ")}>`}}function np(te){if(!te.contexts||te.contexts.length===0)return"";return te.contexts.map((ne)=>{let Fe=ne.properties.map((zt)=>{let Ut=zt.description?`${Fr(zt.description)}
|
|
47
|
+
`:"",qt=zt.optional?"?":"";return`${Ut}${Mn(zt.name)}${qt}: ${zt.type};`}).join(`
|
|
48
|
+
`),Vt=ne.description?`${Vn(qi(ne.description))}
|
|
49
|
+
`:"",{declSuffix:Gt}=tp(te.generics,[ne.type??"",...ne.properties.map((zt)=>zt.type)].join(`
|
|
50
|
+
`));if(ne.type!==void 0)return`${Vt}export type ${ne.typeName}${Gt} = ${ne.type};`;if(ne.properties.length===0)return`${Vt}export type ${ne.typeName} = ${ne.hasUnresolvedSpread?"Record<string, any>":Ki};`;let Kt=ne.hasUnresolvedSpread?" & Record<string, any>":"";return`${Vt}export type ${ne.typeName}${Gt} = {
|
|
51
|
+
${Fe}
|
|
52
|
+
}${Kt};`}).join(`
|
|
53
|
+
|
|
54
|
+
`)}function Mn(te){return Ya.test(te)?te:JSON.stringify(te)}function Xa(te,ne){let Fe=Br(ne.description,ne.tags,ne.deprecated),Vt=Fe?`${Fe}
|
|
55
|
+
`:"",Gt=!ne.slot_props||ne.slot_props===Ki?"[]":Nh(ne.slot_props),Kt=Gt==="[]"?"(this: void) => void":`(this: void, ...args: ${Gt}) => void`;return`
|
|
56
|
+
${Vt}${te}?: ${Kt};`}function _h(te){let ne=te.props.filter((on)=>!Zn(on)),Fe=new Set([...ne.map((on)=>on.name),...Array.from(te.canonicalPropNames??[])]),Gt=(te.canonicalPropsType?ne.filter((on)=>!te.canonicalPropNames?.has(on.name)):ne).map((on)=>{let gi=typeof on.value==="string"?on.value.replace(Sh," "):on.value,is=vh.test(on.description??"")||on.value===void 0||on.value==="undefined",ss=Vn([...Pi(on.description,on.deprecated,on.tags),...on.constant?["@constant"]:[],...is?[]:[`@default ${gi}`]]),rs=on.constant&&!on.isFunction?on.value:on.type||Dn;return`
|
|
57
|
+
${ss}
|
|
58
|
+
${Mn(on.name)}${on.isRequired?"":"?"}: ${rs};`});for(let on of te.slots)if(!on.default&&on.name!=null&&!Fe.has(on.name))Gt.push(Xa(Mn(on.name),on));let Kt=te.slots.find((on)=>on.default||on.name===null);if(Kt&&!Fe.has("children"))Gt.push(Xa("children",Kt));let zt=Gt.join(`
|
|
59
|
+
`),Ut=_i(te.moduleName),qt=te.generics?`<${Ns(te.generics[1]).map((on)=>Lr(on.trim())).join(", ")}>`:"",Xt=te.generics?`<${te.generics[0]}>`:"",Qt=`${te.extends===void 0?"":`Omit<${te.extends.interface}, keyof $Props${Xt}> & `}$Props${Xt}`,Zt=(on)=>`export type ${Ut}${qt} = ${on};`,en=`{${zt}
|
|
60
|
+
}`;if(te.rest_props?.type!=="Element"){let on;if(te.canonicalPropsType){let gi=zt.trim()===""?"":` & ${en}`;on=[`type $Props${qt} = ${te.canonicalPropsType}${gi};`,Zt(Qt)]}else if(zt.trim()==="")on=[Zt(te.extends?.interface??Ki)];else if(te.extends===void 0)on=[Zt(en)];else on=[`type $Props${qt} = ${en};`,Zt(Qt)];return{props_name:Ut,prop_def:on.join(`
|
|
61
|
+
|
|
62
|
+
`),elementsImport:void 0}}let{name:tn,thisValue:sn,thisType:nn,description:pn}=te.rest_props,cn;if(tn!=="svelte:element")cn=tn.split("|").map((on)=>`SvelteHTMLElements["${on.trim()}"]`).join(" & ");else if(sn)cn=`SvelteHTMLElements["${sn}"]`;else if(nn)cn=`NoInfer<SvelteHTMLElements[${nn}]>`;else cn="HTMLAttributes<HTMLElement>";let fn="[key: `data-${string}`]: unknown;",gn=pn?`${Fr(pn)}
|
|
63
|
+
`:"",yn=te.canonicalPropsType?`(${te.canonicalPropsType}) & `:"",Wn=nn?{name:qt,ref:Xt}:{name:"",ref:""},ri=te.extends===void 0?`keyof $Props${Xt}`:`keyof ($Props${Xt} & ${te.extends.interface})`,oi=`Omit<$RestProps${Wn.ref}, ${ri}>`,Sn=nn?$h(nn,te.generics,te.extends?.interface):void 0,zn=Sn?Sn.ref:oi;return{props_name:Ut,prop_def:[`${gn}type $RestProps${Wn.name} = ${cn};`,...Sn?[Sn.declaration]:[],`type $Props${qt} = ${yn}{${zt}
|
|
64
|
+
|
|
65
|
+
${fn}
|
|
66
|
+
};`,Zt(`${zn} & ${Qt}`)].join(`
|
|
67
|
+
|
|
68
|
+
`),elementsImport:cn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function $h(te,ne,Fe){if(!ne)return;let Vt=Ns(ne[0]).map((tn)=>tn.trim()),Gt=Ns(ne[1]).map((tn)=>Lr(tn.trim())),Kt=Vt.indexOf(te),zt=Gt[Kt];if(Kt===-1||!zt?.startsWith(`${te} extends `))return;let Ut=r(zt.slice(`${te} extends `.length),"=")[0]?.trim();if(!Ut)return;let qt=Vt.filter((tn,sn)=>sn!==Kt),Xt=Gt.filter((tn,sn)=>sn!==Kt),Jt=Xt.length>0?`<${Xt.join(", ")}>`:"",Qt=qt.length>0?`<${qt.join(", ")}>`:"",Zt=`<${Vt.map((tn)=>tn===te?"$Tag":tn).join(", ")}>`,en=Fe===void 0?`keyof $Props${Zt}`:`keyof ($Props${Zt} & ${Fe})`;return{declaration:`type $Elements${Jt} = { [$Tag in ${Ut}]: Omit<$RestProps${Zt}, ${en}> };`,ref:`$Elements${Qt}[${te}]`}}function Nh(te){return Di(te)?te:`[${te}]`}function Dh(te){let ne=te.slots.filter((Vt)=>!Di(Vt.slot_props??""));if(ne.length===0)return Ki;let Fe=ne.map(({name:Vt,slot_props:Gt,...Kt})=>{let zt=Kt.default||Vt===null?"default":Mn(Vt??""),Ut=Br(Kt.description,Kt.tags,Kt.deprecated);return`${Ut?`${Ut}
|
|
69
|
+
`:""}${zt}: ${ep(Gt)};`}).join(`
|
|
70
|
+
`);return ne.length===1?`{${Fe}}`:`{
|
|
71
|
+
${Fe}
|
|
72
|
+
}`}var Rh=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave","contextmenu","wheel","keydown","keyup","keypress","submit","change","input","focus","blur","focusin","focusout","reset","select","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragover","dragenter","dragleave","drop","pointerdown","pointerup","pointermove","pointerover","pointerout","pointerenter","pointerleave","pointercancel","gotpointercapture","lostpointercapture","play","pause","ended","volumechange","timeupdate","loadeddata","loadedmetadata","canplay","canplaythrough","seeking","seeked","playing","waiting","stalled","suspend","abort","error","emptied","ratechange","durationchange","loadstart","progress","loadend","animationstart","animationend","animationiteration","animationcancel","transitionstart","transitionend","transitionrun","transitioncancel","scroll","resize","load","unload","beforeunload","cut","copy","paste","compositionstart","compositionupdate","compositionend"]);function Or(te=Dn){if(fh.test(te))return te;return`CustomEvent<${te}>`}function Rs(te){switch(te.type){case"dispatched":return Or(te.detail);case"forwarded":{let ne=te.element,Fe=ne&&mh.test(ne),Vt=!Fe||Rh.has(te.name);if(te.detail!==void 0&&te.detail!=="undefined"&&!(te.detail==="null"&&Vt&&!Fe))return Or(te.detail);if(!Vt)return Or();return`${ne==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${te.name}"]`}default:return te}}function Ja(te){if(te.events.length===0)return dh;let ne=te.events.map((Fe)=>{let Vt=Br(Fe.description,Fe.tags,Fe.deprecated);return`${Vt?`${Vt}
|
|
73
|
+
`:""}${Mn(Fe.name)}: ${Rs(Fe)};
|
|
74
|
+
`}).join("");return te.events.length===1?`{${ne}}`:`{
|
|
75
|
+
${ne}}`}function Ih(te){let ne=te.type==="() => any";if(te.type&&yh.test(te.type)&&!ne)return te.type;if(te.params&&te.params.length>0)return`(${h(te.params)}) => ${te.returnType||Dn}`;if(te.returnType)return`() => ${te.returnType}`;return te.type||Dn}function Zn(te){return te.isFunctionDeclaration===!0||te.kind==="const"}function ip(te){return te.props.filter(Zn).map((ne)=>`
|
|
76
|
+
${Vn(Pi(ne.description,ne.deprecated,ne.tags))}
|
|
77
|
+
${Mn(ne.name)}: ${Ih(ne)};`).join(`
|
|
78
|
+
`)}function Oh(te){let ne=zi(te.moduleName),Fe=ip({props:te.props});if(Fe.trim()==="")return{exports_ref:ne,exports_def:`export type ${ne} = ${Ki};`};let{declSuffix:Vt,refSuffix:Gt}=tp(te.generics,Fe);return{exports_ref:`${ne}${Gt}`,exports_def:`export type ${ne}${Vt} = {${Fe}
|
|
79
|
+
};`}}function Lh(te){let ne=te.props.filter((Fe)=>Fe.bindable===!0||Fe.binding==="writable").map((Fe)=>JSON.stringify(Fe.name));return ne.length>0?ne.join(" | "):'""'}function sp(te){return te==="default"?"$$Component":te}function Mh(te){let ne=sp(te.moduleName);return`declare const ${ne}: Component<
|
|
80
|
+
${te.propsRef},
|
|
81
|
+
${te.exportsRef},
|
|
82
|
+
${te.bindings}
|
|
83
|
+
>;
|
|
84
|
+
export default ${ne};`}function Fh(te){let ne=sp(te.moduleName),Fe=`${ne}Component`,Vt=te.eventsRef?`$on?<K extends keyof ${te.eventsRef} & string>(type: K, callback: (e: ${te.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${Fe} {
|
|
85
|
+
new ${te.generic}(
|
|
86
|
+
options: ComponentConstructorOptions<${te.propsRef}>
|
|
87
|
+
): SvelteComponent<${te.propsRef}${te.eventsRef?`, ${te.eventsRef}`:""}> & ${te.exportsRef};
|
|
88
|
+
${te.generic}(
|
|
89
|
+
this: void,
|
|
90
|
+
internals: ComponentInternals,
|
|
91
|
+
props: ${te.propsRef}
|
|
92
|
+
): {
|
|
93
|
+
${Vt}
|
|
94
|
+
$set?(props: Partial<${te.propsRef}>): void;
|
|
95
|
+
} & ${te.exportsRef};
|
|
96
|
+
element?: typeof HTMLElement;
|
|
97
|
+
z_$$bindings?: ${te.bindings};
|
|
98
|
+
}
|
|
99
|
+
declare const ${ne}: ${Fe};
|
|
100
|
+
export default ${ne};`}function Bh(te){if(te.extends===void 0)return"";return`import type { ${jr(te.extends.interface)} } from ${te.extends.import};`}function jr(te){let ne=te.indexOf("<");return(ne===-1?te:te.slice(0,ne)).trim()}function jh(te){if(!te.componentComment)return"";if(!gh.test(te.componentComment))return Za(te.componentComment.trim());return`/*${j(te.componentComment).split(`
|
|
101
|
+
`).map((ne)=>`* ${ne}`).join(`
|
|
102
|
+
`)}
|
|
103
|
+
*/`}function Vh(te){let ne=[],Fe=new Map;for(let Vt of te.moduleExports){if(Vt.kind!=="re-export"||!Vt.reExport)continue;let{from:Gt,imported:Kt}=Vt.reExport,zt=Vn(Pi(Vt.description,Vt.deprecated,Vt.tags)),Ut=Mn(Vt.name);if(Kt==="*"){let Jt=Vt.name==="*"?"*":`* as ${Ut}`;ne.push(`${zt}
|
|
104
|
+
export ${Jt} from ${JSON.stringify(Gt)};`);continue}let qt=`${Gt}\x00${zt}`,Xt=Fe.get(qt);if(!Xt)Xt={comment:zt,from:Gt,specifiers:[]},Fe.set(qt,Xt),ne.push(qt);Xt.specifiers.push(Kt===Vt.name?Ut:`${Mn(Kt)} as ${Ut}`)}return ne.map((Vt)=>{let Gt=Fe.get(Vt);if(!Gt)return Vt;return`${Gt.comment}
|
|
105
|
+
export { ${Gt.specifiers.join(", ")} } from ${JSON.stringify(Gt.from)};`}).join(`
|
|
106
|
+
|
|
107
|
+
`)}function Vr(te){let ne=[te.static?"static ":"",te.abstract?"abstract ":"",te.readonly?"readonly ":""].join(""),Fe=te.optional?"?":"";if(te.kind==="property")return`${ne}${Mn(te.name)}${Fe}: ${te.type??Dn}`;if(te.kind==="index")return`${ne}${te.name}: ${te.type??Dn}`;let Vt=h(te.params??[]);if(te.kind==="constructor")return`constructor(${Vt})`;let Gt=te.typeParameters?`<${te.typeParameters}>`:"";return`${ne}${Mn(te.name)}${Fe}${Gt}(${Vt}): ${te.returnType??Dn}`}function Gh(te,ne){let Fe=te.localName??te.name,Vt=Fe!==te.name,Gt=`export { ${Fe}${Vt?` as ${Mn(te.name)}`:""} };`;if(ne.has(Fe))return Gt;ne.add(Fe);let Kt=te.typeParameters?`<${te.typeParameters}>`:"",zt=(te.members??[]).map((Jt)=>[Vn(Pi(Jt.description,Jt.deprecated,Jt.tags)),`${Vr(Jt)};`].filter(Boolean).join(`
|
|
108
|
+
`)).join(`
|
|
109
|
+
|
|
110
|
+
`),Ut=`${te.extends?` extends ${te.extends}`:""}${te.implements?.length?` implements ${te.implements.join(", ")}`:""}`,qt=`${Vt?"":"export "}declare ${te.abstract?"abstract ":""}class ${Fe}${Kt}${Ut}`;return`
|
|
111
|
+
${[Vn(Pi(te.description,te.deprecated,te.tags)),zt?`${qt} {
|
|
112
|
+
${zt}
|
|
113
|
+
}`:`${qt} {}`,Vt?Gt:""].filter(Boolean).join(`
|
|
114
|
+
`)}`}function Wh(te){let ne=Vh(te),Fe=new Set,Vt=te.moduleExports.filter((Gt)=>Gt.kind!=="re-export").map((Gt)=>{if(Gt.kind==="class")return Gh(Gt,Fe);let Kt=!Ya.test(Gt.name),zt=Kt?{...Gt,name:Uh(Gt.name)}:Gt,Ut,qt=zt.type&&xh.test(zt.type)?b(zt.type):-1,Xt=zt.typeParameters?`<${zt.typeParameters}>`:"";if(zt.kind==="const"&&qt===-1)Ut=`export declare const ${zt.name}: ${zt.type||Dn};
|
|
115
|
+
`;else if(zt.kind==="let")Ut=`export declare let ${zt.name}: ${zt.type||Dn};`;else if(zt.params&&zt.params.length>0)Ut=`export declare function ${zt.name}${Xt}(${h(zt.params)}): ${zt.returnType||Dn};`;else if(zt.returnType)Ut=`export declare function ${zt.name}${Xt}(): ${zt.returnType};`;else if(zt.type&&qt!==-1){let Jt=zt.type.slice(0,qt).trimEnd(),Qt=zt.type.slice(qt+2).trim();Ut=`export declare function ${zt.name}${Jt}: ${Qt};`}else Ut=`export declare let ${zt.name}: ${zt.type||Dn};`;if(Kt)Ut=`${Ut.replace(wh,"").trimEnd()}
|
|
116
|
+
export { ${zt.name} as ${JSON.stringify(Gt.name)} };`;return`
|
|
117
|
+
${Vn(Pi(zt.description,zt.deprecated,zt.tags))}
|
|
118
|
+
${Ut}`}).join(`
|
|
119
|
+
`);return[ne,Vt].filter(Boolean).join(`
|
|
120
|
+
|
|
121
|
+
`)}function Uh(te){return`__export_${te.replace(kh,"_")}`}var Hh=120;function Kh(te){let Fe=`export default class ${te.moduleName==="default"?"":te.moduleName}${te.generic} extends SvelteComponentTyped<`,Vt=[te.genericProps,te.events,te.slots],Kt=[te.ownConstructor?`constructor(options: ComponentConstructorOptions<${te.genericProps}>);`:"",te.accessors.trim()].filter(Boolean).join(`
|
|
122
|
+
`);if(Kt===""&&Vt.every((zt)=>!zt.includes(`
|
|
123
|
+
`))){let zt=`${Fe}${Vt.join(", ")}> {}`;if(zt.length<=Hh)return zt}return`${Fe}
|
|
124
|
+
${te.genericProps},
|
|
125
|
+
${te.events},
|
|
126
|
+
${te.slots}
|
|
127
|
+
> {
|
|
128
|
+
${Kt}
|
|
129
|
+
}`}function _i(te){return`${te}Props`}function zi(te){return`${te}Exports`}function Gr(te){return{format:te.format}}var qh={format:"class"};function rp(te){let ne=Gr(te??{}),Fe={};for(let[Vt,Gt]of Object.entries(ne))Fe[Vt]=Gt??qh[Vt];return JSON.stringify(Fe)}function Wr(te,ne){let Fe=No(te),{moduleName:Vt,typedefs:Gt,generics:Kt,props:zt,moduleExports:Ut,slots:qt,events:Xt,rest_props:Jt,extends:Qt,componentComment:Zt,contexts:en}=te,tn=ne?.format==="component",sn=Kt!==null,{props_name:nn,prop_def:pn,elementsImport:cn}=_h({moduleName:Vt,props:zt,rest_props:Jt,extends:Qt,generics:Kt,slots:qt,canonicalPropNames:new Set(Fe?.canonicalPropNames??[]),canonicalPropsType:Fe?.canonicalPropsType}),fn=Kt?`<${Kt[1]}>`:"",gn=Kt?`${nn}<${Kt[0]}>`:nn,yn=tn&&Xt.length>0?`type $Events${fn} = ${Ja({events:Xt})};`:"",Wn=Kt?`$Events<${Kt[0]}>`:"$Events",ri=tn&&(sn||yn!==""),oi=Wh({moduleExports:Ut}),Sn=Ds({typedefs:Gt}),zn=np({contexts:en,generics:Kt}),on=(Fe?.typeImportStatements??[]).join(`
|
|
130
|
+
`),gi=[...Fe?.localTypeDeclarations??[],...Fe?.moduleTypeDeclarations??[]].join(`
|
|
131
|
+
|
|
132
|
+
`),{exports_ref:is,exports_def:ss}=tn?Oh({props:zt,moduleName:Vt,generics:Kt}):{exports_ref:"",exports_def:""},rs=tn?Lh({props:zt}):"",_o=Jt?.type==="Element"&&Jt.thisType!==void 0,Ys=!Ch.test(on)&&[pn,oi,Sn,zn,gi,ss].some((Qs)=>bh.test(Qs)),Jc=[tn?ri?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Ys?", Snippet":""} } from "svelte";`:`import type { Component${Ys?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${_o?", type ComponentConstructorOptions":""}${Ys?", type Snippet":""} } from "svelte";`,cn?`import type { ${cn} } from "svelte/elements";`:"",on,Bh({extends:Qt})].filter(Boolean).join(`
|
|
133
|
+
`),Yc=tn?ri?Fh({moduleName:Vt,generic:fn,propsRef:gn,exportsRef:is,bindings:rs,...yn?{eventsRef:Wn}:{}}):Mh({moduleName:Vt,propsRef:gn,exportsRef:is,bindings:rs}):Kh({moduleName:Vt,generic:fn,genericProps:gn,events:Ja({events:Xt}),slots:Dh({slots:qt}),accessors:ip({props:zt}),ownConstructor:_o}),Qc=[oi,Sn,gi,zn,pn,ss,yn,[jh({componentComment:Zt}),Yc].filter(Boolean).join(`
|
|
134
|
+
`)].map((Qs)=>Qs.trim()).filter(Boolean).join(`
|
|
135
|
+
|
|
136
|
+
`);return Ha([Jc,Qc].filter(Boolean).join(`
|
|
137
|
+
|
|
138
|
+
`))}var Xh=/[:=]/,op=/^HTML\w+Element$|^HTMLElementTagNameMap\[[\w$]+\]$/,ap=/^SVG\w+Element$/,Jh=/[\w$]+/g,Yh=/^CustomEvent<([\s\S]*)>$/,Qh=/^(Readonly)?Array</,Kr="COMPONENT_API.json",Is={none:0,patch:1,minor:2,major:3};function Kn(te,ne){return Is[ne]>Is[te]?ne:te}function Zh(te){return te.reduce((ne,Fe)=>Kn(ne,Fe.bump),"none")}function xp(te,ne){return Is[te]>=Is[ne]}function pp(te){let ne=Ei(In(te));if(b(ne)!==-1)return new Set([ne]);return new Set(r(ne,"|").map((Fe)=>Ei(Fe)).filter((Fe)=>Fe.length>0))}function vp(te,ne,Fe){let Vt=lp(te),Gt=lp(ne);if(Vt&&Gt)return td(Vt,Gt,Fe);let Kt=nd(hp(te),hp(ne),Fe);if(Kt!==void 0)return Kt;return id(te,ne,Fe)}function ed(te,ne){if(te===ne)return!1;if(ne==="HTMLElement")return op.test(te);if(ne==="SVGElement")return ap.test(te);if(ne==="Element")return te==="HTMLElement"||te==="SVGElement"||te==="MathMLElement"||op.test(te)||ap.test(te);return!1}function cp(te,ne){for(let Fe of ne)if(ed(te,Fe))return!0;return!1}function lp(te){let ne=b(te);if(ne===-1)return;let Fe=te.slice(0,ne).trim(),Vt=te.slice(ne+2).trim();if(!Fe.startsWith("(")||!Fe.endsWith(")"))return;let Gt=Fe.slice(1,-1).trim();return{params:Gt.length===0?[]:r(Gt,",").map((zt)=>zt.trim()),returnType:Vt}}function Ep(te){return(te.split(Xh,1)[0]??"").trimEnd().endsWith("?")}function up(te){if(te.startsWith("..."))return;let ne=T(te,":");if(ne===-1)return;let Fe=te.slice(ne+1).trim();return Ep(te)?`(${Fe}) | undefined`:Fe}function td(te,ne,Fe){if(ne.params.length<te.params.length)return"major";let Vt=!Fe&&ne.returnType==="void"?"none":Rn(te.returnType,ne.returnType,{readOnly:Fe});for(let Kt=0;Kt<te.params.length;Kt++){let zt=up(te.params[Kt]),Ut=up(ne.params[Kt]);if(zt===void 0||Ut===void 0){if(In(te.params[Kt])!==In(ne.params[Kt]))return"major";continue}Vt=Kn(Vt,Rn(zt,Ut,{readOnly:!Fe}))}let Gt=ne.params.slice(te.params.length);if(Gt.length>0)Vt=Kn(Vt,!Fe||Gt.every(Ep)?"minor":"major");return Vt}function hp(te){let ne=In(te),Fe=!1;if(ne.startsWith("readonly "))Fe=!0,ne=ne.slice(9);let Vt=Qh.exec(ne);if(Vt){let Kt=Vt[0].length-1;if(Fe||E(ne,Kt)!==ne.length-1)return;return{readonly:Vt[1]!==void 0,elements:[ne.slice(Kt+1,-1)],tuple:!1}}if(Di(ne)){let Kt=ne.slice(1,-1).trim(),zt=Kt===""?[]:r(Kt,",").map((Ut)=>Ut.trim());if(zt.some((Ut)=>Ut.startsWith("...")||T(Ut,":?")!==-1))return;return{readonly:Fe,elements:zt,tuple:!0}}if(!ne.endsWith("[]"))return;let Gt=ne.slice(0,-2);if(Gt===""||T(Gt," |&")!==-1)return;return{readonly:Fe,elements:[Gt],tuple:!1}}function nd(te,ne,Fe){if(!te||!ne||te.tuple!==ne.tuple)return;if(te.elements.length!==ne.elements.length)return"major";let Vt="none";if(te.readonly!==ne.readonly)Vt=ne.readonly===Fe?"major":"minor";for(let Gt=0;Gt<te.elements.length;Gt++)Vt=Kn(Vt,Rn(te.elements[Gt],ne.elements[Gt],{readOnly:Fe}));return Vt}function id(te,ne,Fe){let Vt=d(te,{withReadonly:!0}),Gt=d(ne,{withReadonly:!0});if(!Vt||!Gt)return;let{added:Kt,removed:zt,common:Ut}=ei(Vt,Gt,(Xt)=>Xt.name);if(zt.length>0)return"major";if(!Fe&&Kt.some(([,Xt])=>!Xt.optional))return"major";let qt=Kt.length>0?"minor":"none";for(let[,Xt,Jt]of Ut){if(Xt.optional!==Jt.optional)qt=Kn(qt,Jt.optional===Fe?"major":"minor");if(Fe&&Xt.readonly!==Jt.readonly)qt=Kn(qt,Jt.readonly?"major":"minor");qt=Kn(qt,Rn(Xt.type,Jt.type,{readOnly:Fe}))}return qt}function Rn(te,ne,{readOnly:Fe=!1}={}){if(te===ne)return"none";if(te===void 0||ne===void 0)return"major";if(In(te)===In(ne))return"none";let Vt=vp(Ei(te),Ei(ne),Fe);if(Vt!==void 0)return Vt;return sd(pp(te),pp(ne),Fe)}function sd(te,ne,Fe){let Vt=[...ne].filter((Xt)=>!te.has(Xt)&&!cp(Xt,te)),Gt=[...te].filter((Xt)=>!ne.has(Xt)&&!cp(Xt,ne));if(Vt.length===1&&Gt.length===1){let Xt=vp(Gt[0],Vt[0],Fe);if(Xt!==void 0)return Xt}let Kt=Vt.length>0,zt=Gt.length>0,[Ut,qt]=Fe?[Kt,zt]:[zt,Kt];if(Ut)return"major";return qt?"minor":"none"}function dp(te,ne){return te==="moduleExport"||Zn(ne)}function Hr(te){return te.bindable===!0||te.binding==="writable"}function ei(te,ne,Fe){let Vt=new Map(te.map((qt)=>[Fe(qt),qt])),Gt=new Map(ne.map((qt)=>[Fe(qt),qt])),Kt=[...Gt].filter(([qt])=>!Vt.has(qt)),zt=[...Vt.keys()].filter((qt)=>!Gt.has(qt)),Ut=[];for(let[qt,Xt]of Vt){let Jt=Gt.get(qt);if(Jt)Ut.push([qt,Xt,Jt])}return{added:Kt,removed:zt,common:Ut}}function Ls(te,ne,Fe,Vt){return(Gt,Kt,zt)=>te.push({component:ne,kind:Fe,name:Gt,bump:Kt,message:`${Vt} "${Gt}" ${zt}`})}function fp(te,ne,Fe,Vt){let Gt=[],Kt=Ls(Gt,te,ne,ne==="prop"?"prop":"export"),{added:zt,removed:Ut,common:qt}=ei(Fe,Vt,(Xt)=>Xt.name);for(let[Xt,Jt]of zt)Kt(Xt,Jt.isRequired?"major":"minor",`added${Jt.isRequired?" (required)":""}`);for(let Xt of Ut)Kt(Xt,"major","removed");for(let[Xt,Jt,Qt]of qt){let Zt=Zn(Qt);if(ne==="prop"&&Zn(Jt)!==Zt){Kt(Xt,"major",Zt?"became a read-only accessor":"stopped being a read-only accessor");continue}if(Jt.isRequired!==Qt.isRequired)Kt(Xt,Qt.isRequired?"major":"minor",`became ${Qt.isRequired?"required":"optional"}`);let en=dp(ne,Jt)&&dp(ne,Qt),tn=Rn(Jt.type,Qt.type,{readOnly:en});if(tn!=="none")Kt(Xt,tn,`type changed from \`${Jt.type??"unknown"}\` to \`${Qt.type??"unknown"}\``);let sn=Hr(Qt);if(Hr(Jt)!==sn)Kt(Xt,sn?"minor":"major",sn?"gained a writable binding":"lost its writable binding");if(Jt.value!==Qt.value&&tn==="none")Kt(Xt,"patch",`default changed from \`${Jt.value??"none"}\` to \`${Qt.value??"none"}\``);let nn=Qt.deprecated!==void 0;if(Jt.deprecated!==void 0!==nn)Kt(Xt,nn?"minor":"patch",nn?"marked as deprecated":"no longer deprecated");if(ne==="moduleExport"&&Jt.constant!==Qt.constant)Kt(Xt,"minor",Qt.constant?"became constant":"became mutable");if(Jt.reactive!==Qt.reactive)Kt(Xt,"minor",Qt.reactive?"became reactive":"stopped being reactive")}return Gt}function mp(te){if(r(te,"|").length>1)return;return Yh.exec(te)?.[1]}function rd(te,ne){let Fe=mp(te),Vt=mp(ne);if(Fe===void 0||Vt===void 0)return"major";return Rn(Fe,Vt,{readOnly:!0})}function od(te,ne,Fe){let Vt=[],Gt=Ls(Vt,te,"event","event"),{added:Kt,removed:zt,common:Ut}=ei(ne,Fe,(qt)=>qt.name);for(let[qt]of Kt)Gt(qt,"minor","added");for(let qt of zt)Gt(qt,"major","removed");for(let[qt,Xt,Jt]of Ut){if(Xt.type!==Jt.type){Gt(qt,"major",`changed from ${Xt.type} to ${Jt.type}`);continue}if(Xt.type==="forwarded"&&Jt.type==="forwarded"){let tn=Rs(Xt),sn=Rs(Jt),nn=tn===sn?"none":rd(tn,sn);if(nn!=="none")Gt(qt,nn,`type changed from \`${tn}\` to \`${sn}\``);continue}let Qt=Xt.type==="dispatched"?Xt.detail:void 0,Zt=Jt.type==="dispatched"?Jt.detail:void 0,en=Rn(Qt,Zt,{readOnly:!0});if(en!=="none")Gt(qt,en,`detail changed from \`${Qt??"unknown"}\` to \`${Zt??"unknown"}\``)}return Vt}function ad(te,ne,Fe){let Vt=[],Gt=Ls(Vt,te,"slot","slot"),{added:Kt,removed:zt,common:Ut}=ei(ne,Fe,(qt)=>qt.name??"default");for(let[qt]of Kt)Gt(qt,"minor","added");for(let qt of zt)Gt(qt,"major","removed");for(let[qt,Xt,Jt]of Ut){let Qt=Rn(Xt.slot_props,Jt.slot_props,{readOnly:!0});if(Qt!=="none")Gt(qt,Qt,`props changed from \`${Xt.slot_props??"none"}\` to \`${Jt.slot_props??"none"}\``)}return Vt}function gp(te){return te.type===void 0?"an object of properties":`\`${te.type}\``}function pd(te,ne=[],Fe=[]){let Vt=[],{added:Gt,removed:Kt,common:zt}=ei(ne,Fe,(Ut)=>Ut.key);for(let[Ut]of Gt)Vt.push({component:te,kind:"context",name:Ut,bump:"minor",message:`context "${Ut}" added`});for(let Ut of Kt)Vt.push({component:te,kind:"context",name:Ut,bump:"major",message:`context "${Ut}" removed`});for(let[Ut,qt,Xt]of zt){let Jt=(Zt,en,tn)=>Vt.push({component:te,kind:"context",name:Ut,...tn===void 0?{}:{property:tn},bump:Zt,message:`context "${Ut}" ${tn===void 0?"":`property "${tn}" `}${en}`});if(qt.typeName!==Xt.typeName)Jt("major",`type name changed from \`${qt.typeName}\` to \`${Xt.typeName}\``);if(Boolean(qt.hasUnresolvedSpread)!==Boolean(Xt.hasUnresolvedSpread))Jt("major",`${Xt.hasUnresolvedSpread?"gained":"lost"} an unresolved spread`);if(qt.type!==void 0||Xt.type!==void 0){if(qt.type!==Xt.type){let Zt=qt.type!==void 0&&Xt.type!==void 0?Rn(qt.type,Xt.type,{readOnly:!0}):"major";if(Zt!=="none")Jt(Zt,`type changed from ${gp(qt)} to ${gp(Xt)}`)}continue}let Qt=ei(qt.properties,Xt.properties,(Zt)=>Zt.name);for(let[Zt]of Qt.added)Jt("minor","added",Zt);for(let Zt of Qt.removed)Jt("major","removed",Zt);for(let[Zt,en,tn]of Qt.common){if(en.optional!==tn.optional)Jt(tn.optional?"major":"minor",`became ${tn.optional?"optional":"required"}`,Zt);let sn=Rn(en.type,tn.type,{readOnly:!0});if(sn!=="none")Jt(sn,`type changed from \`${en.type}\` to \`${tn.type}\``,Zt)}}return Vt}var cd=new Set(["description","source","componentCommentSource","tags"]);function Os(te){if(Array.isArray(te))return te.map(Os);if(i(te)){let ne={};for(let[Fe,Vt]of Object.entries(te)){if(cd.has(Fe))continue;ne[Fe]=Os(Vt)}return ne}return te}var ld=["generics","rest_props","extends"];function ud(te,ne,Fe){let Vt=[];for(let Gt of ld){let Kt=JSON.stringify(Os(ne[Gt])),zt=JSON.stringify(Os(Fe[Gt]));if(Kt===zt)continue;if(Gt==="rest_props"&&ne.rest_props===void 0){Vt.push({component:te,kind:"shape",name:Gt,bump:"minor",message:`"${Gt}" added`});continue}Vt.push({component:te,kind:"shape",name:Gt,bump:"major",message:`"${Gt}" changed (breaking)`})}return Vt}function qr(te){return te.name.split("<",1)[0].trim()}function yp(te){return new Set(te?.match(Jh))}function hd(te,ne){let Fe=new Map(ne.map((Jt)=>[Jt,{write:!1,read:!1}])),Vt=(Jt,Qt)=>{for(let Zt of yp(Jt)){let en=Fe.get(Zt);if(!en)continue;en.write||=Qt.write,en.read||=Qt.read}},Gt={write:!0,read:!0},Kt={write:!0,read:!1},zt={write:!1,read:!0},Ut=(Jt,Qt)=>Vt(Jt,Jt?.includes("=>")?Gt:Qt);for(let Jt of te){for(let Qt of Jt.props)Ut(Qt.type,Hr(Qt)?Gt:Kt);for(let Qt of Jt.moduleExports)Vt(Qt.type,Gt);for(let Qt of Jt.events)Ut("detail"in Qt?Qt.detail:void 0,zt);for(let Qt of Jt.slots)Ut(Qt.slot_props,zt);for(let Qt of Jt.contexts??[]){Vt(Qt.type,Gt);for(let Zt of Qt.properties)Vt(Zt.type,Gt)}}let qt=te.flatMap((Jt)=>Jt.typedefs.map((Qt)=>({name:qr(Qt),callback:Qt.type.includes("=>"),mentioned:[...yp(Qt.type)].filter((Zt)=>Fe.has(Zt))}))),Xt=!0;while(Xt){Xt=!1;for(let{name:Jt,callback:Qt,mentioned:Zt}of qt){let en=Fe.get(Jt);if(!en)continue;for(let tn of Zt){let sn=Fe.get(tn);if(!sn||tn===Jt)continue;let nn=sn.write||en.write||Qt&&en.read,pn=sn.read||en.read||Qt&&en.write;if(nn!==sn.write||pn!==sn.read)sn.write=nn,sn.read=pn,Xt=!0}}}for(let Jt of Fe.values())if(!Jt.write&&!Jt.read)Object.assign(Jt,Gt);return Fe}function dd(te,ne,Fe,Vt){let Gt=[],Kt=Ls(Gt,te,"typedef","typedef"),{added:zt,removed:Ut,common:qt}=ei(ne.typedefs,Fe.typedefs,qr);for(let[Jt]of zt)Kt(Jt,"minor","added");for(let Jt of Ut)Kt(Jt,"major","removed");let Xt=qt.filter(([,Jt,Qt])=>Jt.name!==Qt.name||In(Jt.type)!==In(Qt.type));if(Xt.length===0)return Gt;for(let[Jt,Qt,Zt]of Xt){if(Qt.name!==Zt.name){Kt(Jt,"major",`type parameters changed from \`${Qt.name}\` to \`${Zt.name}\``);continue}let en=In(Qt.type),tn=In(Zt.type),sn=Vt().get(Jt)??{write:!0,read:!0},nn="none";if(sn.write)nn=Kn(nn,Rn(en,tn));if(sn.read)nn=Kn(nn,Rn(en,tn,{readOnly:!0}));if(nn==="none")continue;Kt(Jt,nn,`type changed from \`${en}\` to \`${tn}\``)}return Gt}function fd(te,ne,Fe){let Vt=ne.moduleName;return[...fp(Vt,"prop",te.props,ne.props),...fp(Vt,"moduleExport",te.moduleExports,ne.moduleExports),...od(Vt,te.events,ne.events),...ad(Vt,te.slots,ne.slots),...pd(Vt,te.contexts,ne.contexts),...dd(Vt,te,ne,Fe),...ud(Vt,te,ne)]}function Ft(te,ne){let Fe=[],{added:Vt,removed:Gt,common:Kt}=ei(te.components,ne.components,(Xt)=>Xt.moduleName);for(let[Xt]of Vt)Fe.push({component:Xt,kind:"component",bump:"minor",message:`component "${Xt}" added`});for(let Xt of Gt)Fe.push({component:Xt,kind:"component",bump:"major",message:`component "${Xt}" removed`});let zt=[...te.components,...ne.components],Ut,qt=()=>(Ut??=hd(zt,[...new Set(zt.flatMap((Xt)=>Xt.typedefs.map(qr)))]),Ut);for(let[,Xt,Jt]of Kt)Fe.push(...fd(Xt,Jt,qt));return Fe}async function md(te){let ne;try{ne=await zh(Ur.resolve(te),"utf-8")}catch(Fe){if(Fe.code==="ENOENT")return null;throw Fe}try{return JSON.parse(ne)}catch{throw Error(`sveld: could not parse "${te}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Sp(te){if(typeof te.check==="string")return te.check;return te.jsonOptions?.outFile??Kr}function bp(te,ne){if(!te.json||te.stdout||te.jsonOptions?.outDir)return!1;return Ur.resolve(te.jsonOptions?.outFile??Kr)===Ur.resolve(ne)}async function Ie(te,ne,Fe={}){let Vt=await md(ne);if(Vt===null)return{snapshotExists:!1,snapshotFile:ne,changes:[],bump:"none"};if(Vt.schemaVersion!==ks)return{snapshotExists:!0,snapshotFile:ne,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Vt.schemaVersion} differs from ${ks}; regenerate the snapshot`}],bump:"none"};let Gt=y(te,{entryExports:Fe.entryExports}),Kt=Ft(Vt,Gt);return{snapshotExists:!0,snapshotFile:ne,changes:Kt,bump:Zh(Kt)}}var gd={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function xe(te){if(!te.snapshotExists){let Gt=te.snapshotFile===Kr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${te.snapshotFile}"\``;return`sveld --check: no snapshot found at "${te.snapshotFile}". Generate it with ${Gt} and commit it.`}if(te.changes.length===0)return`sveld --check: no API changes detected against "${te.snapshotFile}".`;let ne=te.changes.length,Fe=[`sveld --check: ${ne} API change${ne===1?"":"s"} detected against "${te.snapshotFile}".`,`Suggested semver bump: ${te.bump}.`],Vt=new Map;for(let Gt of te.changes){let Kt=Vt.get(Gt.component)??[];Kt.push(Gt),Vt.set(Gt.component,Kt)}for(let[Gt,Kt]of Vt){Fe.push("",` ${Gt}`);for(let zt of Kt){let Ut=zt.kind==="schema"?"schema":gd[zt.bump];Fe.push(` [${Ut}] ${zt.message}`)}}return Fe.join(`
|
|
139
|
+
`)}var Bt=1;function Ee(te){let ne={kind:"check-report",schemaVersion:Bt,...te};return Wi(ne)}import{existsSync as wp}from"node:fs";import{join as yd,resolve as xd}from"node:path";import{pathToFileURL as vd}from"node:url";var Ed=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Wt(te){return te}function Sd(te=process.cwd()){for(let ne of Ed){let Fe=yd(te,ne);if(wp(Fe))return Fe}return null}async function kp(te){let ne;try{ne=await import(`${vd(te).href}?t=${Date.now()}`)}catch(Vt){let Gt=Vt instanceof Error?Vt.message:String(Vt);throw Error(`sveld: failed to load config file "${te}".
|
|
140
|
+
${Gt}`,{cause:Vt})}let Fe=ne.default;if(!i(Fe)||Array.isArray(Fe))throw Error(`sveld: config file "${te}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Fe}async function bd(te=process.cwd()){let ne=Sd(te);return ne===null?{}:kp(ne)}async function G(te,ne,Fe){if(typeof te==="string"){let Vt=xd(ne,te);if(!wp(Vt))throw Error(`sveld: config file "${te}" does not exist.`);return kp(Vt)}return te??Fe?bd(ne):{}}function O(...te){let ne={};for(let Fe of te){if(!Fe)continue;for(let[Vt,Gt]of Object.entries(Fe)){let Kt=ne[Vt];ne[Vt]=i(Kt)&&!Array.isArray(Kt)&&i(Gt)&&!Array.isArray(Gt)?{...Kt,...Gt}:Gt}}return ne}var Cp=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Cd={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function Tp(te,ne,Fe){let Vt=te===null?ne:`${te}.${ne}`,Gt=L(ne,Fe),Kt=Gt===void 0?void 0:te===null?Gt:`${te}.${Gt}`;console.warn(`sveld: unknown option "${Vt}".${Kt?` Did you mean "${Kt}"?`:""}`)}function W(te){for(let ne of Object.keys(te))if(!Cp.includes(ne))Tp(null,ne,Cp);for(let[ne,Fe]of Object.entries(Cd)){let Vt=te[ne];if(!i(Vt))continue;for(let Gt of Object.keys(Vt))if(!Fe.includes(Gt))Tp(ne,Gt,Fe)}}import{dirname as Kc}from"node:path";import{lstatSync as lm}from"node:fs";import{readFile as um}from"node:fs/promises";import{resolve as yc}from"node:path";import{dirname as Td}from"node:path";var wd=[...ki,".svelte"];function kd(te){let ne=te.trim();if(ne.length<2)return;let Fe=ne[0],Vt=ne[ne.length-1];if((Fe==='"'||Fe==="'"||Fe==="`")&&Fe===Vt)return ne.slice(1,-1);return}function Ap(te){let ne=[],Fe=te.moduleExports.filter((Gt)=>Gt.kind==="re-export");if(Fe.length===0)return ne;let Vt=new Set([_i(te.moduleName),zi(te.moduleName)]);for(let Gt of Fe){if(!Vt.has(Gt.name))continue;ne.push(a({component:te.filePath,kind:"module-export-conflict",name:Gt.name,message:`Re-export "${Gt.name}" has the same name as the generated "${Gt.name}" type; the .d.ts won't type-check if "${Gt.reExport?.from}" exports a type by that name.`,source:Gt.source}))}return ne}function Pp(te,ne,Fe){let Vt=new Map(Array.from(te.values()).map((Gt)=>[ne(Gt.filePath),Gt]));return(Gt)=>{let Kt=Gt.extends;if(!Kt)return[];let zt=kd(Kt.import);if(zt===void 0||!zt.startsWith(".")&&!zt.startsWith("/"))return[];let Ut=ne(Gt.filePath),qt=Fe.resolve(zt,Td(Ut),wd);if(qt===null)return[a({component:Gt.filePath,kind:"extend-props-target-missing",name:Kt.interface,message:`@extends/@extendProps target "${zt}" was not found on disk.`})];let Xt=Vt.get(qt);if(!Xt)return[];let Jt=_i(Xt.moduleName);if(jr(Kt.interface)!==Jt)return[a({component:Gt.filePath,kind:"extend-props-target-missing",name:Kt.interface,message:`@extends/@extendProps names "${Kt.interface}", but "${zt}" generates "${Jt}".`})];let Qt=[];for(let Zt of Gt.props){let en=Xt.props.find((tn)=>tn.name===Zt.name);if(en&&en.type!==Zt.type){let tn=a({component:Gt.filePath,kind:"extend-props-override",name:Zt.name,message:`Own prop "${Zt.name}" (${Zt.type}) overrides "${Jt}"'s "${Zt.name}" (${en.type}).`,source:Zt.source}),nn=$o(Gt)?.[Zt.name]?.some((pn)=>pn===""||pn===tn.code);Qt.push(nn?{...tn,ignored:!0}:tn)}}return Qt}}import{lstatSync as qd,readFileSync as zd,realpathSync as Xd,statSync as Jd}from"node:fs";import{dirname as Yd,isAbsolute as Qd,join as Hp,parse as Zd,relative as so,resolve as Ji}from"node:path";function ee(te){return te}function Fn(te){if(te==="")return te;return te==="."||te===".."||te.startsWith("./")||te.startsWith("../")?te:`./${te}`}import{readFileSync as Wp}from"node:fs";import{dirname as no,join as Hd,relative as Vp,resolve as Gp}from"node:path";import{readFileSync as Ld,statSync as Md}from"node:fs";import{basename as eo,dirname as Ms,isAbsolute as Fd,join as Bd,resolve as jd}from"node:path";import{existsSync as Np,readdirSync as Ad}from"node:fs";import{dirname as _p,join as Dp,resolve as Pd}from"node:path";function H(te,ne){for(let Fe=Pd(te);;Fe=_p(Fe)){for(let Vt of ne){let Gt=Dp(Fe,Vt);if(Np(Gt))return Gt}if(_p(Fe)===Fe)return null}}function $p(te){return te.normalize("NFC").toLowerCase()}class zr{listings=new Map;clear(){this.listings.clear()}entries(te){return this.read(te)?.entries??null}entry(te,ne){let Fe=this.read(te);if(Fe===null)return;if(Fe.byName===void 0){Fe.byName=new Map;for(let Vt of Fe.entries)Fe.byName.set(Vt.name,Vt)}return Fe.byName.get(ne)}has(te,ne){let Fe=this.read(te);if(Fe===null)return!1;if(Fe.names.has(ne))return!0;if(Fe.folded===void 0){Fe.folded=new Map;for(let Gt of Fe.names)Fe.folded.set($p(Gt),Gt)}let Vt=Fe.folded.get($p(ne));return Vt!==void 0&&Vt!==ne&&Np(Dp(te,ne))}read(te){let ne=this.listings.get(te);if(ne!==void 0)return ne;try{let Fe=Ad(te,{withFileTypes:!0}),Vt=new Set;for(let Gt of Fe)Vt.add(Gt.name);ne={entries:Fe,names:Vt}}catch{ne=null}return this.listings.set(te,ne),ne}}var Xr=!1;function U(te){Xr=te}function qn(te){if(!Xr)console.error(te)}function Rp(te){if(!Xr)console.error(te)}function Se(te){if(te instanceof e)return te.start?`${te.reason} (${te.start.line}:${te.start.column})`:te.reason;return te instanceof Error?te.message:String(te)}var Xi=null,Jr=null;function ti(){if(Xi)return Promise.resolve(Xi);if(!Jr)Jr=import("./chunk-j58p3sv3.js").then((te)=>(Xi=te,te));return Jr}function Bn(){if(!Xi)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Xi}import{existsSync as Yr,readFileSync as _d}from"node:fs";import{dirname as Fp,isAbsolute as Bp,relative as $d,resolve as Qr}from"node:path";function Ip(te){if(!i(te))return{};let ne={};if(typeof te.svelte==="string")ne.svelte=te.svelte;if(typeof te.name==="string")ne.name=te.name;if(typeof te.description==="string")ne.description=te.description;return ne}function Op(te){if(!i(te))return{};let ne={};if(typeof te.extends==="string")ne.extends=te.extends;if(i(te.compilerOptions)){let Fe={};if(typeof te.compilerOptions.baseUrl==="string")Fe.baseUrl=te.compilerOptions.baseUrl;if(i(te.compilerOptions.paths)){let Vt={};for(let[Gt,Kt]of Object.entries(te.compilerOptions.paths))if(Array.isArray(Kt)&&Kt.every((zt)=>typeof zt==="string"))Vt[Gt]=Kt;if(Object.keys(Vt).length>0)Fe.paths=Vt}if(Object.keys(Fe).length>0)ne.compilerOptions=Fe}return ne}var Nd=["tsconfig.json","jsconfig.json"],Lp=new Map,Dd=/\/\*[\s\S]*?\*\/|\/\/.*/g,Rd=[".svelte",...ki];class J extends Error{specifier;fromFile;searched;constructor(te,ne,Fe){super(`cannot resolve "${te}" from ${ne||"."} (${Fe})`);this.name="UnresolvedModuleError",this.specifier=te,this.fromFile=ne,this.searched=Fe}}function Id(te){if(Yr(te))return!0;return Rd.some((ne)=>Yr(te+ne))}function Mp(te){let ne=te.indexOf("*");return ne===-1?te.length:ne}function jp(te,ne){if(ne.has(te))return ne.get(te)??null;try{let Fe=_d(te,"utf-8"),Vt;try{Vt=JSON.parse(Fe)}catch{let Kt=Fe.replace(Dd,"");Vt=JSON.parse(Kt)}let Gt=Op(Vt);if(Gt.extends){let Kt=Bp(Gt.extends)?Gt.extends:Qr(Fp(te),Gt.extends),zt=Kt.endsWith(".json")?Kt:`${Kt}.json`;if(Yr(zt)){let Ut=jp(zt,ne);if(Ut)Gt.compilerOptions={...Ut.compilerOptions,...Gt.compilerOptions,paths:{...Ut.compilerOptions?.paths,...Gt.compilerOptions?.paths}}}}return ne.set(te,Gt),Gt}catch{return ne.set(te,null),null}}function Od(te){let ne=Lp.get(te);if(!ne){let Fe=te.split("*").map(R).join("(.*)");ne=new RegExp(`^${Fe}$`),Lp.set(te,ne)}return ne}class Zr{configs=new Map;lookup(te,ne){if(te.startsWith(".")||Bp(te))return{resolved:te,unresolved:!1,searched:""};let Fe=H(ne,Nd),Vt=Fe?jp(Fe,this.configs)?.compilerOptions:void 0,Gt=Vt?.paths;if(!Fe||!Vt||!Gt)return{resolved:te,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Kt=Qr(Fp(Fe),Vt.baseUrl??"."),zt=Object.entries(Gt).sort(([Ut],[qt])=>Mp(qt)-Mp(Ut));for(let[Ut,qt]of zt){let Xt=te.match(Od(Ut));if(!Xt)continue;let Jt;for(let Qt of qt){let Zt=Qt;for(let tn=1;tn<Xt.length;tn++)Zt=Zt.replace("*",Xt[tn]);let en=Qr(Kt,Zt);if(Jt??=en,Id(en))return{resolved:en,unresolved:!1,searched:Fe}}return{resolved:Jt??te,unresolved:!1,searched:Fe}}return{resolved:te,unresolved:!0,searched:`tsconfig paths (${Fe})`}}absolute(te,ne){return this.lookup(te,ne).resolved}relative(te,ne){let Fe=this.absolute(te,ne);if(Fe===te)return te;return Fn(n($d(ne,Fe)))}}var Vd=/\.[mc]?jsx?$/,Gd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function Wd(te){return te==="."||te===".."||te.startsWith("./")||te.startsWith("../")||Fd(te)}class ni{aliases=new Zr;listings=new zr;modules=new Map;programs=new Map;listDirectory(te){return this.listings.entries(te)}exists(te){return this.listings.has(Ms(te),eo(te))}resolve(te,ne,Fe=ki){let Vt=this.aliases.absolute(te,ne);if(Vt===te&&!Wd(te))return null;let Gt=jd(ne,Vt),Kt=Ms(Gt),zt=eo(Gt),Ut=this.listings.has(Kt,zt),qt;if(Ut){let Xt=this.listings.entry(Kt,zt);if(qt=Xt&&!Xt.isSymbolicLink()?Xt:Md(Gt,{throwIfNoEntry:!1}),qt?.isFile())return Gt}for(let Xt of Fe)if(this.listings.has(Kt,zt+Xt))return Gt+Xt;if(!Ut)return this.typeScriptCounterpart(Gt)??null;if(qt?.isDirectory()){for(let Xt of Fe)if(this.listings.has(Gt,`index${Xt}`))return Bd(Gt,`index${Xt}`)}return null}parse(te){let ne=this.modules.get(te);if(ne===void 0)ne=Ud(te),this.modules.set(te,ne);return ne}parseJavaScript(te,ne){let Fe=this.programs.get(te);if(Fe?.source===ne)return Fe.ast;let Vt;try{Vt=I(ne)}catch(Gt){throw Error(Se(Gt),{cause:Gt})}return this.programs.set(te,{source:ne,ast:Vt}),Vt}invalidate(...te){this.listings.clear();for(let ne of te)this.modules.delete(ne),this.programs.delete(ne)}typeScriptCounterpart(te){let ne=Vd.exec(te)?.[0];if(ne===void 0)return;let Fe=te.slice(0,-ne.length),Vt=Ms(Fe),Gt=eo(Fe);for(let Kt of Gd[ne]??[])if(this.listings.has(Vt,Gt+Kt))return Fe+Kt;return}}function Ud(te){let ne;try{ne=Ld(te,"utf-8")}catch{return null}try{let Fe=te.endsWith(".svelte")?Bn().parseSvelteScripts(ne).module?.content.body??[]:Bn().parseModule(ne,{typescript:!0}).body;return{source:{text:ne,filePath:te,dir:Ms(te)},body:Fe}}catch(Fe){return Rp(`Warning: sveld couldn't parse ${te} to read its exports (${Se(Fe)}); skipping it.`),null}}function to(te){return te.type==="Identifier"?te.name:te.value}function Kd(te,ne,Fe,Vt){let Gt=te.resolve(ne,Fe);if(!Gt)return null;let Kt=no(Gt);if(Vt.has(Gt))return{dir:Kt,exports:{}};Vt.add(Gt);try{return{dir:Kt,exports:io(te,Wp(Gt,"utf-8"),Kt,Vt,Gt)}}catch{return{dir:Kt,exports:{}}}finally{Vt.delete(Gt)}}function Up(te,ne,Fe=new ni,Vt=new Set,Gt=ne){return io(Fe,te,ne,Vt,Gt)}function io(te,ne,Fe,Vt,Gt){let Kt=te.parseJavaScript(Gt,ne),zt={};for(let Ut of Kt.body)if(Ut.type==="ExportDefaultDeclaration"){if(Ut.declaration.type!=="Identifier")continue;let qt=Ut.declaration.name;if(qt in zt)zt[qt].default=!0;else zt[qt]={source:Fn(""),default:!0}}else if(Ut.type==="ExportAllDeclaration"){let qt=Ut.source.value,Xt=te.resolve(qt,Fe);if(!Xt){let en=te.aliases.lookup(qt,Fe);throw new J(qt,Gt,en.unresolved?en.searched:"no matching file or index found")}if(Vt.has(Xt))continue;Vt.add(Xt);let Jt=Wp(Xt,"utf-8"),Qt=io(te,Jt,no(Xt),Vt,Xt);Vt.delete(Xt);let Zt=Object.entries(Qt);if(Zt.length===0&&!Ln.test(qt)){let en=Fn(n(qt));zt[`*:${qt}`]={source:en,default:!1,star:!0}}for(let[en,tn]of Zt){let sn=Fn(n(tn.source.startsWith(".")?`./${Vp(Fe,Gp(no(Xt),tn.source))}`:`./${Hd(qt,tn.source)}`));zt[en]={...tn,source:sn}}}else if(Ut.type==="ExportNamedDeclaration"){let qt=Ut.source?.value,Xt=qt!==void 0&&Ln.test(qt);if(Xt){let Zt=te.aliases.lookup(qt,Fe);if(Zt.unresolved)throw new J(qt,Gt,Zt.searched)}let Qt=qt!==void 0&&!Xt?Kd(te,qt,Fe,Vt):void 0;if(Qt===null){console.warn(`sveld: could not resolve re-exported module "${qt}" from barrel "${Fe||"."}"; skipping.`);continue}for(let Zt of Ut.specifiers){let en=to(Zt.exported),tn=to(Zt.local),sn=en||tn,nn=Qt?.exports[tn],pn=nn?Fn(n(`./${Vp(Fe,Gp(Qt.dir,nn.source))}`)):Fn(te.aliases.relative(qt??"",Fe)),cn=nn?nn.default:tn==="default",fn=nn?nn.imported??tn:tn;if(sn in zt){if(zt[sn].mixed=!0,!zt[sn].source)zt[sn].source=pn}else zt[sn]={source:pn,default:cn,...!cn&&qt!==void 0&&fn!==sn?{imported:fn}:{}}}}else if(Ut.type==="ImportDeclaration"){let qt=Ut.specifiers[0];if(!qt)continue;let Xt=qt.local.name,Jt=Fn(te.aliases.relative(Ut.source.value,Fe)),Qt=qt.type==="ImportSpecifier"?to(qt.imported):Xt;if(Xt in zt){if(!zt[Xt].source)zt[Xt].source=Jt}else zt[Xt]={source:Jt,default:Xt==="default",...Qt===Xt?{}:{imported:Qt}}}return zt}var ef=/-/g,tf=/[^A-Za-z0-9_$]/g,nf=/^[0-9]/;function sf(te,ne){let Fe=te.replace(tf,""),Vt=nf.test(Fe)?`_${Fe}`:Fe;if(Vt!==te&&!ne?.has(te))ne?.add(te),console.warn(`Warning: "${te}" is not a valid identifier; using "${Vt}" instead.`);return Vt}function Kp(te,ne){return sf(Zd(te).name.replace(ef,""),ne)}function qp(te,ne,Fe=[],Vt=new Set,Gt){let Kt;try{Kt=Gt??Xd(ne)}catch{return Fe}if(Vt.has(Kt))return Fe;Vt.add(Kt);let zt=te.listDirectory(ne);if(zt===null)return Fe;for(let Ut of zt){if(Ut.name.startsWith("."))continue;let qt=Hp(ne,Ut.name),Xt=Ut.isSymbolicLink(),Jt=Xt?Jd(qt,{throwIfNoEntry:!1}):Ut;if(!Jt)continue;if(Jt.isDirectory())qp(te,qt,Fe,Vt,Xt?void 0:Hp(Kt,Ut.name));else if(Jt.isFile()&&Ut.name.endsWith(".svelte"))Fe.push(qt)}return Fe}function rf(te,ne){return qp(te,ne).map((Fe)=>({moduleName:Kp(Fe),source:Fn(n(`./${so(ne,Fe)}`))})).sort((Fe,Vt)=>u(Fe.source,Vt.source))}function of(te){return!Ai(te)}function af(te,ne){let Fe=te.endsWith("/")?te:`${te}/`;return ne.startsWith(Fe)}function Fs(te,ne){return{seenPaths:new Set(te.map(([,Fe])=>ne(Fe.source))),seenModuleNamePaths:new Map(te.map(([Fe,Vt])=>[Fe,ne(Vt.source)])),warnedModuleNames:new Set}}function ro(te,ne,Fe,Vt,Gt,Kt){for(let{moduleName:zt,source:Ut}of rf(te,ne)){let qt=Gt(Ut),Xt=Fe[zt];if(Xt&&of(Xt.source)&&af(Xt.source,Ut)){Kt.seenPaths.delete(Gt(Xt.source)),Xt.source=Ut,Kt.seenPaths.add(qt),Kt.seenModuleNamePaths.set(zt,qt);continue}if(Kt.seenPaths.has(qt))continue;Kt.seenPaths.add(qt);let Jt=Kt.seenModuleNamePaths.get(zt);if(Jt===void 0)Kt.seenModuleNamePaths.set(zt,qt);else if(Jt!==qt&&!Kt.warnedModuleNames.has(zt))Kt.warnedModuleNames.add(zt),console.warn(`Warning: multiple components named "${zt}" found (${n(so(ne,Jt))} and ${n(so(ne,qt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Vt.push([zt,{source:Ut,default:!1}])}}function oo(te,ne,Fe,Vt){let Gt=qd(te).isFile(),Kt=Gt?Yd(te):te,zt=Ji(Kt),Ut=new Map,qt=(Qt)=>{let Zt=Ut.get(Qt);if(Zt===void 0)Zt=Qd(Qt)?Ji(Qt):Ji(zt,Qt),Ut.set(Qt,Zt);return Zt},Xt={};if(Gt){let Qt=zd(te,"utf-8");try{Xt=Up(Qt,zt,Vt,new Set([Ji(te)]),Ji(te))}catch(Zt){if(!Fe)throw Zt;let en=Zt instanceof Error?Zt.message:String(Zt);console.warn(`Warning: Failed to parse component exports from ${te}: ${en}`)}}let Jt=Object.entries(Xt);if(ne){let Qt=Fs(Jt,qt);if(ro(Vt,zt,Xt,Jt,qt,Qt),!Gt)Xt=Object.fromEntries(Jt.map(([Zt,en])=>[Zt,{...en,default:!0}]))}return{exports:Xt,allComponentEntries:Jt,rootDir:zt,resolveComponentFilePath:qt}}function zp(te,ne,Fe,Vt){if(Fe!==1||te!=="default")return te;return Kp(ne,Vt)}import{dirname as Gf}from"node:path";import{resolve as pf}from"node:path";var cf=/\r?\n/,lf=/^\s*\*+/;function Bs(te){return{graph:te,cache:new Map,computing:new Set}}function Cn(te){return te?.type==="Identifier"?te.name:void 0}function uf(te){let ne=te.trimEnd();for(;;){let Fe=ne.lastIndexOf(`
|
|
141
|
+
`)+1;if(ne.slice(Fe).trimStart().startsWith("//")){ne=ne.slice(0,Fe).trimEnd();continue}let Vt=ne.endsWith("*/")?ne.lastIndexOf("/*",ne.length-3):-1;if(Vt!==-1&&ne[Vt+2]!=="*"){ne=ne.slice(0,Vt).trimEnd();continue}return ne}}function hf(te,ne){let Fe=uf(te.slice(0,ne));if(!Fe.endsWith("*/"))return;let Vt=Fe.length-2,Gt=Fe.lastIndexOf("/**",Vt);if(Gt===-1)return;return Fe.slice(Gt,Vt+2)}function df(te){let ne=[];for(let Fe of te.slice(3,-2).split(cf)){let Vt=Fe.replace(lf,"").trim();if(Vt.startsWith("@"))break;if(Vt)ne.push(Vt)}return ne.join(" ")||void 0}function di(te,ne){if(!ne)return;return te.text.slice(ne.start,ne.end)}function ff(te,ne){return"typeAnnotation"in ne?di(te,ne.typeAnnotation?.typeAnnotation):void 0}function Jp(te,ne){return di(te,ne.returnType?.typeAnnotation)}function ao(te,ne,Fe){return`(${ne.params.map((Gt)=>di(te,Gt)??"").join(", ")}) => ${Jp(te,ne)??Fe??"any"}`}function Yp(te){if(te.type==="Literal"){let ne=te.value;if(typeof ne==="string")return"string";if(typeof ne==="number")return"number";if(typeof ne==="boolean")return"boolean"}if(te.type==="TemplateLiteral")return"string";if(te.type==="UnaryExpression"&&(te.operator==="-"||te.operator==="+"))return te.argument.type==="Literal"&&typeof te.argument.value==="number"?"number":void 0;if(te.type==="CallExpression"&&te.callee.type==="Identifier")return mf[te.callee.name];return}var mf={String:"string",Number:"number",Boolean:"boolean"};function Qp(te){if(te.type==="Literal"){let ne=te.value;return typeof ne==="string"||typeof ne==="number"||typeof ne==="boolean"?ne:void 0}if(te.type==="UnaryExpression"&&te.operator==="-"){let ne=te.argument;return ne.type==="Literal"&&typeof ne.value==="number"?-ne.value:void 0}return te.type==="TemplateLiteral"?k(te)??void 0:void 0}function gf(te,ne){let Fe=di(te,ne),Vt=Qp(ne);if(Fe===void 0||Vt===void 0)return;return{raw:Fe,value:Vt,type:typeof Vt}}function yf(te,ne){if(te.type!=="CallExpression"&&te.type!=="NewExpression")return;let Fe=te.callee;if(!(Cn(Fe)==="Symbol"||Fe.type==="MemberExpression"&&!Fe.computed&&Cn(Fe.object)==="Symbol"&&Cn(Fe.property)==="for"))return;let[Gt]=te.arguments;return(Gt?.type==="Literal"&&typeof Gt.value!=="string"?null:k(Gt))||ne}var xf=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),vf=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Ef=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Sf(te,ne){let Fe=ne?Bn().extractJsDocType(ne):void 0,Vt=te?{type:te,source:"typescript"}:Fe?{type:Fe,source:"jsdoc"}:void 0;if(!Vt||Vt.type.includes("`"))return;return(Vt.type.replace(vf,'""').match(Ef)??[]).every((Kt)=>xf.has(Kt))?Vt:void 0}function Zp(te){if(te.async||te.generator||te.type==="TSDeclareFunction")return;let ne=te.body,Fe=ne.type==="BlockStatement"?Z(ne):[ne];if(Fe.length===0)return;let Vt;for(let Gt of Fe){if(!Gt)return;let Kt=Yp(Gt);if(!Kt)return;if(Vt===void 0)Vt=Kt;else if(Vt!==Kt)return}return Vt}function bf(te){if(te.type==="TemplateLiteral")return;let ne=Qp(te);return typeof ne==="boolean"?void 0:ne}function Cf(te){let ne=te.members;if(ne.length===0)return;let Fe=[],Vt=0;for(let Gt of ne){if(!Gt.initializer){Fe.push(String(Vt)),Vt+=1;continue}let Kt=bf(Gt.initializer);if(Kt===void 0)return;Fe.push(typeof Kt==="string"?JSON.stringify(Kt):String(Kt)),Vt=typeof Kt==="number"?Kt+1:Vt}return Fe.join(" | ")}function po(te,ne,Fe,Vt){let Gt=hf(te.text,Fe),Kt=Gt?df(Gt):void 0,zt=Gt?Bn().extractJsDocReturnType(Gt):void 0,{deprecated:Ut,tags:qt,internal:Xt}=Gt?Bn().extractJsDocDeprecatedAndTags(Gt):{deprecated:void 0,tags:void 0,internal:!1},Jt={description:Kt,deprecated:Ut,tags:qt,...Xt?{internal:!0}:{},declFile:te.filePath},Qt=(en,tn,sn=!1)=>en?[{name:en,...tn,...Jt,isTypeOnly:sn}]:[],Zt=(en,tn)=>Jp(te,en)??zt??re(tn)??Zp(en);if(ne.type==="VariableDeclaration"){let en=ne.kind==="let"||ne.kind==="var"?ne.kind:"const";return ne.declarations.flatMap((tn)=>{let sn=tn.id,nn=Cn(sn);if(!nn)return[];let pn=ff(te,sn),cn=pn,fn,gn,yn,Wn,ri,oi,Sn=tn.init;if(Sn)if(Sn.type==="ArrowFunctionExpression"||Sn.type==="FunctionExpression"){if(oi=Sn,gn=Zt(Sn,cn),!cn)cn=ao(te,Sn,gn)}else{if(fn=di(te,Sn),!cn)cn=Yp(Sn);let zn=w(Sn);if(yn=k(zn)??yf(zn,nn),en==="const")Wn=gf(te,zn),ri=Sf(pn,Gt)}return Qt(nn,{kind:en,type:cn,value:fn,returnType:gn,literalValue:yn,primitiveLiteral:Wn,declaredType:ri,functionNode:oi})})}if(ne.type==="FunctionDeclaration"||ne.type==="TSDeclareFunction"){let en=Zt(ne);return Qt(Cn(ne.id)??Vt,{kind:"function",type:ao(te,ne,en),returnType:en,...ne.type==="FunctionDeclaration"?{functionNode:ne}:{}})}if(ne.type==="ClassDeclaration"){let en=Cn(ne.id);return Qt(en??Vt,{kind:"class",...en?{type:en}:{}})}if(ne.type==="TSTypeAliasDeclaration")return Qt(Cn(ne.id),{kind:"type",type:di(te,ne.typeAnnotation)},!0);if(ne.type==="TSInterfaceDeclaration")return Qt(Cn(ne.id),{kind:"interface",type:di(te,ne.body)},!0);if(ne.type==="TSEnumDeclaration"){let en=Cn(ne.id);return Qt(en,{kind:"enum",type:Cf(ne)??en})}return[]}function Tf(te,ne,Fe){let Vt=ne.declaration;if(Vt.type==="FunctionDeclaration"||Vt.type==="TSDeclareFunction"||Vt.type==="ClassDeclaration"){let[zt]=po(te,Vt,ne.start,"default");return zt?{...zt,name:"default"}:void 0}if(Vt.type==="FunctionExpression"||Vt.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:ao(te,Vt,Zp(Vt)),functionNode:Vt,declFile:te.filePath,isTypeOnly:!1};let Gt=Cn(Vt),Kt=Gt?Fe(Gt):null;return Kt?{...Kt,name:"default"}:void 0}function wf(te,ne){for(let Fe of te){if(Fe.type!=="ImportDeclaration")continue;let Vt=Fe.source.value;for(let Gt of Fe.specifiers){if(Gt.local.name!==ne)continue;let Kt=Fe.importKind==="type"||Gt.type==="ImportSpecifier"&&Gt.importKind==="type";if(Gt.type==="ImportDefaultSpecifier")return{specifier:Vt,importedName:"default",isTypeOnly:Kt};if(Gt.type==="ImportNamespaceSpecifier")return{specifier:Vt,importedName:"*",isTypeOnly:Kt};if(Gt.type==="ImportSpecifier"){let zt=Cn(Gt.imported)??ne;return{specifier:Vt,importedName:zt,isTypeOnly:Kt}}}}return null}function Xp(te,ne,Fe){return{name:te,kind:"const",declFile:ne,namespaceFile:ne,isTypeOnly:Fe}}function js(te,ne){let Fe=ne.cache.get(te);if(Fe)return Fe;if(ne.computing.has(te))return[];ne.computing.add(te);let Vt=ne.graph.parse(te);if(!Vt)return ne.computing.delete(te),ne.cache.set(te,[]),[];let{source:Gt,body:Kt}=Vt,zt=[],Ut=new Map;for(let Zt of Kt){let en=Zt.type==="ExportNamedDeclaration"?Zt.declaration:Zt;if(!en)continue;for(let tn of po(Gt,en,en.start))Ut.set(tn.name,tn)}let qt=(Zt,en)=>({name:Zt,kind:"const",declFile:pf(Gt.dir,en),isTypeOnly:!1}),Xt=(Zt)=>{let en=Ut.get(Zt);if(en)return en;let tn=wf(Kt,Zt);if(!tn)return null;if(tn.specifier.endsWith(".svelte"))return qt(Zt,tn.specifier);let sn=ne.graph.resolve(tn.specifier,Gt.dir);if(!sn)return null;if(tn.importedName==="*")return Xp(Zt,sn,tn.isTypeOnly);return fi(sn,tn.importedName,ne)??null},Jt=new Map;for(let Zt of Kt){if(Zt.type==="ExportAllDeclaration"){let nn=Zt.source.value;if(nn.endsWith(".svelte"))continue;let pn=ne.graph.resolve(nn,Gt.dir);if(!pn)continue;let cn=Zt.exportKind==="type",fn=Cn(Zt.exported);if(fn){zt.push(Xp(fn,pn,cn));continue}for(let gn of js(pn,ne)){let yn=Jt.get(gn.name)??[];yn.push(cn?{...gn,isTypeOnly:!0}:gn),Jt.set(gn.name,yn)}continue}if(Zt.type==="ExportDefaultDeclaration"){let nn=Tf(Gt,Zt,Xt);if(nn)zt.push(nn);continue}if(Zt.type!=="ExportNamedDeclaration")continue;let en=Zt.declaration;if(en){zt.push(...po(Gt,en,Zt.start));continue}let tn=Zt.source?.value;if(tn?.endsWith(".svelte")){for(let nn of Zt.specifiers){let pn=Cn(nn.exported);if(pn)zt.push(qt(pn,tn))}continue}let sn=Zt.exportKind==="type";for(let nn of Zt.specifiers){let pn=Cn(nn.exported),cn=Cn(nn.local);if(!pn||!cn)continue;let fn=sn||nn.exportKind==="type",gn=null;if(tn){let yn=ne.graph.resolve(tn,Gt.dir);if(yn)gn=fi(yn,cn,ne)??null}else gn=Xt(cn);if(gn)zt.push({...gn,name:pn,isTypeOnly:gn.isTypeOnly||fn});else if(cn!=="default")zt.push({name:pn,kind:fn?"type":"const",declFile:te,isTypeOnly:fn})}}let Qt=new Set(zt.map((Zt)=>Zt.name));for(let[Zt,en]of Jt){if(Qt.has(Zt)||Zt==="default")continue;if(en.every((tn)=>tn.declFile===en[0].declFile))zt.push(...en);else ne.onAmbiguousStarExport?.(te,Zt,en)}return ne.computing.delete(te),ne.cache.set(te,zt),zt}function fi(te,ne,Fe){return js(te,Fe).findLast((Vt)=>Vt.name===ne)}function $i(te,{importedName:ne,members:Fe=[]},Vt){let Gt=fi(te,ne,Vt);for(let Kt of Fe){if(Gt?.namespaceFile===void 0)return;Gt=fi(Gt.namespaceFile,Kt,Vt)}return Gt}function ii(te,ne,Fe){if(te[ne]===void 0)delete te[ne];te[ne]=Fe}function Vs(te,ne){return(ne.location==="props"?te.props:te.moduleExports).find((Vt)=>Vt.name===ne.propName)}function Gs(te,ne){if(ne.location!=="props")return;te.diagnostics=(te.diagnostics??[]).filter((Fe)=>!(Fe.kind==="prop-unknown-type"&&Fe.name===ne.propName))}var kf=/\.[^./\\]+$/;function Af(te,ne){if(te.endsWith(".d.ts"))return null;let Fe=te.replace(kf,".d.ts");return ne.exists(Fe)?Fe:null}function Pf(te,ne,Fe){return ne.map((Vt)=>{if(!Vt.importSource||!Vt.importedName)return{candidate:Vt};let Gt=Fe.graph.resolve(Vt.importSource,te);if(!Gt)return{candidate:Vt,failureReason:"module-not-found"};let Kt=fi(Gt,Vt.importedName,Fe);if(!Kt)return{candidate:Vt,failureReason:"export-not-found"};if(Kt.returnType)return{candidate:Vt,type:Kt.returnType};let zt=Af(Gt,Fe.graph);if(zt){let Ut=fi(zt,Vt.importedName,Fe);if(Ut?.returnType)return{candidate:Vt,type:Ut.returnType}}return{candidate:Vt,failureReason:"return-type-unresolved"}})}function _f(te,ne){switch(ne){case"module-not-found":return`Prop "${te.propName}" default calls "${te.calleeName}()", but "${te.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${te.propName}" default calls "${te.calleeName}()", but "${te.importedName}" is not exported from "${te.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${te.propName}" default calls "${te.calleeName}()" imported from "${te.importSource}", but its return type could not be resolved; falling back to "any".`}}function $f(te,ne){for(let{candidate:Fe,type:Vt,failureReason:Gt}of ne){let Kt=Vs(te,Fe);if(Kt?.typeSource!=="unknown")continue;if(Vt){ii(Kt,"type",Vt),ii(Kt,"typeSource","typescript"),Gs(te,Fe);continue}if(Fe.location==="props"&&Gt){let zt=te.diagnostics?.find((Ut)=>Ut.kind==="prop-unknown-type"&&Ut.name===Fe.propName);if(zt)zt.message=_f(Fe,Gt)}}}var ec={collect:(te)=>te.pendingCallDefaultCandidates?.filter((ne)=>ne.importSource!==void 0)??[],resolve:Pf,apply:$f};function Nf(te,ne,Fe){return ne.map((Vt)=>{let Gt=Fe.graph.resolve(Vt.importSource,te);if(!Gt)return{candidate:Vt};let Kt=$i(Gt,Vt,Fe);if(!Kt?.primitiveLiteral)return{candidate:Vt};return{candidate:Vt,literal:Kt.primitiveLiteral,declaredType:Kt.declaredType}})}function Df(te,ne){for(let{candidate:Fe,literal:Vt,declaredType:Gt}of ne){if(!Vt)continue;let Kt=Vs(te,Fe);if(!Kt)continue;if(ii(Kt,"value",Vt.raw),ii(Kt,"defaultValue",{raw:Vt.raw,kind:"literal",value:Vt.value}),Kt.typeSource!=="unknown")continue;ii(Kt,"type",Gt?.type??Vt.type),ii(Kt,"typeSource",Gt?.source??"default"),Gs(te,Fe)}}var tc={collect:(te)=>te.pendingConstDefaultCandidates??[],resolve:Nf,apply:Df};function Rf(te,ne,Fe){return ne.map((Vt)=>{let Gt=Fe.graph.resolve(Vt.importSource,te);if(!Gt)return{candidate:Vt};let Kt=$i(Gt,Vt,Fe);if(Kt?.kind!=="const"||Kt.literalValue===void 0)return{candidate:Vt};return{candidate:Vt,key:Kt.literalValue}})}function If(te,ne){for(let{candidate:Fe,key:Vt}of ne){if(!Vt){let Ut=oe(Fe);Si(te,[a({component:te.filePath,kind:"context-key-unresolved",name:Ut,message:`setContext key \`${Ut}\` from "${Fe.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Fe.source?{source:Fe.source}:{}})]);continue}let Gt=[...te.contexts??[]],Kt=Gt.findIndex((Ut)=>Ut.key===Vt);if(Kt!==-1){let Ut=Gt[Kt],qt=nc(Ut.source,Fe.source),Xt=qt?Ut.source:Fe.source;if(Si(te,[a({component:te.filePath,kind:"context-duplicate-key",name:Vt,message:`setContext("${Vt}", ...) was called more than once; only the first call's shape is used.`,...Xt?{source:Xt}:{}})]),!qt)continue;Gt.splice(Kt,1)}let zt=Gt.findIndex((Ut)=>nc(Ut.source,Fe.source));Gt.splice(zt===-1?Gt.length:zt,0,{key:Vt,typeName:X(Vt),...Fe.type===void 0?{}:{type:Fe.type},description:Fe.description,properties:Fe.properties,...Fe.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Fe.internal?{internal:!0}:{},source:Fe.source}),te.contexts=Gt}}function nc(te,ne){if(!te||!ne)return!1;let{line:Fe,column:Vt}=te.start;return Fe>ne.start.line||Fe===ne.start.line&&Vt>ne.start.column}var ic={collect:(te)=>te.pendingContextKeyCandidates??[],resolve:Rf,apply:If};function Of(te,ne,Fe){return ne.map((Vt)=>{let Gt=Fe.graph.resolve(Vt.importSource,te);if(!Gt)return{candidate:Vt,failureReason:"module-not-found"};let Kt=$i(Gt,Vt,Fe)?.functionNode;if(!Kt)return{candidate:Vt,failureReason:"not-a-function"};let zt=Lf(Kt,Vt);if(!zt)return{candidate:Vt,failureReason:"parameter-not-found"};return Bf(Kt,zt,Vt)})}function sc(te){return te?.type==="AssignmentPattern"?te.left:te}function Lf(te,ne){let Fe=sc(te.params[ne.argumentIndex]);if(ne.property===void 0)return Fe?.type==="Identifier"?{name:Fe.name}:void 0;if(!ne.property)return;if(Fe?.type==="Identifier")return{object:Fe.name,property:ne.property};if(Fe?.type!=="ObjectPattern")return;for(let Vt of Fe.properties){if(Vt.type!=="Property"||Vt.computed)continue;if(Vt.key.type!=="Identifier"||Vt.key.name!==ne.property)continue;let Gt=sc(Vt.value);return Gt?.type==="Identifier"?{name:Gt.name}:void 0}return}function co(te){if(!te)return null;if(te.type==="ConditionalExpression"){let Fe=co(te.consequent),Vt=co(te.alternate);return Fe&&Vt?[...Fe,...Vt]:null}let ne=k(te);return ne?[ne]:null}var Mf={variableType:()=>{return}};function Ff(te){if(!te)return"null";let{deriveLiteralDetailType:ne,literalDetailToTypeText:Fe}=Bn();if(te.type==="Literal")return Fe(te.value);return ne(Mf,te)??"any"}function rc(te,ne){if("name"in ne)return te.type==="Identifier"&&te.name===ne.name;if(te.type!=="MemberExpression"||te.computed)return!1;return te.object.type==="Identifier"&&te.object.name===ne.object&&te.property.type==="Identifier"&&te.property.name===ne.property}function Bf(te,ne,Fe){let Vt=new Map,Gt="name"in ne?ne.name:ne.object,Kt;if(o(te.body,{enter(Ut,qt,Xt){if(Ut.type==="CallExpression"){if(!rc(Ut.callee,ne))return;let Qt=Ut.arguments,Zt=co(Qt[0]);if(!Zt)return Kt="dynamic-event-name",C;for(let en of Zt){let tn=Vt.get(en)??new Set;tn.add(Ff(Qt[1])),Vt.set(en,tn)}return}let Jt=qt?.type==="CallExpression"&&Xt==="callee";if(Ut.type==="MemberExpression"&&rc(Ut,ne)&&!Jt)return Kt="passed-on",C;if(Ut.type!=="Identifier"||Ut.name!==Gt)return;if(Jt)return;if(!("name"in ne)&&qt?.type==="MemberExpression"&&Xt==="object")return;if(!z(Ut,qt))return;return Kt="passed-on",C}}),Kt)return{candidate:Fe,failureReason:Kt};let zt=Array.from(Vt,([Ut,qt])=>{let Xt=Array.from(qt);return{name:Ut,detail:Xt.includes("any")?"any":Xt.join(" | ")}});return{candidate:Fe,events:zt}}function jf(te,ne){let Fe=te.members?`"${te.calleeText}"`:te.importedName==="default"?"the default export":`"${te.importedName}"`;switch(ne){case"module-not-found":return`"${te.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Fe} isn't a function declared in "${te.importSource}"`;case"parameter-not-found":return`no parameter of ${Fe} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Fe} passes it on`}}function Vf(te,ne,{deferredEventNoSourceDiagnostics:Fe=[],untypedJsDocEventNames:Vt=[]}){let Gt=new Map,Kt=[...te.diagnostics??[]],zt=!0;for(let{candidate:en,events:tn,failureReason:sn}of ne){if(sn){zt=!1,Kt.push(a({component:te.filePath,kind:"dispatch-escapes",name:en.dispatcherName,message:`\`${en.dispatcherName}\` is passed to \`${en.calleeText}\`, but sveld couldn't read the events it dispatches: ${jf(en,sn)}. Document them with @event tags.`,...en.source?{source:en.source}:{},...en.ignored?{ignored:!0}:{}}));continue}for(let nn of tn??[]){if(Gt.has(nn.name))continue;Gt.set(nn.name,{type:"dispatched",name:nn.name,detail:nn.detail,...en.source?{source:en.source}:{}})}}if(zt){for(let en of Fe)if(!Gt.has(en.name))Kt.push(en)}if(te.diagnostics=Kt,Gt.size===0)return;let Ut=new Map,qt=new Set;for(let en of te.events)if(en.type==="dispatched")qt.add(en.name);else if(!Ut.has(en.name))Ut.set(en.name,en);let Xt=new Set(Vt),Jt=new Map,Qt=[];for(let en of Gt.values()){if(qt.has(en.name)){if(Xt.has(en.name)&&en.detail!==void 0)Jt.set(en.name,en.detail);continue}let tn=Ut.get(en.name);if(!tn){Qt.push(en);continue}let sn=en.source??tn.source;Qt.push({type:"dispatched",name:en.name,detail:tn.detail??en.detail,...tn.description?{description:tn.description}:{},...tn.deprecated===void 0?{}:{deprecated:tn.deprecated},...tn.tags?{tags:tn.tags}:{},...tn.internal?{internal:!0}:{},...sn?{source:sn}:{}})}if(Qt.length===0&&Jt.size===0)return;let Zt=new Set(Qt.map((en)=>en.name));te.events=[...te.events.filter((en)=>en.type==="dispatched"||!Zt.has(en.name)).map((en)=>{let tn=en.type==="dispatched"?Jt.get(en.name):void 0;return tn===void 0?en:{...en,detail:tn}}),...Qt].sort(ye)}var oc={collect:(te)=>te.pendingDispatchEscapeCandidates??[],resolve:Of,apply:Vf};function Ws(te){return(ne)=>{let Fe=te.collect(ne);if(Fe.length===0)return;return(Vt,Gt,Kt)=>te.apply(Vt,te.resolve(Gt,Fe,Kt),ne)}}var Wf=[Ws(ec),Ws(tc),Ws(ic),Ws(oc)];async function ac(te,ne,Fe,Vt){let Gt=[];for(let zt of te){let Ut=Fe(zt);if(Ut===void 0)continue;let qt=Wf.flatMap((Xt)=>Xt(Ut)??[]);if(qt.length>0)Gt.push({component:zt,passes:qt})}let Kt=new Map;if(Gt.length===0)return Kt;await ti();for(let{component:zt,passes:Ut}of Gt){let qt=Bs(Vt),Xt=Gf(ne(zt.filePath));for(let Jt of Ut)Jt(zt,Xt,qt);Kt.set(zt.filePath,Array.from(qt.cache.keys()))}return Kt}var Uf=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,Hf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),Kf=new Set(["svelte","html"]);function qf(te){let ne=te.trim();if(ne==="")return null;let Fe=ne.match(Uf);if(Fe){let Vt=Fe[1].toLowerCase(),Gt=Fe[2].trim();if(Gt==="")return null;if(Hf.has(Vt))return{kind:"compile",code:Gt};if(Kf.has(Vt))return{kind:"syntax",code:Gt};return null}if(ne.startsWith("<"))return null;return{kind:"compile",code:ne}}function pc(te){if(!te.isFunction)return"any";return`(${(te.params??[]).map((Fe)=>`${Fe.name}${Fe.optional?"?":""}: any`).join(", ")}) => any`}function Us(te,ne,Fe,Vt,Gt){let Kt=(te??[]).filter((Ut)=>Ut.name==="example"),zt=Kt.length>1;return Kt.flatMap((Ut,qt)=>{let Xt=qf(Ut.body);if(Xt===null)return[];return[{id:zt?`${ne}#${qt}`:ne,name:zt?`${Fe} (example ${qt+1})`:Fe,type:Vt,code:Xt.code,kind:Xt.kind,...Gt?{source:Gt}:{}}]})}function zf(te){let ne=[];for(let Fe of te.props)ne.push(...Us(Fe.tags,`prop:${Fe.name}`,Fe.name,pc(Fe),Fe.source));for(let Fe of te.moduleExports)ne.push(...Us(Fe.tags,`export:${Fe.name}`,Fe.name,pc(Fe),Fe.source));for(let Fe of te.slots){let Vt=Fe.name??"default";ne.push(...Us(Fe.tags,`slot:${Vt}`,Vt,"any",Fe.source))}for(let Fe of te.events)ne.push(...Us(Fe.tags,`event:${Fe.name}`,Fe.name,"any",Fe.source));return ne}function cc(te,ne){return te.flatMap(({component:Fe,sources:Vt})=>{let Gt=Vt.filter((Kt)=>Kt.kind===ne);return Gt.length===0?[]:[{component:Fe,sources:Gt}]})}async function Xf(te){let{formatParseError:ne,parseSvelte:Fe}=await ti(),Vt=new Map;for(let{component:Gt,sources:Kt}of te){let zt=[];for(let Ut of Kt)try{Fe(Ut.code)}catch(qt){zt.push(a({component:Gt.filePath,kind:"example-syntax-error",name:Ut.name,message:ne(qt),...Ut.source?{source:Ut.source}:{}}))}Vt.set(Gt,zt)}return Vt}async function Jf(te,ne,Fe){let Vt=await ne.checkExamples(te.map(({component:Kt,sources:zt})=>({moduleName:Kt.moduleName,filePath:Fe(Kt.filePath),sources:zt}))),Gt=new Map;for(let{component:Kt,sources:zt}of te){let Ut=Vt.get(Fe(Kt.filePath));if(!Ut||Ut.length===0)continue;let qt=new Map(zt.map((Xt)=>[Xt.id,Xt.source]));Gt.set(Kt,Ut.map((Xt)=>{let Jt=qt.get(Xt.id);return a({component:Kt.filePath,kind:"example-compile-error",name:Xt.name,message:Xt.message,...Jt?{source:Jt}:{}})}))}return Gt}async function lc(te,ne,Fe,Vt){let Gt=Array.from(te,(Xt)=>({component:Xt,sources:zf(Xt)})),Kt=ne===!0?cc(Gt,"compile"):[],zt=cc(Gt,"syntax"),Ut=new Map,qt=(Xt)=>{for(let[Jt,Qt]of Xt)Ut.set(Jt,[...Ut.get(Jt)??[],...Qt])};if(zt.length>0)qt(await Xf(zt));if(Kt.length>0){let{TypeResolver:Xt}=await import("./chunk-x82fq7xs.js"),Jt=await Xt.create(Fe);if(!Jt.ok)throw Error(`sveld: \`checkExamples\` ${Jt.message}.`);let Qt=Jt.resolver;try{qt(await Jf(Kt,Qt,Vt))}finally{await Qt.dispose()}}return Ut}import{hash as Yf}from"node:crypto";import{mkdirSync as Qf,readFileSync as Zf,renameSync as em,writeFileSync as uc}from"node:fs";import{dirname as hc,isAbsolute as tm,join as nm,resolve as lo}from"node:path";var dc=11,im=nm("node_modules",".cache","sveld","parse-cache.json"),sm="d5f2531ddb75d347";function fc(){return`${ws}+${sm}+svelte@${Ui}`}function rm(te){let ne=H(te,["package.json"]);return ne===null?lo(te):hc(ne)}function mc(te,ne){let Fe=rm(te);if(typeof ne==="string")return tm(ne)?ne:lo(Fe,ne);return lo(Fe,im)}function Hs(te){return Yf("sha256",te,"hex")}function uo(){return{formatVersion:dc,toolchainVersion:fc(),entries:{}}}function om(te){try{let ne=JSON.parse(Zf(te,"utf-8"));if(ne.formatVersion!==dc||ne.toolchainVersion!==fc())return uo();return ne}catch{return uo()}}class ho{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(te){this.cacheFilePath=te,this.file=om(te),this.savedEntryCount=Object.keys(this.file.entries).length}has(te,ne){return this.lookup(te,ne)!==void 0}lookup(te,ne){let Fe=this.next.get(te);if(Fe?.hash===ne)return Fe;let Vt=this.file.entries[te];return Vt?.hash===ne?Vt:void 0}get(te,ne){let Fe=this.lookup(te,ne);if(Fe===void 0)return null;this.next.set(te,Fe);let{component:Vt,typeScriptMetadata:Gt,propIgnores:Kt,pending:zt}=structuredClone({component:Fe.component,typeScriptMetadata:Fe.typeScriptMetadata,propIgnores:Fe.propIgnores,pending:Fe.pending});if(Gt!==void 0)Vt[v]=Gt;if(Kt!==void 0)Vt[M]=Kt;return zt===void 0?{component:Vt}:{component:Vt,pending:zt}}set(te,ne,{component:Fe,pending:Vt}){this.dirty=!0,this.next.set(te,{hash:ne,...structuredClone({component:Fe,typeScriptMetadata:Fe[v],propIgnores:Fe[M],pending:Vt})})}getGeneratedText(te,ne){let Fe=this.next.get(te);if(Fe?.generatedText===void 0||Fe.generatedText.key!==ne)return;return Fe.generatedText.text}setGeneratedText(te,ne,Fe){let Vt=this.next.get(te);if(Vt===void 0)return;if(Vt.generatedText?.key===ne&&Vt.generatedText.text===Fe)return;Vt.generatedText={key:ne,text:Fe},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,Qf(hc(this.cacheFilePath),{recursive:!0});let te={...uo(),entries:Object.fromEntries(this.next)},ne=JSON.stringify(te),Fe=`${this.cacheFilePath}.${process.pid}.tmp`;try{uc(Fe,ne),em(Fe,this.cacheFilePath)}catch{try{uc(this.cacheFilePath,ne)}catch{}}}}import{dirname as am,relative as pm,resolve as cm}from"node:path";async function gc(te,ne={}){await ti();let Fe=cm(te),Vt=am(Fe),Gt=(Ut)=>n(`./${pm(Vt,Ut)}`),Kt=js(Fe,{...Bs(ne.graph??new ni),onAmbiguousStarExport:(Ut,qt,Xt)=>{if(Ut!==Fe||!ne.diagnostics)return;if(Xt.every((en)=>en.declFile.endsWith(".svelte")))return;let Jt=Array.from(new Set(Xt.map((en)=>Gt(en.declFile)))),Qt=Jt.map((en)=>`"${en}"`),Zt=`${Qt.slice(0,-1).join(", ")} and ${Qt[Qt.length-1]}`;ne.diagnostics.push(a({component:Gt(Fe),kind:"export-ambiguous",name:qt,message:`"${qt}" is exported by ${Zt} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${qt} } from "${Jt[0]}"\`).`}))}}),zt=new Map;for(let Ut of Kt){if(Ut.name==="default"||Ut.declFile.endsWith(".svelte"))continue;let{declFile:qt,returnType:Xt,literalValue:Jt,primitiveLiteral:Qt,declaredType:Zt,functionNode:en,namespaceFile:tn,...sn}=Ut,nn=Gt(qt);if(tn!==void 0)sn.type=`typeof import(${JSON.stringify(Gt(tn))})`;zt.set(Ut.name,{...sn,source:nn})}return Array.from(zt.values()).sort((Ut,qt)=>u(Ut.name,qt.name))}async function hm(te){let ne=await Promise.all(Array.from(te,async(Fe)=>{try{return[Fe,await um(Fe,"utf-8")]}catch(Vt){return console.warn(`Warning: Failed to read file ${Fe}:`,Vt),[Fe,null]}}));return new Map(ne)}function xc(te){if(te.length===0)return;console.error(`sveld: failed to parse ${te.length} component(s):`);for(let{filePath:ne,message:Fe}of te)console.error(` - ${ne}: ${Fe}`)}class Yi{input;glob;options;graph=new ni;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(te,ne,Fe={}){this.input=te,this.glob=ne,this.options=Fe}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new ni,this.collected=oo(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Fs(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=lm(this.input).isFile()?yc(this.input):null,this.cache=this.options.cache===!1?void 0:new ho(mc(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),xc(Array.from(this.parseErrors.values())),this.assemble()}async update(te){let ne=te.map((Xt)=>yc(Xt));if(this.graph.invalidate(...ne),ne.length===0)return{result:this.assemble(),reparsed:[]};let Fe=this.entryFile!==null&&ne.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Xt,exports:Jt,allComponentEntries:Qt,resolveComponentFilePath:Zt}=this.collected;ro(this.graph,Xt,Jt,Qt,Zt,this.globMergeState)}this.indexEntries();let Vt=this.componentPaths();for(let Xt of this.records.keys())if(!Vt.has(Xt))this.records.delete(Xt);for(let Xt of this.parseErrors.keys())if(!Vt.has(Xt))this.parseErrors.delete(Xt);let Gt=Array.from(this.records).flatMap(([Xt,{crossFileReads:Jt}])=>Jt?.some((Qt)=>ne.includes(Qt))?[Xt]:[]),Kt=new Set([...ne.filter((Xt)=>Ln.test(Xt)),...Fe,...Gt]),zt=new Set(Array.from(Vt).filter((Xt)=>Kt.has(Xt))),Ut=await this.process(zt),qt=this.assemble();return xc(qt.errors),{result:qt,reparsed:Ut}}async recollect(){let te=this.collected,ne=oo(this.input,this.glob,this.documentExports,this.graph),Fe=[];for(let[Vt,Gt]of Object.entries(ne.exports)){let Kt=ne.resolveComponentFilePath(Gt.source),zt=Object.hasOwn(te.exports,Vt)?te.exports[Vt]:void 0;if(zt===void 0||te.resolveComponentFilePath(zt.source)!==Kt)Fe.push(Kt)}return this.collected=ne,this.globMergeState=Fs(ne.allComponentEntries,ne.resolveComponentFilePath),await this.readEntryExports(),Fe}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await gc(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:te,allComponentEntries:ne,resolveComponentFilePath:Fe}=this.collected,Vt=new Set;for(let[,Gt]of[...Object.entries(te),...ne])if(Ai(Gt.source))Vt.add(Fe(Gt.source));return Vt}indexEntries(){let{exports:te,allComponentEntries:ne,resolveComponentFilePath:Fe}=this.collected;this.canonicalEntries=new Map;for(let Vt of[Object.entries(te),ne])for(let Gt of Vt){if(!Ai(Gt[1].source))continue;this.canonicalEntries.set(Fe(Gt[1].source),this.entryIdentity(Vt,Gt))}}entryIdentity(te,[ne,{source:Fe}]){return{moduleName:zp(ne,Fe,te.length,this.warnedModuleNames),filePath:n(Fe)}}canonicalEntry(te){let ne=this.canonicalEntries.get(te);if(ne===void 0)throw Error(`sveld: no entry lists ${te}.`);return ne}async process(te){let ne=new Map,Fe=await this.parse(te,ne);this.cache?.save();let Vt=await this.settle(Fe);for(let Gt of te)this.records.delete(Gt),this.parseErrors.delete(Gt);for(let[Gt,Kt]of Vt)this.records.set(Gt,Kt);for(let[Gt,Kt]of ne)this.parseErrors.set(Gt,Kt);return Array.from(Vt.keys())}async parse(te,ne){let Fe=await hm(te),Vt=this.cache,Gt=new Map,Kt=new Set;if(Vt)for(let[Ut,qt]of Fe){if(qt===null)continue;let Xt=Hs(qt);if(Gt.set(Ut,Xt),!Vt.has(Ut,Xt))Kt.add(Ut)}if(te.size>0&&(!Vt||Kt.size>0))await ti();let zt=new Map;for(let Ut of te){let qt=Fe.get(Ut);if(qt===null||qt===void 0)continue;let Xt=this.parseOne(Ut,qt,Gt.get(Ut),ne);if(Xt)zt.set(Ut,Xt)}return zt}parseOne(te,ne,Fe,Vt){let Gt=Fe===void 0?null:this.cache?.get(te,Fe);if(Gt)return Gt;let{moduleName:Kt,filePath:zt}=this.canonicalEntry(te),Ut;try{Ut=new(Bn()).ComponentParser().parse(ne,{moduleName:Kt,filePath:zt})}catch(qt){if(this.options.failFast)throw qt;Vt.set(te,{filePath:zt,moduleName:Kt,message:qt instanceof Error?qt.message:String(qt),stack:qt instanceof Error?qt.stack:void 0});return}if(Fe!==void 0)this.cache?.set(te,Fe,Ut);return Ut}async settle(te){let{rootDir:ne,resolveComponentFilePath:Fe}=this.collected,Vt=new Map,Gt=new Map;for(let[qt,{component:Xt,pending:Jt}]of te){let Qt={...this.canonicalEntry(qt),...Xt};Vt.set(qt,Qt),Gt.set(Qt,Jt)}let{checkExamples:Kt}=this.options;if(Kt){let qt=await lc(Vt.values(),Kt,ne,Fe);for(let[Xt,Jt]of qt)Si(Xt,Jt)}let zt=await ac(Vt.values(),Fe,(qt)=>Gt.get(qt),this.graph),Ut=new Map;for(let[qt,Xt]of Vt){let{moduleName:Jt,filePath:Qt,...Zt}=Xt,en=zt.get(Qt);Ut.set(qt,en===void 0?{component:Zt}:{component:Zt,crossFileReads:en})}return Ut}assemble(){let{exports:te,allComponentEntries:ne,resolveComponentFilePath:Fe}=this.collected,Vt=this.cache,Gt=(Qt,Zt)=>{let{source:en}=Zt[1];if(!Ai(en))return;let tn=this.records.get(Fe(en));if(tn===void 0)return;return{component:{...this.entryIdentity(Qt,Zt),...tn.component},record:tn}},Kt=new Map,zt=Vt?new Map:void 0,Ut=Vt?new Map:void 0;for(let Qt of ne){let Zt=Gt(ne,Qt);if(Zt===void 0)continue;let{filePath:en}=Zt.component;Kt.set(en,Zt.component),(Zt.record.crossFileReads===void 0?zt:Ut)?.set(en,Fe(Qt[1].source))}let qt=Pp(Kt,Fe,this.graph);for(let Qt of Kt.values())Si(Qt,[...qt(Qt),...Ap(Qt)]);let Xt=new Map,Jt=Object.entries(te);for(let Qt of Jt){let Zt=Gt(Jt,Qt);if(Zt===void 0)continue;let en=Kt.get(Zt.component.filePath);if(en)Zt.component.diagnostics=en.diagnostics;Xt.set(Zt.component.moduleName,Zt.component)}return{exports:te,entryExports:this.entryExports,components:Xt,allComponentsForTypes:Kt,errors:Array.from(this.parseErrors.values()),diagnostics:Vo(Wo([...Array.from(Kt.values()).flatMap((Qt)=>Qt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Vt,resolvedPathByFilePath:zt,crossFileResolvedPathByFilePath:Ut}}}function Qi(te){return{failFast:te?.failFast,documentExports:te?.documentExports===!0,cache:te?.cache,checkExamples:te?.checkExamples==="syntax"?"syntax":te?.checkExamples===!0,diagnostics:te?.diagnostics}}async function Zi(te,ne,Fe={}){return new Yi(te,ne,Fe).build()}import{existsSync as fo,readFileSync as dm}from"node:fs";import{isAbsolute as fm,join as Ec}from"node:path";var es='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function vc(te){return fm(te)?te:Ec(process.cwd(),te)}function Le(te){if(te){let Gt=vc(te);if(fo(Gt))return{entry:ee(te)};return{entry:null,configured:!0,message:`Invalid entry point: ${Gt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let ne=Ec(process.cwd(),"package.json");if(!fo(ne))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Fe;try{Fe=Ip(JSON.parse(dm(ne,"utf-8")))}catch(Gt){throw console.error("Error reading package.json:",Gt),Gt}let Vt=Fe.svelte?.trim();if(!Vt)return{entry:null,configured:!1,message:'Could not determine an entry point. Set the "svelte" field in your package.json, or pass --entry (or the "entry" option).'};if(!fo(vc(Vt)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Vt}", which does not exist.`};return{entry:ee(Vt)}}function Ks(te){let ne=Le(te);if(ne.entry===null)console.error(ne.message);return ne.entry}async function Sc(te,ne,Fe={}){let Vt=new Yi(te,ne,{...Fe,failFast:!1}),Gt=await Vt.build();return{get result(){return Promise.resolve(Gt)},async update(Kt){let zt=await Vt.update(Kt);return Gt=zt.result,zt}}}import go from"node:path";function bc(te){let ne=new Map,Fe=[];for(let[Vt,Gt]of Object.entries(te)){if(Gt.star){Fe.push(`export * from "${Gt.source}";`);continue}let Kt=ne.get(Gt.source)??[];Kt.push({id:Vt,exportee:Gt}),ne.set(Gt.source,Kt)}for(let[Vt,Gt]of ne){let Kt=Ln.test(Vt),zt=Gt.some(({id:Zt,exportee:en})=>Zt!=="default"&&en.default),Ut=Gt.some(({exportee:Zt})=>!Zt.default),qt=Kt&&zt&&Ut,Xt=[],Jt=[],Qt=[];for(let{id:Zt,exportee:en}of Gt){if(Zt==="default"){Jt.push(`export { default } from "${Vt}";`);continue}if(en.default)if(en.mixed)Jt.push(`export { default as ${Zt} } from "${Vt}";`),Jt.push(`export { default } from "${Vt}";`);else Qt.push(`default as ${Zt}`);else if(Kt&&!qt)Qt.push(`default as ${Zt}`);else Xt.push(en.imported===void 0?Zt:`${en.imported} as ${Zt}`)}if(Qt.length>0&&Xt.length>0)Fe.push(`export { ${[...Qt,...Xt].join(", ")} } from "${Vt}";`);else{if(Xt.length>0)Fe.push(`export { ${Xt.join(", ")} } from "${Vt}";`);if(Qt.length>0)Fe.push(`export { ${Qt.join(", ")} } from "${Vt}";`)}Fe.push(...Jt)}return Fe.join(`
|
|
142
|
+
`)}function Cc(te){return te.filter((ne)=>ne.names.length>0).map((ne)=>`export type { ${ne.names.join(", ")} } from "${ne.source}";`).join(`
|
|
143
|
+
`)}function Tc(te){return te.replace(Ln,"")}function mo(te){return te.replace(Ln,".svelte.d.ts")}import{mkdir as mm,readFile as gm,writeFile as ym}from"node:fs/promises";import{parse as xm}from"node:path";class Gn{ensuredDirs=new Set;async write(te,ne){try{if(await gm(te,"utf-8")===ne)return!1}catch{}let Fe=xm(te).dir;if(!this.ensuredDirs.has(Fe))await mm(Fe,{recursive:!0}),this.ensuredDirs.add(Fe);return await ym(te,ne),!0}}function vm(te){return i(te)&&!Array.isArray(te)&&"start"in te&&"end"in te}function yo(te){if(Array.isArray(te))return te.map((ne)=>yo(ne));if(i(te)){let ne={};for(let[Fe,Vt]of Object.entries(te)){if((Fe==="source"||Fe==="componentCommentSource")&&vm(Vt))continue;ne[Fe]=yo(Vt)}return ne}return te}function Em(te,ne,Fe){if(!ne)return`${te.moduleName}.api.json`;if(!Fe.has(te.moduleName))Fe.add(te.moduleName),console.warn(`Warning: multiple components named "${te.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${Tc(te.filePath)}.api.json`}async function Sm(te,ne,Fe){let Vt=qs(te,{inputDir:ne.inputDir,source:ne.source}).components,Gt=new Map;for(let Ut of Vt)Gt.set(Ut.moduleName,(Gt.get(Ut.moduleName)??0)+1);let Kt=new Set,zt=new Gn;await Promise.all(Vt.map(async(Ut)=>{let qt=(Gt.get(Ut.moduleName)??0)>1,Xt=Em(Ut,qt,Kt),Jt=go.resolve(go.join(Fe,Xt)),Qt=await zt.write(Jt,Wi(Ut));qn(`${Qt?"created":"unchanged"} "${Jt}".`)}))}function qs(te,ne){let Fe=y(te,{entryExports:ne.entryExports}),Vt={...Fe,components:Fe.components.map((Gt)=>({...Gt,filePath:Ia(Gt.filePath,ne.inputDir)}))};return ne.source===!1?yo(Vt):Vt}function xo(te,ne){return Wi(qs(te,ne))}async function vo(te,ne){if(ne.outDir){await Sm(te,ne,ne.outDir);return}let Fe=await new Gn().write(go.resolve(ne.outFile),xo(te,ne));qn(`${Fe?"created":"unchanged"} "${ne.outFile}".`)}import{join as Uc,resolve as ko}from"node:path";var wc=/`/g,kc=/\s+/g,si="--",Ac=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
144
|
+
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
145
|
+
`,Pc=`| Slot name | Default | Props | Fallback | Description |
|
|
146
|
+
| :- | :- | :- | :- | :- |
|
|
147
|
+
`,_c=`| Event name | Type | Detail | Description |
|
|
148
|
+
| :- | :- | :- | :- |
|
|
149
|
+
`,Eo=`| Name | Kind | Type | Description |
|
|
150
|
+
| :- | :- | :- | :- |
|
|
151
|
+
`,bm=`| Member | Signature | Description |
|
|
152
|
+
| :- | :- | :- |
|
|
153
|
+
`,$c=`| Part name | Description |
|
|
154
|
+
| :- | :- |
|
|
155
|
+
`,Nc=`| Property name | Type | Default value | Description |
|
|
156
|
+
| :- | :- | :- | :- |
|
|
157
|
+
`,Dc=/\|/g,Cm=/</g,Tm=/>/g,zs=/\n/g,wm=/^[A-Za-z_$][\w$]*$/,km=/\s*\n\s*/g,Am=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,Pm=/[&<|`*\\_]/;function So(te){if(!Pm.test(te))return te;return te.replace(Am,(ne)=>ne==="&"?"&":ne==="<"?"<":ne==="_"?"_":`&#${ne.charCodeAt(0)};`)}function _m(te){return`<code>${So(te.includes(`
|
|
158
|
+
`)?te.replace(km," "):te)}</code>`}var $m=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function Nm(te){if(!te.includes("{@link"))return te;return te.replace($m,(ne,Fe,Vt)=>`[${Vt===void 0?Fe:Vt.trim()}](${Fe})`)}function Dm(te){return te.includes("```")||te.includes("~~~")}function Rm(te){return Lc(Nm(te))}var Im=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Om=/^\n/,Lm=/\n$/;function Rc(te){let ne=(Kt)=>({kind:"prose",text:Rm(Kt.join(`
|
|
159
|
+
`))});if(!Dm(te))return[ne([te])];let Fe=te.split(`
|
|
160
|
+
`),Vt=[],Gt=[];for(let Kt=0;Kt<Fe.length;Kt++){let zt=Im.exec(Fe[Kt]),[,Ut="",qt="",Xt=""]=zt??[];if(!zt||qt[0]==="`"&&Xt.includes("`")){Gt.push(Fe[Kt]);continue}if(Gt.push(""),Gt.length>1)Vt.push(ne(Gt));let Jt=[],Qt=new RegExp(`^[ \\t]*${qt[0]}{${qt.length},}[ \\t]*$`);for(Kt++;Kt<Fe.length&&!Qt.test(Fe[Kt]);Kt++){let Zt=Fe[Kt],en=0;while(en<Ut.length&&(Zt[en]===" "||Zt[en]==="\t"))en++;Jt.push(Zt.slice(en))}Vt.push({kind:"code",code:Jt.join(`
|
|
161
|
+
`)}),Gt=[""]}if(Gt.length>1||Vt.length===0)Vt.push(ne(Gt));return Vt}function Ic(te){let ne="";for(let Fe=0;Fe<te.length;Fe++){let Vt=te[Fe];if(Vt.kind==="code"){ne+=`<pre><code>${So(Vt.code).replace(zs,"<br />")}</code></pre>`;continue}let Gt=Vt.text;if(te[Fe-1]?.kind==="code")Gt=Gt.replace(Om,"");if(te[Fe+1]?.kind==="code")Gt=Gt.replace(Lm,"");ne+=Gt.replace(Dc,"|").replace(zs,"<br />")}return ne}function An(te){if(te===void 0)return si;return _m(te)}function Oc(te){if(!te.reExport)return An(te.type);let{from:ne,imported:Fe}=te.reExport,Vt=Fe==="*"?"":wm.test(Fe)?`.${Fe}`:`[${JSON.stringify(Fe)}]`;return An(`typeof import(${JSON.stringify(ne)})${Vt}`)}function Lc(te){if(!te.includes("<")&&!te.includes(">"))return te;return te.replace(Cm,"<").replace(Tm,">")}function mi(te,ne){if(ne===void 0)return te;let Fe=typeof ne==="string"&&ne.trim().length>0?`: ${Lc(ne).replace(zs," ").replace(Dc,"|")}`:"";return`<s>${te}</s><br />**Deprecated**${Fe}`}function Xs(te){if(te===void 0||te.trim().length===0)return si;return Ic(Rc(te))}function Mc(te){if(te===void 0||te==="{}"||te==="Record<string, never>")return si;return An(te.trim())}function Fc(te){if(te===void 0)return si;return`<code>${So(te).replace(zs,"<br />")}</code>`}function Ni(te,ne){let Fe=[],Vt=(Kt)=>{let zt=Fe.at(-1);if(zt?.kind==="prose")zt.text+=Kt;else Fe.push({kind:"prose",text:Kt})},Gt=(Kt,zt)=>{if(Fe.length>0)Vt(`
|
|
162
|
+
`);if(Kt)Vt(Kt);for(let Ut of Rc(zt))if(Ut.kind==="prose")Vt(Ut.text);else Fe.push(Ut)};if(te?.trim())Gt("",te);for(let{name:Kt,body:zt}of ne??[]){let Ut=zt?.trim();Gt(Ut?`@${Kt} `:`@${Kt}`,Ut??"")}if(Fe.length===0)return si;return Ic(Fe)}function Bc(te){return An(te)}function Mm(te){let ne=[te.extends?`Extends ${An(te.extends)}.`:"",te.implements?.length?`Implements ${te.implements.map((Fe)=>An(Fe)).join(", ")}.`:""].filter(Boolean);return ne.length>0?ne.join(" "):void 0}function jc(te,ne){let Fe=new Set;for(let Vt of ne){if(Vt.kind!=="class")continue;let Gt=Mm(Vt);if(!Vt.members?.length&&!Gt)continue;let Kt=Vt.localName??Vt.name;if(Fe.has(Kt))continue;if(Fe.add(Kt),te.append("h4",`\`${Kt}\` members`),Gt)te.append("raw",`${Gt}
|
|
163
|
+
|
|
164
|
+
`);if(!Vt.members?.length)continue;te.append("raw",bm);for(let zt of Vt.members)te.append("raw",`| ${mi(zt.name,zt.deprecated)} | ${An(Vr(zt))} | ${Ni(zt.description,zt.tags)} |
|
|
165
|
+
`);te.append("raw",`
|
|
166
|
+
`)}}function Vc(te,ne,Fe){if(te.append("h1","Component Index"),te.append("h2","Components").tableOfContents(),te.append("divider"),Fe&&Fe.length>0)Wc(te,Fe);for(let Vt of y(ne).components)Co(te,Vt)}function Gc(te,ne,Fe){te.append("h1","Component Index"),te.append("h2","Components");for(let Vt of ne)te.append("raw",`- [${Vt.moduleName}](./${Vt.moduleName}.md)
|
|
167
|
+
`);if(te.append("raw",`
|
|
168
|
+
`),te.append("divider"),Fe&&Fe.length>0)Wc(te,Fe)}function Wc(te,ne){te.append("h2","Exports"),te.append("raw",Eo);for(let Fe of ne){let Vt=(Fe.type??Fe.value)?.replace(kc," ").trim();te.append("raw",`| ${mi(Fe.name,Fe.deprecated)} | <code>${Fe.kind}</code> | ${An(Vt)} | ${Xs(Fe.description)} |
|
|
169
|
+
`)}te.append("raw",`
|
|
170
|
+
`),te.append("divider")}function Fm(te,ne){te.append("h3","Module exports"),te.append("raw",Eo);for(let Fe of ne)te.append("raw",`| ${mi(Fe.name,Fe.deprecated)} | <code>${Fe.kind}</code> | ${Oc(Fe)} | ${Ni(Fe.description,Fe.tags)} |
|
|
171
|
+
`);te.append("raw",`
|
|
172
|
+
`),jc(te,ne)}function bo(te,ne,Fe){if(ne.length>0)Fe(),te.append("raw",`
|
|
173
|
+
`);else te.append("p","None.")}function Co(te,ne){if(te.append("h2",`\`${ne.moduleName}\``),ne.generics)te.append("p",`**Type parameters:** ${An(`<${ne.generics[1]}>`)}`);if(ne.typedefs.length>0)te.append("h3","Types").append("raw",`\`\`\`ts
|
|
174
|
+
${Ds({typedefs:ne.typedefs})}
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
177
|
+
`);if(te.append("h3","Props"),bo(te,ne.props,()=>{te.append("raw",Ac);let Fe=(Gt)=>Gt.reactive?0:Gt.constant?2:1,Vt=ne.props.map((Gt,Kt)=>({prop:Gt,index:Kt})).sort((Gt,Kt)=>Fe(Gt.prop)-Fe(Kt.prop)||Gt.index-Kt.index).map(({prop:Gt})=>Gt);for(let Gt of Vt){let Kt=Zn(Gt)?"accessor":Gt.kind;te.append("raw",`| ${mi(Gt.name,Gt.deprecated)} | ${Gt.isRequired?"Yes":"No"} | <code>${Kt}</code> | ${Gt.reactive?"Yes":"No"} | ${Gt.binding??"--"} | ${An(Gt.type)} | ${An(Gt.value)} | ${Ni(Gt.description,Gt.tags)} |
|
|
178
|
+
`)}}),ne.moduleExports.length>0)Fm(te,ne.moduleExports);if(te.append("h3","Slots"),bo(te,ne.slots,()=>{te.append("raw",Pc);for(let Fe of ne.slots)te.append("raw",`| ${mi(Fe.default?si:Fe.name??si,Fe.deprecated)} | ${Fe.default?"Yes":"No"} | ${Mc(Fe.slot_props)} | ${Fc(Fe.fallback)} | ${Ni(Fe.description,Fe.tags)} |
|
|
179
|
+
`)}),te.append("h3","Events"),bo(te,ne.events,()=>{te.append("raw",_c);for(let Fe of ne.events)te.append("raw",`| ${mi(Fe.name,Fe.deprecated)} | ${Fe.type} | ${Bc(Fe.detail)} | ${Ni(Fe.description,Fe.tags)} |
|
|
180
|
+
`)}),ne.cssParts&&ne.cssParts.length>0){te.append("h3","CSS Parts"),te.append("raw",$c);for(let Fe of ne.cssParts)te.append("raw",`| ${Fe.name} | ${Xs(Fe.description)} |
|
|
181
|
+
`);te.append("raw",`
|
|
182
|
+
`)}if(ne.cssProperties&&ne.cssProperties.length>0){te.append("h3","CSS Custom Properties"),te.append("raw",Nc);for(let Fe of ne.cssProperties)te.append("raw",`| ${Fe.name} | ${An(Fe.type)} | ${An(Fe.default)} | ${Xs(Fe.description)} |
|
|
183
|
+
`);te.append("raw",`
|
|
184
|
+
`)}}var Bm=/[^\w\- ]+/g,jm=/\s+/g,To="<!-- __TOC__ -->";function Vm(te,ne){let Fe=te.toLowerCase().replace(wc,"").replace(Bm,"").replace(jm,"-"),Vt=ne.get(Fe)??0;return ne.set(Fe,Vt+1),Vt===0?Fe:`${Fe}-${Vt}`}class wo{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(te={}){this.onAppend=te.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
185
|
+
|
|
186
|
+
`),this}append(te,ne){switch(te){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(te.slice(-1)))} ${ne}`),this.hasToC&&te==="h2")this.toc.push({indent:0,raw:ne??""});break}case"quote":this.sourceParts.push(`> ${ne}`);break;case"p":this.sourceParts.push(ne??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(ne??"");break}if(te!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,te,this),this}tableOfContents(){return this.sourceParts.push(To),this.hasToC=!0,this.appendLineBreaks(),this}end(){let te=this.sourceParts.join("");if(!this.hasToC)return te;let ne=te.indexOf(To);if(ne===-1)return te;let Fe=new Map,Vt=this.toc.map(({indent:Gt,raw:Kt})=>`${" ".repeat(Gt)}- [${Kt}](#${Vm(Kt,Fe)})`).join(`
|
|
187
|
+
`);return te.slice(0,ne)+Vt+te.slice(ne+To.length)}}function Js(te,ne){return new wo({onAppend:(Fe,Vt)=>{ne?.onAppend?.call(null,Fe,Vt,te)}})}function ts(te,ne){let Fe=Js(te,ne);return Vc(Fe,te,ne.entryExports),Fe.end()}async function Gm(te,ne,Fe){let Vt=y(te,{entryExports:ne.entryExports}),Gt=new Gn,Kt=Js(te,ne);Gc(Kt,Vt.components,ne.entryExports);let zt=ko(Uc(Fe,"README.md")),Ut=await Gt.write(zt,Kt.end());qn(`${Ut?"created":"unchanged"} "${zt}".`),await Promise.all(Vt.components.map(async(qt)=>{let Xt=Js(te,ne);Co(Xt,qt);let Jt=ko(Uc(Fe,`${qt.moduleName}.md`)),Qt=await Gt.write(Jt,Xt.end());qn(`${Qt?"created":"unchanged"} "${Jt}".`)}))}async function Ao(te,ne){if(ne.outDir){await Gm(te,ne,ne.outDir);return}let Fe=ko(ne.outFile),Vt=await new Gn().write(Fe,ts(te,ne));qn(`${Vt?"created":"unchanged"} "${ne.outFile}".`)}import{join as Wm,resolve as Um}from"node:path";function Hm(te,ne){if(!ne.indexTypes)return[];let Fe=ne.format==="component",Vt=new Set,Gt=[];for(let Kt of Object.values(ne.exports)){if(!Kt.default||!Ln.test(Kt.source))continue;let zt=n(Kt.source);if(Vt.has(zt))continue;Vt.add(zt);let Ut=te.components.find((Xt)=>Xt.filePath===zt);if(!Ut)continue;let qt=[_i(Ut.moduleName)];if(Fe)qt.push(zi(Ut.moduleName));Gt.push({source:Kt.source,names:qt})}return Gt}async function Hc(te,ne,Fe){if(!te)return ne;try{let Vt=await te(ne,Fe);if(typeof Vt!=="string")throw TypeError(`must return a string, got ${typeof Vt}`);return Vt}catch(Vt){let Gt=Vt instanceof Error?Vt.message:String(Vt);throw Error(`sveld: typesOptions.transform failed for "${Fe.filePath}": ${Gt}`,{cause:Vt})}}function Km(te,ne){return`${te}
|
|
188
|
+
${rp(ne)}`}async function Po(te,ne){let Fe=Um(ne.outDir,"index.d.ts"),Vt=new Gn,Gt=y(te),Kt=Cc(Hm(Gt,ne)),zt=ne.preamble+[bc(ne.exports),Kt].filter((en)=>en!=="").join(`
|
|
189
|
+
|
|
190
|
+
`),Ut=Gr(ne),qt=Gt.components.map(async(en)=>{let tn=mo(Wm(ne.outDir,en.filePath)),sn=n(mo(en.filePath)),nn=ne.resolvedPathByFilePath?.get(en.filePath),pn=nn?void 0:ne.crossFileResolvedPathByFilePath?.get(en.filePath),cn=nn??pn,fn=Km(en.moduleName,Ut),gn=pn?`${fn}
|
|
191
|
+
${Hs(JSON.stringify(en))}`:fn,yn=cn?ne.cache?.getGeneratedText(cn,gn):void 0;if(yn===void 0){if(yn=Wr(en,Ut),cn)ne.cache?.setGeneratedText(cn,gn,yn)}let Wn=await Hc(ne.transform,yn,{kind:"component",component:en,filePath:sn});return Vt.write(tn,Wn)}),Xt=(async()=>{let en=await Hc(ne.transform,zt,{kind:"index",filePath:"index.d.ts"});return Vt.write(Fe,`${en}
|
|
192
|
+
`)})(),Jt=(await Promise.all([...qt,Xt])).filter(Boolean).length,Qt=qt.length+1,Zt=Jt===0?`unchanged ${Qt}`:`created ${Jt} of ${Qt}`;qn(`${Zt} TypeScript definitions in "${ne.outDir}".`)}var qm=["reportDiagnostics","strict","check","checkLevel","stdout","format"],zm=50;function Xm(te){let ne=Promise.resolve();return()=>{ne=ne.then(te,te)}}function jt(te){let ne=te?.watch===!0,Fe,Vt,Gt=te??{},Kt,zt=null,Ut,qt=new Set,Jt=Xm(async()=>{if(zt==null||Vt==null||qt.size===0)return;let Zt=Array.from(qt);qt.clear();try{let{result:en}=await zt.update(Zt);await ns(en,Gt,Vt)}catch(en){console.error("sveld: failed to regenerate types in watch mode:",en)}}),Qt=(Zt)=>{if(!ne||zt==null||!Ra.test(Zt))return;qt.add(Zt),clearTimeout(Ut),Ut=setTimeout(Jt,zm)};return{name:"vite-plugin-sveld",apply:ne?void 0:"build",enforce:"post",configResolved(Zt){Kt=Zt.root},async buildStart(){if(te?.config){let en=await G(te.config,Kt??process.cwd(),!1);Gt=O(en,te)}W(Gt);let Zt=qm.filter((en)=>(en in Gt));if(Zt.length>0)console.warn(`sveld: the Vite plugin ignores ${Zt.map((en)=>`"${en}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(U(Gt.quiet===!0),Vt=Ks(Gt.entry),ne&&Vt!=null)try{zt=await Sc(Vt,Gt.glob===!0,Qi(Gt)),await ns(await zt.result,Gt,Vt)}catch(en){console.error("sveld: failed to generate initial types in watch mode:",en)}},async generateBundle(){if(ne)return;if(Vt==null)this.error(es);Fe=await Zi(Vt,Gt.glob===!0,Qi(Gt))},async writeBundle(){if(ne)return;if(Vt==null)this.error(es);await ns(Fe,Gt,Vt)},handleHotUpdate(Zt){Qt(Zt.file)},watchChange(Zt){Qt(Zt)}}}async function ns(te,ne,Fe){let Vt=Kc(Fe);if(ne.types!==!1)await Po(te.allComponentsForTypes,{outDir:"types",preamble:"",...ne.typesOptions,exports:te.exports,inputDir:Vt,cache:te.cache,resolvedPathByFilePath:te.resolvedPathByFilePath,crossFileResolvedPathByFilePath:te.crossFileResolvedPathByFilePath});if(ne.json)await vo(te.components,{outFile:"COMPONENT_API.json",...ne.jsonOptions,inputDir:Vt,entryExports:te.entryExports});if(ne.markdown)await Ao(te.components,{outFile:"COMPONENT_INDEX.md",...ne.markdownOptions,entryExports:te.entryExports});te.cache?.save()}async function qc(te,ne,Fe){if(ne.json){let Vt=xo(te.components,{...ne.jsonOptions,inputDir:Kc(Fe),entryExports:te.entryExports});process.stdout.write(Vt);return}if(ne.markdown){let Vt=ts(te.components,{...ne.markdownOptions,entryExports:te.entryExports});process.stdout.write(Vt)}}import{realpathSync as zc,statSync as Jm}from"node:fs";import{dirname as Xc,relative as Ym,resolve as Qm}from"node:path";function Zm(te){if(te.check&&!te.check.snapshotExists&&!te.writesSnapshot)return 1;if(te.check?.changes.some((ne)=>ne.kind==="schema"))return 1;if(te.errors.length>0)return 2;if(te.check&&xp(te.check.bump,te.checkLevel??"major"))return 3;if(jo(te.diagnostics,te.strict).length>0)return 4;return 0}async function Oe(te,ne,Fe=!1){let Vt=await Zi(te,ne.glob===!0,Qi(ne)),Gt=ne.check?await Ie(Vt.components,Sp(ne),{entryExports:Vt.entryExports}):void 0;return await(Fe?qc:ns)(Vt,ne,te),{result:Vt,check:Gt}}function eg(te){let ne=zc(Jm(te).isFile()?Xc(te):te),Fe=zc(process.env.GITHUB_WORKSPACE||process.cwd());return(Vt)=>n(Ym(Fe,Qm(ne,Vt)))}function Me(te,ne,Fe,Vt){let Gt=Fe.reportDiagnostics||Fe.strict,Kt=Bo(te.diagnostics,Gt);if(Gt&&Kt.length>0)if(Fe.format==="json")process.stderr.write(qo(Kt));else{if(Fe.format==="github"){let Ut=Ko(Kt,eg(Vt));if(Ut)console.error(Ut)}console.error(Uo(Kt))}let zt=Zm({errors:te.errors,check:ne,writesSnapshot:ne?bp(Fe,ne.snapshotFile):!1,checkLevel:Fe.checkLevel,diagnostics:Kt,strict:Fe.strict});return{diagnostics:Kt,exitCode:zt}}async function Ht(te){if(te&&"input"in te)throw Error("sveld: the `input` option was renamed to `entry`.");if(typeof te?.config==="string")throw Error("sveld: `config` takes `true` or `false`; import another config file and pass its options instead.");let{entry:ne,...Fe}=te??{},Vt=await G(Fe.config,process.cwd(),!0),Gt=Ks(ne??Vt.entry);if(Gt===null)throw Error(es);let Kt=O(Vt,Fe,{entry:Gt});W(Kt),U(Kt.quiet===!0);let{result:zt,check:Ut}=await Oe(Gt,Kt),{diagnostics:qt,exitCode:Xt}=Me(zt,Ut,Kt,Gt),Jt=qs(zt.components,{inputDir:Xc(Gt),entryExports:zt.entryExports,source:Kt.jsonOptions?.source});return{diagnostics:qt,check:Ut,errors:zt.errors,document:Jt,exitCode:Xt}}
|
|
193
|
+
export{v,M,F,x,N,ve,K,Ce,Te,z,C,p,o,i,P,t,A,c,m,w,Be,be,k,l,B,_,r,T,b,E,re,ie,a,q,je,R,j,h,u,X,d,se,Y,oe,Pe,Q,ae,Ve,Ae,le,Z,g,S,s,pe,Ge,We,He,ce,e,Ue,Je,ue,Ke,ze,qe,Xe,Ye,Qe,Ze,we,et,tt,ke,nt,rt,it,st,De,Ne,ot,_e,at,lt,D,pt,ct,ut,dt,ft,mt,ht,gt,yt,$e,xt,Et,St,vt,Ct,Tt,de,bt,Pt,At,Re,wt,kt,Dt,Nt,f,_t,$t,Rt,fe,me,V,It,Lt,Ot,he,ge,I,ye,L,n,Mt,y,Ft,Ie,xe,Bt,Ee,Wt,G,O,W,ee,H,U,Se,J,Le,jt,Oe,Me,Ht};
|