sveld 0.40.2 → 0.40.3
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/browser.js +123 -122
- package/{chunk-6hzm92zg.js → chunk-1pzasy7d.js} +1 -1
- package/{chunk-a6579404.js → chunk-m252rw53.js} +8 -8
- package/{chunk-tz95vn4s.js → chunk-r6xdep4j.js} +1 -1
- package/{chunk-atg0fsa6.js → chunk-ve0g5kge.js} +112 -111
- package/cli-entry.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
var E=Symbol("sveld.parsedComponentTypeScriptMetadata"),L=Symbol("sveld.parsedComponentPropIgnores");function
|
|
2
|
-
`,Gn);if(te===-1){Gn=Number.POSITIVE_INFINITY;return}Gn=te+1,Rn.push(Gn)}}function
|
|
1
|
+
var E=Symbol("sveld.parsedComponentTypeScriptMetadata"),L=Symbol("sveld.parsedComponentPropIgnores");function Eo(ee){return ee[L]}function So(ee){return ee[E]}var Gs=Array(2048).fill(void 0);function Lc(){Gs.fill(void 0)}function bo(ee,te,Oe,Ot){let jt=Ot&2047,Vt=Gs[jt];if(Vt!==void 0&&Vt.length===Oe-te&&ee.startsWith(Vt,te))return Vt;let Wt=ee.slice(te,Oe);return Gs[jt]=Wt,Wt}var ci="",Rn=[0],Gn=0,pi=0,Vn;function ne(ee){Lc(),ci=ee,Rn=[0],Gn=0,pi=0,Vn=void 0}function Ws(ee){while(Gn<=ee){let te=ci.indexOf(`
|
|
2
|
+
`,Gn);if(te===-1){Gn=Number.POSITIVE_INFINITY;return}Gn=te+1,Rn.push(Gn)}}function Co(ee){let te=[0],Oe=ee.indexOf(`
|
|
3
3
|
`);while(Oe!==-1)te.push(Oe+1),Oe=ee.indexOf(`
|
|
4
|
-
`,Oe+1);return te}function zi(ee,te,Oe){let Ot=0,jt=ee.length-1;if(te>=ee[Oe])Ot=Oe;else jt=Oe-1;if(Ot<jt&&te<ee[Ot+1])jt=Ot;while(Ot<jt){let Vt=Ot+jt+1>>>1;if(ee[Vt]<=te)Ot=Vt;else jt=Vt-1}return Ot}function x(ee){return Vs(ee),ai=zi(Rn,ee,ai),{line:ai+1,column:ee-Rn[ai],character:ee}}var Bs=/\r\n?|\n|\u2028|\u2029/g,Lc=/[\r\u2028\u2029]/;function So(ee){if(Vn===void 0){Vn=Lc.test(pi)?[]:null,Bs.lastIndex=0;while(Vn!==null&&Bs.exec(pi)!==null)Vn.push(Bs.lastIndex)}if(Vn===null)return Vs(ee),zi(Rn,ee,ai);let te=0,Oe=Vn.length;while(te<Oe){let Ot=te+Oe>>>1;if(Vn[Ot]<=ee)te=Ot+1;else Oe=Ot}return te}function D(ee){let{line:te,column:Oe}=x(ee);return{line:te,column:Oe}}function bo(ee){while(Rn.length<=ee+1&&Gn!==Number.POSITIVE_INFINITY)Vs(Gn);if(ee>=Rn.length)return;let te=ee+1<Rn.length?Rn[ee+1]-1:pi.length;return pi.slice(Rn[ee],te)}function ve(ee){let te,Oe=0;return(Ot)=>(te??=Eo(ee),Oe=zi(te,Ot,Oe),{line:Oe+1,column:Ot-te[Oe]})}function Mn(ee){return typeof ee==="object"&&ee!==null&&typeof Jn(ee).type==="string"}function Jn(ee){return ee}function H(ee,te){let Oe=Jn(ee);for(let Ot in Oe){let jt=Oe[Ot];if(Array.isArray(jt)){for(let Vt=0;Vt<jt.length;Vt++)if(Mn(jt[Vt]))jt[Vt]=te(jt[Vt])}else if(Mn(jt))Oe[Ot]=te(jt)}}function re(ee,...te){if(!te.some((Oe)=>Oe===ee.type))throw Error(`expected ${te.join(" or ")}, got ${ee.type}`)}function Se(ee){let te=[];return Yn(ee,te),te}function Yn(ee,te){switch(ee.type){case"Identifier":te.push(ee);return;case"ObjectPattern":for(let Oe of ee.properties)Yn(Oe.type==="RestElement"?Oe.argument:Oe.value,te);return;case"ArrayPattern":for(let Oe of ee.elements)if(Oe!==null)Yn(Oe,te);return;case"RestElement":Yn(ee.argument,te);return;case"AssignmentPattern":Yn(ee.left,te);return;case"TSParameterProperty":Yn(ee.parameter,te);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Yn(ee.expression,te)}}function U(ee,te){if(ee.type!=="Identifier")return!1;if(te===null)return!0;switch(te.type){case"MemberExpression":return te.computed||ee===te.object;case"MethodDefinition":return te.computed;case"Property":case"PropertyDefinition":return te.computed||ee===te.value;case"ExportSpecifier":case"ImportSpecifier":return ee===te.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 ee===te.expression;case"TSEnumMember":return ee===te.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!te.type.startsWith("TS")}}var Qn={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 on=[],ci={...Qn,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:on,TSTypeParameterDeclaration:on,TSTypeParameterInstantiation:on,TSTypeParameter:on,TSArrayType:on,TSTupleType:on,TSNamedTupleMember:on,TSOptionalType:on,TSRestType:on,TSUnionType:on,TSIntersectionType:on,TSConditionalType:on,TSInferType:on,TSParenthesizedType:on,TSTypeOperator:on,TSIndexedAccessType:on,TSMappedType:on,TSLiteralType:on,TSTypeReference:on,TSTypeQuery:on,TSImportType:on,TSTypeLiteral:on,TSPropertySignature:on,TSMethodSignature:on,TSCallSignatureDeclaration:on,TSConstructSignatureDeclaration:on,TSFunctionType:on,TSConstructorType:on,TSIndexSignature:on,TSTypePredicate:on,TSInterfaceDeclaration:on,TSInterfaceBody:on,TSExpressionWithTypeArguments:on,TSTypeAliasDeclaration:on,TSNamespaceExportDeclaration:on,TSDeclareFunction:["id"],TSDeclareMethod:on,TSAsExpression:["expression"],TSSatisfiesExpression:["expression"],TSTypeAssertion:["expression"],TSInstantiationExpression:["expression"]},Mc=Object.assign(Object.create(null),Qn),Fc=Object.assign(Object.create(null),ci),Co=[],v=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function o(ee,te,Oe){Xi(ee,null,null,null,te,Bc(Oe))}function Bc(ee){if(ee===void 0||ee===Qn)return Vc;if(ee===ci)return Gc;return(te)=>jc(ee,te.type)}function jc(ee,te){return Object.hasOwn(ee,te)?ee[te]:void 0}var Rm=Object.freeze([]);function Xi(ee,te,Oe,Ot,jt,Vt){let Wt=Vt(ee);if(Wt===void 0)throw Error(`unknown node type: ${ee.type}`);let Mt=jt.enter?.(ee,te,Oe,Ot);if(Mt===v)return!0;if(Mt!==p){if(Mt!==ee&&Mn(Mt))return Wc(Mt,te,Oe,Ot,jt,Vt);let Gt=Jn(ee);for(let Ut=0;Ut<Wt.length;Ut++){let Ht=Wt[Ut],qt=Gt[Ht];if(Array.isArray(qt))for(let zt=0;zt<qt.length;zt++){let Xt=qt[zt];if(Mn(Xt)&&Xi(Xt,ee,Ht,zt,jt,Vt))return!0}else if(Mn(qt)&&Xi(qt,ee,Ht,null,jt,Vt))return!0}}return jt.leave?.(ee,te,Oe,Ot)===v}function Vc(ee){let te=ee.type;if(te==="Identifier")return ee.typeAnnotation===void 0&&ee.decorators===void 0?Co:Qn.Identifier;if(te==="Literal")return Qn.Literal;if(te==="Text")return Qn.Text;return Mc[te]}function Gc(ee){let te=ee.type;if(te==="Identifier")return ee.decorators===void 0?Co:ci.Identifier;if(te==="Literal")return ci.Literal;if(te==="Text")return ci.Text;return Fc[te]}function Wc(ee,te,Oe,Ot,jt,Vt){if(te===null||Oe===null)throw Error("walk can't replace the node it was called with");let Wt=Jn(te),Mt=Wt[Oe];if(Ot===null)Wt[Oe]=ee;else if(Array.isArray(Mt))Mt[Ot]=ee;return Xi(ee,te,Oe,Ot,jt,Vt)}function r(ee){return typeof ee==="object"&&ee!==null}function b(ee){return r(ee)&&ee.type==="Literal"}function t(ee){return r(ee)&&ee.type==="Identifier"&&typeof ee.name==="string"}function T(ee){return r(ee)&&ee.type==="MemberExpression"}function c(ee){return r(ee)&&ee.type==="ObjectExpression"&&Array.isArray(ee.properties)}function Uc(ee){return r(ee)&&ee.type==="CallExpression"}function m(ee,te){return Uc(ee)&&t(ee.callee)&&ee.callee.name===te}function C(ee){return ee?.type==="TSAsExpression"||ee?.type==="TSSatisfiesExpression"?C(ee.expression):ee}function Me(ee){return ee?.type==="TSAsExpression"||ee?.type==="TSSatisfiesExpression"?ee.typeAnnotation:void 0}function Hc(ee){return r(ee)&&ee.type==="NewExpression"}function be(ee,te){return Hc(ee)&&t(ee.callee)&&ee.callee.name===te}function k(ee){if(!r(ee))return null;if(ee.type==="Literal")return ee.value==null?null:String(ee.value);if(ee.type==="TemplateLiteral"){let te=ee.quasis;if(te?.length===1)return te[0]?.value?.cooked??null}return null}function l(ee){if(t(ee))return ee.name;if(b(ee))return ee.value==null?void 0:String(ee.value);return}var Kc=new Set(["Component","SvelteComponent","SvelteSelf"]),qc=new Set(["RegularElement","SvelteElement"]);function O(ee){return Kc.has(ee)}function N(ee){return qc.has(ee)}function Ji(ee,te,Oe=0,Ot=ee.length,jt=0){let Vt=jt;for(let Wt=Oe;Wt<Ot;Wt++){let Mt=ee.charCodeAt(Wt);if(Mt===34||Mt===39||Mt===96){Wt=zc(ee,Wt,Ot);continue}if(Mt===123||Mt===40||Mt===91||Mt===60)Vt++;else if(Mt===125||Mt===41||Mt===93||Mt===62&&ee.charCodeAt(Wt-1)!==61){if(Vt>0)Vt--}if(te?.(Wt,Vt)===!0)break}return Vt}function zc(ee,te,Oe){let Ot=ee.charCodeAt(te);for(let jt=te+1;jt<Oe;jt++){let Vt=ee.charCodeAt(jt);if(Vt===92)jt++;else if(Vt===Ot)return jt}return Oe-1}function i(ee,te){let Oe=[],Ot=0;return Ji(ee,(jt,Vt)=>{if(Vt===0&&te.includes(ee[jt]))Oe.push(ee.slice(Ot,jt)),Ot=jt+1;return!1}),Oe.push(ee.slice(Ot)),Oe}function Gs(ee,te,Oe=0){let Ot=-1;return Ji(ee,(jt,Vt)=>{if(te(jt,Vt))Ot=jt;return Ot!==-1},Oe),Ot}function z(ee,te){return Gs(ee,(Oe,Ot)=>Ot===0&&te.includes(ee[Oe]))}function w(ee){return Gs(ee,(te,Oe)=>Oe===0&&ee[te]==="="&&ee[te+1]===">")}function P(ee,te){return Gs(ee,(Oe,Ot)=>Ot===0,te)}function Ws(ee){let te=ee.trim();return te.startsWith("[")&&P(te,0)===te.length-1}function ie(ee){if(!ee)return;let te=w(ee);if(te===-1)return;return ee.slice(te+2).trim()||void 0}var Xc=new Set(["null","undefined"]);function se(ee){if(!ee)return!1;let te=i(ee,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!Xc.has(Ot));if(te.length!==1)return!1;let[Oe]=te;while(Oe.startsWith("(")&&P(Oe,0)===Oe.length-1)Oe=Oe.slice(1,-1).trim();return(Oe.startsWith("(")||Oe.startsWith("<"))&&w(Oe)!==-1}function Jc(ee){let te="";for(let Oe=0;Oe<ee.length;Oe++){let Ot=ee[Oe];if(Ot==="*"&&ee[Oe+1]==="*"){if(Oe++,ee[Oe+1]==="/")te+="(?:.*/)?",Oe++;else te+=".*";continue}if(Ot==="*"){te+="[^/]*";continue}if(Ot==="?"){te+="[^/]";continue}te+=".+^$()[]{}|\\".includes(Ot)?`\\${Ot}`:Ot}return te}function wo(ee,te){return new RegExp(`^${Jc(ee)}$`).test(te)}var Us={"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(ee){return{...ee,code:J[ee.kind],severity:Us[ee.kind].severity}}function To(ee,te){if(te)return ee;return ee.filter((Oe)=>Oe.kind!=="jsdoc-unknown-tag")}function ko(ee,te){if(!te)return[];return ee.filter((Oe)=>!Oe.ignored&&(te!=="errors"||Oe.severity==="error"))}function Yc(ee,te){if(te.code!==void 0&&te.code!==ee.code)return!1;if(te.name!==void 0&&te.name!==ee.name)return!1;if(te.component!==void 0&&!wo(te.component,ee.component))return!1;return!0}function Ao(ee,te){if(!te||te.length===0)return ee;return ee.map((Oe)=>Oe.ignored||te.some((Ot)=>Yc(Oe,Ot))?{...Oe,ignored:!0}:Oe)}var Po=Object.keys(Us),J=Object.fromEntries(Po.map((ee)=>[ee,`sveld/${ee}`]));function _o(ee){let te=new Set,Oe=[];for(let Ot of ee){let jt=`${Ot.component}:${Ot.kind}:${Ot.name}`;if(te.has(jt))continue;te.add(jt),Oe.push(Ot)}return Oe}function $o(ee){let te=ee.filter((Gt)=>!Gt.ignored),Oe=ee.length-te.length,Ot=Oe>0?` (${Oe} ignored)`:"";if(te.length===0)return`sveld: no diagnostics${Ot}.`;let jt=[],Vt=(Gt,Ut)=>`${Gt} ${Ut}${Gt===1?"":"s"}`,Wt=te.filter((Gt)=>Gt.severity==="error").length,Mt=`${Vt(Wt,"error")}, ${Vt(te.length-Wt,"warning")}`;jt.push(`sveld: ${Vt(te.length,"diagnostic")} (${Mt})${Ot}.`);for(let Gt of Po){let Ut=te.filter((qt)=>qt.kind===Gt);if(Ut.length===0)continue;jt.push(""),jt.push(`${Us[Gt].label} (${Ut.length}):`);let Ht=new Map;for(let qt of Ut){let zt=Ht.get(qt.component)??[];zt.push(qt),Ht.set(qt.component,zt)}for(let[qt,zt]of Ht){jt.push(` ${qt}`);for(let Xt of zt){let Jt=Xt.source?` (${qt}:${Xt.source.start.line}:${Xt.source.start.column})`:"";jt.push(` - ${Xt.message}${Jt} [${Xt.code}]`)}}}return jt.join(`
|
|
5
|
-
`)}function
|
|
6
|
-
`,"%0A")}function
|
|
7
|
-
`)}var Fe=1;function
|
|
8
|
-
`}function
|
|
9
|
-
Defaulting to 2020, but this will stop working in the future.`);te.ecmaVersion=11}else if(te.ecmaVersion>=2015)te.ecmaVersion-=2009;if(te.allowReserved==null)te.allowReserved=te.ecmaVersion<5;if(!ee||ee.allowHashBang==null)te.allowHashBang=te.ecmaVersion>=14;if(
|
|
10
|
-
`,Oe-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(En).length}else this.lineStart=0;if(this.type=Kt.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=ee.sourceType==="module",this.strict=this.inModule||ee.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&&ee.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?ei:Zn),this.regexpState=null,this.privateNameStack=[]},Tn={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 ee=this,te=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return ee.parseTopLevel(te)})};Tn.inFunction.get=function(){return(this.currentVarScope().flags&ei)>0};Tn.inGenerator.get=function(){return(this.currentVarScope().flags&Go)>0};Tn.inAsync.get=function(){return(this.currentVarScope().flags&Ys)>0};Tn.canAwait.get=function(){for(var ee=this.scopeStack.length-1;ee>=0;ee--){var te=this.scopeStack[ee],Oe=te.flags;if(Oe&(ti|wi))return!1;if(Oe&ei)return(Oe&Ys)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Tn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Zn)return!0;return!1};Tn.allowSuper.get=function(){var ee=this.currentThisScope(),te=ee.flags;return(te&is)>0||this.options.allowSuperOutsideMethod};Tn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Uo)>0};Tn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Tn.allowNewDotTarget.get=function(){for(var ee=this.scopeStack.length-1;ee>=0;ee--){var te=this.scopeStack[ee],Oe=te.flags;if(Oe&(ti|wi)||Oe&ei&&!(Oe&Qs))return!0}return!1};Tn.allowUsing.get=function(){var ee=this.currentScope(),te=ee.flags;if(te&Ho)return!1;if(!this.inModule&&te&Zn)return!1;return!0};Tn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ti)>0};s.extend=function(){var ee=[],te=arguments.length;while(te--)ee[te]=arguments[te];var Oe=this;for(var Ot=0;Ot<ee.length;Ot++)Oe=ee[Ot](Oe);return Oe};s.parse=function(ee,te){return new this(te,ee).parse()};s.parseExpressionAt=function(ee,te,Oe){var Ot=new this(Oe,ee,te);return Ot.nextToken(),Ot.parseExpression()};s.tokenizer=function(ee,te){return new this(te,ee)};Object.defineProperties(s.prototype,Tn);var gn=s.prototype,vl=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;gn.strictDirective=function(ee){if(this.options.ecmaVersion<5)return!1;for(;;){dn.lastIndex=ee,ee+=dn.exec(this.input)[0].length;var te=vl.exec(this.input.slice(ee));if(!te)return!1;if((te[1]||te[2])==="use strict"){dn.lastIndex=ee+te[0].length;var Oe=dn.exec(this.input),Ot=Oe.index+Oe[0].length,jt=this.input.charAt(Ot);return jt===";"||jt==="}"||En.test(Oe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(jt)||jt==="!"&&this.input.charAt(Ot+1)==="=")}if(ee+=te[0].length,dn.lastIndex=ee,ee+=dn.exec(this.input)[0].length,this.input[ee]===";")ee++}};gn.eat=function(ee){if(this.type===ee)return this.next(),!0;else return!1};gn.isContextual=function(ee){return this.type===Kt.name&&this.value===ee&&!this.containsEsc};gn.eatContextual=function(ee){if(!this.isContextual(ee))return!1;return this.next(),!0};gn.catchStackOverflow=function(ee){try{return ee()}catch(te){if(te instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(te.message)||/\btoo much recursion\b/i.test(te.message)))this.raise(this.start,"Not enough stack space to parse input");else throw te}};gn.expectContextual=function(ee){if(!this.eatContextual(ee))this.unexpected()};gn.canInsertSemicolon=function(){return this.type===Kt.eof||this.type===Kt.braceR||En.test(this.input.slice(this.lastTokEnd,this.start))};gn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};gn.semicolon=function(){if(!this.eat(Kt.semi)&&!this.insertSemicolon())this.unexpected()};gn.afterTrailingComma=function(ee,te){if(this.type===ee){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!te)this.next();return!0}};gn.expect=function(ee){this.eat(ee)||this.unexpected()};gn.unexpected=function(ee){this.raise(ee!=null?ee:this.start,"Unexpected token")};var rs=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};gn.checkPatternErrors=function(ee,te){if(!ee)return;if(ee.trailingComma>-1)this.raiseRecoverable(ee.trailingComma,"Comma is not permitted after the rest element");var Oe=te?ee.parenthesizedAssign:ee.parenthesizedBind;if(Oe>-1)this.raiseRecoverable(Oe,te?"Assigning to rvalue":"Parenthesized pattern")};gn.checkExpressionErrors=function(ee,te){if(!ee)return!1;var{shorthandAssign:Oe,doubleProto:Ot}=ee;if(!te)return Oe>=0||Ot>=0;if(Oe>=0)this.raise(Oe,"Shorthand property assignments are valid only in destructuring patterns");if(Ot>=0)this.raiseRecoverable(Ot,"Redefinition of __proto__ property")};gn.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")};gn.isSimpleAssignTarget=function(ee){if(ee.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(ee.expression);return ee.type==="Identifier"||ee.type==="MemberExpression"};var Zt=s.prototype;Zt.parseTopLevel=function(ee){var te=Object.create(null);if(!ee.body)ee.body=[];while(this.type!==Kt.eof){var Oe=this.parseStatement(null,!0,te);ee.body.push(Oe)}if(this.inModule)for(var Ot=0,jt=Object.keys(this.undefinedExports);Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.raiseRecoverable(this.undefinedExports[Vt].start,"Export '"+Vt+"' is not defined")}return this.adaptDirectivePrologue(ee.body),this.next(),ee.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(ee,"Program")};var tr={kind:"loop"},El={kind:"switch"};Zt.isLet=function(ee){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;dn.lastIndex=this.pos;var te=dn.exec(this.input),Oe=this.pos+te[0].length,Ot=this.fullCharCodeAt(Oe);if(Ot===91||Ot===92)return!0;if(ee)return!1;if(Ot===123)return!0;if(g(Ot)){var jt=Oe;do Oe+=Ot<=65535?1:2;while(S(Ot=this.fullCharCodeAt(Oe)));if(Ot===92)return!0;var Vt=this.input.slice(jt,Oe);if(!Fo.test(Vt))return!0}return!1};Zt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dn.lastIndex=this.pos;var ee=dn.exec(this.input),te=this.pos+ee[0].length,Oe;return!En.test(this.input.slice(this.pos,te))&&this.input.slice(te,te+8)==="function"&&(te+8===this.input.length||!(S(Oe=this.fullCharCodeAt(te+8))||Oe===92))};Zt.isUsingKeyword=function(ee,te){if(this.options.ecmaVersion<17||!this.isContextual(ee?"await":"using"))return!1;dn.lastIndex=this.pos;var Oe=dn.exec(this.input),Ot=this.pos+Oe[0].length;if(En.test(this.input.slice(this.pos,Ot)))return!1;if(ee){var jt=Ot+5,Vt;if(this.input.slice(Ot,jt)!=="using"||jt===this.input.length||S(Vt=this.fullCharCodeAt(jt))||Vt===92)return!1;dn.lastIndex=jt;var Wt=dn.exec(this.input);if(Ot=jt+Wt[0].length,Wt&&En.test(this.input.slice(jt,Ot)))return!1}var Mt=this.fullCharCodeAt(Ot);if(!g(Mt)&&Mt!==92)return!1;var Gt=Ot;do Ot+=Mt<=65535?1:2;while(S(Mt=this.fullCharCodeAt(Ot)));if(Mt===92)return!0;var Ut=this.input.slice(Gt,Ot);if(Fo.test(Ut))return!1;if(te&&!ee&&Ut==="of"){dn.lastIndex=Ot;var Ht=dn.exec(this.input);if(Ot=Ot+Ht[0].length,this.input.charCodeAt(Ot)!==61||(Mt=this.input.charCodeAt(Ot+1))===61||Mt===62)return!1}return!0};Zt.isAwaitUsing=function(ee){return this.isUsingKeyword(!0,ee)};Zt.isUsing=function(ee){return this.isUsingKeyword(!1,ee)};Zt.parseStatement=function(ee,te,Oe){var Ot=this.type,jt=this.startNode(),Vt;if(this.isLet(ee))Ot=Kt._var,Vt="let";switch(Ot){case Kt._break:case Kt._continue:return this.parseBreakContinueStatement(jt,Ot.keyword);case Kt._debugger:return this.parseDebuggerStatement(jt);case Kt._do:return this.parseDoStatement(jt);case Kt._for:return this.parseForStatement(jt);case Kt._function:if(ee&&(this.strict||ee!=="if"&&ee!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(jt,!1,!ee);case Kt._class:if(ee)this.unexpected();return this.parseClass(jt,!0);case Kt._if:return this.parseIfStatement(jt);case Kt._return:return this.parseReturnStatement(jt);case Kt._switch:return this.parseSwitchStatement(jt);case Kt._throw:return this.parseThrowStatement(jt);case Kt._try:return this.parseTryStatement(jt);case Kt._const:case Kt._var:if(Vt=Vt||this.value,ee&&Vt!=="var")this.unexpected();return this.parseVarStatement(jt,Vt);case Kt._while:return this.parseWhileStatement(jt);case Kt._with:return this.parseWithStatement(jt);case Kt.braceL:return this.parseBlock(!0,jt);case Kt.semi:return this.parseEmptyStatement(jt);case Kt._export:case Kt._import:if(this.options.ecmaVersion>10&&Ot===Kt._import){dn.lastIndex=this.pos;var Wt=dn.exec(this.input),Mt=this.pos+Wt[0].length,Gt=this.input.charCodeAt(Mt);if(Gt===40||Gt===46)return this.parseExpressionStatement(jt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!te)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 Ot===Kt._import?this.parseImport(jt):this.parseExport(jt,Oe);default:if(this.isAsyncFunction()){if(ee)this.unexpected();return this.next(),this.parseFunctionStatement(jt,!0,!ee)}var Ut=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Ut){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(ee)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Ut==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(jt,!1,Ut),this.semicolon(),this.finishNode(jt,"VariableDeclaration")}var Ht=this.value,qt=this.parseExpression();if(Ot===Kt.name&&qt.type==="Identifier"&&this.eat(Kt.colon))return this.parseLabeledStatement(jt,Ht,qt,ee);else return this.parseExpressionStatement(jt,qt)}};Zt.parseBreakContinueStatement=function(ee,te){var Oe=te==="break";if(this.next(),this.eat(Kt.semi)||this.insertSemicolon())ee.label=null;else if(this.type!==Kt.name)this.unexpected();else ee.label=this.parseIdent(),this.semicolon();var Ot=0;for(;Ot<this.labels.length;++Ot){var jt=this.labels[Ot];if(ee.label==null||jt.name===ee.label.name){if(jt.kind!=null&&(Oe||jt.kind==="loop"))break;if(ee.label&&Oe)break}}if(Ot===this.labels.length)this.raise(ee.start,"Unsyntactic "+te);return this.finishNode(ee,Oe?"BreakStatement":"ContinueStatement")};Zt.parseDebuggerStatement=function(ee){return this.next(),this.semicolon(),this.finishNode(ee,"DebuggerStatement")};Zt.parseDoStatement=function(ee){if(this.next(),this.labels.push(tr),ee.body=this.parseStatement("do"),this.labels.pop(),this.expect(Kt._while),ee.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Kt.semi);else this.semicolon();return this.finishNode(ee,"DoWhileStatement")};Zt.parseForStatement=function(ee){this.next();var te=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(tr),this.enterScope(0),this.expect(Kt.parenL),this.type===Kt.semi){if(te>-1)this.unexpected(te);return this.parseFor(ee,null)}var Oe=this.isLet();if(this.type===Kt._var||this.type===Kt._const||Oe){var Ot=this.startNode(),jt=Oe?"let":this.value;return this.next(),this.parseVar(Ot,!0,jt),this.finishNode(Ot,"VariableDeclaration"),this.parseForAfterInit(ee,Ot,te)}var Vt=this.isContextual("let"),Wt=!1,Mt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Mt){var Gt=this.startNode();if(this.next(),Mt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Gt,!0,Mt),this.finishNode(Gt,"VariableDeclaration"),this.parseForAfterInit(ee,Gt,te)}var Ut=this.containsEsc,Ht=new rs,qt=this.start,zt=te>-1?this.parseExprSubscripts(Ht,"await"):this.parseExpression(!0,Ht);if(this.type===Kt._in||(Wt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(te>-1){if(this.type===Kt._in)this.unexpected(te);ee.await=!0}else if(Wt&&this.options.ecmaVersion>=8){if(zt.start===qt&&!Ut&&zt.type==="Identifier"&&zt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)ee.await=!1}if(Vt&&Wt)this.raise(zt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(zt,!1,Ht),this.checkLValPattern(zt),this.parseForIn(ee,zt)}else this.checkExpressionErrors(Ht,!0);if(te>-1)this.unexpected(te);return this.parseFor(ee,zt)};Zt.parseForAfterInit=function(ee,te,Oe){if((this.type===Kt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&te.declarations.length===1){if(this.type===Kt._in){if((te.kind==="using"||te.kind==="await using")&&!te.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Oe>-1)this.unexpected(Oe)}else if(this.options.ecmaVersion>=9)ee.await=Oe>-1;return this.parseForIn(ee,te)}if(Oe>-1)this.unexpected(Oe);return this.parseFor(ee,te)};Zt.parseFunctionStatement=function(ee,te,Oe){return this.next(),this.parseFunction(ee,Si|(Oe?0:zs),!1,te)};Zt.parseIfStatement=function(ee){return this.next(),ee.test=this.parseParenExpression(),ee.consequent=this.parseStatement("if"),ee.alternate=this.eat(Kt._else)?this.parseStatement("if"):null,this.finishNode(ee,"IfStatement")};Zt.parseReturnStatement=function(ee){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Kt.semi)||this.insertSemicolon())ee.argument=null;else ee.argument=this.parseExpression(),this.semicolon();return this.finishNode(ee,"ReturnStatement")};Zt.parseSwitchStatement=function(ee){this.next(),ee.discriminant=this.parseParenExpression(),ee.cases=[],this.expect(Kt.braceL),this.labels.push(El),this.enterScope(Ho);var te;for(var Oe=!1;this.type!==Kt.braceR;)if(this.type===Kt._case||this.type===Kt._default){var Ot=this.type===Kt._case;if(te)this.finishNode(te,"SwitchCase");if(ee.cases.push(te=this.startNode()),te.consequent=[],this.next(),Ot)te.test=this.parseExpression();else{if(Oe)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Oe=!0,te.test=null}this.expect(Kt.colon)}else{if(!te)this.unexpected();te.consequent.push(this.parseStatement(null))}if(this.exitScope(),te)this.finishNode(te,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(ee,"SwitchStatement")};Zt.parseThrowStatement=function(ee){if(this.next(),En.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return ee.argument=this.parseExpression(),this.semicolon(),this.finishNode(ee,"ThrowStatement")};var Sl=[];Zt.parseCatchClauseParam=function(){var ee=this.parseBindingAtom(),te=ee.type==="Identifier";return this.enterScope(te?Wo:0),this.checkLValPattern(ee,te?qo:Fn),this.expect(Kt.parenR),ee};Zt.parseTryStatement=function(ee){if(this.next(),ee.block=this.parseBlock(),ee.handler=null,this.type===Kt._catch){var te=this.startNode();if(this.next(),this.eat(Kt.parenL))te.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();te.param=null,this.enterScope(0)}te.body=this.parseBlock(!1),this.exitScope(),ee.handler=this.finishNode(te,"CatchClause")}if(ee.finalizer=this.eat(Kt._finally)?this.parseBlock():null,!ee.handler&&!ee.finalizer)this.raise(ee.start,"Missing catch or finally clause");return this.finishNode(ee,"TryStatement")};Zt.parseVarStatement=function(ee,te,Oe){return this.next(),this.parseVar(ee,!1,te,Oe),this.semicolon(),this.finishNode(ee,"VariableDeclaration")};Zt.parseWhileStatement=function(ee){return this.next(),ee.test=this.parseParenExpression(),this.labels.push(tr),ee.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(ee,"WhileStatement")};Zt.parseWithStatement=function(ee){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),ee.object=this.parseParenExpression(),ee.body=this.parseStatement("with"),this.finishNode(ee,"WithStatement")};Zt.parseEmptyStatement=function(ee){return this.next(),this.finishNode(ee,"EmptyStatement")};Zt.parseLabeledStatement=function(ee,te,Oe,Ot){for(var jt=0,Vt=this.labels;jt<Vt.length;jt+=1){var Wt=Vt[jt];if(Wt.name===te)this.raise(Oe.start,"Label '"+te+"' is already declared")}var Mt=this.type.isLoop?"loop":this.type===Kt._switch?"switch":null;for(var Gt=this.labels.length-1;Gt>=0;Gt--){var Ut=this.labels[Gt];if(Ut.statementStart===ee.start)Ut.statementStart=this.start,Ut.kind=Mt;else break}return this.labels.push({name:te,kind:Mt,statementStart:this.start}),ee.body=this.parseStatement(Ot?Ot.indexOf("label")===-1?Ot+"label":Ot:"label"),this.labels.pop(),ee.label=Oe,this.finishNode(ee,"LabeledStatement")};Zt.parseExpressionStatement=function(ee,te){return ee.expression=te,this.semicolon(),this.finishNode(ee,"ExpressionStatement")};Zt.parseBlock=function(ee,te,Oe){if(ee===void 0)ee=!0;if(te===void 0)te=this.startNode();if(te.body=[],this.expect(Kt.braceL),ee)this.enterScope(0);while(this.type!==Kt.braceR){var Ot=this.parseStatement(null);te.body.push(Ot)}if(Oe)this.strict=!1;if(this.next(),ee)this.exitScope();return this.finishNode(te,"BlockStatement")};Zt.parseFor=function(ee,te){return ee.init=te,this.expect(Kt.semi),ee.test=this.type===Kt.semi?null:this.parseExpression(),this.expect(Kt.semi),ee.update=this.type===Kt.parenR?null:this.parseExpression(),this.expect(Kt.parenR),ee.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(ee,"ForStatement")};Zt.parseForIn=function(ee,te){var Oe=this.type===Kt._in;if(this.next(),te.type==="VariableDeclaration"&&te.declarations[0].init!=null&&(!Oe||this.options.ecmaVersion<8||this.strict||te.kind!=="var"||te.declarations[0].id.type!=="Identifier"))this.raise(te.start,(Oe?"for-in":"for-of")+" loop variable declaration may not have an initializer");return ee.left=te,ee.right=Oe?this.parseExpression():this.parseMaybeAssign(),this.expect(Kt.parenR),ee.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(ee,Oe?"ForInStatement":"ForOfStatement")};Zt.parseVar=function(ee,te,Oe,Ot){ee.declarations=[],ee.kind=Oe;for(;;){var jt=this.startNode();if(this.parseVarId(jt,Oe),this.eat(Kt.eq))jt.init=this.parseMaybeAssign(te);else if(!Ot&&Oe==="const"&&!(this.type===Kt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ot&&(Oe==="using"||Oe==="await using")&&this.options.ecmaVersion>=17&&this.type!==Kt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Oe+" declaration");else if(!Ot&&jt.id.type!=="Identifier"&&!(te&&(this.type===Kt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else jt.init=null;if(ee.declarations.push(this.finishNode(jt,"VariableDeclarator")),!this.eat(Kt.comma))break}return ee};Zt.parseVarId=function(ee,te){ee.id=te==="using"||te==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(ee.id,te==="var"?er:Fn,!1)};var Si=1,zs=2,Xo=4;Zt.parseFunction=function(ee,te,Oe,Ot,jt){if(this.initFunction(ee),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ot){if(this.type===Kt.star&&te&zs)this.unexpected();ee.generator=this.eat(Kt.star)}if(this.options.ecmaVersion>=8)ee.async=!!Ot;if(te&Si){if(ee.id=te&Xo&&this.type!==Kt.name?null:this.parseIdent(),ee.id&&!(te&zs))this.checkLValSimple(ee.id,this.strict||ee.generator||ee.async?this.treatFunctionsAsVar?er:Fn:Ko)}var Vt=this.yieldPos,Wt=this.awaitPos,Mt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Zs(ee.async,ee.generator)),!(te&Si))ee.id=this.type===Kt.name?this.parseIdent():null;return this.parseFunctionParams(ee),this.parseFunctionBody(ee,Oe,!1,jt),this.yieldPos=Vt,this.awaitPos=Wt,this.awaitIdentPos=Mt,this.finishNode(ee,te&Si?"FunctionDeclaration":"FunctionExpression")};Zt.parseFunctionParams=function(ee){this.expect(Kt.parenL),ee.params=this.parseBindingList(Kt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Zt.parseClass=function(ee,te){this.next();var Oe=this.strict;this.strict=!0,this.parseClassId(ee,te),this.parseClassSuper(ee);var Ot=this.enterClassBody(),jt=this.startNode(),Vt=!1;jt.body=[],this.expect(Kt.braceL);while(this.type!==Kt.braceR){var Wt=this.parseClassElement(ee.superClass!==null);if(Wt){if(jt.body.push(Wt),Wt.type==="MethodDefinition"&&Wt.kind==="constructor"){if(Vt)this.raiseRecoverable(Wt.start,"Duplicate constructor in the same class");Vt=!0}else if(Wt.key&&Wt.key.type==="PrivateIdentifier"&&bl(Ot,Wt))this.raiseRecoverable(Wt.key.start,"Identifier '#"+Wt.key.name+"' has already been declared")}}return this.strict=Oe,this.next(),ee.body=this.finishNode(jt,"ClassBody"),this.exitClassBody(),this.finishNode(ee,te?"ClassDeclaration":"ClassExpression")};Zt.parseClassElement=function(ee){if(this.eat(Kt.semi))return null;var te=this.options.ecmaVersion,Oe=this.startNode(),Ot="",jt=!1,Vt=!1,Wt="method",Mt=!1;if(this.eatContextual("static")){if(te>=13&&this.eat(Kt.braceL))return this.parseClassStaticBlock(Oe),Oe;if(this.isClassElementNameStart()||this.type===Kt.star)Mt=!0;else Ot="static"}if(Oe.static=Mt,!Ot&&te>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Kt.star)&&!this.canInsertSemicolon())Vt=!0;else Ot="async";if(!Ot&&(te>=9||!Vt)&&this.eat(Kt.star))jt=!0;if(!Ot&&!Vt&&!jt){var Gt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Wt=Gt;else Ot=Gt}if(Ot)Oe.computed=!1,Oe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Oe.key.name=Ot,this.finishNode(Oe.key,"Identifier");else this.parseClassElementName(Oe);if(te<13||this.type===Kt.parenL||Wt!=="method"||jt||Vt){var Ut=!Oe.static&&Zi(Oe,"constructor"),Ht=Ut&ⅇif(Ut&&Wt!=="method")this.raise(Oe.key.start,"Constructor can't have get/set modifier");Oe.kind=Ut?"constructor":Wt,this.parseClassMethod(Oe,jt,Vt,Ht)}else this.parseClassField(Oe);return Oe};Zt.isClassElementNameStart=function(){return this.type===Kt.name||this.type===Kt.privateId||this.type===Kt.num||this.type===Kt.string||this.type===Kt.bracketL||this.type.keyword};Zt.parseClassElementName=function(ee){if(this.type===Kt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");ee.computed=!1,ee.key=this.parsePrivateIdent()}else this.parsePropertyName(ee)};Zt.parseClassMethod=function(ee,te,Oe,Ot){var jt=ee.key;if(ee.kind==="constructor"){if(te)this.raise(jt.start,"Constructor can't be a generator");if(Oe)this.raise(jt.start,"Constructor can't be an async method")}else if(ee.static&&Zi(ee,"prototype"))this.raise(jt.start,"Classes may not have a static property named prototype");var Vt=ee.value=this.parseMethod(te,Oe,Ot);if(ee.kind==="get"&&Vt.params.length!==0)this.raiseRecoverable(Vt.start,"getter should have no params");if(ee.kind==="set"&&Vt.params.length!==1)this.raiseRecoverable(Vt.start,"setter should have exactly one param");if(ee.kind==="set"&&Vt.params[0].type==="RestElement")this.raiseRecoverable(Vt.params[0].start,"Setter cannot use rest params");return this.finishNode(ee,"MethodDefinition")};Zt.parseClassField=function(ee){if(Zi(ee,"constructor"))this.raise(ee.key.start,"Classes can't have a field named 'constructor'");else if(ee.static&&Zi(ee,"prototype"))this.raise(ee.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Kt.eq))this.enterScope(wi|is),ee.value=this.parseMaybeAssign(),this.exitScope();else ee.value=null;return this.semicolon(),this.finishNode(ee,"PropertyDefinition")};Zt.parseClassStaticBlock=function(ee){ee.body=[];var te=this.labels;this.labels=[],this.enterScope(ti|is);while(this.type!==Kt.braceR){var Oe=this.parseStatement(null);ee.body.push(Oe)}return this.next(),this.exitScope(),this.labels=te,this.finishNode(ee,"StaticBlock")};Zt.parseClassId=function(ee,te){if(this.type===Kt.name){if(ee.id=this.parseIdent(),te)this.checkLValSimple(ee.id,Fn,!1)}else{if(te===!0)this.unexpected();ee.id=null}};Zt.parseClassSuper=function(ee){ee.superClass=this.eat(Kt._extends)?this.parseExprSubscripts(null,!1):null};Zt.enterClassBody=function(){var ee={declared:Object.create(null),used:[]};return this.privateNameStack.push(ee),ee.declared};Zt.exitClassBody=function(){var ee=this.privateNameStack.pop(),{declared:te,used:Oe}=ee;if(!this.options.checkPrivateFields)return;var Ot=this.privateNameStack.length,jt=Ot===0?null:this.privateNameStack[Ot-1];for(var Vt=0;Vt<Oe.length;++Vt){var Wt=Oe[Vt];if(!Ci(te,Wt.name))if(jt)jt.used.push(Wt);else this.raiseRecoverable(Wt.start,"Private field '#"+Wt.name+"' must be declared in an enclosing class")}};function bl(ee,te){var Oe=te.key.name,Ot=ee[Oe],jt="true";if(te.type==="MethodDefinition"&&(te.kind==="get"||te.kind==="set"))jt=(te.static?"s":"i")+te.kind;if(Ot==="iget"&&jt==="iset"||Ot==="iset"&&jt==="iget"||Ot==="sget"&&jt==="sset"||Ot==="sset"&&jt==="sget")return ee[Oe]="true",!1;else if(!Ot)return ee[Oe]=jt,!1;else return!0}function Zi(ee,te){var{computed:Oe,key:Ot}=ee;return!Oe&&(Ot.type==="Identifier"&&Ot.name===te||Ot.type==="Literal"&&Ot.value===te)}Zt.parseExportAllDeclaration=function(ee,te){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))ee.exported=this.parseModuleExportName(),this.checkExport(te,ee.exported,this.lastTokStart);else ee.exported=null;if(this.expectContextual("from"),this.type!==Kt.string)this.unexpected();if(ee.source=this.parseExprAtom(),this.options.ecmaVersion>=16)ee.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(ee,"ExportAllDeclaration")};Zt.parseExport=function(ee,te){if(this.next(),this.eat(Kt.star))return this.parseExportAllDeclaration(ee,te);if(this.eat(Kt._default))return this.checkExport(te,"default",this.lastTokStart),ee.declaration=this.parseExportDefaultDeclaration(),this.finishNode(ee,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(ee.declaration=this.parseExportDeclaration(ee),ee.declaration.type==="VariableDeclaration")this.checkVariableExport(te,ee.declaration.declarations);else this.checkExport(te,ee.declaration.id,ee.declaration.id.start);if(ee.specifiers=[],ee.source=null,this.options.ecmaVersion>=16)ee.attributes=[]}else{if(ee.declaration=null,ee.specifiers=this.parseExportSpecifiers(te),this.eatContextual("from")){if(this.type!==Kt.string)this.unexpected();if(ee.source=this.parseExprAtom(),this.options.ecmaVersion>=16)ee.attributes=this.parseWithClause()}else{for(var Oe=0,Ot=ee.specifiers;Oe<Ot.length;Oe+=1){var jt=Ot[Oe];if(this.checkUnreserved(jt.local),this.checkLocalExport(jt.local),jt.local.type==="Literal")this.raise(jt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(ee.source=null,this.options.ecmaVersion>=16)ee.attributes=[]}this.semicolon()}return this.finishNode(ee,"ExportNamedDeclaration")};Zt.parseExportDeclaration=function(ee){return this.parseStatement(null)};Zt.parseExportDefaultDeclaration=function(){var ee;if(this.type===Kt._function||(ee=this.isAsyncFunction())){var te=this.startNode();if(this.next(),ee)this.next();return this.parseFunction(te,Si|Xo,!1,ee)}else if(this.type===Kt._class){var Oe=this.startNode();return this.parseClass(Oe,"nullableID")}else{var Ot=this.parseMaybeAssign();return this.semicolon(),Ot}};Zt.checkExport=function(ee,te,Oe){if(!ee)return;if(typeof te!=="string")te=te.type==="Identifier"?te.name:te.value;if(Ci(ee,te))this.raiseRecoverable(Oe,"Duplicate export '"+te+"'");ee[te]=!0};Zt.checkPatternExport=function(ee,te){var Oe=te.type;if(Oe==="Identifier")this.checkExport(ee,te,te.start);else if(Oe==="ObjectPattern")for(var Ot=0,jt=te.properties;Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.checkPatternExport(ee,Vt)}else if(Oe==="ArrayPattern")for(var Wt=0,Mt=te.elements;Wt<Mt.length;Wt+=1){var Gt=Mt[Wt];if(Gt)this.checkPatternExport(ee,Gt)}else if(Oe==="Property")this.checkPatternExport(ee,te.value);else if(Oe==="AssignmentPattern")this.checkPatternExport(ee,te.left);else if(Oe==="RestElement")this.checkPatternExport(ee,te.argument)};Zt.checkVariableExport=function(ee,te){if(!ee)return;for(var Oe=0,Ot=te;Oe<Ot.length;Oe+=1){var jt=Ot[Oe];this.checkPatternExport(ee,jt.id)}};Zt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Zt.parseExportSpecifier=function(ee){var te=this.startNode();return te.local=this.parseModuleExportName(),te.exported=this.eatContextual("as")?this.parseModuleExportName():te.local,this.checkExport(ee,te.exported,te.exported.start),this.finishNode(te,"ExportSpecifier")};Zt.parseExportSpecifiers=function(ee){var te=[],Oe=!0;this.expect(Kt.braceL);while(!this.eat(Kt.braceR)){if(!Oe){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else Oe=!1;te.push(this.parseExportSpecifier(ee))}return te};Zt.parseImport=function(ee){if(this.next(),this.type===Kt.string)ee.specifiers=Sl,ee.source=this.parseExprAtom();else ee.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),ee.source=this.type===Kt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)ee.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(ee,"ImportDeclaration")};Zt.parseImportSpecifier=function(){var ee=this.startNode();if(ee.imported=this.parseModuleExportName(),this.eatContextual("as"))ee.local=this.parseIdent();else this.checkUnreserved(ee.imported),ee.local=ee.imported;return this.checkLValSimple(ee.local,Fn),this.finishNode(ee,"ImportSpecifier")};Zt.parseImportDefaultSpecifier=function(){var ee=this.startNode();return ee.local=this.parseIdent(),this.checkLValSimple(ee.local,Fn),this.finishNode(ee,"ImportDefaultSpecifier")};Zt.parseImportNamespaceSpecifier=function(){var ee=this.startNode();return this.next(),this.expectContextual("as"),ee.local=this.parseIdent(),this.checkLValSimple(ee.local,Fn),this.finishNode(ee,"ImportNamespaceSpecifier")};Zt.parseImportSpecifiers=function(){var ee=[],te=!0;if(this.type===Kt.name){if(ee.push(this.parseImportDefaultSpecifier()),!this.eat(Kt.comma))return ee}if(this.type===Kt.star)return ee.push(this.parseImportNamespaceSpecifier()),ee;this.expect(Kt.braceL);while(!this.eat(Kt.braceR)){if(!te){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else te=!1;ee.push(this.parseImportSpecifier())}return ee};Zt.parseWithClause=function(){var ee=[];if(!this.eat(Kt._with))return ee;this.expect(Kt.braceL);var te={},Oe=!0;while(!this.eat(Kt.braceR)){if(!Oe){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else Oe=!1;var Ot=this.parseImportAttribute(),jt=Ot.key.type==="Identifier"?Ot.key.name:Ot.key.value;if(Ci(te,jt))this.raiseRecoverable(Ot.key.start,"Duplicate attribute key '"+jt+"'");te[jt]=!0,ee.push(Ot)}return ee};Zt.parseImportAttribute=function(){var ee=this.startNode();if(ee.key=this.type===Kt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Kt.colon),this.type!==Kt.string)this.unexpected();return ee.value=this.parseExprAtom(),this.finishNode(ee,"ImportAttribute")};Zt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Kt.string){var ee=this.parseLiteral(this.value);if(gl.test(ee.value))this.raise(ee.start,"An export name cannot include a lone surrogate.");return ee}return this.parseIdent(!0)};Zt.adaptDirectivePrologue=function(ee){for(var te=0;te<ee.length&&this.isDirectiveCandidate(ee[te]);++te)ee[te].directive=ee[te].expression.raw.slice(1,-1)};Zt.isDirectiveCandidate=function(ee){return this.options.ecmaVersion>=5&&ee.type==="ExpressionStatement"&&ee.expression.type==="Literal"&&typeof ee.expression.value==="string"&&(this.input[ee.start]==='"'||this.input[ee.start]==="'")};var kn=s.prototype;kn.toAssignable=function(ee,te,Oe){if(this.options.ecmaVersion>=6&&ee)switch(ee.type){case"Identifier":if(this.inAsync&&ee.name==="await")this.raise(ee.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(ee.type="ObjectPattern",Oe)this.checkPatternErrors(Oe,!0);for(var Ot=0,jt=ee.properties;Ot<jt.length;Ot+=1){var Vt=jt[Ot];if(this.toAssignable(Vt,te),Vt.type==="RestElement"&&(Vt.argument.type==="ArrayPattern"||Vt.argument.type==="ObjectPattern"))this.raise(Vt.argument.start,"Unexpected token")}break;case"Property":if(ee.kind!=="init")this.raise(ee.key.start,"Object pattern can't contain getter or setter");this.toAssignable(ee.value,te);break;case"ArrayExpression":if(ee.type="ArrayPattern",Oe)this.checkPatternErrors(Oe,!0);this.toAssignableList(ee.elements,te);break;case"SpreadElement":if(ee.type="RestElement",this.toAssignable(ee.argument,te),ee.argument.type==="AssignmentPattern")this.raise(ee.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(ee.operator!=="=")this.raise(ee.left.end,"Only '=' operator can be used for specifying default value.");ee.type="AssignmentPattern",delete ee.operator,this.toAssignable(ee.left,te);break;case"ParenthesizedExpression":this.toAssignable(ee.expression,te,Oe);break;case"ChainExpression":this.raiseRecoverable(ee.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!te)break;default:this.raise(ee.start,"Assigning to rvalue")}else if(Oe)this.checkPatternErrors(Oe,!0);return ee};kn.toAssignableList=function(ee,te){var Oe=ee.length;for(var Ot=0;Ot<Oe;Ot++){var jt=ee[Ot];if(jt)this.toAssignable(jt,te)}if(Oe){var Vt=ee[Oe-1];if(this.options.ecmaVersion===6&&te&&Vt&&Vt.type==="RestElement"&&Vt.argument.type!=="Identifier")this.unexpected(Vt.argument.start)}return ee};kn.parseSpread=function(ee){var te=this.startNode();return this.next(),te.argument=this.parseMaybeAssign(!1,ee),this.finishNode(te,"SpreadElement")};kn.parseRestBinding=function(){var ee=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Kt.name)this.unexpected();return ee.argument=this.parseBindingAtom(),this.finishNode(ee,"RestElement")};kn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Kt.bracketL:var ee=this.startNode();return this.next(),ee.elements=this.parseBindingList(Kt.bracketR,!0,!0),this.finishNode(ee,"ArrayPattern");case Kt.braceL:return this.parseObj(!0)}return this.parseIdent()};kn.parseBindingList=function(ee,te,Oe,Ot){var jt=[],Vt=!0;while(!this.eat(ee)){if(Vt)Vt=!1;else this.expect(Kt.comma);if(te&&this.type===Kt.comma)jt.push(null);else if(Oe&&this.afterTrailingComma(ee))break;else if(this.type===Kt.ellipsis){var Wt=this.parseRestBinding();if(this.parseBindingListItem(Wt),jt.push(Wt),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(ee);break}else jt.push(this.parseAssignableListItem(Ot))}return jt};kn.parseAssignableListItem=function(ee){var te=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(te),te};kn.parseBindingListItem=function(ee){return ee};kn.parseMaybeDefault=function(ee,te,Oe){if(Oe=Oe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Kt.eq))return Oe;var Ot=this.startNodeAt(ee,te);return Ot.left=Oe,Ot.right=this.parseMaybeAssign(),this.finishNode(Ot,"AssignmentPattern")};kn.checkLValSimple=function(ee,te,Oe){if(te===void 0)te=Qi;var Ot=te!==Qi;switch(ee.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(ee.name))this.raiseRecoverable(ee.start,(Ot?"Binding ":"Assigning to ")+ee.name+" in strict mode");if(Ot){if(te===Fn&&ee.name==="let")this.raiseRecoverable(ee.start,"let is disallowed as a lexically bound name");if(Oe){if(Ci(Oe,ee.name))this.raiseRecoverable(ee.start,"Argument name clash");Oe[ee.name]=!0}if(te!==zo)this.declareName(ee.name,te,ee.start)}break;case"ChainExpression":this.raiseRecoverable(ee.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ot)this.raiseRecoverable(ee.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ot)this.raiseRecoverable(ee.start,"Binding parenthesized expression");return this.checkLValSimple(ee.expression,te,Oe);default:this.raise(ee.start,(Ot?"Binding":"Assigning to")+" rvalue")}};kn.checkLValPattern=function(ee,te,Oe){if(te===void 0)te=Qi;switch(ee.type){case"ObjectPattern":for(var Ot=0,jt=ee.properties;Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.checkLValInnerPattern(Vt,te,Oe)}break;case"ArrayPattern":for(var Wt=0,Mt=ee.elements;Wt<Mt.length;Wt+=1){var Gt=Mt[Wt];if(Gt)this.checkLValInnerPattern(Gt,te,Oe)}break;default:this.checkLValSimple(ee,te,Oe)}};kn.checkLValInnerPattern=function(ee,te,Oe){if(te===void 0)te=Qi;switch(ee.type){case"Property":this.checkLValInnerPattern(ee.value,te,Oe);break;case"AssignmentPattern":this.checkLValPattern(ee.left,te,Oe);break;case"RestElement":this.checkLValPattern(ee.argument,te,Oe);break;default:this.checkLValPattern(ee,te,Oe)}};var Pn=function(ee,te,Oe,Ot,jt){this.token=ee,this.isExpr=!!te,this.preserveSpace=!!Oe,this.override=Ot,this.generator=!!jt},ln={b_stat:new Pn("{",!1),b_expr:new Pn("{",!0),b_tmpl:new Pn("${",!1),p_stat:new Pn("(",!1),p_expr:new Pn("(",!0),q_tmpl:new Pn("`",!0,!0,function(ee){return ee.tryReadTemplateToken()}),f_stat:new Pn("function",!1),f_expr:new Pn("function",!0),f_expr_gen:new Pn("function",!0,!1,null,!0),f_gen:new Pn("function",!1,!1,null,!0)},hi=s.prototype;hi.initialContext=function(){return[ln.b_stat]};hi.curContext=function(){return this.context[this.context.length-1]};hi.braceIsBlock=function(ee){var te=this.curContext();if(te===ln.f_expr||te===ln.f_stat)return!0;if(ee===Kt.colon&&(te===ln.b_stat||te===ln.b_expr))return!te.isExpr;if(ee===Kt._return||ee===Kt.name&&this.exprAllowed)return En.test(this.input.slice(this.lastTokEnd,this.start));if(ee===Kt._else||ee===Kt.semi||ee===Kt.eof||ee===Kt.parenR||ee===Kt.arrow)return!0;if(ee===Kt.braceL)return te===ln.b_stat;if(ee===Kt._var||ee===Kt._const||ee===Kt.name)return!1;return!this.exprAllowed};hi.inGeneratorContext=function(){for(var ee=this.context.length-1;ee>=1;ee--){var te=this.context[ee];if(te.token==="function")return te.generator}return!1};hi.updateContext=function(ee){var te,Oe=this.type;if(Oe.keyword&&ee===Kt.dot)this.exprAllowed=!1;else if(te=Oe.updateContext)te.call(this,ee);else this.exprAllowed=Oe.beforeExpr};hi.overrideContext=function(ee){if(this.curContext()!==ee)this.context[this.context.length-1]=ee};Kt.parenR.updateContext=Kt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var ee=this.context.pop();if(ee===ln.b_stat&&this.curContext().token==="function")ee=this.context.pop();this.exprAllowed=!ee.isExpr};Kt.braceL.updateContext=function(ee){this.context.push(this.braceIsBlock(ee)?ln.b_stat:ln.b_expr),this.exprAllowed=!0};Kt.dollarBraceL.updateContext=function(){this.context.push(ln.b_tmpl),this.exprAllowed=!0};Kt.parenL.updateContext=function(ee){var te=ee===Kt._if||ee===Kt._for||ee===Kt._with||ee===Kt._while;this.context.push(te?ln.p_stat:ln.p_expr),this.exprAllowed=!0};Kt.incDec.updateContext=function(){};Kt._function.updateContext=Kt._class.updateContext=function(ee){if(ee.beforeExpr&&ee!==Kt._else&&!(ee===Kt.semi&&this.curContext()!==ln.p_stat)&&!(ee===Kt._return&&En.test(this.input.slice(this.lastTokEnd,this.start)))&&!((ee===Kt.colon||ee===Kt.braceL)&&this.curContext()===ln.b_stat))this.context.push(ln.f_expr);else this.context.push(ln.f_stat);this.exprAllowed=!1};Kt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Kt.backQuote.updateContext=function(){if(this.curContext()===ln.q_tmpl)this.context.pop();else this.context.push(ln.q_tmpl);this.exprAllowed=!1};Kt.star.updateContext=function(ee){if(ee===Kt._function){var te=this.context.length-1;if(this.context[te]===ln.f_expr)this.context[te]=ln.f_expr_gen;else this.context[te]=ln.f_gen}this.exprAllowed=!0};Kt.name.updateContext=function(ee){var te=!1;if(this.options.ecmaVersion>=6&&ee!==Kt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())te=!0}this.exprAllowed=te};var tn=s.prototype;tn.checkPropClash=function(ee,te,Oe){if(this.options.ecmaVersion>=9&&ee.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(ee.computed||ee.method||ee.shorthand))return;var Ot=ee.key,jt;switch(Ot.type){case"Identifier":jt=Ot.name;break;case"Literal":jt=String(Ot.value);break;default:return}var Vt=ee.kind;if(this.options.ecmaVersion>=6){if(jt==="__proto__"&&Vt==="init"){if(te.proto)if(Oe){if(Oe.doubleProto<0)Oe.doubleProto=Ot.start}else this.raiseRecoverable(Ot.start,"Redefinition of __proto__ property");te.proto=!0}return}jt="$"+jt;var Wt=te[jt];if(Wt){var Mt;if(Vt==="init")Mt=this.strict&&Wt.init||Wt.get||Wt.set;else Mt=Wt.init||Wt[Vt];if(Mt)this.raiseRecoverable(Ot.start,"Redefinition of property")}else Wt=te[jt]={init:!1,get:!1,set:!1};Wt[Vt]=!0};tn.parseExpression=function(ee,te){var Oe=this;return this.catchStackOverflow(function(){var{start:Ot,startLoc:jt}=Oe,Vt=Oe.parseMaybeAssign(ee,te);if(Oe.type===Kt.comma){var Wt=Oe.startNodeAt(Ot,jt);Wt.expressions=[Vt];while(Oe.eat(Kt.comma))Wt.expressions.push(Oe.parseMaybeAssign(ee,te));return Oe.finishNode(Wt,"SequenceExpression")}return Vt})};tn.parseMaybeAssign=function(ee,te,Oe){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(ee);else this.exprAllowed=!1;var Ot=!1,jt=-1,Vt=-1,Wt=-1;if(te)jt=te.parenthesizedAssign,Vt=te.trailingComma,Wt=te.doubleProto,te.parenthesizedAssign=te.trailingComma=-1;else te=new rs,Ot=!0;var Mt=this.start,Gt=this.startLoc;if(this.type===Kt.parenL||this.type===Kt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=ee==="await";var Ut=this.parseMaybeConditional(ee,te);if(Oe)Ut=Oe.call(this,Ut,Mt,Gt);if(this.type.isAssign){var Ht=this.startNodeAt(Mt,Gt);if(Ht.operator=this.value,this.type===Kt.eq)Ut=this.toAssignable(Ut,!1,te);if(!Ot)te.parenthesizedAssign=te.trailingComma=te.doubleProto=-1;if(te.shorthandAssign>=Ut.start)te.shorthandAssign=-1;if(this.type===Kt.eq)this.checkLValPattern(Ut);else this.checkLValSimple(Ut);if(Ht.left=Ut,this.next(),Ht.right=this.parseMaybeAssign(ee),Wt>-1)te.doubleProto=Wt;return this.finishNode(Ht,"AssignmentExpression")}else if(Ot)this.checkExpressionErrors(te,!0);if(jt>-1)te.parenthesizedAssign=jt;if(Vt>-1)te.trailingComma=Vt;return Ut};tn.parseMaybeConditional=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt=this.parseExprOps(ee,te);if(this.checkExpressionErrors(te))return jt;if(!(jt.type==="ArrowFunctionExpression"&&jt.start===Oe)&&this.eat(Kt.question)){var Vt=this.startNodeAt(Oe,Ot);return Vt.test=jt,Vt.consequent=this.parseMaybeAssign(),this.expect(Kt.colon),Vt.alternate=this.parseMaybeAssign(ee),this.finishNode(Vt,"ConditionalExpression")}return jt};tn.parseExprOps=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt=this.parseMaybeUnary(te,!1,!1,ee);if(this.checkExpressionErrors(te))return jt;return jt.start===Oe&&jt.type==="ArrowFunctionExpression"?jt:this.parseExprOp(jt,Oe,Ot,-1,ee)};tn.parseExprOp=function(ee,te,Oe,Ot,jt){var Vt=this.type.binop;if(Vt!=null&&(!jt||this.type!==Kt._in)){if(Vt>Ot){var Wt=this.type===Kt.logicalOR||this.type===Kt.logicalAND,Mt=this.type===Kt.coalesce;if(Mt)Vt=Kt.logicalAND.binop;var Gt=this.value;this.next();var Ut=this.start,Ht=this.startLoc,qt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,jt),Ut,Ht,Vt,jt),zt=this.buildBinary(te,Oe,ee,qt,Gt,Wt||Mt);if(Wt&&this.type===Kt.coalesce||Mt&&(this.type===Kt.logicalOR||this.type===Kt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(zt,te,Oe,Ot,jt)}}return ee};tn.buildBinary=function(ee,te,Oe,Ot,jt,Vt){if(Ot.type==="PrivateIdentifier")this.raise(Ot.start,"Private identifier can only be left side of binary expression");var Wt=this.startNodeAt(ee,te);return Wt.left=Oe,Wt.operator=jt,Wt.right=Ot,this.finishNode(Wt,Vt?"LogicalExpression":"BinaryExpression")};tn.parseMaybeUnary=function(ee,te,Oe,Ot){var jt=this.start,Vt=this.startLoc,Wt;if(this.isContextual("await")&&this.canAwait)Wt=this.parseAwait(Ot),te=!0;else if(this.type.prefix){var Mt=this.startNode(),Gt=this.type===Kt.incDec;if(Mt.operator=this.value,Mt.prefix=!0,this.next(),Mt.argument=this.parseMaybeUnary(null,!0,Gt,Ot),this.checkExpressionErrors(ee,!0),Gt)this.checkLValSimple(Mt.argument);else if(this.strict&&Mt.operator==="delete"&&Jo(Mt.argument))this.raiseRecoverable(Mt.start,"Deleting local variable in strict mode");else if(Mt.operator==="delete"&&Xs(Mt.argument))this.raiseRecoverable(Mt.start,"Private fields can not be deleted");else te=!0;Wt=this.finishNode(Mt,Gt?"UpdateExpression":"UnaryExpression")}else if(!te&&this.type===Kt.privateId){if((Ot||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Wt=this.parsePrivateIdent(),this.type!==Kt._in)this.unexpected()}else{if(Wt=this.parseExprSubscripts(ee,Ot),this.checkExpressionErrors(ee))return Wt;while(this.type.postfix&&!this.canInsertSemicolon()){var Ut=this.startNodeAt(jt,Vt);Ut.operator=this.value,Ut.prefix=!1,Ut.argument=Wt,this.checkLValSimple(Wt),this.next(),Wt=this.finishNode(Ut,"UpdateExpression")}}if(!Oe&&!(Wt.type==="ArrowFunctionExpression"&&Wt.start===jt)&&this.eat(Kt.starstar))if(te)this.unexpected(this.lastTokStart);else return this.buildBinary(jt,Vt,Wt,this.parseMaybeUnary(null,!1,!1,Ot),"**",!1);else return Wt};function Jo(ee){return ee.type==="Identifier"||ee.type==="ParenthesizedExpression"&&Jo(ee.expression)}function Xs(ee){return ee.type==="MemberExpression"&&ee.property.type==="PrivateIdentifier"||ee.type==="ChainExpression"&&Xs(ee.expression)||ee.type==="ParenthesizedExpression"&&Xs(ee.expression)}tn.parseExprSubscripts=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt=this.parseExprAtom(ee,te);if(jt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return jt;var Vt=this.parseSubscripts(jt,Oe,Ot,!1,te);if(ee&&Vt.type==="MemberExpression"){if(ee.parenthesizedAssign>=Vt.start)ee.parenthesizedAssign=-1;if(ee.parenthesizedBind>=Vt.start)ee.parenthesizedBind=-1;if(ee.trailingComma>=Vt.start)ee.trailingComma=-1}return Vt};tn.parseSubscripts=function(ee,te,Oe,Ot,jt){var Vt=this.options.ecmaVersion>=8&&ee.type==="Identifier"&&ee.name==="async"&&this.lastTokEnd===ee.end&&!this.canInsertSemicolon()&&ee.end-ee.start===5&&this.potentialArrowAt===ee.start,Wt=!1;while(!0){var Mt=this.parseSubscript(ee,te,Oe,Ot,Vt,Wt,jt);if(Mt.optional)Wt=!0;if(Mt===ee||Mt.type==="ArrowFunctionExpression"){if(Wt){var Gt=this.startNodeAt(te,Oe);Gt.expression=Mt,Mt=this.finishNode(Gt,"ChainExpression")}return Mt}ee=Mt}};tn.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Kt.arrow)};tn.parseSubscriptAsyncArrow=function(ee,te,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(ee,te),Oe,!0,Ot)};tn.parseSubscript=function(ee,te,Oe,Ot,jt,Vt,Wt){var Mt=this.options.ecmaVersion>=11,Gt=Mt&&this.eat(Kt.questionDot);if(Ot&&Gt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Ut=this.eat(Kt.bracketL);if(Ut||Gt&&this.type!==Kt.parenL&&this.type!==Kt.backQuote||this.eat(Kt.dot)){var Ht=this.startNodeAt(te,Oe);if(Ht.object=ee,Ut)Ht.property=this.parseExpression(),this.expect(Kt.bracketR);else if(this.type===Kt.privateId&&ee.type!=="Super")Ht.property=this.parsePrivateIdent();else Ht.property=this.parseIdent(this.options.allowReserved!=="never");if(Ht.computed=!!Ut,Mt)Ht.optional=Gt;ee=this.finishNode(Ht,"MemberExpression")}else if(!Ot&&this.eat(Kt.parenL)){var qt=new rs,zt=this.yieldPos,Xt=this.awaitPos,Jt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Qt=this.parseExprList(Kt.parenR,this.options.ecmaVersion>=8,!1,qt);if(jt&&!Gt&&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=Xt,this.awaitIdentPos=Jt,this.parseSubscriptAsyncArrow(te,Oe,Qt,Wt)}this.checkExpressionErrors(qt,!0),this.yieldPos=zt||this.yieldPos,this.awaitPos=Xt||this.awaitPos,this.awaitIdentPos=Jt||this.awaitIdentPos;var Yt=this.startNodeAt(te,Oe);if(Yt.callee=ee,Yt.arguments=Qt,Mt)Yt.optional=Gt;ee=this.finishNode(Yt,"CallExpression")}else if(this.type===Kt.backQuote){if(Gt||Vt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var nn=this.startNodeAt(te,Oe);nn.tag=ee,nn.quasi=this.parseTemplate({isTagged:!0}),ee=this.finishNode(nn,"TaggedTemplateExpression")}return ee};tn.parseExprAtom=function(ee,te,Oe){if(this.type===Kt.slash)this.readRegexp();var Ot,jt=this.potentialArrowAt===this.start;switch(this.type){case Kt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Ot=this.startNode(),this.next(),this.type===Kt.parenL&&!this.allowDirectSuper)this.raise(Ot.start,"super() call outside constructor of a subclass");if(this.type!==Kt.dot&&this.type!==Kt.bracketL&&this.type!==Kt.parenL)this.unexpected();return this.finishNode(Ot,"Super");case Kt._this:return Ot=this.startNode(),this.next(),this.finishNode(Ot,"ThisExpression");case Kt.name:var Vt=this.start,Wt=this.startLoc,Mt=this.containsEsc,Gt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Mt&&Gt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Kt._function))return this.overrideContext(ln.f_expr),this.parseFunction(this.startNodeAt(Vt,Wt),0,!1,!0,te);if(jt&&!this.canInsertSemicolon()){if(this.eat(Kt.arrow))return this.parseArrowExpression(this.startNodeAt(Vt,Wt),[Gt],!1,te);if(this.options.ecmaVersion>=8&&Gt.name==="async"&&this.type===Kt.name&&!Mt&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Gt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Kt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Vt,Wt),[Gt],!0,te)}}return Gt;case Kt.regexp:var Ut=this.value;return Ot=this.parseLiteral(Ut.value),Ot.regex={pattern:Ut.pattern,flags:Ut.flags},Ot;case Kt.num:case Kt.string:return this.parseLiteral(this.value);case Kt._null:case Kt._true:case Kt._false:return Ot=this.startNode(),Ot.value=this.type===Kt._null?null:this.type===Kt._true,Ot.raw=this.type.keyword,this.next(),this.finishNode(Ot,"Literal");case Kt.parenL:var Ht=this.start,qt=this.parseParenAndDistinguishExpression(jt,te);if(ee){if(ee.parenthesizedAssign<0&&!this.isSimpleAssignTarget(qt))ee.parenthesizedAssign=Ht;if(ee.parenthesizedBind<0)ee.parenthesizedBind=Ht}return qt;case Kt.bracketL:return Ot=this.startNode(),this.next(),Ot.elements=this.parseExprList(Kt.bracketR,!0,!0,ee),this.finishNode(Ot,"ArrayExpression");case Kt.braceL:return this.overrideContext(ln.b_expr),this.parseObj(!1,ee);case Kt._function:return Ot=this.startNode(),this.next(),this.parseFunction(Ot,0);case Kt._class:return this.parseClass(this.startNode(),!1);case Kt._new:return this.parseNew();case Kt.backQuote:return this.parseTemplate();case Kt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Oe);else return this.unexpected();default:return this.parseExprAtomDefault()}};tn.parseExprAtomDefault=function(){this.unexpected()};tn.parseExprImport=function(ee){var te=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Kt.parenL&&!ee)return this.parseDynamicImport(te);else if(this.type===Kt.dot){var Oe=this.startNodeAt(te.start,te.loc&&te.loc.start);return Oe.name="import",te.meta=this.finishNode(Oe,"Identifier"),this.parseImportMeta(te)}else this.unexpected()};tn.parseDynamicImport=function(ee){if(this.next(),ee.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Kt.parenR))if(this.expect(Kt.comma),!this.afterTrailingComma(Kt.parenR)){if(ee.options=this.parseMaybeAssign(),!this.eat(Kt.parenR)){if(this.expect(Kt.comma),!this.afterTrailingComma(Kt.parenR))this.unexpected()}}else ee.options=null;else ee.options=null;else if(!this.eat(Kt.parenR)){var te=this.start;if(this.eat(Kt.comma)&&this.eat(Kt.parenR))this.raiseRecoverable(te,"Trailing comma is not allowed in import()");else this.unexpected(te)}return this.finishNode(ee,"ImportExpression")};tn.parseImportMeta=function(ee){this.next();var te=this.containsEsc;if(ee.property=this.parseIdent(!0),ee.property.name!=="meta")this.raiseRecoverable(ee.property.start,"The only valid meta property for import is 'import.meta'");if(te)this.raiseRecoverable(ee.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(ee.start,"Cannot use 'import.meta' outside a module");return this.finishNode(ee,"MetaProperty")};tn.parseLiteral=function(ee){var te=this.startNode();if(te.value=ee,te.raw=this.input.slice(this.start,this.end),te.raw.charCodeAt(te.raw.length-1)===110)te.bigint=te.value!=null?te.value.toString():te.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(te,"Literal")};tn.parseParenExpression=function(){this.expect(Kt.parenL);var ee=this.parseExpression();return this.expect(Kt.parenR),ee};tn.shouldParseArrow=function(ee){return!this.canInsertSemicolon()};tn.parseParenAndDistinguishExpression=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt,Vt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Wt=this.start,Mt=this.startLoc,Gt=[],Ut=!0,Ht=!1,qt=new rs,zt=this.yieldPos,Xt=this.awaitPos,Jt;this.yieldPos=0,this.awaitPos=0;while(this.type!==Kt.parenR)if(Ut?Ut=!1:this.expect(Kt.comma),Vt&&this.afterTrailingComma(Kt.parenR,!0)){Ht=!0;break}else if(this.type===Kt.ellipsis){if(Jt=this.start,Gt.push(this.parseParenItem(this.parseRestBinding())),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Gt.push(this.parseMaybeAssign(!1,qt,this.parseParenItem));var Qt=this.lastTokEnd,Yt=this.lastTokEndLoc;if(this.expect(Kt.parenR),ee&&this.shouldParseArrow(Gt)&&this.eat(Kt.arrow))return this.checkPatternErrors(qt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=zt,this.awaitPos=Xt,this.parseParenArrowList(Oe,Ot,Gt,te);if(!Gt.length||Ht)this.unexpected(this.lastTokStart);if(Jt)this.unexpected(Jt);if(this.checkExpressionErrors(qt,!0),this.yieldPos=zt||this.yieldPos,this.awaitPos=Xt||this.awaitPos,Gt.length>1)jt=this.startNodeAt(Wt,Mt),jt.expressions=Gt,this.finishNodeAt(jt,"SequenceExpression",Qt,Yt);else jt=Gt[0]}else jt=this.parseParenExpression();if(this.options.preserveParens){var nn=this.startNodeAt(Oe,Ot);return nn.expression=jt,this.finishNode(nn,"ParenthesizedExpression")}else return jt};tn.parseParenItem=function(ee){return ee};tn.parseParenArrowList=function(ee,te,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(ee,te),Oe,!1,Ot)};var Cl=[];tn.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var ee=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Kt.dot){var te=this.startNodeAt(ee.start,ee.loc&&ee.loc.start);te.name="new",ee.meta=this.finishNode(te,"Identifier"),this.next();var Oe=this.containsEsc;if(ee.property=this.parseIdent(!0),ee.property.name!=="target")this.raiseRecoverable(ee.property.start,"The only valid meta property for new is 'new.target'");if(Oe)this.raiseRecoverable(ee.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(ee.start,"'new.target' can only be used in functions and class static block");return this.finishNode(ee,"MetaProperty")}var Ot=this.start,jt=this.startLoc;if(ee.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ot,jt,!0,!1),ee.callee.type==="Super")this.raiseRecoverable(Ot,"Invalid use of 'super'");if(this.eat(Kt.parenL))ee.arguments=this.parseExprList(Kt.parenR,this.options.ecmaVersion>=8,!1);else ee.arguments=Cl;return this.finishNode(ee,"NewExpression")};tn.parseTemplateElement=function(ee){var te=ee.isTagged,Oe=this.startNode();if(this.type===Kt.invalidTemplate){if(!te)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Oe.value={raw:this.value.replace(/\r\n?/g,`
|
|
4
|
+
`,Oe+1);return te}function Xi(ee,te,Oe){let Ot=0,jt=ee.length-1;if(te>=ee[Oe])Ot=Oe;else jt=Oe-1;if(Ot<jt&&te<ee[Ot+1])jt=Ot;while(Ot<jt){let Vt=Ot+jt+1>>>1;if(ee[Vt]<=te)Ot=Vt;else jt=Vt-1}return Ot}function x(ee){return Ws(ee),pi=Xi(Rn,ee,pi),{line:pi+1,column:ee-Rn[pi],character:ee}}var Vs=/\r\n?|\n|\u2028|\u2029/g,Mc=/[\r\u2028\u2029]/;function wo(ee){if(Vn===void 0){Vn=Mc.test(ci)?[]:null,Vs.lastIndex=0;while(Vn!==null&&Vs.exec(ci)!==null)Vn.push(Vs.lastIndex)}if(Vn===null)return Ws(ee),Xi(Rn,ee,pi);let te=0,Oe=Vn.length;while(te<Oe){let Ot=te+Oe>>>1;if(Vn[Ot]<=ee)te=Ot+1;else Oe=Ot}return te}function D(ee){let{line:te,column:Oe}=x(ee);return{line:te,column:Oe}}function To(ee){while(Rn.length<=ee+1&&Gn!==Number.POSITIVE_INFINITY)Ws(Gn);if(ee>=Rn.length)return;let te=ee+1<Rn.length?Rn[ee+1]-1:ci.length;return ci.slice(Rn[ee],te)}function ve(ee){let te,Oe=0;return(Ot)=>(te??=Co(ee),Oe=Xi(te,Ot,Oe),{line:Oe+1,column:Ot-te[Oe]})}function Mn(ee){return typeof ee==="object"&&ee!==null&&typeof Yn(ee).type==="string"}function Yn(ee){return ee}function H(ee,te){let Oe=Yn(ee);for(let Ot in Oe){let jt=Oe[Ot];if(Array.isArray(jt)){for(let Vt=0;Vt<jt.length;Vt++)if(Mn(jt[Vt]))jt[Vt]=te(jt[Vt])}else if(Mn(jt))Oe[Ot]=te(jt)}}function re(ee,...te){if(!te.some((Oe)=>Oe===ee.type))throw Error(`expected ${te.join(" or ")}, got ${ee.type}`)}function Se(ee){let te=[];return Qn(ee,te),te}function Qn(ee,te){switch(ee.type){case"Identifier":te.push(ee);return;case"ObjectPattern":for(let Oe of ee.properties)Qn(Oe.type==="RestElement"?Oe.argument:Oe.value,te);return;case"ArrayPattern":for(let Oe of ee.elements)if(Oe!==null)Qn(Oe,te);return;case"RestElement":Qn(ee.argument,te);return;case"AssignmentPattern":Qn(ee.left,te);return;case"TSParameterProperty":Qn(ee.parameter,te);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Qn(ee.expression,te)}}function U(ee,te){if(ee.type!=="Identifier")return!1;if(te===null)return!0;switch(te.type){case"MemberExpression":return te.computed||ee===te.object;case"MethodDefinition":return te.computed;case"Property":case"PropertyDefinition":return te.computed||ee===te.value;case"ExportSpecifier":case"ImportSpecifier":return ee===te.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 ee===te.expression;case"TSEnumMember":return ee===te.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!te.type.startsWith("TS")}}var Zn={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 on=[],li={...Zn,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:on,TSTypeParameterDeclaration:on,TSTypeParameterInstantiation:on,TSTypeParameter:on,TSArrayType:on,TSTupleType:on,TSNamedTupleMember:on,TSOptionalType:on,TSRestType:on,TSUnionType:on,TSIntersectionType:on,TSConditionalType:on,TSInferType:on,TSParenthesizedType:on,TSTypeOperator:on,TSIndexedAccessType:on,TSMappedType:on,TSLiteralType:on,TSTypeReference:on,TSTypeQuery:on,TSImportType:on,TSTypeLiteral:on,TSPropertySignature:on,TSMethodSignature:on,TSCallSignatureDeclaration:on,TSConstructSignatureDeclaration:on,TSFunctionType:on,TSConstructorType:on,TSIndexSignature:on,TSTypePredicate:on,TSInterfaceDeclaration:on,TSInterfaceBody:on,TSExpressionWithTypeArguments:on,TSTypeAliasDeclaration:on,TSNamespaceExportDeclaration:on,TSDeclareFunction:["id"],TSDeclareMethod:on,TSAsExpression:["expression"],TSSatisfiesExpression:["expression"],TSTypeAssertion:["expression"],TSInstantiationExpression:["expression"]},Fc=Object.assign(Object.create(null),Zn),Bc=Object.assign(Object.create(null),li),ko=[],v=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function o(ee,te,Oe){Ji(ee,null,null,null,te,jc(Oe))}function jc(ee){if(ee===void 0||ee===Zn)return Gc;if(ee===li)return Wc;return(te)=>Vc(ee,te.type)}function Vc(ee,te){return Object.hasOwn(ee,te)?ee[te]:void 0}var Om=Object.freeze([]);function Ji(ee,te,Oe,Ot,jt,Vt){let Wt=Vt(ee);if(Wt===void 0)throw Error(`unknown node type: ${ee.type}`);let Mt=jt.enter?.(ee,te,Oe,Ot);if(Mt===v)return!0;if(Mt!==p){if(Mt!==ee&&Mn(Mt))return Uc(Mt,te,Oe,Ot,jt,Vt);let Gt=Yn(ee);for(let Ut=0;Ut<Wt.length;Ut++){let Ht=Wt[Ut],qt=Gt[Ht];if(Array.isArray(qt))for(let zt=0;zt<qt.length;zt++){let Xt=qt[zt];if(Mn(Xt)&&Ji(Xt,ee,Ht,zt,jt,Vt))return!0}else if(Mn(qt)&&Ji(qt,ee,Ht,null,jt,Vt))return!0}}return jt.leave?.(ee,te,Oe,Ot)===v}function Gc(ee){let te=ee.type;if(te==="Identifier")return ee.typeAnnotation===void 0&&ee.decorators===void 0?ko:Zn.Identifier;if(te==="Literal")return Zn.Literal;if(te==="Text")return Zn.Text;return Fc[te]}function Wc(ee){let te=ee.type;if(te==="Identifier")return ee.decorators===void 0?ko:li.Identifier;if(te==="Literal")return li.Literal;if(te==="Text")return li.Text;return Bc[te]}function Uc(ee,te,Oe,Ot,jt,Vt){if(te===null||Oe===null)throw Error("walk can't replace the node it was called with");let Wt=Yn(te),Mt=Wt[Oe];if(Ot===null)Wt[Oe]=ee;else if(Array.isArray(Mt))Mt[Ot]=ee;return Ji(ee,te,Oe,Ot,jt,Vt)}function i(ee){return typeof ee==="object"&&ee!==null}function b(ee){return i(ee)&&ee.type==="Literal"}function t(ee){return i(ee)&&ee.type==="Identifier"&&typeof ee.name==="string"}function C(ee){return i(ee)&&ee.type==="MemberExpression"}function c(ee){return i(ee)&&ee.type==="ObjectExpression"&&Array.isArray(ee.properties)}function Hc(ee){return i(ee)&&ee.type==="CallExpression"}function m(ee,te){return Hc(ee)&&t(ee.callee)&&ee.callee.name===te}function T(ee){return ee?.type==="TSAsExpression"||ee?.type==="TSSatisfiesExpression"?T(ee.expression):ee}function Me(ee){return ee?.type==="TSAsExpression"||ee?.type==="TSSatisfiesExpression"?ee.typeAnnotation:void 0}function Kc(ee){return i(ee)&&ee.type==="NewExpression"}function be(ee,te){return Kc(ee)&&t(ee.callee)&&ee.callee.name===te}function k(ee){if(!i(ee))return null;if(ee.type==="Literal")return ee.value==null?null:String(ee.value);if(ee.type==="TemplateLiteral"){let te=ee.quasis;if(te?.length===1)return te[0]?.value?.cooked??null}return null}function l(ee){if(t(ee))return ee.name;if(b(ee))return ee.value==null?void 0:String(ee.value);return}var qc=new Set(["Component","SvelteComponent","SvelteSelf"]),zc=new Set(["RegularElement","SvelteElement"]);function O(ee){return qc.has(ee)}function N(ee){return zc.has(ee)}function Yi(ee,te,Oe=0,Ot=ee.length,jt=0){let Vt=jt;for(let Wt=Oe;Wt<Ot;Wt++){let Mt=ee.charCodeAt(Wt);if(Mt===34||Mt===39||Mt===96){Wt=Xc(ee,Wt,Ot);continue}if(Mt===123||Mt===40||Mt===91||Mt===60)Vt++;else if(Mt===125||Mt===41||Mt===93||Mt===62&&ee.charCodeAt(Wt-1)!==61){if(Vt>0)Vt--}if(te?.(Wt,Vt)===!0)break}return Vt}function Xc(ee,te,Oe){let Ot=ee.charCodeAt(te);for(let jt=te+1;jt<Oe;jt++){let Vt=ee.charCodeAt(jt);if(Vt===92)jt++;else if(Vt===Ot)return jt}return Oe-1}function r(ee,te){let Oe=[],Ot=0;return Yi(ee,(jt,Vt)=>{if(Vt===0&&te.includes(ee[jt]))Oe.push(ee.slice(Ot,jt)),Ot=jt+1;return!1}),Oe.push(ee.slice(Ot)),Oe}function Us(ee,te,Oe=0){let Ot=-1;return Yi(ee,(jt,Vt)=>{if(te(jt,Vt))Ot=jt;return Ot!==-1},Oe),Ot}function z(ee,te){return Us(ee,(Oe,Ot)=>Ot===0&&te.includes(ee[Oe]))}function w(ee){return Us(ee,(te,Oe)=>Oe===0&&ee[te]==="="&&ee[te+1]===">")}function P(ee,te){return Us(ee,(Oe,Ot)=>Ot===0,te)}function Hs(ee){let te=ee.trim();return te.startsWith("[")&&P(te,0)===te.length-1}function ie(ee){if(!ee)return;let te=w(ee);if(te===-1)return;return ee.slice(te+2).trim()||void 0}var Jc=new Set(["null","undefined"]);function se(ee){if(!ee)return!1;let te=r(ee,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!Jc.has(Ot));if(te.length!==1)return!1;let[Oe]=te;while(Oe.startsWith("(")&&P(Oe,0)===Oe.length-1)Oe=Oe.slice(1,-1).trim();return(Oe.startsWith("(")||Oe.startsWith("<"))&&w(Oe)!==-1}function Yc(ee){let te="";for(let Oe=0;Oe<ee.length;Oe++){let Ot=ee[Oe];if(Ot==="*"&&ee[Oe+1]==="*"){if(Oe++,ee[Oe+1]==="/")te+="(?:.*/)?",Oe++;else te+=".*";continue}if(Ot==="*"){te+="[^/]*";continue}if(Ot==="?"){te+="[^/]";continue}te+=".+^$()[]{}|\\".includes(Ot)?`\\${Ot}`:Ot}return te}function Ao(ee,te){return new RegExp(`^${Yc(ee)}$`).test(te)}var Ks={"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(ee){return{...ee,code:J[ee.kind],severity:Ks[ee.kind].severity}}function Po(ee,te){if(te)return ee;return ee.filter((Oe)=>Oe.kind!=="jsdoc-unknown-tag")}function _o(ee,te){if(!te)return[];return ee.filter((Oe)=>!Oe.ignored&&(te!=="errors"||Oe.severity==="error"))}function Qc(ee,te){if(te.code!==void 0&&te.code!==ee.code)return!1;if(te.name!==void 0&&te.name!==ee.name)return!1;if(te.component!==void 0&&!Ao(te.component,ee.component))return!1;return!0}function $o(ee,te){if(!te||te.length===0)return ee;return ee.map((Oe)=>Oe.ignored||te.some((Ot)=>Qc(Oe,Ot))?{...Oe,ignored:!0}:Oe)}var No=Object.keys(Ks),J=Object.fromEntries(No.map((ee)=>[ee,`sveld/${ee}`]));function Do(ee){let te=new Set,Oe=[];for(let Ot of ee){let jt=`${Ot.component}:${Ot.kind}:${Ot.name}`;if(te.has(jt))continue;te.add(jt),Oe.push(Ot)}return Oe}function Ro(ee){let te=ee.filter((Gt)=>!Gt.ignored),Oe=ee.length-te.length,Ot=Oe>0?` (${Oe} ignored)`:"";if(te.length===0)return`sveld: no diagnostics${Ot}.`;let jt=[],Vt=(Gt,Ut)=>`${Gt} ${Ut}${Gt===1?"":"s"}`,Wt=te.filter((Gt)=>Gt.severity==="error").length,Mt=`${Vt(Wt,"error")}, ${Vt(te.length-Wt,"warning")}`;jt.push(`sveld: ${Vt(te.length,"diagnostic")} (${Mt})${Ot}.`);for(let Gt of No){let Ut=te.filter((qt)=>qt.kind===Gt);if(Ut.length===0)continue;jt.push(""),jt.push(`${Ks[Gt].label} (${Ut.length}):`);let Ht=new Map;for(let qt of Ut){let zt=Ht.get(qt.component)??[];zt.push(qt),Ht.set(qt.component,zt)}for(let[qt,zt]of Ht){jt.push(` ${qt}`);for(let Xt of zt){let Jt=Xt.source?` (${qt}:${Xt.source.start.line}:${Xt.source.start.column})`:"";jt.push(` - ${Xt.message}${Jt} [${Xt.code}]`)}}}return jt.join(`
|
|
5
|
+
`)}function Io(ee){return ee.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
6
|
+
`,"%0A")}function Zc(ee){return Io(ee).replaceAll(":","%3A").replaceAll(",","%2C")}function el(ee){let Oe=[["file",ee.file],["line",ee.line],["col",ee.column],["endLine",ee.endLine],["endColumn",ee.endColumn],["title",ee.title]].filter((Ot)=>Ot[1]!==void 0).map(([Ot,jt])=>`${Ot}=${Zc(String(jt))}`).join(",");return`::${ee.severity} ${Oe}::${Io(ee.message)}`}function Oo(ee,te){let Oe=ee.filter((jt)=>!jt.ignored);return[...Oe.filter((jt)=>jt.severity==="error"),...Oe.filter((jt)=>jt.severity!=="error")].map(({source:jt,...Vt})=>{let Wt=jt!==void 0&&jt.start.line===jt.end.line;return el({severity:Vt.severity,title:Vt.code,message:Vt.message,file:te(Vt.component),line:jt?.start.line,column:Wt?jt.start.column+1:void 0,endLine:jt?.end.line,endColumn:Wt?jt.end.column+1:void 0})}).join(`
|
|
7
|
+
`)}var Fe=1;function Lo(ee){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Fe,diagnostics:ee},null,2)}
|
|
8
|
+
`}function ui(ee,te){if(te.length===0)return;ee.diagnostics=[...ee.diagnostics??[],...te]}var tl=/\*\//g,nl=/[.*+?^${}()|[\]\\]/g;function _(ee){return ee.replace(nl,"\\$&")}function M(ee){return ee.replace(tl,"*\\/")}function h(ee){return ee.map((te)=>`${te.name}${te.optional?"?":""}: ${te.type}`).join(", ")}var il=new Intl.Collator("en");function u(ee,te){return il.compare(ee,te)}var sl=/(?:_|[^\p{ID_Continue}$])+/u,rl=/^[\p{ID_Start}$]/u;function K(ee){let Ot=`${ee.split(sl).map((jt)=>jt.charAt(0).toUpperCase()+jt.slice(1)).join("")}Context`;return rl.test(Ot)?Ot:`_${Ot}`}var ol=/^\{([\s\S]*)\}$/,al=/^[A-Za-z_$][\w$]*$/,pl=/^readonly\s+/,cl=/^\[[\w$]+\s*:[^\]]+\]$/;function d(ee,{skipIndexSignatures:te=!1}={}){let Oe=ee.trim(),Ot=ol.exec(Oe);if(!Ot)return null;let jt=Ot[1].trim();if(jt==="")return[];let Vt=[];for(let Wt of r(jt,";,")){let Mt=Wt.trim();if(!Mt)continue;let Gt=z(Mt,":");if(Gt===-1)return null;let Ut=Mt.slice(0,Gt).trim().replace(pl,""),Ht=Mt.slice(Gt+1).trim();if(!Ht)return null;if(te&&cl.test(Ut))continue;let qt=!1;if(Ut.endsWith("?"))qt=!0,Ut=Ut.slice(0,-1).trim();if(!al.test(Ut))return null;Vt.push({name:Ut,type:Ht,optional:qt})}return Vt}function oe({imported:ee}){return ee.type==="Identifier"?ee.name:ee.value}function X(ee,te){let Oe=te.source.value;if(typeof Oe!=="string"||te.importKind==="type")return;for(let Ot of te.specifiers){if(Ot.type!=="ImportSpecifier"||Ot.importKind==="type")continue;let jt=Ot.local.name,Vt=oe(Ot);ee.valueImportBindingsByLocalName.set(jt,{localName:jt,importedName:Vt,source:Oe})}}function ae(ee){return[ee.importedName,...ee.members??[]].join(".")}function Ce(ee,te){let Oe=[],Ot=te;while(C(Ot)){if(Ot.computed||!t(Ot.property))return;Oe.unshift(Ot.property.name),Ot=Ot.object}if(!t(Ot))return;return Y(ee,Ot.name,Oe)}function Y(ee,te,Oe=[]){let Ot=(Vt,Wt,Mt)=>Mt.length>0?{source:Vt,importedName:Wt,members:Mt}:{source:Vt,importedName:Wt},jt=ee.valueImportBindingsByLocalName.get(te);if(jt)return Ot(jt.source,jt.importedName,Oe);for(let Vt of[ee.parsed?.instance,ee.parsed?.module])for(let Wt of Vt?.content.body??[]){if(Wt.type!=="ImportDeclaration")continue;let Mt=Wt.source.value;if(Wt.importKind==="type"||typeof Mt!=="string")continue;let Gt=Wt.specifiers.find((Ut)=>Ut.local.name===te);if(Gt?.type==="ImportDefaultSpecifier")return Ot(Mt,"default",Oe);if(Gt?.type==="ImportNamespaceSpecifier"&&Oe.length>0)return Ot(Mt,Oe[0],Oe.slice(1))}return}function le(ee,te){if(!C(te))return;return Ce(ee,te)}function Be(ee){let te=new Map;for(let Oe of ee.content.body){if(Oe.type!=="ImportDeclaration"||Oe.importKind==="type")continue;let Ot=Oe.source.value;if(typeof Ot!=="string")continue;for(let jt of Oe.specifiers){if(jt.type==="ImportSpecifier"&&jt.importKind==="type")continue;let Vt=jt.local.name,Wt;if(jt.type==="ImportDefaultSpecifier")Wt="default";else if(jt.type==="ImportNamespaceSpecifier")Wt="*";else Wt=oe(jt);te.set(Vt,{from:Ot,imported:Wt})}}return te}function Te(ee,te){for(let Oe of te?.content.body??[]){if(Oe.type==="ImportDeclaration"){X(ee,Oe);continue}let Ot=Oe.type==="ExportNamedDeclaration"&&Oe.declaration?Oe.declaration:Oe;if(Ot.type==="FunctionDeclaration"&&Ot.id?.name)ee.funcDecls.set(Ot.id.name,Ot)}}function pe(ee){return ee==="TSTypeAnnotation"||ee==="TSTypeAliasDeclaration"||ee==="TSInterfaceDeclaration"||ee==="TSTypeParameterDeclaration"||ee==="TSTypeParameterInstantiation"}function Q(ee){let te=[];return o(ee,{enter(Oe){if(Oe.type==="FunctionDeclaration"||Oe.type==="FunctionExpression"||Oe.type==="ArrowFunctionExpression")return p;if(Oe.type==="ReturnStatement")te.push(Oe.argument??null)}}),te}var qs={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"},zs="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",ll={5:zs,"5module":zs+" export import",6:zs+" const class extends export import super"},Vo=/^in(stanceof)?$/,ul=/\p{ID_Start}/u,hl=/[\p{ID_Continue}\u200c\u200d]/u;function g(ee,te){if(ee<65)return ee===36;if(ee<91)return!0;if(ee<97)return ee===95;if(ee<123)return!0;if(ee>65535&&te===!1)return!1;return ee>=170&&ul.test(String.fromCodePoint(ee))}function S(ee,te){if(ee<48)return ee===36;if(ee<58)return!0;if(ee<65)return!1;if(ee<91)return!0;if(ee<97)return ee===95;if(ee<123)return!0;if(ee>65535&&te===!1)return!1;return ee>=170&&hl.test(String.fromCodePoint(ee))}var pn=function(ee,te){if(te===void 0)te={};this.label=ee,this.keyword=te.keyword,this.beforeExpr=!!te.beforeExpr,this.startsExpr=!!te.startsExpr,this.isLoop=!!te.isLoop,this.isAssign=!!te.isAssign,this.prefix=!!te.prefix,this.postfix=!!te.postfix,this.binop=te.binop||null,this.updateContext=null};function Cn(ee,te){return new pn(ee,{beforeExpr:!0,binop:te})}var wn={beforeExpr:!0},vn={startsExpr:!0},Qs={};function an(ee,te){if(te===void 0)te={};return te.keyword=ee,Qs[ee]=new pn(ee,te)}var Kt={num:new pn("num",vn),regexp:new pn("regexp",vn),string:new pn("string",vn),name:new pn("name",vn),privateId:new pn("privateId",vn),eof:new pn("eof"),bracketL:new pn("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new pn("]"),braceL:new pn("{",{beforeExpr:!0,startsExpr:!0}),braceR:new pn("}"),parenL:new pn("(",{beforeExpr:!0,startsExpr:!0}),parenR:new pn(")"),comma:new pn(",",wn),semi:new pn(";",wn),colon:new pn(":",wn),dot:new pn("."),question:new pn("?",wn),questionDot:new pn("?."),arrow:new pn("=>",wn),template:new pn("template"),invalidTemplate:new pn("invalidTemplate"),ellipsis:new pn("...",wn),backQuote:new pn("`",vn),dollarBraceL:new pn("${",{beforeExpr:!0,startsExpr:!0}),eq:new pn("=",{beforeExpr:!0,isAssign:!0}),assign:new pn("_=",{beforeExpr:!0,isAssign:!0}),incDec:new pn("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new pn("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Cn("||",1),logicalAND:Cn("&&",2),bitwiseOR:Cn("|",3),bitwiseXOR:Cn("^",4),bitwiseAND:Cn("&",5),equality:Cn("==/!=/===/!==",6),relational:Cn("</>/<=/>=",7),bitShift:Cn("<</>>/>>>",8),plusMin:new pn("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Cn("%",10),star:Cn("*",10),slash:Cn("/",10),starstar:new pn("**",{beforeExpr:!0}),coalesce:Cn("??",1),_break:an("break"),_case:an("case",wn),_catch:an("catch"),_continue:an("continue"),_debugger:an("debugger"),_default:an("default",wn),_do:an("do",{isLoop:!0,beforeExpr:!0}),_else:an("else",wn),_finally:an("finally"),_for:an("for",{isLoop:!0}),_function:an("function",vn),_if:an("if"),_return:an("return",wn),_switch:an("switch"),_throw:an("throw",wn),_try:an("try"),_var:an("var"),_const:an("const"),_while:an("while",{isLoop:!0}),_with:an("with"),_new:an("new",{beforeExpr:!0,startsExpr:!0}),_this:an("this",vn),_super:an("super",vn),_class:an("class",vn),_extends:an("extends",wn),_export:an("export"),_import:an("import",vn),_null:an("null",vn),_true:an("true",vn),_false:an("false",vn),_in:an("in",{beforeExpr:!0,binop:7}),_instanceof:an("instanceof",{beforeExpr:!0,binop:7}),_typeof:an("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:an("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:an("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},En=/\r\n?|\n|\u2028|\u2029/,dl=new RegExp(En.source,"g");function hi(ee){return ee===10||ee===13||ee===8232||ee===8233}function Go(ee,te,Oe){if(Oe===void 0)Oe=ee.length;for(var Ot=te;Ot<Oe;Ot++){var jt=ee.charCodeAt(Ot);if(hi(jt))return Ot<Oe-1&&jt===13&&ee.charCodeAt(Ot+1)===10?Ot+2:Ot+1}return-1}var Wo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,dn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,fl=Object.prototype,{hasOwnProperty:ml,toString:gl}=fl,wi=Object.hasOwn||function(ee,te){return ml.call(ee,te)},Mo=Array.isArray||function(ee){return gl.call(ee)==="[object Array]"},Fo=Object.create(null);function Qi(ee){return Fo[ee]||(Fo[ee]=new RegExp("^(?:"+ee.replace(/ /g,"|")+")$"))}function ns(ee){if(ee<=65535)return String.fromCharCode(ee);return ee-=65536,String.fromCharCode((ee>>10)+55296,(ee&1023)+56320)}var yl=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ci=function(ee,te){this.line=ee,this.column=te};Ci.prototype.offset=function(ee){return new Ci(this.line,this.column+ee)};var is=function(ee,te,Oe){if(this.start=te,this.end=Oe,ee.sourceFile!==null)this.source=ee.sourceFile};function Uo(ee,te){for(var Oe=1,Ot=0;;){var jt=Go(ee,Ot,te);if(jt<0)return new Ci(Oe,te-Ot);++Oe,Ot=jt}}var Xs={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},Bo=!1;function xl(ee){var te={};for(var Oe in Xs)te[Oe]=ee&&wi(ee,Oe)?ee[Oe]:Xs[Oe];if(te.ecmaVersion==="latest")te.ecmaVersion=1e8;else if(te.ecmaVersion==null){if(!Bo&&typeof console==="object"&&console.warn)Bo=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
9
|
+
Defaulting to 2020, but this will stop working in the future.`);te.ecmaVersion=11}else if(te.ecmaVersion>=2015)te.ecmaVersion-=2009;if(te.allowReserved==null)te.allowReserved=te.ecmaVersion<5;if(!ee||ee.allowHashBang==null)te.allowHashBang=te.ecmaVersion>=14;if(Mo(te.onToken)){var Ot=te.onToken;te.onToken=function(jt){return Ot.push(jt)}}if(Mo(te.onComment))te.onComment=vl(te,te.onComment);if(te.sourceType==="commonjs"&&te.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return te}function vl(ee,te){return function(Oe,Ot,jt,Vt,Wt,Mt){var Gt={type:Oe?"Block":"Line",value:Ot,start:jt,end:Vt};if(ee.locations)Gt.loc=new is(this,Wt,Mt);if(ee.ranges)Gt.range=[jt,Vt];te.push(Gt)}}var ei=1,ti=2,Zs=4,Ho=8,er=16,Ko=32,ss=64,qo=128,ni=256,Ti=512,zo=1024,rs=ei|ti|ni;function tr(ee,te){return ti|(ee?Zs:0)|(te?Ho:0)}var Zi=0,nr=1,Fn=2,Xo=3,Jo=4,Yo=5,s=function(ee,te,Oe){this.options=ee=xl(ee),this.sourceFile=ee.sourceFile,this.keywords=Qi(ll[ee.ecmaVersion>=6?6:ee.sourceType==="module"?"5module":5]);var Ot="";if(ee.allowReserved!==!0){if(Ot=qs[ee.ecmaVersion>=6?6:ee.ecmaVersion===5?5:3],ee.sourceType==="module")Ot+=" await"}this.reservedWords=Qi(Ot);var jt=(Ot?Ot+" ":"")+qs.strict;if(this.reservedWordsStrict=Qi(jt),this.reservedWordsStrictBind=Qi(jt+" "+qs.strictBind),this.input=String(te),this.containsEsc=!1,this.pos=Oe||0,this.curLine=1,ee.startLocation)this.lineStart=this.pos-ee.startLocation.column,this.curLine=ee.startLocation.line;else if(Oe){if(this.lineStart=this.input.lastIndexOf(`
|
|
10
|
+
`,Oe-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(En).length}else this.lineStart=0;if(this.type=Kt.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=ee.sourceType==="module",this.strict=this.inModule||ee.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&&ee.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?ti:ei),this.regexpState=null,this.privateNameStack=[]},Tn={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 ee=this,te=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return ee.parseTopLevel(te)})};Tn.inFunction.get=function(){return(this.currentVarScope().flags&ti)>0};Tn.inGenerator.get=function(){return(this.currentVarScope().flags&Ho)>0};Tn.inAsync.get=function(){return(this.currentVarScope().flags&Zs)>0};Tn.canAwait.get=function(){for(var ee=this.scopeStack.length-1;ee>=0;ee--){var te=this.scopeStack[ee],Oe=te.flags;if(Oe&(ni|Ti))return!1;if(Oe&ti)return(Oe&Zs)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Tn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ei)return!0;return!1};Tn.allowSuper.get=function(){var ee=this.currentThisScope(),te=ee.flags;return(te&ss)>0||this.options.allowSuperOutsideMethod};Tn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&qo)>0};Tn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Tn.allowNewDotTarget.get=function(){for(var ee=this.scopeStack.length-1;ee>=0;ee--){var te=this.scopeStack[ee],Oe=te.flags;if(Oe&(ni|Ti)||Oe&ti&&!(Oe&er))return!0}return!1};Tn.allowUsing.get=function(){var ee=this.currentScope(),te=ee.flags;if(te&zo)return!1;if(!this.inModule&&te&ei)return!1;return!0};Tn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ni)>0};s.extend=function(){var ee=[],te=arguments.length;while(te--)ee[te]=arguments[te];var Oe=this;for(var Ot=0;Ot<ee.length;Ot++)Oe=ee[Ot](Oe);return Oe};s.parse=function(ee,te){return new this(te,ee).parse()};s.parseExpressionAt=function(ee,te,Oe){var Ot=new this(Oe,ee,te);return Ot.nextToken(),Ot.parseExpression()};s.tokenizer=function(ee,te){return new this(te,ee)};Object.defineProperties(s.prototype,Tn);var yn=s.prototype,El=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;yn.strictDirective=function(ee){if(this.options.ecmaVersion<5)return!1;for(;;){dn.lastIndex=ee,ee+=dn.exec(this.input)[0].length;var te=El.exec(this.input.slice(ee));if(!te)return!1;if((te[1]||te[2])==="use strict"){dn.lastIndex=ee+te[0].length;var Oe=dn.exec(this.input),Ot=Oe.index+Oe[0].length,jt=this.input.charAt(Ot);return jt===";"||jt==="}"||En.test(Oe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(jt)||jt==="!"&&this.input.charAt(Ot+1)==="=")}if(ee+=te[0].length,dn.lastIndex=ee,ee+=dn.exec(this.input)[0].length,this.input[ee]===";")ee++}};yn.eat=function(ee){if(this.type===ee)return this.next(),!0;else return!1};yn.isContextual=function(ee){return this.type===Kt.name&&this.value===ee&&!this.containsEsc};yn.eatContextual=function(ee){if(!this.isContextual(ee))return!1;return this.next(),!0};yn.catchStackOverflow=function(ee){try{return ee()}catch(te){if(te instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(te.message)||/\btoo much recursion\b/i.test(te.message)))this.raise(this.start,"Not enough stack space to parse input");else throw te}};yn.expectContextual=function(ee){if(!this.eatContextual(ee))this.unexpected()};yn.canInsertSemicolon=function(){return this.type===Kt.eof||this.type===Kt.braceR||En.test(this.input.slice(this.lastTokEnd,this.start))};yn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};yn.semicolon=function(){if(!this.eat(Kt.semi)&&!this.insertSemicolon())this.unexpected()};yn.afterTrailingComma=function(ee,te){if(this.type===ee){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!te)this.next();return!0}};yn.expect=function(ee){this.eat(ee)||this.unexpected()};yn.unexpected=function(ee){this.raise(ee!=null?ee:this.start,"Unexpected token")};var os=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};yn.checkPatternErrors=function(ee,te){if(!ee)return;if(ee.trailingComma>-1)this.raiseRecoverable(ee.trailingComma,"Comma is not permitted after the rest element");var Oe=te?ee.parenthesizedAssign:ee.parenthesizedBind;if(Oe>-1)this.raiseRecoverable(Oe,te?"Assigning to rvalue":"Parenthesized pattern")};yn.checkExpressionErrors=function(ee,te){if(!ee)return!1;var{shorthandAssign:Oe,doubleProto:Ot}=ee;if(!te)return Oe>=0||Ot>=0;if(Oe>=0)this.raise(Oe,"Shorthand property assignments are valid only in destructuring patterns");if(Ot>=0)this.raiseRecoverable(Ot,"Redefinition of __proto__ property")};yn.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")};yn.isSimpleAssignTarget=function(ee){if(ee.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(ee.expression);return ee.type==="Identifier"||ee.type==="MemberExpression"};var Zt=s.prototype;Zt.parseTopLevel=function(ee){var te=Object.create(null);if(!ee.body)ee.body=[];while(this.type!==Kt.eof){var Oe=this.parseStatement(null,!0,te);ee.body.push(Oe)}if(this.inModule)for(var Ot=0,jt=Object.keys(this.undefinedExports);Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.raiseRecoverable(this.undefinedExports[Vt].start,"Export '"+Vt+"' is not defined")}return this.adaptDirectivePrologue(ee.body),this.next(),ee.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(ee,"Program")};var ir={kind:"loop"},Sl={kind:"switch"};Zt.isLet=function(ee){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;dn.lastIndex=this.pos;var te=dn.exec(this.input),Oe=this.pos+te[0].length,Ot=this.fullCharCodeAt(Oe);if(Ot===91||Ot===92)return!0;if(ee)return!1;if(Ot===123)return!0;if(g(Ot)){var jt=Oe;do Oe+=Ot<=65535?1:2;while(S(Ot=this.fullCharCodeAt(Oe)));if(Ot===92)return!0;var Vt=this.input.slice(jt,Oe);if(!Vo.test(Vt))return!0}return!1};Zt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dn.lastIndex=this.pos;var ee=dn.exec(this.input),te=this.pos+ee[0].length,Oe;return!En.test(this.input.slice(this.pos,te))&&this.input.slice(te,te+8)==="function"&&(te+8===this.input.length||!(S(Oe=this.fullCharCodeAt(te+8))||Oe===92))};Zt.isUsingKeyword=function(ee,te){if(this.options.ecmaVersion<17||!this.isContextual(ee?"await":"using"))return!1;dn.lastIndex=this.pos;var Oe=dn.exec(this.input),Ot=this.pos+Oe[0].length;if(En.test(this.input.slice(this.pos,Ot)))return!1;if(ee){var jt=Ot+5,Vt;if(this.input.slice(Ot,jt)!=="using"||jt===this.input.length||S(Vt=this.fullCharCodeAt(jt))||Vt===92)return!1;dn.lastIndex=jt;var Wt=dn.exec(this.input);if(Ot=jt+Wt[0].length,Wt&&En.test(this.input.slice(jt,Ot)))return!1}var Mt=this.fullCharCodeAt(Ot);if(!g(Mt)&&Mt!==92)return!1;var Gt=Ot;do Ot+=Mt<=65535?1:2;while(S(Mt=this.fullCharCodeAt(Ot)));if(Mt===92)return!0;var Ut=this.input.slice(Gt,Ot);if(Vo.test(Ut))return!1;if(te&&!ee&&Ut==="of"){dn.lastIndex=Ot;var Ht=dn.exec(this.input);if(Ot=Ot+Ht[0].length,this.input.charCodeAt(Ot)!==61||(Mt=this.input.charCodeAt(Ot+1))===61||Mt===62)return!1}return!0};Zt.isAwaitUsing=function(ee){return this.isUsingKeyword(!0,ee)};Zt.isUsing=function(ee){return this.isUsingKeyword(!1,ee)};Zt.parseStatement=function(ee,te,Oe){var Ot=this.type,jt=this.startNode(),Vt;if(this.isLet(ee))Ot=Kt._var,Vt="let";switch(Ot){case Kt._break:case Kt._continue:return this.parseBreakContinueStatement(jt,Ot.keyword);case Kt._debugger:return this.parseDebuggerStatement(jt);case Kt._do:return this.parseDoStatement(jt);case Kt._for:return this.parseForStatement(jt);case Kt._function:if(ee&&(this.strict||ee!=="if"&&ee!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(jt,!1,!ee);case Kt._class:if(ee)this.unexpected();return this.parseClass(jt,!0);case Kt._if:return this.parseIfStatement(jt);case Kt._return:return this.parseReturnStatement(jt);case Kt._switch:return this.parseSwitchStatement(jt);case Kt._throw:return this.parseThrowStatement(jt);case Kt._try:return this.parseTryStatement(jt);case Kt._const:case Kt._var:if(Vt=Vt||this.value,ee&&Vt!=="var")this.unexpected();return this.parseVarStatement(jt,Vt);case Kt._while:return this.parseWhileStatement(jt);case Kt._with:return this.parseWithStatement(jt);case Kt.braceL:return this.parseBlock(!0,jt);case Kt.semi:return this.parseEmptyStatement(jt);case Kt._export:case Kt._import:if(this.options.ecmaVersion>10&&Ot===Kt._import){dn.lastIndex=this.pos;var Wt=dn.exec(this.input),Mt=this.pos+Wt[0].length,Gt=this.input.charCodeAt(Mt);if(Gt===40||Gt===46)return this.parseExpressionStatement(jt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!te)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 Ot===Kt._import?this.parseImport(jt):this.parseExport(jt,Oe);default:if(this.isAsyncFunction()){if(ee)this.unexpected();return this.next(),this.parseFunctionStatement(jt,!0,!ee)}var Ut=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Ut){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(ee)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Ut==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(jt,!1,Ut),this.semicolon(),this.finishNode(jt,"VariableDeclaration")}var Ht=this.value,qt=this.parseExpression();if(Ot===Kt.name&&qt.type==="Identifier"&&this.eat(Kt.colon))return this.parseLabeledStatement(jt,Ht,qt,ee);else return this.parseExpressionStatement(jt,qt)}};Zt.parseBreakContinueStatement=function(ee,te){var Oe=te==="break";if(this.next(),this.eat(Kt.semi)||this.insertSemicolon())ee.label=null;else if(this.type!==Kt.name)this.unexpected();else ee.label=this.parseIdent(),this.semicolon();var Ot=0;for(;Ot<this.labels.length;++Ot){var jt=this.labels[Ot];if(ee.label==null||jt.name===ee.label.name){if(jt.kind!=null&&(Oe||jt.kind==="loop"))break;if(ee.label&&Oe)break}}if(Ot===this.labels.length)this.raise(ee.start,"Unsyntactic "+te);return this.finishNode(ee,Oe?"BreakStatement":"ContinueStatement")};Zt.parseDebuggerStatement=function(ee){return this.next(),this.semicolon(),this.finishNode(ee,"DebuggerStatement")};Zt.parseDoStatement=function(ee){if(this.next(),this.labels.push(ir),ee.body=this.parseStatement("do"),this.labels.pop(),this.expect(Kt._while),ee.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Kt.semi);else this.semicolon();return this.finishNode(ee,"DoWhileStatement")};Zt.parseForStatement=function(ee){this.next();var te=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(ir),this.enterScope(0),this.expect(Kt.parenL),this.type===Kt.semi){if(te>-1)this.unexpected(te);return this.parseFor(ee,null)}var Oe=this.isLet();if(this.type===Kt._var||this.type===Kt._const||Oe){var Ot=this.startNode(),jt=Oe?"let":this.value;return this.next(),this.parseVar(Ot,!0,jt),this.finishNode(Ot,"VariableDeclaration"),this.parseForAfterInit(ee,Ot,te)}var Vt=this.isContextual("let"),Wt=!1,Mt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Mt){var Gt=this.startNode();if(this.next(),Mt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Gt,!0,Mt),this.finishNode(Gt,"VariableDeclaration"),this.parseForAfterInit(ee,Gt,te)}var Ut=this.containsEsc,Ht=new os,qt=this.start,zt=te>-1?this.parseExprSubscripts(Ht,"await"):this.parseExpression(!0,Ht);if(this.type===Kt._in||(Wt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(te>-1){if(this.type===Kt._in)this.unexpected(te);ee.await=!0}else if(Wt&&this.options.ecmaVersion>=8){if(zt.start===qt&&!Ut&&zt.type==="Identifier"&&zt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)ee.await=!1}if(Vt&&Wt)this.raise(zt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(zt,!1,Ht),this.checkLValPattern(zt),this.parseForIn(ee,zt)}else this.checkExpressionErrors(Ht,!0);if(te>-1)this.unexpected(te);return this.parseFor(ee,zt)};Zt.parseForAfterInit=function(ee,te,Oe){if((this.type===Kt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&te.declarations.length===1){if(this.type===Kt._in){if((te.kind==="using"||te.kind==="await using")&&!te.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Oe>-1)this.unexpected(Oe)}else if(this.options.ecmaVersion>=9)ee.await=Oe>-1;return this.parseForIn(ee,te)}if(Oe>-1)this.unexpected(Oe);return this.parseFor(ee,te)};Zt.parseFunctionStatement=function(ee,te,Oe){return this.next(),this.parseFunction(ee,bi|(Oe?0:Js),!1,te)};Zt.parseIfStatement=function(ee){return this.next(),ee.test=this.parseParenExpression(),ee.consequent=this.parseStatement("if"),ee.alternate=this.eat(Kt._else)?this.parseStatement("if"):null,this.finishNode(ee,"IfStatement")};Zt.parseReturnStatement=function(ee){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Kt.semi)||this.insertSemicolon())ee.argument=null;else ee.argument=this.parseExpression(),this.semicolon();return this.finishNode(ee,"ReturnStatement")};Zt.parseSwitchStatement=function(ee){this.next(),ee.discriminant=this.parseParenExpression(),ee.cases=[],this.expect(Kt.braceL),this.labels.push(Sl),this.enterScope(zo);var te;for(var Oe=!1;this.type!==Kt.braceR;)if(this.type===Kt._case||this.type===Kt._default){var Ot=this.type===Kt._case;if(te)this.finishNode(te,"SwitchCase");if(ee.cases.push(te=this.startNode()),te.consequent=[],this.next(),Ot)te.test=this.parseExpression();else{if(Oe)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Oe=!0,te.test=null}this.expect(Kt.colon)}else{if(!te)this.unexpected();te.consequent.push(this.parseStatement(null))}if(this.exitScope(),te)this.finishNode(te,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(ee,"SwitchStatement")};Zt.parseThrowStatement=function(ee){if(this.next(),En.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return ee.argument=this.parseExpression(),this.semicolon(),this.finishNode(ee,"ThrowStatement")};var bl=[];Zt.parseCatchClauseParam=function(){var ee=this.parseBindingAtom(),te=ee.type==="Identifier";return this.enterScope(te?Ko:0),this.checkLValPattern(ee,te?Jo:Fn),this.expect(Kt.parenR),ee};Zt.parseTryStatement=function(ee){if(this.next(),ee.block=this.parseBlock(),ee.handler=null,this.type===Kt._catch){var te=this.startNode();if(this.next(),this.eat(Kt.parenL))te.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();te.param=null,this.enterScope(0)}te.body=this.parseBlock(!1),this.exitScope(),ee.handler=this.finishNode(te,"CatchClause")}if(ee.finalizer=this.eat(Kt._finally)?this.parseBlock():null,!ee.handler&&!ee.finalizer)this.raise(ee.start,"Missing catch or finally clause");return this.finishNode(ee,"TryStatement")};Zt.parseVarStatement=function(ee,te,Oe){return this.next(),this.parseVar(ee,!1,te,Oe),this.semicolon(),this.finishNode(ee,"VariableDeclaration")};Zt.parseWhileStatement=function(ee){return this.next(),ee.test=this.parseParenExpression(),this.labels.push(ir),ee.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(ee,"WhileStatement")};Zt.parseWithStatement=function(ee){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),ee.object=this.parseParenExpression(),ee.body=this.parseStatement("with"),this.finishNode(ee,"WithStatement")};Zt.parseEmptyStatement=function(ee){return this.next(),this.finishNode(ee,"EmptyStatement")};Zt.parseLabeledStatement=function(ee,te,Oe,Ot){for(var jt=0,Vt=this.labels;jt<Vt.length;jt+=1){var Wt=Vt[jt];if(Wt.name===te)this.raise(Oe.start,"Label '"+te+"' is already declared")}var Mt=this.type.isLoop?"loop":this.type===Kt._switch?"switch":null;for(var Gt=this.labels.length-1;Gt>=0;Gt--){var Ut=this.labels[Gt];if(Ut.statementStart===ee.start)Ut.statementStart=this.start,Ut.kind=Mt;else break}return this.labels.push({name:te,kind:Mt,statementStart:this.start}),ee.body=this.parseStatement(Ot?Ot.indexOf("label")===-1?Ot+"label":Ot:"label"),this.labels.pop(),ee.label=Oe,this.finishNode(ee,"LabeledStatement")};Zt.parseExpressionStatement=function(ee,te){return ee.expression=te,this.semicolon(),this.finishNode(ee,"ExpressionStatement")};Zt.parseBlock=function(ee,te,Oe){if(ee===void 0)ee=!0;if(te===void 0)te=this.startNode();if(te.body=[],this.expect(Kt.braceL),ee)this.enterScope(0);while(this.type!==Kt.braceR){var Ot=this.parseStatement(null);te.body.push(Ot)}if(Oe)this.strict=!1;if(this.next(),ee)this.exitScope();return this.finishNode(te,"BlockStatement")};Zt.parseFor=function(ee,te){return ee.init=te,this.expect(Kt.semi),ee.test=this.type===Kt.semi?null:this.parseExpression(),this.expect(Kt.semi),ee.update=this.type===Kt.parenR?null:this.parseExpression(),this.expect(Kt.parenR),ee.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(ee,"ForStatement")};Zt.parseForIn=function(ee,te){var Oe=this.type===Kt._in;if(this.next(),te.type==="VariableDeclaration"&&te.declarations[0].init!=null&&(!Oe||this.options.ecmaVersion<8||this.strict||te.kind!=="var"||te.declarations[0].id.type!=="Identifier"))this.raise(te.start,(Oe?"for-in":"for-of")+" loop variable declaration may not have an initializer");return ee.left=te,ee.right=Oe?this.parseExpression():this.parseMaybeAssign(),this.expect(Kt.parenR),ee.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(ee,Oe?"ForInStatement":"ForOfStatement")};Zt.parseVar=function(ee,te,Oe,Ot){ee.declarations=[],ee.kind=Oe;for(;;){var jt=this.startNode();if(this.parseVarId(jt,Oe),this.eat(Kt.eq))jt.init=this.parseMaybeAssign(te);else if(!Ot&&Oe==="const"&&!(this.type===Kt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ot&&(Oe==="using"||Oe==="await using")&&this.options.ecmaVersion>=17&&this.type!==Kt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Oe+" declaration");else if(!Ot&&jt.id.type!=="Identifier"&&!(te&&(this.type===Kt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else jt.init=null;if(ee.declarations.push(this.finishNode(jt,"VariableDeclarator")),!this.eat(Kt.comma))break}return ee};Zt.parseVarId=function(ee,te){ee.id=te==="using"||te==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(ee.id,te==="var"?nr:Fn,!1)};var bi=1,Js=2,Qo=4;Zt.parseFunction=function(ee,te,Oe,Ot,jt){if(this.initFunction(ee),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ot){if(this.type===Kt.star&&te&Js)this.unexpected();ee.generator=this.eat(Kt.star)}if(this.options.ecmaVersion>=8)ee.async=!!Ot;if(te&bi){if(ee.id=te&Qo&&this.type!==Kt.name?null:this.parseIdent(),ee.id&&!(te&Js))this.checkLValSimple(ee.id,this.strict||ee.generator||ee.async?this.treatFunctionsAsVar?nr:Fn:Xo)}var Vt=this.yieldPos,Wt=this.awaitPos,Mt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(tr(ee.async,ee.generator)),!(te&bi))ee.id=this.type===Kt.name?this.parseIdent():null;return this.parseFunctionParams(ee),this.parseFunctionBody(ee,Oe,!1,jt),this.yieldPos=Vt,this.awaitPos=Wt,this.awaitIdentPos=Mt,this.finishNode(ee,te&bi?"FunctionDeclaration":"FunctionExpression")};Zt.parseFunctionParams=function(ee){this.expect(Kt.parenL),ee.params=this.parseBindingList(Kt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Zt.parseClass=function(ee,te){this.next();var Oe=this.strict;this.strict=!0,this.parseClassId(ee,te),this.parseClassSuper(ee);var Ot=this.enterClassBody(),jt=this.startNode(),Vt=!1;jt.body=[],this.expect(Kt.braceL);while(this.type!==Kt.braceR){var Wt=this.parseClassElement(ee.superClass!==null);if(Wt){if(jt.body.push(Wt),Wt.type==="MethodDefinition"&&Wt.kind==="constructor"){if(Vt)this.raiseRecoverable(Wt.start,"Duplicate constructor in the same class");Vt=!0}else if(Wt.key&&Wt.key.type==="PrivateIdentifier"&&Cl(Ot,Wt))this.raiseRecoverable(Wt.key.start,"Identifier '#"+Wt.key.name+"' has already been declared")}}return this.strict=Oe,this.next(),ee.body=this.finishNode(jt,"ClassBody"),this.exitClassBody(),this.finishNode(ee,te?"ClassDeclaration":"ClassExpression")};Zt.parseClassElement=function(ee){if(this.eat(Kt.semi))return null;var te=this.options.ecmaVersion,Oe=this.startNode(),Ot="",jt=!1,Vt=!1,Wt="method",Mt=!1;if(this.eatContextual("static")){if(te>=13&&this.eat(Kt.braceL))return this.parseClassStaticBlock(Oe),Oe;if(this.isClassElementNameStart()||this.type===Kt.star)Mt=!0;else Ot="static"}if(Oe.static=Mt,!Ot&&te>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Kt.star)&&!this.canInsertSemicolon())Vt=!0;else Ot="async";if(!Ot&&(te>=9||!Vt)&&this.eat(Kt.star))jt=!0;if(!Ot&&!Vt&&!jt){var Gt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Wt=Gt;else Ot=Gt}if(Ot)Oe.computed=!1,Oe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Oe.key.name=Ot,this.finishNode(Oe.key,"Identifier");else this.parseClassElementName(Oe);if(te<13||this.type===Kt.parenL||Wt!=="method"||jt||Vt){var Ut=!Oe.static&&es(Oe,"constructor"),Ht=Ut&ⅇif(Ut&&Wt!=="method")this.raise(Oe.key.start,"Constructor can't have get/set modifier");Oe.kind=Ut?"constructor":Wt,this.parseClassMethod(Oe,jt,Vt,Ht)}else this.parseClassField(Oe);return Oe};Zt.isClassElementNameStart=function(){return this.type===Kt.name||this.type===Kt.privateId||this.type===Kt.num||this.type===Kt.string||this.type===Kt.bracketL||this.type.keyword};Zt.parseClassElementName=function(ee){if(this.type===Kt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");ee.computed=!1,ee.key=this.parsePrivateIdent()}else this.parsePropertyName(ee)};Zt.parseClassMethod=function(ee,te,Oe,Ot){var jt=ee.key;if(ee.kind==="constructor"){if(te)this.raise(jt.start,"Constructor can't be a generator");if(Oe)this.raise(jt.start,"Constructor can't be an async method")}else if(ee.static&&es(ee,"prototype"))this.raise(jt.start,"Classes may not have a static property named prototype");var Vt=ee.value=this.parseMethod(te,Oe,Ot);if(ee.kind==="get"&&Vt.params.length!==0)this.raiseRecoverable(Vt.start,"getter should have no params");if(ee.kind==="set"&&Vt.params.length!==1)this.raiseRecoverable(Vt.start,"setter should have exactly one param");if(ee.kind==="set"&&Vt.params[0].type==="RestElement")this.raiseRecoverable(Vt.params[0].start,"Setter cannot use rest params");return this.finishNode(ee,"MethodDefinition")};Zt.parseClassField=function(ee){if(es(ee,"constructor"))this.raise(ee.key.start,"Classes can't have a field named 'constructor'");else if(ee.static&&es(ee,"prototype"))this.raise(ee.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Kt.eq))this.enterScope(Ti|ss),ee.value=this.parseMaybeAssign(),this.exitScope();else ee.value=null;return this.semicolon(),this.finishNode(ee,"PropertyDefinition")};Zt.parseClassStaticBlock=function(ee){ee.body=[];var te=this.labels;this.labels=[],this.enterScope(ni|ss);while(this.type!==Kt.braceR){var Oe=this.parseStatement(null);ee.body.push(Oe)}return this.next(),this.exitScope(),this.labels=te,this.finishNode(ee,"StaticBlock")};Zt.parseClassId=function(ee,te){if(this.type===Kt.name){if(ee.id=this.parseIdent(),te)this.checkLValSimple(ee.id,Fn,!1)}else{if(te===!0)this.unexpected();ee.id=null}};Zt.parseClassSuper=function(ee){ee.superClass=this.eat(Kt._extends)?this.parseExprSubscripts(null,!1):null};Zt.enterClassBody=function(){var ee={declared:Object.create(null),used:[]};return this.privateNameStack.push(ee),ee.declared};Zt.exitClassBody=function(){var ee=this.privateNameStack.pop(),{declared:te,used:Oe}=ee;if(!this.options.checkPrivateFields)return;var Ot=this.privateNameStack.length,jt=Ot===0?null:this.privateNameStack[Ot-1];for(var Vt=0;Vt<Oe.length;++Vt){var Wt=Oe[Vt];if(!wi(te,Wt.name))if(jt)jt.used.push(Wt);else this.raiseRecoverable(Wt.start,"Private field '#"+Wt.name+"' must be declared in an enclosing class")}};function Cl(ee,te){var Oe=te.key.name,Ot=ee[Oe],jt="true";if(te.type==="MethodDefinition"&&(te.kind==="get"||te.kind==="set"))jt=(te.static?"s":"i")+te.kind;if(Ot==="iget"&&jt==="iset"||Ot==="iset"&&jt==="iget"||Ot==="sget"&&jt==="sset"||Ot==="sset"&&jt==="sget")return ee[Oe]="true",!1;else if(!Ot)return ee[Oe]=jt,!1;else return!0}function es(ee,te){var{computed:Oe,key:Ot}=ee;return!Oe&&(Ot.type==="Identifier"&&Ot.name===te||Ot.type==="Literal"&&Ot.value===te)}Zt.parseExportAllDeclaration=function(ee,te){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))ee.exported=this.parseModuleExportName(),this.checkExport(te,ee.exported,this.lastTokStart);else ee.exported=null;if(this.expectContextual("from"),this.type!==Kt.string)this.unexpected();if(ee.source=this.parseExprAtom(),this.options.ecmaVersion>=16)ee.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(ee,"ExportAllDeclaration")};Zt.parseExport=function(ee,te){if(this.next(),this.eat(Kt.star))return this.parseExportAllDeclaration(ee,te);if(this.eat(Kt._default))return this.checkExport(te,"default",this.lastTokStart),ee.declaration=this.parseExportDefaultDeclaration(),this.finishNode(ee,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(ee.declaration=this.parseExportDeclaration(ee),ee.declaration.type==="VariableDeclaration")this.checkVariableExport(te,ee.declaration.declarations);else this.checkExport(te,ee.declaration.id,ee.declaration.id.start);if(ee.specifiers=[],ee.source=null,this.options.ecmaVersion>=16)ee.attributes=[]}else{if(ee.declaration=null,ee.specifiers=this.parseExportSpecifiers(te),this.eatContextual("from")){if(this.type!==Kt.string)this.unexpected();if(ee.source=this.parseExprAtom(),this.options.ecmaVersion>=16)ee.attributes=this.parseWithClause()}else{for(var Oe=0,Ot=ee.specifiers;Oe<Ot.length;Oe+=1){var jt=Ot[Oe];if(this.checkUnreserved(jt.local),this.checkLocalExport(jt.local),jt.local.type==="Literal")this.raise(jt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(ee.source=null,this.options.ecmaVersion>=16)ee.attributes=[]}this.semicolon()}return this.finishNode(ee,"ExportNamedDeclaration")};Zt.parseExportDeclaration=function(ee){return this.parseStatement(null)};Zt.parseExportDefaultDeclaration=function(){var ee;if(this.type===Kt._function||(ee=this.isAsyncFunction())){var te=this.startNode();if(this.next(),ee)this.next();return this.parseFunction(te,bi|Qo,!1,ee)}else if(this.type===Kt._class){var Oe=this.startNode();return this.parseClass(Oe,"nullableID")}else{var Ot=this.parseMaybeAssign();return this.semicolon(),Ot}};Zt.checkExport=function(ee,te,Oe){if(!ee)return;if(typeof te!=="string")te=te.type==="Identifier"?te.name:te.value;if(wi(ee,te))this.raiseRecoverable(Oe,"Duplicate export '"+te+"'");ee[te]=!0};Zt.checkPatternExport=function(ee,te){var Oe=te.type;if(Oe==="Identifier")this.checkExport(ee,te,te.start);else if(Oe==="ObjectPattern")for(var Ot=0,jt=te.properties;Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.checkPatternExport(ee,Vt)}else if(Oe==="ArrayPattern")for(var Wt=0,Mt=te.elements;Wt<Mt.length;Wt+=1){var Gt=Mt[Wt];if(Gt)this.checkPatternExport(ee,Gt)}else if(Oe==="Property")this.checkPatternExport(ee,te.value);else if(Oe==="AssignmentPattern")this.checkPatternExport(ee,te.left);else if(Oe==="RestElement")this.checkPatternExport(ee,te.argument)};Zt.checkVariableExport=function(ee,te){if(!ee)return;for(var Oe=0,Ot=te;Oe<Ot.length;Oe+=1){var jt=Ot[Oe];this.checkPatternExport(ee,jt.id)}};Zt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Zt.parseExportSpecifier=function(ee){var te=this.startNode();return te.local=this.parseModuleExportName(),te.exported=this.eatContextual("as")?this.parseModuleExportName():te.local,this.checkExport(ee,te.exported,te.exported.start),this.finishNode(te,"ExportSpecifier")};Zt.parseExportSpecifiers=function(ee){var te=[],Oe=!0;this.expect(Kt.braceL);while(!this.eat(Kt.braceR)){if(!Oe){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else Oe=!1;te.push(this.parseExportSpecifier(ee))}return te};Zt.parseImport=function(ee){if(this.next(),this.type===Kt.string)ee.specifiers=bl,ee.source=this.parseExprAtom();else ee.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),ee.source=this.type===Kt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)ee.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(ee,"ImportDeclaration")};Zt.parseImportSpecifier=function(){var ee=this.startNode();if(ee.imported=this.parseModuleExportName(),this.eatContextual("as"))ee.local=this.parseIdent();else this.checkUnreserved(ee.imported),ee.local=ee.imported;return this.checkLValSimple(ee.local,Fn),this.finishNode(ee,"ImportSpecifier")};Zt.parseImportDefaultSpecifier=function(){var ee=this.startNode();return ee.local=this.parseIdent(),this.checkLValSimple(ee.local,Fn),this.finishNode(ee,"ImportDefaultSpecifier")};Zt.parseImportNamespaceSpecifier=function(){var ee=this.startNode();return this.next(),this.expectContextual("as"),ee.local=this.parseIdent(),this.checkLValSimple(ee.local,Fn),this.finishNode(ee,"ImportNamespaceSpecifier")};Zt.parseImportSpecifiers=function(){var ee=[],te=!0;if(this.type===Kt.name){if(ee.push(this.parseImportDefaultSpecifier()),!this.eat(Kt.comma))return ee}if(this.type===Kt.star)return ee.push(this.parseImportNamespaceSpecifier()),ee;this.expect(Kt.braceL);while(!this.eat(Kt.braceR)){if(!te){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else te=!1;ee.push(this.parseImportSpecifier())}return ee};Zt.parseWithClause=function(){var ee=[];if(!this.eat(Kt._with))return ee;this.expect(Kt.braceL);var te={},Oe=!0;while(!this.eat(Kt.braceR)){if(!Oe){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else Oe=!1;var Ot=this.parseImportAttribute(),jt=Ot.key.type==="Identifier"?Ot.key.name:Ot.key.value;if(wi(te,jt))this.raiseRecoverable(Ot.key.start,"Duplicate attribute key '"+jt+"'");te[jt]=!0,ee.push(Ot)}return ee};Zt.parseImportAttribute=function(){var ee=this.startNode();if(ee.key=this.type===Kt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Kt.colon),this.type!==Kt.string)this.unexpected();return ee.value=this.parseExprAtom(),this.finishNode(ee,"ImportAttribute")};Zt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Kt.string){var ee=this.parseLiteral(this.value);if(yl.test(ee.value))this.raise(ee.start,"An export name cannot include a lone surrogate.");return ee}return this.parseIdent(!0)};Zt.adaptDirectivePrologue=function(ee){for(var te=0;te<ee.length&&this.isDirectiveCandidate(ee[te]);++te)ee[te].directive=ee[te].expression.raw.slice(1,-1)};Zt.isDirectiveCandidate=function(ee){return this.options.ecmaVersion>=5&&ee.type==="ExpressionStatement"&&ee.expression.type==="Literal"&&typeof ee.expression.value==="string"&&(this.input[ee.start]==='"'||this.input[ee.start]==="'")};var kn=s.prototype;kn.toAssignable=function(ee,te,Oe){if(this.options.ecmaVersion>=6&&ee)switch(ee.type){case"Identifier":if(this.inAsync&&ee.name==="await")this.raise(ee.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(ee.type="ObjectPattern",Oe)this.checkPatternErrors(Oe,!0);for(var Ot=0,jt=ee.properties;Ot<jt.length;Ot+=1){var Vt=jt[Ot];if(this.toAssignable(Vt,te),Vt.type==="RestElement"&&(Vt.argument.type==="ArrayPattern"||Vt.argument.type==="ObjectPattern"))this.raise(Vt.argument.start,"Unexpected token")}break;case"Property":if(ee.kind!=="init")this.raise(ee.key.start,"Object pattern can't contain getter or setter");this.toAssignable(ee.value,te);break;case"ArrayExpression":if(ee.type="ArrayPattern",Oe)this.checkPatternErrors(Oe,!0);this.toAssignableList(ee.elements,te);break;case"SpreadElement":if(ee.type="RestElement",this.toAssignable(ee.argument,te),ee.argument.type==="AssignmentPattern")this.raise(ee.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(ee.operator!=="=")this.raise(ee.left.end,"Only '=' operator can be used for specifying default value.");ee.type="AssignmentPattern",delete ee.operator,this.toAssignable(ee.left,te);break;case"ParenthesizedExpression":this.toAssignable(ee.expression,te,Oe);break;case"ChainExpression":this.raiseRecoverable(ee.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!te)break;default:this.raise(ee.start,"Assigning to rvalue")}else if(Oe)this.checkPatternErrors(Oe,!0);return ee};kn.toAssignableList=function(ee,te){var Oe=ee.length;for(var Ot=0;Ot<Oe;Ot++){var jt=ee[Ot];if(jt)this.toAssignable(jt,te)}if(Oe){var Vt=ee[Oe-1];if(this.options.ecmaVersion===6&&te&&Vt&&Vt.type==="RestElement"&&Vt.argument.type!=="Identifier")this.unexpected(Vt.argument.start)}return ee};kn.parseSpread=function(ee){var te=this.startNode();return this.next(),te.argument=this.parseMaybeAssign(!1,ee),this.finishNode(te,"SpreadElement")};kn.parseRestBinding=function(){var ee=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Kt.name)this.unexpected();return ee.argument=this.parseBindingAtom(),this.finishNode(ee,"RestElement")};kn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Kt.bracketL:var ee=this.startNode();return this.next(),ee.elements=this.parseBindingList(Kt.bracketR,!0,!0),this.finishNode(ee,"ArrayPattern");case Kt.braceL:return this.parseObj(!0)}return this.parseIdent()};kn.parseBindingList=function(ee,te,Oe,Ot){var jt=[],Vt=!0;while(!this.eat(ee)){if(Vt)Vt=!1;else this.expect(Kt.comma);if(te&&this.type===Kt.comma)jt.push(null);else if(Oe&&this.afterTrailingComma(ee))break;else if(this.type===Kt.ellipsis){var Wt=this.parseRestBinding();if(this.parseBindingListItem(Wt),jt.push(Wt),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(ee);break}else jt.push(this.parseAssignableListItem(Ot))}return jt};kn.parseAssignableListItem=function(ee){var te=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(te),te};kn.parseBindingListItem=function(ee){return ee};kn.parseMaybeDefault=function(ee,te,Oe){if(Oe=Oe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Kt.eq))return Oe;var Ot=this.startNodeAt(ee,te);return Ot.left=Oe,Ot.right=this.parseMaybeAssign(),this.finishNode(Ot,"AssignmentPattern")};kn.checkLValSimple=function(ee,te,Oe){if(te===void 0)te=Zi;var Ot=te!==Zi;switch(ee.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(ee.name))this.raiseRecoverable(ee.start,(Ot?"Binding ":"Assigning to ")+ee.name+" in strict mode");if(Ot){if(te===Fn&&ee.name==="let")this.raiseRecoverable(ee.start,"let is disallowed as a lexically bound name");if(Oe){if(wi(Oe,ee.name))this.raiseRecoverable(ee.start,"Argument name clash");Oe[ee.name]=!0}if(te!==Yo)this.declareName(ee.name,te,ee.start)}break;case"ChainExpression":this.raiseRecoverable(ee.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ot)this.raiseRecoverable(ee.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ot)this.raiseRecoverable(ee.start,"Binding parenthesized expression");return this.checkLValSimple(ee.expression,te,Oe);default:this.raise(ee.start,(Ot?"Binding":"Assigning to")+" rvalue")}};kn.checkLValPattern=function(ee,te,Oe){if(te===void 0)te=Zi;switch(ee.type){case"ObjectPattern":for(var Ot=0,jt=ee.properties;Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.checkLValInnerPattern(Vt,te,Oe)}break;case"ArrayPattern":for(var Wt=0,Mt=ee.elements;Wt<Mt.length;Wt+=1){var Gt=Mt[Wt];if(Gt)this.checkLValInnerPattern(Gt,te,Oe)}break;default:this.checkLValSimple(ee,te,Oe)}};kn.checkLValInnerPattern=function(ee,te,Oe){if(te===void 0)te=Zi;switch(ee.type){case"Property":this.checkLValInnerPattern(ee.value,te,Oe);break;case"AssignmentPattern":this.checkLValPattern(ee.left,te,Oe);break;case"RestElement":this.checkLValPattern(ee.argument,te,Oe);break;default:this.checkLValPattern(ee,te,Oe)}};var Pn=function(ee,te,Oe,Ot,jt){this.token=ee,this.isExpr=!!te,this.preserveSpace=!!Oe,this.override=Ot,this.generator=!!jt},ln={b_stat:new Pn("{",!1),b_expr:new Pn("{",!0),b_tmpl:new Pn("${",!1),p_stat:new Pn("(",!1),p_expr:new Pn("(",!0),q_tmpl:new Pn("`",!0,!0,function(ee){return ee.tryReadTemplateToken()}),f_stat:new Pn("function",!1),f_expr:new Pn("function",!0),f_expr_gen:new Pn("function",!0,!1,null,!0),f_gen:new Pn("function",!1,!1,null,!0)},di=s.prototype;di.initialContext=function(){return[ln.b_stat]};di.curContext=function(){return this.context[this.context.length-1]};di.braceIsBlock=function(ee){var te=this.curContext();if(te===ln.f_expr||te===ln.f_stat)return!0;if(ee===Kt.colon&&(te===ln.b_stat||te===ln.b_expr))return!te.isExpr;if(ee===Kt._return||ee===Kt.name&&this.exprAllowed)return En.test(this.input.slice(this.lastTokEnd,this.start));if(ee===Kt._else||ee===Kt.semi||ee===Kt.eof||ee===Kt.parenR||ee===Kt.arrow)return!0;if(ee===Kt.braceL)return te===ln.b_stat;if(ee===Kt._var||ee===Kt._const||ee===Kt.name)return!1;return!this.exprAllowed};di.inGeneratorContext=function(){for(var ee=this.context.length-1;ee>=1;ee--){var te=this.context[ee];if(te.token==="function")return te.generator}return!1};di.updateContext=function(ee){var te,Oe=this.type;if(Oe.keyword&&ee===Kt.dot)this.exprAllowed=!1;else if(te=Oe.updateContext)te.call(this,ee);else this.exprAllowed=Oe.beforeExpr};di.overrideContext=function(ee){if(this.curContext()!==ee)this.context[this.context.length-1]=ee};Kt.parenR.updateContext=Kt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var ee=this.context.pop();if(ee===ln.b_stat&&this.curContext().token==="function")ee=this.context.pop();this.exprAllowed=!ee.isExpr};Kt.braceL.updateContext=function(ee){this.context.push(this.braceIsBlock(ee)?ln.b_stat:ln.b_expr),this.exprAllowed=!0};Kt.dollarBraceL.updateContext=function(){this.context.push(ln.b_tmpl),this.exprAllowed=!0};Kt.parenL.updateContext=function(ee){var te=ee===Kt._if||ee===Kt._for||ee===Kt._with||ee===Kt._while;this.context.push(te?ln.p_stat:ln.p_expr),this.exprAllowed=!0};Kt.incDec.updateContext=function(){};Kt._function.updateContext=Kt._class.updateContext=function(ee){if(ee.beforeExpr&&ee!==Kt._else&&!(ee===Kt.semi&&this.curContext()!==ln.p_stat)&&!(ee===Kt._return&&En.test(this.input.slice(this.lastTokEnd,this.start)))&&!((ee===Kt.colon||ee===Kt.braceL)&&this.curContext()===ln.b_stat))this.context.push(ln.f_expr);else this.context.push(ln.f_stat);this.exprAllowed=!1};Kt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Kt.backQuote.updateContext=function(){if(this.curContext()===ln.q_tmpl)this.context.pop();else this.context.push(ln.q_tmpl);this.exprAllowed=!1};Kt.star.updateContext=function(ee){if(ee===Kt._function){var te=this.context.length-1;if(this.context[te]===ln.f_expr)this.context[te]=ln.f_expr_gen;else this.context[te]=ln.f_gen}this.exprAllowed=!0};Kt.name.updateContext=function(ee){var te=!1;if(this.options.ecmaVersion>=6&&ee!==Kt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())te=!0}this.exprAllowed=te};var tn=s.prototype;tn.checkPropClash=function(ee,te,Oe){if(this.options.ecmaVersion>=9&&ee.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(ee.computed||ee.method||ee.shorthand))return;var Ot=ee.key,jt;switch(Ot.type){case"Identifier":jt=Ot.name;break;case"Literal":jt=String(Ot.value);break;default:return}var Vt=ee.kind;if(this.options.ecmaVersion>=6){if(jt==="__proto__"&&Vt==="init"){if(te.proto)if(Oe){if(Oe.doubleProto<0)Oe.doubleProto=Ot.start}else this.raiseRecoverable(Ot.start,"Redefinition of __proto__ property");te.proto=!0}return}jt="$"+jt;var Wt=te[jt];if(Wt){var Mt;if(Vt==="init")Mt=this.strict&&Wt.init||Wt.get||Wt.set;else Mt=Wt.init||Wt[Vt];if(Mt)this.raiseRecoverable(Ot.start,"Redefinition of property")}else Wt=te[jt]={init:!1,get:!1,set:!1};Wt[Vt]=!0};tn.parseExpression=function(ee,te){var Oe=this;return this.catchStackOverflow(function(){var{start:Ot,startLoc:jt}=Oe,Vt=Oe.parseMaybeAssign(ee,te);if(Oe.type===Kt.comma){var Wt=Oe.startNodeAt(Ot,jt);Wt.expressions=[Vt];while(Oe.eat(Kt.comma))Wt.expressions.push(Oe.parseMaybeAssign(ee,te));return Oe.finishNode(Wt,"SequenceExpression")}return Vt})};tn.parseMaybeAssign=function(ee,te,Oe){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(ee);else this.exprAllowed=!1;var Ot=!1,jt=-1,Vt=-1,Wt=-1;if(te)jt=te.parenthesizedAssign,Vt=te.trailingComma,Wt=te.doubleProto,te.parenthesizedAssign=te.trailingComma=-1;else te=new os,Ot=!0;var Mt=this.start,Gt=this.startLoc;if(this.type===Kt.parenL||this.type===Kt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=ee==="await";var Ut=this.parseMaybeConditional(ee,te);if(Oe)Ut=Oe.call(this,Ut,Mt,Gt);if(this.type.isAssign){var Ht=this.startNodeAt(Mt,Gt);if(Ht.operator=this.value,this.type===Kt.eq)Ut=this.toAssignable(Ut,!1,te);if(!Ot)te.parenthesizedAssign=te.trailingComma=te.doubleProto=-1;if(te.shorthandAssign>=Ut.start)te.shorthandAssign=-1;if(this.type===Kt.eq)this.checkLValPattern(Ut);else this.checkLValSimple(Ut);if(Ht.left=Ut,this.next(),Ht.right=this.parseMaybeAssign(ee),Wt>-1)te.doubleProto=Wt;return this.finishNode(Ht,"AssignmentExpression")}else if(Ot)this.checkExpressionErrors(te,!0);if(jt>-1)te.parenthesizedAssign=jt;if(Vt>-1)te.trailingComma=Vt;return Ut};tn.parseMaybeConditional=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt=this.parseExprOps(ee,te);if(this.checkExpressionErrors(te))return jt;if(!(jt.type==="ArrowFunctionExpression"&&jt.start===Oe)&&this.eat(Kt.question)){var Vt=this.startNodeAt(Oe,Ot);return Vt.test=jt,Vt.consequent=this.parseMaybeAssign(),this.expect(Kt.colon),Vt.alternate=this.parseMaybeAssign(ee),this.finishNode(Vt,"ConditionalExpression")}return jt};tn.parseExprOps=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt=this.parseMaybeUnary(te,!1,!1,ee);if(this.checkExpressionErrors(te))return jt;return jt.start===Oe&&jt.type==="ArrowFunctionExpression"?jt:this.parseExprOp(jt,Oe,Ot,-1,ee)};tn.parseExprOp=function(ee,te,Oe,Ot,jt){var Vt=this.type.binop;if(Vt!=null&&(!jt||this.type!==Kt._in)){if(Vt>Ot){var Wt=this.type===Kt.logicalOR||this.type===Kt.logicalAND,Mt=this.type===Kt.coalesce;if(Mt)Vt=Kt.logicalAND.binop;var Gt=this.value;this.next();var Ut=this.start,Ht=this.startLoc,qt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,jt),Ut,Ht,Vt,jt),zt=this.buildBinary(te,Oe,ee,qt,Gt,Wt||Mt);if(Wt&&this.type===Kt.coalesce||Mt&&(this.type===Kt.logicalOR||this.type===Kt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(zt,te,Oe,Ot,jt)}}return ee};tn.buildBinary=function(ee,te,Oe,Ot,jt,Vt){if(Ot.type==="PrivateIdentifier")this.raise(Ot.start,"Private identifier can only be left side of binary expression");var Wt=this.startNodeAt(ee,te);return Wt.left=Oe,Wt.operator=jt,Wt.right=Ot,this.finishNode(Wt,Vt?"LogicalExpression":"BinaryExpression")};tn.parseMaybeUnary=function(ee,te,Oe,Ot){var jt=this.start,Vt=this.startLoc,Wt;if(this.isContextual("await")&&this.canAwait)Wt=this.parseAwait(Ot),te=!0;else if(this.type.prefix){var Mt=this.startNode(),Gt=this.type===Kt.incDec;if(Mt.operator=this.value,Mt.prefix=!0,this.next(),Mt.argument=this.parseMaybeUnary(null,!0,Gt,Ot),this.checkExpressionErrors(ee,!0),Gt)this.checkLValSimple(Mt.argument);else if(this.strict&&Mt.operator==="delete"&&Zo(Mt.argument))this.raiseRecoverable(Mt.start,"Deleting local variable in strict mode");else if(Mt.operator==="delete"&&Ys(Mt.argument))this.raiseRecoverable(Mt.start,"Private fields can not be deleted");else te=!0;Wt=this.finishNode(Mt,Gt?"UpdateExpression":"UnaryExpression")}else if(!te&&this.type===Kt.privateId){if((Ot||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Wt=this.parsePrivateIdent(),this.type!==Kt._in)this.unexpected()}else{if(Wt=this.parseExprSubscripts(ee,Ot),this.checkExpressionErrors(ee))return Wt;while(this.type.postfix&&!this.canInsertSemicolon()){var Ut=this.startNodeAt(jt,Vt);Ut.operator=this.value,Ut.prefix=!1,Ut.argument=Wt,this.checkLValSimple(Wt),this.next(),Wt=this.finishNode(Ut,"UpdateExpression")}}if(!Oe&&!(Wt.type==="ArrowFunctionExpression"&&Wt.start===jt)&&this.eat(Kt.starstar))if(te)this.unexpected(this.lastTokStart);else return this.buildBinary(jt,Vt,Wt,this.parseMaybeUnary(null,!1,!1,Ot),"**",!1);else return Wt};function Zo(ee){return ee.type==="Identifier"||ee.type==="ParenthesizedExpression"&&Zo(ee.expression)}function Ys(ee){return ee.type==="MemberExpression"&&ee.property.type==="PrivateIdentifier"||ee.type==="ChainExpression"&&Ys(ee.expression)||ee.type==="ParenthesizedExpression"&&Ys(ee.expression)}tn.parseExprSubscripts=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt=this.parseExprAtom(ee,te);if(jt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return jt;var Vt=this.parseSubscripts(jt,Oe,Ot,!1,te);if(ee&&Vt.type==="MemberExpression"){if(ee.parenthesizedAssign>=Vt.start)ee.parenthesizedAssign=-1;if(ee.parenthesizedBind>=Vt.start)ee.parenthesizedBind=-1;if(ee.trailingComma>=Vt.start)ee.trailingComma=-1}return Vt};tn.parseSubscripts=function(ee,te,Oe,Ot,jt){var Vt=this.options.ecmaVersion>=8&&ee.type==="Identifier"&&ee.name==="async"&&this.lastTokEnd===ee.end&&!this.canInsertSemicolon()&&ee.end-ee.start===5&&this.potentialArrowAt===ee.start,Wt=!1;while(!0){var Mt=this.parseSubscript(ee,te,Oe,Ot,Vt,Wt,jt);if(Mt.optional)Wt=!0;if(Mt===ee||Mt.type==="ArrowFunctionExpression"){if(Wt){var Gt=this.startNodeAt(te,Oe);Gt.expression=Mt,Mt=this.finishNode(Gt,"ChainExpression")}return Mt}ee=Mt}};tn.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Kt.arrow)};tn.parseSubscriptAsyncArrow=function(ee,te,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(ee,te),Oe,!0,Ot)};tn.parseSubscript=function(ee,te,Oe,Ot,jt,Vt,Wt){var Mt=this.options.ecmaVersion>=11,Gt=Mt&&this.eat(Kt.questionDot);if(Ot&&Gt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Ut=this.eat(Kt.bracketL);if(Ut||Gt&&this.type!==Kt.parenL&&this.type!==Kt.backQuote||this.eat(Kt.dot)){var Ht=this.startNodeAt(te,Oe);if(Ht.object=ee,Ut)Ht.property=this.parseExpression(),this.expect(Kt.bracketR);else if(this.type===Kt.privateId&&ee.type!=="Super")Ht.property=this.parsePrivateIdent();else Ht.property=this.parseIdent(this.options.allowReserved!=="never");if(Ht.computed=!!Ut,Mt)Ht.optional=Gt;ee=this.finishNode(Ht,"MemberExpression")}else if(!Ot&&this.eat(Kt.parenL)){var qt=new os,zt=this.yieldPos,Xt=this.awaitPos,Jt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Qt=this.parseExprList(Kt.parenR,this.options.ecmaVersion>=8,!1,qt);if(jt&&!Gt&&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=Xt,this.awaitIdentPos=Jt,this.parseSubscriptAsyncArrow(te,Oe,Qt,Wt)}this.checkExpressionErrors(qt,!0),this.yieldPos=zt||this.yieldPos,this.awaitPos=Xt||this.awaitPos,this.awaitIdentPos=Jt||this.awaitIdentPos;var Yt=this.startNodeAt(te,Oe);if(Yt.callee=ee,Yt.arguments=Qt,Mt)Yt.optional=Gt;ee=this.finishNode(Yt,"CallExpression")}else if(this.type===Kt.backQuote){if(Gt||Vt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var nn=this.startNodeAt(te,Oe);nn.tag=ee,nn.quasi=this.parseTemplate({isTagged:!0}),ee=this.finishNode(nn,"TaggedTemplateExpression")}return ee};tn.parseExprAtom=function(ee,te,Oe){if(this.type===Kt.slash)this.readRegexp();var Ot,jt=this.potentialArrowAt===this.start;switch(this.type){case Kt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Ot=this.startNode(),this.next(),this.type===Kt.parenL&&!this.allowDirectSuper)this.raise(Ot.start,"super() call outside constructor of a subclass");if(this.type!==Kt.dot&&this.type!==Kt.bracketL&&this.type!==Kt.parenL)this.unexpected();return this.finishNode(Ot,"Super");case Kt._this:return Ot=this.startNode(),this.next(),this.finishNode(Ot,"ThisExpression");case Kt.name:var Vt=this.start,Wt=this.startLoc,Mt=this.containsEsc,Gt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Mt&&Gt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Kt._function))return this.overrideContext(ln.f_expr),this.parseFunction(this.startNodeAt(Vt,Wt),0,!1,!0,te);if(jt&&!this.canInsertSemicolon()){if(this.eat(Kt.arrow))return this.parseArrowExpression(this.startNodeAt(Vt,Wt),[Gt],!1,te);if(this.options.ecmaVersion>=8&&Gt.name==="async"&&this.type===Kt.name&&!Mt&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Gt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Kt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Vt,Wt),[Gt],!0,te)}}return Gt;case Kt.regexp:var Ut=this.value;return Ot=this.parseLiteral(Ut.value),Ot.regex={pattern:Ut.pattern,flags:Ut.flags},Ot;case Kt.num:case Kt.string:return this.parseLiteral(this.value);case Kt._null:case Kt._true:case Kt._false:return Ot=this.startNode(),Ot.value=this.type===Kt._null?null:this.type===Kt._true,Ot.raw=this.type.keyword,this.next(),this.finishNode(Ot,"Literal");case Kt.parenL:var Ht=this.start,qt=this.parseParenAndDistinguishExpression(jt,te);if(ee){if(ee.parenthesizedAssign<0&&!this.isSimpleAssignTarget(qt))ee.parenthesizedAssign=Ht;if(ee.parenthesizedBind<0)ee.parenthesizedBind=Ht}return qt;case Kt.bracketL:return Ot=this.startNode(),this.next(),Ot.elements=this.parseExprList(Kt.bracketR,!0,!0,ee),this.finishNode(Ot,"ArrayExpression");case Kt.braceL:return this.overrideContext(ln.b_expr),this.parseObj(!1,ee);case Kt._function:return Ot=this.startNode(),this.next(),this.parseFunction(Ot,0);case Kt._class:return this.parseClass(this.startNode(),!1);case Kt._new:return this.parseNew();case Kt.backQuote:return this.parseTemplate();case Kt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Oe);else return this.unexpected();default:return this.parseExprAtomDefault()}};tn.parseExprAtomDefault=function(){this.unexpected()};tn.parseExprImport=function(ee){var te=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Kt.parenL&&!ee)return this.parseDynamicImport(te);else if(this.type===Kt.dot){var Oe=this.startNodeAt(te.start,te.loc&&te.loc.start);return Oe.name="import",te.meta=this.finishNode(Oe,"Identifier"),this.parseImportMeta(te)}else this.unexpected()};tn.parseDynamicImport=function(ee){if(this.next(),ee.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Kt.parenR))if(this.expect(Kt.comma),!this.afterTrailingComma(Kt.parenR)){if(ee.options=this.parseMaybeAssign(),!this.eat(Kt.parenR)){if(this.expect(Kt.comma),!this.afterTrailingComma(Kt.parenR))this.unexpected()}}else ee.options=null;else ee.options=null;else if(!this.eat(Kt.parenR)){var te=this.start;if(this.eat(Kt.comma)&&this.eat(Kt.parenR))this.raiseRecoverable(te,"Trailing comma is not allowed in import()");else this.unexpected(te)}return this.finishNode(ee,"ImportExpression")};tn.parseImportMeta=function(ee){this.next();var te=this.containsEsc;if(ee.property=this.parseIdent(!0),ee.property.name!=="meta")this.raiseRecoverable(ee.property.start,"The only valid meta property for import is 'import.meta'");if(te)this.raiseRecoverable(ee.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(ee.start,"Cannot use 'import.meta' outside a module");return this.finishNode(ee,"MetaProperty")};tn.parseLiteral=function(ee){var te=this.startNode();if(te.value=ee,te.raw=this.input.slice(this.start,this.end),te.raw.charCodeAt(te.raw.length-1)===110)te.bigint=te.value!=null?te.value.toString():te.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(te,"Literal")};tn.parseParenExpression=function(){this.expect(Kt.parenL);var ee=this.parseExpression();return this.expect(Kt.parenR),ee};tn.shouldParseArrow=function(ee){return!this.canInsertSemicolon()};tn.parseParenAndDistinguishExpression=function(ee,te){var Oe=this.start,Ot=this.startLoc,jt,Vt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Wt=this.start,Mt=this.startLoc,Gt=[],Ut=!0,Ht=!1,qt=new os,zt=this.yieldPos,Xt=this.awaitPos,Jt;this.yieldPos=0,this.awaitPos=0;while(this.type!==Kt.parenR)if(Ut?Ut=!1:this.expect(Kt.comma),Vt&&this.afterTrailingComma(Kt.parenR,!0)){Ht=!0;break}else if(this.type===Kt.ellipsis){if(Jt=this.start,Gt.push(this.parseParenItem(this.parseRestBinding())),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Gt.push(this.parseMaybeAssign(!1,qt,this.parseParenItem));var Qt=this.lastTokEnd,Yt=this.lastTokEndLoc;if(this.expect(Kt.parenR),ee&&this.shouldParseArrow(Gt)&&this.eat(Kt.arrow))return this.checkPatternErrors(qt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=zt,this.awaitPos=Xt,this.parseParenArrowList(Oe,Ot,Gt,te);if(!Gt.length||Ht)this.unexpected(this.lastTokStart);if(Jt)this.unexpected(Jt);if(this.checkExpressionErrors(qt,!0),this.yieldPos=zt||this.yieldPos,this.awaitPos=Xt||this.awaitPos,Gt.length>1)jt=this.startNodeAt(Wt,Mt),jt.expressions=Gt,this.finishNodeAt(jt,"SequenceExpression",Qt,Yt);else jt=Gt[0]}else jt=this.parseParenExpression();if(this.options.preserveParens){var nn=this.startNodeAt(Oe,Ot);return nn.expression=jt,this.finishNode(nn,"ParenthesizedExpression")}else return jt};tn.parseParenItem=function(ee){return ee};tn.parseParenArrowList=function(ee,te,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(ee,te),Oe,!1,Ot)};var wl=[];tn.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var ee=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Kt.dot){var te=this.startNodeAt(ee.start,ee.loc&&ee.loc.start);te.name="new",ee.meta=this.finishNode(te,"Identifier"),this.next();var Oe=this.containsEsc;if(ee.property=this.parseIdent(!0),ee.property.name!=="target")this.raiseRecoverable(ee.property.start,"The only valid meta property for new is 'new.target'");if(Oe)this.raiseRecoverable(ee.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(ee.start,"'new.target' can only be used in functions and class static block");return this.finishNode(ee,"MetaProperty")}var Ot=this.start,jt=this.startLoc;if(ee.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ot,jt,!0,!1),ee.callee.type==="Super")this.raiseRecoverable(Ot,"Invalid use of 'super'");if(this.eat(Kt.parenL))ee.arguments=this.parseExprList(Kt.parenR,this.options.ecmaVersion>=8,!1);else ee.arguments=wl;return this.finishNode(ee,"NewExpression")};tn.parseTemplateElement=function(ee){var te=ee.isTagged,Oe=this.startNode();if(this.type===Kt.invalidTemplate){if(!te)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Oe.value={raw:this.value.replace(/\r\n?/g,`
|
|
11
11
|
`),cooked:null}}else Oe.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
12
|
-
`),cooked:this.value};return this.next(),Oe.tail=this.type===Kt.backQuote,this.finishNode(Oe,"TemplateElement")};tn.parseTemplate=function(ee){if(ee===void 0)ee={};var te=ee.isTagged;if(te===void 0)te=!1;var Oe=this.startNode();this.next(),Oe.expressions=[];var Ot=this.parseTemplateElement({isTagged:te});Oe.quasis=[Ot];while(!Ot.tail){if(this.type===Kt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Kt.dollarBraceL),Oe.expressions.push(this.parseExpression()),this.expect(Kt.braceR),Oe.quasis.push(Ot=this.parseTemplateElement({isTagged:te}))}return this.next(),this.finishNode(Oe,"TemplateLiteral")};tn.isAsyncProp=function(ee){return!ee.computed&&ee.key.type==="Identifier"&&ee.key.name==="async"&&(this.type===Kt.name||this.type===Kt.num||this.type===Kt.string||this.type===Kt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Kt.star)&&!En.test(this.input.slice(this.lastTokEnd,this.start))};tn.parseObj=function(ee,te){var Oe=this.startNode(),Ot=!0,jt={};Oe.properties=[],this.next();while(!this.eat(Kt.braceR)){if(!Ot){if(this.expect(Kt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Kt.braceR))break}else Ot=!1;var Vt=this.parseProperty(ee,te);if(!ee)this.checkPropClash(Vt,jt,te);Oe.properties.push(Vt)}return this.finishNode(Oe,ee?"ObjectPattern":"ObjectExpression")};tn.parseProperty=function(ee,te){var Oe=this.startNode(),Ot,jt,Vt,Wt;if(this.options.ecmaVersion>=9&&this.eat(Kt.ellipsis)){if(ee){if(Oe.argument=this.parseIdent(!1),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Oe,"RestElement")}if(Oe.argument=this.parseMaybeAssign(!1,te),this.type===Kt.comma&&te&&te.trailingComma<0)te.trailingComma=this.start;return this.finishNode(Oe,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Oe.method=!1,Oe.shorthand=!1,ee||te)Vt=this.start,Wt=this.startLoc;if(!ee)Ot=this.eat(Kt.star)}var Mt=this.containsEsc;if(this.parsePropertyName(Oe),!ee&&!Mt&&this.options.ecmaVersion>=8&&!Ot&&this.isAsyncProp(Oe))jt=!0,Ot=this.options.ecmaVersion>=9&&this.eat(Kt.star),this.parsePropertyName(Oe);else jt=!1;return this.parsePropertyValue(Oe,ee,Ot,jt,Vt,Wt,te,Mt),this.finishNode(Oe,"Property")};tn.parseGetterSetter=function(ee){var te=ee.key.name;this.parsePropertyName(ee),ee.value=this.parseMethod(!1),ee.kind=te;var Oe=ee.kind==="get"?0:1;if(ee.value.params.length!==Oe){var Ot=ee.value.start;if(ee.kind==="get")this.raiseRecoverable(Ot,"getter should have no params");else this.raiseRecoverable(Ot,"setter should have exactly one param")}else if(ee.kind==="set"&&ee.value.params[0].type==="RestElement")this.raiseRecoverable(ee.value.params[0].start,"Setter cannot use rest params")};tn.parsePropertyValue=function(ee,te,Oe,Ot,jt,Vt,Wt,Mt){if((Oe||Ot)&&this.type===Kt.colon)this.unexpected();if(this.eat(Kt.colon))ee.value=te?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Wt),ee.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Kt.parenL){if(te)this.unexpected();ee.method=!0,ee.value=this.parseMethod(Oe,Ot),ee.kind="init"}else if(!te&&!Mt&&this.options.ecmaVersion>=5&&!ee.computed&&ee.key.type==="Identifier"&&(ee.key.name==="get"||ee.key.name==="set")&&(this.type!==Kt.comma&&this.type!==Kt.braceR&&this.type!==Kt.eq)){if(Oe||Ot)this.unexpected();this.parseGetterSetter(ee)}else if(this.options.ecmaVersion>=6&&!ee.computed&&ee.key.type==="Identifier"){if(Oe||Ot)this.unexpected();if(this.checkUnreserved(ee.key),ee.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=jt;if(te)ee.value=this.parseMaybeDefault(jt,Vt,this.copyNode(ee.key));else if(this.type===Kt.eq&&Wt){if(Wt.shorthandAssign<0)Wt.shorthandAssign=this.start;ee.value=this.parseMaybeDefault(jt,Vt,this.copyNode(ee.key))}else ee.value=this.copyNode(ee.key);ee.kind="init",ee.shorthand=!0}else this.unexpected()};tn.parsePropertyName=function(ee){if(this.options.ecmaVersion>=6)if(this.eat(Kt.bracketL))return ee.computed=!0,ee.key=this.parseMaybeAssign(),this.expect(Kt.bracketR),ee.key;else ee.computed=!1;return ee.key=this.type===Kt.num||this.type===Kt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};tn.initFunction=function(ee){if(ee.id=null,this.options.ecmaVersion>=6)ee.generator=ee.expression=!1;if(this.options.ecmaVersion>=8)ee.async=!1};tn.parseMethod=function(ee,te,Oe){var Ot=this.startNode(),jt=this.yieldPos,Vt=this.awaitPos,Wt=this.awaitIdentPos;if(this.initFunction(Ot),this.options.ecmaVersion>=6)Ot.generator=ee;if(this.options.ecmaVersion>=8)Ot.async=!!te;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Zs(te,Ot.generator)|is|(Oe?Uo:0)),this.expect(Kt.parenL),Ot.params=this.parseBindingList(Kt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Ot,!1,!0,!1),this.yieldPos=jt,this.awaitPos=Vt,this.awaitIdentPos=Wt,this.finishNode(Ot,"FunctionExpression")};tn.parseArrowExpression=function(ee,te,Oe,Ot){var jt=this.yieldPos,Vt=this.awaitPos,Wt=this.awaitIdentPos;if(this.enterScope(Zs(Oe,!1)|Qs),this.initFunction(ee),this.options.ecmaVersion>=8)ee.async=!!Oe;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,ee.params=this.toAssignableList(te,!0),this.parseFunctionBody(ee,!0,!1,Ot),this.yieldPos=jt,this.awaitPos=Vt,this.awaitIdentPos=Wt,this.finishNode(ee,"ArrowFunctionExpression")};tn.parseFunctionBody=function(ee,te,Oe,Ot){var jt=te&&this.type!==Kt.braceL,Vt=this.strict,Wt=!1;if(jt)ee.body=this.parseMaybeAssign(Ot),ee.expression=!0,this.checkParams(ee,!1);else{var Mt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(ee.params);if(!Vt||Mt){if(Wt=this.strictDirective(this.end),Wt&&Mt)this.raiseRecoverable(ee.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Gt=this.labels;if(this.labels=[],Wt)this.strict=!0;if(this.checkParams(ee,!Vt&&!Wt&&!te&&!Oe&&this.isSimpleParamList(ee.params)),this.strict&&ee.id)this.checkLValSimple(ee.id,zo);ee.body=this.parseBlock(!1,void 0,Wt&&!Vt),ee.expression=!1,this.adaptDirectivePrologue(ee.body.body),this.labels=Gt}this.exitScope()};tn.isSimpleParamList=function(ee){for(var te=0,Oe=ee;te<Oe.length;te+=1){var Ot=Oe[te];if(Ot.type!=="Identifier")return!1}return!0};tn.checkParams=function(ee,te){var Oe=Object.create(null);for(var Ot=0,jt=ee.params;Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.checkLValInnerPattern(Vt,er,te?null:Oe)}};tn.parseExprList=function(ee,te,Oe,Ot){var jt=[],Vt=!0;while(!this.eat(ee)){if(!Vt){if(this.expect(Kt.comma),te&&this.afterTrailingComma(ee))break}else Vt=!1;var Wt=void 0;if(Oe&&this.type===Kt.comma)Wt=null;else if(this.type===Kt.ellipsis){if(Wt=this.parseSpread(Ot),Ot&&this.type===Kt.comma&&Ot.trailingComma<0)Ot.trailingComma=this.start}else Wt=this.parseMaybeAssign(!1,Ot);jt.push(Wt)}return jt};tn.checkUnreserved=function(ee){var{start:te,end:Oe,name:Ot}=ee;if(this.inGenerator&&Ot==="yield")this.raiseRecoverable(te,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ot==="await")this.raiseRecoverable(te,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&ss)&&Ot==="arguments")this.raiseRecoverable(te,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ot==="arguments"||Ot==="await"))this.raise(te,"Cannot use "+Ot+" in class static initialization block");if(this.keywords.test(Ot))this.raise(te,"Unexpected keyword '"+Ot+"'");if(this.options.ecmaVersion<6&&this.input.slice(te,Oe).indexOf("\\")!==-1)return;var jt=this.strict?this.reservedWordsStrict:this.reservedWords;if(jt.test(Ot)){if(!this.inAsync&&Ot==="await")this.raiseRecoverable(te,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(te,"The keyword '"+Ot+"' is reserved")}};tn.parseIdent=function(ee){var te=this.parseIdentNode();if(this.next(!!ee),this.finishNode(te,"Identifier"),!ee){if(this.checkUnreserved(te),te.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=te.start}return te};tn.parseIdentNode=function(){var ee=this.startNode();if(this.type===Kt.name)ee.name=this.value;else if(this.type.keyword){if(ee.name=this.type.keyword,(ee.name==="class"||ee.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Kt.name}else this.unexpected();return ee};tn.parsePrivateIdent=function(){var ee=this.startNode();if(this.type===Kt.privateId)ee.name=this.value;else this.unexpected();if(this.next(),this.finishNode(ee,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(ee.start,"Private field '#"+ee.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(ee);return ee};tn.parseYield=function(ee){if(!this.yieldPos)this.yieldPos=this.start;var te=this.startNode();if(this.next(),this.type===Kt.semi||this.canInsertSemicolon()||this.type!==Kt.star&&!this.type.startsExpr)te.delegate=!1,te.argument=null;else te.delegate=this.eat(Kt.star),te.argument=this.parseMaybeAssign(ee);return this.finishNode(te,"YieldExpression")};tn.parseAwait=function(ee){if(!this.awaitPos)this.awaitPos=this.start;var te=this.startNode();return this.next(),te.argument=this.parseMaybeUnary(null,!0,!1,ee),this.finishNode(te,"AwaitExpression")};var es=s.prototype;es.raise=function(ee,te){var Oe=Vo(this.input,ee);if(te+=" ("+Oe.line+":"+Oe.column+")",this.sourceFile)te+=" in "+this.sourceFile;var Ot=SyntaxError(te);throw Ot.pos=ee,Ot.loc=Oe,Ot.raisedAt=this.pos,Ot};es.raiseRecoverable=es.raise;es.curPosition=function(){if(this.options.locations)return new bi(this.curLine,this.pos-this.lineStart)};var Wn=s.prototype,wl=function(ee){this.flags=ee,this.var=[],this.lexical=[],this.functions=[]};Wn.enterScope=function(ee){this.scopeStack.push(new wl(ee))};Wn.exitScope=function(){this.scopeStack.pop()};Wn.treatFunctionsAsVarInScope=function(ee){return ee.flags&ei||!this.inModule&&ee.flags&Zn};Wn.declareName=function(ee,te,Oe){var Ot=!1;if(te===Fn){var jt=this.currentScope();if(Ot=jt.lexical.indexOf(ee)>-1||jt.functions.indexOf(ee)>-1||jt.var.indexOf(ee)>-1,jt.lexical.push(ee),this.inModule&&jt.flags&Zn)delete this.undefinedExports[ee]}else if(te===qo){var Vt=this.currentScope();Vt.lexical.push(ee)}else if(te===Ko){var Wt=this.currentScope();if(this.treatFunctionsAsVar)Ot=Wt.lexical.indexOf(ee)>-1;else Ot=Wt.lexical.indexOf(ee)>-1||Wt.var.indexOf(ee)>-1;Wt.functions.push(ee)}else for(var Mt=this.scopeStack.length-1;Mt>=0;--Mt){var Gt=this.scopeStack[Mt];if(Gt.lexical.indexOf(ee)>-1&&!(Gt.flags&Wo&&Gt.lexical[0]===ee)||!this.treatFunctionsAsVarInScope(Gt)&&Gt.functions.indexOf(ee)>-1){Ot=!0;break}if(Gt.var.push(ee),this.inModule&&Gt.flags&Zn)delete this.undefinedExports[ee];if(Gt.flags&ss)break}if(Ot)this.raiseRecoverable(Oe,"Identifier '"+ee+"' has already been declared")};Wn.checkLocalExport=function(ee){if(this.scopeStack[0].lexical.indexOf(ee.name)===-1&&this.scopeStack[0].var.indexOf(ee.name)===-1)this.undefinedExports[ee.name]=ee};Wn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Wn.currentVarScope=function(){for(var ee=this.scopeStack.length-1;;ee--){var te=this.scopeStack[ee];if(te.flags&(ss|wi|ti))return te}};Wn.currentThisScope=function(){for(var ee=this.scopeStack.length-1;;ee--){var te=this.scopeStack[ee];if(te.flags&(ss|wi|ti)&&!(te.flags&Qs))return te}};var os=function(ee,te,Oe){if(this.type="",this.start=te,this.end=0,ee.options.locations)this.loc=new ns(ee,Oe);if(ee.options.directSourceFile)this.sourceFile=ee.options.directSourceFile;if(ee.options.ranges)this.range=[te,0]},Ti=s.prototype;Ti.startNode=function(){return new os(this,this.start,this.startLoc)};Ti.startNodeAt=function(ee,te){return new os(this,ee,te)};function Yo(ee,te,Oe,Ot){if(ee.type=te,ee.end=Oe,this.options.locations)ee.loc.end=Ot;if(this.options.ranges)ee.range[1]=Oe;return ee}Ti.finishNode=function(ee,te){return Yo.call(this,ee,te,this.lastTokEnd,this.lastTokEndLoc)};Ti.finishNodeAt=function(ee,te,Oe,Ot){return Yo.call(this,ee,te,Oe,Ot)};Ti.copyNode=function(ee){var te=new os(this,ee.start,this.startLoc);for(var Oe in ee)te[Oe]=ee[Oe];return te};var Qo=function(){};Qo.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var nr=function(ee){if(this.type=ee.type,this.value=ee.value,this.start=ee.start,this.end=ee.end,ee.options.locations)this.loc=new ns(ee,ee.startLoc,ee.endLoc);if(ee.options.ranges)this.range=[ee.start,ee.end]},rn=s.prototype;rn.next=function(ee){if(!ee&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new nr(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};rn.getToken=function(){return this.next(),new nr(this)};if(typeof Symbol<"u")rn[Symbol.iterator]=function(){var ee=this;return{next:function(){var te=ee.getToken();return{done:te.type===Kt.eof,value:te}}}};rn.nextToken=function(){var ee=this.curContext();if(!ee||!ee.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Kt.eof);if(ee.override)return ee.override(this);else this.readToken(this.fullCharCodeAtPos())};rn.readToken=function(ee){if(g(ee,this.options.ecmaVersion>=6)||ee===92)return this.readWord();return this.getTokenFromCode(ee)};rn.fullCharCodeAt=function(ee){var te=this.input.charCodeAt(ee);if(te<=55295||te>=56320)return te;var Oe=this.input.charCodeAt(ee+1);return Oe<=56319||Oe>=57344?te:(te<<10)+Oe-56613888};rn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};rn.skipBlockComment=function(){var ee=this.options.onComment&&this.curPosition(),te=this.pos,Oe=this.input.indexOf("*/",this.pos+=2);if(Oe===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Oe+2,this.options.locations)for(var Ot=void 0,jt=te;(Ot=Bo(this.input,jt,this.pos))>-1;)++this.curLine,jt=this.lineStart=Ot;if(this.options.onComment)this.options.onComment(!0,this.input.slice(te+2,Oe),te,this.pos,ee,this.curPosition())};rn.skipLineComment=function(ee){var te=this.pos,Oe=this.options.onComment&&this.curPosition(),Ot=this.input.charCodeAt(this.pos+=ee);while(this.pos<this.input.length&&!ui(Ot))Ot=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(te+ee,this.pos),te,this.pos,Oe,this.curPosition())};rn.skipSpace=function(){e:while(this.pos<this.input.length){var ee=this.input.charCodeAt(this.pos);switch(ee){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(ee>8&&ee<14||ee>=5760&&jo.test(String.fromCharCode(ee)))++this.pos;else break e}}};rn.finishToken=function(ee,te){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Oe=this.type;this.type=ee,this.value=te,this.updateContext(Oe)};rn.readToken_dot=function(){var ee=this.input.charCodeAt(this.pos+1);if(ee>=48&&ee<=57)return this.readNumber(!0);var te=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&ee===46&&te===46)return this.pos+=3,this.finishToken(Kt.ellipsis);else return++this.pos,this.finishToken(Kt.dot)};rn.readToken_slash=function(){var ee=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(ee===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.slash,1)};rn.readToken_mult_modulo_exp=function(ee){var te=this.input.charCodeAt(this.pos+1),Oe=1,Ot=ee===42?Kt.star:Kt.modulo;if(this.options.ecmaVersion>=7&&ee===42&&te===42)++Oe,Ot=Kt.starstar,te=this.input.charCodeAt(this.pos+2);if(te===61)return this.finishOp(Kt.assign,Oe+1);return this.finishOp(Ot,Oe)};rn.readToken_pipe_amp=function(ee){var te=this.input.charCodeAt(this.pos+1);if(te===ee){if(this.options.ecmaVersion>=12){var Oe=this.input.charCodeAt(this.pos+2);if(Oe===61)return this.finishOp(Kt.assign,3)}return this.finishOp(ee===124?Kt.logicalOR:Kt.logicalAND,2)}if(te===61)return this.finishOp(Kt.assign,2);return this.finishOp(ee===124?Kt.bitwiseOR:Kt.bitwiseAND,1)};rn.readToken_caret=function(){var ee=this.input.charCodeAt(this.pos+1);if(ee===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.bitwiseXOR,1)};rn.readToken_plus_min=function(ee){var te=this.input.charCodeAt(this.pos+1);if(te===ee){if(te===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||En.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Kt.incDec,2)}if(te===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.plusMin,1)};rn.readToken_lt_gt=function(ee){var te=this.input.charCodeAt(this.pos+1),Oe=1;if(te===ee){if(Oe=ee===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Oe)===61)return this.finishOp(Kt.assign,Oe+1);return this.finishOp(Kt.bitShift,Oe)}if(te===33&&ee===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(te===61)Oe=2;return this.finishOp(Kt.relational,Oe)};rn.readToken_eq_excl=function(ee){var te=this.input.charCodeAt(this.pos+1);if(te===61)return this.finishOp(Kt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(ee===61&&te===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Kt.arrow);return this.finishOp(ee===61?Kt.eq:Kt.prefix,1)};rn.readToken_question=function(){var ee=this.options.ecmaVersion;if(ee>=11){var te=this.input.charCodeAt(this.pos+1);if(te===46){var Oe=this.input.charCodeAt(this.pos+2);if(Oe<48||Oe>57)return this.finishOp(Kt.questionDot,2)}if(te===63){if(ee>=12){var Ot=this.input.charCodeAt(this.pos+2);if(Ot===61)return this.finishOp(Kt.assign,3)}return this.finishOp(Kt.coalesce,2)}}return this.finishOp(Kt.question,1)};rn.readToken_numberSign=function(){var ee=this.options.ecmaVersion,te=35;if(ee>=13){if(++this.pos,te=this.fullCharCodeAtPos(),g(te,!0)||te===92)return this.finishToken(Kt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+ts(te)+"'")};rn.getTokenFromCode=function(ee){switch(ee){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Kt.parenL);case 41:return++this.pos,this.finishToken(Kt.parenR);case 59:return++this.pos,this.finishToken(Kt.semi);case 44:return++this.pos,this.finishToken(Kt.comma);case 91:return++this.pos,this.finishToken(Kt.bracketL);case 93:return++this.pos,this.finishToken(Kt.bracketR);case 123:return++this.pos,this.finishToken(Kt.braceL);case 125:return++this.pos,this.finishToken(Kt.braceR);case 58:return++this.pos,this.finishToken(Kt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Kt.backQuote);case 48:var te=this.input.charCodeAt(this.pos+1);if(te===120||te===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(te===111||te===79)return this.readRadixNumber(8);if(te===98||te===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(ee);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(ee);case 124:case 38:return this.readToken_pipe_amp(ee);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(ee);case 60:case 62:return this.readToken_lt_gt(ee);case 61:case 33:return this.readToken_eq_excl(ee);case 63:return this.readToken_question();case 126:return this.finishOp(Kt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ts(ee)+"'")};rn.finishOp=function(ee,te){var Oe=this.input.slice(this.pos,this.pos+te);return this.pos+=te,this.finishToken(ee,Oe)};rn.readRegexp=function(){var ee,te,Oe=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Oe,"Unterminated regular expression");var Ot=this.input.charAt(this.pos);if(En.test(Ot))this.raise(Oe,"Unterminated regular expression");if(!ee){if(Ot==="[")te=!0;else if(Ot==="]"&&te)te=!1;else if(Ot==="/"&&!te)break;ee=Ot==="\\"}else ee=!1;++this.pos}var jt=this.input.slice(Oe,this.pos);++this.pos;var Vt=this.pos,Wt=this.readWord1();if(this.containsEsc)this.unexpected(Vt);var Mt=this.regexpState||(this.regexpState=new Qo(this));Mt.reset(Oe,jt,Wt),this.validateRegExpFlags(Mt),this.validateRegExpPattern(Mt);var Gt=null;try{Gt=new RegExp(jt,Wt)}catch(Ut){}return this.finishToken(Kt.regexp,{pattern:jt,flags:Wt,value:Gt})};rn.readInt=function(ee,te,Oe){var Ot=this.options.ecmaVersion>=12&&te===void 0,jt=Oe&&this.input.charCodeAt(this.pos)===48,Vt=this.pos,Wt=0,Mt=0;for(var Gt=0,Ut=te==null?1/0:te;Gt<Ut;++Gt,++this.pos){var Ht=this.input.charCodeAt(this.pos),qt=void 0;if(Ot&&Ht===95){if(jt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Mt===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Gt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Mt=Ht;continue}if(Ht>=97)qt=Ht-97+10;else if(Ht>=65)qt=Ht-65+10;else if(Ht>=48&&Ht<=57)qt=Ht-48;else qt=1/0;if(qt>=ee)break;Mt=Ht,Wt=Wt*ee+qt}if(Ot&&Mt===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Vt||te!=null&&this.pos-Vt!==te)return null;return Wt};function Tl(ee,te){if(te)return parseInt(ee,8);return parseFloat(ee.replace(/_/g,""))}function Zo(ee){if(typeof BigInt!=="function")return null;return BigInt(ee.replace(/_/g,""))}rn.readRadixNumber=function(ee){var te=this.pos;this.pos+=2;var Oe=this.readInt(ee);if(Oe==null)this.raise(this.start+2,"Expected number in radix "+ee);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Oe=Zo(this.input.slice(te,this.pos)),++this.pos;else if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Kt.num,Oe)};rn.readNumber=function(ee){var te=this.pos;if(!ee&&this.readInt(10,void 0,!0)===null)this.raise(te,"Invalid number");var Oe=this.pos-te>=2&&this.input.charCodeAt(te)===48;if(Oe&&this.strict)this.raise(te,"Invalid number");var Ot=this.input.charCodeAt(this.pos);if(!Oe&&!ee&&this.options.ecmaVersion>=11&&Ot===110){var jt=Zo(this.input.slice(te,this.pos));if(++this.pos,g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Kt.num,jt)}if(Oe&&/[89]/.test(this.input.slice(te,this.pos)))Oe=!1;if(Ot===46&&!Oe)++this.pos,this.readInt(10),Ot=this.input.charCodeAt(this.pos);if((Ot===69||Ot===101)&&!Oe){if(Ot=this.input.charCodeAt(++this.pos),Ot===43||Ot===45)++this.pos;if(this.readInt(10)===null)this.raise(te,"Invalid number")}if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Vt=Tl(this.input.slice(te,this.pos),Oe);return this.finishToken(Kt.num,Vt)};rn.readCodePoint=function(){var ee=this.input.charCodeAt(this.pos),te;if(ee===123){if(this.options.ecmaVersion<6)this.unexpected();var Oe=++this.pos;if(te=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,te>1114111)this.invalidStringToken(Oe,"Code point out of bounds")}else te=this.readHexChar(4);return te};rn.readString=function(ee){var te="",Oe=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Ot=this.input.charCodeAt(this.pos);if(Ot===ee)break;if(Ot===92)te+=this.input.slice(Oe,this.pos),te+=this.readEscapedChar(!1),Oe=this.pos;else if(Ot===8232||Ot===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(ui(Ot))this.raise(this.start,"Unterminated string constant");++this.pos}}return te+=this.input.slice(Oe,this.pos++),this.finishToken(Kt.string,te)};var ea={};rn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(ee){if(ee===ea)this.readInvalidTemplateToken();else throw ee}this.inTemplateElement=!1};rn.invalidStringToken=function(ee,te){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ea;else this.raise(ee,te)};rn.readTmplToken=function(){var ee="",te=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Oe=this.input.charCodeAt(this.pos);if(Oe===96||Oe===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Kt.template||this.type===Kt.invalidTemplate))if(Oe===36)return this.pos+=2,this.finishToken(Kt.dollarBraceL);else return++this.pos,this.finishToken(Kt.backQuote);return ee+=this.input.slice(te,this.pos),this.finishToken(Kt.template,ee)}if(Oe===92)ee+=this.input.slice(te,this.pos),ee+=this.readEscapedChar(!0),te=this.pos;else if(ui(Oe)){switch(ee+=this.input.slice(te,this.pos),++this.pos,Oe){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:ee+=`
|
|
12
|
+
`),cooked:this.value};return this.next(),Oe.tail=this.type===Kt.backQuote,this.finishNode(Oe,"TemplateElement")};tn.parseTemplate=function(ee){if(ee===void 0)ee={};var te=ee.isTagged;if(te===void 0)te=!1;var Oe=this.startNode();this.next(),Oe.expressions=[];var Ot=this.parseTemplateElement({isTagged:te});Oe.quasis=[Ot];while(!Ot.tail){if(this.type===Kt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Kt.dollarBraceL),Oe.expressions.push(this.parseExpression()),this.expect(Kt.braceR),Oe.quasis.push(Ot=this.parseTemplateElement({isTagged:te}))}return this.next(),this.finishNode(Oe,"TemplateLiteral")};tn.isAsyncProp=function(ee){return!ee.computed&&ee.key.type==="Identifier"&&ee.key.name==="async"&&(this.type===Kt.name||this.type===Kt.num||this.type===Kt.string||this.type===Kt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Kt.star)&&!En.test(this.input.slice(this.lastTokEnd,this.start))};tn.parseObj=function(ee,te){var Oe=this.startNode(),Ot=!0,jt={};Oe.properties=[],this.next();while(!this.eat(Kt.braceR)){if(!Ot){if(this.expect(Kt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Kt.braceR))break}else Ot=!1;var Vt=this.parseProperty(ee,te);if(!ee)this.checkPropClash(Vt,jt,te);Oe.properties.push(Vt)}return this.finishNode(Oe,ee?"ObjectPattern":"ObjectExpression")};tn.parseProperty=function(ee,te){var Oe=this.startNode(),Ot,jt,Vt,Wt;if(this.options.ecmaVersion>=9&&this.eat(Kt.ellipsis)){if(ee){if(Oe.argument=this.parseIdent(!1),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Oe,"RestElement")}if(Oe.argument=this.parseMaybeAssign(!1,te),this.type===Kt.comma&&te&&te.trailingComma<0)te.trailingComma=this.start;return this.finishNode(Oe,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Oe.method=!1,Oe.shorthand=!1,ee||te)Vt=this.start,Wt=this.startLoc;if(!ee)Ot=this.eat(Kt.star)}var Mt=this.containsEsc;if(this.parsePropertyName(Oe),!ee&&!Mt&&this.options.ecmaVersion>=8&&!Ot&&this.isAsyncProp(Oe))jt=!0,Ot=this.options.ecmaVersion>=9&&this.eat(Kt.star),this.parsePropertyName(Oe);else jt=!1;return this.parsePropertyValue(Oe,ee,Ot,jt,Vt,Wt,te,Mt),this.finishNode(Oe,"Property")};tn.parseGetterSetter=function(ee){var te=ee.key.name;this.parsePropertyName(ee),ee.value=this.parseMethod(!1),ee.kind=te;var Oe=ee.kind==="get"?0:1;if(ee.value.params.length!==Oe){var Ot=ee.value.start;if(ee.kind==="get")this.raiseRecoverable(Ot,"getter should have no params");else this.raiseRecoverable(Ot,"setter should have exactly one param")}else if(ee.kind==="set"&&ee.value.params[0].type==="RestElement")this.raiseRecoverable(ee.value.params[0].start,"Setter cannot use rest params")};tn.parsePropertyValue=function(ee,te,Oe,Ot,jt,Vt,Wt,Mt){if((Oe||Ot)&&this.type===Kt.colon)this.unexpected();if(this.eat(Kt.colon))ee.value=te?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Wt),ee.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Kt.parenL){if(te)this.unexpected();ee.method=!0,ee.value=this.parseMethod(Oe,Ot),ee.kind="init"}else if(!te&&!Mt&&this.options.ecmaVersion>=5&&!ee.computed&&ee.key.type==="Identifier"&&(ee.key.name==="get"||ee.key.name==="set")&&(this.type!==Kt.comma&&this.type!==Kt.braceR&&this.type!==Kt.eq)){if(Oe||Ot)this.unexpected();this.parseGetterSetter(ee)}else if(this.options.ecmaVersion>=6&&!ee.computed&&ee.key.type==="Identifier"){if(Oe||Ot)this.unexpected();if(this.checkUnreserved(ee.key),ee.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=jt;if(te)ee.value=this.parseMaybeDefault(jt,Vt,this.copyNode(ee.key));else if(this.type===Kt.eq&&Wt){if(Wt.shorthandAssign<0)Wt.shorthandAssign=this.start;ee.value=this.parseMaybeDefault(jt,Vt,this.copyNode(ee.key))}else ee.value=this.copyNode(ee.key);ee.kind="init",ee.shorthand=!0}else this.unexpected()};tn.parsePropertyName=function(ee){if(this.options.ecmaVersion>=6)if(this.eat(Kt.bracketL))return ee.computed=!0,ee.key=this.parseMaybeAssign(),this.expect(Kt.bracketR),ee.key;else ee.computed=!1;return ee.key=this.type===Kt.num||this.type===Kt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};tn.initFunction=function(ee){if(ee.id=null,this.options.ecmaVersion>=6)ee.generator=ee.expression=!1;if(this.options.ecmaVersion>=8)ee.async=!1};tn.parseMethod=function(ee,te,Oe){var Ot=this.startNode(),jt=this.yieldPos,Vt=this.awaitPos,Wt=this.awaitIdentPos;if(this.initFunction(Ot),this.options.ecmaVersion>=6)Ot.generator=ee;if(this.options.ecmaVersion>=8)Ot.async=!!te;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(tr(te,Ot.generator)|ss|(Oe?qo:0)),this.expect(Kt.parenL),Ot.params=this.parseBindingList(Kt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Ot,!1,!0,!1),this.yieldPos=jt,this.awaitPos=Vt,this.awaitIdentPos=Wt,this.finishNode(Ot,"FunctionExpression")};tn.parseArrowExpression=function(ee,te,Oe,Ot){var jt=this.yieldPos,Vt=this.awaitPos,Wt=this.awaitIdentPos;if(this.enterScope(tr(Oe,!1)|er),this.initFunction(ee),this.options.ecmaVersion>=8)ee.async=!!Oe;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,ee.params=this.toAssignableList(te,!0),this.parseFunctionBody(ee,!0,!1,Ot),this.yieldPos=jt,this.awaitPos=Vt,this.awaitIdentPos=Wt,this.finishNode(ee,"ArrowFunctionExpression")};tn.parseFunctionBody=function(ee,te,Oe,Ot){var jt=te&&this.type!==Kt.braceL,Vt=this.strict,Wt=!1;if(jt)ee.body=this.parseMaybeAssign(Ot),ee.expression=!0,this.checkParams(ee,!1);else{var Mt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(ee.params);if(!Vt||Mt){if(Wt=this.strictDirective(this.end),Wt&&Mt)this.raiseRecoverable(ee.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Gt=this.labels;if(this.labels=[],Wt)this.strict=!0;if(this.checkParams(ee,!Vt&&!Wt&&!te&&!Oe&&this.isSimpleParamList(ee.params)),this.strict&&ee.id)this.checkLValSimple(ee.id,Yo);ee.body=this.parseBlock(!1,void 0,Wt&&!Vt),ee.expression=!1,this.adaptDirectivePrologue(ee.body.body),this.labels=Gt}this.exitScope()};tn.isSimpleParamList=function(ee){for(var te=0,Oe=ee;te<Oe.length;te+=1){var Ot=Oe[te];if(Ot.type!=="Identifier")return!1}return!0};tn.checkParams=function(ee,te){var Oe=Object.create(null);for(var Ot=0,jt=ee.params;Ot<jt.length;Ot+=1){var Vt=jt[Ot];this.checkLValInnerPattern(Vt,nr,te?null:Oe)}};tn.parseExprList=function(ee,te,Oe,Ot){var jt=[],Vt=!0;while(!this.eat(ee)){if(!Vt){if(this.expect(Kt.comma),te&&this.afterTrailingComma(ee))break}else Vt=!1;var Wt=void 0;if(Oe&&this.type===Kt.comma)Wt=null;else if(this.type===Kt.ellipsis){if(Wt=this.parseSpread(Ot),Ot&&this.type===Kt.comma&&Ot.trailingComma<0)Ot.trailingComma=this.start}else Wt=this.parseMaybeAssign(!1,Ot);jt.push(Wt)}return jt};tn.checkUnreserved=function(ee){var{start:te,end:Oe,name:Ot}=ee;if(this.inGenerator&&Ot==="yield")this.raiseRecoverable(te,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ot==="await")this.raiseRecoverable(te,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&rs)&&Ot==="arguments")this.raiseRecoverable(te,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ot==="arguments"||Ot==="await"))this.raise(te,"Cannot use "+Ot+" in class static initialization block");if(this.keywords.test(Ot))this.raise(te,"Unexpected keyword '"+Ot+"'");if(this.options.ecmaVersion<6&&this.input.slice(te,Oe).indexOf("\\")!==-1)return;var jt=this.strict?this.reservedWordsStrict:this.reservedWords;if(jt.test(Ot)){if(!this.inAsync&&Ot==="await")this.raiseRecoverable(te,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(te,"The keyword '"+Ot+"' is reserved")}};tn.parseIdent=function(ee){var te=this.parseIdentNode();if(this.next(!!ee),this.finishNode(te,"Identifier"),!ee){if(this.checkUnreserved(te),te.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=te.start}return te};tn.parseIdentNode=function(){var ee=this.startNode();if(this.type===Kt.name)ee.name=this.value;else if(this.type.keyword){if(ee.name=this.type.keyword,(ee.name==="class"||ee.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Kt.name}else this.unexpected();return ee};tn.parsePrivateIdent=function(){var ee=this.startNode();if(this.type===Kt.privateId)ee.name=this.value;else this.unexpected();if(this.next(),this.finishNode(ee,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(ee.start,"Private field '#"+ee.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(ee);return ee};tn.parseYield=function(ee){if(!this.yieldPos)this.yieldPos=this.start;var te=this.startNode();if(this.next(),this.type===Kt.semi||this.canInsertSemicolon()||this.type!==Kt.star&&!this.type.startsExpr)te.delegate=!1,te.argument=null;else te.delegate=this.eat(Kt.star),te.argument=this.parseMaybeAssign(ee);return this.finishNode(te,"YieldExpression")};tn.parseAwait=function(ee){if(!this.awaitPos)this.awaitPos=this.start;var te=this.startNode();return this.next(),te.argument=this.parseMaybeUnary(null,!0,!1,ee),this.finishNode(te,"AwaitExpression")};var ts=s.prototype;ts.raise=function(ee,te){var Oe=Uo(this.input,ee);if(te+=" ("+Oe.line+":"+Oe.column+")",this.sourceFile)te+=" in "+this.sourceFile;var Ot=SyntaxError(te);throw Ot.pos=ee,Ot.loc=Oe,Ot.raisedAt=this.pos,Ot};ts.raiseRecoverable=ts.raise;ts.curPosition=function(){if(this.options.locations)return new Ci(this.curLine,this.pos-this.lineStart)};var Wn=s.prototype,Tl=function(ee){this.flags=ee,this.var=[],this.lexical=[],this.functions=[]};Wn.enterScope=function(ee){this.scopeStack.push(new Tl(ee))};Wn.exitScope=function(){this.scopeStack.pop()};Wn.treatFunctionsAsVarInScope=function(ee){return ee.flags&ti||!this.inModule&&ee.flags&ei};Wn.declareName=function(ee,te,Oe){var Ot=!1;if(te===Fn){var jt=this.currentScope();if(Ot=jt.lexical.indexOf(ee)>-1||jt.functions.indexOf(ee)>-1||jt.var.indexOf(ee)>-1,jt.lexical.push(ee),this.inModule&&jt.flags&ei)delete this.undefinedExports[ee]}else if(te===Jo){var Vt=this.currentScope();Vt.lexical.push(ee)}else if(te===Xo){var Wt=this.currentScope();if(this.treatFunctionsAsVar)Ot=Wt.lexical.indexOf(ee)>-1;else Ot=Wt.lexical.indexOf(ee)>-1||Wt.var.indexOf(ee)>-1;Wt.functions.push(ee)}else for(var Mt=this.scopeStack.length-1;Mt>=0;--Mt){var Gt=this.scopeStack[Mt];if(Gt.lexical.indexOf(ee)>-1&&!(Gt.flags&Ko&&Gt.lexical[0]===ee)||!this.treatFunctionsAsVarInScope(Gt)&&Gt.functions.indexOf(ee)>-1){Ot=!0;break}if(Gt.var.push(ee),this.inModule&&Gt.flags&ei)delete this.undefinedExports[ee];if(Gt.flags&rs)break}if(Ot)this.raiseRecoverable(Oe,"Identifier '"+ee+"' has already been declared")};Wn.checkLocalExport=function(ee){if(this.scopeStack[0].lexical.indexOf(ee.name)===-1&&this.scopeStack[0].var.indexOf(ee.name)===-1)this.undefinedExports[ee.name]=ee};Wn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Wn.currentVarScope=function(){for(var ee=this.scopeStack.length-1;;ee--){var te=this.scopeStack[ee];if(te.flags&(rs|Ti|ni))return te}};Wn.currentThisScope=function(){for(var ee=this.scopeStack.length-1;;ee--){var te=this.scopeStack[ee];if(te.flags&(rs|Ti|ni)&&!(te.flags&er))return te}};var as=function(ee,te,Oe){if(this.type="",this.start=te,this.end=0,ee.options.locations)this.loc=new is(ee,Oe);if(ee.options.directSourceFile)this.sourceFile=ee.options.directSourceFile;if(ee.options.ranges)this.range=[te,0]},ki=s.prototype;ki.startNode=function(){return new as(this,this.start,this.startLoc)};ki.startNodeAt=function(ee,te){return new as(this,ee,te)};function ea(ee,te,Oe,Ot){if(ee.type=te,ee.end=Oe,this.options.locations)ee.loc.end=Ot;if(this.options.ranges)ee.range[1]=Oe;return ee}ki.finishNode=function(ee,te){return ea.call(this,ee,te,this.lastTokEnd,this.lastTokEndLoc)};ki.finishNodeAt=function(ee,te,Oe,Ot){return ea.call(this,ee,te,Oe,Ot)};ki.copyNode=function(ee){var te=new as(this,ee.start,this.startLoc);for(var Oe in ee)te[Oe]=ee[Oe];return te};var ta=function(){};ta.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var sr=function(ee){if(this.type=ee.type,this.value=ee.value,this.start=ee.start,this.end=ee.end,ee.options.locations)this.loc=new is(ee,ee.startLoc,ee.endLoc);if(ee.options.ranges)this.range=[ee.start,ee.end]},rn=s.prototype;rn.next=function(ee){if(!ee&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new sr(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};rn.getToken=function(){return this.next(),new sr(this)};if(typeof Symbol<"u")rn[Symbol.iterator]=function(){var ee=this;return{next:function(){var te=ee.getToken();return{done:te.type===Kt.eof,value:te}}}};rn.nextToken=function(){var ee=this.curContext();if(!ee||!ee.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Kt.eof);if(ee.override)return ee.override(this);else this.readToken(this.fullCharCodeAtPos())};rn.readToken=function(ee){if(g(ee,this.options.ecmaVersion>=6)||ee===92)return this.readWord();return this.getTokenFromCode(ee)};rn.fullCharCodeAt=function(ee){var te=this.input.charCodeAt(ee);if(te<=55295||te>=56320)return te;var Oe=this.input.charCodeAt(ee+1);return Oe<=56319||Oe>=57344?te:(te<<10)+Oe-56613888};rn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};rn.skipBlockComment=function(){var ee=this.options.onComment&&this.curPosition(),te=this.pos,Oe=this.input.indexOf("*/",this.pos+=2);if(Oe===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Oe+2,this.options.locations)for(var Ot=void 0,jt=te;(Ot=Go(this.input,jt,this.pos))>-1;)++this.curLine,jt=this.lineStart=Ot;if(this.options.onComment)this.options.onComment(!0,this.input.slice(te+2,Oe),te,this.pos,ee,this.curPosition())};rn.skipLineComment=function(ee){var te=this.pos,Oe=this.options.onComment&&this.curPosition(),Ot=this.input.charCodeAt(this.pos+=ee);while(this.pos<this.input.length&&!hi(Ot))Ot=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(te+ee,this.pos),te,this.pos,Oe,this.curPosition())};rn.skipSpace=function(){e:while(this.pos<this.input.length){var ee=this.input.charCodeAt(this.pos);switch(ee){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(ee>8&&ee<14||ee>=5760&&Wo.test(String.fromCharCode(ee)))++this.pos;else break e}}};rn.finishToken=function(ee,te){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Oe=this.type;this.type=ee,this.value=te,this.updateContext(Oe)};rn.readToken_dot=function(){var ee=this.input.charCodeAt(this.pos+1);if(ee>=48&&ee<=57)return this.readNumber(!0);var te=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&ee===46&&te===46)return this.pos+=3,this.finishToken(Kt.ellipsis);else return++this.pos,this.finishToken(Kt.dot)};rn.readToken_slash=function(){var ee=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(ee===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.slash,1)};rn.readToken_mult_modulo_exp=function(ee){var te=this.input.charCodeAt(this.pos+1),Oe=1,Ot=ee===42?Kt.star:Kt.modulo;if(this.options.ecmaVersion>=7&&ee===42&&te===42)++Oe,Ot=Kt.starstar,te=this.input.charCodeAt(this.pos+2);if(te===61)return this.finishOp(Kt.assign,Oe+1);return this.finishOp(Ot,Oe)};rn.readToken_pipe_amp=function(ee){var te=this.input.charCodeAt(this.pos+1);if(te===ee){if(this.options.ecmaVersion>=12){var Oe=this.input.charCodeAt(this.pos+2);if(Oe===61)return this.finishOp(Kt.assign,3)}return this.finishOp(ee===124?Kt.logicalOR:Kt.logicalAND,2)}if(te===61)return this.finishOp(Kt.assign,2);return this.finishOp(ee===124?Kt.bitwiseOR:Kt.bitwiseAND,1)};rn.readToken_caret=function(){var ee=this.input.charCodeAt(this.pos+1);if(ee===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.bitwiseXOR,1)};rn.readToken_plus_min=function(ee){var te=this.input.charCodeAt(this.pos+1);if(te===ee){if(te===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||En.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Kt.incDec,2)}if(te===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.plusMin,1)};rn.readToken_lt_gt=function(ee){var te=this.input.charCodeAt(this.pos+1),Oe=1;if(te===ee){if(Oe=ee===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Oe)===61)return this.finishOp(Kt.assign,Oe+1);return this.finishOp(Kt.bitShift,Oe)}if(te===33&&ee===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(te===61)Oe=2;return this.finishOp(Kt.relational,Oe)};rn.readToken_eq_excl=function(ee){var te=this.input.charCodeAt(this.pos+1);if(te===61)return this.finishOp(Kt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(ee===61&&te===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Kt.arrow);return this.finishOp(ee===61?Kt.eq:Kt.prefix,1)};rn.readToken_question=function(){var ee=this.options.ecmaVersion;if(ee>=11){var te=this.input.charCodeAt(this.pos+1);if(te===46){var Oe=this.input.charCodeAt(this.pos+2);if(Oe<48||Oe>57)return this.finishOp(Kt.questionDot,2)}if(te===63){if(ee>=12){var Ot=this.input.charCodeAt(this.pos+2);if(Ot===61)return this.finishOp(Kt.assign,3)}return this.finishOp(Kt.coalesce,2)}}return this.finishOp(Kt.question,1)};rn.readToken_numberSign=function(){var ee=this.options.ecmaVersion,te=35;if(ee>=13){if(++this.pos,te=this.fullCharCodeAtPos(),g(te,!0)||te===92)return this.finishToken(Kt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+ns(te)+"'")};rn.getTokenFromCode=function(ee){switch(ee){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Kt.parenL);case 41:return++this.pos,this.finishToken(Kt.parenR);case 59:return++this.pos,this.finishToken(Kt.semi);case 44:return++this.pos,this.finishToken(Kt.comma);case 91:return++this.pos,this.finishToken(Kt.bracketL);case 93:return++this.pos,this.finishToken(Kt.bracketR);case 123:return++this.pos,this.finishToken(Kt.braceL);case 125:return++this.pos,this.finishToken(Kt.braceR);case 58:return++this.pos,this.finishToken(Kt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Kt.backQuote);case 48:var te=this.input.charCodeAt(this.pos+1);if(te===120||te===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(te===111||te===79)return this.readRadixNumber(8);if(te===98||te===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(ee);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(ee);case 124:case 38:return this.readToken_pipe_amp(ee);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(ee);case 60:case 62:return this.readToken_lt_gt(ee);case 61:case 33:return this.readToken_eq_excl(ee);case 63:return this.readToken_question();case 126:return this.finishOp(Kt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ns(ee)+"'")};rn.finishOp=function(ee,te){var Oe=this.input.slice(this.pos,this.pos+te);return this.pos+=te,this.finishToken(ee,Oe)};rn.readRegexp=function(){var ee,te,Oe=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Oe,"Unterminated regular expression");var Ot=this.input.charAt(this.pos);if(En.test(Ot))this.raise(Oe,"Unterminated regular expression");if(!ee){if(Ot==="[")te=!0;else if(Ot==="]"&&te)te=!1;else if(Ot==="/"&&!te)break;ee=Ot==="\\"}else ee=!1;++this.pos}var jt=this.input.slice(Oe,this.pos);++this.pos;var Vt=this.pos,Wt=this.readWord1();if(this.containsEsc)this.unexpected(Vt);var Mt=this.regexpState||(this.regexpState=new ta(this));Mt.reset(Oe,jt,Wt),this.validateRegExpFlags(Mt),this.validateRegExpPattern(Mt);var Gt=null;try{Gt=new RegExp(jt,Wt)}catch(Ut){}return this.finishToken(Kt.regexp,{pattern:jt,flags:Wt,value:Gt})};rn.readInt=function(ee,te,Oe){var Ot=this.options.ecmaVersion>=12&&te===void 0,jt=Oe&&this.input.charCodeAt(this.pos)===48,Vt=this.pos,Wt=0,Mt=0;for(var Gt=0,Ut=te==null?1/0:te;Gt<Ut;++Gt,++this.pos){var Ht=this.input.charCodeAt(this.pos),qt=void 0;if(Ot&&Ht===95){if(jt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Mt===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Gt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Mt=Ht;continue}if(Ht>=97)qt=Ht-97+10;else if(Ht>=65)qt=Ht-65+10;else if(Ht>=48&&Ht<=57)qt=Ht-48;else qt=1/0;if(qt>=ee)break;Mt=Ht,Wt=Wt*ee+qt}if(Ot&&Mt===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Vt||te!=null&&this.pos-Vt!==te)return null;return Wt};function kl(ee,te){if(te)return parseInt(ee,8);return parseFloat(ee.replace(/_/g,""))}function na(ee){if(typeof BigInt!=="function")return null;return BigInt(ee.replace(/_/g,""))}rn.readRadixNumber=function(ee){var te=this.pos;this.pos+=2;var Oe=this.readInt(ee);if(Oe==null)this.raise(this.start+2,"Expected number in radix "+ee);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Oe=na(this.input.slice(te,this.pos)),++this.pos;else if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Kt.num,Oe)};rn.readNumber=function(ee){var te=this.pos;if(!ee&&this.readInt(10,void 0,!0)===null)this.raise(te,"Invalid number");var Oe=this.pos-te>=2&&this.input.charCodeAt(te)===48;if(Oe&&this.strict)this.raise(te,"Invalid number");var Ot=this.input.charCodeAt(this.pos);if(!Oe&&!ee&&this.options.ecmaVersion>=11&&Ot===110){var jt=na(this.input.slice(te,this.pos));if(++this.pos,g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Kt.num,jt)}if(Oe&&/[89]/.test(this.input.slice(te,this.pos)))Oe=!1;if(Ot===46&&!Oe)++this.pos,this.readInt(10),Ot=this.input.charCodeAt(this.pos);if((Ot===69||Ot===101)&&!Oe){if(Ot=this.input.charCodeAt(++this.pos),Ot===43||Ot===45)++this.pos;if(this.readInt(10)===null)this.raise(te,"Invalid number")}if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Vt=kl(this.input.slice(te,this.pos),Oe);return this.finishToken(Kt.num,Vt)};rn.readCodePoint=function(){var ee=this.input.charCodeAt(this.pos),te;if(ee===123){if(this.options.ecmaVersion<6)this.unexpected();var Oe=++this.pos;if(te=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,te>1114111)this.invalidStringToken(Oe,"Code point out of bounds")}else te=this.readHexChar(4);return te};rn.readString=function(ee){var te="",Oe=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Ot=this.input.charCodeAt(this.pos);if(Ot===ee)break;if(Ot===92)te+=this.input.slice(Oe,this.pos),te+=this.readEscapedChar(!1),Oe=this.pos;else if(Ot===8232||Ot===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(hi(Ot))this.raise(this.start,"Unterminated string constant");++this.pos}}return te+=this.input.slice(Oe,this.pos++),this.finishToken(Kt.string,te)};var ia={};rn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(ee){if(ee===ia)this.readInvalidTemplateToken();else throw ee}this.inTemplateElement=!1};rn.invalidStringToken=function(ee,te){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ia;else this.raise(ee,te)};rn.readTmplToken=function(){var ee="",te=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Oe=this.input.charCodeAt(this.pos);if(Oe===96||Oe===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Kt.template||this.type===Kt.invalidTemplate))if(Oe===36)return this.pos+=2,this.finishToken(Kt.dollarBraceL);else return++this.pos,this.finishToken(Kt.backQuote);return ee+=this.input.slice(te,this.pos),this.finishToken(Kt.template,ee)}if(Oe===92)ee+=this.input.slice(te,this.pos),ee+=this.readEscapedChar(!0),te=this.pos;else if(hi(Oe)){switch(ee+=this.input.slice(te,this.pos),++this.pos,Oe){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:ee+=`
|
|
13
13
|
`;break;default:ee+=String.fromCharCode(Oe);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;te=this.pos}else++this.pos}};rn.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(Kt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
14
14
|
`)++this.pos;case`
|
|
15
15
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};rn.readEscapedChar=function(ee){var te=this.input.charCodeAt(++this.pos);switch(++this.pos,te){case 110:return`
|
|
16
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ts(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(ee){var Oe=this.pos-1;this.invalidStringToken(Oe,"Invalid escape sequence in template string")}default:if(te>=48&&te<=55){var Ot=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],jt=parseInt(Ot,8);if(jt>255)Ot=Ot.slice(0,-1),jt=parseInt(Ot,8);if(this.pos+=Ot.length-1,te=this.input.charCodeAt(this.pos),(Ot!=="0"||te===56||te===57)&&(this.strict||ee))this.invalidStringToken(this.pos-1-Ot.length,ee?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(jt)}if(ui(te)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(te)}};rn.readHexChar=function(ee){var te=this.pos,Oe=this.readInt(16,ee);if(Oe===null)this.invalidStringToken(te,"Bad character escape sequence");return Oe};rn.readWord1=function(){this.containsEsc=!1;var ee="",te=!0,Oe=this.pos,Ot=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var jt=this.fullCharCodeAtPos();if(S(jt,Ot))this.pos+=jt<=65535?1:2;else if(jt===92){this.containsEsc=!0,ee+=this.input.slice(Oe,this.pos);var Vt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Wt=this.readCodePoint();if(!(te?g:S)(Wt,Ot))this.invalidStringToken(Vt,"Invalid Unicode escape");ee+=ts(Wt),Oe=this.pos}else break;te=!1}return ee+this.input.slice(Oe,this.pos)};rn.readWord=function(){var ee=this.readWord1(),te=Kt.name;if(this.keywords.test(ee))te=Js[ee];return this.finishToken(te,ee)};var kl="8.18.0";s.acorn={Parser:s,version:kl,defaultOptions:qs,Position:bi,SourceLocation:ns,getLineInfo:Vo,Node:os,TokenType:pn,tokTypes:Kt,keywordTypes:Js,TokContext:Pn,tokContexts:ln,isIdentifierChar:S,isIdentifierStart:g,Token:nr,isNewLine:ui,lineBreak:En,lineBreakG:hl,nonASCIIwhitespace:jo};function ki(ee){return(te)=>ee(te)}function as(...ee){return s.extend(...ee)}function Ai(ee,te,Oe){for(let Ot=te;Ot<Oe;Ot++){let jt=ee.charCodeAt(Ot);if(jt===10||jt===13||jt===8232||jt===8233)return!0}return!1}var Mo=new WeakMap;function Sn(ee,te){if(ee===void 0)return!1;if(ee.length<16)return ee.includes(te);let Oe=Mo.get(ee);if(Oe===void 0||Oe.length>ee.length)Oe={names:new Set,length:0},Mo.set(ee,Oe);while(Oe.length<ee.length)Oe.names.add(ee[Oe.length++]);return Oe.names.has(te)}var ir=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,Al=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"]]),Pl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),_l=new Set("public private protected readonly override".split(" ")),$l=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),Nl=new Set("var let const function class interface enum".split(" ")),ta=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),na=1,Dl=32,Rl=256,Il=0,Ol=1,Pi=2,Ll=3,Ml=4,sr=6,ia=7,ca=256,pr=1024,Fl=8|pr,Bl=Pi|ca,sa=1,jl=2,ra=40,Vl=41,Gl=44,oa=46,aa=58,ps=61,pa=60,cs=123,Wl=91,rr=42,Ul=35,or=34,ar=39,Hl=SyntaxError("speculative parse failed"),ce=ki((ee)=>{let{tokTypes:te,keywordTypes:Oe,isIdentifierChar:Ot,isIdentifierStart:jt}=ee.acorn,Vt=new ee.acorn.TokenType("@");class Wt extends ee{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Mt,Gt,Ut){super(Mt,Gt,Ut);let Ht=this.options.onComment;if(typeof Ht==="function")this.options.onComment=(qt,zt,Xt,Jt,Qt,Yt)=>{if(Xt<this.$t)return;this.$t=Jt,Ht.call(this,qt,zt,Xt,Jt,Qt,Yt)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Mt){if(Mt===64)return++this.pos,this.finishToken(Vt);return super.getTokenFromCode(Mt)}readToken_lt_gt(Mt){if(this.inType)return this.finishOp(te.relational,1);return super.readToken_lt_gt(Mt)}$a(Mt){let Gt=this.inType;this.inType=!0;let Ut=Mt();if(this.inType=Gt,!Gt&&this.type===te.relational)this.pos=this.start,this.nextToken();return Ut}$1(){return this.type===te.relational&&this.value==="<"}$p(){if(this.type===te.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(te.relational,"<");return this.$1()}$c(){return this.type===te.relational&&this.value===">"}$u(){return this.type===te.prefix&&this.value==="!"}hasPrecedingLineBreak(){return Ai(this.input,this.lastTokEnd,this.start)}$d(Mt=this.pos){return ir.lastIndex=Mt,ir.exec(this.input),ir.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Mt=this.$d(),Gt=Mt;while(Gt<this.input.length&&Ot(this.input.charCodeAt(Gt)))Gt++;return this.input.slice(Mt,Gt)}$b(){return!Ai(this.input,this.pos,this.$d())}$14(){return this.$b()&&jt(this.$2())&&!Object.hasOwn(Oe,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(Mt){this.pos=Mt.pos,this.type=Mt.type,this.value=Mt.value,this.start=Mt.start,this.end=Mt.end,this.startLoc=Mt.startLoc,this.endLoc=Mt.endLoc,this.lastTokStart=Mt.lastTokStart,this.lastTokEnd=Mt.lastTokEnd,this.lastTokStartLoc=Mt.lastTokStartLoc,this.lastTokEndLoc=Mt.lastTokEndLoc,this.curLine=Mt.curLine,this.lineStart=Mt.lineStart,this.context=Mt.context,this.exprAllowed=Mt.exprAllowed,this.containsEsc=Mt.containsEsc,this.inType=Mt.inType,this.$4=Mt.$4,this.$5=Mt.$5,this.$7=Mt.$7,this.scopeStack.length=Mt.scopes,this.privateNameStack.length=Mt.privateNames,this.labels=Mt.labels,this.labels.length=Mt.labelCount,this.strict=Mt.strict,this.yieldPos=Mt.yieldPos,this.awaitPos=Mt.awaitPos,this.awaitIdentPos=Mt.awaitIdentPos,this.potentialArrowAt=Mt.potentialArrowAt,this.potentialArrowInForAwait=Mt.potentialArrowInForAwait}raise(Mt,Gt){if(this.$n>0)throw Hl;return super.raise(Mt,Gt)}$1y(Mt,Gt){try{super.raise(Mt,Gt)}catch(Ut){if(Ut instanceof SyntaxError)Ut.$1z=!0;throw Ut}throw Error("unreachable")}$g(Mt,Gt=!1){let Ut=this.$15();this.$n++;try{let Ht=Mt();if(Gt||Ht===void 0)this.$16(Ut);return Ht}catch(Ht){if(!(Ht instanceof SyntaxError)||!Gt&&Ht.$1z)throw Ht;this.$16(Ut);return}finally{this.$n--}}$v(Mt){return this.$g(Mt,!0)===!0}$17(Mt){if(Mt.end=this.lastTokEnd,this.options.locations)Mt.loc.end=this.lastTokEndLoc}$q(Mt,Gt){if(Mt.start=Gt.start,this.options.locations)Mt.loc.start=Gt.loc.start}$6(Mt=!1){let Gt=this.startNode();return Gt.typeAnnotation=this.$a(()=>(this.next(),Mt?this.$20():this.$0())),this.finishNode(Gt,"TSTypeAnnotation")}$h(Mt,Gt){if(Gt&&this.eat(te.question))Mt.optional=!0,this.$17(Mt);if(this.type===te.colon)Mt.typeAnnotation=this.$6(),this.$17(Mt);return Mt}$20(){if(this.type!==te.name&&this.type!==te._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&jt(this.$2())){let Mt=this.startNode();if(this.next(),Mt.parameterName=this.type===te._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Mt,!0);return Mt.asserts=!0,Mt.typeAnnotation=null,this.finishNode(Mt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Mt=this.startNode();return Mt.parameterName=this.type===te._this?this.$w():this.parseIdent(!0),this.$x(Mt,!1)}return this.$0()}$x(Mt,Gt){this.next();let Ut=this.startNode();return Ut.typeAnnotation=this.$0(),Mt.typeAnnotation=this.finishNode(Ut,"TSTypeAnnotation"),Mt.asserts=Gt,this.finishNode(Mt,"TSTypePredicate")}$w(){let Mt=this.startNode();return this.next(),this.finishNode(Mt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Mt=this.$0();if(this.type!==te.eof)this.unexpected();return Mt}$0(){let Mt=this.$18();if(this.$4||this.type!==te._extends||this.hasPrecedingLineBreak())return Mt;let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);return this.next(),Gt.checkType=Mt,Gt.extendsType=this.$i(!0,()=>this.$18()),this.expect(te.question),Gt.trueType=this.$i(!1,()=>this.$0()),this.expect(te.colon),Gt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Gt,"TSConditionalType")}$i(Mt,Gt){let Ut=this.$4;this.$4=Mt;let Ht=Gt();return this.$4=Ut,Ht}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===te._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",te.bitwiseOR,()=>this.$1a("TSIntersectionType",te.bitwiseAND,()=>this.$1b()))}$19(Mt){let Gt=this.startNode();if(Mt==="TSConstructorType"){if(Gt.abstract=this.isContextual("abstract"),Gt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Gt,te.arrow)),this.finishNode(Gt,Mt)}$r(Mt,Gt){if(this.$1())Mt.typeParameters=this.$8();if(this.expect(te.parenL),Mt.parameters=this.parseBindingList(te.parenR,!1,!0),this.type===Gt)Mt.typeAnnotation=this.$6(!0);else if(Gt===te.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==te.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===te.parenR||this.type===te.ellipsis)return!0;if(this.type===te.name||this.type===te._this)this.next();else if(this.type===te.braceL||this.type===te.bracketL)this.parseBindingAtom();else return!1;let Mt=this.type;if(Mt===te.colon||Mt===te.comma||Mt===te.question||Mt===te.eq)return!0;if(Mt!==te.parenR)return!1;return this.next(),this.type===te.arrow})}$1a(Mt,Gt,Ut){let Ht=this.startNode(),qt=this.eat(Gt),zt=[];do zt.push(Ut());while(this.eat(Gt));if(zt.length===1&&!qt)return zt[0];return Ht.types=zt,this.finishNode(Ht,Mt)}$1b(){if(this.type===te.name&&!this.containsEsc){let Mt=this.value;if(Mt==="keyof"||Mt==="unique"||Mt==="readonly"){let Gt=this.startNode();return this.next(),Gt.operator=Mt,Gt.typeAnnotation=this.$1b(),this.finishNode(Gt,"TSTypeOperator")}if(Mt==="infer"){let Gt=this.startNode();this.next();let Ut=this.startNode();Ut.name=this.$y();let Ht=this.$g(()=>this.$22());if(Ht)Ut.constraint=Ht;return Gt.typeParameter=this.finishNode(Ut,"TSTypeParameter"),this.finishNode(Gt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(te._extends))return;let Mt=this.$i(!0,()=>this.$0());return this.$4||this.type!==te.question?Mt:void 0}$y(){if(this.type!==te.name&&!this.type.keyword)this.unexpected();let Mt=this.type===te.name?this.value:this.type.keyword;return this.next(),Mt}$23(){let Mt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(te.bracketL)){let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);if(this.eat(te.bracketR))Gt.elementType=Mt,Mt=this.finishNode(Gt,"TSArrayType");else Gt.objectType=Mt,Gt.indexType=this.$0(),this.expect(te.bracketR),Mt=this.finishNode(Gt,"TSIndexedAccessType")}return Mt}$24(){switch(this.type){case te.name:case te._void:case te._null:{let Mt=Al.get(this.value);if(Mt&&(this.type!==te.name||!this.containsEsc&&this.$2()!==oa)){let Gt=this.startNode();return this.next(),this.finishNode(Gt,Mt)}return this.$1c()}case te.string:case te.num:case te._true:case te._false:{let Mt=this.startNode();return Mt.literal=this.parseExprAtom(),this.finishNode(Mt,"TSLiteralType")}case te.plusMin:{if(this.value!=="-")break;let Mt=this.startNode(),Gt=this.startNode();if(this.next(),this.type!==te.num)this.unexpected();return Gt.operator="-",Gt.prefix=!0,Gt.argument=this.parseExprAtom(),Mt.literal=this.finishNode(Gt,"UnaryExpression"),this.finishNode(Mt,"TSLiteralType")}case te.backQuote:return this.$25();case te._this:{let Mt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);return Gt.parameterName=Mt,this.$x(Gt,!1)}return Mt}case te._typeof:return this.$26();case te._import:return this.$1d();case te.braceL:return this.$27()?this.$28():this.$29();case te.bracketL:return this.$2a();case te.parenL:{let Mt=this.startNode();return this.next(),Mt.typeAnnotation=this.$0(),this.expect(te.parenR),this.finishNode(Mt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Mt=this.startNode();if(Mt.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeReference")}$j(){let Mt=this.parseIdent(!0);while(this.eat(te.dot)){let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);Gt.left=Mt,Gt.right=this.parseIdent(!0),Mt=this.finishNode(Gt,"TSQualifiedName")}return Mt}$26(){let Mt=this.startNode();if(this.next(),Mt.exprName=this.type===te._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeQuery")}$1d(){let Mt=this.startNode();if(this.next(),Mt.argument=this.$1e(),this.eat(te.dot))Mt.qualifier=this.$j();if(this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSImportType")}$z(){if(this.type!==te.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(te.parenL);let Mt=this.$z();return this.expect(te.parenR),Mt}$25(){let Mt=this.startNode(),Gt=this.startNode();this.next(),Gt.expressions=[];let Ut=this.parseTemplateElement({isTagged:!1});Gt.quasis=[Ut];while(!Ut.tail){if(this.type===te.eof)this.raise(this.pos,"Unterminated template literal");this.expect(te.dollarBraceL),Gt.expressions.push(this.$0()),this.expect(te.braceR),Ut=this.parseTemplateElement({isTagged:!1}),Gt.quasis.push(Ut)}return this.next(),Mt.literal=this.finishNode(Gt,"TemplateLiteral"),this.finishNode(Mt,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===te.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==te.bracketL)return!1;if(this.next(),this.type!==te.name)return!1;return this.next(),this.type===te._in})}$28(){let Mt=this.startNode();if(this.expect(te.braceL),this.type===te.plusMin)Mt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Mt.readonly=!0;this.expect(te.bracketL);let Gt=this.startNode();if(Gt.name=this.$y(),this.expect(te._in),Gt.constraint=this.$0(),Mt.typeParameter=this.finishNode(Gt,"TSTypeParameter"),Mt.nameType=this.eatContextual("as")?this.$0():null,this.expect(te.bracketR),this.type===te.plusMin)Mt.optional=this.value,this.next(),this.expect(te.question);else if(this.eat(te.question))Mt.optional=!0;if(this.eat(te.colon))Mt.typeAnnotation=this.$0();return this.semicolon(),this.expect(te.braceR),this.finishNode(Mt,"TSMappedType")}$29(){let Mt=this.startNode();return Mt.members=this.$1f(),this.finishNode(Mt,"TSTypeLiteral")}$1f(){this.expect(te.braceL);let Mt=[];while(!this.eat(te.braceR))Mt.push(this.$2b());return Mt}$2b(){let Mt=this.startNode(),Gt="TSPropertySignature",Ut=this.type===te._new?this.$2():-1;if(this.type===te.parenL||this.$1())Gt="TSCallSignatureDeclaration",this.$r(Mt,te.colon);else if(Ut===ra||Ut===pa)Gt="TSConstructSignatureDeclaration",this.next(),this.$r(Mt,te.colon);else{let Ht=this.type===te._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Mt.readonly=!0;if(this.type===te.bracketL&&this.$1g())return this.$1h(Mt);let qt="method";if(Ht)Mt.key=Ht;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))qt=this.value,this.next();this.parsePropertyName(Mt)}if(this.eat(te.question))Mt.optional=!0;if(this.type===te.parenL||this.$1()){if(Gt="TSMethodSignature",qt!=="method")Mt.kind=qt;this.$r(Mt,te.colon),Mt.kind=qt}else if(this.type===te.colon)Mt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Mt,Gt)}$1i(){if(!this.eat(te.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==te.name)return!1;return this.next(),this.type===te.colon})}$1h(Mt){if(this.expect(te.bracketL),Mt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(te.bracketR),this.type===te.colon)Mt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Mt,"TSIndexSignature")}$2a(){let Mt=this.startNode();this.expect(te.bracketL),Mt.elementTypes=[];while(!this.eat(te.bracketR))if(Mt.elementTypes.push(this.$2c()),this.type!==te.bracketR)this.expect(te.comma);return this.finishNode(Mt,"TSTupleType")}$2c(){let Mt=this.start,Gt=this.startLoc,Ut=this.eat(te.ellipsis),Ht;if((this.type===te.name||this.type.keyword)&&this.$2d()){let qt=this.startNode();qt.label=this.parseIdent(!0),qt.optional=this.eat(te.question),this.expect(te.colon),qt.elementType=this.$0(),Ht=this.finishNode(qt,"TSNamedTupleMember")}else if(Ht=this.$0(),this.eat(te.question)){let qt=this.startNodeAt(Ht.start,Ht.loc?.start);qt.typeAnnotation=Ht,Ht=this.finishNode(qt,"TSOptionalType")}if(Ut){let qt=this.startNodeAt(Mt,Gt);qt.typeAnnotation=Ht,Ht=this.finishNode(qt,"TSRestType")}return Ht}$2d(){let Mt=this.$d();if(this.input.charCodeAt(Mt)===63)Mt=this.$d(Mt+1);return this.input.charCodeAt(Mt)===aa}$8(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c()){let Gt=this.startNode();while((this.type===te._const||this.type===te._in||this.isContextual("out"))&&jt(this.$2()))Gt[this.value]=!0,this.next();if(Gt.name=this.$y(),this.eat(te._extends))Gt.constraint=this.$0();if(this.eat(te.eq))Gt.default=this.$0();if(Mt.params.push(this.finishNode(Gt,"TSTypeParameter")),!this.$c()){if(this.expect(te.comma),this.$c())Mt.extra={trailingComma:this.lastTokStart}}}if(this.next(),Mt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Mt,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c())if(Mt.params.push(this.$0()),!this.$c())this.expect(te.comma);if(Mt.params.length===0)this.unexpected();return this.next(),this.finishNode(Mt,"TSTypeParameterInstantiation")})}$1j(){let Mt=[];do{let Gt=this.startNode();if(Gt.expression=this.$j(),this.$1())Gt.typeParameters=this.$e();Mt.push(this.finishNode(Gt,"TSExpressionWithTypeArguments"))}while(this.eat(te.comma));return Mt}$1k(Mt=!1){if(this.type!==te.name||this.containsEsc){if(this.type===te._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Mt);return this.$1l(this.startNode(),this.value)}$2e(Mt){switch(Mt){case"interface":case"type":case"namespace":return this.$14();case"enum":return jt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Gt=this.$2();return this.$b()&&(Gt===or||Gt===ar||jt(Gt))}case"declare":return this.$b()&&$l.has(this.$3());case"global":return this.$b()&&this.$2()===cs}return!1}$1l(Mt,Gt){switch(Gt){case"interface":return this.$1m(Mt);case"type":return this.$2g(Mt);case"enum":return this.$10(Mt);case"abstract":return this.$1n(Mt,!0);case"global":return Mt.global=!0,Mt.id=this.parseIdent(),Mt.body=this.$11(),this.finishNode(Mt,"TSModuleDeclaration")}return this.$2h(Mt)}$2f(Mt){let Gt=this.$5;this.$5=!0;let Ut=this.startNode();this.next();let Ht=this.value;if(Ht==="const"&&this.$3()==="enum")Ut.const=!0;if(!Mt&&Nl.has(Ht))Ut.declare=!0;let qt;if(Ut.const)qt=this.$10(Ut);else if(Ht==="var"||Ht==="let"||Ht==="const")qt=this.parseVarStatement(Ut,Ht,!0);else if(Ht==="function")this.next(),qt=this.parseFunction(Ut,sa,!1,!1);else if(Ht==="class")qt=this.parseClass(Ut,!0);else qt=this.$1l(Ut,Ht);return qt.declare=!0,this.$5=Gt,qt}$1n(Mt,Gt){return this.next(),Mt.abstract=!0,this.parseClass(Mt,Gt)}$1m(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,ia),this.$1())Mt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(te._extends))Mt.extends=this.$1j();let Gt=this.startNode();Gt.body=this.$1f(),Mt.body=this.finishNode(Gt,"TSInterfaceBody")}),this.finishNode(Mt,"TSInterfaceDeclaration")}$2g(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,sr),this.$1())Mt.typeParameters=this.$8();return Mt.typeAnnotation=this.$a(()=>(this.expect(te.eq),this.$0())),this.semicolon(),this.finishNode(Mt,"TSTypeAliasDeclaration")}$10(Mt){if(this.type===te._const)Mt.const=!0,this.next();this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Bl),this.expect(te.braceL),Mt.members=[];while(!this.eat(te.braceR)){let Gt=this.startNode();if(Gt.id=this.type===te.string?this.parseExprAtom():this.parseIdent(!0),this.eat(te.eq))Gt.initializer=this.parseMaybeAssign();if(Mt.members.push(this.finishNode(Gt,"TSEnumMember")),this.type!==te.braceR)this.expect(te.comma)}return this.finishNode(Mt,"TSEnumDeclaration")}$2h(Mt){if(this.next(),this.type===te.string){if(Mt.id=this.parseExprAtom(),this.type===te.braceL)Mt.body=this.$11();else this.semicolon();return this.finishNode(Mt,"TSModuleDeclaration")}return Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Fl),this.$1o(Mt)}$1o(Mt){if(this.eat(te.dot)){let Gt=this.startNode();Gt.id=this.parseIdent(),Mt.body=this.$1o(Gt)}else Mt.body=this.$11();return this.finishNode(Mt,"TSModuleDeclaration")}$11(){this.enterScope(Rl);let Mt=this.startNode();this.enterScope(0),this.expect(te.braceL),Mt.body=[];while(!this.eat(te.braceR))Mt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Mt,"TSModuleBlock")}$1p(Mt,Gt){if(Mt.isExport=Gt,Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Pi),this.expect(te.eq),this.isContextual("require")&&this.$2()===ra){let Ut=this.startNode();this.next(),Ut.expression=this.$1e(),Mt.moduleReference=this.finishNode(Ut,"TSExternalModuleReference")}else Mt.moduleReference=this.$j();return this.semicolon(),this.finishNode(Mt,"TSImportEqualsDeclaration")}$2i(){let Mt=this.$d();if(this.input.charCodeAt(Mt)!==ps)return!1;let Gt=this.input.charCodeAt(Mt+1);return Gt!==ps&&Gt!==62}parseStatement(Mt,Gt,Ut){if(this.type===Vt)this.$1q(!0);let Ht=this.$1k();if(Ht)return Ht;return super.parseStatement(Mt,Gt,Ut)}parseVarStatement(Mt,Gt,Ut){return super.parseVarStatement(Mt,Gt,Ut||this.$5)}parseVarId(Mt,Gt){if(super.parseVarId(Mt,Gt),Mt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Mt.definite=!0;this.$h(Mt.id,!1)}parseCatchClauseParam(){let Mt=this.$h(this.parseBindingAtom(),!1),Gt=Mt.type==="Identifier";return this.enterScope(Gt?Dl:0),this.checkLValPattern(Mt,Gt?Ml:Pi),this.expect(te.parenR),Mt}parseImport(Mt){if(this.next(),Mt.importKind="value",this.type===te.string)Mt.specifiers=[],Mt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Gt=this.$2();if(Gt===cs||Gt===rr||jt(Gt)&&this.$3()!=="from")Mt.importKind="type",this.next()}if(this.type===te.name&&this.$2i())return this.$1p(Mt,!1);Mt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Mt.source=this.$z()}return this.$1r(Mt),this.semicolon(),this.finishNode(Mt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=te._with;return this.type===te._with?super.parseWithClause():void 0}$1r(Mt){let Gt=this.parseWithClause();if(Gt)Mt.attributes=Gt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Mt){return this.$1s("exportKind",()=>super.parseExportSpecifier(Mt))}$1s(Mt,Gt){let Ut=this.isContextual("type")?this.$2():-1;if(Ut===or||Ut===ar||jt(Ut)&&this.$3()!=="as"){let qt=this.startNode();this.next();let zt=Gt();return this.$q(zt,qt),zt[Mt]="type",zt}let Ht=Gt();return Ht[Mt]="value",Ht}parseExport(Mt,Gt){if(this.next(),this.eat(te._import)){if(Mt.importKind="value",this.isContextual("type")&&jt(this.$2())&&this.$3()!=="from")Mt.importKind="type",this.next();return this.$1p(Mt,!0)}if(this.eat(te.eq))return Mt.expression=this.parseExpression(),this.semicolon(),this.finishNode(Mt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Mt.id=this.parseIdent(),this.semicolon(),this.finishNode(Mt,"TSNamespaceExportDeclaration");if(Mt.exportKind="value",this.isContextual("type")){let qt=this.$2();if(qt===cs||qt===rr)Mt.exportKind="type",this.next()}if(this.eat(te.star))return this.parseExportAllDeclaration(Mt,Gt);if(this.eat(te._default)){if(this.isContextual("interface")&&this.$14())Mt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Mt.declaration=this.$1n(this.startNode(),"nullableID");else Mt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Mt,"ExportDefaultDeclaration")}let Ut=this.isContextual("declare"),Ht=this.$1k(!0);if(Ht||this.shouldParseExportStatement()){if(Mt.declaration=Ht??this.parseStatement(null),Ut||Mt.declaration.type==="TSInterfaceDeclaration"||Mt.declaration.type==="TSTypeAliasDeclaration")Mt.exportKind="type";return Mt.specifiers=[],Mt.source=null,this.finishNode(Mt,"ExportNamedDeclaration")}if(Mt.declaration=null,Mt.specifiers=this.parseExportSpecifiers(Gt),this.eatContextual("from"))Mt.source=this.$z(),this.$1r(Mt);else{for(let qt of Mt.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`.");Mt.source=null}return this.semicolon(),this.finishNode(Mt,"ExportNamedDeclaration")}parseFunction(Mt,Gt,Ut,Ht,qt){let zt=Gt&sa;if(zt)this.$f=Mt,this.$o=Mt.start;super.parseFunction(Mt,Gt,Ut,Ht,qt),this.$f=null;let Xt=!Mt.body;if(Xt)Mt.type="TSDeclareFunction";if(zt&&Mt.id){if(Xt){if(this.$5&&this.currentScope().flags&na)this.declareName(Mt.id.name,pr,Mt.id.start);this.checkLValSimple(Mt.id,Il)}else if(!(Gt&jl)){let Jt=Ll;if(this.strict||Mt.generator||Mt.async)Jt=this.treatFunctionsAsVar?Ol:Pi;this.checkLValSimple(Mt.id,Jt)}}return Mt}parseFunctionParams(Mt){if(this.$1())Mt.typeParameters=this.$8();if(super.parseFunctionParams(Mt),this.type===te.colon)Mt.returnType=this.$6(!0)}parseFunctionBody(Mt,Gt,Ut,Ht){if(Ut&&this.type===te.colon)Mt.returnType=this.$6(!0);if(Gt||this.type===te.braceL||Mt.start!==this.$o){super.parseFunctionBody(Mt,Gt,Ut,Ht);return}this.semicolon(),this.exitScope()}parseMethod(Mt,Gt,Ut){let Ht=this.$k;this.$k=null;let qt=super.parseMethod(Mt,Gt,Ut);if(!qt.body)qt.type="TSDeclareMethod";if(Ht)qt.typeParameters=Ht;return qt}parseBindingList(Mt,Gt,Ut,Ht){let qt=Ht===!0||this.$l;return this.$l=!1,super.parseBindingList(Mt,Gt,Ut,qt)}$s(Mt){if(!Mt&&!this.$b())return!1;let Gt=this.$2();return Gt===Wl||Gt===cs||Gt===rr||Gt===oa||Gt===Ul||Gt===or||Gt===ar||Gt>=48&&Gt<=57||jt(Gt)}parseAssignableListItem(Mt){let Gt=this.$12(),Ut=this.start,Ht=this.startLoc,qt,zt=!1,Xt=!1;if(Mt)while(this.type===te.name&&_l.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")zt=!0;else if(this.value==="override")Xt=!0;else qt=this.value;this.next()}let Jt;if(this.type===te._this)Jt=this.startNode(),Jt.name="this",this.next(),this.finishNode(Jt,"Identifier");else Jt=this.parseBindingAtom();let Qt=this.type===te.eq?this.parseMaybeDefault(Ut,Ht,Jt):this.parseMaybeDefault(Jt.start,Jt.loc?.start,this.$h(Jt,!0));if(Gt.length>0)Qt.decorators=Gt;if(!qt&&!zt&&!Xt)return Qt;let Yt=this.startNodeAt(Ut,Ht);if(qt)Yt.accessibility=qt;if(zt)Yt.readonly=!0;if(Xt)Yt.override=!0;return Yt.parameter=Qt,this.finishNode(Yt,"TSParameterProperty")}parseBindingListItem(Mt){if(Mt.type==="RestElement")this.$h(Mt,!0);return Mt}checkLValSimple(Mt,Gt,Ut){if(this.$f&&Mt===this.$f.id){this.$f=null;return}if(!Gt&&ta.has(Mt.type)){this.checkLValSimple(Mt.expression,Gt,Ut);return}switch(Mt.type){case"TSParameterProperty":this.checkLValInnerPattern(Mt.parameter,Gt,Ut);return;case"Identifier":if(Mt.name==="this")return}super.checkLValSimple(Mt,Gt,Ut)}toAssignable(Mt,Gt,Ut){if(Mt&&!Gt&&ta.has(Mt.type))return Mt;return super.toAssignable(Mt,Gt,Ut)}declareName(Mt,Gt,Ut){let Ht=this.currentScope();if(Gt&pr){this.$1t(Ht,Mt),Ht.$1u??=[],Ht.$1u.push(Mt);return}if(Gt===sr||Gt===ia){if(Ht.$13??=[],Gt===sr&&Sn(Ht.$13,Mt))this.raise(Ut,`type '${Mt}' has already been declared.`);Ht.$13.push(Mt),this.$1t(Ht,Mt);return}if(Gt&ca){if(Ht.$1v??=[],Sn(Ht.$1v,Mt))return;super.declareName(Mt,Pi,Ut),Ht.$1v.push(Mt);return}super.declareName(Mt,Gt,Ut)}$1t(Mt,Gt){if(this.inModule&&Mt.flags&na)delete this.undefinedExports[Gt]}checkLocalExport(Mt){for(let Gt=this.scopeStack.length-1;Gt>=0;Gt--){let Ut=this.scopeStack[Gt];if(Sn(Ut.$13,Mt.name)||Sn(Ut.$1u,Mt.name))return}super.checkLocalExport(Mt)}checkExport(){}raiseRecoverable(Mt,Gt){if(Gt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Mt,Gt)}$12(){let Mt=[];while(this.type===Vt)Mt.push(this.$1w());return Mt}$1q(Mt){let Gt=this.$9[this.$9.length-1];while(this.type===Vt)Gt.push(this.$1w());if(this.type===te._export){if(!Mt)this.unexpected()}else if(this.type!==te._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 Mt=this.startNode();this.next(),this.$9.push([]);let Gt=this.start,Ut=this.startLoc,Ht;if(this.type===te.parenL){if(this.next(),Ht=this.parseExpression(),this.expect(te.parenR),this.options.preserveParens){let zt=this.startNodeAt(Gt,Ut);zt.expression=Ht,Ht=this.finishNode(zt,"ParenthesizedExpression")}}else{Ht=this.parseIdent(!1);while(this.eat(te.dot)){let zt=this.startNodeAt(Gt,Ut);zt.object=Ht,zt.property=this.parseIdent(!0),zt.computed=!1,Ht=this.finishNode(zt,"MemberExpression")}}let qt=this.$p()?this.$e():void 0;if(this.eat(te.parenL)){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);if(zt.callee=Ht,zt.arguments=this.parseExprList(te.parenR,!1,!1),qt)zt.typeArguments=qt;Ht=this.finishNode(zt,"CallExpression")}else if(qt){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);zt.expression=Ht,zt.typeArguments=qt,Ht=this.finishNode(zt,"TSInstantiationExpression")}return Mt.expression=Ht,this.$9.pop(),this.finishNode(Mt,"Decorator")}shouldParseExportStatement(){return this.type===Vt||super.shouldParseExportStatement()}parseExprAtom(Mt,Gt,Ut){if(this.type===Vt)this.$1q(!1);return super.parseExprAtom(Mt,Gt,Ut)}parseProperty(Mt,Gt){if(Mt||this.type!==Vt)return super.parseProperty(Mt,Gt);let Ut=this.$12(),Ht=super.parseProperty(Mt,Gt);if(Ht.type==="SpreadElement")this.raise(Ht.start,"Decorators can't be used with SpreadElement");return Ht.decorators=Ut,Ht}parseClassId(Mt,Gt){let Ut=this.$9.length-1,Ht=this.$9[Ut];if(Ht.length>0)Mt.decorators=Ht,this.$q(Mt,Ht[0]),this.$9[Ut]=[];if(!this.isContextual("implements")||Gt===!0)super.parseClassId(Mt,Gt);if(this.$1())Mt.typeParameters=this.$8()}parseClassSuper(Mt){if(super.parseClassSuper(Mt),Mt.superClass&&this.$1())Mt.superTypeParameters=this.$e();if(this.eatContextual("implements"))Mt.implements=this.$a(()=>this.$1j())}parseClassElement(Mt){if(this.type===Vt){let Xt=this.$12();if(this.type===te.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Jt=this.parseClassElement(Mt);return Jt.decorators=Xt,this.$q(Jt,Xt[0]),Jt}if(this.eat(te.semi))return null;let Gt=this.startNode();while(this.type===te.name&&Pl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let Xt=this.value;if(this.next(),Xt==="static"&&this.type===te.braceL)return this.next(),this.parseClassStaticBlock(Gt),Gt;if(Xt==="public"||Xt==="private"||Xt==="protected")Gt.accessibility=Xt;else Gt[Xt]=!0}if(this.type===te.bracketL&&this.$1g())return this.$1h(Gt);Gt.static??=!1;let Ut="",Ht=!1,qt=!1,zt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===te.star)&&!this.canInsertSemicolon())qt=!0;else Ut="async";if(!Ut&&this.eat(te.star))Ht=!0;if(!Ut&&!qt&&!Ht){let Xt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())zt=Xt;else Ut=Xt}if(Ut)Gt.computed=!1,Gt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Gt.key.name=Ut,this.finishNode(Gt.key,"Identifier");else this.parseClassElementName(Gt);if(this.eat(te.question))Gt.optional=!0;if(this.type===te.parenL||this.$1()||zt!=="method"||Ht||qt){let Xt=Gt.key,Jt=!Gt.static&&!Gt.computed&&(Xt.type==="Identifier"&&Xt.name==="constructor"||Xt.type==="Literal"&&Xt.value==="constructor");if(Gt.kind=Jt?"constructor":zt,this.$1())Gt.typeParameters=this.$8();this.$l=Jt,this.$o=this.start,this.parseClassMethod(Gt,Ht,qt,Jt&&Mt)}else{if(!Gt.optional&&this.$u())this.next(),Gt.definite=!0;if(this.type===te.colon)Gt.typeAnnotation=this.$6();this.parseClassField(Gt)}return Gt}parseMaybeAssign(Mt,Gt,Ut){if(this.$p()){let Ht=this.$g(()=>{let qt=this.$8(),zt=super.parseMaybeAssign(Mt,Gt,Ut);if(zt.type!=="ArrowFunctionExpression")return;return zt.typeParameters=qt,this.$q(zt,qt),zt});if(Ht)return Ht}return super.parseMaybeAssign(Mt,Gt,Ut)}parseMaybeUnary(Mt,Gt,Ut,Ht){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,Ht),this.finishNode(qt,"TSTypeAssertion")}return super.parseMaybeUnary(Mt,Gt,Ut,Ht)}parseMaybeConditional(Mt,Gt){let Ut=this.start,Ht=this.startLoc,qt=this.parseExprOps(Mt,Gt);if(this.checkExpressionErrors(Gt))return qt;if(this.type===te.question&&!(qt.type==="ArrowFunctionExpression"&&qt.start===Ut)&&!this.$2j()){this.next();let zt=this.startNodeAt(Ut,Ht);return zt.test=qt,zt.consequent=this.parseMaybeAssign(),this.expect(te.colon),zt.alternate=this.parseMaybeAssign(Mt),this.finishNode(zt,"ConditionalExpression")}return qt}$2j(){let Mt=this.$d(),Gt=this.input.charCodeAt(Mt);if(Gt===aa||Gt===Gl||Gt===Vl)return!0;return Gt===ps&&this.input.charCodeAt(Mt+1)!==ps}parseParenItem(Mt){return this.$h(Mt,!0)}$1x(){if(this.type!==te.colon)return!0;let Mt=this.$g(()=>{let Gt=this.$6(!0);return this.type===te.arrow&&!this.canInsertSemicolon()?Gt:void 0});if(!Mt)return!1;return this.$7=Mt,!0}shouldParseArrow(Mt){return this.$1x()&&super.shouldParseArrow(Mt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Mt,Gt,Ut,Ht){if(this.$7)Mt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Mt,Gt,Ut,Ht)}parseExprList(Mt,Gt,Ut,Ht){if(!this.$m)return super.parseExprList(Mt,Gt,Ut,Ht);this.$m=!1;let qt=[],zt=!0;while(!this.eat(Mt)){if(zt)zt=!1;else if(this.expect(te.comma),Gt&&this.afterTrailingComma(Mt))break;if(this.type===te.ellipsis){let Xt=this.parseSpread(Ht);if(this.eat(te.question))Xt.optional=!0;if(this.type===te.colon)Xt.typeAnnotation=this.$6();qt.push(Xt)}else qt.push(this.parseMaybeAssign(!1,Ht,this.parseParenItem))}return qt}parseSubscript(Mt,Gt,Ut,Ht,qt,zt,Xt){if(this.$u()&&!this.hasPrecedingLineBreak()){let Qt=this.startNodeAt(Gt,Ut);return this.exprAllowed=!1,this.next(),Qt.expression=Mt,this.finishNode(Qt,"TSNonNullExpression")}if(qt&&this.$1()){let Qt=this.$g(()=>this.$2k(Gt,Ut,Xt));if(Qt)return Qt}let Jt=this.type===te.questionDot&&this.$2()===pa;if(this.$1()||Jt||this.type===te.bitShift&&this.value==="<<"){let Qt=this.$g(()=>{if(Jt)this.next();this.$p();let Yt=this.$e();if(this.type===te.parenL&&!Ht)return Yt;if(this.type===te.backQuote)return Jt?void 0:Yt;if(Jt)return;if(this.$c()||this.type===te.bitShift||this.type.startsExpr&&this.type!==te.parenL&&!this.hasPrecedingLineBreak())return;return Yt});if(Qt){let Yt=this.startNodeAt(Gt,Ut);if(this.type===te.parenL&&!Ht){if(this.next(),Yt.callee=Mt,Yt.arguments=this.parseExprList(te.parenR,!0,!1),Yt.typeArguments=Qt,Jt)Mt.optional=!0;if(Jt||zt)Yt.optional=Jt;return this.finishNode(Yt,"CallExpression")}if(this.type===te.backQuote)return Yt.tag=Mt,Yt.quasi=this.parseTemplate({isTagged:!0}),Yt.typeArguments=Qt,this.finishNode(Yt,"TaggedTemplateExpression");return Yt.expression=Mt,Yt.typeArguments=Qt,this.finishNode(Yt,"TSInstantiationExpression")}}if(qt&&this.type===te.parenL)this.$m=!0;return super.parseSubscript(Mt,Gt,Ut,Ht,qt,zt,Xt)}$2k(Mt,Gt,Ut){let Ht=this.startNodeAt(Mt,Gt);if(Ht.typeParameters=this.$8(),this.expect(te.parenL),Ht.params=this.parseBindingList(te.parenR,!1,!0),this.type===te.colon)Ht.returnType=this.$6(!0);if(this.type!==te.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Ht,Ht.params,!0,Ut)}parseDynamicImport(Mt){if(this.next(),Mt.source=this.parseMaybeAssign(),this.eat(te.comma)&&this.type!==te.parenR)Mt.arguments=[this.parseExpression()];return this.expect(te.parenR),this.finishNode(Mt,"ImportExpression")}parseNew(){let Mt=super.parseNew();if(Mt.callee?.type!=="TSInstantiationExpression")return Mt;let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);return Gt.callee=Mt.callee.expression,Gt.typeArguments=Mt.callee.typeArguments,Gt.arguments=Mt.arguments,this.finishNodeAt(Gt,"NewExpression",Mt.end,Mt.loc?.end)}parseExprOp(Mt,Gt,Ut,Ht,qt){if(te._in.binop>Ht&&this.type===te.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let zt=this.value==="satisfies",Xt=this.startNodeAt(Gt,Ut);return Xt.expression=Mt,Xt.typeAnnotation=this.$a(()=>{if(this.next(),!zt&&this.type===te._const){let Jt=this.startNode();return Jt.typeName=this.parseIdent(!0),this.finishNode(Jt,"TSTypeReference")}return this.$0()}),this.finishNode(Xt,zt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(Xt,Gt,Ut,Ht,qt)}return super.parseExprOp(Mt,Gt,Ut,Ht,qt)}parseGetterSetter(Mt){Mt.kind=Mt.key.name,super.parseGetterSetter(Mt)}parsePropertyValue(Mt,Gt,Ut,Ht,qt,zt,Xt,Jt){if(!Gt&&this.$1()){if(this.$k=this.$8(),this.type!==te.parenL)this.unexpected();Mt.kind="init"}return super.parsePropertyValue(Mt,Gt,Ut,Ht,qt,zt,Xt,Jt)}}return Wt});function ue(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var Kl=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(ee,te,Oe){super(`${Oe}
|
|
17
|
-
https://svelte.dev/e/${te}`);this.code=te,this.reason=Oe;let Ot=typeof ee==="number"?ee:ee?.start,jt=typeof ee==="number"?ee:ee?.end;if(Ot!==void 0)this.position=[Ot,jt??Ot],this.start=x(this.position[0]),this.end=x(this.position[1]),this.frame=
|
|
18
|
-
${" ".repeat(jt+2+
|
|
19
|
-
`)}function je(ee){throw new e(ee,"attribute_duplicate","Attributes need to be unique")}function Ve(ee){throw new e(ee,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function qe(ee,te){throw new e(ee,"block_duplicate_clause",`${te} cannot appear more than once within a block`)}function Ge(ee){throw new e(ee,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function We(ee){throw new e(ee,"block_invalid_elseif","'elseif' should be 'else if'")}function He(ee,te,Oe){throw new e(ee,"block_invalid_placement",`{#${te} ...} block cannot be ${Oe}`)}function Ue(ee){throw new e(ee,"block_unclosed","Block was left open")}function ze(ee){throw new e(ee,"block_unexpected_close","Unexpected block closing tag")}function Je(ee){throw new e(ee,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Ke(ee){throw new e(ee,"css_empty_declaration","Declaration cannot be empty")}function ke(ee){throw new e(ee,"css_expected_identifier","Expected a valid CSS identifier")}function Xe(ee){throw new e(ee,"css_selector_invalid","Invalid selector")}function Ye(ee){throw new e(ee,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function we(ee){throw new e(ee,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function Qe(ee){throw new e(ee,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function Ze(ee,te){throw new e(ee,"directive_missing_name",`\`${te}\` name cannot be empty`)}function et(ee,te){throw new e(ee,"element_invalid_closing_tag",`\`</${te}>\` attempted to close an element that was not open`)}function tt(ee,te,Oe){throw new e(ee,"element_invalid_closing_tag_autoclosed",`\`</${te}>\` attempted to close element that was already automatically closed by \`<${Oe}>\` (cannot nest \`<${Oe}>\` inside \`<${te}>\`)`)}function Pe(ee,te){throw new e(ee,"element_unclosed",`\`<${te}>\` was left open`)}function Ae(ee){throw new e(ee,"expected_attribute_value","Expected attribute value")}function nt(ee){throw new e(ee,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function De(ee){throw new e(ee,"expected_identifier","Expected an identifier")}function rt(ee){throw new e(ee,"expected_pattern","Expected identifier or destructure pattern")}function it(ee){throw new e(ee,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function A(ee,te){throw new e(ee,"expected_token",`Expected token ${te}`)}function st(ee){throw new e(ee,"expected_whitespace","Expected whitespace")}function
|
|
20
|
-
`)){let Gt=
|
|
21
|
-
`,Oe-1)+1,Ut=Gt,Ht=
|
|
16
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ns(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(ee){var Oe=this.pos-1;this.invalidStringToken(Oe,"Invalid escape sequence in template string")}default:if(te>=48&&te<=55){var Ot=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],jt=parseInt(Ot,8);if(jt>255)Ot=Ot.slice(0,-1),jt=parseInt(Ot,8);if(this.pos+=Ot.length-1,te=this.input.charCodeAt(this.pos),(Ot!=="0"||te===56||te===57)&&(this.strict||ee))this.invalidStringToken(this.pos-1-Ot.length,ee?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(jt)}if(hi(te)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(te)}};rn.readHexChar=function(ee){var te=this.pos,Oe=this.readInt(16,ee);if(Oe===null)this.invalidStringToken(te,"Bad character escape sequence");return Oe};rn.readWord1=function(){this.containsEsc=!1;var ee="",te=!0,Oe=this.pos,Ot=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var jt=this.fullCharCodeAtPos();if(S(jt,Ot))this.pos+=jt<=65535?1:2;else if(jt===92){this.containsEsc=!0,ee+=this.input.slice(Oe,this.pos);var Vt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Wt=this.readCodePoint();if(!(te?g:S)(Wt,Ot))this.invalidStringToken(Vt,"Invalid Unicode escape");ee+=ns(Wt),Oe=this.pos}else break;te=!1}return ee+this.input.slice(Oe,this.pos)};rn.readWord=function(){var ee=this.readWord1(),te=Kt.name;if(this.keywords.test(ee))te=Qs[ee];return this.finishToken(te,ee)};var Al="8.18.0";s.acorn={Parser:s,version:Al,defaultOptions:Xs,Position:Ci,SourceLocation:is,getLineInfo:Uo,Node:as,TokenType:pn,tokTypes:Kt,keywordTypes:Qs,TokContext:Pn,tokContexts:ln,isIdentifierChar:S,isIdentifierStart:g,Token:sr,isNewLine:hi,lineBreak:En,lineBreakG:dl,nonASCIIwhitespace:Wo};function Ai(ee){return(te)=>ee(te)}function ps(...ee){return s.extend(...ee)}function Pi(ee,te,Oe){for(let Ot=te;Ot<Oe;Ot++){let jt=ee.charCodeAt(Ot);if(jt===10||jt===13||jt===8232||jt===8233)return!0}return!1}var jo=new WeakMap;function Sn(ee,te){if(ee===void 0)return!1;if(ee.length<16)return ee.includes(te);let Oe=jo.get(ee);if(Oe===void 0||Oe.length>ee.length)Oe={names:new Set,length:0},jo.set(ee,Oe);while(Oe.length<ee.length)Oe.names.add(ee[Oe.length++]);return Oe.names.has(te)}var rr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,Pl=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"]]),_l=new Set("public private protected readonly declare abstract override static accessor".split(" ")),$l=new Set("public private protected readonly override".split(" ")),Nl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),Dl=new Set("var let const function class interface enum".split(" ")),sa=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),ra=1,Rl=32,Il=256,Ol=0,Ll=1,_i=2,Ml=3,Fl=4,or=6,oa=7,ha=256,lr=1024,Bl=8|lr,jl=_i|ha,aa=1,Vl=2,pa=40,Gl=41,Wl=44,ca=46,la=58,cs=61,ua=60,ls=123,Ul=91,ar=42,Hl=35,pr=34,cr=39,Kl=SyntaxError("speculative parse failed"),ce=Ai((ee)=>{let{tokTypes:te,keywordTypes:Oe,isIdentifierChar:Ot,isIdentifierStart:jt}=ee.acorn,Vt=new ee.acorn.TokenType("@");class Wt extends ee{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Mt,Gt,Ut){super(Mt,Gt,Ut);let Ht=this.options.onComment;if(typeof Ht==="function")this.options.onComment=(qt,zt,Xt,Jt,Qt,Yt)=>{if(Xt<this.$t)return;this.$t=Jt,Ht.call(this,qt,zt,Xt,Jt,Qt,Yt)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Mt){if(Mt===64)return++this.pos,this.finishToken(Vt);return super.getTokenFromCode(Mt)}readToken_lt_gt(Mt){if(this.inType)return this.finishOp(te.relational,1);return super.readToken_lt_gt(Mt)}$a(Mt){let Gt=this.inType;this.inType=!0;let Ut=Mt();if(this.inType=Gt,!Gt&&this.type===te.relational)this.pos=this.start,this.nextToken();return Ut}$1(){return this.type===te.relational&&this.value==="<"}$p(){if(this.type===te.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(te.relational,"<");return this.$1()}$c(){return this.type===te.relational&&this.value===">"}$u(){return this.type===te.prefix&&this.value==="!"}hasPrecedingLineBreak(){return Pi(this.input,this.lastTokEnd,this.start)}$d(Mt=this.pos){return rr.lastIndex=Mt,rr.exec(this.input),rr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Mt=this.$d(),Gt=Mt;while(Gt<this.input.length&&Ot(this.input.charCodeAt(Gt)))Gt++;return this.input.slice(Mt,Gt)}$b(){return!Pi(this.input,this.pos,this.$d())}$14(){return this.$b()&&jt(this.$2())&&!Object.hasOwn(Oe,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(Mt){this.pos=Mt.pos,this.type=Mt.type,this.value=Mt.value,this.start=Mt.start,this.end=Mt.end,this.startLoc=Mt.startLoc,this.endLoc=Mt.endLoc,this.lastTokStart=Mt.lastTokStart,this.lastTokEnd=Mt.lastTokEnd,this.lastTokStartLoc=Mt.lastTokStartLoc,this.lastTokEndLoc=Mt.lastTokEndLoc,this.curLine=Mt.curLine,this.lineStart=Mt.lineStart,this.context=Mt.context,this.exprAllowed=Mt.exprAllowed,this.containsEsc=Mt.containsEsc,this.inType=Mt.inType,this.$4=Mt.$4,this.$5=Mt.$5,this.$7=Mt.$7,this.scopeStack.length=Mt.scopes,this.privateNameStack.length=Mt.privateNames,this.labels=Mt.labels,this.labels.length=Mt.labelCount,this.strict=Mt.strict,this.yieldPos=Mt.yieldPos,this.awaitPos=Mt.awaitPos,this.awaitIdentPos=Mt.awaitIdentPos,this.potentialArrowAt=Mt.potentialArrowAt,this.potentialArrowInForAwait=Mt.potentialArrowInForAwait}raise(Mt,Gt){if(this.$n>0)throw Kl;return super.raise(Mt,Gt)}$1y(Mt,Gt){try{super.raise(Mt,Gt)}catch(Ut){if(Ut instanceof SyntaxError)Ut.$1z=!0;throw Ut}throw Error("unreachable")}$g(Mt,Gt=!1){let Ut=this.$15();this.$n++;try{let Ht=Mt();if(Gt||Ht===void 0)this.$16(Ut);return Ht}catch(Ht){if(!(Ht instanceof SyntaxError)||!Gt&&Ht.$1z)throw Ht;this.$16(Ut);return}finally{this.$n--}}$v(Mt){return this.$g(Mt,!0)===!0}$17(Mt){if(Mt.end=this.lastTokEnd,this.options.locations)Mt.loc.end=this.lastTokEndLoc}$q(Mt,Gt){if(Mt.start=Gt.start,this.options.locations)Mt.loc.start=Gt.loc.start}$6(Mt=!1){let Gt=this.startNode();return Gt.typeAnnotation=this.$a(()=>(this.next(),Mt?this.$20():this.$0())),this.finishNode(Gt,"TSTypeAnnotation")}$h(Mt,Gt){if(Gt&&this.eat(te.question))Mt.optional=!0,this.$17(Mt);if(this.type===te.colon)Mt.typeAnnotation=this.$6(),this.$17(Mt);return Mt}$20(){if(this.type!==te.name&&this.type!==te._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&jt(this.$2())){let Mt=this.startNode();if(this.next(),Mt.parameterName=this.type===te._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Mt,!0);return Mt.asserts=!0,Mt.typeAnnotation=null,this.finishNode(Mt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Mt=this.startNode();return Mt.parameterName=this.type===te._this?this.$w():this.parseIdent(!0),this.$x(Mt,!1)}return this.$0()}$x(Mt,Gt){this.next();let Ut=this.startNode();return Ut.typeAnnotation=this.$0(),Mt.typeAnnotation=this.finishNode(Ut,"TSTypeAnnotation"),Mt.asserts=Gt,this.finishNode(Mt,"TSTypePredicate")}$w(){let Mt=this.startNode();return this.next(),this.finishNode(Mt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Mt=this.$0();if(this.type!==te.eof)this.unexpected();return Mt}$0(){let Mt=this.$18();if(this.$4||this.type!==te._extends||this.hasPrecedingLineBreak())return Mt;let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);return this.next(),Gt.checkType=Mt,Gt.extendsType=this.$i(!0,()=>this.$18()),this.expect(te.question),Gt.trueType=this.$i(!1,()=>this.$0()),this.expect(te.colon),Gt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Gt,"TSConditionalType")}$i(Mt,Gt){let Ut=this.$4;this.$4=Mt;let Ht=Gt();return this.$4=Ut,Ht}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===te._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",te.bitwiseOR,()=>this.$1a("TSIntersectionType",te.bitwiseAND,()=>this.$1b()))}$19(Mt){let Gt=this.startNode();if(Mt==="TSConstructorType"){if(Gt.abstract=this.isContextual("abstract"),Gt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Gt,te.arrow)),this.finishNode(Gt,Mt)}$r(Mt,Gt){if(this.$1())Mt.typeParameters=this.$8();if(this.expect(te.parenL),Mt.parameters=this.parseBindingList(te.parenR,!1,!0),this.type===Gt)Mt.typeAnnotation=this.$6(!0);else if(Gt===te.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==te.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===te.parenR||this.type===te.ellipsis)return!0;if(this.type===te.name||this.type===te._this)this.next();else if(this.type===te.braceL||this.type===te.bracketL)this.parseBindingAtom();else return!1;let Mt=this.type;if(Mt===te.colon||Mt===te.comma||Mt===te.question||Mt===te.eq)return!0;if(Mt!==te.parenR)return!1;return this.next(),this.type===te.arrow})}$1a(Mt,Gt,Ut){let Ht=this.startNode(),qt=this.eat(Gt),zt=[];do zt.push(Ut());while(this.eat(Gt));if(zt.length===1&&!qt)return zt[0];return Ht.types=zt,this.finishNode(Ht,Mt)}$1b(){if(this.type===te.name&&!this.containsEsc){let Mt=this.value;if(Mt==="keyof"||Mt==="unique"||Mt==="readonly"){let Gt=this.startNode();return this.next(),Gt.operator=Mt,Gt.typeAnnotation=this.$1b(),this.finishNode(Gt,"TSTypeOperator")}if(Mt==="infer"){let Gt=this.startNode();this.next();let Ut=this.startNode();Ut.name=this.$y();let Ht=this.$g(()=>this.$22());if(Ht)Ut.constraint=Ht;return Gt.typeParameter=this.finishNode(Ut,"TSTypeParameter"),this.finishNode(Gt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(te._extends))return;let Mt=this.$i(!0,()=>this.$0());return this.$4||this.type!==te.question?Mt:void 0}$y(){if(this.type!==te.name&&!this.type.keyword)this.unexpected();let Mt=this.type===te.name?this.value:this.type.keyword;return this.next(),Mt}$23(){let Mt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(te.bracketL)){let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);if(this.eat(te.bracketR))Gt.elementType=Mt,Mt=this.finishNode(Gt,"TSArrayType");else Gt.objectType=Mt,Gt.indexType=this.$0(),this.expect(te.bracketR),Mt=this.finishNode(Gt,"TSIndexedAccessType")}return Mt}$24(){switch(this.type){case te.name:case te._void:case te._null:{let Mt=Pl.get(this.value);if(Mt&&(this.type!==te.name||!this.containsEsc&&this.$2()!==ca)){let Gt=this.startNode();return this.next(),this.finishNode(Gt,Mt)}return this.$1c()}case te.string:case te.num:case te._true:case te._false:{let Mt=this.startNode();return Mt.literal=this.parseExprAtom(),this.finishNode(Mt,"TSLiteralType")}case te.plusMin:{if(this.value!=="-")break;let Mt=this.startNode(),Gt=this.startNode();if(this.next(),this.type!==te.num)this.unexpected();return Gt.operator="-",Gt.prefix=!0,Gt.argument=this.parseExprAtom(),Mt.literal=this.finishNode(Gt,"UnaryExpression"),this.finishNode(Mt,"TSLiteralType")}case te.backQuote:return this.$25();case te._this:{let Mt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);return Gt.parameterName=Mt,this.$x(Gt,!1)}return Mt}case te._typeof:return this.$26();case te._import:return this.$1d();case te.braceL:return this.$27()?this.$28():this.$29();case te.bracketL:return this.$2a();case te.parenL:{let Mt=this.startNode();return this.next(),Mt.typeAnnotation=this.$0(),this.expect(te.parenR),this.finishNode(Mt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Mt=this.startNode();if(Mt.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeReference")}$j(){let Mt=this.parseIdent(!0);while(this.eat(te.dot)){let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);Gt.left=Mt,Gt.right=this.parseIdent(!0),Mt=this.finishNode(Gt,"TSQualifiedName")}return Mt}$26(){let Mt=this.startNode();if(this.next(),Mt.exprName=this.type===te._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeQuery")}$1d(){let Mt=this.startNode();if(this.next(),Mt.argument=this.$1e(),this.eat(te.dot))Mt.qualifier=this.$j();if(this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSImportType")}$z(){if(this.type!==te.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(te.parenL);let Mt=this.$z();return this.expect(te.parenR),Mt}$25(){let Mt=this.startNode(),Gt=this.startNode();this.next(),Gt.expressions=[];let Ut=this.parseTemplateElement({isTagged:!1});Gt.quasis=[Ut];while(!Ut.tail){if(this.type===te.eof)this.raise(this.pos,"Unterminated template literal");this.expect(te.dollarBraceL),Gt.expressions.push(this.$0()),this.expect(te.braceR),Ut=this.parseTemplateElement({isTagged:!1}),Gt.quasis.push(Ut)}return this.next(),Mt.literal=this.finishNode(Gt,"TemplateLiteral"),this.finishNode(Mt,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===te.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==te.bracketL)return!1;if(this.next(),this.type!==te.name)return!1;return this.next(),this.type===te._in})}$28(){let Mt=this.startNode();if(this.expect(te.braceL),this.type===te.plusMin)Mt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Mt.readonly=!0;this.expect(te.bracketL);let Gt=this.startNode();if(Gt.name=this.$y(),this.expect(te._in),Gt.constraint=this.$0(),Mt.typeParameter=this.finishNode(Gt,"TSTypeParameter"),Mt.nameType=this.eatContextual("as")?this.$0():null,this.expect(te.bracketR),this.type===te.plusMin)Mt.optional=this.value,this.next(),this.expect(te.question);else if(this.eat(te.question))Mt.optional=!0;if(this.eat(te.colon))Mt.typeAnnotation=this.$0();return this.semicolon(),this.expect(te.braceR),this.finishNode(Mt,"TSMappedType")}$29(){let Mt=this.startNode();return Mt.members=this.$1f(),this.finishNode(Mt,"TSTypeLiteral")}$1f(){this.expect(te.braceL);let Mt=[];while(!this.eat(te.braceR))Mt.push(this.$2b());return Mt}$2b(){let Mt=this.startNode(),Gt="TSPropertySignature",Ut=this.type===te._new?this.$2():-1;if(this.type===te.parenL||this.$1())Gt="TSCallSignatureDeclaration",this.$r(Mt,te.colon);else if(Ut===pa||Ut===ua)Gt="TSConstructSignatureDeclaration",this.next(),this.$r(Mt,te.colon);else{let Ht=this.type===te._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Mt.readonly=!0;if(this.type===te.bracketL&&this.$1g())return this.$1h(Mt);let qt="method";if(Ht)Mt.key=Ht;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))qt=this.value,this.next();this.parsePropertyName(Mt)}if(this.eat(te.question))Mt.optional=!0;if(this.type===te.parenL||this.$1()){if(Gt="TSMethodSignature",qt!=="method")Mt.kind=qt;this.$r(Mt,te.colon),Mt.kind=qt}else if(this.type===te.colon)Mt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Mt,Gt)}$1i(){if(!this.eat(te.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==te.name)return!1;return this.next(),this.type===te.colon})}$1h(Mt){if(this.expect(te.bracketL),Mt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(te.bracketR),this.type===te.colon)Mt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Mt,"TSIndexSignature")}$2a(){let Mt=this.startNode();this.expect(te.bracketL),Mt.elementTypes=[];while(!this.eat(te.bracketR))if(Mt.elementTypes.push(this.$2c()),this.type!==te.bracketR)this.expect(te.comma);return this.finishNode(Mt,"TSTupleType")}$2c(){let Mt=this.start,Gt=this.startLoc,Ut=this.eat(te.ellipsis),Ht;if((this.type===te.name||this.type.keyword)&&this.$2d()){let qt=this.startNode();qt.label=this.parseIdent(!0),qt.optional=this.eat(te.question),this.expect(te.colon),qt.elementType=this.$0(),Ht=this.finishNode(qt,"TSNamedTupleMember")}else if(Ht=this.$0(),this.eat(te.question)){let qt=this.startNodeAt(Ht.start,Ht.loc?.start);qt.typeAnnotation=Ht,Ht=this.finishNode(qt,"TSOptionalType")}if(Ut){let qt=this.startNodeAt(Mt,Gt);qt.typeAnnotation=Ht,Ht=this.finishNode(qt,"TSRestType")}return Ht}$2d(){let Mt=this.$d();if(this.input.charCodeAt(Mt)===63)Mt=this.$d(Mt+1);return this.input.charCodeAt(Mt)===la}$8(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c()){let Gt=this.startNode();while((this.type===te._const||this.type===te._in||this.isContextual("out"))&&jt(this.$2()))Gt[this.value]=!0,this.next();if(Gt.name=this.$y(),this.eat(te._extends))Gt.constraint=this.$0();if(this.eat(te.eq))Gt.default=this.$0();if(Mt.params.push(this.finishNode(Gt,"TSTypeParameter")),!this.$c()){if(this.expect(te.comma),this.$c())Mt.extra={trailingComma:this.lastTokStart}}}if(this.next(),Mt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Mt,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c())if(Mt.params.push(this.$0()),!this.$c())this.expect(te.comma);if(Mt.params.length===0)this.unexpected();return this.next(),this.finishNode(Mt,"TSTypeParameterInstantiation")})}$1j(){let Mt=[];do{let Gt=this.startNode();if(Gt.expression=this.$j(),this.$1())Gt.typeParameters=this.$e();Mt.push(this.finishNode(Gt,"TSExpressionWithTypeArguments"))}while(this.eat(te.comma));return Mt}$1k(Mt=!1){if(this.type!==te.name||this.containsEsc){if(this.type===te._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Mt);return this.$1l(this.startNode(),this.value)}$2e(Mt){switch(Mt){case"interface":case"type":case"namespace":return this.$14();case"enum":return jt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Gt=this.$2();return this.$b()&&(Gt===pr||Gt===cr||jt(Gt))}case"declare":return this.$b()&&Nl.has(this.$3());case"global":return this.$b()&&this.$2()===ls}return!1}$1l(Mt,Gt){switch(Gt){case"interface":return this.$1m(Mt);case"type":return this.$2g(Mt);case"enum":return this.$10(Mt);case"abstract":return this.$1n(Mt,!0);case"global":return Mt.global=!0,Mt.id=this.parseIdent(),Mt.body=this.$11(),this.finishNode(Mt,"TSModuleDeclaration")}return this.$2h(Mt)}$2f(Mt){let Gt=this.$5;this.$5=!0;let Ut=this.startNode();this.next();let Ht=this.value;if(Ht==="const"&&this.$3()==="enum")Ut.const=!0;if(!Mt&&Dl.has(Ht))Ut.declare=!0;let qt;if(Ut.const)qt=this.$10(Ut);else if(Ht==="var"||Ht==="let"||Ht==="const")qt=this.parseVarStatement(Ut,Ht,!0);else if(Ht==="function")this.next(),qt=this.parseFunction(Ut,aa,!1,!1);else if(Ht==="class")qt=this.parseClass(Ut,!0);else qt=this.$1l(Ut,Ht);return qt.declare=!0,this.$5=Gt,qt}$1n(Mt,Gt){return this.next(),Mt.abstract=!0,this.parseClass(Mt,Gt)}$1m(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,oa),this.$1())Mt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(te._extends))Mt.extends=this.$1j();let Gt=this.startNode();Gt.body=this.$1f(),Mt.body=this.finishNode(Gt,"TSInterfaceBody")}),this.finishNode(Mt,"TSInterfaceDeclaration")}$2g(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,or),this.$1())Mt.typeParameters=this.$8();return Mt.typeAnnotation=this.$a(()=>(this.expect(te.eq),this.$0())),this.semicolon(),this.finishNode(Mt,"TSTypeAliasDeclaration")}$10(Mt){if(this.type===te._const)Mt.const=!0,this.next();this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,jl),this.expect(te.braceL),Mt.members=[];while(!this.eat(te.braceR)){let Gt=this.startNode();if(Gt.id=this.type===te.string?this.parseExprAtom():this.parseIdent(!0),this.eat(te.eq))Gt.initializer=this.parseMaybeAssign();if(Mt.members.push(this.finishNode(Gt,"TSEnumMember")),this.type!==te.braceR)this.expect(te.comma)}return this.finishNode(Mt,"TSEnumDeclaration")}$2h(Mt){if(this.next(),this.type===te.string){if(Mt.id=this.parseExprAtom(),this.type===te.braceL)Mt.body=this.$11();else this.semicolon();return this.finishNode(Mt,"TSModuleDeclaration")}return Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Bl),this.$1o(Mt)}$1o(Mt){if(this.eat(te.dot)){let Gt=this.startNode();Gt.id=this.parseIdent(),Mt.body=this.$1o(Gt)}else Mt.body=this.$11();return this.finishNode(Mt,"TSModuleDeclaration")}$11(){this.enterScope(Il);let Mt=this.startNode();this.enterScope(0),this.expect(te.braceL),Mt.body=[];while(!this.eat(te.braceR))Mt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Mt,"TSModuleBlock")}$1p(Mt,Gt){if(Mt.isExport=Gt,Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,_i),this.expect(te.eq),this.isContextual("require")&&this.$2()===pa){let Ut=this.startNode();this.next(),Ut.expression=this.$1e(),Mt.moduleReference=this.finishNode(Ut,"TSExternalModuleReference")}else Mt.moduleReference=this.$j();return this.semicolon(),this.finishNode(Mt,"TSImportEqualsDeclaration")}$2i(){let Mt=this.$d();if(this.input.charCodeAt(Mt)!==cs)return!1;let Gt=this.input.charCodeAt(Mt+1);return Gt!==cs&&Gt!==62}parseStatement(Mt,Gt,Ut){if(this.type===Vt)this.$1q(!0);let Ht=this.$1k();if(Ht)return Ht;return super.parseStatement(Mt,Gt,Ut)}parseVarStatement(Mt,Gt,Ut){return super.parseVarStatement(Mt,Gt,Ut||this.$5)}parseVarId(Mt,Gt){if(super.parseVarId(Mt,Gt),Mt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Mt.definite=!0;this.$h(Mt.id,!1)}parseCatchClauseParam(){let Mt=this.$h(this.parseBindingAtom(),!1),Gt=Mt.type==="Identifier";return this.enterScope(Gt?Rl:0),this.checkLValPattern(Mt,Gt?Fl:_i),this.expect(te.parenR),Mt}parseImport(Mt){if(this.next(),Mt.importKind="value",this.type===te.string)Mt.specifiers=[],Mt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Gt=this.$2();if(Gt===ls||Gt===ar||jt(Gt)&&this.$3()!=="from")Mt.importKind="type",this.next()}if(this.type===te.name&&this.$2i())return this.$1p(Mt,!1);Mt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Mt.source=this.$z()}return this.$1r(Mt),this.semicolon(),this.finishNode(Mt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=te._with;return this.type===te._with?super.parseWithClause():void 0}$1r(Mt){let Gt=this.parseWithClause();if(Gt)Mt.attributes=Gt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Mt){return this.$1s("exportKind",()=>super.parseExportSpecifier(Mt))}$1s(Mt,Gt){let Ut=this.isContextual("type")?this.$2():-1;if(Ut===pr||Ut===cr||jt(Ut)&&this.$3()!=="as"){let qt=this.startNode();this.next();let zt=Gt();return this.$q(zt,qt),zt[Mt]="type",zt}let Ht=Gt();return Ht[Mt]="value",Ht}parseExport(Mt,Gt){if(this.next(),this.eat(te._import)){if(Mt.importKind="value",this.isContextual("type")&&jt(this.$2())&&this.$3()!=="from")Mt.importKind="type",this.next();return this.$1p(Mt,!0)}if(this.eat(te.eq))return Mt.expression=this.parseExpression(),this.semicolon(),this.finishNode(Mt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Mt.id=this.parseIdent(),this.semicolon(),this.finishNode(Mt,"TSNamespaceExportDeclaration");if(Mt.exportKind="value",this.isContextual("type")){let qt=this.$2();if(qt===ls||qt===ar)Mt.exportKind="type",this.next()}if(this.eat(te.star))return this.parseExportAllDeclaration(Mt,Gt);if(this.eat(te._default)){if(this.isContextual("interface")&&this.$14())Mt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Mt.declaration=this.$1n(this.startNode(),"nullableID");else Mt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Mt,"ExportDefaultDeclaration")}let Ut=this.isContextual("declare"),Ht=this.$1k(!0);if(Ht||this.shouldParseExportStatement()){if(Mt.declaration=Ht??this.parseStatement(null),Ut||Mt.declaration.type==="TSInterfaceDeclaration"||Mt.declaration.type==="TSTypeAliasDeclaration")Mt.exportKind="type";return Mt.specifiers=[],Mt.source=null,this.finishNode(Mt,"ExportNamedDeclaration")}if(Mt.declaration=null,Mt.specifiers=this.parseExportSpecifiers(Gt),this.eatContextual("from"))Mt.source=this.$z(),this.$1r(Mt);else{for(let qt of Mt.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`.");Mt.source=null}return this.semicolon(),this.finishNode(Mt,"ExportNamedDeclaration")}parseFunction(Mt,Gt,Ut,Ht,qt){let zt=Gt&aa;if(zt)this.$f=Mt,this.$o=Mt.start;super.parseFunction(Mt,Gt,Ut,Ht,qt),this.$f=null;let Xt=!Mt.body;if(Xt)Mt.type="TSDeclareFunction";if(zt&&Mt.id){if(Xt){if(this.$5&&this.currentScope().flags&ra)this.declareName(Mt.id.name,lr,Mt.id.start);this.checkLValSimple(Mt.id,Ol)}else if(!(Gt&Vl)){let Jt=Ml;if(this.strict||Mt.generator||Mt.async)Jt=this.treatFunctionsAsVar?Ll:_i;this.checkLValSimple(Mt.id,Jt)}}return Mt}parseFunctionParams(Mt){if(this.$1())Mt.typeParameters=this.$8();if(super.parseFunctionParams(Mt),this.type===te.colon)Mt.returnType=this.$6(!0)}parseFunctionBody(Mt,Gt,Ut,Ht){if(Ut&&this.type===te.colon)Mt.returnType=this.$6(!0);if(Gt||this.type===te.braceL||Mt.start!==this.$o){super.parseFunctionBody(Mt,Gt,Ut,Ht);return}this.semicolon(),this.exitScope()}parseMethod(Mt,Gt,Ut){let Ht=this.$k;this.$k=null;let qt=super.parseMethod(Mt,Gt,Ut);if(!qt.body)qt.type="TSDeclareMethod";if(Ht)qt.typeParameters=Ht;return qt}parseBindingList(Mt,Gt,Ut,Ht){let qt=Ht===!0||this.$l;return this.$l=!1,super.parseBindingList(Mt,Gt,Ut,qt)}$s(Mt){if(!Mt&&!this.$b())return!1;let Gt=this.$2();return Gt===Ul||Gt===ls||Gt===ar||Gt===ca||Gt===Hl||Gt===pr||Gt===cr||Gt>=48&&Gt<=57||jt(Gt)}parseAssignableListItem(Mt){let Gt=this.$12(),Ut=this.start,Ht=this.startLoc,qt,zt=!1,Xt=!1;if(Mt)while(this.type===te.name&&$l.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")zt=!0;else if(this.value==="override")Xt=!0;else qt=this.value;this.next()}let Jt;if(this.type===te._this)Jt=this.startNode(),Jt.name="this",this.next(),this.finishNode(Jt,"Identifier");else Jt=this.parseBindingAtom();let Qt=this.type===te.eq?this.parseMaybeDefault(Ut,Ht,Jt):this.parseMaybeDefault(Jt.start,Jt.loc?.start,this.$h(Jt,!0));if(Gt.length>0)Qt.decorators=Gt;if(!qt&&!zt&&!Xt)return Qt;let Yt=this.startNodeAt(Ut,Ht);if(qt)Yt.accessibility=qt;if(zt)Yt.readonly=!0;if(Xt)Yt.override=!0;return Yt.parameter=Qt,this.finishNode(Yt,"TSParameterProperty")}parseBindingListItem(Mt){if(Mt.type==="RestElement")this.$h(Mt,!0);return Mt}checkLValSimple(Mt,Gt,Ut){if(this.$f&&Mt===this.$f.id){this.$f=null;return}if(!Gt&&sa.has(Mt.type)){this.checkLValSimple(Mt.expression,Gt,Ut);return}switch(Mt.type){case"TSParameterProperty":this.checkLValInnerPattern(Mt.parameter,Gt,Ut);return;case"Identifier":if(Mt.name==="this")return}super.checkLValSimple(Mt,Gt,Ut)}toAssignable(Mt,Gt,Ut){if(Mt&&!Gt&&sa.has(Mt.type))return Mt;return super.toAssignable(Mt,Gt,Ut)}declareName(Mt,Gt,Ut){let Ht=this.currentScope();if(Gt&lr){this.$1t(Ht,Mt),Ht.$1u??=[],Ht.$1u.push(Mt);return}if(Gt===or||Gt===oa){if(Ht.$13??=[],Gt===or&&Sn(Ht.$13,Mt))this.raise(Ut,`type '${Mt}' has already been declared.`);Ht.$13.push(Mt),this.$1t(Ht,Mt);return}if(Gt&ha){if(Ht.$1v??=[],Sn(Ht.$1v,Mt))return;super.declareName(Mt,_i,Ut),Ht.$1v.push(Mt);return}super.declareName(Mt,Gt,Ut)}$1t(Mt,Gt){if(this.inModule&&Mt.flags&ra)delete this.undefinedExports[Gt]}checkLocalExport(Mt){for(let Gt=this.scopeStack.length-1;Gt>=0;Gt--){let Ut=this.scopeStack[Gt];if(Sn(Ut.$13,Mt.name)||Sn(Ut.$1u,Mt.name))return}super.checkLocalExport(Mt)}checkExport(){}raiseRecoverable(Mt,Gt){if(Gt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Mt,Gt)}$12(){let Mt=[];while(this.type===Vt)Mt.push(this.$1w());return Mt}$1q(Mt){let Gt=this.$9[this.$9.length-1];while(this.type===Vt)Gt.push(this.$1w());if(this.type===te._export){if(!Mt)this.unexpected()}else if(this.type!==te._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 Mt=this.startNode();this.next(),this.$9.push([]);let Gt=this.start,Ut=this.startLoc,Ht;if(this.type===te.parenL){if(this.next(),Ht=this.parseExpression(),this.expect(te.parenR),this.options.preserveParens){let zt=this.startNodeAt(Gt,Ut);zt.expression=Ht,Ht=this.finishNode(zt,"ParenthesizedExpression")}}else{Ht=this.parseIdent(!1);while(this.eat(te.dot)){let zt=this.startNodeAt(Gt,Ut);zt.object=Ht,zt.property=this.parseIdent(!0),zt.computed=!1,Ht=this.finishNode(zt,"MemberExpression")}}let qt=this.$p()?this.$e():void 0;if(this.eat(te.parenL)){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);if(zt.callee=Ht,zt.arguments=this.parseExprList(te.parenR,!1,!1),qt)zt.typeArguments=qt;Ht=this.finishNode(zt,"CallExpression")}else if(qt){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);zt.expression=Ht,zt.typeArguments=qt,Ht=this.finishNode(zt,"TSInstantiationExpression")}return Mt.expression=Ht,this.$9.pop(),this.finishNode(Mt,"Decorator")}shouldParseExportStatement(){return this.type===Vt||super.shouldParseExportStatement()}parseExprAtom(Mt,Gt,Ut){if(this.type===Vt)this.$1q(!1);return super.parseExprAtom(Mt,Gt,Ut)}parseProperty(Mt,Gt){if(Mt||this.type!==Vt)return super.parseProperty(Mt,Gt);let Ut=this.$12(),Ht=super.parseProperty(Mt,Gt);if(Ht.type==="SpreadElement")this.raise(Ht.start,"Decorators can't be used with SpreadElement");return Ht.decorators=Ut,Ht}parseClassId(Mt,Gt){let Ut=this.$9.length-1,Ht=this.$9[Ut];if(Ht.length>0)Mt.decorators=Ht,this.$q(Mt,Ht[0]),this.$9[Ut]=[];if(!this.isContextual("implements")||Gt===!0)super.parseClassId(Mt,Gt);if(this.$1())Mt.typeParameters=this.$8()}parseClassSuper(Mt){if(super.parseClassSuper(Mt),Mt.superClass&&this.$1())Mt.superTypeParameters=this.$e();if(this.eatContextual("implements"))Mt.implements=this.$a(()=>this.$1j())}parseClassElement(Mt){if(this.type===Vt){let Xt=this.$12();if(this.type===te.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Jt=this.parseClassElement(Mt);return Jt.decorators=Xt,this.$q(Jt,Xt[0]),Jt}if(this.eat(te.semi))return null;let Gt=this.startNode();while(this.type===te.name&&_l.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let Xt=this.value;if(this.next(),Xt==="static"&&this.type===te.braceL)return this.next(),this.parseClassStaticBlock(Gt),Gt;if(Xt==="public"||Xt==="private"||Xt==="protected")Gt.accessibility=Xt;else Gt[Xt]=!0}if(this.type===te.bracketL&&this.$1g())return this.$1h(Gt);Gt.static??=!1;let Ut="",Ht=!1,qt=!1,zt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===te.star)&&!this.canInsertSemicolon())qt=!0;else Ut="async";if(!Ut&&this.eat(te.star))Ht=!0;if(!Ut&&!qt&&!Ht){let Xt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())zt=Xt;else Ut=Xt}if(Ut)Gt.computed=!1,Gt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Gt.key.name=Ut,this.finishNode(Gt.key,"Identifier");else this.parseClassElementName(Gt);if(this.eat(te.question))Gt.optional=!0;if(this.type===te.parenL||this.$1()||zt!=="method"||Ht||qt){let Xt=Gt.key,Jt=!Gt.static&&!Gt.computed&&(Xt.type==="Identifier"&&Xt.name==="constructor"||Xt.type==="Literal"&&Xt.value==="constructor");if(Gt.kind=Jt?"constructor":zt,this.$1())Gt.typeParameters=this.$8();this.$l=Jt,this.$o=this.start,this.parseClassMethod(Gt,Ht,qt,Jt&&Mt)}else{if(!Gt.optional&&this.$u())this.next(),Gt.definite=!0;if(this.type===te.colon)Gt.typeAnnotation=this.$6();this.parseClassField(Gt)}return Gt}parseMaybeAssign(Mt,Gt,Ut){if(this.$p()){let Ht=this.$g(()=>{let qt=this.$8(),zt=super.parseMaybeAssign(Mt,Gt,Ut);if(zt.type!=="ArrowFunctionExpression")return;return zt.typeParameters=qt,this.$q(zt,qt),zt});if(Ht)return Ht}return super.parseMaybeAssign(Mt,Gt,Ut)}parseMaybeUnary(Mt,Gt,Ut,Ht){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,Ht),this.finishNode(qt,"TSTypeAssertion")}return super.parseMaybeUnary(Mt,Gt,Ut,Ht)}parseMaybeConditional(Mt,Gt){let Ut=this.start,Ht=this.startLoc,qt=this.parseExprOps(Mt,Gt);if(this.checkExpressionErrors(Gt))return qt;if(this.type===te.question&&!(qt.type==="ArrowFunctionExpression"&&qt.start===Ut)&&!this.$2j()){this.next();let zt=this.startNodeAt(Ut,Ht);return zt.test=qt,zt.consequent=this.parseMaybeAssign(),this.expect(te.colon),zt.alternate=this.parseMaybeAssign(Mt),this.finishNode(zt,"ConditionalExpression")}return qt}$2j(){let Mt=this.$d(),Gt=this.input.charCodeAt(Mt);if(Gt===la||Gt===Wl||Gt===Gl)return!0;return Gt===cs&&this.input.charCodeAt(Mt+1)!==cs}parseParenItem(Mt){return this.$h(Mt,!0)}$1x(){if(this.type!==te.colon)return!0;let Mt=this.$g(()=>{let Gt=this.$6(!0);return this.type===te.arrow&&!this.canInsertSemicolon()?Gt:void 0});if(!Mt)return!1;return this.$7=Mt,!0}shouldParseArrow(Mt){return this.$1x()&&super.shouldParseArrow(Mt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Mt,Gt,Ut,Ht){if(this.$7)Mt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Mt,Gt,Ut,Ht)}parseExprList(Mt,Gt,Ut,Ht){if(!this.$m)return super.parseExprList(Mt,Gt,Ut,Ht);this.$m=!1;let qt=[],zt=!0;while(!this.eat(Mt)){if(zt)zt=!1;else if(this.expect(te.comma),Gt&&this.afterTrailingComma(Mt))break;if(this.type===te.ellipsis){let Xt=this.parseSpread(Ht);if(this.eat(te.question))Xt.optional=!0;if(this.type===te.colon)Xt.typeAnnotation=this.$6();qt.push(Xt)}else qt.push(this.parseMaybeAssign(!1,Ht,this.parseParenItem))}return qt}parseSubscript(Mt,Gt,Ut,Ht,qt,zt,Xt){if(this.$u()&&!this.hasPrecedingLineBreak()){let Qt=this.startNodeAt(Gt,Ut);return this.exprAllowed=!1,this.next(),Qt.expression=Mt,this.finishNode(Qt,"TSNonNullExpression")}if(qt&&this.$1()){let Qt=this.$g(()=>this.$2k(Gt,Ut,Xt));if(Qt)return Qt}let Jt=this.type===te.questionDot&&this.$2()===ua;if(this.$1()||Jt||this.type===te.bitShift&&this.value==="<<"){let Qt=this.$g(()=>{if(Jt)this.next();this.$p();let Yt=this.$e();if(this.type===te.parenL&&!Ht)return Yt;if(this.type===te.backQuote)return Jt?void 0:Yt;if(Jt)return;if(this.$c()||this.type===te.bitShift||this.type.startsExpr&&this.type!==te.parenL&&!this.hasPrecedingLineBreak())return;return Yt});if(Qt){let Yt=this.startNodeAt(Gt,Ut);if(this.type===te.parenL&&!Ht){if(this.next(),Yt.callee=Mt,Yt.arguments=this.parseExprList(te.parenR,!0,!1),Yt.typeArguments=Qt,Jt)Mt.optional=!0;if(Jt||zt)Yt.optional=Jt;return this.finishNode(Yt,"CallExpression")}if(this.type===te.backQuote)return Yt.tag=Mt,Yt.quasi=this.parseTemplate({isTagged:!0}),Yt.typeArguments=Qt,this.finishNode(Yt,"TaggedTemplateExpression");return Yt.expression=Mt,Yt.typeArguments=Qt,this.finishNode(Yt,"TSInstantiationExpression")}}if(qt&&this.type===te.parenL)this.$m=!0;return super.parseSubscript(Mt,Gt,Ut,Ht,qt,zt,Xt)}$2k(Mt,Gt,Ut){let Ht=this.startNodeAt(Mt,Gt);if(Ht.typeParameters=this.$8(),this.expect(te.parenL),Ht.params=this.parseBindingList(te.parenR,!1,!0),this.type===te.colon)Ht.returnType=this.$6(!0);if(this.type!==te.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Ht,Ht.params,!0,Ut)}parseDynamicImport(Mt){if(this.next(),Mt.source=this.parseMaybeAssign(),this.eat(te.comma)&&this.type!==te.parenR)Mt.arguments=[this.parseExpression()];return this.expect(te.parenR),this.finishNode(Mt,"ImportExpression")}parseNew(){let Mt=super.parseNew();if(Mt.callee?.type!=="TSInstantiationExpression")return Mt;let Gt=this.startNodeAt(Mt.start,Mt.loc?.start);return Gt.callee=Mt.callee.expression,Gt.typeArguments=Mt.callee.typeArguments,Gt.arguments=Mt.arguments,this.finishNodeAt(Gt,"NewExpression",Mt.end,Mt.loc?.end)}parseExprOp(Mt,Gt,Ut,Ht,qt){if(te._in.binop>Ht&&this.type===te.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let zt=this.value==="satisfies",Xt=this.startNodeAt(Gt,Ut);return Xt.expression=Mt,Xt.typeAnnotation=this.$a(()=>{if(this.next(),!zt&&this.type===te._const){let Jt=this.startNode();return Jt.typeName=this.parseIdent(!0),this.finishNode(Jt,"TSTypeReference")}return this.$0()}),this.finishNode(Xt,zt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(Xt,Gt,Ut,Ht,qt)}return super.parseExprOp(Mt,Gt,Ut,Ht,qt)}parseGetterSetter(Mt){Mt.kind=Mt.key.name,super.parseGetterSetter(Mt)}parsePropertyValue(Mt,Gt,Ut,Ht,qt,zt,Xt,Jt){if(!Gt&&this.$1()){if(this.$k=this.$8(),this.type!==te.parenL)this.unexpected();Mt.kind="init"}return super.parsePropertyValue(Mt,Gt,Ut,Ht,qt,zt,Xt,Jt)}}return Wt});function ue(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var ql=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(ee,te,Oe){super(`${Oe}
|
|
17
|
+
https://svelte.dev/e/${te}`);this.code=te,this.reason=Oe;let Ot=typeof ee==="number"?ee:ee?.start,jt=typeof ee==="number"?ee:ee?.end;if(Ot!==void 0)this.position=[Ot,jt??Ot],this.start=x(this.position[0]),this.end=x(this.position[1]),this.frame=zl(this.start.line-1,this.end.column)}}var da=(ee)=>ee.replace(ql,(te)=>" ".repeat(te.length));function zl(ee,te){let Oe=Math.max(0,ee-2),Ot=[];for(let Vt=Oe;Vt<ee+3;Vt++){let Wt=To(Vt);if(Wt===void 0)break;Ot.push(Wt)}let jt=String(Oe+Ot.length+1).length;return Ot.map((Vt,Wt)=>{let Mt=`${String(Oe+Wt+1).padStart(jt," ")}: ${da(Vt)}`;if(Oe+Wt!==ee)return Mt;return`${Mt}
|
|
18
|
+
${" ".repeat(jt+2+da(Vt.slice(0,te)).length)}^`}).join(`
|
|
19
|
+
`)}function je(ee){throw new e(ee,"attribute_duplicate","Attributes need to be unique")}function Ve(ee){throw new e(ee,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function qe(ee,te){throw new e(ee,"block_duplicate_clause",`${te} cannot appear more than once within a block`)}function Ge(ee){throw new e(ee,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function We(ee){throw new e(ee,"block_invalid_elseif","'elseif' should be 'else if'")}function He(ee,te,Oe){throw new e(ee,"block_invalid_placement",`{#${te} ...} block cannot be ${Oe}`)}function Ue(ee){throw new e(ee,"block_unclosed","Block was left open")}function ze(ee){throw new e(ee,"block_unexpected_close","Unexpected block closing tag")}function Je(ee){throw new e(ee,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Ke(ee){throw new e(ee,"css_empty_declaration","Declaration cannot be empty")}function ke(ee){throw new e(ee,"css_expected_identifier","Expected a valid CSS identifier")}function Xe(ee){throw new e(ee,"css_selector_invalid","Invalid selector")}function Ye(ee){throw new e(ee,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function we(ee){throw new e(ee,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function Qe(ee){throw new e(ee,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function Ze(ee,te){throw new e(ee,"directive_missing_name",`\`${te}\` name cannot be empty`)}function et(ee,te){throw new e(ee,"element_invalid_closing_tag",`\`</${te}>\` attempted to close an element that was not open`)}function tt(ee,te,Oe){throw new e(ee,"element_invalid_closing_tag_autoclosed",`\`</${te}>\` attempted to close element that was already automatically closed by \`<${Oe}>\` (cannot nest \`<${Oe}>\` inside \`<${te}>\`)`)}function Pe(ee,te){throw new e(ee,"element_unclosed",`\`<${te}>\` was left open`)}function Ae(ee){throw new e(ee,"expected_attribute_value","Expected attribute value")}function nt(ee){throw new e(ee,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function De(ee){throw new e(ee,"expected_identifier","Expected an identifier")}function rt(ee){throw new e(ee,"expected_pattern","Expected identifier or destructure pattern")}function it(ee){throw new e(ee,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function A(ee,te){throw new e(ee,"expected_token",`Expected token ${te}`)}function st(ee){throw new e(ee,"expected_whitespace","Expected whitespace")}function Xl(ee,te){throw new e(ee,"js_parse_error",`${te}`)}function ot(ee){throw new e(ee,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function at(ee){throw new e(ee,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function lt(ee,te){throw new e(ee,"script_invalid_attribute_value",`If the \`${te}\` attribute is supplied, it must be a boolean attribute`)}function pt(ee){throw new e(ee,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function ct(ee,te){throw new e(ee,"script_reserved_attribute",`The \`${te}\` attribute is reserved and cannot be used`)}function ut(ee){throw new e(ee,"style_duplicate","A component can have a single top-level `<style>` element")}function dt(ee){throw new e(ee,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function ft(ee){throw new e(ee,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function Ne(ee){throw new e(ee,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function mt(ee,te){throw new e(ee,"svelte_meta_duplicate",`A component can only have one \`<${te}>\` element`)}function ht(ee,te){throw new e(ee,"svelte_meta_invalid_content",`<${te}> cannot have children`)}function gt(ee,te){throw new e(ee,"svelte_meta_invalid_placement",`\`<${te}>\` tags cannot be inside elements or blocks`)}function yt(ee,te){throw new e(ee,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${te}`)}function xt(ee){throw new e(ee,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function Et(ee){throw new e(ee,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function de(ee,te){throw new e(ee,"svelte_options_invalid_attribute_value",`Value must be ${te}, if specified`)}function vt(ee){throw new e(ee,"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 St(ee){throw new e(ee,"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 bt(ee){throw new e(ee,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function _e(ee){throw new e(ee,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function Ct(ee){throw new e(ee,"svelte_options_reserved_tagname","Tag name is reserved")}function Tt(ee,te){throw new e(ee,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${te}'`)}function kt(ee){throw new e(ee,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function wt(ee,te,Oe){throw new e(ee,"tag_invalid_placement",`{@${te} ...} tag cannot be ${Oe}`)}function f(ee){throw new e(ee,"unexpected_eof","Unexpected end of input")}function Pt(ee,te){throw new e(ee,"unexpected_reserved_word",`'${te}' is a reserved word in JavaScript and cannot be used here`)}function At(ee){throw new e(ee,"unterminated_string_constant","Unterminated string constant")}function Dt(ee){throw new e(ee,"void_element_invalid_content","Void elements cannot have children or closing tags")}var fi="",ga=[],hs=0,fn=[],mn=0;function Jl(ee,te){fi=ee,ga=te,hs=0}function Yl(){return hs}function Ql(ee,te,Oe,Ot){hs=Ot}function Zl(ee,te,Oe,Ot,jt,Vt){hs=Ot;let Wt=te;if(ee&&Wt.includes(`
|
|
20
|
+
`)){let Gt=fi.lastIndexOf(`
|
|
21
|
+
`,Oe-1)+1,Ut=Gt,Ht=fi.charCodeAt(Ut);while(Ht===32||Ht===9)Ht=fi.charCodeAt(++Ut);if(Ut>Gt)Wt=eu(Wt,fi.slice(Gt,Ut))}let Mt={type:ee?"Block":"Line",value:Wt,start:Oe,end:Ot};if(jt&&Vt)Mt.loc={start:jt,end:Vt};ga.push(Mt)}function eu(ee,te){let Oe=ee.startsWith(te)?te.length:0,Ot="",jt=ee.indexOf(`
|
|
22
22
|
`,Oe);while(jt!==-1){if(Ot+=ee.slice(Oe,jt+1),Oe=jt+1,ee.startsWith(te,Oe))Oe+=te.length;jt=ee.indexOf(`
|
|
23
|
-
`,Oe)}return Ot+ee.slice(Oe)}function
|
|
24
|
-
`,Wt-1)+1,this.curLine=this.options.locations?Vt.slice(0,this.lineStart).split(
|
|
25
|
-
`}var Sa="sveld",ds="0.40.2";var Rt={name:Sa,version:ds,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",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",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:{"@biomejs/biome":"2.6.3","@types/bun":"^1.4.4","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",bivium:"^0.3.2",knip:"^6.43.0",ostia:"^0.2.11",sveast:"^0.9.6",svelte:"^5.57.2",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 Di="5.57.2";var fs=1;function Un(ee){return ee.some((te)=>te.internal)?ee.filter((te)=>!te.internal):ee}function yu(ee){return{...ee,props:Un(ee.props),moduleExports:Un(ee.moduleExports),slots:Un(ee.slots),events:Un(ee.events),typedefs:Un(ee.typedefs),...ee.contexts?{contexts:Un(ee.contexts).map((te)=>({...te,properties:Un(te.properties)}))}:{}}}function y(ee,te={}){let Oe=Array.from(ee.values(),(Vt)=>{let{diagnostics:Wt,...Mt}=Vt;return yu(Mt)}).sort((Vt,Wt)=>u(Vt.moduleName,Wt.moduleName)),Ot={schemaVersion:fs,generator:{name:Sa,version:ds,svelteVersion:Di},total:Oe.length,components:Oe},jt=te.entryExports?Un(te.entryExports):void 0;if(jt&&jt.length>0)Ot.totalExports=jt.length,Ot.exports=jt;return Ot}var vu=/[:=]/,ba=/^HTML\w+Element$|^HTMLElementTagNameMap\[[\w$]+\]$/,Ca=/^SVG\w+Element$/,vr="COMPONENT_API.json",ms={none:0,patch:1,minor:2,major:3};function xr(ee,te){return ms[te]>ms[ee]?te:ee}function Eu(ee){return ee.reduce((te,Oe)=>xr(te,Oe.bump),"none")}function $a(ee,te){return ms[ee]>=ms[te]}function wa(ee){return new Set(i(ee,"|").map((te)=>te.trim()).filter((te)=>te.length>0))}function Su(ee,te){if(ee===te)return!1;if(te==="HTMLElement")return ba.test(ee);if(te==="SVGElement")return Ca.test(ee);if(te==="Element")return ee==="HTMLElement"||ee==="SVGElement"||ee==="MathMLElement"||ba.test(ee)||Ca.test(ee);return!1}function Ta(ee,te){for(let Oe of te)if(Su(ee,Oe))return!0;return!1}function ka(ee){let te=w(ee);if(te===-1)return;let Oe=ee.slice(0,te).trim(),Ot=ee.slice(te+2).trim();if(!Oe.startsWith("(")||!Oe.endsWith(")"))return;let jt=Oe.slice(1,-1).trim();return{params:jt.length===0?[]:i(jt,",").map((Wt)=>Wt.trim()),returnType:Ot}}function bu(ee){return(ee.split(vu,1)[0]??"").trimEnd().endsWith("?")}function Cu(ee,te){if(ee.returnType!==te.returnType)return"major";if(te.params.length<ee.params.length)return"major";for(let Ot=0;Ot<ee.params.length;Ot++)if(ee.params[Ot]!==te.params[Ot])return"major";if(te.params.length===ee.params.length)return"none";return te.params.slice(ee.params.length).every(bu)?"minor":"major"}function wu(ee,te){let Oe=d(ee),Ot=d(te);if(!Oe||!Ot)return;let{added:jt,removed:Vt,common:Wt}=ni(Oe,Ot,(Gt)=>Gt.name);if(Vt.length>0)return"major";let Mt=jt.length>0?"minor":"none";for(let[,Gt,Ut]of Wt){if(Gt.optional!==Ut.optional)Mt=xr(Mt,Ut.optional?"major":"minor");Mt=xr(Mt,gi(Gt.type,Ut.type,{readOnly:!0}))}return Mt}function gi(ee,te,{readOnly:Oe=!1}={}){if(ee===te)return"none";if(ee===void 0||te===void 0)return"major";let Ot=ka(ee),jt=ka(te);if(Ot&&jt)return Cu(Ot,jt);let Vt=Oe?wu(ee,te):void 0;if(Vt!==void 0)return Vt;let Wt=wa(ee),Mt=wa(te),Gt=[...Mt].some((Ht)=>!Wt.has(Ht)&&!Ta(Ht,Wt));if(![...Wt].some((Ht)=>!Mt.has(Ht)&&!Ta(Ht,Mt)))return Gt?"minor":"none";return"major"}function Aa(ee){return ee.bindable===!0||ee.binding==="writable"}function ni(ee,te,Oe){let Ot=new Map(ee.map((Gt)=>[Oe(Gt),Gt])),jt=new Map(te.map((Gt)=>[Oe(Gt),Gt])),Vt=[...jt].filter(([Gt])=>!Ot.has(Gt)),Wt=[...Ot.keys()].filter((Gt)=>!jt.has(Gt)),Mt=[];for(let[Gt,Ut]of Ot){let Ht=jt.get(Gt);if(Ht)Mt.push([Gt,Ut,Ht])}return{added:Vt,removed:Wt,common:Mt}}function Er(ee,te,Oe,Ot){return(jt,Vt,Wt)=>ee.push({component:te,kind:Oe,name:jt,bump:Vt,message:`${Ot} "${jt}" ${Wt}`})}function Pa(ee,te,Oe,Ot){let jt=[],Vt=Er(jt,ee,te,te==="prop"?"prop":"export"),{added:Wt,removed:Mt,common:Gt}=ni(Oe,Ot,(Ut)=>Ut.name);for(let[Ut,Ht]of Wt)Vt(Ut,Ht.isRequired?"major":"minor",`added${Ht.isRequired?" (required)":""}`);for(let Ut of Mt)Vt(Ut,"major","removed");for(let[Ut,Ht,qt]of Gt){if(Ht.isRequired!==qt.isRequired)Vt(Ut,qt.isRequired?"major":"minor",`became ${qt.isRequired?"required":"optional"}`);let zt=gi(Ht.type,qt.type);if(zt!=="none")Vt(Ut,zt,`type changed from \`${Ht.type??"unknown"}\` to \`${qt.type??"unknown"}\``);let Xt=Aa(qt);if(Aa(Ht)!==Xt)Vt(Ut,Xt?"minor":"major",Xt?"gained a writable binding":"lost its writable binding");if(Ht.value!==qt.value&&zt==="none")Vt(Ut,"patch",`default changed from \`${Ht.value??"none"}\` to \`${qt.value??"none"}\``);let Jt=qt.deprecated!==void 0;if(Ht.deprecated!==void 0!==Jt)Vt(Ut,Jt?"minor":"patch",Jt?"marked as deprecated":"no longer deprecated");if(Ht.constant!==qt.constant)Vt(Ut,"minor",qt.constant?"became constant":"became mutable");if(Ht.reactive!==qt.reactive)Vt(Ut,"minor",qt.reactive?"became reactive":"stopped being reactive")}return jt}function Tu(ee,te,Oe){let Ot=[],jt=Er(Ot,ee,"event","event"),{added:Vt,removed:Wt,common:Mt}=ni(te,Oe,(Gt)=>Gt.name);for(let[Gt]of Vt)jt(Gt,"minor","added");for(let Gt of Wt)jt(Gt,"major","removed");for(let[Gt,Ut,Ht]of Mt){if(Ut.type!==Ht.type){jt(Gt,"major",`changed from ${Ut.type} to ${Ht.type}`);continue}let qt=Ut.type==="dispatched"?Ut.detail:void 0,zt=Ht.type==="dispatched"?Ht.detail:void 0,Xt=gi(qt,zt,{readOnly:!0});if(Xt!=="none")jt(Gt,Xt,`detail changed from \`${qt??"unknown"}\` to \`${zt??"unknown"}\``)}return Ot}function ku(ee,te,Oe){let Ot=[],jt=Er(Ot,ee,"slot","slot"),{added:Vt,removed:Wt,common:Mt}=ni(te,Oe,(Gt)=>Gt.name??"default");for(let[Gt]of Vt)jt(Gt,"minor","added");for(let Gt of Wt)jt(Gt,"major","removed");for(let[Gt,Ut,Ht]of Mt){let qt=gi(Ut.slot_props,Ht.slot_props,{readOnly:!0});if(qt!=="none")jt(Gt,qt,`props changed from \`${Ut.slot_props??"none"}\` to \`${Ht.slot_props??"none"}\``)}return Ot}function _a(ee){return ee.type===void 0?"an object of properties":`\`${ee.type}\``}function Au(ee,te=[],Oe=[]){let Ot=[],{added:jt,removed:Vt,common:Wt}=ni(te,Oe,(Mt)=>Mt.key);for(let[Mt]of jt)Ot.push({component:ee,kind:"context",name:Mt,bump:"minor",message:`context "${Mt}" added`});for(let Mt of Vt)Ot.push({component:ee,kind:"context",name:Mt,bump:"major",message:`context "${Mt}" removed`});for(let[Mt,Gt,Ut]of Wt){let Ht=(zt,Xt,Jt)=>Ot.push({component:ee,kind:"context",name:Mt,...Jt===void 0?{}:{property:Jt},bump:zt,message:`context "${Mt}" ${Jt===void 0?"":`property "${Jt}" `}${Xt}`});if(Gt.typeName!==Ut.typeName)Ht("major",`type name changed from \`${Gt.typeName}\` to \`${Ut.typeName}\``);if(Boolean(Gt.hasUnresolvedSpread)!==Boolean(Ut.hasUnresolvedSpread))Ht("major",`${Ut.hasUnresolvedSpread?"gained":"lost"} an unresolved spread`);if(Gt.type!==void 0||Ut.type!==void 0){if(Gt.type!==Ut.type){let zt=Gt.type!==void 0&&Ut.type!==void 0?gi(Gt.type,Ut.type):"major";Ht(zt,`type changed from ${_a(Gt)} to ${_a(Ut)}`)}continue}let qt=ni(Gt.properties,Ut.properties,(zt)=>zt.name);for(let[zt]of qt.added)Ht("minor","added",zt);for(let zt of qt.removed)Ht("major","removed",zt);for(let[zt,Xt,Jt]of qt.common){if(Xt.optional!==Jt.optional)Ht(Jt.optional?"major":"minor",`became ${Jt.optional?"optional":"required"}`,zt);let Qt=gi(Xt.type,Jt.type);if(Qt!=="none")Ht(Qt,`type changed from \`${Xt.type}\` to \`${Jt.type}\``,zt)}}return Ot}var Pu=new Set(["description","source","componentCommentSource","tags"]);function gs(ee){if(Array.isArray(ee))return ee.map(gs);if(r(ee)){let te={};for(let[Oe,Ot]of Object.entries(ee)){if(Pu.has(Oe))continue;te[Oe]=gs(Ot)}return te}return ee}var _u=["generics","rest_props","extends","typedefs"];function $u(ee,te,Oe){let Ot=[];for(let jt of _u){let Vt=JSON.stringify(gs(te[jt])),Wt=JSON.stringify(gs(Oe[jt]));if(Vt!==Wt)Ot.push({component:ee,kind:"shape",name:jt,bump:"major",message:`"${jt}" changed (breaking)`})}return Ot}function Nu(ee,te){let Oe=te.moduleName;return[...Pa(Oe,"prop",ee.props,te.props),...Pa(Oe,"moduleExport",ee.moduleExports,te.moduleExports),...Tu(Oe,ee.events,te.events),...ku(Oe,ee.slots,te.slots),...Au(Oe,ee.contexts,te.contexts),...$u(Oe,ee,te)]}function $t(ee,te){let Oe=[],{added:Ot,removed:jt,common:Vt}=ni(ee.components,te.components,(Wt)=>Wt.moduleName);for(let[Wt]of Ot)Oe.push({component:Wt,kind:"component",bump:"minor",message:`component "${Wt}" added`});for(let Wt of jt)Oe.push({component:Wt,kind:"component",bump:"major",message:`component "${Wt}" removed`});for(let[,Wt,Mt]of Vt)Oe.push(...Nu(Wt,Mt));return Oe}async function Du(ee){let te;try{te=await xu(yr.resolve(ee),"utf-8")}catch(Oe){if(Oe.code==="ENOENT")return null;throw Oe}try{return JSON.parse(te)}catch{throw Error(`sveld: could not parse "${ee}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Na(ee){if(typeof ee.check==="string")return ee.check;return ee.jsonOptions?.outFile??vr}function Da(ee,te){if(!ee.json||ee.stdout||ee.jsonOptions?.outDir)return!1;return yr.resolve(ee.jsonOptions?.outFile??vr)===yr.resolve(te)}async function Re(ee,te,Oe={}){let Ot=await Du(te);if(Ot===null)return{snapshotExists:!1,snapshotFile:te,changes:[],bump:"none"};if(Ot.schemaVersion!==fs)return{snapshotExists:!0,snapshotFile:te,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ot.schemaVersion} differs from ${fs}; regenerate the snapshot`}],bump:"none"};let jt=y(ee,{entryExports:Oe.entryExports}),Vt=$t(Ot,jt);return{snapshotExists:!0,snapshotFile:te,changes:Vt,bump:Eu(Vt)}}var Ru={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ye(ee){if(!ee.snapshotExists){let jt=ee.snapshotFile===vr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${ee.snapshotFile}"\``;return`sveld --check: no snapshot found at "${ee.snapshotFile}". Generate it with ${jt} and commit it.`}if(ee.changes.length===0)return`sveld --check: no API changes detected against "${ee.snapshotFile}".`;let te=ee.changes.length,Oe=[`sveld --check: ${te} API change${te===1?"":"s"} detected against "${ee.snapshotFile}".`,`Suggested semver bump: ${ee.bump}.`],Ot=new Map;for(let jt of ee.changes){let Vt=Ot.get(jt.component)??[];Vt.push(jt),Ot.set(jt.component,Vt)}for(let[jt,Vt]of Ot){Oe.push("",` ${jt}`);for(let Wt of Vt){let Mt=Wt.kind==="schema"?"schema":Ru[Wt.bump];Oe.push(` [${Mt}] ${Wt.message}`)}}return Oe.join(`
|
|
26
|
-
`)}var It=1;function xe(ee){let te={kind:"check-report",schemaVersion:It,...ee};return
|
|
27
|
-
${jt}`)}let Oe=te.default;if(!
|
|
28
|
-
`)){let Qt=Jt.endsWith(";")?Jt.slice(0,-1):Jt,Yt=`{ ${
|
|
23
|
+
`,Oe)}return Ot+ee.slice(Oe)}function tu(ee,te,Oe){let Ot=0,jt=te.length;while(Ot<jt){let Vt=Ot+jt>>>1;if(te[Vt].start<Oe)Ot=Vt+1;else jt=Vt}if(Ot>=te.length)return;if(fn=te.slice(Ot).map(({type:Vt,value:Wt,start:Mt,end:Gt})=>({type:Vt,value:Wt,start:Mt,end:Gt})),mn=0,hr(ee,void 0,!1),mn<fn.length&&(fn[mn].start>=ee.end||ee.type==="Program")){ee.trailingComments??=[];while(mn<fn.length)ee.trailingComments.push(fn[mn++])}}var nu=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function fa(ee,te){for(let Oe=ee;Oe<te;Oe++){let Ot=fi.charCodeAt(Oe);if(Ot!==44&&Ot!==41&&Ot!==32&&Ot!==9)return!0}return!1}function hr(ee,te,Oe){while(mn<fn.length&&fn[mn].start<ee.start)ee.leadingComments??=[],ee.leadingComments.push(fn[mn++]);if(mn>=fn.length)return;let Ot=fn[mn].start;if(Ot<ee.end||!fa(ee.end,Ot)){let jt=Yn(ee),Vt=nu.get(ee.type),Wt=Vt===void 0?void 0:jt[Vt],Mt=Array.isArray(Wt)&&Wt.length===0;for(let Gt in jt){if(mn>=fn.length)return;if(Gt==="type")continue;let Ut=jt[Gt];if(Array.isArray(Ut)){let Ht=Gt===Vt;for(let qt=0;qt<Ut.length;qt++){let zt=Ut[qt];if(Mn(zt))hr(zt,ee,Ht?qt===Ut.length-1:Mt)}}else if(Mn(Ut))hr(Ut,ee,Mt)}if(mn>=fn.length)return}if(te!==void 0&&ee.end===te.end)return;if(Oe)while(mn<fn.length){if(te&&fn[mn].start>=te.end)break;ee.trailingComments??=[],ee.trailingComments.push(fn[mn++])}else if(ee.end<=fn[mn].start&&!fa(ee.end,fn[mn].start))ee.trailingComments=[fn[mn++]]}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(" ")),ds=!1,$i=1,iu=2,su=32,ru=256,ou=$i|iu|ru,au=2,pu=3,cu=4,lu=/\r\n?|\n|\u2028|\u2029/,ma=new Map;function us(ee){if(!(ee instanceof RegExp))return ee;let te=ma.get(ee);if(!te){let Oe=new Set(ee.source.slice(4,-2).split("|"));te={test:(Ot)=>Oe.has(Ot)},ma.set(ee,te)}return te}var dr=Ai((ee)=>class extends ee{declareName(te,Oe,Ot){let jt=!1;if(Oe===au){let Vt=this.currentScope();if(jt=Sn(Vt.lexical,te)||Sn(Vt.functions,te)||Sn(Vt.var,te),Vt.lexical.push(te),this.inModule&&Vt.flags&$i)delete this.undefinedExports[te]}else if(Oe===cu)this.currentScope().lexical.push(te);else if(Oe===pu){let Vt=this.currentScope();jt=this.treatFunctionsAsVar?Sn(Vt.lexical,te):Sn(Vt.lexical,te)||Sn(Vt.var,te),Vt.functions.push(te)}else for(let Vt=this.scopeStack.length-1;Vt>=0;--Vt){let Wt=this.scopeStack[Vt];if(Sn(Wt.lexical,te)&&!(Wt.flags&su&&Wt.lexical[0]===te)||!this.treatFunctionsAsVarInScope(Wt)&&Sn(Wt.functions,te)){jt=!0;break}if(Wt.var.push(te),this.inModule&&Wt.flags&$i)delete this.undefinedExports[te];if(Wt.flags&ou)break}if(jt)this.raiseRecoverable(Ot,`Identifier '${te}' has already been declared`)}}),fr=Ai((ee)=>{let{keywordTypes:te,tokTypes:Oe}=ee.acorn,Ot=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((Vt)=>[Vt,te[Vt]])),jt;return class extends ee{constructor(Vt,Wt,Mt){super(Vt,Wt,Mt);this.keywords=us(this.keywords),this.reservedWords=us(this.reservedWords),this.reservedWordsStrict=us(this.reservedWordsStrict),this.reservedWordsStrictBind=us(this.reservedWordsStrictBind),jt??=this.context[0]}reset(Vt,Wt,Mt){if(super.reset?.(Vt,Wt,Mt),this.input=Vt,this.containsEsc=!1,this.pos=Wt,Mt)this.lineStart=Wt-Mt.column,this.curLine=Mt.line;else this.lineStart=Vt.lastIndexOf(`
|
|
24
|
+
`,Wt-1)+1,this.curLine=this.options.locations?Vt.slice(0,this.lineStart).split(lu).length:1;this.type=Oe.eof,this.value=null,this.start=this.end=Wt,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=Wt;let Gt=this.context;if(Gt.length!==1||Gt[0]!==jt)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 Ut=this.scopeStack,Ht=Ut[0];if(Ut.length!==1||Ht.flags!==$i||Ht.var.length>0||Ht.lexical.length>0||Ht.functions.length>0||Ht.tsTypes!==void 0||Ht.tsExportOnly!==void 0||Ht.tsEnums!==void 0)this.scopeStack=[],this.enterScope($i);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(Vt,Wt){let Mt=super.parseParenAndDistinguishExpression(Vt,Wt);if(Mt.type==="ParenthesizedExpression")ds=!0;return Mt}checkUnreserved(Vt){if(fe.has(Vt.name))super.checkUnreserved(Vt)}canInsertSemicolon(){let Vt=this.type;return Vt===Oe.eof||Vt===Oe.braceR||Pi(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let Vt=this.input,Wt=this.options.locations,Mt=this.pos,Gt=Vt.charCodeAt(Mt);for(;;)if(Gt===32||Gt===9)Gt=Vt.charCodeAt(++Mt);else if(Gt===10){if(Gt=Vt.charCodeAt(++Mt),Wt)this.curLine++,this.lineStart=Mt}else break;if(this.pos=Mt,Gt===47||Gt<33||Gt>=128)super.skipSpace()}readWord1(){let Vt=this.input,Wt=this.pos,Mt=Wt,Gt=Vt.charCodeAt(Mt),Ut=0;while(Gt>=97&&Gt<=122||Gt>=65&&Gt<=90||Gt>=48&&Gt<=57||Gt===95||Gt===36)Ut=Math.imul(Ut,31)+Gt|0,Gt=Vt.charCodeAt(++Mt);if(Gt>=128||Gt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Mt,bo(Vt,Wt,Mt,Ut)}readWord(){let Vt=this.readWord1();return this.finishToken(Ot.get(Vt)??Oe.name,Vt)}}}),ya=ps(dr,fr),uu=/ \(\d+:\d+\)$/;function Ni(ee){return ee}function xa(ee){return ee instanceof SyntaxError&&"pos"in ee&&typeof ee.pos==="number"}function mr(ee,te,Oe,Ot,jt,Vt=ee.root.comments.length){let Wt=ee.root.comments;Jl(te,Wt);let Mt={onComment:ee.comments?Zl:Ql,sourceType:"module",ecmaVersion:16,locations:ee.loc,preserveParens:Ot};if(ee.lfOnly)Mt.startLocation=x(Oe);let Gt=ee.isTypeScript?ee.typescript:ya;if(!Gt)ue();let Ut;try{Ut=jt(Gt,Mt)}catch(Ht){if(!xa(Ht))throw Ht;Xl(Ht.pos,Ht.message.replace(uu,""))}if(Wt.length>Vt)tu(Ni(Ut),Wt,Oe);return Ut}function me(ee,te,Oe=0){return Ni(mr(ee,te,0,!1,(Ot,jt)=>{if(Oe>0&&jt.locations)jt.startLocation=x(Oe);let Vt=new Ot(jt,te,Oe).parse();return Vt.start=0,Vt},0))}function hu(ee,te){if(!te)return{line:1,column:0};let{column:Oe}=x(ee);return{line:wo(ee-Oe)+1,column:Oe}}var du={count:0},ur,fu=(ee)=>ee.parseExpression();function mu(ee,te,Oe,Ot,jt){let Vt=ur;if(ur=void 0,Vt?.ParserClass===ee&&Vt.onComment===te.onComment&&Vt.locations===te.locations&&Vt.parser.reset)Vt.parser.reset(Oe,Ot,te.startLocation);else Vt={ParserClass:ee,onComment:te.onComment,locations:te.locations,parser:new ee(te,Oe,Ot)};let Wt=Vt.parser;Wt.nextToken();let Mt=jt(Wt);return Wt.input="",ur=Vt,Mt}function va(ee,te,Oe,Ot){return du.count+=1,ds=!1,mr(ee,te,Oe,!0,(jt,Vt)=>(Vt.startLocation??=hu(Oe,Vt.locations),mu(jt,Vt,te,Oe,Ot)))}function F(ee,te,Oe,Ot=!1){let jt=Ni(va(ee,te,Oe,fu)),Vt=Math.max(jt.end,Yl());return{node:ds&&!Ot?gr(jt):jt,end:Vt}}function Nt(ee,te,Oe){let Ot=ee.root.comments.length,jt=!0,Vt=va(ee,te,Oe,(Mt)=>{let Gt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Ut=Mt.parseMaybeConditional(void 0,Gt);if(Mt.type!==ya.acorn.tokTypes.eof)return jt=!1,Ut;let Ht=Mt.toAssignable(Ut,!1,Gt);return Mt.checkLValPattern(Ht),Ht});if(!jt){ee.root.comments.length=Ot;return}let Wt=Ni(Vt);return ds?gr(Wt):Wt}function _t(ee,te,Oe){return Ni(mr(ee,te,Oe,!1,(Ot,jt)=>{let Vt=new Ot(jt,te,Oe);try{return Vt.nextToken(),Vt.parseStatement(null,!0,Object.create(null))}catch(Wt){if(xa(Wt)&&Wt.pos===te.length)f(te.length);throw Wt}}))}function gr(ee){let te=ee;while(te.type==="ParenthesizedExpression")te=te.expression;return H(te,gr),te}var B=ps(dr,ce,fr);function Ea(ee,te,Oe){return ne(ee),me({isTypeScript:te.typescript??!1,typescript:Oe,loc:te.loc??!1,comments:te.comments??!0,root:{comments:[]}},ee)}function he(ee,te={}){return Ea(ee,te,B)}function ge(ee,te){let Oe=u(ee.name,te.name);if(Oe!==0)return Oe;let Ot=u(ee.type,te.type);if(Ot!==0)return Ot;if(ee.type==="forwarded"&&te.type==="forwarded"){let jt=u(ee.element,te.element);if(jt!==0)return jt}return u(ee.detail??"",te.detail??"")}function gu(ee,te){let Oe=ee.length+1,Ot=te.length+1,jt=Array.from({length:Oe},()=>Array(Ot).fill(0));for(let Vt=0;Vt<Oe;Vt++)jt[Vt][0]=Vt;for(let Vt=0;Vt<Ot;Vt++)jt[0][Vt]=Vt;for(let Vt=1;Vt<Oe;Vt++)for(let Wt=1;Wt<Ot;Wt++){let Mt=ee[Vt-1]===te[Wt-1]?0:1;if(jt[Vt][Wt]=Math.min(jt[Vt-1][Wt]+1,jt[Vt][Wt-1]+1,jt[Vt-1][Wt-1]+Mt),Vt>1&&Wt>1&&ee[Vt-1]===te[Wt-2]&&ee[Vt-2]===te[Wt-1])jt[Vt][Wt]=Math.min(jt[Vt][Wt],jt[Vt-2][Wt-2]+1)}return jt[Oe-1][Ot-1]}function R(ee,te,Oe=3){let Ot,jt=Number.POSITIVE_INFINITY;for(let Vt of te){let Wt=gu(ee,Vt);if(Wt<jt)Ot=Vt,jt=Wt}return jt<=Oe?Ot:void 0}import{readFile as vu}from"node:fs/promises";import vr from"node:path";import Sa,{sep as yr}from"node:path";var _n=/\.svelte$/,mi=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],ba=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function gi(ee){if(!ee.endsWith(".svelte"))return!1;let te=ee.length-7;if(te===0)return!1;let Oe=ee.charCodeAt(te-1);return Oe!==47&&(yr==="/"||Oe!==92)}function n(ee){return yr==="/"?ee:ee.split(yr).join("/")}function Ca(ee,te){return n(Sa.join(te,Sa.normalize(ee)))}function Di(ee){return`${JSON.stringify(ee,null,2)}
|
|
25
|
+
`}var wa="sveld",fs="0.40.3";var $t={name:wa,version:fs,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",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",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:{"@biomejs/biome":"2.6.3","@types/bun":"^1.4.4","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",bivium:"^0.4.0",knip:"^6.43.0",ostia:"^0.2.11",sveast:"^0.9.6",svelte:"^5.57.2",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 Ri="5.57.2";var ms=1;function Un(ee){return ee.some((te)=>te.internal)?ee.filter((te)=>!te.internal):ee}function xu(ee){return{...ee,props:Un(ee.props),moduleExports:Un(ee.moduleExports),slots:Un(ee.slots),events:Un(ee.events),typedefs:Un(ee.typedefs),...ee.contexts?{contexts:Un(ee.contexts).map((te)=>({...te,properties:Un(te.properties)}))}:{}}}function y(ee,te={}){let Oe=Array.from(ee.values(),(Vt)=>{let{diagnostics:Wt,...Mt}=Vt;return xu(Mt)}).sort((Vt,Wt)=>u(Vt.moduleName,Wt.moduleName)),Ot={schemaVersion:ms,generator:{name:wa,version:fs,svelteVersion:Ri},total:Oe.length,components:Oe},jt=te.entryExports?Un(te.entryExports):void 0;if(jt&&jt.length>0)Ot.totalExports=jt.length,Ot.exports=jt;return Ot}var Eu=/[:=]/,Ta=/^HTML\w+Element$|^HTMLElementTagNameMap\[[\w$]+\]$/,ka=/^SVG\w+Element$/,Sr="COMPONENT_API.json",gs={none:0,patch:1,minor:2,major:3};function Er(ee,te){return gs[te]>gs[ee]?te:ee}function Su(ee){return ee.reduce((te,Oe)=>Er(te,Oe.bump),"none")}function Ra(ee,te){return gs[ee]>=gs[te]}function Aa(ee){return new Set(r(ee,"|").map((te)=>te.trim()).filter((te)=>te.length>0))}function bu(ee,te){if(ee===te)return!1;if(te==="HTMLElement")return Ta.test(ee);if(te==="SVGElement")return ka.test(ee);if(te==="Element")return ee==="HTMLElement"||ee==="SVGElement"||ee==="MathMLElement"||Ta.test(ee)||ka.test(ee);return!1}function Pa(ee,te){for(let Oe of te)if(bu(ee,Oe))return!0;return!1}function _a(ee){let te=w(ee);if(te===-1)return;let Oe=ee.slice(0,te).trim(),Ot=ee.slice(te+2).trim();if(!Oe.startsWith("(")||!Oe.endsWith(")"))return;let jt=Oe.slice(1,-1).trim();return{params:jt.length===0?[]:r(jt,",").map((Wt)=>Wt.trim()),returnType:Ot}}function Cu(ee){return(ee.split(Eu,1)[0]??"").trimEnd().endsWith("?")}function wu(ee,te){if(ee.returnType!==te.returnType)return"major";if(te.params.length<ee.params.length)return"major";for(let Ot=0;Ot<ee.params.length;Ot++)if(ee.params[Ot]!==te.params[Ot])return"major";if(te.params.length===ee.params.length)return"none";return te.params.slice(ee.params.length).every(Cu)?"minor":"major"}function Tu(ee,te){let Oe=d(ee),Ot=d(te);if(!Oe||!Ot)return;let{added:jt,removed:Vt,common:Wt}=ii(Oe,Ot,(Gt)=>Gt.name);if(Vt.length>0)return"major";let Mt=jt.length>0?"minor":"none";for(let[,Gt,Ut]of Wt){if(Gt.optional!==Ut.optional)Mt=Er(Mt,Ut.optional?"major":"minor");Mt=Er(Mt,yi(Gt.type,Ut.type,{readOnly:!0}))}return Mt}function yi(ee,te,{readOnly:Oe=!1}={}){if(ee===te)return"none";if(ee===void 0||te===void 0)return"major";let Ot=_a(ee),jt=_a(te);if(Ot&&jt)return wu(Ot,jt);let Vt=Oe?Tu(ee,te):void 0;if(Vt!==void 0)return Vt;let Wt=Aa(ee),Mt=Aa(te),Gt=[...Mt].some((Ht)=>!Wt.has(Ht)&&!Pa(Ht,Wt));if(![...Wt].some((Ht)=>!Mt.has(Ht)&&!Pa(Ht,Mt)))return Gt?"minor":"none";return"major"}function $a(ee){return ee.bindable===!0||ee.binding==="writable"}function ii(ee,te,Oe){let Ot=new Map(ee.map((Gt)=>[Oe(Gt),Gt])),jt=new Map(te.map((Gt)=>[Oe(Gt),Gt])),Vt=[...jt].filter(([Gt])=>!Ot.has(Gt)),Wt=[...Ot.keys()].filter((Gt)=>!jt.has(Gt)),Mt=[];for(let[Gt,Ut]of Ot){let Ht=jt.get(Gt);if(Ht)Mt.push([Gt,Ut,Ht])}return{added:Vt,removed:Wt,common:Mt}}function br(ee,te,Oe,Ot){return(jt,Vt,Wt)=>ee.push({component:te,kind:Oe,name:jt,bump:Vt,message:`${Ot} "${jt}" ${Wt}`})}function Na(ee,te,Oe,Ot){let jt=[],Vt=br(jt,ee,te,te==="prop"?"prop":"export"),{added:Wt,removed:Mt,common:Gt}=ii(Oe,Ot,(Ut)=>Ut.name);for(let[Ut,Ht]of Wt)Vt(Ut,Ht.isRequired?"major":"minor",`added${Ht.isRequired?" (required)":""}`);for(let Ut of Mt)Vt(Ut,"major","removed");for(let[Ut,Ht,qt]of Gt){if(Ht.isRequired!==qt.isRequired)Vt(Ut,qt.isRequired?"major":"minor",`became ${qt.isRequired?"required":"optional"}`);let zt=yi(Ht.type,qt.type);if(zt!=="none")Vt(Ut,zt,`type changed from \`${Ht.type??"unknown"}\` to \`${qt.type??"unknown"}\``);let Xt=$a(qt);if($a(Ht)!==Xt)Vt(Ut,Xt?"minor":"major",Xt?"gained a writable binding":"lost its writable binding");if(Ht.value!==qt.value&&zt==="none")Vt(Ut,"patch",`default changed from \`${Ht.value??"none"}\` to \`${qt.value??"none"}\``);let Jt=qt.deprecated!==void 0;if(Ht.deprecated!==void 0!==Jt)Vt(Ut,Jt?"minor":"patch",Jt?"marked as deprecated":"no longer deprecated");if(Ht.constant!==qt.constant)Vt(Ut,"minor",qt.constant?"became constant":"became mutable");if(Ht.reactive!==qt.reactive)Vt(Ut,"minor",qt.reactive?"became reactive":"stopped being reactive")}return jt}function ku(ee,te,Oe){let Ot=[],jt=br(Ot,ee,"event","event"),{added:Vt,removed:Wt,common:Mt}=ii(te,Oe,(Gt)=>Gt.name);for(let[Gt]of Vt)jt(Gt,"minor","added");for(let Gt of Wt)jt(Gt,"major","removed");for(let[Gt,Ut,Ht]of Mt){if(Ut.type!==Ht.type){jt(Gt,"major",`changed from ${Ut.type} to ${Ht.type}`);continue}let qt=Ut.type==="dispatched"?Ut.detail:void 0,zt=Ht.type==="dispatched"?Ht.detail:void 0,Xt=yi(qt,zt,{readOnly:!0});if(Xt!=="none")jt(Gt,Xt,`detail changed from \`${qt??"unknown"}\` to \`${zt??"unknown"}\``)}return Ot}function Au(ee,te,Oe){let Ot=[],jt=br(Ot,ee,"slot","slot"),{added:Vt,removed:Wt,common:Mt}=ii(te,Oe,(Gt)=>Gt.name??"default");for(let[Gt]of Vt)jt(Gt,"minor","added");for(let Gt of Wt)jt(Gt,"major","removed");for(let[Gt,Ut,Ht]of Mt){let qt=yi(Ut.slot_props,Ht.slot_props,{readOnly:!0});if(qt!=="none")jt(Gt,qt,`props changed from \`${Ut.slot_props??"none"}\` to \`${Ht.slot_props??"none"}\``)}return Ot}function Da(ee){return ee.type===void 0?"an object of properties":`\`${ee.type}\``}function Pu(ee,te=[],Oe=[]){let Ot=[],{added:jt,removed:Vt,common:Wt}=ii(te,Oe,(Mt)=>Mt.key);for(let[Mt]of jt)Ot.push({component:ee,kind:"context",name:Mt,bump:"minor",message:`context "${Mt}" added`});for(let Mt of Vt)Ot.push({component:ee,kind:"context",name:Mt,bump:"major",message:`context "${Mt}" removed`});for(let[Mt,Gt,Ut]of Wt){let Ht=(zt,Xt,Jt)=>Ot.push({component:ee,kind:"context",name:Mt,...Jt===void 0?{}:{property:Jt},bump:zt,message:`context "${Mt}" ${Jt===void 0?"":`property "${Jt}" `}${Xt}`});if(Gt.typeName!==Ut.typeName)Ht("major",`type name changed from \`${Gt.typeName}\` to \`${Ut.typeName}\``);if(Boolean(Gt.hasUnresolvedSpread)!==Boolean(Ut.hasUnresolvedSpread))Ht("major",`${Ut.hasUnresolvedSpread?"gained":"lost"} an unresolved spread`);if(Gt.type!==void 0||Ut.type!==void 0){if(Gt.type!==Ut.type){let zt=Gt.type!==void 0&&Ut.type!==void 0?yi(Gt.type,Ut.type):"major";Ht(zt,`type changed from ${Da(Gt)} to ${Da(Ut)}`)}continue}let qt=ii(Gt.properties,Ut.properties,(zt)=>zt.name);for(let[zt]of qt.added)Ht("minor","added",zt);for(let zt of qt.removed)Ht("major","removed",zt);for(let[zt,Xt,Jt]of qt.common){if(Xt.optional!==Jt.optional)Ht(Jt.optional?"major":"minor",`became ${Jt.optional?"optional":"required"}`,zt);let Qt=yi(Xt.type,Jt.type);if(Qt!=="none")Ht(Qt,`type changed from \`${Xt.type}\` to \`${Jt.type}\``,zt)}}return Ot}var _u=new Set(["description","source","componentCommentSource","tags"]);function ys(ee){if(Array.isArray(ee))return ee.map(ys);if(i(ee)){let te={};for(let[Oe,Ot]of Object.entries(ee)){if(_u.has(Oe))continue;te[Oe]=ys(Ot)}return te}return ee}var $u=["generics","rest_props","extends","typedefs"];function Nu(ee,te,Oe){let Ot=[];for(let jt of $u){let Vt=JSON.stringify(ys(te[jt])),Wt=JSON.stringify(ys(Oe[jt]));if(Vt!==Wt)Ot.push({component:ee,kind:"shape",name:jt,bump:"major",message:`"${jt}" changed (breaking)`})}return Ot}function Du(ee,te){let Oe=te.moduleName;return[...Na(Oe,"prop",ee.props,te.props),...Na(Oe,"moduleExport",ee.moduleExports,te.moduleExports),...ku(Oe,ee.events,te.events),...Au(Oe,ee.slots,te.slots),...Pu(Oe,ee.contexts,te.contexts),...Nu(Oe,ee,te)]}function Rt(ee,te){let Oe=[],{added:Ot,removed:jt,common:Vt}=ii(ee.components,te.components,(Wt)=>Wt.moduleName);for(let[Wt]of Ot)Oe.push({component:Wt,kind:"component",bump:"minor",message:`component "${Wt}" added`});for(let Wt of jt)Oe.push({component:Wt,kind:"component",bump:"major",message:`component "${Wt}" removed`});for(let[,Wt,Mt]of Vt)Oe.push(...Du(Wt,Mt));return Oe}async function Ru(ee){let te;try{te=await vu(vr.resolve(ee),"utf-8")}catch(Oe){if(Oe.code==="ENOENT")return null;throw Oe}try{return JSON.parse(te)}catch{throw Error(`sveld: could not parse "${ee}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Ia(ee){if(typeof ee.check==="string")return ee.check;return ee.jsonOptions?.outFile??Sr}function Oa(ee,te){if(!ee.json||ee.stdout||ee.jsonOptions?.outDir)return!1;return vr.resolve(ee.jsonOptions?.outFile??Sr)===vr.resolve(te)}async function $e(ee,te,Oe={}){let Ot=await Ru(te);if(Ot===null)return{snapshotExists:!1,snapshotFile:te,changes:[],bump:"none"};if(Ot.schemaVersion!==ms)return{snapshotExists:!0,snapshotFile:te,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ot.schemaVersion} differs from ${ms}; regenerate the snapshot`}],bump:"none"};let jt=y(ee,{entryExports:Oe.entryExports}),Vt=Rt(Ot,jt);return{snapshotExists:!0,snapshotFile:te,changes:Vt,bump:Su(Vt)}}var Iu={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ye(ee){if(!ee.snapshotExists){let jt=ee.snapshotFile===Sr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${ee.snapshotFile}"\``;return`sveld --check: no snapshot found at "${ee.snapshotFile}". Generate it with ${jt} and commit it.`}if(ee.changes.length===0)return`sveld --check: no API changes detected against "${ee.snapshotFile}".`;let te=ee.changes.length,Oe=[`sveld --check: ${te} API change${te===1?"":"s"} detected against "${ee.snapshotFile}".`,`Suggested semver bump: ${ee.bump}.`],Ot=new Map;for(let jt of ee.changes){let Vt=Ot.get(jt.component)??[];Vt.push(jt),Ot.set(jt.component,Vt)}for(let[jt,Vt]of Ot){Oe.push("",` ${jt}`);for(let Wt of Vt){let Mt=Wt.kind==="schema"?"schema":Iu[Wt.bump];Oe.push(` [${Mt}] ${Wt.message}`)}}return Oe.join(`
|
|
26
|
+
`)}var It=1;function xe(ee){let te={kind:"check-report",schemaVersion:It,...ee};return Di(te)}import{existsSync as Fa}from"node:fs";import{join as Ou,resolve as Lu}from"node:path";import{pathToFileURL as Mu}from"node:url";var Fu=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Ft(ee){return ee}function Bu(ee=process.cwd()){for(let te of Fu){let Oe=Ou(ee,te);if(Fa(Oe))return Oe}return null}async function Ba(ee){let te;try{te=await import(`${Mu(ee).href}?t=${Date.now()}`)}catch(Ot){let jt=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: failed to load config file "${ee}".
|
|
27
|
+
${jt}`)}let Oe=te.default;if(!i(Oe)||Array.isArray(Oe))throw Error(`sveld: config file "${ee}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Oe}async function ju(ee=process.cwd()){let te=Bu(ee);return te===null?{}:Ba(te)}async function j(ee,te,Oe){if(typeof ee==="string"){let Ot=Lu(te,ee);if(!Fa(Ot))throw Error(`sveld: config file "${ee}" does not exist.`);return Ba(Ot)}return ee??Oe?ju(te):{}}function I(...ee){let te={};for(let Oe of ee){if(!Oe)continue;for(let[Ot,jt]of Object.entries(Oe)){let Vt=te[Ot];te[Ot]=i(Vt)&&!Array.isArray(Vt)&&i(jt)&&!Array.isArray(jt)?{...Vt,...jt}:jt}}return te}var La=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Vu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function Ma(ee,te,Oe){let Ot=ee===null?te:`${ee}.${te}`,jt=R(te,Oe),Vt=jt===void 0?void 0:ee===null?jt:`${ee}.${jt}`;console.warn(`sveld: unknown option "${Ot}".${Vt?` Did you mean "${Vt}"?`:""}`)}function V(ee){for(let te of Object.keys(ee))if(!La.includes(te))Ma(null,te,La);for(let[te,Oe]of Object.entries(Vu)){let Ot=ee[te];if(!i(Ot))continue;for(let jt of Object.keys(Ot))if(!Oe.includes(jt))Ma(te,jt,Oe)}}import{dirname as _c}from"node:path";import{lstatSync as jf}from"node:fs";import{readFile as Vf}from"node:fs/promises";import{resolve as ec}from"node:path";import{dirname as ed}from"node:path";var Gu=" ",Wu=120,Uu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Hu=200,Wa=/\s/,Ku=/\s{2}|[^\S ]/,qu=/["'`{}/]/g,zu=/["'`{};/]/g,Ua=9,Cr=10,Xu=13,Ii=32,vs=34,Ju=38,Es=39,Yu=40,Qu=41,xs=42,ja=46,Tr=47,Ha=59,Zu=62,eh=91,kr=92,th=93,Ss=96,Ar=123,nh=124,Pr=125;function ih(ee){return Uu.test(rh(ee,Hu))}var Va=[""];function sh(ee){let te=Va[ee];if(te===void 0)te=Gu.repeat(ee),Va[ee]=te;return te}function rh(ee,te){let Oe="";for(let Ot=ee.length-1;Ot>=0&&Oe.length<te;Ot--)Oe=ee[Ot]+Oe;return Oe.length>te?Oe.slice(-te):Oe}function oh(ee){if(ee.length===0)return!1;let te=ee[ee.length-1];return te.charCodeAt(te.length-1)===Cr}function ah(ee){while(ee.length>0){let te=ee[ee.length-1],Oe=te.length;while(Oe>0){let Ot=te.charCodeAt(Oe-1);if(Ot!==Ii&&Ot!==Ua)break;Oe--}if(Oe===te.length)return;if(Oe===0){ee.pop();continue}ee[ee.length-1]=te.slice(0,Oe);return}}function ph(ee){while(ee.length>0){let te=ee[ee.length-1];if(!Wa.test(te[te.length-1]))return;let Oe=te.trimEnd();if(Oe.length===te.length)return;if(Oe.length===0){ee.pop();continue}ee[ee.length-1]=Oe;return}}function ch(ee){if(ee.includes("{"))return!1;let te=0,Oe=0;for(let Ot=0;Ot<ee.length;Ot++){let jt=ee.charCodeAt(Ot);if(te!==0){if(jt===te&&ee.charCodeAt(Ot-1)!==kr)te=0;continue}if(jt===vs||jt===Es||jt===Ss){te=jt;continue}if(jt===Ha&&++Oe>=2)return!0}return!1}function lh(ee){if(!Ku.test(ee))return ee.trimEnd();let te="",Oe=null,Ot=!1;for(let jt=0;jt<ee.length;jt++){let Vt=ee[jt],Wt=ee[jt-1];if(Oe){if(te+=Vt,Oe==="double"&&Vt==='"'&&Wt!=="\\"||Oe==="single"&&Vt==="'"&&Wt!=="\\"||Oe==="template"&&Vt==="`"&&Wt!=="\\")Oe=null;Ot=!1;continue}if(Vt==='"'||Vt==="'"||Vt==="`"){Oe=Vt==='"'?"double":Vt==="'"?"single":"template",te+=Vt,Ot=!1;continue}if(Wa.test(Vt)){if(!Ot&&te.length>0)te+=" ",Ot=!0;continue}te+=Vt,Ot=!1}return te.trimEnd()}function Ka(ee,te){let Oe=ee[te],Ot=ee.indexOf(Oe,te+1);while(Ot!==-1&&ee.charCodeAt(Ot-1)===kr)Ot=ee.indexOf(Oe,Ot+1);return Ot}function qa(ee,te){let Oe=ee.indexOf("*/",te+1);return Oe===-1?-1:Oe+1}function uh(ee){let te=new Map,Oe=[],Ot=qu,jt=0;while(jt<ee.length){if(Ot.lastIndex=jt,!Ot.test(ee))break;jt=Ot.lastIndex-1;let Vt=ee.charCodeAt(jt);if(Vt===Tr){if(ee.charCodeAt(jt+1)===xs){let Wt=qa(ee,jt);if(Wt===-1)break;jt=Wt}}else if(Vt===vs||Vt===Es||Vt===Ss){let Wt=Ka(ee,jt);if(Wt===-1)break;jt=Wt}else if(Vt===Ar)Oe.push(jt);else if(Vt===Pr&&Oe.length>0)te.set(Oe.pop(),jt);jt++}return te}function hh(ee,te,Oe){for(let Ot=te;Ot<Oe;Ot++)if(!wr(ee.charCodeAt(Ot)))return!1;return!0}function wr(ee){if(ee<=Ii)return ee===Ii||ee>=Ua&&ee<=Xu;if(ee<160)return!1;return ee===160||ee===5760||ee>=8192&&ee<=8202||ee===8232||ee===8233||ee===8239||ee===8287||ee===12288||ee===65279}function za(ee,te,Oe,Ot){let jt=[],Vt=zu,Wt=te,Mt=te;while(Mt<Oe){if(Vt.lastIndex=Mt,!Vt.test(ee))break;if(Mt=Vt.lastIndex-1,Mt>=Oe)break;let Gt=ee.charCodeAt(Mt);if(Gt===Tr){if(ee.charCodeAt(Mt+1)===xs){let Ut=qa(ee,Mt);if(Ut===-1)break;Mt=Ut}Mt++;continue}if(Gt===vs||Gt===Es||Gt===Ss){let Ut=Ka(ee,Mt);if(Ut===-1)break;Mt=Ut+1;continue}if(Gt===Ar){let Ut=Ot.get(Mt);if(Ut===void 0||Ut>=Oe){Mt++;continue}if(Wt<Mt)jt.push(ee.slice(Wt,Mt));let Ht=Mt+1;if(hh(ee,Ht,Ut)){jt.push("{}"),Mt=Ut+1,Wt=Mt;continue}let qt=ee.slice(Ht,Ut),zt=ee.charCodeAt(Ht)===Cr;if(!zt&&!qt.includes("/*")&&!ch(qt)&&!ih(jt)){let Xt=za(ee,Ht,Ut,Ot),Jt=Xt.trim();if(!Jt.includes(`
|
|
28
|
+
`)){let Qt=Jt.endsWith(";")?Jt.slice(0,-1):Jt,Yt=`{ ${lh(Qt)} }`;if(Yt.length<=Wu){jt.push(Yt),Mt=Ut+1,Wt=Mt;continue}}if(jt.push("{"),Xt.charCodeAt(0)!==Ha)jt.push(`
|
|
29
29
|
`);if(Xt.length>0)jt.push(Xt);Mt=Ut,Wt=Ut;continue}if(jt.push("{"),!zt)jt.push(`
|
|
30
|
-
`);Mt=Ht,Wt=Ht;continue}if(Gt===
|
|
31
|
-
`);jt.push("}"),Mt++,Wt=Mt;continue}if(Wt<Mt)jt.push(ee.slice(Wt,Mt));if(
|
|
32
|
-
`);Mt++,Wt=Mt}if(Wt<Oe)jt.push(ee.slice(Wt,Oe));return jt.join("")}function
|
|
33
|
-
`,Mt);if(Ht===-1)Ht=Ot;let qt=Ht+1,zt=Mt,Xt=Ht;while(zt<Xt&&
|
|
34
|
-
`);let qt=te[Ht];if(qt>0)Ut.push(
|
|
35
|
-
`}var An="any",
|
|
30
|
+
`);Mt=Ht,Wt=Ht;continue}if(Gt===Pr){if(Wt<Mt)jt.push(ee.slice(Wt,Mt));if(ah(jt),!oh(jt))jt.push(`
|
|
31
|
+
`);jt.push("}"),Mt++,Wt=Mt;continue}if(Wt<Mt)jt.push(ee.slice(Wt,Mt));if(ph(jt),jt.push(";"),ee.charCodeAt(Mt+1)!==Cr)jt.push(`
|
|
32
|
+
`);Mt++,Wt=Mt}if(Wt<Oe)jt.push(ee.slice(Wt,Oe));return jt.join("")}function dh(ee){if(!ee.includes(" "))return ee;let te="",Oe=0;for(let Ot=0;Ot<ee.length;Ot++){let jt=ee.charCodeAt(Ot);if(Oe!==0){if(te+=ee[Ot],jt===Oe&&ee.charCodeAt(Ot-1)!==kr)Oe=0;continue}if(jt===vs||jt===Es||jt===Ss){Oe=jt,te+=ee[Ot];continue}if(jt===Ii&&te.charCodeAt(te.length-1)===Ii)continue;te+=ee[Ot]}return te}function fh(ee){return ee===Pr||ee===th||ee===Qu||ee===Zu}function mh(ee,te,Oe){return Oe-te>=3&&ee.charCodeAt(te)===Tr&&ee.charCodeAt(te+1)===xs&&ee.charCodeAt(te+2)===xs}function Ga(ee,te,Oe){let Ot=ee.indexOf("*/",te);return Ot!==-1&&Ot+2<=Oe}function gh(ee,te,Oe){let Ot=ee.charCodeAt(te);if(Ot===nh||Ot===Ju)return!0;return Ot===ja&&te+1<Oe&&ee.charCodeAt(te+1)!==ja}function yh(ee){let te=[],Oe=[],Ot=ee.length,jt=0,Vt=!1,Wt=0,Mt=0;while(Mt<=Ot){let Ht=ee.indexOf(`
|
|
33
|
+
`,Mt);if(Ht===-1)Ht=Ot;let qt=Ht+1,zt=Mt,Xt=Ht;while(zt<Xt&&wr(ee.charCodeAt(zt)))zt++;while(Xt>zt&&wr(ee.charCodeAt(Xt-1)))Xt--;if(zt===Xt){let sn=Oe.length>0?Oe[Oe.length-1]:void 0;if(sn!==void 0&&sn!==""){let cn=sn.charCodeAt(sn.length-1);if(cn!==Ar&&cn!==Yu&&cn!==eh)te.push(0),Oe.push("")}Mt=qt;continue}if(Vt){if(te.push(Wt),Oe.push(` ${ee.slice(zt,Xt)}`),Ga(ee,zt,Xt))Vt=!1;Mt=qt;continue}let Jt=mh(ee,zt,Xt),Qt=Jt&&Ga(ee,zt,Xt);if(Jt&&!Qt){te.push(jt),Oe.push(ee.slice(zt,Xt)),Vt=!0,Wt=jt,Mt=qt;continue}let Yt=fh(ee.charCodeAt(zt)),nn=Math.max(0,jt-(Yt?1:0))+(gh(ee,zt,Xt)?1:0);if(Yt&&nn===0&&Oe.length>0&&Oe[Oe.length-1]==="")te.pop(),Oe.pop();if(te.push(nn),Oe.push(dh(ee.slice(zt,Xt))),Mt=qt,Qt)continue;jt=Yi(ee,void 0,zt,Xt,jt)}let Gt=Oe.length;while(Gt>0&&Oe[Gt-1]==="")Gt--;let Ut=[];for(let Ht=0;Ht<Gt;Ht++){if(Ht>0)Ut.push(`
|
|
34
|
+
`);let qt=te[Ht];if(qt>0)Ut.push(sh(qt));Ut.push(Oe[Ht])}return Ut.join("")}function Xa(ee){return`${yh(za(ee,0,ee.length,uh(ee)))}
|
|
35
|
+
`}var An="any",xh="Record<string, any>",Oi="Record<string, never>",tp=/^[A-Za-z_$][A-Za-z0-9_$]*$/,vh=/CustomEvent/,Eh=/^[A-Z]/,Sh=/\n/,bh=/=>/,Ch=/^\s*[(<]/,wh=/(?:^|\n)@default\b/,Th=/^([ \t]*\*) +$/gm,kh=/[^\S\r\n]*[\r\n]\s*/g,Ah=/(^|[^.\w])Snippet(?:\s*<|\b)/,Ph=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,_h=/^const\s+/,$h=/^export /,Nh=/[^\w$]/g;function $r(ee){return ee.replace(_h,"")}function In(ee){if(ee.length===0)return"";return`/**
|
|
36
36
|
* ${M(ee.join(`
|
|
37
37
|
* `))}
|
|
38
|
-
*/`}function
|
|
39
|
-
`):[]}function
|
|
40
|
-
`)}function
|
|
38
|
+
*/`}function Li(ee){return ee?ee.split(`
|
|
39
|
+
`):[]}function np(ee){if(ee===void 0)return[];return(ee===!0?"@deprecated":`@deprecated ${ee}`).split(`
|
|
40
|
+
`)}function Nr(ee){let te=[];for(let{name:Oe,body:Ot}of ee??[])if(!Ot)te.push(`@${Oe}`);else if(Ot.includes(`
|
|
41
41
|
`))te.push(`@${Oe}`,...Ot.split(`
|
|
42
|
-
`));else te.push(`@${Oe} ${Ot}`);return te}function
|
|
43
|
-
`)?In(
|
|
44
|
-
`}function
|
|
45
|
-
`:""}export ${te.ts}`.replace(
|
|
42
|
+
`));else te.push(`@${Oe} ${Ot}`);return te}function xi(ee,te,Oe){return[...Li(ee),...np(te),...Nr(Oe)]}function ip(ee){if(!ee)return"";return`/** ${M(ee)} */`}function Dr(ee){return ee?.includes(`
|
|
43
|
+
`)?In(Li(ee)):ip(ee)}function Rr(ee,te,Oe){let Ot=[...Nr(te),...np(Oe)];if(Ot.length===0)return Dr(ee);return In([...Li(ee),...Ot])}function sp(ee){if(ee===void 0)return An;return`${ee}
|
|
44
|
+
`}function Cs(ee){if(ee.typedefs.length===0)return"";return ee.typedefs.map((te)=>{let Oe=In([...Li(te.description),...Nr(te.tags)]);return`${Oe?`${Oe}
|
|
45
|
+
`:""}export ${te.ts}`.replace(Th,"$1")}).join(`
|
|
46
46
|
|
|
47
|
-
`)}var
|
|
47
|
+
`)}var Ja=new Map;function Dh(ee,te){let Oe=Ja.get(te);if(Oe===void 0)Oe=new RegExp(`\\b${_(te)}\\b`),Ja.set(te,Oe);return Oe.test(ee)}var Ya,Qa=[];function bs(ee){if(ee!==Ya)Ya=ee,Qa=r(ee,",");return Qa}function Rh(ee){if(ee===null)return[];return ee[0].split(",").map((te,Oe)=>({name:te.trim(),constraint:(bs(ee[1]??"")[Oe]??te).trim()}))}function rp(ee,te){let Oe=Rh(ee).filter(({name:Ot})=>Dh(te,Ot));if(Oe.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Oe.map(({constraint:Ot})=>$r(Ot)).join(", ")}>`,refSuffix:`<${Oe.map(({name:Ot})=>Ot).join(", ")}>`}}function op(ee){if(!ee.contexts||ee.contexts.length===0)return"";return ee.contexts.map((te)=>{let Oe=te.properties.map((Wt)=>{let Mt=Wt.description?`${Dr(Wt.description)}
|
|
48
48
|
`:"",Gt=Wt.optional?"?":"";return`${Mt}${$n(Wt.name)}${Gt}: ${Wt.type};`}).join(`
|
|
49
|
-
`),Ot=te.description?`${In(
|
|
50
|
-
`:"",{declSuffix:jt}=
|
|
51
|
-
`));if(te.type!==void 0)return`${Ot}export type ${te.typeName}${jt} = ${te.type};`;if(te.properties.length===0)return`${Ot}export type ${te.typeName} = ${te.hasUnresolvedSpread?"Record<string, any>":
|
|
49
|
+
`),Ot=te.description?`${In(Li(te.description))}
|
|
50
|
+
`:"",{declSuffix:jt}=rp(ee.generics,[te.type??"",...te.properties.map((Wt)=>Wt.type)].join(`
|
|
51
|
+
`));if(te.type!==void 0)return`${Ot}export type ${te.typeName}${jt} = ${te.type};`;if(te.properties.length===0)return`${Ot}export type ${te.typeName} = ${te.hasUnresolvedSpread?"Record<string, any>":Oi};`;let Vt=te.hasUnresolvedSpread?" & Record<string, any>":"";return`${Ot}export type ${te.typeName}${jt} = {
|
|
52
52
|
${Oe}
|
|
53
53
|
}${Vt};`}).join(`
|
|
54
54
|
|
|
55
|
-
`)}function $n(ee){return
|
|
56
|
-
`:"",jt=!te.slot_props||te.slot_props===
|
|
57
|
-
${Ot}${ee}?: ${Vt};`}function
|
|
58
|
-
${
|
|
59
|
-
${$n(en.name)}${en.isRequired?"":"?"}: ${
|
|
60
|
-
`),Mt=
|
|
61
|
-
}`;if(ee.rest_props?.type!=="Element"){let en;if(ee.canonicalPropsType){let
|
|
55
|
+
`)}function $n(ee){return tp.test(ee)?ee:JSON.stringify(ee)}function Za(ee,te){let Oe=Rr(te.description,te.tags,te.deprecated),Ot=Oe?`${Oe}
|
|
56
|
+
`:"",jt=!te.slot_props||te.slot_props===Oi?"[]":Lh(te.slot_props),Vt=jt==="[]"?"(this: void) => void":`(this: void, ...args: ${jt}) => void`;return`
|
|
57
|
+
${Ot}${ee}?: ${Vt};`}function Ih(ee){let te=ee.props.filter((en)=>!ws(en)),Oe=new Set([...te.map((en)=>en.name),...Array.from(ee.canonicalPropNames??[])]),jt=(ee.canonicalPropsType?te.filter((en)=>!ee.canonicalPropNames?.has(en.name)):te).map((en)=>{let ai=typeof en.value==="string"?en.value.replace(kh," "):en.value,Ki=wh.test(en.description??"")||en.value===void 0||en.value==="undefined",qi=In([...xi(en.description,en.deprecated,en.tags),...en.constant?["@constant"]:[],...Ki?[]:[`@default ${ai}`]]),zi=en.constant&&!en.isFunction?en.value:en.type||An;return`
|
|
58
|
+
${qi}
|
|
59
|
+
${$n(en.name)}${en.isRequired?"":"?"}: ${zi};`});for(let en of ee.slots)if(!en.default&&en.name!=null&&!Oe.has(en.name))jt.push(Za($n(en.name),en));let Vt=ee.slots.find((en)=>en.default||en.name===null);if(Vt&&!Oe.has("children"))jt.push(Za("children",Vt));let Wt=jt.join(`
|
|
60
|
+
`),Mt=vi(ee.moduleName),Gt=ee.generics?`<${bs(ee.generics[1]).map((en)=>$r(en.trim())).join(", ")}>`:"",Ut=ee.generics?`<${ee.generics[0]}>`:"",qt=`${ee.extends===void 0?"":`Omit<${ee.extends.interface}, keyof $Props${Ut}> & `}$Props${Ut}`,zt=(en)=>`export type ${Mt}${Gt} = ${en};`,Xt=`{${Wt}
|
|
61
|
+
}`;if(ee.rest_props?.type!=="Element"){let en;if(ee.canonicalPropsType){let ai=Wt.trim()===""?"":` & ${Xt}`;en=[`type $Props${Gt} = ${ee.canonicalPropsType}${ai};`,zt(qt)]}else if(Wt.trim()==="")en=[zt(ee.extends?.interface??Oi)];else if(ee.extends===void 0)en=[zt(Xt)];else en=[`type $Props${Gt} = ${Xt};`,zt(qt)];return{props_name:Mt,prop_def:en.join(`
|
|
62
62
|
|
|
63
|
-
`),elementsImport:void 0}}let{name:Jt,thisValue:Qt,thisType:Yt,description:nn}=ee.rest_props,sn;if(Jt!=="svelte:element")sn=Jt.split("|").map((en)=>`SvelteHTMLElements["${en.trim()}"]`).join(" & ");else if(Qt)sn=`SvelteHTMLElements["${Qt}"]`;else if(Yt)sn=`NoInfer<SvelteHTMLElements[${Yt}]>`;else sn="HTMLAttributes<HTMLElement>";let cn="[key: `data-${string}`]: unknown;",un=nn?`${
|
|
64
|
-
`:"",hn=ee.canonicalPropsType?`(${ee.canonicalPropsType}) & `:"",Ln=Yt?{name:Gt,ref:Ut}:{name:"",ref:""},Xn=ee.extends===void 0?`keyof $Props${Ut}`:`keyof ($Props${Ut} & ${ee.extends.interface})`,
|
|
63
|
+
`),elementsImport:void 0}}let{name:Jt,thisValue:Qt,thisType:Yt,description:nn}=ee.rest_props,sn;if(Jt!=="svelte:element")sn=Jt.split("|").map((en)=>`SvelteHTMLElements["${en.trim()}"]`).join(" & ");else if(Qt)sn=`SvelteHTMLElements["${Qt}"]`;else if(Yt)sn=`NoInfer<SvelteHTMLElements[${Yt}]>`;else sn="HTMLAttributes<HTMLElement>";let cn="[key: `data-${string}`]: unknown;",un=nn?`${Dr(nn)}
|
|
64
|
+
`:"",hn=ee.canonicalPropsType?`(${ee.canonicalPropsType}) & `:"",Ln=Yt?{name:Gt,ref:Ut}:{name:"",ref:""},Xn=ee.extends===void 0?`keyof $Props${Ut}`:`keyof ($Props${Ut} & ${ee.extends.interface})`,Jn=`Omit<$RestProps${Ln.ref}, ${Xn}>`,gn=Yt?Oh(Yt,ee.generics,ee.extends?.interface):void 0,jn=gn?gn.ref:Jn;return{props_name:Mt,prop_def:[`${un}type $RestProps${Ln.name} = ${sn};`,...gn?[gn.declaration]:[],`type $Props${Gt} = ${hn}{${Wt}
|
|
65
65
|
|
|
66
66
|
${cn}
|
|
67
|
-
};`,zt(`${
|
|
67
|
+
};`,zt(`${jn} & ${qt}`)].join(`
|
|
68
68
|
|
|
69
|
-
`),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function
|
|
70
|
-
`:""}${Wt}: ${
|
|
69
|
+
`),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function Oh(ee,te,Oe){if(!te)return;let Ot=bs(te[0]).map((Jt)=>Jt.trim()),jt=bs(te[1]).map((Jt)=>$r(Jt.trim())),Vt=Ot.indexOf(ee),Wt=jt[Vt];if(Vt===-1||!Wt?.startsWith(`${ee} extends `))return;let Mt=r(Wt.slice(`${ee} extends `.length),"=")[0]?.trim();if(!Mt)return;let Gt=Ot.filter((Jt,Qt)=>Qt!==Vt),Ut=jt.filter((Jt,Qt)=>Qt!==Vt),Ht=Ut.length>0?`<${Ut.join(", ")}>`:"",qt=Gt.length>0?`<${Gt.join(", ")}>`:"",zt=`<${Ot.map((Jt)=>Jt===ee?"$Tag":Jt).join(", ")}>`,Xt=Oe===void 0?`keyof $Props${zt}`:`keyof ($Props${zt} & ${Oe})`;return{declaration:`type $Elements${Ht} = { [$Tag in ${Mt}]: Omit<$RestProps${zt}, ${Xt}> };`,ref:`$Elements${qt}[${ee}]`}}function Lh(ee){return Hs(ee)?ee:`[${ee}]`}function Mh(ee){let te=ee.slots.filter((Ot)=>!Hs(Ot.slot_props??""));if(te.length===0)return Oi;let Oe=te.map(({name:Ot,slot_props:jt,...Vt})=>{let Wt=Vt.default||Ot===null?"default":$n(Ot??""),Mt=Rr(Vt.description,Vt.tags,Vt.deprecated);return`${Mt?`${Mt}
|
|
70
|
+
`:""}${Wt}: ${sp(jt)};`}).join(`
|
|
71
71
|
`);return te.length===1?`{${Oe}}`:`{
|
|
72
72
|
${Oe}
|
|
73
|
-
}`}var
|
|
74
|
-
`:""}${$n(Oe.name)}: ${
|
|
73
|
+
}`}var Fh=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 _r(ee=An){if(vh.test(ee))return ee;return`CustomEvent<${ee}>`}function Bh(ee){switch(ee.type){case"dispatched":return _r(ee.detail);case"forwarded":{let te=ee.element,Oe=te&&Eh.test(te),Ot=!Oe||Fh.has(ee.name);if(ee.detail!==void 0&&ee.detail!=="undefined"&&!(ee.detail==="null"&&Ot&&!Oe))return _r(ee.detail);if(!Ot)return _r();return`${te==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${ee.name}"]`}default:return ee}}function ep(ee){if(ee.events.length===0)return xh;let te=ee.events.map((Oe)=>{let Ot=Rr(Oe.description,Oe.tags,Oe.deprecated);return`${Ot?`${Ot}
|
|
74
|
+
`:""}${$n(Oe.name)}: ${Bh(Oe)};
|
|
75
75
|
`}).join("");return ee.events.length===1?`{${te}}`:`{
|
|
76
|
-
${te}}`}function
|
|
77
|
-
${In(
|
|
78
|
-
${$n(te.name)}: ${
|
|
79
|
-
`)}function
|
|
80
|
-
};`}}function
|
|
76
|
+
${te}}`}function jh(ee){let te=ee.type==="() => any";if(ee.type&&bh.test(ee.type)&&!te)return ee.type;if(ee.params&&ee.params.length>0)return`(${h(ee.params)}) => ${ee.returnType||An}`;if(ee.returnType)return`() => ${ee.returnType}`;return ee.type||An}function ws(ee){return ee.isFunctionDeclaration===!0||ee.kind==="const"}function ap(ee){return ee.props.filter(ws).map((te)=>`
|
|
77
|
+
${In(xi(te.description,te.deprecated,te.tags))}
|
|
78
|
+
${$n(te.name)}: ${jh(te)};`).join(`
|
|
79
|
+
`)}function Vh(ee){let te=Mi(ee.moduleName),Oe=ap({props:ee.props});if(Oe.trim()==="")return{exports_ref:te,exports_def:`export type ${te} = ${Oi};`};let{declSuffix:Ot,refSuffix:jt}=rp(ee.generics,Oe);return{exports_ref:`${te}${jt}`,exports_def:`export type ${te}${Ot} = {${Oe}
|
|
80
|
+
};`}}function Gh(ee){let te=ee.props.filter((Oe)=>Oe.bindable===!0||Oe.binding==="writable").map((Oe)=>JSON.stringify(Oe.name));return te.length>0?te.join(" | "):'""'}function pp(ee){return ee==="default"?"$$Component":ee}function Wh(ee){let te=pp(ee.moduleName);return`declare const ${te}: Component<
|
|
81
81
|
${ee.propsRef},
|
|
82
82
|
${ee.exportsRef},
|
|
83
83
|
${ee.bindings}
|
|
84
84
|
>;
|
|
85
|
-
export default ${te};`}function
|
|
85
|
+
export default ${te};`}function Uh(ee){let te=pp(ee.moduleName),Oe=`${te}Component`,Ot=ee.eventsRef?`$on?<K extends keyof ${ee.eventsRef} & string>(type: K, callback: (e: ${ee.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${Oe} {
|
|
86
86
|
new ${ee.generic}(
|
|
87
87
|
options: ComponentConstructorOptions<${ee.propsRef}>
|
|
88
88
|
): SvelteComponent<${ee.propsRef}${ee.eventsRef?`, ${ee.eventsRef}`:""}> & ${ee.exportsRef};
|
|
@@ -98,94 +98,95 @@ ${te}}`}function Fh(ee){let te=ee.type==="() => any";if(ee.type&&Sh.test(ee.type
|
|
|
98
98
|
z_$$bindings?: ${ee.bindings};
|
|
99
99
|
}
|
|
100
100
|
declare const ${te}: ${Oe};
|
|
101
|
-
export default ${te};`}function
|
|
101
|
+
export default ${te};`}function Hh(ee){if(ee.extends===void 0)return"";return`import type { ${Ir(ee.extends.interface)} } from ${ee.extends.import};`}function Ir(ee){let te=ee.indexOf("<");return(te===-1?ee:ee.slice(0,te)).trim()}function Kh(ee){if(!ee.componentComment)return"";if(!Sh.test(ee.componentComment))return ip(ee.componentComment.trim());return`/*${M(ee.componentComment).split(`
|
|
102
102
|
`).map((te)=>`* ${te}`).join(`
|
|
103
103
|
`)}
|
|
104
|
-
*/`}function
|
|
104
|
+
*/`}function qh(ee){let te=[],Oe=new Map;for(let Ot of ee.moduleExports){if(Ot.kind!=="re-export"||!Ot.reExport)continue;let{from:jt,imported:Vt}=Ot.reExport,Wt=In(xi(Ot.description,Ot.deprecated,Ot.tags)),Mt=$n(Ot.name);if(Vt==="*"){let Ht=Ot.name==="*"?"*":`* as ${Mt}`;te.push(`${Wt}
|
|
105
105
|
export ${Ht} from ${JSON.stringify(jt)};`);continue}let Gt=`${jt}\x00${Wt}`,Ut=Oe.get(Gt);if(!Ut)Ut={comment:Wt,from:jt,specifiers:[]},Oe.set(Gt,Ut),te.push(Gt);Ut.specifiers.push(Vt===Ot.name?Mt:`${$n(Vt)} as ${Mt}`)}return te.map((Ot)=>{let jt=Oe.get(Ot);if(!jt)return Ot;return`${jt.comment}
|
|
106
106
|
export { ${jt.specifiers.join(", ")} } from ${JSON.stringify(jt.from)};`}).join(`
|
|
107
107
|
|
|
108
|
-
`)}function
|
|
108
|
+
`)}function Or(ee){let te=[ee.static?"static ":"",ee.abstract?"abstract ":"",ee.readonly?"readonly ":""].join(""),Oe=ee.optional?"?":"";if(ee.kind==="property")return`${te}${$n(ee.name)}${Oe}: ${ee.type??An}`;if(ee.kind==="index")return`${te}${ee.name}: ${ee.type??An}`;let Ot=h(ee.params??[]);if(ee.kind==="constructor")return`constructor(${Ot})`;let jt=ee.typeParameters?`<${ee.typeParameters}>`:"";return`${te}${$n(ee.name)}${Oe}${jt}(${Ot}): ${ee.returnType??An}`}function zh(ee,te){let Oe=ee.localName??ee.name,Ot=Oe!==ee.name,jt=`export { ${Oe}${Ot?` as ${$n(ee.name)}`:""} };`;if(te.has(Oe))return jt;te.add(Oe);let Vt=ee.typeParameters?`<${ee.typeParameters}>`:"",Wt=(ee.members??[]).map((Ht)=>[In(xi(Ht.description,Ht.deprecated,Ht.tags)),`${Or(Ht)};`].filter(Boolean).join(`
|
|
109
109
|
`)).join(`
|
|
110
110
|
|
|
111
111
|
`),Mt=`${ee.extends?` extends ${ee.extends}`:""}${ee.implements?.length?` implements ${ee.implements.join(", ")}`:""}`,Gt=`${Ot?"":"export "}declare ${ee.abstract?"abstract ":""}class ${Oe}${Vt}${Mt}`;return`
|
|
112
|
-
${[In(
|
|
112
|
+
${[In(xi(ee.description,ee.deprecated,ee.tags)),Wt?`${Gt} {
|
|
113
113
|
${Wt}
|
|
114
114
|
}`:`${Gt} {}`,Ot?jt:""].filter(Boolean).join(`
|
|
115
|
-
`)}`}function
|
|
116
|
-
`;else if(Wt.kind==="let")Mt=`export declare let ${Wt.name}: ${Wt.type||An};`;else if(Wt.params&&Wt.params.length>0)Mt=`export declare function ${Wt.name}${Ut}(${h(Wt.params)}): ${Wt.returnType||An};`;else if(Wt.returnType)Mt=`export declare function ${Wt.name}${Ut}(): ${Wt.returnType};`;else if(Wt.type&&Gt!==-1){let Ht=Wt.type.slice(0,Gt).trimEnd(),qt=Wt.type.slice(Gt+2).trim();Mt=`export declare function ${Wt.name}${Ht}: ${qt};`}else Mt=`export declare let ${Wt.name}: ${Wt.type||An};`;if(Vt)Mt=`${Mt.replace(
|
|
115
|
+
`)}`}function Xh(ee){let te=qh(ee),Oe=new Set,Ot=ee.moduleExports.filter((jt)=>jt.kind!=="re-export").map((jt)=>{if(jt.kind==="class")return zh(jt,Oe);let Vt=!tp.test(jt.name),Wt=Vt?{...jt,name:Jh(jt.name)}:jt,Mt,Gt=Wt.type&&Ch.test(Wt.type)?w(Wt.type):-1,Ut=Wt.typeParameters?`<${Wt.typeParameters}>`:"";if(Wt.kind==="const"&&Gt===-1)Mt=`export declare const ${Wt.name}: ${Wt.type||An};
|
|
116
|
+
`;else if(Wt.kind==="let")Mt=`export declare let ${Wt.name}: ${Wt.type||An};`;else if(Wt.params&&Wt.params.length>0)Mt=`export declare function ${Wt.name}${Ut}(${h(Wt.params)}): ${Wt.returnType||An};`;else if(Wt.returnType)Mt=`export declare function ${Wt.name}${Ut}(): ${Wt.returnType};`;else if(Wt.type&&Gt!==-1){let Ht=Wt.type.slice(0,Gt).trimEnd(),qt=Wt.type.slice(Gt+2).trim();Mt=`export declare function ${Wt.name}${Ht}: ${qt};`}else Mt=`export declare let ${Wt.name}: ${Wt.type||An};`;if(Vt)Mt=`${Mt.replace($h,"").trimEnd()}
|
|
117
117
|
export { ${Wt.name} as ${JSON.stringify(jt.name)} };`;return`
|
|
118
|
-
${In(
|
|
118
|
+
${In(xi(Wt.description,Wt.deprecated,Wt.tags))}
|
|
119
119
|
${Mt}`}).join(`
|
|
120
120
|
`);return[te,Ot].filter(Boolean).join(`
|
|
121
121
|
|
|
122
|
-
`)}function
|
|
123
|
-
`)
|
|
122
|
+
`)}function Jh(ee){return`__export_${ee.replace(Nh,"_")}`}var Yh=120;function Qh(ee){let Oe=`export default class ${ee.moduleName==="default"?"":ee.moduleName}${ee.generic} extends SvelteComponentTyped<`,Ot=[ee.genericProps,ee.events,ee.slots],Vt=[ee.ownConstructor?`constructor(options: ComponentConstructorOptions<${ee.genericProps}>);`:"",ee.accessors.trim()].filter(Boolean).join(`
|
|
123
|
+
`);if(Vt===""&&Ot.every((Wt)=>!Wt.includes(`
|
|
124
|
+
`))){let Wt=`${Oe}${Ot.join(", ")}> {}`;if(Wt.length<=Yh)return Wt}return`${Oe}
|
|
124
125
|
${ee.genericProps},
|
|
125
126
|
${ee.events},
|
|
126
127
|
${ee.slots}
|
|
127
128
|
> {
|
|
128
|
-
${
|
|
129
|
-
}`}function
|
|
130
|
-
`),
|
|
129
|
+
${Vt}
|
|
130
|
+
}`}function vi(ee){return`${ee}Props`}function Mi(ee){return`${ee}Exports`}function Lr(ee){return{format:ee.format}}var Zh={format:"class"};function cp(ee){let te=Lr(ee??{}),Oe={};for(let[Ot,jt]of Object.entries(te))Oe[Ot]=jt??Zh[Ot];return JSON.stringify(Oe)}function Mr(ee,te){let Oe=So(ee),{moduleName:Ot,typedefs:jt,generics:Vt,props:Wt,moduleExports:Mt,slots:Gt,events:Ut,rest_props:Ht,extends:qt,componentComment:zt,contexts:Xt}=ee,Jt=te?.format==="component",Qt=Vt!==null,{props_name:Yt,prop_def:nn,elementsImport:sn}=Ih({moduleName:Ot,props:Wt,rest_props:Ht,extends:qt,generics:Vt,slots:Gt,canonicalPropNames:new Set(Oe?.canonicalPropNames??[]),canonicalPropsType:Oe?.canonicalPropsType}),cn=Vt?`<${Vt[1]}>`:"",un=Vt?`${Yt}<${Vt[0]}>`:Yt,hn=Jt&&Ut.length>0?`type $Events${cn} = ${ep({events:Ut})};`:"",Ln=Vt?`$Events<${Vt[0]}>`:"$Events",Xn=Jt&&(Qt||hn!==""),Jn=Xh({moduleExports:Mt}),gn=Cs({typedefs:jt}),jn=op({contexts:Xt,generics:Vt}),en=(Oe?.typeImportStatements??[]).join(`
|
|
131
|
+
`),ai=[...Oe?.localTypeDeclarations??[],...Oe?.moduleTypeDeclarations??[]].join(`
|
|
131
132
|
|
|
132
|
-
`),{exports_ref:Ki,exports_def:qi}=Jt?
|
|
133
|
-
`),
|
|
134
|
-
`)].map((
|
|
133
|
+
`),{exports_ref:Ki,exports_def:qi}=Jt?Vh({props:Wt,moduleName:Ot,generics:Vt}):{exports_ref:"",exports_def:""},zi=Jt?Gh({props:Wt}):"",vo=Ht?.type==="Element"&&Ht.thisType!==void 0,Bs=!Ph.test(en)&&[nn,Jn,gn,jn,ai,qi].some((js)=>Ah.test(js)),Rc=[Jt?Xn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Bs?", Snippet":""} } from "svelte";`:`import type { Component${Bs?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${vo?", type ComponentConstructorOptions":""}${Bs?", type Snippet":""} } from "svelte";`,sn?`import type { ${sn} } from "svelte/elements";`:"",en,Hh({extends:qt})].filter(Boolean).join(`
|
|
134
|
+
`),Ic=Jt?Xn?Uh({moduleName:Ot,generic:cn,propsRef:un,exportsRef:Ki,bindings:zi,...hn?{eventsRef:Ln}:{}}):Wh({moduleName:Ot,propsRef:un,exportsRef:Ki,bindings:zi}):Qh({moduleName:Ot,generic:cn,genericProps:un,events:ep({events:Ut}),slots:Mh({slots:Gt}),accessors:ap({props:Wt}),ownConstructor:vo}),Oc=[Jn,gn,ai,jn,nn,qi,hn,[Kh({componentComment:zt}),Ic].filter(Boolean).join(`
|
|
135
|
+
`)].map((js)=>js.trim()).filter(Boolean).join(`
|
|
135
136
|
|
|
136
|
-
`);return
|
|
137
|
+
`);return Xa([Rc,Oc].filter(Boolean).join(`
|
|
137
138
|
|
|
138
|
-
`))}var Zh=[...fi,".svelte"];function ed(ee){let te=ee.trim();if(te.length<2)return;let Oe=te[0],Ot=te[te.length-1];if((Oe==='"'||Oe==="'"||Oe==="`")&&Oe===Ot)return te.slice(1,-1);return}function cp(ee){let te=[],Oe=ee.moduleExports.filter((jt)=>jt.kind==="re-export");if(Oe.length===0)return te;let Ot=new Set([xi(ee.moduleName),Li(ee.moduleName)]);for(let jt of Oe){if(!Ot.has(jt.name))continue;te.push(a({component:ee.filePath,kind:"module-export-conflict",name:jt.name,message:`Re-export "${jt.name}" has the same name as the generated "${jt.name}" type; the .d.ts won't type-check if "${jt.reExport?.from}" exports a type by that name.`,source:jt.source}))}return te}function lp(ee,te,Oe){let Ot=new Map(Array.from(ee.values()).map((jt)=>[te(jt.filePath),jt]));return(jt)=>{let Vt=jt.extends;if(!Vt)return[];let Wt=ed(Vt.import);if(Wt===void 0||!Wt.startsWith(".")&&!Wt.startsWith("/"))return[];let Mt=te(jt.filePath),Gt=Oe.resolve(Wt,Qh(Mt),Zh);if(Gt===null)return[a({component:jt.filePath,kind:"extend-props-target-missing",name:Vt.interface,message:`@extends/@extendProps target "${Wt}" was not found on disk.`})];let Ut=Ot.get(Gt);if(!Ut)return[];let Ht=xi(Ut.moduleName);if(Nr(Vt.interface)!==Ht)return[a({component:jt.filePath,kind:"extend-props-target-missing",name:Vt.interface,message:`@extends/@extendProps names "${Vt.interface}", but "${Wt}" generates "${Ht}".`})];let qt=[];for(let zt of jt.props){let Xt=Ut.props.find((Jt)=>Jt.name===zt.name);if(Xt&&Xt.type!==zt.type){let Jt=a({component:jt.filePath,kind:"extend-props-override",name:zt.name,message:`Own prop "${zt.name}" (${zt.type}) overrides "${Ht}"'s "${zt.name}" (${Xt.type}).`,source:zt.source}),Yt=yo(jt)?.[zt.name]?.some((nn)=>nn===""||nn===Jt.code);qt.push(Yt?{...Jt,ignored:!0}:Jt)}}return qt}}import{lstatSync as Sd,readFileSync as bd,realpathSync as Cd,statSync as wd}from"node:fs";import{dirname as Td,isAbsolute as kd,join as Ap,parse as Ad,relative as Hr,resolve as Fi}from"node:path";function Z(ee){return ee}function Nn(ee){if(ee==="")return ee;return ee==="."||ee===".."||ee.startsWith("./")||ee.startsWith("../")?ee:`./${ee}`}import{readFileSync as Tp}from"node:fs";import{dirname as Wr,join as vd,relative as Cp,resolve as wp}from"node:path";import{readFileSync as ld,statSync as ud}from"node:fs";import{basename as Vr,dirname as Cs,isAbsolute as hd,join as dd,resolve as fd}from"node:path";import{existsSync as dp,readdirSync as td}from"node:fs";import{dirname as up,join as fp,resolve as nd}from"node:path";function q(ee,te){for(let Oe=nd(ee);;Oe=up(Oe)){for(let Ot of te){let jt=fp(Oe,Ot);if(dp(jt))return jt}if(up(Oe)===Oe)return null}}function hp(ee){return ee.normalize("NFC").toLowerCase()}class Or{listings=new Map;clear(){this.listings.clear()}entries(ee){return this.read(ee)?.entries??null}entry(ee,te){let Oe=this.read(ee);if(Oe===null)return;if(Oe.byName===void 0){Oe.byName=new Map;for(let Ot of Oe.entries)Oe.byName.set(Ot.name,Ot)}return Oe.byName.get(te)}has(ee,te){let Oe=this.read(ee);if(Oe===null)return!1;if(Oe.names.has(te))return!0;if(Oe.folded===void 0){Oe.folded=new Map;for(let jt of Oe.names)Oe.folded.set(hp(jt),jt)}let Ot=Oe.folded.get(hp(te));return Ot!==void 0&&Ot!==te&&dp(fp(ee,te))}read(ee){let te=this.listings.get(ee);if(te!==void 0)return te;try{let Oe=td(ee,{withFileTypes:!0}),Ot=new Set;for(let jt of Oe)Ot.add(jt.name);te={entries:Oe,names:Ot}}catch{te=null}return this.listings.set(ee,te),te}}var Lr=!1;function G(ee){Lr=ee}function Bn(ee){if(!Lr)console.error(ee)}function mp(ee){if(!Lr)console.error(ee)}function Ee(ee){if(ee instanceof e)return ee.start?`${ee.reason} (${ee.start.line}:${ee.start.column})`:ee.reason;return ee instanceof Error?ee.message:String(ee)}var Mi=null,Mr=null;function Hn(){if(Mi)return Promise.resolve(Mi);if(!Mr)Mr=import("./chunk-tz95vn4s.js").then((ee)=>(Mi=ee,ee));return Mr}function Dn(){if(!Mi)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Mi}import{existsSync as Fr,readFileSync as id}from"node:fs";import{dirname as Ep,isAbsolute as Sp,relative as sd,resolve as Br}from"node:path";function gp(ee){if(!r(ee))return{};let te={};if(typeof ee.svelte==="string")te.svelte=ee.svelte;if(typeof ee.name==="string")te.name=ee.name;if(typeof ee.description==="string")te.description=ee.description;return te}function yp(ee){if(!r(ee))return{};let te={};if(typeof ee.extends==="string")te.extends=ee.extends;if(r(ee.compilerOptions)){let Oe={};if(typeof ee.compilerOptions.baseUrl==="string")Oe.baseUrl=ee.compilerOptions.baseUrl;if(r(ee.compilerOptions.paths)){let Ot={};for(let[jt,Vt]of Object.entries(ee.compilerOptions.paths))if(Array.isArray(Vt)&&Vt.every((Wt)=>typeof Wt==="string"))Ot[jt]=Vt;if(Object.keys(Ot).length>0)Oe.paths=Ot}if(Object.keys(Oe).length>0)te.compilerOptions=Oe}return te}var rd=["tsconfig.json","jsconfig.json"],xp=new Map,od=/\/\*[\s\S]*?\*\/|\/\/.*/g,ad=[".svelte",...fi];class W extends Error{specifier;fromFile;searched;constructor(ee,te,Oe){super(`cannot resolve "${ee}" from ${te||"."} (${Oe})`);this.name="UnresolvedModuleError",this.specifier=ee,this.fromFile=te,this.searched=Oe}}function pd(ee){if(Fr(ee))return!0;return ad.some((te)=>Fr(ee+te))}function vp(ee){let te=ee.indexOf("*");return te===-1?ee.length:te}function bp(ee,te){if(te.has(ee))return te.get(ee)??null;try{let Oe=id(ee,"utf-8"),Ot;try{Ot=JSON.parse(Oe)}catch{let Vt=Oe.replace(od,"");Ot=JSON.parse(Vt)}let jt=yp(Ot);if(jt.extends){let Vt=Sp(jt.extends)?jt.extends:Br(Ep(ee),jt.extends),Wt=Vt.endsWith(".json")?Vt:`${Vt}.json`;if(Fr(Wt)){let Mt=bp(Wt,te);if(Mt)jt.compilerOptions={...Mt.compilerOptions,...jt.compilerOptions,paths:{...Mt.compilerOptions?.paths,...jt.compilerOptions?.paths}}}}return te.set(ee,jt),jt}catch{return te.set(ee,null),null}}function cd(ee){let te=xp.get(ee);if(!te){let Oe=ee.split("*").map(_).join("(.*)");te=new RegExp(`^${Oe}$`),xp.set(ee,te)}return te}class jr{configs=new Map;lookup(ee,te){if(ee.startsWith(".")||Sp(ee))return{resolved:ee,unresolved:!1,searched:""};let Oe=q(te,rd),Ot=Oe?bp(Oe,this.configs)?.compilerOptions:void 0,jt=Ot?.paths;if(!Oe||!Ot||!jt)return{resolved:ee,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Vt=Br(Ep(Oe),Ot.baseUrl??"."),Wt=Object.entries(jt).sort(([Mt],[Gt])=>vp(Gt)-vp(Mt));for(let[Mt,Gt]of Wt){let Ut=ee.match(cd(Mt));if(!Ut)continue;let Ht;for(let qt of Gt){let zt=qt;for(let Jt=1;Jt<Ut.length;Jt++)zt=zt.replace("*",Ut[Jt]);let Xt=Br(Vt,zt);if(Ht??=Xt,pd(Xt))return{resolved:Xt,unresolved:!1,searched:Oe}}return{resolved:Ht??ee,unresolved:!1,searched:Oe}}return{resolved:ee,unresolved:!0,searched:`tsconfig paths (${Oe})`}}absolute(ee,te){return this.lookup(ee,te).resolved}relative(ee,te){let Oe=this.absolute(ee,te);if(Oe===ee)return ee;return Nn(n(sd(te,Oe)))}}var md=/\.[mc]?jsx?$/,gd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function yd(ee){return ee==="."||ee===".."||ee.startsWith("./")||ee.startsWith("../")||hd(ee)}class Kn{aliases=new jr;listings=new Or;modules=new Map;programs=new Map;listDirectory(ee){return this.listings.entries(ee)}exists(ee){return this.listings.has(Cs(ee),Vr(ee))}resolve(ee,te,Oe=fi){let Ot=this.aliases.absolute(ee,te);if(Ot===ee&&!yd(ee))return null;let jt=fd(te,Ot),Vt=Cs(jt),Wt=Vr(jt),Mt=this.listings.has(Vt,Wt),Gt;if(Mt){let Ut=this.listings.entry(Vt,Wt);if(Gt=Ut&&!Ut.isSymbolicLink()?Ut:ud(jt,{throwIfNoEntry:!1}),Gt?.isFile())return jt}for(let Ut of Oe)if(this.listings.has(Vt,Wt+Ut))return jt+Ut;if(!Mt)return this.typeScriptCounterpart(jt)??null;if(Gt?.isDirectory()){for(let Ut of Oe)if(this.listings.has(jt,`index${Ut}`))return dd(jt,`index${Ut}`)}return null}parse(ee){let te=this.modules.get(ee);if(te===void 0)te=xd(ee),this.modules.set(ee,te);return te}parseJavaScript(ee,te){let Oe=this.programs.get(ee);if(Oe?.source===te)return Oe.ast;let Ot;try{Ot=he(te)}catch(jt){throw Error(Ee(jt))}return this.programs.set(ee,{source:te,ast:Ot}),Ot}invalidate(...ee){this.listings.clear();for(let te of ee)this.modules.delete(te),this.programs.delete(te)}typeScriptCounterpart(ee){let te=md.exec(ee)?.[0];if(te===void 0)return;let Oe=ee.slice(0,-te.length),Ot=Cs(Oe),jt=Vr(Oe);for(let Vt of gd[te]??[])if(this.listings.has(Ot,jt+Vt))return Oe+Vt;return}}function xd(ee){let te;try{te=ld(ee,"utf-8")}catch{return null}try{let Oe=ee.endsWith(".svelte")?Dn().parseSvelteScripts(te).module?.content.body??[]:Dn().parseModule(te,{typescript:!0}).body;return{source:{text:te,filePath:ee,dir:Cs(ee)},body:Oe}}catch(Oe){return mp(`Warning: sveld couldn't parse ${ee} to read its exports (${Ee(Oe)}); skipping it.`),null}}function Gr(ee){return ee.type==="Identifier"?ee.name:ee.value}function Ed(ee,te,Oe,Ot){let jt=ee.resolve(te,Oe);if(!jt)return null;let Vt=Wr(jt);if(Ot.has(jt))return{dir:Vt,exports:{}};Ot.add(jt);try{return{dir:Vt,exports:Ur(ee,Tp(jt,"utf-8"),Vt,Ot,jt)}}catch{return{dir:Vt,exports:{}}}finally{Ot.delete(jt)}}function kp(ee,te,Oe=new Kn,Ot=new Set,jt=te){return Ur(Oe,ee,te,Ot,jt)}function Ur(ee,te,Oe,Ot,jt){let Vt=ee.parseJavaScript(jt,te),Wt={};for(let Mt of Vt.body)if(Mt.type==="ExportDefaultDeclaration"){if(Mt.declaration.type!=="Identifier")continue;let Gt=Mt.declaration.name;if(Gt in Wt)Wt[Gt].default=!0;else Wt[Gt]={source:Nn(""),default:!0}}else if(Mt.type==="ExportAllDeclaration"){let Gt=Mt.source.value,Ut=ee.resolve(Gt,Oe);if(!Ut){let Xt=ee.aliases.lookup(Gt,Oe);throw new W(Gt,jt,Xt.unresolved?Xt.searched:"no matching file or index found")}if(Ot.has(Ut))continue;Ot.add(Ut);let Ht=Tp(Ut,"utf-8"),qt=Ur(ee,Ht,Wr(Ut),Ot,Ut);Ot.delete(Ut);let zt=Object.entries(qt);if(zt.length===0&&!_n.test(Gt)){let Xt=Nn(n(Gt));Wt[`*:${Gt}`]={source:Xt,default:!1,star:!0}}for(let[Xt,Jt]of zt){let Qt=Nn(n(Jt.source.startsWith(".")?`./${Cp(Oe,wp(Wr(Ut),Jt.source))}`:`./${vd(Gt,Jt.source)}`));Wt[Xt]={...Jt,source:Qt}}}else if(Mt.type==="ExportNamedDeclaration"){let Gt=Mt.source?.value,Ut=Gt!==void 0&&_n.test(Gt);if(Ut){let zt=ee.aliases.lookup(Gt,Oe);if(zt.unresolved)throw new W(Gt,jt,zt.searched)}let qt=Gt!==void 0&&!Ut?Ed(ee,Gt,Oe,Ot):void 0;if(qt===null){console.warn(`sveld: could not resolve re-exported module "${Gt}" from barrel "${Oe||"."}"; skipping.`);continue}for(let zt of Mt.specifiers){let Xt=Gr(zt.exported),Jt=Gr(zt.local),Qt=Xt||Jt,Yt=qt?.exports[Jt],nn=Yt?Nn(n(`./${Cp(Oe,wp(qt.dir,Yt.source))}`)):Nn(ee.aliases.relative(Gt??"",Oe)),sn=Yt?Yt.default:Jt==="default",cn=Yt?Yt.imported??Jt:Jt;if(Qt in Wt){if(Wt[Qt].mixed=!0,!Wt[Qt].source)Wt[Qt].source=nn}else Wt[Qt]={source:nn,default:sn,...!sn&&Gt!==void 0&&cn!==Qt?{imported:cn}:{}}}}else if(Mt.type==="ImportDeclaration"){let Gt=Mt.specifiers[0];if(!Gt)continue;let Ut=Gt.local.name,Ht=Nn(ee.aliases.relative(Mt.source.value,Oe)),qt=Gt.type==="ImportSpecifier"?Gr(Gt.imported):Ut;if(Ut in Wt){if(!Wt[Ut].source)Wt[Ut].source=Ht}else Wt[Ut]={source:Ht,default:Ut==="default",...qt===Ut?{}:{imported:qt}}}return Wt}var Pd=/-/g,_d=/[^A-Za-z0-9_$]/g,$d=/^[0-9]/;function Nd(ee,te){let Oe=ee.replace(_d,""),Ot=$d.test(Oe)?`_${Oe}`:Oe;if(Ot!==ee&&!te?.has(ee))te?.add(ee),console.warn(`Warning: "${ee}" is not a valid identifier; using "${Ot}" instead.`);return Ot}function Pp(ee,te){return Nd(Ad(ee).name.replace(Pd,""),te)}function _p(ee,te,Oe=[],Ot=new Set,jt){let Vt;try{Vt=jt??Cd(te)}catch{return Oe}if(Ot.has(Vt))return Oe;Ot.add(Vt);let Wt=ee.listDirectory(te);if(Wt===null)return Oe;for(let Mt of Wt){if(Mt.name.startsWith("."))continue;let Gt=Ap(te,Mt.name),Ut=Mt.isSymbolicLink(),Ht=Ut?wd(Gt,{throwIfNoEntry:!1}):Mt;if(!Ht)continue;if(Ht.isDirectory())_p(ee,Gt,Oe,Ot,Ut?void 0:Ap(Vt,Mt.name));else if(Ht.isFile()&&Mt.name.endsWith(".svelte"))Oe.push(Gt)}return Oe}function Dd(ee,te){return _p(ee,te).map((Oe)=>({moduleName:Pp(Oe),source:Nn(n(`./${Hr(te,Oe)}`))})).sort((Oe,Ot)=>u(Oe.source,Ot.source))}function Rd(ee){return!mi(ee)}function Id(ee,te){let Oe=ee.endsWith("/")?ee:`${ee}/`;return te.startsWith(Oe)}function ws(ee,te){return{seenPaths:new Set(ee.map(([,Oe])=>te(Oe.source))),seenModuleNamePaths:new Map(ee.map(([Oe,Ot])=>[Oe,te(Ot.source)])),warnedModuleNames:new Set}}function Kr(ee,te,Oe,Ot,jt,Vt){for(let{moduleName:Wt,source:Mt}of Dd(ee,te)){let Gt=jt(Mt),Ut=Oe[Wt];if(Ut&&Rd(Ut.source)&&Id(Ut.source,Mt)){Vt.seenPaths.delete(jt(Ut.source)),Ut.source=Mt,Vt.seenPaths.add(Gt),Vt.seenModuleNamePaths.set(Wt,Gt);continue}if(Vt.seenPaths.has(Gt))continue;Vt.seenPaths.add(Gt);let Ht=Vt.seenModuleNamePaths.get(Wt);if(Ht===void 0)Vt.seenModuleNamePaths.set(Wt,Gt);else if(Ht!==Gt&&!Vt.warnedModuleNames.has(Wt))Vt.warnedModuleNames.add(Wt),console.warn(`Warning: multiple components named "${Wt}" found (${n(Hr(te,Ht))} and ${n(Hr(te,Gt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Wt,{source:Mt,default:!1}])}}function qr(ee,te,Oe,Ot){let jt=Sd(ee).isFile(),Vt=jt?Td(ee):ee,Wt=Fi(Vt),Mt=new Map,Gt=(qt)=>{let zt=Mt.get(qt);if(zt===void 0)zt=kd(qt)?Fi(qt):Fi(Wt,qt),Mt.set(qt,zt);return zt},Ut={};if(jt){let qt=bd(ee,"utf-8");try{Ut=kp(qt,Wt,Ot,new Set([Fi(ee)]),Fi(ee))}catch(zt){if(!Oe)throw zt;let Xt=zt instanceof Error?zt.message:String(zt);console.warn(`Warning: Failed to parse component exports from ${ee}: ${Xt}`)}}let Ht=Object.entries(Ut);if(te){let qt=ws(Ht,Gt);if(Kr(Ot,Wt,Ut,Ht,Gt,qt),!jt)Ut=Object.fromEntries(Ht.map(([zt,Xt])=>[zt,{...Xt,default:!0}]))}return{exports:Ut,allComponentEntries:Ht,rootDir:Wt,resolveComponentFilePath:Gt}}function $p(ee,te,Oe,Ot){if(Oe!==1||ee!=="default")return ee;return Pp(te,Ot)}import{dirname as gf}from"node:path";import{resolve as Od}from"node:path";var Ld=/\r?\n/,Md=/^\s*\*+/;function Ts(ee){return{graph:ee,cache:new Map,computing:new Set}}function yn(ee){return ee?.type==="Identifier"?ee.name:void 0}function Fd(ee){let te=ee.trimEnd();for(;;){let Oe=te.lastIndexOf(`
|
|
139
|
-
`)+1;if(te.slice(Oe).trimStart().startsWith("//")){te=te.slice(0,Oe).trimEnd();continue}let Ot=te.endsWith("*/")?te.lastIndexOf("/*",te.length-3):-1;if(Ot!==-1&&te[Ot+2]!=="*"){te=te.slice(0,Ot).trimEnd();continue}return te}}function Bd(ee,te){let Oe=Fd(ee.slice(0,te));if(!Oe.endsWith("*/"))return;let Ot=Oe.length-2,jt=Oe.lastIndexOf("/**",Ot);if(jt===-1)return;return Oe.slice(jt,Ot+2)}function jd(ee){let te=[];for(let Oe of ee.slice(3,-2).split(Ld)){let Ot=Oe.replace(Md,"").trim();if(Ot.startsWith("@"))break;if(Ot)te.push(Ot)}return te.join(" ")||void 0}function ii(ee,te){if(!te)return;return ee.text.slice(te.start,te.end)}function Vd(ee,te){return"typeAnnotation"in te?ii(ee,te.typeAnnotation?.typeAnnotation):void 0}function Dp(ee,te){return ii(ee,te.returnType?.typeAnnotation)}function zr(ee,te,Oe){return`(${te.params.map((jt)=>ii(ee,jt)??"").join(", ")}) => ${Dp(ee,te)??Oe??"any"}`}function Rp(ee){if(ee.type==="Literal"){let te=ee.value;if(typeof te==="string")return"string";if(typeof te==="number")return"number";if(typeof te==="boolean")return"boolean"}if(ee.type==="TemplateLiteral")return"string";if(ee.type==="UnaryExpression"&&(ee.operator==="-"||ee.operator==="+"))return ee.argument.type==="Literal"&&typeof ee.argument.value==="number"?"number":void 0;if(ee.type==="CallExpression"&&ee.callee.type==="Identifier")return Gd[ee.callee.name];return}var Gd={String:"string",Number:"number",Boolean:"boolean"};function Ip(ee){if(ee.type==="Literal"){let te=ee.value;return typeof te==="string"||typeof te==="number"||typeof te==="boolean"?te:void 0}if(ee.type==="UnaryExpression"&&ee.operator==="-"){let te=ee.argument;return te.type==="Literal"&&typeof te.value==="number"?-te.value:void 0}return ee.type==="TemplateLiteral"?k(ee)??void 0:void 0}function Wd(ee,te){let Oe=ii(ee,te),Ot=Ip(te);if(Oe===void 0||Ot===void 0)return;return{raw:Oe,value:Ot,type:typeof Ot}}function Ud(ee,te){if(ee.type!=="CallExpression"&&ee.type!=="NewExpression")return;let Oe=ee.callee;if(!(yn(Oe)==="Symbol"||Oe.type==="MemberExpression"&&!Oe.computed&&yn(Oe.object)==="Symbol"&&yn(Oe.property)==="for"))return;let[jt]=ee.arguments;return(jt?.type==="Literal"&&typeof jt.value!=="string"?null:k(jt))||te}var Hd=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Kd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,qd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function zd(ee,te){let Oe=te?Dn().extractJsDocType(te):void 0,Ot=ee?{type:ee,source:"typescript"}:Oe?{type:Oe,source:"jsdoc"}:void 0;if(!Ot||Ot.type.includes("`"))return;return(Ot.type.replace(Kd,'""').match(qd)??[]).every((Vt)=>Hd.has(Vt))?Ot:void 0}function Op(ee){if(ee.async||ee.generator||ee.type==="TSDeclareFunction")return;let te=ee.body,Oe=te.type==="BlockStatement"?Q(te):[te];if(Oe.length===0)return;let Ot;for(let jt of Oe){if(!jt)return;let Vt=Rp(jt);if(!Vt)return;if(Ot===void 0)Ot=Vt;else if(Ot!==Vt)return}return Ot}function Xd(ee){if(ee.type==="TemplateLiteral")return;let te=Ip(ee);return typeof te==="boolean"?void 0:te}function Jd(ee){let te=ee.members;if(te.length===0)return;let Oe=[],Ot=0;for(let jt of te){if(!jt.initializer){Oe.push(String(Ot)),Ot+=1;continue}let Vt=Xd(jt.initializer);if(Vt===void 0)return;Oe.push(typeof Vt==="string"?JSON.stringify(Vt):String(Vt)),Ot=typeof Vt==="number"?Vt+1:Ot}return Oe.join(" | ")}function Xr(ee,te,Oe,Ot){let jt=Bd(ee.text,Oe),Vt=jt?jd(jt):void 0,Wt=jt?Dn().extractJsDocReturnType(jt):void 0,{deprecated:Mt,tags:Gt,internal:Ut}=jt?Dn().extractJsDocDeprecatedAndTags(jt):{deprecated:void 0,tags:void 0,internal:!1},Ht={description:Vt,deprecated:Mt,tags:Gt,...Ut?{internal:!0}:{},declFile:ee.filePath},qt=(Xt,Jt,Qt=!1)=>Xt?[{name:Xt,...Jt,...Ht,isTypeOnly:Qt}]:[],zt=(Xt,Jt)=>Dp(ee,Xt)??Wt??ie(Jt)??Op(Xt);if(te.type==="VariableDeclaration"){let Xt=te.kind==="let"||te.kind==="var"?te.kind:"const";return te.declarations.flatMap((Jt)=>{let Qt=Jt.id,Yt=yn(Qt);if(!Yt)return[];let nn=Vd(ee,Qt),sn=nn,cn,un,hn,Ln,Xn,jn,xn=Jt.init;if(xn)if(xn.type==="ArrowFunctionExpression"||xn.type==="FunctionExpression"){if(jn=xn,un=zt(xn,sn),!sn)sn=zr(ee,xn,un)}else{if(cn=ii(ee,xn),!sn)sn=Rp(xn);let en=C(xn);if(hn=k(en)??Ud(en,Yt),Xt==="const")Ln=Wd(ee,en),Xn=zd(nn,jt)}return qt(Yt,{kind:Xt,type:sn,value:cn,returnType:un,literalValue:hn,primitiveLiteral:Ln,declaredType:Xn,functionNode:jn})})}if(te.type==="FunctionDeclaration"||te.type==="TSDeclareFunction"){let Xt=zt(te);return qt(yn(te.id)??Ot,{kind:"function",type:zr(ee,te,Xt),returnType:Xt,...te.type==="FunctionDeclaration"?{functionNode:te}:{}})}if(te.type==="ClassDeclaration"){let Xt=yn(te.id);return qt(Xt??Ot,{kind:"class",...Xt?{type:Xt}:{}})}if(te.type==="TSTypeAliasDeclaration")return qt(yn(te.id),{kind:"type",type:ii(ee,te.typeAnnotation)},!0);if(te.type==="TSInterfaceDeclaration")return qt(yn(te.id),{kind:"interface",type:ii(ee,te.body)},!0);if(te.type==="TSEnumDeclaration"){let Xt=yn(te.id);return qt(Xt,{kind:"enum",type:Jd(te)??Xt})}return[]}function Yd(ee,te,Oe){let Ot=te.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Wt]=Xr(ee,Ot,te.start,"default");return Wt?{...Wt,name:"default"}:void 0}if(Ot.type==="FunctionExpression"||Ot.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:zr(ee,Ot,Op(Ot)),functionNode:Ot,declFile:ee.filePath,isTypeOnly:!1};let jt=yn(Ot),Vt=jt?Oe(jt):null;return Vt?{...Vt,name:"default"}:void 0}function Qd(ee,te){for(let Oe of ee){if(Oe.type!=="ImportDeclaration")continue;let Ot=Oe.source.value;for(let jt of Oe.specifiers){if(jt.local.name!==te)continue;let Vt=Oe.importKind==="type"||jt.type==="ImportSpecifier"&&jt.importKind==="type";if(jt.type==="ImportDefaultSpecifier")return{specifier:Ot,importedName:"default",isTypeOnly:Vt};if(jt.type==="ImportNamespaceSpecifier")return{specifier:Ot,importedName:"*",isTypeOnly:Vt};if(jt.type==="ImportSpecifier"){let Wt=yn(jt.imported)??te;return{specifier:Ot,importedName:Wt,isTypeOnly:Vt}}}}return null}function Np(ee,te,Oe){return{name:ee,kind:"const",declFile:te,namespaceFile:te,isTypeOnly:Oe}}function ks(ee,te){let Oe=te.cache.get(ee);if(Oe)return Oe;if(te.computing.has(ee))return[];te.computing.add(ee);let Ot=te.graph.parse(ee);if(!Ot)return te.computing.delete(ee),te.cache.set(ee,[]),[];let{source:jt,body:Vt}=Ot,Wt=[],Mt=new Map;for(let zt of Vt){let Xt=zt.type==="ExportNamedDeclaration"?zt.declaration:zt;if(!Xt)continue;for(let Jt of Xr(jt,Xt,Xt.start))Mt.set(Jt.name,Jt)}let Gt=(zt,Xt)=>({name:zt,kind:"const",declFile:Od(jt.dir,Xt),isTypeOnly:!1}),Ut=(zt)=>{let Xt=Mt.get(zt);if(Xt)return Xt;let Jt=Qd(Vt,zt);if(!Jt)return null;if(Jt.specifier.endsWith(".svelte"))return Gt(zt,Jt.specifier);let Qt=te.graph.resolve(Jt.specifier,jt.dir);if(!Qt)return null;if(Jt.importedName==="*")return Np(zt,Qt,Jt.isTypeOnly);return si(Qt,Jt.importedName,te)??null},Ht=new Map;for(let zt of Vt){if(zt.type==="ExportAllDeclaration"){let Yt=zt.source.value;if(Yt.endsWith(".svelte"))continue;let nn=te.graph.resolve(Yt,jt.dir);if(!nn)continue;let sn=zt.exportKind==="type",cn=yn(zt.exported);if(cn){Wt.push(Np(cn,nn,sn));continue}for(let un of ks(nn,te)){let hn=Ht.get(un.name)??[];hn.push(sn?{...un,isTypeOnly:!0}:un),Ht.set(un.name,hn)}continue}if(zt.type==="ExportDefaultDeclaration"){let Yt=Yd(jt,zt,Ut);if(Yt)Wt.push(Yt);continue}if(zt.type!=="ExportNamedDeclaration")continue;let Xt=zt.declaration;if(Xt){Wt.push(...Xr(jt,Xt,zt.start));continue}let Jt=zt.source?.value;if(Jt?.endsWith(".svelte")){for(let Yt of zt.specifiers){let nn=yn(Yt.exported);if(nn)Wt.push(Gt(nn,Jt))}continue}let Qt=zt.exportKind==="type";for(let Yt of zt.specifiers){let nn=yn(Yt.exported),sn=yn(Yt.local);if(!nn||!sn)continue;let cn=Qt||Yt.exportKind==="type",un=null;if(Jt){let hn=te.graph.resolve(Jt,jt.dir);if(hn)un=si(hn,sn,te)??null}else un=Ut(sn);if(un)Wt.push({...un,name:nn,isTypeOnly:un.isTypeOnly||cn});else if(sn!=="default")Wt.push({name:nn,kind:cn?"type":"const",declFile:ee,isTypeOnly:cn})}}let qt=new Set(Wt.map((zt)=>zt.name));for(let[zt,Xt]of Ht){if(qt.has(zt)||zt==="default")continue;if(Xt.every((Jt)=>Jt.declFile===Xt[0].declFile))Wt.push(...Xt);else te.onAmbiguousStarExport?.(ee,zt,Xt)}return te.computing.delete(ee),te.cache.set(ee,Wt),Wt}function si(ee,te,Oe){return ks(ee,Oe).findLast((Ot)=>Ot.name===te)}function vi(ee,{importedName:te,members:Oe=[]},Ot){let jt=si(ee,te,Ot);for(let Vt of Oe){if(jt?.namespaceFile===void 0)return;jt=si(jt.namespaceFile,Vt,Ot)}return jt}function qn(ee,te,Oe){if(ee[te]===void 0)delete ee[te];ee[te]=Oe}function As(ee,te){return(te.location==="props"?ee.props:ee.moduleExports).find((Ot)=>Ot.name===te.propName)}function Ps(ee,te){if(te.location!=="props")return;ee.diagnostics=(ee.diagnostics??[]).filter((Oe)=>!(Oe.kind==="prop-unknown-type"&&Oe.name===te.propName))}var Zd=/\.[^./\\]+$/;function ef(ee,te){if(ee.endsWith(".d.ts"))return null;let Oe=ee.replace(Zd,".d.ts");return te.exists(Oe)?Oe:null}function tf(ee,te,Oe){return te.map((Ot)=>{if(!Ot.importSource||!Ot.importedName)return{candidate:Ot};let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot,failureReason:"module-not-found"};let Vt=si(jt,Ot.importedName,Oe);if(!Vt)return{candidate:Ot,failureReason:"export-not-found"};if(Vt.returnType)return{candidate:Ot,type:Vt.returnType};let Wt=ef(jt,Oe.graph);if(Wt){let Mt=si(Wt,Ot.importedName,Oe);if(Mt?.returnType)return{candidate:Ot,type:Mt.returnType}}return{candidate:Ot,failureReason:"return-type-unresolved"}})}function nf(ee,te){switch(te){case"module-not-found":return`Prop "${ee.propName}" default calls "${ee.calleeName}()", but "${ee.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${ee.propName}" default calls "${ee.calleeName}()", but "${ee.importedName}" is not exported from "${ee.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${ee.propName}" default calls "${ee.calleeName}()" imported from "${ee.importSource}", but its return type could not be resolved; falling back to "any".`}}function sf(ee,te){for(let{candidate:Oe,type:Ot,failureReason:jt}of te){let Vt=As(ee,Oe);if(Vt?.typeSource!=="unknown")continue;if(Ot){qn(Vt,"type",Ot),qn(Vt,"typeSource","typescript"),Ps(ee,Oe);continue}if(Oe.location==="props"&&jt){let Wt=ee.diagnostics?.find((Mt)=>Mt.kind==="prop-unknown-type"&&Mt.name===Oe.propName);if(Wt)Wt.message=nf(Oe,jt)}}}var Lp={collect:(ee)=>ee.pendingCallDefaultCandidates?.filter((te)=>te.importSource!==void 0)??[],resolve:tf,apply:sf};function rf(ee,te,Oe){return te.map((Ot)=>{let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot};let Vt=vi(jt,Ot,Oe);if(!Vt?.primitiveLiteral)return{candidate:Ot};return{candidate:Ot,literal:Vt.primitiveLiteral,declaredType:Vt.declaredType}})}function of(ee,te){for(let{candidate:Oe,literal:Ot,declaredType:jt}of te){if(!Ot)continue;let Vt=As(ee,Oe);if(!Vt)continue;if(qn(Vt,"value",Ot.raw),qn(Vt,"defaultValue",{raw:Ot.raw,kind:"literal",value:Ot.value}),Vt.typeSource!=="unknown")continue;qn(Vt,"type",jt?.type??Ot.type),qn(Vt,"typeSource",jt?.source??"default"),Ps(ee,Oe)}}var Mp={collect:(ee)=>ee.pendingConstDefaultCandidates??[],resolve:rf,apply:of};function af(ee,te,Oe){return te.map((Ot)=>{let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot};let Vt=vi(jt,Ot,Oe);if(Vt?.kind!=="const"||Vt.literalValue===void 0)return{candidate:Ot};return{candidate:Ot,key:Vt.literalValue}})}function pf(ee,te){for(let{candidate:Oe,key:Ot}of te){if(!Ot){let Mt=ae(Oe);li(ee,[a({component:ee.filePath,kind:"context-key-unresolved",name:Mt,message:`setContext key \`${Mt}\` from "${Oe.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Oe.source?{source:Oe.source}:{}})]);continue}let jt=[...ee.contexts??[]],Vt=jt.findIndex((Mt)=>Mt.key===Ot);if(Vt!==-1){let Mt=jt[Vt],Gt=Fp(Mt.source,Oe.source),Ut=Gt?Mt.source:Oe.source;if(li(ee,[a({component:ee.filePath,kind:"context-duplicate-key",name:Ot,message:`setContext("${Ot}", ...) was called more than once; only the first call's shape is used.`,...Ut?{source:Ut}:{}})]),!Gt)continue;jt.splice(Vt,1)}let Wt=jt.findIndex((Mt)=>Fp(Mt.source,Oe.source));jt.splice(Wt===-1?jt.length:Wt,0,{key:Ot,typeName:K(Ot),...Oe.type===void 0?{}:{type:Oe.type},description:Oe.description,properties:Oe.properties,...Oe.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Oe.internal?{internal:!0}:{},source:Oe.source}),ee.contexts=jt}}function Fp(ee,te){if(!ee||!te)return!1;let{line:Oe,column:Ot}=ee.start;return Oe>te.start.line||Oe===te.start.line&&Ot>te.start.column}var Bp={collect:(ee)=>ee.pendingContextKeyCandidates??[],resolve:af,apply:pf};function cf(ee,te,Oe){return te.map((Ot)=>{let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot,failureReason:"module-not-found"};let Vt=vi(jt,Ot,Oe)?.functionNode;if(!Vt)return{candidate:Ot,failureReason:"not-a-function"};let Wt=lf(Vt,Ot);if(!Wt)return{candidate:Ot,failureReason:"parameter-not-found"};return df(Vt,Wt,Ot)})}function jp(ee){return ee?.type==="AssignmentPattern"?ee.left:ee}function lf(ee,te){let Oe=jp(ee.params[te.argumentIndex]);if(te.property===void 0)return Oe?.type==="Identifier"?{name:Oe.name}:void 0;if(!te.property)return;if(Oe?.type==="Identifier")return{object:Oe.name,property:te.property};if(Oe?.type!=="ObjectPattern")return;for(let Ot of Oe.properties){if(Ot.type!=="Property"||Ot.computed)continue;if(Ot.key.type!=="Identifier"||Ot.key.name!==te.property)continue;let jt=jp(Ot.value);return jt?.type==="Identifier"?{name:jt.name}:void 0}return}function Jr(ee){if(!ee)return null;if(ee.type==="ConditionalExpression"){let Oe=Jr(ee.consequent),Ot=Jr(ee.alternate);return Oe&&Ot?[...Oe,...Ot]:null}let te=k(ee);return te?[te]:null}var uf={variableType:()=>{return}};function hf(ee){if(!ee)return"null";let{deriveLiteralDetailType:te,literalDetailToTypeText:Oe}=Dn();if(ee.type==="Literal")return Oe(ee.value);return te(uf,ee)??"any"}function Vp(ee,te){if("name"in te)return ee.type==="Identifier"&&ee.name===te.name;if(ee.type!=="MemberExpression"||ee.computed)return!1;return ee.object.type==="Identifier"&&ee.object.name===te.object&&ee.property.type==="Identifier"&&ee.property.name===te.property}function df(ee,te,Oe){let Ot=new Map,jt="name"in te?te.name:te.object,Vt;if(o(ee.body,{enter(Mt,Gt,Ut){if(Mt.type==="CallExpression"){if(!Vp(Mt.callee,te))return;let qt=Mt.arguments,zt=Jr(qt[0]);if(!zt)return Vt="dynamic-event-name",v;for(let Xt of zt){let Jt=Ot.get(Xt)??new Set;Jt.add(hf(qt[1])),Ot.set(Xt,Jt)}return}let Ht=Gt?.type==="CallExpression"&&Ut==="callee";if(Mt.type==="MemberExpression"&&Vp(Mt,te)&&!Ht)return Vt="passed-on",v;if(Mt.type!=="Identifier"||Mt.name!==jt)return;if(Ht)return;if(!("name"in te)&&Gt?.type==="MemberExpression"&&Ut==="object")return;if(!U(Mt,Gt))return;return Vt="passed-on",v}}),Vt)return{candidate:Oe,failureReason:Vt};let Wt=Array.from(Ot,([Mt,Gt])=>{let Ut=Array.from(Gt);return{name:Mt,detail:Ut.includes("any")?"any":Ut.join(" | ")}});return{candidate:Oe,events:Wt}}function ff(ee,te){let Oe=ee.members?`"${ee.calleeText}"`:ee.importedName==="default"?"the default export":`"${ee.importedName}"`;switch(te){case"module-not-found":return`"${ee.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Oe} isn't a function declared in "${ee.importSource}"`;case"parameter-not-found":return`no parameter of ${Oe} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Oe} passes it on`}}function mf(ee,te,{deferredEventNoSourceDiagnostics:Oe=[],untypedJsDocEventNames:Ot=[]}){let jt=new Map,Vt=[...ee.diagnostics??[]],Wt=!0;for(let{candidate:Xt,events:Jt,failureReason:Qt}of te){if(Qt){Wt=!1,Vt.push(a({component:ee.filePath,kind:"dispatch-escapes",name:Xt.dispatcherName,message:`\`${Xt.dispatcherName}\` is passed to \`${Xt.calleeText}\`, but sveld couldn't read the events it dispatches: ${ff(Xt,Qt)}. Document them with @event tags.`,...Xt.source?{source:Xt.source}:{},...Xt.ignored?{ignored:!0}:{}}));continue}for(let Yt of Jt??[]){if(jt.has(Yt.name))continue;jt.set(Yt.name,{type:"dispatched",name:Yt.name,detail:Yt.detail,...Xt.source?{source:Xt.source}:{}})}}if(Wt){for(let Xt of Oe)if(!jt.has(Xt.name))Vt.push(Xt)}if(ee.diagnostics=Vt,jt.size===0)return;let Mt=new Map,Gt=new Set;for(let Xt of ee.events)if(Xt.type==="dispatched")Gt.add(Xt.name);else if(!Mt.has(Xt.name))Mt.set(Xt.name,Xt);let Ut=new Set(Ot),Ht=new Map,qt=[];for(let Xt of jt.values()){if(Gt.has(Xt.name)){if(Ut.has(Xt.name)&&Xt.detail!==void 0)Ht.set(Xt.name,Xt.detail);continue}let Jt=Mt.get(Xt.name);if(!Jt){qt.push(Xt);continue}let Qt=Xt.source??Jt.source;qt.push({type:"dispatched",name:Xt.name,detail:Jt.detail??Xt.detail,...Jt.description?{description:Jt.description}:{},...Jt.deprecated===void 0?{}:{deprecated:Jt.deprecated},...Jt.tags?{tags:Jt.tags}:{},...Jt.internal?{internal:!0}:{},...Qt?{source:Qt}:{}})}if(qt.length===0&&Ht.size===0)return;let zt=new Set(qt.map((Xt)=>Xt.name));ee.events=[...ee.events.filter((Xt)=>Xt.type==="dispatched"||!zt.has(Xt.name)).map((Xt)=>{let Jt=Xt.type==="dispatched"?Ht.get(Xt.name):void 0;return Jt===void 0?Xt:{...Xt,detail:Jt}}),...qt].sort(ge)}var Gp={collect:(ee)=>ee.pendingDispatchEscapeCandidates??[],resolve:cf,apply:mf};function _s(ee){return(te)=>{let Oe=ee.collect(te);if(Oe.length===0)return;return(Ot,jt,Vt)=>ee.apply(Ot,ee.resolve(jt,Oe,Vt),te)}}var yf=[_s(Lp),_s(Mp),_s(Bp),_s(Gp)];async function Wp(ee,te,Oe,Ot){let jt=[];for(let Wt of ee){let Mt=Oe(Wt);if(Mt===void 0)continue;let Gt=yf.flatMap((Ut)=>Ut(Mt)??[]);if(Gt.length>0)jt.push({component:Wt,passes:Gt})}let Vt=new Map;if(jt.length===0)return Vt;await Hn();for(let{component:Wt,passes:Mt}of jt){let Gt=Ts(Ot),Ut=gf(te(Wt.filePath));for(let Ht of Mt)Ht(Wt,Ut,Gt);Vt.set(Wt.filePath,Array.from(Gt.cache.keys()))}return Vt}var xf=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,vf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),Ef=new Set(["svelte","html"]);function Sf(ee){let te=ee.trim();if(te==="")return null;let Oe=te.match(xf);if(Oe){let Ot=Oe[1].toLowerCase(),jt=Oe[2].trim();if(jt==="")return null;if(vf.has(Ot))return{kind:"compile",code:jt};if(Ef.has(Ot))return{kind:"syntax",code:jt};return null}if(te.startsWith("<"))return null;return{kind:"compile",code:te}}function Up(ee){if(!ee.isFunction)return"any";return`(${(ee.params??[]).map((Oe)=>`${Oe.name}${Oe.optional?"?":""}: any`).join(", ")}) => any`}function $s(ee,te,Oe,Ot,jt){let Vt=(ee??[]).filter((Mt)=>Mt.name==="example"),Wt=Vt.length>1;return Vt.flatMap((Mt,Gt)=>{let Ut=Sf(Mt.body);if(Ut===null)return[];return[{id:Wt?`${te}#${Gt}`:te,name:Wt?`${Oe} (example ${Gt+1})`:Oe,type:Ot,code:Ut.code,kind:Ut.kind,...jt?{source:jt}:{}}]})}function bf(ee){let te=[];for(let Oe of ee.props)te.push(...$s(Oe.tags,`prop:${Oe.name}`,Oe.name,Up(Oe),Oe.source));for(let Oe of ee.moduleExports)te.push(...$s(Oe.tags,`export:${Oe.name}`,Oe.name,Up(Oe),Oe.source));for(let Oe of ee.slots){let Ot=Oe.name??"default";te.push(...$s(Oe.tags,`slot:${Ot}`,Ot,"any",Oe.source))}for(let Oe of ee.events)te.push(...$s(Oe.tags,`event:${Oe.name}`,Oe.name,"any",Oe.source));return te}function Hp(ee,te){return ee.flatMap(({component:Oe,sources:Ot})=>{let jt=Ot.filter((Vt)=>Vt.kind===te);return jt.length===0?[]:[{component:Oe,sources:jt}]})}async function Cf(ee){let{formatParseError:te,parseSvelte:Oe}=await Hn(),Ot=new Map;for(let{component:jt,sources:Vt}of ee){let Wt=[];for(let Mt of Vt)try{Oe(Mt.code)}catch(Gt){Wt.push(a({component:jt.filePath,kind:"example-syntax-error",name:Mt.name,message:te(Gt),...Mt.source?{source:Mt.source}:{}}))}Ot.set(jt,Wt)}return Ot}async function wf(ee,te,Oe){let Ot=await te.checkExamples(ee.map(({component:Vt,sources:Wt})=>({moduleName:Vt.moduleName,filePath:Oe(Vt.filePath),sources:Wt}))),jt=new Map;for(let{component:Vt,sources:Wt}of ee){let Mt=Ot.get(Oe(Vt.filePath));if(!Mt||Mt.length===0)continue;let Gt=new Map(Wt.map((Ut)=>[Ut.id,Ut.source]));jt.set(Vt,Mt.map((Ut)=>{let Ht=Gt.get(Ut.id);return a({component:Vt.filePath,kind:"example-compile-error",name:Ut.name,message:Ut.message,...Ht?{source:Ht}:{}})}))}return jt}async function Kp(ee,te,Oe,Ot){let jt=Array.from(ee,(Ut)=>({component:Ut,sources:bf(Ut)})),Vt=te===!0?Hp(jt,"compile"):[],Wt=Hp(jt,"syntax"),Mt=new Map,Gt=(Ut)=>{for(let[Ht,qt]of Ut)Mt.set(Ht,[...Mt.get(Ht)??[],...qt])};if(Wt.length>0)Gt(await Cf(Wt));if(Vt.length>0){let{TypeResolver:Ut}=await import("./chunk-6hzm92zg.js"),Ht=await Ut.create(Oe);if(!Ht.ok)throw Error(`sveld: \`checkExamples\` ${Ht.message}.`);let qt=Ht.resolver;try{Gt(await wf(Vt,qt,Ot))}finally{await qt.dispose()}}return Mt}import{hash as Tf}from"node:crypto";import{mkdirSync as kf,readFileSync as Af,renameSync as Pf,writeFileSync as qp}from"node:fs";import{dirname as zp,isAbsolute as _f,join as $f,resolve as Yr}from"node:path";var Xp=11,Nf=$f("node_modules",".cache","sveld","parse-cache.json"),Df="0ef077d6d6e9dc85";function Jp(){return`${ds}+${Df}+svelte@${Di}`}function Rf(ee){let te=q(ee,["package.json"]);return te===null?Yr(ee):zp(te)}function Yp(ee,te){let Oe=Rf(ee);if(typeof te==="string")return _f(te)?te:Yr(Oe,te);return Yr(Oe,Nf)}function Ns(ee){return Tf("sha256",ee,"hex")}function Qr(){return{formatVersion:Xp,toolchainVersion:Jp(),entries:{}}}function If(ee){try{let te=JSON.parse(Af(ee,"utf-8"));if(te.formatVersion!==Xp||te.toolchainVersion!==Jp())return Qr();return te}catch{return Qr()}}class Zr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(ee){this.cacheFilePath=ee,this.file=If(ee),this.savedEntryCount=Object.keys(this.file.entries).length}has(ee,te){return this.lookup(ee,te)!==void 0}lookup(ee,te){let Oe=this.next.get(ee);if(Oe?.hash===te)return Oe;let Ot=this.file.entries[ee];return Ot?.hash===te?Ot:void 0}get(ee,te){let Oe=this.lookup(ee,te);if(Oe===void 0)return null;this.next.set(ee,Oe);let{component:Ot,typeScriptMetadata:jt,propIgnores:Vt,pending:Wt}=structuredClone({component:Oe.component,typeScriptMetadata:Oe.typeScriptMetadata,propIgnores:Oe.propIgnores,pending:Oe.pending});if(jt!==void 0)Ot[E]=jt;if(Vt!==void 0)Ot[L]=Vt;return Wt===void 0?{component:Ot}:{component:Ot,pending:Wt}}set(ee,te,{component:Oe,pending:Ot}){this.dirty=!0,this.next.set(ee,{hash:te,...structuredClone({component:Oe,typeScriptMetadata:Oe[E],propIgnores:Oe[L],pending:Ot})})}getGeneratedText(ee,te){let Oe=this.next.get(ee);if(Oe?.generatedText===void 0||Oe.generatedText.key!==te)return;return Oe.generatedText.text}setGeneratedText(ee,te,Oe){let Ot=this.next.get(ee);if(Ot===void 0)return;if(Ot.generatedText?.key===te&&Ot.generatedText.text===Oe)return;Ot.generatedText={key:te,text:Oe},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,kf(zp(this.cacheFilePath),{recursive:!0});let ee={...Qr(),entries:Object.fromEntries(this.next)},te=JSON.stringify(ee),Oe=`${this.cacheFilePath}.${process.pid}.tmp`;try{qp(Oe,te),Pf(Oe,this.cacheFilePath)}catch{try{qp(this.cacheFilePath,te)}catch{}}}}import{dirname as Of,relative as Lf,resolve as Mf}from"node:path";async function Qp(ee,te={}){await Hn();let Oe=Mf(ee),Ot=Of(Oe),jt=(Mt)=>n(`./${Lf(Ot,Mt)}`),Vt=ks(Oe,{...Ts(te.graph??new Kn),onAmbiguousStarExport:(Mt,Gt,Ut)=>{if(Mt!==Oe||!te.diagnostics)return;if(Ut.every((Xt)=>Xt.declFile.endsWith(".svelte")))return;let Ht=Array.from(new Set(Ut.map((Xt)=>jt(Xt.declFile)))),qt=Ht.map((Xt)=>`"${Xt}"`),zt=`${qt.slice(0,-1).join(", ")} and ${qt[qt.length-1]}`;te.diagnostics.push(a({component:jt(Oe),kind:"export-ambiguous",name:Gt,message:`"${Gt}" 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 { ${Gt} } from "${Ht[0]}"\`).`}))}}),Wt=new Map;for(let Mt of Vt){if(Mt.name==="default"||Mt.declFile.endsWith(".svelte"))continue;let{declFile:Gt,returnType:Ut,literalValue:Ht,primitiveLiteral:qt,declaredType:zt,functionNode:Xt,namespaceFile:Jt,...Qt}=Mt,Yt=jt(Gt);if(Jt!==void 0)Qt.type=`typeof import(${JSON.stringify(jt(Jt))})`;Wt.set(Mt.name,{...Qt,source:Yt})}return Array.from(Wt.values()).sort((Mt,Gt)=>u(Mt.name,Gt.name))}async function jf(ee){let te=await Promise.all(Array.from(ee,async(Oe)=>{try{return[Oe,await Bf(Oe,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Oe}:`,Ot),[Oe,null]}}));return new Map(te)}function ec(ee){if(ee.length===0)return;console.error(`sveld: failed to parse ${ee.length} component(s):`);for(let{filePath:te,message:Oe}of ee)console.error(` - ${te}: ${Oe}`)}class Bi{input;glob;options;graph=new Kn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(ee,te,Oe={}){this.input=ee,this.glob=te,this.options=Oe}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Kn,this.collected=qr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=ws(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=Ff(this.input).isFile()?Zp(this.input):null,this.cache=this.options.cache===!1?void 0:new Zr(Yp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),ec(Array.from(this.parseErrors.values())),this.assemble()}async update(ee){let te=ee.map((Ut)=>Zp(Ut));if(this.graph.invalidate(...te),te.length===0)return{result:this.assemble(),reparsed:[]};let Oe=this.entryFile!==null&&te.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Ut,exports:Ht,allComponentEntries:qt,resolveComponentFilePath:zt}=this.collected;Kr(this.graph,Ut,Ht,qt,zt,this.globMergeState)}this.indexEntries();let Ot=this.componentPaths();for(let Ut of this.records.keys())if(!Ot.has(Ut))this.records.delete(Ut);for(let Ut of this.parseErrors.keys())if(!Ot.has(Ut))this.parseErrors.delete(Ut);let jt=Array.from(this.records).flatMap(([Ut,{crossFileReads:Ht}])=>Ht?.some((qt)=>te.includes(qt))?[Ut]:[]),Vt=new Set([...te.filter((Ut)=>_n.test(Ut)),...Oe,...jt]),Wt=new Set(Array.from(Ot).filter((Ut)=>Vt.has(Ut))),Mt=await this.process(Wt),Gt=this.assemble();return ec(Gt.errors),{result:Gt,reparsed:Mt}}async recollect(){let ee=this.collected,te=qr(this.input,this.glob,this.documentExports,this.graph),Oe=[];for(let[Ot,jt]of Object.entries(te.exports)){let Vt=te.resolveComponentFilePath(jt.source),Wt=Object.hasOwn(ee.exports,Ot)?ee.exports[Ot]:void 0;if(Wt===void 0||ee.resolveComponentFilePath(Wt.source)!==Vt)Oe.push(Vt)}return this.collected=te,this.globMergeState=ws(te.allComponentEntries,te.resolveComponentFilePath),await this.readEntryExports(),Oe}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Qp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:ee,allComponentEntries:te,resolveComponentFilePath:Oe}=this.collected,Ot=new Set;for(let[,jt]of[...Object.entries(ee),...te])if(mi(jt.source))Ot.add(Oe(jt.source));return Ot}indexEntries(){let{exports:ee,allComponentEntries:te,resolveComponentFilePath:Oe}=this.collected;this.canonicalEntries=new Map;for(let Ot of[Object.entries(ee),te])for(let jt of Ot){if(!mi(jt[1].source))continue;this.canonicalEntries.set(Oe(jt[1].source),this.entryIdentity(Ot,jt))}}entryIdentity(ee,[te,{source:Oe}]){return{moduleName:$p(te,Oe,ee.length,this.warnedModuleNames),filePath:n(Oe)}}canonicalEntry(ee){let te=this.canonicalEntries.get(ee);if(te===void 0)throw Error(`sveld: no entry lists ${ee}.`);return te}async process(ee){let te=new Map,Oe=await this.parse(ee,te);this.cache?.save();let Ot=await this.settle(Oe);for(let jt of ee)this.records.delete(jt),this.parseErrors.delete(jt);for(let[jt,Vt]of Ot)this.records.set(jt,Vt);for(let[jt,Vt]of te)this.parseErrors.set(jt,Vt);return Array.from(Ot.keys())}async parse(ee,te){let Oe=await jf(ee),Ot=this.cache,jt=new Map,Vt=new Set;if(Ot)for(let[Mt,Gt]of Oe){if(Gt===null)continue;let Ut=Ns(Gt);if(jt.set(Mt,Ut),!Ot.has(Mt,Ut))Vt.add(Mt)}if(ee.size>0&&(!Ot||Vt.size>0))await Hn();let Wt=new Map;for(let Mt of ee){let Gt=Oe.get(Mt);if(Gt===null||Gt===void 0)continue;let Ut=this.parseOne(Mt,Gt,jt.get(Mt),te);if(Ut)Wt.set(Mt,Ut)}return Wt}parseOne(ee,te,Oe,Ot){let jt=Oe===void 0?null:this.cache?.get(ee,Oe);if(jt)return jt;let{moduleName:Vt,filePath:Wt}=this.canonicalEntry(ee),Mt;try{Mt=new(Dn()).ComponentParser().parse(te,{moduleName:Vt,filePath:Wt})}catch(Gt){if(this.options.failFast)throw Gt;Ot.set(ee,{filePath:Wt,moduleName:Vt,message:Gt instanceof Error?Gt.message:String(Gt),stack:Gt instanceof Error?Gt.stack:void 0});return}if(Oe!==void 0)this.cache?.set(ee,Oe,Mt);return Mt}async settle(ee){let{rootDir:te,resolveComponentFilePath:Oe}=this.collected,Ot=new Map,jt=new Map;for(let[Gt,{component:Ut,pending:Ht}]of ee){let qt={...this.canonicalEntry(Gt),...Ut};Ot.set(Gt,qt),jt.set(qt,Ht)}let{checkExamples:Vt}=this.options;if(Vt){let Gt=await Kp(Ot.values(),Vt,te,Oe);for(let[Ut,Ht]of Gt)li(Ut,Ht)}let Wt=await Wp(Ot.values(),Oe,(Gt)=>jt.get(Gt),this.graph),Mt=new Map;for(let[Gt,Ut]of Ot){let{moduleName:Ht,filePath:qt,...zt}=Ut,Xt=Wt.get(qt);Mt.set(Gt,Xt===void 0?{component:zt}:{component:zt,crossFileReads:Xt})}return Mt}assemble(){let{exports:ee,allComponentEntries:te,resolveComponentFilePath:Oe}=this.collected,Ot=this.cache,jt=(qt,zt)=>{let{source:Xt}=zt[1];if(!mi(Xt))return;let Jt=this.records.get(Oe(Xt));if(Jt===void 0)return;return{component:{...this.entryIdentity(qt,zt),...Jt.component},record:Jt}},Vt=new Map,Wt=Ot?new Map:void 0,Mt=Ot?new Map:void 0;for(let qt of te){let zt=jt(te,qt);if(zt===void 0)continue;let{filePath:Xt}=zt.component;Vt.set(Xt,zt.component),(zt.record.crossFileReads===void 0?Wt:Mt)?.set(Xt,Oe(qt[1].source))}let Gt=lp(Vt,Oe,this.graph);for(let qt of Vt.values())li(qt,[...Gt(qt),...cp(qt)]);let Ut=new Map,Ht=Object.entries(ee);for(let qt of Ht){let zt=jt(Ht,qt);if(zt===void 0)continue;let Xt=Vt.get(zt.component.filePath);if(Xt)zt.component.diagnostics=Xt.diagnostics;Ut.set(zt.component.moduleName,zt.component)}return{exports:ee,entryExports:this.entryExports,components:Ut,allComponentsForTypes:Vt,errors:Array.from(this.parseErrors.values()),diagnostics:Ao(_o([...Array.from(Vt.values()).flatMap((qt)=>qt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ot,resolvedPathByFilePath:Wt,crossFileResolvedPathByFilePath:Mt}}}function ji(ee){return{failFast:ee?.failFast,documentExports:ee?.documentExports===!0,cache:ee?.cache,checkExamples:ee?.checkExamples==="syntax"?"syntax":ee?.checkExamples===!0,diagnostics:ee?.diagnostics}}async function Vi(ee,te,Oe={}){return new Bi(ee,te,Oe).build()}import{existsSync as eo,readFileSync as Vf}from"node:fs";import{isAbsolute as Gf,join as nc}from"node:path";var Gi='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function tc(ee){return Gf(ee)?ee:nc(process.cwd(),ee)}function $e(ee){if(ee){let jt=tc(ee);if(eo(jt))return{entry:Z(ee)};return{entry:null,configured:!0,message:`Invalid entry point: ${jt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let te=nc(process.cwd(),"package.json");if(!eo(te))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Oe;try{Oe=gp(JSON.parse(Vf(te,"utf-8")))}catch(jt){throw console.error("Error reading package.json:",jt),jt}let Ot=Oe.svelte?.trim();if(!Ot)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(!eo(tc(Ot)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ot}", which does not exist.`};return{entry:Z(Ot)}}function Ds(ee){let te=$e(ee);if(te.entry===null)console.error(te.message);return te.entry}async function ic(ee,te,Oe={}){let Ot=new Bi(ee,te,{...Oe,failFast:!1}),jt=await Ot.build();return{get result(){return Promise.resolve(jt)},async update(Vt){let Wt=await Ot.update(Vt);return jt=Wt.result,Wt}}}import no from"node:path";function sc(ee){let te=new Map,Oe=[];for(let[Ot,jt]of Object.entries(ee)){if(jt.star){Oe.push(`export * from "${jt.source}";`);continue}let Vt=te.get(jt.source)??[];Vt.push({id:Ot,exportee:jt}),te.set(jt.source,Vt)}for(let[Ot,jt]of te){let Vt=_n.test(Ot),Wt=jt.some(({id:zt,exportee:Xt})=>zt!=="default"&&Xt.default),Mt=jt.some(({exportee:zt})=>!zt.default),Gt=Vt&&Wt&&Mt,Ut=[],Ht=[],qt=[];for(let{id:zt,exportee:Xt}of jt){if(zt==="default"){Ht.push(`export { default } from "${Ot}";`);continue}if(Xt.default)if(Xt.mixed)Ht.push(`export { default as ${zt} } from "${Ot}";`),Ht.push(`export { default } from "${Ot}";`);else qt.push(`default as ${zt}`);else if(Vt&&!Gt)qt.push(`default as ${zt}`);else Ut.push(Xt.imported===void 0?zt:`${Xt.imported} as ${zt}`)}if(qt.length>0&&Ut.length>0)Oe.push(`export { ${[...qt,...Ut].join(", ")} } from "${Ot}";`);else{if(Ut.length>0)Oe.push(`export { ${Ut.join(", ")} } from "${Ot}";`);if(qt.length>0)Oe.push(`export { ${qt.join(", ")} } from "${Ot}";`)}Oe.push(...Ht)}return Oe.join(`
|
|
140
|
-
`)}function
|
|
141
|
-
`)}function
|
|
139
|
+
`))}var td=[...mi,".svelte"];function nd(ee){let te=ee.trim();if(te.length<2)return;let Oe=te[0],Ot=te[te.length-1];if((Oe==='"'||Oe==="'"||Oe==="`")&&Oe===Ot)return te.slice(1,-1);return}function lp(ee){let te=[],Oe=ee.moduleExports.filter((jt)=>jt.kind==="re-export");if(Oe.length===0)return te;let Ot=new Set([vi(ee.moduleName),Mi(ee.moduleName)]);for(let jt of Oe){if(!Ot.has(jt.name))continue;te.push(a({component:ee.filePath,kind:"module-export-conflict",name:jt.name,message:`Re-export "${jt.name}" has the same name as the generated "${jt.name}" type; the .d.ts won't type-check if "${jt.reExport?.from}" exports a type by that name.`,source:jt.source}))}return te}function up(ee,te,Oe){let Ot=new Map(Array.from(ee.values()).map((jt)=>[te(jt.filePath),jt]));return(jt)=>{let Vt=jt.extends;if(!Vt)return[];let Wt=nd(Vt.import);if(Wt===void 0||!Wt.startsWith(".")&&!Wt.startsWith("/"))return[];let Mt=te(jt.filePath),Gt=Oe.resolve(Wt,ed(Mt),td);if(Gt===null)return[a({component:jt.filePath,kind:"extend-props-target-missing",name:Vt.interface,message:`@extends/@extendProps target "${Wt}" was not found on disk.`})];let Ut=Ot.get(Gt);if(!Ut)return[];let Ht=vi(Ut.moduleName);if(Ir(Vt.interface)!==Ht)return[a({component:jt.filePath,kind:"extend-props-target-missing",name:Vt.interface,message:`@extends/@extendProps names "${Vt.interface}", but "${Wt}" generates "${Ht}".`})];let qt=[];for(let zt of jt.props){let Xt=Ut.props.find((Jt)=>Jt.name===zt.name);if(Xt&&Xt.type!==zt.type){let Jt=a({component:jt.filePath,kind:"extend-props-override",name:zt.name,message:`Own prop "${zt.name}" (${zt.type}) overrides "${Ht}"'s "${zt.name}" (${Xt.type}).`,source:zt.source}),Yt=Eo(jt)?.[zt.name]?.some((nn)=>nn===""||nn===Jt.code);qt.push(Yt?{...Jt,ignored:!0}:Jt)}}return qt}}import{lstatSync as Cd,readFileSync as wd,realpathSync as Td,statSync as kd}from"node:fs";import{dirname as Ad,isAbsolute as Pd,join as Pp,parse as _d,relative as zr,resolve as Bi}from"node:path";function Z(ee){return ee}function Nn(ee){if(ee==="")return ee;return ee==="."||ee===".."||ee.startsWith("./")||ee.startsWith("../")?ee:`./${ee}`}import{readFileSync as kp}from"node:fs";import{dirname as Kr,join as Sd,relative as wp,resolve as Tp}from"node:path";import{readFileSync as hd,statSync as dd}from"node:fs";import{basename as Ur,dirname as Ts,isAbsolute as fd,join as md,resolve as gd}from"node:path";import{existsSync as fp,readdirSync as id}from"node:fs";import{dirname as hp,join as mp,resolve as sd}from"node:path";function q(ee,te){for(let Oe=sd(ee);;Oe=hp(Oe)){for(let Ot of te){let jt=mp(Oe,Ot);if(fp(jt))return jt}if(hp(Oe)===Oe)return null}}function dp(ee){return ee.normalize("NFC").toLowerCase()}class Fr{listings=new Map;clear(){this.listings.clear()}entries(ee){return this.read(ee)?.entries??null}entry(ee,te){let Oe=this.read(ee);if(Oe===null)return;if(Oe.byName===void 0){Oe.byName=new Map;for(let Ot of Oe.entries)Oe.byName.set(Ot.name,Ot)}return Oe.byName.get(te)}has(ee,te){let Oe=this.read(ee);if(Oe===null)return!1;if(Oe.names.has(te))return!0;if(Oe.folded===void 0){Oe.folded=new Map;for(let jt of Oe.names)Oe.folded.set(dp(jt),jt)}let Ot=Oe.folded.get(dp(te));return Ot!==void 0&&Ot!==te&&fp(mp(ee,te))}read(ee){let te=this.listings.get(ee);if(te!==void 0)return te;try{let Oe=id(ee,{withFileTypes:!0}),Ot=new Set;for(let jt of Oe)Ot.add(jt.name);te={entries:Oe,names:Ot}}catch{te=null}return this.listings.set(ee,te),te}}var Br=!1;function G(ee){Br=ee}function Bn(ee){if(!Br)console.error(ee)}function gp(ee){if(!Br)console.error(ee)}function Ee(ee){if(ee instanceof e)return ee.start?`${ee.reason} (${ee.start.line}:${ee.start.column})`:ee.reason;return ee instanceof Error?ee.message:String(ee)}var Fi=null,jr=null;function Hn(){if(Fi)return Promise.resolve(Fi);if(!jr)jr=import("./chunk-r6xdep4j.js").then((ee)=>(Fi=ee,ee));return jr}function Dn(){if(!Fi)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Fi}import{existsSync as Vr,readFileSync as rd}from"node:fs";import{dirname as Sp,isAbsolute as bp,relative as od,resolve as Gr}from"node:path";function yp(ee){if(!i(ee))return{};let te={};if(typeof ee.svelte==="string")te.svelte=ee.svelte;if(typeof ee.name==="string")te.name=ee.name;if(typeof ee.description==="string")te.description=ee.description;return te}function xp(ee){if(!i(ee))return{};let te={};if(typeof ee.extends==="string")te.extends=ee.extends;if(i(ee.compilerOptions)){let Oe={};if(typeof ee.compilerOptions.baseUrl==="string")Oe.baseUrl=ee.compilerOptions.baseUrl;if(i(ee.compilerOptions.paths)){let Ot={};for(let[jt,Vt]of Object.entries(ee.compilerOptions.paths))if(Array.isArray(Vt)&&Vt.every((Wt)=>typeof Wt==="string"))Ot[jt]=Vt;if(Object.keys(Ot).length>0)Oe.paths=Ot}if(Object.keys(Oe).length>0)te.compilerOptions=Oe}return te}var ad=["tsconfig.json","jsconfig.json"],vp=new Map,pd=/\/\*[\s\S]*?\*\/|\/\/.*/g,cd=[".svelte",...mi];class W extends Error{specifier;fromFile;searched;constructor(ee,te,Oe){super(`cannot resolve "${ee}" from ${te||"."} (${Oe})`);this.name="UnresolvedModuleError",this.specifier=ee,this.fromFile=te,this.searched=Oe}}function ld(ee){if(Vr(ee))return!0;return cd.some((te)=>Vr(ee+te))}function Ep(ee){let te=ee.indexOf("*");return te===-1?ee.length:te}function Cp(ee,te){if(te.has(ee))return te.get(ee)??null;try{let Oe=rd(ee,"utf-8"),Ot;try{Ot=JSON.parse(Oe)}catch{let Vt=Oe.replace(pd,"");Ot=JSON.parse(Vt)}let jt=xp(Ot);if(jt.extends){let Vt=bp(jt.extends)?jt.extends:Gr(Sp(ee),jt.extends),Wt=Vt.endsWith(".json")?Vt:`${Vt}.json`;if(Vr(Wt)){let Mt=Cp(Wt,te);if(Mt)jt.compilerOptions={...Mt.compilerOptions,...jt.compilerOptions,paths:{...Mt.compilerOptions?.paths,...jt.compilerOptions?.paths}}}}return te.set(ee,jt),jt}catch{return te.set(ee,null),null}}function ud(ee){let te=vp.get(ee);if(!te){let Oe=ee.split("*").map(_).join("(.*)");te=new RegExp(`^${Oe}$`),vp.set(ee,te)}return te}class Wr{configs=new Map;lookup(ee,te){if(ee.startsWith(".")||bp(ee))return{resolved:ee,unresolved:!1,searched:""};let Oe=q(te,ad),Ot=Oe?Cp(Oe,this.configs)?.compilerOptions:void 0,jt=Ot?.paths;if(!Oe||!Ot||!jt)return{resolved:ee,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Vt=Gr(Sp(Oe),Ot.baseUrl??"."),Wt=Object.entries(jt).sort(([Mt],[Gt])=>Ep(Gt)-Ep(Mt));for(let[Mt,Gt]of Wt){let Ut=ee.match(ud(Mt));if(!Ut)continue;let Ht;for(let qt of Gt){let zt=qt;for(let Jt=1;Jt<Ut.length;Jt++)zt=zt.replace("*",Ut[Jt]);let Xt=Gr(Vt,zt);if(Ht??=Xt,ld(Xt))return{resolved:Xt,unresolved:!1,searched:Oe}}return{resolved:Ht??ee,unresolved:!1,searched:Oe}}return{resolved:ee,unresolved:!0,searched:`tsconfig paths (${Oe})`}}absolute(ee,te){return this.lookup(ee,te).resolved}relative(ee,te){let Oe=this.absolute(ee,te);if(Oe===ee)return ee;return Nn(n(od(te,Oe)))}}var yd=/\.[mc]?jsx?$/,xd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function vd(ee){return ee==="."||ee===".."||ee.startsWith("./")||ee.startsWith("../")||fd(ee)}class Kn{aliases=new Wr;listings=new Fr;modules=new Map;programs=new Map;listDirectory(ee){return this.listings.entries(ee)}exists(ee){return this.listings.has(Ts(ee),Ur(ee))}resolve(ee,te,Oe=mi){let Ot=this.aliases.absolute(ee,te);if(Ot===ee&&!vd(ee))return null;let jt=gd(te,Ot),Vt=Ts(jt),Wt=Ur(jt),Mt=this.listings.has(Vt,Wt),Gt;if(Mt){let Ut=this.listings.entry(Vt,Wt);if(Gt=Ut&&!Ut.isSymbolicLink()?Ut:dd(jt,{throwIfNoEntry:!1}),Gt?.isFile())return jt}for(let Ut of Oe)if(this.listings.has(Vt,Wt+Ut))return jt+Ut;if(!Mt)return this.typeScriptCounterpart(jt)??null;if(Gt?.isDirectory()){for(let Ut of Oe)if(this.listings.has(jt,`index${Ut}`))return md(jt,`index${Ut}`)}return null}parse(ee){let te=this.modules.get(ee);if(te===void 0)te=Ed(ee),this.modules.set(ee,te);return te}parseJavaScript(ee,te){let Oe=this.programs.get(ee);if(Oe?.source===te)return Oe.ast;let Ot;try{Ot=he(te)}catch(jt){throw Error(Ee(jt))}return this.programs.set(ee,{source:te,ast:Ot}),Ot}invalidate(...ee){this.listings.clear();for(let te of ee)this.modules.delete(te),this.programs.delete(te)}typeScriptCounterpart(ee){let te=yd.exec(ee)?.[0];if(te===void 0)return;let Oe=ee.slice(0,-te.length),Ot=Ts(Oe),jt=Ur(Oe);for(let Vt of xd[te]??[])if(this.listings.has(Ot,jt+Vt))return Oe+Vt;return}}function Ed(ee){let te;try{te=hd(ee,"utf-8")}catch{return null}try{let Oe=ee.endsWith(".svelte")?Dn().parseSvelteScripts(te).module?.content.body??[]:Dn().parseModule(te,{typescript:!0}).body;return{source:{text:te,filePath:ee,dir:Ts(ee)},body:Oe}}catch(Oe){return gp(`Warning: sveld couldn't parse ${ee} to read its exports (${Ee(Oe)}); skipping it.`),null}}function Hr(ee){return ee.type==="Identifier"?ee.name:ee.value}function bd(ee,te,Oe,Ot){let jt=ee.resolve(te,Oe);if(!jt)return null;let Vt=Kr(jt);if(Ot.has(jt))return{dir:Vt,exports:{}};Ot.add(jt);try{return{dir:Vt,exports:qr(ee,kp(jt,"utf-8"),Vt,Ot,jt)}}catch{return{dir:Vt,exports:{}}}finally{Ot.delete(jt)}}function Ap(ee,te,Oe=new Kn,Ot=new Set,jt=te){return qr(Oe,ee,te,Ot,jt)}function qr(ee,te,Oe,Ot,jt){let Vt=ee.parseJavaScript(jt,te),Wt={};for(let Mt of Vt.body)if(Mt.type==="ExportDefaultDeclaration"){if(Mt.declaration.type!=="Identifier")continue;let Gt=Mt.declaration.name;if(Gt in Wt)Wt[Gt].default=!0;else Wt[Gt]={source:Nn(""),default:!0}}else if(Mt.type==="ExportAllDeclaration"){let Gt=Mt.source.value,Ut=ee.resolve(Gt,Oe);if(!Ut){let Xt=ee.aliases.lookup(Gt,Oe);throw new W(Gt,jt,Xt.unresolved?Xt.searched:"no matching file or index found")}if(Ot.has(Ut))continue;Ot.add(Ut);let Ht=kp(Ut,"utf-8"),qt=qr(ee,Ht,Kr(Ut),Ot,Ut);Ot.delete(Ut);let zt=Object.entries(qt);if(zt.length===0&&!_n.test(Gt)){let Xt=Nn(n(Gt));Wt[`*:${Gt}`]={source:Xt,default:!1,star:!0}}for(let[Xt,Jt]of zt){let Qt=Nn(n(Jt.source.startsWith(".")?`./${wp(Oe,Tp(Kr(Ut),Jt.source))}`:`./${Sd(Gt,Jt.source)}`));Wt[Xt]={...Jt,source:Qt}}}else if(Mt.type==="ExportNamedDeclaration"){let Gt=Mt.source?.value,Ut=Gt!==void 0&&_n.test(Gt);if(Ut){let zt=ee.aliases.lookup(Gt,Oe);if(zt.unresolved)throw new W(Gt,jt,zt.searched)}let qt=Gt!==void 0&&!Ut?bd(ee,Gt,Oe,Ot):void 0;if(qt===null){console.warn(`sveld: could not resolve re-exported module "${Gt}" from barrel "${Oe||"."}"; skipping.`);continue}for(let zt of Mt.specifiers){let Xt=Hr(zt.exported),Jt=Hr(zt.local),Qt=Xt||Jt,Yt=qt?.exports[Jt],nn=Yt?Nn(n(`./${wp(Oe,Tp(qt.dir,Yt.source))}`)):Nn(ee.aliases.relative(Gt??"",Oe)),sn=Yt?Yt.default:Jt==="default",cn=Yt?Yt.imported??Jt:Jt;if(Qt in Wt){if(Wt[Qt].mixed=!0,!Wt[Qt].source)Wt[Qt].source=nn}else Wt[Qt]={source:nn,default:sn,...!sn&&Gt!==void 0&&cn!==Qt?{imported:cn}:{}}}}else if(Mt.type==="ImportDeclaration"){let Gt=Mt.specifiers[0];if(!Gt)continue;let Ut=Gt.local.name,Ht=Nn(ee.aliases.relative(Mt.source.value,Oe)),qt=Gt.type==="ImportSpecifier"?Hr(Gt.imported):Ut;if(Ut in Wt){if(!Wt[Ut].source)Wt[Ut].source=Ht}else Wt[Ut]={source:Ht,default:Ut==="default",...qt===Ut?{}:{imported:qt}}}return Wt}var $d=/-/g,Nd=/[^A-Za-z0-9_$]/g,Dd=/^[0-9]/;function Rd(ee,te){let Oe=ee.replace(Nd,""),Ot=Dd.test(Oe)?`_${Oe}`:Oe;if(Ot!==ee&&!te?.has(ee))te?.add(ee),console.warn(`Warning: "${ee}" is not a valid identifier; using "${Ot}" instead.`);return Ot}function _p(ee,te){return Rd(_d(ee).name.replace($d,""),te)}function $p(ee,te,Oe=[],Ot=new Set,jt){let Vt;try{Vt=jt??Td(te)}catch{return Oe}if(Ot.has(Vt))return Oe;Ot.add(Vt);let Wt=ee.listDirectory(te);if(Wt===null)return Oe;for(let Mt of Wt){if(Mt.name.startsWith("."))continue;let Gt=Pp(te,Mt.name),Ut=Mt.isSymbolicLink(),Ht=Ut?kd(Gt,{throwIfNoEntry:!1}):Mt;if(!Ht)continue;if(Ht.isDirectory())$p(ee,Gt,Oe,Ot,Ut?void 0:Pp(Vt,Mt.name));else if(Ht.isFile()&&Mt.name.endsWith(".svelte"))Oe.push(Gt)}return Oe}function Id(ee,te){return $p(ee,te).map((Oe)=>({moduleName:_p(Oe),source:Nn(n(`./${zr(te,Oe)}`))})).sort((Oe,Ot)=>u(Oe.source,Ot.source))}function Od(ee){return!gi(ee)}function Ld(ee,te){let Oe=ee.endsWith("/")?ee:`${ee}/`;return te.startsWith(Oe)}function ks(ee,te){return{seenPaths:new Set(ee.map(([,Oe])=>te(Oe.source))),seenModuleNamePaths:new Map(ee.map(([Oe,Ot])=>[Oe,te(Ot.source)])),warnedModuleNames:new Set}}function Xr(ee,te,Oe,Ot,jt,Vt){for(let{moduleName:Wt,source:Mt}of Id(ee,te)){let Gt=jt(Mt),Ut=Oe[Wt];if(Ut&&Od(Ut.source)&&Ld(Ut.source,Mt)){Vt.seenPaths.delete(jt(Ut.source)),Ut.source=Mt,Vt.seenPaths.add(Gt),Vt.seenModuleNamePaths.set(Wt,Gt);continue}if(Vt.seenPaths.has(Gt))continue;Vt.seenPaths.add(Gt);let Ht=Vt.seenModuleNamePaths.get(Wt);if(Ht===void 0)Vt.seenModuleNamePaths.set(Wt,Gt);else if(Ht!==Gt&&!Vt.warnedModuleNames.has(Wt))Vt.warnedModuleNames.add(Wt),console.warn(`Warning: multiple components named "${Wt}" found (${n(zr(te,Ht))} and ${n(zr(te,Gt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Wt,{source:Mt,default:!1}])}}function Jr(ee,te,Oe,Ot){let jt=Cd(ee).isFile(),Vt=jt?Ad(ee):ee,Wt=Bi(Vt),Mt=new Map,Gt=(qt)=>{let zt=Mt.get(qt);if(zt===void 0)zt=Pd(qt)?Bi(qt):Bi(Wt,qt),Mt.set(qt,zt);return zt},Ut={};if(jt){let qt=wd(ee,"utf-8");try{Ut=Ap(qt,Wt,Ot,new Set([Bi(ee)]),Bi(ee))}catch(zt){if(!Oe)throw zt;let Xt=zt instanceof Error?zt.message:String(zt);console.warn(`Warning: Failed to parse component exports from ${ee}: ${Xt}`)}}let Ht=Object.entries(Ut);if(te){let qt=ks(Ht,Gt);if(Xr(Ot,Wt,Ut,Ht,Gt,qt),!jt)Ut=Object.fromEntries(Ht.map(([zt,Xt])=>[zt,{...Xt,default:!0}]))}return{exports:Ut,allComponentEntries:Ht,rootDir:Wt,resolveComponentFilePath:Gt}}function Np(ee,te,Oe,Ot){if(Oe!==1||ee!=="default")return ee;return _p(te,Ot)}import{dirname as xf}from"node:path";import{resolve as Md}from"node:path";var Fd=/\r?\n/,Bd=/^\s*\*+/;function As(ee){return{graph:ee,cache:new Map,computing:new Set}}function xn(ee){return ee?.type==="Identifier"?ee.name:void 0}function jd(ee){let te=ee.trimEnd();for(;;){let Oe=te.lastIndexOf(`
|
|
140
|
+
`)+1;if(te.slice(Oe).trimStart().startsWith("//")){te=te.slice(0,Oe).trimEnd();continue}let Ot=te.endsWith("*/")?te.lastIndexOf("/*",te.length-3):-1;if(Ot!==-1&&te[Ot+2]!=="*"){te=te.slice(0,Ot).trimEnd();continue}return te}}function Vd(ee,te){let Oe=jd(ee.slice(0,te));if(!Oe.endsWith("*/"))return;let Ot=Oe.length-2,jt=Oe.lastIndexOf("/**",Ot);if(jt===-1)return;return Oe.slice(jt,Ot+2)}function Gd(ee){let te=[];for(let Oe of ee.slice(3,-2).split(Fd)){let Ot=Oe.replace(Bd,"").trim();if(Ot.startsWith("@"))break;if(Ot)te.push(Ot)}return te.join(" ")||void 0}function si(ee,te){if(!te)return;return ee.text.slice(te.start,te.end)}function Wd(ee,te){return"typeAnnotation"in te?si(ee,te.typeAnnotation?.typeAnnotation):void 0}function Rp(ee,te){return si(ee,te.returnType?.typeAnnotation)}function Yr(ee,te,Oe){return`(${te.params.map((jt)=>si(ee,jt)??"").join(", ")}) => ${Rp(ee,te)??Oe??"any"}`}function Ip(ee){if(ee.type==="Literal"){let te=ee.value;if(typeof te==="string")return"string";if(typeof te==="number")return"number";if(typeof te==="boolean")return"boolean"}if(ee.type==="TemplateLiteral")return"string";if(ee.type==="UnaryExpression"&&(ee.operator==="-"||ee.operator==="+"))return ee.argument.type==="Literal"&&typeof ee.argument.value==="number"?"number":void 0;if(ee.type==="CallExpression"&&ee.callee.type==="Identifier")return Ud[ee.callee.name];return}var Ud={String:"string",Number:"number",Boolean:"boolean"};function Op(ee){if(ee.type==="Literal"){let te=ee.value;return typeof te==="string"||typeof te==="number"||typeof te==="boolean"?te:void 0}if(ee.type==="UnaryExpression"&&ee.operator==="-"){let te=ee.argument;return te.type==="Literal"&&typeof te.value==="number"?-te.value:void 0}return ee.type==="TemplateLiteral"?k(ee)??void 0:void 0}function Hd(ee,te){let Oe=si(ee,te),Ot=Op(te);if(Oe===void 0||Ot===void 0)return;return{raw:Oe,value:Ot,type:typeof Ot}}function Kd(ee,te){if(ee.type!=="CallExpression"&&ee.type!=="NewExpression")return;let Oe=ee.callee;if(!(xn(Oe)==="Symbol"||Oe.type==="MemberExpression"&&!Oe.computed&&xn(Oe.object)==="Symbol"&&xn(Oe.property)==="for"))return;let[jt]=ee.arguments;return(jt?.type==="Literal"&&typeof jt.value!=="string"?null:k(jt))||te}var qd=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),zd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Xd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Jd(ee,te){let Oe=te?Dn().extractJsDocType(te):void 0,Ot=ee?{type:ee,source:"typescript"}:Oe?{type:Oe,source:"jsdoc"}:void 0;if(!Ot||Ot.type.includes("`"))return;return(Ot.type.replace(zd,'""').match(Xd)??[]).every((Vt)=>qd.has(Vt))?Ot:void 0}function Lp(ee){if(ee.async||ee.generator||ee.type==="TSDeclareFunction")return;let te=ee.body,Oe=te.type==="BlockStatement"?Q(te):[te];if(Oe.length===0)return;let Ot;for(let jt of Oe){if(!jt)return;let Vt=Ip(jt);if(!Vt)return;if(Ot===void 0)Ot=Vt;else if(Ot!==Vt)return}return Ot}function Yd(ee){if(ee.type==="TemplateLiteral")return;let te=Op(ee);return typeof te==="boolean"?void 0:te}function Qd(ee){let te=ee.members;if(te.length===0)return;let Oe=[],Ot=0;for(let jt of te){if(!jt.initializer){Oe.push(String(Ot)),Ot+=1;continue}let Vt=Yd(jt.initializer);if(Vt===void 0)return;Oe.push(typeof Vt==="string"?JSON.stringify(Vt):String(Vt)),Ot=typeof Vt==="number"?Vt+1:Ot}return Oe.join(" | ")}function Qr(ee,te,Oe,Ot){let jt=Vd(ee.text,Oe),Vt=jt?Gd(jt):void 0,Wt=jt?Dn().extractJsDocReturnType(jt):void 0,{deprecated:Mt,tags:Gt,internal:Ut}=jt?Dn().extractJsDocDeprecatedAndTags(jt):{deprecated:void 0,tags:void 0,internal:!1},Ht={description:Vt,deprecated:Mt,tags:Gt,...Ut?{internal:!0}:{},declFile:ee.filePath},qt=(Xt,Jt,Qt=!1)=>Xt?[{name:Xt,...Jt,...Ht,isTypeOnly:Qt}]:[],zt=(Xt,Jt)=>Rp(ee,Xt)??Wt??ie(Jt)??Lp(Xt);if(te.type==="VariableDeclaration"){let Xt=te.kind==="let"||te.kind==="var"?te.kind:"const";return te.declarations.flatMap((Jt)=>{let Qt=Jt.id,Yt=xn(Qt);if(!Yt)return[];let nn=Wd(ee,Qt),sn=nn,cn,un,hn,Ln,Xn,Jn,gn=Jt.init;if(gn)if(gn.type==="ArrowFunctionExpression"||gn.type==="FunctionExpression"){if(Jn=gn,un=zt(gn,sn),!sn)sn=Yr(ee,gn,un)}else{if(cn=si(ee,gn),!sn)sn=Ip(gn);let jn=T(gn);if(hn=k(jn)??Kd(jn,Yt),Xt==="const")Ln=Hd(ee,jn),Xn=Jd(nn,jt)}return qt(Yt,{kind:Xt,type:sn,value:cn,returnType:un,literalValue:hn,primitiveLiteral:Ln,declaredType:Xn,functionNode:Jn})})}if(te.type==="FunctionDeclaration"||te.type==="TSDeclareFunction"){let Xt=zt(te);return qt(xn(te.id)??Ot,{kind:"function",type:Yr(ee,te,Xt),returnType:Xt,...te.type==="FunctionDeclaration"?{functionNode:te}:{}})}if(te.type==="ClassDeclaration"){let Xt=xn(te.id);return qt(Xt??Ot,{kind:"class",...Xt?{type:Xt}:{}})}if(te.type==="TSTypeAliasDeclaration")return qt(xn(te.id),{kind:"type",type:si(ee,te.typeAnnotation)},!0);if(te.type==="TSInterfaceDeclaration")return qt(xn(te.id),{kind:"interface",type:si(ee,te.body)},!0);if(te.type==="TSEnumDeclaration"){let Xt=xn(te.id);return qt(Xt,{kind:"enum",type:Qd(te)??Xt})}return[]}function Zd(ee,te,Oe){let Ot=te.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Wt]=Qr(ee,Ot,te.start,"default");return Wt?{...Wt,name:"default"}:void 0}if(Ot.type==="FunctionExpression"||Ot.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Yr(ee,Ot,Lp(Ot)),functionNode:Ot,declFile:ee.filePath,isTypeOnly:!1};let jt=xn(Ot),Vt=jt?Oe(jt):null;return Vt?{...Vt,name:"default"}:void 0}function ef(ee,te){for(let Oe of ee){if(Oe.type!=="ImportDeclaration")continue;let Ot=Oe.source.value;for(let jt of Oe.specifiers){if(jt.local.name!==te)continue;let Vt=Oe.importKind==="type"||jt.type==="ImportSpecifier"&&jt.importKind==="type";if(jt.type==="ImportDefaultSpecifier")return{specifier:Ot,importedName:"default",isTypeOnly:Vt};if(jt.type==="ImportNamespaceSpecifier")return{specifier:Ot,importedName:"*",isTypeOnly:Vt};if(jt.type==="ImportSpecifier"){let Wt=xn(jt.imported)??te;return{specifier:Ot,importedName:Wt,isTypeOnly:Vt}}}}return null}function Dp(ee,te,Oe){return{name:ee,kind:"const",declFile:te,namespaceFile:te,isTypeOnly:Oe}}function Ps(ee,te){let Oe=te.cache.get(ee);if(Oe)return Oe;if(te.computing.has(ee))return[];te.computing.add(ee);let Ot=te.graph.parse(ee);if(!Ot)return te.computing.delete(ee),te.cache.set(ee,[]),[];let{source:jt,body:Vt}=Ot,Wt=[],Mt=new Map;for(let zt of Vt){let Xt=zt.type==="ExportNamedDeclaration"?zt.declaration:zt;if(!Xt)continue;for(let Jt of Qr(jt,Xt,Xt.start))Mt.set(Jt.name,Jt)}let Gt=(zt,Xt)=>({name:zt,kind:"const",declFile:Md(jt.dir,Xt),isTypeOnly:!1}),Ut=(zt)=>{let Xt=Mt.get(zt);if(Xt)return Xt;let Jt=ef(Vt,zt);if(!Jt)return null;if(Jt.specifier.endsWith(".svelte"))return Gt(zt,Jt.specifier);let Qt=te.graph.resolve(Jt.specifier,jt.dir);if(!Qt)return null;if(Jt.importedName==="*")return Dp(zt,Qt,Jt.isTypeOnly);return ri(Qt,Jt.importedName,te)??null},Ht=new Map;for(let zt of Vt){if(zt.type==="ExportAllDeclaration"){let Yt=zt.source.value;if(Yt.endsWith(".svelte"))continue;let nn=te.graph.resolve(Yt,jt.dir);if(!nn)continue;let sn=zt.exportKind==="type",cn=xn(zt.exported);if(cn){Wt.push(Dp(cn,nn,sn));continue}for(let un of Ps(nn,te)){let hn=Ht.get(un.name)??[];hn.push(sn?{...un,isTypeOnly:!0}:un),Ht.set(un.name,hn)}continue}if(zt.type==="ExportDefaultDeclaration"){let Yt=Zd(jt,zt,Ut);if(Yt)Wt.push(Yt);continue}if(zt.type!=="ExportNamedDeclaration")continue;let Xt=zt.declaration;if(Xt){Wt.push(...Qr(jt,Xt,zt.start));continue}let Jt=zt.source?.value;if(Jt?.endsWith(".svelte")){for(let Yt of zt.specifiers){let nn=xn(Yt.exported);if(nn)Wt.push(Gt(nn,Jt))}continue}let Qt=zt.exportKind==="type";for(let Yt of zt.specifiers){let nn=xn(Yt.exported),sn=xn(Yt.local);if(!nn||!sn)continue;let cn=Qt||Yt.exportKind==="type",un=null;if(Jt){let hn=te.graph.resolve(Jt,jt.dir);if(hn)un=ri(hn,sn,te)??null}else un=Ut(sn);if(un)Wt.push({...un,name:nn,isTypeOnly:un.isTypeOnly||cn});else if(sn!=="default")Wt.push({name:nn,kind:cn?"type":"const",declFile:ee,isTypeOnly:cn})}}let qt=new Set(Wt.map((zt)=>zt.name));for(let[zt,Xt]of Ht){if(qt.has(zt)||zt==="default")continue;if(Xt.every((Jt)=>Jt.declFile===Xt[0].declFile))Wt.push(...Xt);else te.onAmbiguousStarExport?.(ee,zt,Xt)}return te.computing.delete(ee),te.cache.set(ee,Wt),Wt}function ri(ee,te,Oe){return Ps(ee,Oe).findLast((Ot)=>Ot.name===te)}function Ei(ee,{importedName:te,members:Oe=[]},Ot){let jt=ri(ee,te,Ot);for(let Vt of Oe){if(jt?.namespaceFile===void 0)return;jt=ri(jt.namespaceFile,Vt,Ot)}return jt}function qn(ee,te,Oe){if(ee[te]===void 0)delete ee[te];ee[te]=Oe}function _s(ee,te){return(te.location==="props"?ee.props:ee.moduleExports).find((Ot)=>Ot.name===te.propName)}function $s(ee,te){if(te.location!=="props")return;ee.diagnostics=(ee.diagnostics??[]).filter((Oe)=>!(Oe.kind==="prop-unknown-type"&&Oe.name===te.propName))}var tf=/\.[^./\\]+$/;function nf(ee,te){if(ee.endsWith(".d.ts"))return null;let Oe=ee.replace(tf,".d.ts");return te.exists(Oe)?Oe:null}function sf(ee,te,Oe){return te.map((Ot)=>{if(!Ot.importSource||!Ot.importedName)return{candidate:Ot};let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot,failureReason:"module-not-found"};let Vt=ri(jt,Ot.importedName,Oe);if(!Vt)return{candidate:Ot,failureReason:"export-not-found"};if(Vt.returnType)return{candidate:Ot,type:Vt.returnType};let Wt=nf(jt,Oe.graph);if(Wt){let Mt=ri(Wt,Ot.importedName,Oe);if(Mt?.returnType)return{candidate:Ot,type:Mt.returnType}}return{candidate:Ot,failureReason:"return-type-unresolved"}})}function rf(ee,te){switch(te){case"module-not-found":return`Prop "${ee.propName}" default calls "${ee.calleeName}()", but "${ee.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${ee.propName}" default calls "${ee.calleeName}()", but "${ee.importedName}" is not exported from "${ee.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${ee.propName}" default calls "${ee.calleeName}()" imported from "${ee.importSource}", but its return type could not be resolved; falling back to "any".`}}function of(ee,te){for(let{candidate:Oe,type:Ot,failureReason:jt}of te){let Vt=_s(ee,Oe);if(Vt?.typeSource!=="unknown")continue;if(Ot){qn(Vt,"type",Ot),qn(Vt,"typeSource","typescript"),$s(ee,Oe);continue}if(Oe.location==="props"&&jt){let Wt=ee.diagnostics?.find((Mt)=>Mt.kind==="prop-unknown-type"&&Mt.name===Oe.propName);if(Wt)Wt.message=rf(Oe,jt)}}}var Mp={collect:(ee)=>ee.pendingCallDefaultCandidates?.filter((te)=>te.importSource!==void 0)??[],resolve:sf,apply:of};function af(ee,te,Oe){return te.map((Ot)=>{let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot};let Vt=Ei(jt,Ot,Oe);if(!Vt?.primitiveLiteral)return{candidate:Ot};return{candidate:Ot,literal:Vt.primitiveLiteral,declaredType:Vt.declaredType}})}function pf(ee,te){for(let{candidate:Oe,literal:Ot,declaredType:jt}of te){if(!Ot)continue;let Vt=_s(ee,Oe);if(!Vt)continue;if(qn(Vt,"value",Ot.raw),qn(Vt,"defaultValue",{raw:Ot.raw,kind:"literal",value:Ot.value}),Vt.typeSource!=="unknown")continue;qn(Vt,"type",jt?.type??Ot.type),qn(Vt,"typeSource",jt?.source??"default"),$s(ee,Oe)}}var Fp={collect:(ee)=>ee.pendingConstDefaultCandidates??[],resolve:af,apply:pf};function cf(ee,te,Oe){return te.map((Ot)=>{let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot};let Vt=Ei(jt,Ot,Oe);if(Vt?.kind!=="const"||Vt.literalValue===void 0)return{candidate:Ot};return{candidate:Ot,key:Vt.literalValue}})}function lf(ee,te){for(let{candidate:Oe,key:Ot}of te){if(!Ot){let Mt=ae(Oe);ui(ee,[a({component:ee.filePath,kind:"context-key-unresolved",name:Mt,message:`setContext key \`${Mt}\` from "${Oe.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Oe.source?{source:Oe.source}:{}})]);continue}let jt=[...ee.contexts??[]],Vt=jt.findIndex((Mt)=>Mt.key===Ot);if(Vt!==-1){let Mt=jt[Vt],Gt=Bp(Mt.source,Oe.source),Ut=Gt?Mt.source:Oe.source;if(ui(ee,[a({component:ee.filePath,kind:"context-duplicate-key",name:Ot,message:`setContext("${Ot}", ...) was called more than once; only the first call's shape is used.`,...Ut?{source:Ut}:{}})]),!Gt)continue;jt.splice(Vt,1)}let Wt=jt.findIndex((Mt)=>Bp(Mt.source,Oe.source));jt.splice(Wt===-1?jt.length:Wt,0,{key:Ot,typeName:K(Ot),...Oe.type===void 0?{}:{type:Oe.type},description:Oe.description,properties:Oe.properties,...Oe.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Oe.internal?{internal:!0}:{},source:Oe.source}),ee.contexts=jt}}function Bp(ee,te){if(!ee||!te)return!1;let{line:Oe,column:Ot}=ee.start;return Oe>te.start.line||Oe===te.start.line&&Ot>te.start.column}var jp={collect:(ee)=>ee.pendingContextKeyCandidates??[],resolve:cf,apply:lf};function uf(ee,te,Oe){return te.map((Ot)=>{let jt=Oe.graph.resolve(Ot.importSource,ee);if(!jt)return{candidate:Ot,failureReason:"module-not-found"};let Vt=Ei(jt,Ot,Oe)?.functionNode;if(!Vt)return{candidate:Ot,failureReason:"not-a-function"};let Wt=hf(Vt,Ot);if(!Wt)return{candidate:Ot,failureReason:"parameter-not-found"};return mf(Vt,Wt,Ot)})}function Vp(ee){return ee?.type==="AssignmentPattern"?ee.left:ee}function hf(ee,te){let Oe=Vp(ee.params[te.argumentIndex]);if(te.property===void 0)return Oe?.type==="Identifier"?{name:Oe.name}:void 0;if(!te.property)return;if(Oe?.type==="Identifier")return{object:Oe.name,property:te.property};if(Oe?.type!=="ObjectPattern")return;for(let Ot of Oe.properties){if(Ot.type!=="Property"||Ot.computed)continue;if(Ot.key.type!=="Identifier"||Ot.key.name!==te.property)continue;let jt=Vp(Ot.value);return jt?.type==="Identifier"?{name:jt.name}:void 0}return}function Zr(ee){if(!ee)return null;if(ee.type==="ConditionalExpression"){let Oe=Zr(ee.consequent),Ot=Zr(ee.alternate);return Oe&&Ot?[...Oe,...Ot]:null}let te=k(ee);return te?[te]:null}var df={variableType:()=>{return}};function ff(ee){if(!ee)return"null";let{deriveLiteralDetailType:te,literalDetailToTypeText:Oe}=Dn();if(ee.type==="Literal")return Oe(ee.value);return te(df,ee)??"any"}function Gp(ee,te){if("name"in te)return ee.type==="Identifier"&&ee.name===te.name;if(ee.type!=="MemberExpression"||ee.computed)return!1;return ee.object.type==="Identifier"&&ee.object.name===te.object&&ee.property.type==="Identifier"&&ee.property.name===te.property}function mf(ee,te,Oe){let Ot=new Map,jt="name"in te?te.name:te.object,Vt;if(o(ee.body,{enter(Mt,Gt,Ut){if(Mt.type==="CallExpression"){if(!Gp(Mt.callee,te))return;let qt=Mt.arguments,zt=Zr(qt[0]);if(!zt)return Vt="dynamic-event-name",v;for(let Xt of zt){let Jt=Ot.get(Xt)??new Set;Jt.add(ff(qt[1])),Ot.set(Xt,Jt)}return}let Ht=Gt?.type==="CallExpression"&&Ut==="callee";if(Mt.type==="MemberExpression"&&Gp(Mt,te)&&!Ht)return Vt="passed-on",v;if(Mt.type!=="Identifier"||Mt.name!==jt)return;if(Ht)return;if(!("name"in te)&&Gt?.type==="MemberExpression"&&Ut==="object")return;if(!U(Mt,Gt))return;return Vt="passed-on",v}}),Vt)return{candidate:Oe,failureReason:Vt};let Wt=Array.from(Ot,([Mt,Gt])=>{let Ut=Array.from(Gt);return{name:Mt,detail:Ut.includes("any")?"any":Ut.join(" | ")}});return{candidate:Oe,events:Wt}}function gf(ee,te){let Oe=ee.members?`"${ee.calleeText}"`:ee.importedName==="default"?"the default export":`"${ee.importedName}"`;switch(te){case"module-not-found":return`"${ee.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Oe} isn't a function declared in "${ee.importSource}"`;case"parameter-not-found":return`no parameter of ${Oe} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Oe} passes it on`}}function yf(ee,te,{deferredEventNoSourceDiagnostics:Oe=[],untypedJsDocEventNames:Ot=[]}){let jt=new Map,Vt=[...ee.diagnostics??[]],Wt=!0;for(let{candidate:Xt,events:Jt,failureReason:Qt}of te){if(Qt){Wt=!1,Vt.push(a({component:ee.filePath,kind:"dispatch-escapes",name:Xt.dispatcherName,message:`\`${Xt.dispatcherName}\` is passed to \`${Xt.calleeText}\`, but sveld couldn't read the events it dispatches: ${gf(Xt,Qt)}. Document them with @event tags.`,...Xt.source?{source:Xt.source}:{},...Xt.ignored?{ignored:!0}:{}}));continue}for(let Yt of Jt??[]){if(jt.has(Yt.name))continue;jt.set(Yt.name,{type:"dispatched",name:Yt.name,detail:Yt.detail,...Xt.source?{source:Xt.source}:{}})}}if(Wt){for(let Xt of Oe)if(!jt.has(Xt.name))Vt.push(Xt)}if(ee.diagnostics=Vt,jt.size===0)return;let Mt=new Map,Gt=new Set;for(let Xt of ee.events)if(Xt.type==="dispatched")Gt.add(Xt.name);else if(!Mt.has(Xt.name))Mt.set(Xt.name,Xt);let Ut=new Set(Ot),Ht=new Map,qt=[];for(let Xt of jt.values()){if(Gt.has(Xt.name)){if(Ut.has(Xt.name)&&Xt.detail!==void 0)Ht.set(Xt.name,Xt.detail);continue}let Jt=Mt.get(Xt.name);if(!Jt){qt.push(Xt);continue}let Qt=Xt.source??Jt.source;qt.push({type:"dispatched",name:Xt.name,detail:Jt.detail??Xt.detail,...Jt.description?{description:Jt.description}:{},...Jt.deprecated===void 0?{}:{deprecated:Jt.deprecated},...Jt.tags?{tags:Jt.tags}:{},...Jt.internal?{internal:!0}:{},...Qt?{source:Qt}:{}})}if(qt.length===0&&Ht.size===0)return;let zt=new Set(qt.map((Xt)=>Xt.name));ee.events=[...ee.events.filter((Xt)=>Xt.type==="dispatched"||!zt.has(Xt.name)).map((Xt)=>{let Jt=Xt.type==="dispatched"?Ht.get(Xt.name):void 0;return Jt===void 0?Xt:{...Xt,detail:Jt}}),...qt].sort(ge)}var Wp={collect:(ee)=>ee.pendingDispatchEscapeCandidates??[],resolve:uf,apply:yf};function Ns(ee){return(te)=>{let Oe=ee.collect(te);if(Oe.length===0)return;return(Ot,jt,Vt)=>ee.apply(Ot,ee.resolve(jt,Oe,Vt),te)}}var vf=[Ns(Mp),Ns(Fp),Ns(jp),Ns(Wp)];async function Up(ee,te,Oe,Ot){let jt=[];for(let Wt of ee){let Mt=Oe(Wt);if(Mt===void 0)continue;let Gt=vf.flatMap((Ut)=>Ut(Mt)??[]);if(Gt.length>0)jt.push({component:Wt,passes:Gt})}let Vt=new Map;if(jt.length===0)return Vt;await Hn();for(let{component:Wt,passes:Mt}of jt){let Gt=As(Ot),Ut=xf(te(Wt.filePath));for(let Ht of Mt)Ht(Wt,Ut,Gt);Vt.set(Wt.filePath,Array.from(Gt.cache.keys()))}return Vt}var Ef=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,Sf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),bf=new Set(["svelte","html"]);function Cf(ee){let te=ee.trim();if(te==="")return null;let Oe=te.match(Ef);if(Oe){let Ot=Oe[1].toLowerCase(),jt=Oe[2].trim();if(jt==="")return null;if(Sf.has(Ot))return{kind:"compile",code:jt};if(bf.has(Ot))return{kind:"syntax",code:jt};return null}if(te.startsWith("<"))return null;return{kind:"compile",code:te}}function Hp(ee){if(!ee.isFunction)return"any";return`(${(ee.params??[]).map((Oe)=>`${Oe.name}${Oe.optional?"?":""}: any`).join(", ")}) => any`}function Ds(ee,te,Oe,Ot,jt){let Vt=(ee??[]).filter((Mt)=>Mt.name==="example"),Wt=Vt.length>1;return Vt.flatMap((Mt,Gt)=>{let Ut=Cf(Mt.body);if(Ut===null)return[];return[{id:Wt?`${te}#${Gt}`:te,name:Wt?`${Oe} (example ${Gt+1})`:Oe,type:Ot,code:Ut.code,kind:Ut.kind,...jt?{source:jt}:{}}]})}function wf(ee){let te=[];for(let Oe of ee.props)te.push(...Ds(Oe.tags,`prop:${Oe.name}`,Oe.name,Hp(Oe),Oe.source));for(let Oe of ee.moduleExports)te.push(...Ds(Oe.tags,`export:${Oe.name}`,Oe.name,Hp(Oe),Oe.source));for(let Oe of ee.slots){let Ot=Oe.name??"default";te.push(...Ds(Oe.tags,`slot:${Ot}`,Ot,"any",Oe.source))}for(let Oe of ee.events)te.push(...Ds(Oe.tags,`event:${Oe.name}`,Oe.name,"any",Oe.source));return te}function Kp(ee,te){return ee.flatMap(({component:Oe,sources:Ot})=>{let jt=Ot.filter((Vt)=>Vt.kind===te);return jt.length===0?[]:[{component:Oe,sources:jt}]})}async function Tf(ee){let{formatParseError:te,parseSvelte:Oe}=await Hn(),Ot=new Map;for(let{component:jt,sources:Vt}of ee){let Wt=[];for(let Mt of Vt)try{Oe(Mt.code)}catch(Gt){Wt.push(a({component:jt.filePath,kind:"example-syntax-error",name:Mt.name,message:te(Gt),...Mt.source?{source:Mt.source}:{}}))}Ot.set(jt,Wt)}return Ot}async function kf(ee,te,Oe){let Ot=await te.checkExamples(ee.map(({component:Vt,sources:Wt})=>({moduleName:Vt.moduleName,filePath:Oe(Vt.filePath),sources:Wt}))),jt=new Map;for(let{component:Vt,sources:Wt}of ee){let Mt=Ot.get(Oe(Vt.filePath));if(!Mt||Mt.length===0)continue;let Gt=new Map(Wt.map((Ut)=>[Ut.id,Ut.source]));jt.set(Vt,Mt.map((Ut)=>{let Ht=Gt.get(Ut.id);return a({component:Vt.filePath,kind:"example-compile-error",name:Ut.name,message:Ut.message,...Ht?{source:Ht}:{}})}))}return jt}async function qp(ee,te,Oe,Ot){let jt=Array.from(ee,(Ut)=>({component:Ut,sources:wf(Ut)})),Vt=te===!0?Kp(jt,"compile"):[],Wt=Kp(jt,"syntax"),Mt=new Map,Gt=(Ut)=>{for(let[Ht,qt]of Ut)Mt.set(Ht,[...Mt.get(Ht)??[],...qt])};if(Wt.length>0)Gt(await Tf(Wt));if(Vt.length>0){let{TypeResolver:Ut}=await import("./chunk-1pzasy7d.js"),Ht=await Ut.create(Oe);if(!Ht.ok)throw Error(`sveld: \`checkExamples\` ${Ht.message}.`);let qt=Ht.resolver;try{Gt(await kf(Vt,qt,Ot))}finally{await qt.dispose()}}return Mt}import{hash as Af}from"node:crypto";import{mkdirSync as Pf,readFileSync as _f,renameSync as $f,writeFileSync as zp}from"node:fs";import{dirname as Xp,isAbsolute as Nf,join as Df,resolve as eo}from"node:path";var Jp=11,Rf=Df("node_modules",".cache","sveld","parse-cache.json"),If="610b1a284d958583";function Yp(){return`${fs}+${If}+svelte@${Ri}`}function Of(ee){let te=q(ee,["package.json"]);return te===null?eo(ee):Xp(te)}function Qp(ee,te){let Oe=Of(ee);if(typeof te==="string")return Nf(te)?te:eo(Oe,te);return eo(Oe,Rf)}function Rs(ee){return Af("sha256",ee,"hex")}function to(){return{formatVersion:Jp,toolchainVersion:Yp(),entries:{}}}function Lf(ee){try{let te=JSON.parse(_f(ee,"utf-8"));if(te.formatVersion!==Jp||te.toolchainVersion!==Yp())return to();return te}catch{return to()}}class no{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(ee){this.cacheFilePath=ee,this.file=Lf(ee),this.savedEntryCount=Object.keys(this.file.entries).length}has(ee,te){return this.lookup(ee,te)!==void 0}lookup(ee,te){let Oe=this.next.get(ee);if(Oe?.hash===te)return Oe;let Ot=this.file.entries[ee];return Ot?.hash===te?Ot:void 0}get(ee,te){let Oe=this.lookup(ee,te);if(Oe===void 0)return null;this.next.set(ee,Oe);let{component:Ot,typeScriptMetadata:jt,propIgnores:Vt,pending:Wt}=structuredClone({component:Oe.component,typeScriptMetadata:Oe.typeScriptMetadata,propIgnores:Oe.propIgnores,pending:Oe.pending});if(jt!==void 0)Ot[E]=jt;if(Vt!==void 0)Ot[L]=Vt;return Wt===void 0?{component:Ot}:{component:Ot,pending:Wt}}set(ee,te,{component:Oe,pending:Ot}){this.dirty=!0,this.next.set(ee,{hash:te,...structuredClone({component:Oe,typeScriptMetadata:Oe[E],propIgnores:Oe[L],pending:Ot})})}getGeneratedText(ee,te){let Oe=this.next.get(ee);if(Oe?.generatedText===void 0||Oe.generatedText.key!==te)return;return Oe.generatedText.text}setGeneratedText(ee,te,Oe){let Ot=this.next.get(ee);if(Ot===void 0)return;if(Ot.generatedText?.key===te&&Ot.generatedText.text===Oe)return;Ot.generatedText={key:te,text:Oe},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,Pf(Xp(this.cacheFilePath),{recursive:!0});let ee={...to(),entries:Object.fromEntries(this.next)},te=JSON.stringify(ee),Oe=`${this.cacheFilePath}.${process.pid}.tmp`;try{zp(Oe,te),$f(Oe,this.cacheFilePath)}catch{try{zp(this.cacheFilePath,te)}catch{}}}}import{dirname as Mf,relative as Ff,resolve as Bf}from"node:path";async function Zp(ee,te={}){await Hn();let Oe=Bf(ee),Ot=Mf(Oe),jt=(Mt)=>n(`./${Ff(Ot,Mt)}`),Vt=Ps(Oe,{...As(te.graph??new Kn),onAmbiguousStarExport:(Mt,Gt,Ut)=>{if(Mt!==Oe||!te.diagnostics)return;if(Ut.every((Xt)=>Xt.declFile.endsWith(".svelte")))return;let Ht=Array.from(new Set(Ut.map((Xt)=>jt(Xt.declFile)))),qt=Ht.map((Xt)=>`"${Xt}"`),zt=`${qt.slice(0,-1).join(", ")} and ${qt[qt.length-1]}`;te.diagnostics.push(a({component:jt(Oe),kind:"export-ambiguous",name:Gt,message:`"${Gt}" 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 { ${Gt} } from "${Ht[0]}"\`).`}))}}),Wt=new Map;for(let Mt of Vt){if(Mt.name==="default"||Mt.declFile.endsWith(".svelte"))continue;let{declFile:Gt,returnType:Ut,literalValue:Ht,primitiveLiteral:qt,declaredType:zt,functionNode:Xt,namespaceFile:Jt,...Qt}=Mt,Yt=jt(Gt);if(Jt!==void 0)Qt.type=`typeof import(${JSON.stringify(jt(Jt))})`;Wt.set(Mt.name,{...Qt,source:Yt})}return Array.from(Wt.values()).sort((Mt,Gt)=>u(Mt.name,Gt.name))}async function Gf(ee){let te=await Promise.all(Array.from(ee,async(Oe)=>{try{return[Oe,await Vf(Oe,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Oe}:`,Ot),[Oe,null]}}));return new Map(te)}function tc(ee){if(ee.length===0)return;console.error(`sveld: failed to parse ${ee.length} component(s):`);for(let{filePath:te,message:Oe}of ee)console.error(` - ${te}: ${Oe}`)}class ji{input;glob;options;graph=new Kn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(ee,te,Oe={}){this.input=ee,this.glob=te,this.options=Oe}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Kn,this.collected=Jr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=ks(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=jf(this.input).isFile()?ec(this.input):null,this.cache=this.options.cache===!1?void 0:new no(Qp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),tc(Array.from(this.parseErrors.values())),this.assemble()}async update(ee){let te=ee.map((Ut)=>ec(Ut));if(this.graph.invalidate(...te),te.length===0)return{result:this.assemble(),reparsed:[]};let Oe=this.entryFile!==null&&te.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Ut,exports:Ht,allComponentEntries:qt,resolveComponentFilePath:zt}=this.collected;Xr(this.graph,Ut,Ht,qt,zt,this.globMergeState)}this.indexEntries();let Ot=this.componentPaths();for(let Ut of this.records.keys())if(!Ot.has(Ut))this.records.delete(Ut);for(let Ut of this.parseErrors.keys())if(!Ot.has(Ut))this.parseErrors.delete(Ut);let jt=Array.from(this.records).flatMap(([Ut,{crossFileReads:Ht}])=>Ht?.some((qt)=>te.includes(qt))?[Ut]:[]),Vt=new Set([...te.filter((Ut)=>_n.test(Ut)),...Oe,...jt]),Wt=new Set(Array.from(Ot).filter((Ut)=>Vt.has(Ut))),Mt=await this.process(Wt),Gt=this.assemble();return tc(Gt.errors),{result:Gt,reparsed:Mt}}async recollect(){let ee=this.collected,te=Jr(this.input,this.glob,this.documentExports,this.graph),Oe=[];for(let[Ot,jt]of Object.entries(te.exports)){let Vt=te.resolveComponentFilePath(jt.source),Wt=Object.hasOwn(ee.exports,Ot)?ee.exports[Ot]:void 0;if(Wt===void 0||ee.resolveComponentFilePath(Wt.source)!==Vt)Oe.push(Vt)}return this.collected=te,this.globMergeState=ks(te.allComponentEntries,te.resolveComponentFilePath),await this.readEntryExports(),Oe}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Zp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:ee,allComponentEntries:te,resolveComponentFilePath:Oe}=this.collected,Ot=new Set;for(let[,jt]of[...Object.entries(ee),...te])if(gi(jt.source))Ot.add(Oe(jt.source));return Ot}indexEntries(){let{exports:ee,allComponentEntries:te,resolveComponentFilePath:Oe}=this.collected;this.canonicalEntries=new Map;for(let Ot of[Object.entries(ee),te])for(let jt of Ot){if(!gi(jt[1].source))continue;this.canonicalEntries.set(Oe(jt[1].source),this.entryIdentity(Ot,jt))}}entryIdentity(ee,[te,{source:Oe}]){return{moduleName:Np(te,Oe,ee.length,this.warnedModuleNames),filePath:n(Oe)}}canonicalEntry(ee){let te=this.canonicalEntries.get(ee);if(te===void 0)throw Error(`sveld: no entry lists ${ee}.`);return te}async process(ee){let te=new Map,Oe=await this.parse(ee,te);this.cache?.save();let Ot=await this.settle(Oe);for(let jt of ee)this.records.delete(jt),this.parseErrors.delete(jt);for(let[jt,Vt]of Ot)this.records.set(jt,Vt);for(let[jt,Vt]of te)this.parseErrors.set(jt,Vt);return Array.from(Ot.keys())}async parse(ee,te){let Oe=await Gf(ee),Ot=this.cache,jt=new Map,Vt=new Set;if(Ot)for(let[Mt,Gt]of Oe){if(Gt===null)continue;let Ut=Rs(Gt);if(jt.set(Mt,Ut),!Ot.has(Mt,Ut))Vt.add(Mt)}if(ee.size>0&&(!Ot||Vt.size>0))await Hn();let Wt=new Map;for(let Mt of ee){let Gt=Oe.get(Mt);if(Gt===null||Gt===void 0)continue;let Ut=this.parseOne(Mt,Gt,jt.get(Mt),te);if(Ut)Wt.set(Mt,Ut)}return Wt}parseOne(ee,te,Oe,Ot){let jt=Oe===void 0?null:this.cache?.get(ee,Oe);if(jt)return jt;let{moduleName:Vt,filePath:Wt}=this.canonicalEntry(ee),Mt;try{Mt=new(Dn()).ComponentParser().parse(te,{moduleName:Vt,filePath:Wt})}catch(Gt){if(this.options.failFast)throw Gt;Ot.set(ee,{filePath:Wt,moduleName:Vt,message:Gt instanceof Error?Gt.message:String(Gt),stack:Gt instanceof Error?Gt.stack:void 0});return}if(Oe!==void 0)this.cache?.set(ee,Oe,Mt);return Mt}async settle(ee){let{rootDir:te,resolveComponentFilePath:Oe}=this.collected,Ot=new Map,jt=new Map;for(let[Gt,{component:Ut,pending:Ht}]of ee){let qt={...this.canonicalEntry(Gt),...Ut};Ot.set(Gt,qt),jt.set(qt,Ht)}let{checkExamples:Vt}=this.options;if(Vt){let Gt=await qp(Ot.values(),Vt,te,Oe);for(let[Ut,Ht]of Gt)ui(Ut,Ht)}let Wt=await Up(Ot.values(),Oe,(Gt)=>jt.get(Gt),this.graph),Mt=new Map;for(let[Gt,Ut]of Ot){let{moduleName:Ht,filePath:qt,...zt}=Ut,Xt=Wt.get(qt);Mt.set(Gt,Xt===void 0?{component:zt}:{component:zt,crossFileReads:Xt})}return Mt}assemble(){let{exports:ee,allComponentEntries:te,resolveComponentFilePath:Oe}=this.collected,Ot=this.cache,jt=(qt,zt)=>{let{source:Xt}=zt[1];if(!gi(Xt))return;let Jt=this.records.get(Oe(Xt));if(Jt===void 0)return;return{component:{...this.entryIdentity(qt,zt),...Jt.component},record:Jt}},Vt=new Map,Wt=Ot?new Map:void 0,Mt=Ot?new Map:void 0;for(let qt of te){let zt=jt(te,qt);if(zt===void 0)continue;let{filePath:Xt}=zt.component;Vt.set(Xt,zt.component),(zt.record.crossFileReads===void 0?Wt:Mt)?.set(Xt,Oe(qt[1].source))}let Gt=up(Vt,Oe,this.graph);for(let qt of Vt.values())ui(qt,[...Gt(qt),...lp(qt)]);let Ut=new Map,Ht=Object.entries(ee);for(let qt of Ht){let zt=jt(Ht,qt);if(zt===void 0)continue;let Xt=Vt.get(zt.component.filePath);if(Xt)zt.component.diagnostics=Xt.diagnostics;Ut.set(zt.component.moduleName,zt.component)}return{exports:ee,entryExports:this.entryExports,components:Ut,allComponentsForTypes:Vt,errors:Array.from(this.parseErrors.values()),diagnostics:$o(Do([...Array.from(Vt.values()).flatMap((qt)=>qt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ot,resolvedPathByFilePath:Wt,crossFileResolvedPathByFilePath:Mt}}}function Vi(ee){return{failFast:ee?.failFast,documentExports:ee?.documentExports===!0,cache:ee?.cache,checkExamples:ee?.checkExamples==="syntax"?"syntax":ee?.checkExamples===!0,diagnostics:ee?.diagnostics}}async function Gi(ee,te,Oe={}){return new ji(ee,te,Oe).build()}import{existsSync as io,readFileSync as Wf}from"node:fs";import{isAbsolute as Uf,join as ic}from"node:path";var Wi='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function nc(ee){return Uf(ee)?ee:ic(process.cwd(),ee)}function Re(ee){if(ee){let jt=nc(ee);if(io(jt))return{entry:Z(ee)};return{entry:null,configured:!0,message:`Invalid entry point: ${jt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let te=ic(process.cwd(),"package.json");if(!io(te))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Oe;try{Oe=yp(JSON.parse(Wf(te,"utf-8")))}catch(jt){throw console.error("Error reading package.json:",jt),jt}let Ot=Oe.svelte?.trim();if(!Ot)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(!io(nc(Ot)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ot}", which does not exist.`};return{entry:Z(Ot)}}function Is(ee){let te=Re(ee);if(te.entry===null)console.error(te.message);return te.entry}async function sc(ee,te,Oe={}){let Ot=new ji(ee,te,{...Oe,failFast:!1}),jt=await Ot.build();return{get result(){return Promise.resolve(jt)},async update(Vt){let Wt=await Ot.update(Vt);return jt=Wt.result,Wt}}}import ro from"node:path";function rc(ee){let te=new Map,Oe=[];for(let[Ot,jt]of Object.entries(ee)){if(jt.star){Oe.push(`export * from "${jt.source}";`);continue}let Vt=te.get(jt.source)??[];Vt.push({id:Ot,exportee:jt}),te.set(jt.source,Vt)}for(let[Ot,jt]of te){let Vt=_n.test(Ot),Wt=jt.some(({id:zt,exportee:Xt})=>zt!=="default"&&Xt.default),Mt=jt.some(({exportee:zt})=>!zt.default),Gt=Vt&&Wt&&Mt,Ut=[],Ht=[],qt=[];for(let{id:zt,exportee:Xt}of jt){if(zt==="default"){Ht.push(`export { default } from "${Ot}";`);continue}if(Xt.default)if(Xt.mixed)Ht.push(`export { default as ${zt} } from "${Ot}";`),Ht.push(`export { default } from "${Ot}";`);else qt.push(`default as ${zt}`);else if(Vt&&!Gt)qt.push(`default as ${zt}`);else Ut.push(Xt.imported===void 0?zt:`${Xt.imported} as ${zt}`)}if(qt.length>0&&Ut.length>0)Oe.push(`export { ${[...qt,...Ut].join(", ")} } from "${Ot}";`);else{if(Ut.length>0)Oe.push(`export { ${Ut.join(", ")} } from "${Ot}";`);if(qt.length>0)Oe.push(`export { ${qt.join(", ")} } from "${Ot}";`)}Oe.push(...Ht)}return Oe.join(`
|
|
141
|
+
`)}function oc(ee){return ee.filter((te)=>te.names.length>0).map((te)=>`export type { ${te.names.join(", ")} } from "${te.source}";`).join(`
|
|
142
|
+
`)}function ac(ee){return ee.replace(_n,"")}function so(ee){return ee.replace(_n,".svelte.d.ts")}import{mkdir as Hf,readFile as Kf,writeFile as qf}from"node:fs/promises";import{parse as zf}from"node:path";class On{ensuredDirs=new Set;async write(ee,te){try{if(await Kf(ee,"utf-8")===te)return!1}catch{}let Oe=zf(ee).dir;if(!this.ensuredDirs.has(Oe))await Hf(Oe,{recursive:!0}),this.ensuredDirs.add(Oe);return await qf(ee,te),!0}}function Xf(ee){return i(ee)&&!Array.isArray(ee)&&"start"in ee&&"end"in ee}function oo(ee){if(Array.isArray(ee))return ee.map((te)=>oo(te));if(i(ee)){let te={};for(let[Oe,Ot]of Object.entries(ee)){if((Oe==="source"||Oe==="componentCommentSource")&&Xf(Ot))continue;te[Oe]=oo(Ot)}return te}return ee}function Jf(ee,te,Oe){if(!te)return`${ee.moduleName}.api.json`;if(!Oe.has(ee.moduleName))Oe.add(ee.moduleName),console.warn(`Warning: multiple components named "${ee.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${ac(ee.filePath)}.api.json`}async function Yf(ee,te,Oe){let Ot=Os(ee,{inputDir:te.inputDir,source:te.source}).components,jt=new Map;for(let Mt of Ot)jt.set(Mt.moduleName,(jt.get(Mt.moduleName)??0)+1);let Vt=new Set,Wt=new On;await Promise.all(Ot.map(async(Mt)=>{let Gt=(jt.get(Mt.moduleName)??0)>1,Ut=Jf(Mt,Gt,Vt),Ht=ro.resolve(ro.join(Oe,Ut)),qt=await Wt.write(Ht,Di(Mt));Bn(`${qt?"created":"unchanged"} "${Ht}".`)}))}function Os(ee,te){let Oe=y(ee,{entryExports:te.entryExports}),Ot={...Oe,components:Oe.components.map((jt)=>({...jt,filePath:Ca(jt.filePath,te.inputDir)}))};return te.source===!1?oo(Ot):Ot}function ao(ee,te){return Di(Os(ee,te))}async function po(ee,te){if(te.outDir){await Yf(ee,te,te.outDir);return}let Oe=await new On().write(ro.resolve(te.outFile),ao(ee,te));Bn(`${Oe?"created":"unchanged"} "${te.outFile}".`)}import{join as Ac,resolve as go}from"node:path";var pc=/`/g,cc=/\s+/g,zn="--",lc=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
142
143
|
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
143
|
-
`,
|
|
144
|
+
`,uc=`| Slot name | Default | Props | Fallback | Description |
|
|
144
145
|
| :- | :- | :- | :- | :- |
|
|
145
|
-
`,
|
|
146
|
+
`,hc=`| Event name | Type | Detail | Description |
|
|
146
147
|
| :- | :- | :- | :- |
|
|
147
|
-
`,
|
|
148
|
+
`,co=`| Name | Kind | Type | Description |
|
|
148
149
|
| :- | :- | :- | :- |
|
|
149
|
-
`,
|
|
150
|
+
`,Qf=`| Member | Signature | Description |
|
|
150
151
|
| :- | :- | :- |
|
|
151
|
-
`,
|
|
152
|
+
`,dc=`| Part name | Description |
|
|
152
153
|
| :- | :- |
|
|
153
|
-
`,
|
|
154
|
+
`,fc=`| Property name | Type | Default value | Description |
|
|
154
155
|
| :- | :- | :- | :- |
|
|
155
|
-
`,
|
|
156
|
-
`)?ee.replace(
|
|
157
|
-
`))});if(!
|
|
158
|
-
`),Ot=[],jt=[];for(let Vt=0;Vt<Oe.length;Vt++){let Wt=
|
|
159
|
-
`)}),jt=[""]}if(jt.length>1||Ot.length===0)Ot.push(te(jt));return Ot}function
|
|
160
|
-
`);if(Vt)Ot(Vt);for(let Mt of
|
|
156
|
+
`,mc=/\|/g,Zf=/</g,em=/>/g,Ls=/\n/g,tm=/^[A-Za-z_$][\w$]*$/,nm=/\s*\n\s*/g,im=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,sm=/[&<|`*\\_]/;function lo(ee){if(!sm.test(ee))return ee;return ee.replace(im,(te)=>te==="&"?"&":te==="<"?"<":te==="_"?"_":`&#${te.charCodeAt(0)};`)}function rm(ee){return`<code>${lo(ee.includes(`
|
|
157
|
+
`)?ee.replace(nm," "):ee)}</code>`}var om=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function am(ee){if(!ee.includes("{@link"))return ee;return ee.replace(om,(te,Oe,Ot)=>`[${Ot===void 0?Oe:Ot.trim()}](${Oe})`)}function pm(ee){return ee.includes("```")||ee.includes("~~~")}function cm(ee){return vc(am(ee))}var lm=/^([ \t]*)(`{3,}|~{3,})(.*)$/,um=/^\n/,hm=/\n$/;function gc(ee){let te=(Vt)=>({kind:"prose",text:cm(Vt.join(`
|
|
158
|
+
`))});if(!pm(ee))return[te([ee])];let Oe=ee.split(`
|
|
159
|
+
`),Ot=[],jt=[];for(let Vt=0;Vt<Oe.length;Vt++){let Wt=lm.exec(Oe[Vt]),[,Mt="",Gt="",Ut=""]=Wt??[];if(!Wt||Gt[0]==="`"&&Ut.includes("`")){jt.push(Oe[Vt]);continue}if(jt.push(""),jt.length>1)Ot.push(te(jt));let Ht=[],qt=new RegExp(`^[ \\t]*${Gt[0]}{${Gt.length},}[ \\t]*$`);for(Vt++;Vt<Oe.length&&!qt.test(Oe[Vt]);Vt++){let zt=Oe[Vt],Xt=0;while(Xt<Mt.length&&(zt[Xt]===" "||zt[Xt]==="\t"))Xt++;Ht.push(zt.slice(Xt))}Ot.push({kind:"code",code:Ht.join(`
|
|
160
|
+
`)}),jt=[""]}if(jt.length>1||Ot.length===0)Ot.push(te(jt));return Ot}function yc(ee){let te="";for(let Oe=0;Oe<ee.length;Oe++){let Ot=ee[Oe];if(Ot.kind==="code"){te+=`<pre><code>${lo(Ot.code).replace(Ls,"<br />")}</code></pre>`;continue}let jt=Ot.text;if(ee[Oe-1]?.kind==="code")jt=jt.replace(um,"");if(ee[Oe+1]?.kind==="code")jt=jt.replace(hm,"");te+=jt.replace(mc,"|").replace(Ls,"<br />")}return te}function bn(ee){if(ee===void 0)return zn;return rm(ee)}function xc(ee){if(!ee.reExport)return bn(ee.type);let{from:te,imported:Oe}=ee.reExport,Ot=Oe==="*"?"":tm.test(Oe)?`.${Oe}`:`[${JSON.stringify(Oe)}]`;return bn(`typeof import(${JSON.stringify(te)})${Ot}`)}function vc(ee){if(!ee.includes("<")&&!ee.includes(">"))return ee;return ee.replace(Zf,"<").replace(em,">")}function oi(ee,te){if(te===void 0)return ee;let Oe=typeof te==="string"&&te.trim().length>0?`: ${vc(te).replace(Ls," ").replace(mc,"|")}`:"";return`<s>${ee}</s><br />**Deprecated**${Oe}`}function Ms(ee){if(ee===void 0||ee.trim().length===0)return zn;return yc(gc(ee))}function Ec(ee){if(ee===void 0||ee==="{}"||ee==="Record<string, never>")return zn;return bn(ee.trim())}function Sc(ee){if(ee===void 0)return zn;return`<code>${lo(ee).replace(Ls,"<br />")}</code>`}function Si(ee,te){let Oe=[],Ot=(Vt)=>{let Wt=Oe.at(-1);if(Wt?.kind==="prose")Wt.text+=Vt;else Oe.push({kind:"prose",text:Vt})},jt=(Vt,Wt)=>{if(Oe.length>0)Ot(`
|
|
161
|
+
`);if(Vt)Ot(Vt);for(let Mt of gc(Wt))if(Mt.kind==="prose")Ot(Mt.text);else Oe.push(Mt)};if(ee?.trim())jt("",ee);for(let{name:Vt,body:Wt}of te??[]){let Mt=Wt?.trim();jt(Mt?`@${Vt} `:`@${Vt}`,Mt??"")}if(Oe.length===0)return zn;return yc(Oe)}function bc(ee){return bn(ee)}function dm(ee){let te=[ee.extends?`Extends ${bn(ee.extends)}.`:"",ee.implements?.length?`Implements ${ee.implements.map((Oe)=>bn(Oe)).join(", ")}.`:""].filter(Boolean);return te.length>0?te.join(" "):void 0}function Cc(ee,te){let Oe=new Set;for(let Ot of te){if(Ot.kind!=="class")continue;let jt=dm(Ot);if(!Ot.members?.length&&!jt)continue;let Vt=Ot.localName??Ot.name;if(Oe.has(Vt))continue;if(Oe.add(Vt),ee.append("h4",`\`${Vt}\` members`),jt)ee.append("raw",`${jt}
|
|
161
162
|
|
|
162
|
-
`);if(!Ot.members?.length)continue;ee.append("raw",
|
|
163
|
+
`);if(!Ot.members?.length)continue;ee.append("raw",Qf);for(let Wt of Ot.members)ee.append("raw",`| ${oi(Wt.name,Wt.deprecated)} | ${bn(Or(Wt))} | ${Si(Wt.description,Wt.tags)} |
|
|
163
164
|
`);ee.append("raw",`
|
|
164
|
-
`)}}function
|
|
165
|
+
`)}}function wc(ee,te,Oe){if(ee.append("h1","Component Index"),ee.append("h2","Components").tableOfContents(),ee.append("divider"),Oe&&Oe.length>0)kc(ee,Oe);for(let Ot of y(te).components)ho(ee,Ot)}function Tc(ee,te,Oe){ee.append("h1","Component Index"),ee.append("h2","Components");for(let Ot of te)ee.append("raw",`- [${Ot.moduleName}](./${Ot.moduleName}.md)
|
|
165
166
|
`);if(ee.append("raw",`
|
|
166
|
-
`),ee.append("divider"),Oe&&Oe.length>0)
|
|
167
|
+
`),ee.append("divider"),Oe&&Oe.length>0)kc(ee,Oe)}function kc(ee,te){ee.append("h2","Exports"),ee.append("raw",co);for(let Oe of te){let Ot=(Oe.type??Oe.value)?.replace(cc," ").trim();ee.append("raw",`| ${oi(Oe.name,Oe.deprecated)} | <code>${Oe.kind}</code> | ${bn(Ot)} | ${Ms(Oe.description)} |
|
|
167
168
|
`)}ee.append("raw",`
|
|
168
|
-
`),ee.append("divider")}function
|
|
169
|
+
`),ee.append("divider")}function fm(ee,te){ee.append("h3","Module exports"),ee.append("raw",co);for(let Oe of te)ee.append("raw",`| ${oi(Oe.name,Oe.deprecated)} | <code>${Oe.kind}</code> | ${xc(Oe)} | ${Si(Oe.description,Oe.tags)} |
|
|
169
170
|
`);ee.append("raw",`
|
|
170
|
-
`),
|
|
171
|
-
`);else ee.append("p","None.")}function
|
|
172
|
-
${
|
|
171
|
+
`),Cc(ee,te)}function uo(ee,te,Oe){if(te.length>0)Oe(),ee.append("raw",`
|
|
172
|
+
`);else ee.append("p","None.")}function ho(ee,te){if(ee.append("h2",`\`${te.moduleName}\``),te.generics)ee.append("p",`**Type parameters:** ${bn(`<${te.generics[1]}>`)}`);if(te.typedefs.length>0)ee.append("h3","Types").append("raw",`\`\`\`ts
|
|
173
|
+
${Cs({typedefs:te.typedefs})}
|
|
173
174
|
\`\`\`
|
|
174
175
|
|
|
175
|
-
`);if(ee.append("h3","Props"),
|
|
176
|
-
`)}}),te.moduleExports.length>0)
|
|
177
|
-
`)}),ee.append("h3","Events"),
|
|
178
|
-
`)}),te.cssParts&&te.cssParts.length>0){ee.append("h3","CSS Parts"),ee.append("raw",
|
|
176
|
+
`);if(ee.append("h3","Props"),uo(ee,te.props,()=>{ee.append("raw",lc);let Oe=(jt)=>jt.reactive?0:jt.constant?2:1,Ot=te.props.map((jt,Vt)=>({prop:jt,index:Vt})).sort((jt,Vt)=>Oe(jt.prop)-Oe(Vt.prop)||jt.index-Vt.index).map(({prop:jt})=>jt);for(let jt of Ot){let Vt=ws(jt)?"accessor":jt.kind;ee.append("raw",`| ${oi(jt.name,jt.deprecated)} | ${jt.isRequired?"Yes":"No"} | <code>${Vt}</code> | ${jt.reactive?"Yes":"No"} | ${jt.binding??"--"} | ${bn(jt.type)} | ${bn(jt.value)} | ${Si(jt.description,jt.tags)} |
|
|
177
|
+
`)}}),te.moduleExports.length>0)fm(ee,te.moduleExports);if(ee.append("h3","Slots"),uo(ee,te.slots,()=>{ee.append("raw",uc);for(let Oe of te.slots)ee.append("raw",`| ${oi(Oe.default?zn:Oe.name??zn,Oe.deprecated)} | ${Oe.default?"Yes":"No"} | ${Ec(Oe.slot_props)} | ${Sc(Oe.fallback)} | ${Si(Oe.description,Oe.tags)} |
|
|
178
|
+
`)}),ee.append("h3","Events"),uo(ee,te.events,()=>{ee.append("raw",hc);for(let Oe of te.events)ee.append("raw",`| ${oi(Oe.name,Oe.deprecated)} | ${Oe.type} | ${bc(Oe.detail)} | ${Si(Oe.description,Oe.tags)} |
|
|
179
|
+
`)}),te.cssParts&&te.cssParts.length>0){ee.append("h3","CSS Parts"),ee.append("raw",dc);for(let Oe of te.cssParts)ee.append("raw",`| ${Oe.name} | ${Ms(Oe.description)} |
|
|
179
180
|
`);ee.append("raw",`
|
|
180
|
-
`)}if(te.cssProperties&&te.cssProperties.length>0){ee.append("h3","CSS Custom Properties"),ee.append("raw",
|
|
181
|
+
`)}if(te.cssProperties&&te.cssProperties.length>0){ee.append("h3","CSS Custom Properties"),ee.append("raw",fc);for(let Oe of te.cssProperties)ee.append("raw",`| ${Oe.name} | ${bn(Oe.type)} | ${bn(Oe.default)} | ${Ms(Oe.description)} |
|
|
181
182
|
`);ee.append("raw",`
|
|
182
|
-
`)}}var
|
|
183
|
+
`)}}var mm=/[^\w\- ]+/g,gm=/\s+/g,fo="<!-- __TOC__ -->";function ym(ee,te){let Oe=ee.toLowerCase().replace(pc,"").replace(mm,"").replace(gm,"-"),Ot=te.get(Oe)??0;return te.set(Oe,Ot+1),Ot===0?Oe:`${Oe}-${Ot}`}class mo{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(ee={}){this.onAppend=ee.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
183
184
|
|
|
184
|
-
`),this}append(ee,te){switch(ee){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(ee.slice(-1)))} ${te}`),this.hasToC&&ee==="h2")this.toc.push({indent:0,raw:te??""});break}case"quote":this.sourceParts.push(`> ${te}`);break;case"p":this.sourceParts.push(te??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(te??"");break}if(ee!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,ee,this),this}tableOfContents(){return this.sourceParts.push(
|
|
185
|
-
`);return ee.slice(0,te)+Ot+ee.slice(te+
|
|
186
|
-
${
|
|
185
|
+
`),this}append(ee,te){switch(ee){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(ee.slice(-1)))} ${te}`),this.hasToC&&ee==="h2")this.toc.push({indent:0,raw:te??""});break}case"quote":this.sourceParts.push(`> ${te}`);break;case"p":this.sourceParts.push(te??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(te??"");break}if(ee!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,ee,this),this}tableOfContents(){return this.sourceParts.push(fo),this.hasToC=!0,this.appendLineBreaks(),this}end(){let ee=this.sourceParts.join("");if(!this.hasToC)return ee;let te=ee.indexOf(fo);if(te===-1)return ee;let Oe=new Map,Ot=this.toc.map(({indent:jt,raw:Vt})=>`${" ".repeat(jt)}- [${Vt}](#${ym(Vt,Oe)})`).join(`
|
|
186
|
+
`);return ee.slice(0,te)+Ot+ee.slice(te+fo.length)}}function Fs(ee,te){return new mo({onAppend:(Oe,Ot)=>{te?.onAppend?.call(null,Oe,Ot,ee)}})}function Ui(ee,te){let Oe=Fs(ee,te);return wc(Oe,ee,te.entryExports),Oe.end()}async function xm(ee,te,Oe){let Ot=y(ee,{entryExports:te.entryExports}),jt=new On,Vt=Fs(ee,te);Tc(Vt,Ot.components,te.entryExports);let Wt=go(Ac(Oe,"README.md")),Mt=await jt.write(Wt,Vt.end());Bn(`${Mt?"created":"unchanged"} "${Wt}".`),await Promise.all(Ot.components.map(async(Gt)=>{let Ut=Fs(ee,te);ho(Ut,Gt);let Ht=go(Ac(Oe,`${Gt.moduleName}.md`)),qt=await jt.write(Ht,Ut.end());Bn(`${qt?"created":"unchanged"} "${Ht}".`)}))}async function yo(ee,te){if(te.outDir){await xm(ee,te,te.outDir);return}let Oe=go(te.outFile),Ot=await new On().write(Oe,Ui(ee,te));Bn(`${Ot?"created":"unchanged"} "${te.outFile}".`)}import{join as vm,resolve as Em}from"node:path";function Sm(ee,te){if(!te.indexTypes)return[];let Oe=te.format==="component",Ot=new Set,jt=[];for(let Vt of Object.values(te.exports)){if(!Vt.default||!_n.test(Vt.source))continue;let Wt=n(Vt.source);if(Ot.has(Wt))continue;Ot.add(Wt);let Mt=ee.components.find((Ut)=>Ut.filePath===Wt);if(!Mt)continue;let Gt=[vi(Mt.moduleName)];if(Oe)Gt.push(Mi(Mt.moduleName));jt.push({source:Vt.source,names:Gt})}return jt}async function Pc(ee,te,Oe){if(!ee)return te;try{let Ot=await ee(te,Oe);if(typeof Ot!=="string")throw TypeError(`must return a string, got ${typeof Ot}`);return Ot}catch(Ot){let jt=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: typesOptions.transform failed for "${Oe.filePath}": ${jt}`,{cause:Ot})}}function bm(ee,te){return`${ee}
|
|
187
|
+
${cp(te)}`}async function xo(ee,te){let Oe=Em(te.outDir,"index.d.ts"),Ot=new On,jt=y(ee),Vt=oc(Sm(jt,te)),Wt=te.preamble+[rc(te.exports),Vt].filter((Xt)=>Xt!=="").join(`
|
|
187
188
|
|
|
188
|
-
`),Mt=
|
|
189
|
-
${
|
|
190
|
-
`)})(),Ht=(await Promise.all([...Gt,Ut])).filter(Boolean).length,qt=Gt.length+1,zt=Ht===0?`unchanged ${qt}`:`created ${Ht} of ${qt}`;Bn(`${zt} TypeScript definitions in "${te.outDir}".`)}var
|
|
191
|
-
export{E,L,ne,x,D,ve,H,re,Se,U,v,p,o,
|
|
189
|
+
`),Mt=Lr(te),Gt=jt.components.map(async(Xt)=>{let Jt=so(vm(te.outDir,Xt.filePath)),Qt=n(so(Xt.filePath)),Yt=te.resolvedPathByFilePath?.get(Xt.filePath),nn=Yt?void 0:te.crossFileResolvedPathByFilePath?.get(Xt.filePath),sn=Yt??nn,cn=bm(Xt.moduleName,Mt),un=nn?`${cn}
|
|
190
|
+
${Rs(JSON.stringify(Xt))}`:cn,hn=sn?te.cache?.getGeneratedText(sn,un):void 0;if(hn===void 0){if(hn=Mr(Xt,Mt),sn)te.cache?.setGeneratedText(sn,un,hn)}let Ln=await Pc(te.transform,hn,{kind:"component",component:Xt,filePath:Qt});return Ot.write(Jt,Ln)}),Ut=(async()=>{let Xt=await Pc(te.transform,Wt,{kind:"index",filePath:"index.d.ts"});return Ot.write(Oe,`${Xt}
|
|
191
|
+
`)})(),Ht=(await Promise.all([...Gt,Ut])).filter(Boolean).length,qt=Gt.length+1,zt=Ht===0?`unchanged ${qt}`:`created ${Ht} of ${qt}`;Bn(`${zt} TypeScript definitions in "${te.outDir}".`)}var Cm=["reportDiagnostics","strict","check","checkLevel","stdout","format"],wm=50;function Tm(ee){let te=Promise.resolve();return()=>{te=te.then(ee,ee)}}function Lt(ee){let te=ee?.watch===!0,Oe,Ot,jt=ee??{},Vt,Wt=null,Mt,Gt=new Set,Ht=Tm(async()=>{if(Wt==null||Ot==null||Gt.size===0)return;let zt=Array.from(Gt);Gt.clear();try{let{result:Xt}=await Wt.update(zt);await Hi(Xt,jt,Ot)}catch(Xt){console.error("sveld: failed to regenerate types in watch mode:",Xt)}}),qt=(zt)=>{if(!te||Wt==null||!ba.test(zt))return;Gt.add(zt),clearTimeout(Mt),Mt=setTimeout(Ht,wm)};return{name:"vite-plugin-sveld",apply:te?void 0:"build",enforce:"post",configResolved(zt){Vt=zt.root},async buildStart(){if(ee?.config){let Xt=await j(ee.config,Vt??process.cwd(),!1);jt=I(Xt,ee)}V(jt);let zt=Cm.filter((Xt)=>(Xt in jt));if(zt.length>0)console.warn(`sveld: the Vite plugin ignores ${zt.map((Xt)=>`"${Xt}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(G(jt.quiet===!0),Ot=Is(jt.entry),te&&Ot!=null)try{Wt=await sc(Ot,jt.glob===!0,Vi(jt)),await Hi(await Wt.result,jt,Ot)}catch(Xt){console.error("sveld: failed to generate initial types in watch mode:",Xt)}},async generateBundle(){if(te)return;if(Ot==null)this.error(Wi);Oe=await Gi(Ot,jt.glob===!0,Vi(jt))},async writeBundle(){if(te)return;if(Ot==null)this.error(Wi);await Hi(Oe,jt,Ot)},handleHotUpdate(zt){qt(zt.file)},watchChange(zt){qt(zt)}}}async function Hi(ee,te,Oe){let Ot=_c(Oe);if(te.types!==!1)await xo(ee.allComponentsForTypes,{outDir:"types",preamble:"",...te.typesOptions,exports:ee.exports,inputDir:Ot,cache:ee.cache,resolvedPathByFilePath:ee.resolvedPathByFilePath,crossFileResolvedPathByFilePath:ee.crossFileResolvedPathByFilePath});if(te.json)await po(ee.components,{outFile:"COMPONENT_API.json",...te.jsonOptions,inputDir:Ot,entryExports:ee.entryExports});if(te.markdown)await yo(ee.components,{outFile:"COMPONENT_INDEX.md",...te.markdownOptions,entryExports:ee.entryExports});ee.cache?.save()}async function $c(ee,te,Oe){if(te.json){let Ot=ao(ee.components,{...te.jsonOptions,inputDir:_c(Oe),entryExports:ee.entryExports});process.stdout.write(Ot);return}if(te.markdown){let Ot=Ui(ee.components,{...te.markdownOptions,entryExports:ee.entryExports});process.stdout.write(Ot)}}import{realpathSync as Nc,statSync as km}from"node:fs";import{dirname as Dc,relative as Am,resolve as Pm}from"node:path";function _m(ee){if(ee.check&&!ee.check.snapshotExists&&!ee.writesSnapshot)return 1;if(ee.check?.changes.some((te)=>te.kind==="schema"))return 1;if(ee.errors.length>0)return 2;if(ee.check&&Ra(ee.check.bump,ee.checkLevel??"major"))return 3;if(_o(ee.diagnostics,ee.strict).length>0)return 4;return 0}async function Ie(ee,te,Oe=!1){let Ot=await Gi(ee,te.glob===!0,Vi(te)),jt=te.check?await $e(Ot.components,Ia(te),{entryExports:Ot.entryExports}):void 0;return await(Oe?$c:Hi)(Ot,te,ee),{result:Ot,check:jt}}function $m(ee){let te=Nc(km(ee).isFile()?Dc(ee):ee),Oe=Nc(process.env.GITHUB_WORKSPACE||process.cwd());return(Ot)=>n(Am(Oe,Pm(te,Ot)))}function Le(ee,te,Oe,Ot){let jt=Oe.reportDiagnostics||Oe.strict,Vt=Po(ee.diagnostics,jt);if(jt&&Vt.length>0)if(Oe.format==="json")process.stderr.write(Lo(Vt));else{if(Oe.format==="github"){let Mt=Oo(Vt,$m(Ot));if(Mt)console.error(Mt)}console.error(Ro(Vt))}let Wt=_m({errors:ee.errors,check:te,writesSnapshot:te?Oa(Oe,te.snapshotFile):!1,checkLevel:Oe.checkLevel,diagnostics:Vt,strict:Oe.strict});return{diagnostics:Vt,exitCode:Wt}}async function Bt(ee){if(ee&&"input"in ee)throw Error("sveld: the `input` option was renamed to `entry`.");if(typeof ee?.config==="string")throw Error("sveld: `config` takes `true` or `false`; import another config file and pass its options instead.");let{entry:te,...Oe}=ee??{},Ot=await j(Oe.config,process.cwd(),!0),jt=Is(te??Ot.entry);if(jt===null)throw Error(Wi);let Vt=I(Ot,Oe,{entry:jt});V(Vt),G(Vt.quiet===!0);let{result:Wt,check:Mt}=await Ie(jt,Vt),{diagnostics:Gt,exitCode:Ut}=Le(Wt,Mt,Vt,jt),Ht=Os(Wt.components,{inputDir:Dc(jt),entryExports:Wt.entryExports,source:Vt.jsonOptions?.source});return{diagnostics:Gt,check:Mt,errors:Wt.errors,document:Ht,exitCode:Ut}}
|
|
192
|
+
export{E,L,ne,x,D,ve,H,re,Se,U,v,p,o,i,b,t,C,c,m,T,Me,be,k,l,O,N,r,z,w,P,ie,se,a,J,Fe,_,M,h,u,K,d,oe,X,ae,Ce,Y,le,Be,Te,pe,Q,g,S,s,ce,ue,e,je,Ve,qe,Ge,We,He,Ue,ze,Je,Ke,ke,Xe,Ye,we,Qe,Ze,et,tt,Pe,Ae,nt,De,rt,it,A,st,ot,at,lt,pt,ct,ut,dt,ft,Ne,mt,ht,gt,yt,xt,Et,de,vt,St,bt,_e,Ct,Tt,kt,wt,f,Pt,At,Dt,fe,me,F,Nt,_t,B,he,ge,R,n,$t,y,Rt,$e,ye,It,xe,Ft,j,I,V,Z,q,G,Ee,W,Re,Lt,Ie,Le,Bt};
|