sveld 0.40.4 → 0.40.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser.js +120 -120
- package/chunk-ep5n8z9k.js +193 -0
- package/chunk-j58p3sv3.js +1 -0
- package/{chunk-qwe39hva.js → chunk-x82fq7xs.js} +1 -1
- package/chunk-xv4tka7y.js +40 -0
- package/cli-entry.js +3 -3
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-1wx900qk.js +0 -40
- package/chunk-yp51zj9v.js +0 -1
- package/chunk-yv6ea3ve.js +0 -193
package/chunk-yv6ea3ve.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
var S=Symbol("sveld.parsedComponentTypeScriptMetadata"),M=Symbol("sveld.parsedComponentPropIgnores");function wo(te){return te[M]}function ko(te){return te[S]}var zs=Array(2048).fill(void 0);function zc(){zs.fill(void 0)}function Ao(te,ne,Me,Ot){let Mt=Ot&2047,Vt=zs[Mt];if(Vt!==void 0&&Vt.length===Me-ne&&te.startsWith(Vt,ne))return Vt;let Wt=te.slice(ne,Me);return zs[Mt]=Wt,Wt}var di="",On=[0],Hn=0,hi=0,Un;function re(te){zc(),di=te,On=[0],Hn=0,hi=0,Un=void 0}function Xs(te){while(Hn<=te){let ne=di.indexOf(`
|
|
2
|
-
`,Hn);if(ne===-1){Hn=Number.POSITIVE_INFINITY;return}Hn=ne+1,On.push(Hn)}}function Po(te){let ne=[0],Me=te.indexOf(`
|
|
3
|
-
`);while(Me!==-1)ne.push(Me+1),Me=te.indexOf(`
|
|
4
|
-
`,Me+1);return ne}function ts(te,ne,Me){let Ot=0,Mt=te.length-1;if(ne>=te[Me])Ot=Me;else Mt=Me-1;if(Ot<Mt&&ne<te[Ot+1])Mt=Ot;while(Ot<Mt){let Vt=Ot+Mt+1>>>1;if(te[Vt]<=ne)Ot=Vt;else Mt=Vt-1}return Ot}function x(te){return Xs(te),hi=ts(On,te,hi),{line:hi+1,column:te-On[hi],character:te}}var qs=/\r\n?|\n|\u2028|\u2029/g,Xc=/[\r\u2028\u2029]/;function _o(te){if(Un===void 0){Un=Xc.test(di)?[]:null,qs.lastIndex=0;while(Un!==null&&qs.exec(di)!==null)Un.push(qs.lastIndex)}if(Un===null)return Xs(te),ts(On,te,hi);let ne=0,Me=Un.length;while(ne<Me){let Ot=ne+Me>>>1;if(Un[Ot]<=te)ne=Ot+1;else Me=Ot}return ne}function N(te){let{line:ne,column:Me}=x(te);return{line:ne,column:Me}}function $o(te){while(On.length<=te+1&&Hn!==Number.POSITIVE_INFINITY)Xs(Hn);if(te>=On.length)return;let ne=te+1<On.length?On[te+1]-1:di.length;return di.slice(On[te],ne)}function ve(te){let ne,Me=0;return(Ot)=>(ne??=Po(te),Me=ts(ne,Ot,Me),{line:Me+1,column:Ot-ne[Me]})}function Bn(te){return typeof te==="object"&&te!==null&&typeof ni(te).type==="string"}function ni(te){return te}function z(te,ne){let Me=ni(te);for(let Ot in Me){let Mt=Me[Ot];if(Array.isArray(Mt)){for(let Vt=0;Vt<Mt.length;Vt++)if(Bn(Mt[Vt]))Mt[Vt]=ne(Mt[Vt])}else if(Bn(Mt))Me[Ot]=ne(Mt)}}function Se(te,...ne){if(!ne.some((Me)=>Me===te.type))throw Error(`expected ${ne.join(" or ")}, got ${te.type}`)}function be(te){let ne=[];return ii(te,ne),ne}function ii(te,ne){switch(te.type){case"Identifier":ne.push(te);return;case"ObjectPattern":for(let Me of te.properties)ii(Me.type==="RestElement"?Me.argument:Me.value,ne);return;case"ArrayPattern":for(let Me of te.elements)if(Me!==null)ii(Me,ne);return;case"RestElement":ii(te.argument,ne);return;case"AssignmentPattern":ii(te.left,ne);return;case"TSParameterProperty":ii(te.parameter,ne);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":ii(te.expression,ne)}}function J(te,ne){if(te.type!=="Identifier")return!1;if(ne===null)return!0;switch(ne.type){case"MemberExpression":return ne.computed||te===ne.object;case"MethodDefinition":return ne.computed;case"Property":case"PropertyDefinition":return ne.computed||te===ne.value;case"ExportSpecifier":case"ImportSpecifier":return te===ne.local;case"MetaProperty":case"ImportAttribute":case"ExportAllDeclaration":case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":case"TSExportAssignment":return te===ne.expression;case"TSEnumMember":return te===ne.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!ne.type.startsWith("TS")}}var si={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=[],fi={...si,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"]},Jc=Object.assign(Object.create(null),si),Yc=Object.assign(Object.create(null),fi),No=[],b=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function o(te,ne,Me){ns(te,null,null,null,ne,Qc(Me))}function Qc(te){if(te===void 0||te===si)return el;if(te===fi)return tl;return(ne)=>Zc(te,ne.type)}function Zc(te,ne){return Object.hasOwn(te,ne)?te[ne]:void 0}var tg=Object.freeze([]);function ns(te,ne,Me,Ot,Mt,Vt){let Wt=Vt(te);if(Wt===void 0)throw Error(`unknown node type: ${te.type}`);let jt=Mt.enter?.(te,ne,Me,Ot);if(jt===b)return!0;if(jt!==p){if(jt!==te&&Bn(jt))return nl(jt,ne,Me,Ot,Mt,Vt);let Gt=ni(te);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(Bn(Xt)&&ns(Xt,te,Ht,zt,Mt,Vt))return!0}else if(Bn(qt)&&ns(qt,te,Ht,null,Mt,Vt))return!0}}return Mt.leave?.(te,ne,Me,Ot)===b}function el(te){let ne=te.type;if(ne==="Identifier")return te.typeAnnotation===void 0&&te.decorators===void 0?No:si.Identifier;if(ne==="Literal")return si.Literal;if(ne==="Text")return si.Text;return Jc[ne]}function tl(te){let ne=te.type;if(ne==="Identifier")return te.decorators===void 0?No:fi.Identifier;if(ne==="Literal")return fi.Literal;if(ne==="Text")return fi.Text;return Yc[ne]}function nl(te,ne,Me,Ot,Mt,Vt){if(ne===null||Me===null)throw Error("walk can't replace the node it was called with");let Wt=ni(ne),jt=Wt[Me];if(Ot===null)Wt[Me]=te;else if(Array.isArray(jt))jt[Ot]=te;return ns(te,ne,Me,Ot,Mt,Vt)}function i(te){return typeof te==="object"&&te!==null}function k(te){return i(te)&&te.type==="Literal"}function t(te){return i(te)&&te.type==="Identifier"&&typeof te.name==="string"}function w(te){return i(te)&&te.type==="MemberExpression"}function c(te){return i(te)&&te.type==="ObjectExpression"&&Array.isArray(te.properties)}function il(te){return i(te)&&te.type==="CallExpression"}function m(te,ne){return il(te)&&t(te.callee)&&te.callee.name===ne}function P(te){return te?.type==="TSAsExpression"||te?.type==="TSSatisfiesExpression"?P(te.expression):te}function Fe(te){return te?.type==="TSAsExpression"||te?.type==="TSSatisfiesExpression"?te.typeAnnotation:void 0}function sl(te){return i(te)&&te.type==="NewExpression"}function Te(te,ne){return sl(te)&&t(te.callee)&&te.callee.name===ne}function A(te){if(!i(te))return null;if(te.type==="Literal")return te.value==null?null:String(te.value);if(te.type==="TemplateLiteral"){let ne=te.quasis;if(ne?.length===1)return ne[0]?.value?.cooked??null}return null}function l(te){if(t(te))return te.name;if(k(te))return te.value==null?void 0:String(te.value);return}var rl=new Set(["Component","SvelteComponent","SvelteSelf"]),ol=new Set(["RegularElement","SvelteElement"]);function F(te){return rl.has(te)}function _(te){return ol.has(te)}var al=/\s/;function is(te,ne,Me=0,Ot=te.length,Mt=0){let Vt=Mt;for(let Wt=Me;Wt<Ot;Wt++){let jt=te.charCodeAt(Wt);if(jt===34||jt===39||jt===96){Wt=Do(te,Wt,Ot);continue}if(jt===123||jt===40||jt===91||jt===60)Vt++;else if(jt===125||jt===41||jt===93||jt===62&&te.charCodeAt(Wt-1)!==61){if(Vt>0)Vt--}if(ne?.(Wt,Vt)===!0)break}return Vt}function Do(te,ne,Me){let Ot=te.charCodeAt(ne);for(let Mt=ne+1;Mt<Me;Mt++){let Vt=te.charCodeAt(Mt);if(Vt===92)Mt++;else if(Vt===Ot)return Mt}return Me-1}function r(te,ne){let Me=[],Ot=0;return is(te,(Mt,Vt)=>{if(Vt===0&&ne.includes(te[Mt]))Me.push(te.slice(Ot,Mt)),Ot=Mt+1;return!1}),Me.push(te.slice(Ot)),Me}function Js(te,ne,Me=0){let Ot=-1;return is(te,(Mt,Vt)=>{if(ne(Mt,Vt))Ot=Mt;return Ot!==-1},Me),Ot}function T(te,ne){return Js(te,(Me,Ot)=>Ot===0&&ne.includes(te[Me]))}function C(te){return Js(te,(ne,Me)=>Me===0&&te[ne]==="="&&te[ne+1]===">")}function E(te,ne){return Js(te,(Me,Ot)=>Ot===0,ne)}function ki(te){let ne=te.trim();return ne.startsWith("[")&&E(ne,0)===ne.length-1}function ie(te){if(!te)return;let ne=C(te);if(ne===-1)return;return te.slice(ne+2).trim()||void 0}var pl=new Set(["null","undefined"]);function se(te){if(!te)return!1;let ne=r(te,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!pl.has(Ot));if(ne.length!==1)return!1;let Me=mi(ne[0]);return(Me.startsWith("(")||Me.startsWith("<"))&&C(Me)!==-1}function _n(te){let ne="",Me=!1,Ot=(Vt)=>{if(Me&&ne!=="")ne+=" ";Me=!1,ne+=Vt},Mt=0;while(Mt<te.length){let Vt=te.charCodeAt(Mt);if(Vt===34||Vt===39||Vt===96){let Wt=Do(te,Mt,te.length);Ot(te.slice(Mt,Wt+1)),Mt=Wt+1}else if(te.startsWith("/*",Mt)){let Wt=te.indexOf("*/",Mt+2);Mt=Wt===-1?te.length:Wt+2,Me=!0}else if(te.startsWith("//",Mt)){let Wt=te.indexOf(`
|
|
5
|
-
`,Mt+2);Mt=Wt===-1?te.length:Wt+1,Me=!0}else if(al.test(te[Mt]))Me=!0,Mt++;else Ot(te[Mt]),Mt++}return ne}function mi(te){let ne=te.trim();while(ne.startsWith("(")&&E(ne,0)===ne.length-1)ne=ne.slice(1,-1).trim();return ne}function cl(te){let ne="";for(let Me=0;Me<te.length;Me++){let Ot=te[Me];if(Ot==="*"&&te[Me+1]==="*"){if(Me++,te[Me+1]==="/")ne+="(?:.*/)?",Me++;else ne+=".*";continue}if(Ot==="*"){ne+="[^/]*";continue}if(Ot==="?"){ne+="[^/]";continue}ne+=".+^$()[]{}|\\".includes(Ot)?`\\${Ot}`:Ot}return ne}function Ro(te,ne){return new RegExp(`^${cl(te)}$`).test(ne)}var Ys={"prop-unknown-type":{severity:"warning",label:"Props without inferred types"},"context-any-type":{severity:"warning",label:"Context values typed as `any`"},"bind-this-type-mismatch":{severity:"warning",label:"bind:this props declared with an element type they're never bound to"},"slot-missing-type":{severity:"warning",label:"@slot/@snippet tags missing a {Type} annotation"},"slot-not-rendered":{severity:"warning",label:"@slot/@snippet tags for slots the component doesn't render"},"event-no-source":{severity:"warning",label:"@event tags with no dispatch or callback"},"dispatch-escapes":{severity:"warning",label:"Dispatchers passed to functions sveld can't follow"},"example-compile-error":{severity:"error",label:"@example blocks that failed to compile"},"example-syntax-error":{severity:"error",label:"@example blocks that failed to parse"},"syntax-skipped":{severity:"error",label:"Component syntax sveld skipped"},"type-syntax-error":{severity:"error",label:"JSDoc types that aren't valid TypeScript"},"rest-props-unresolved":{severity:"warning",label:"$$restProps spread only onto components"},"context-duplicate-key":{severity:"warning",label:"Duplicate setContext keys"},"context-key-unresolved":{severity:"warning",label:"setContext keys sveld couldn't resolve"},"context-value-unresolved":{severity:"warning",label:"setContext values sveld couldn't describe"},"spread-unresolved":{severity:"warning",label:"Unresolved spreads widened to Record<string, any>"},"export-unresolved":{severity:"warning",label:"Unresolved named export specifiers"},"module-export-conflict":{severity:"warning",label:"Module-script exports colliding with generated names"},"extend-props-target-missing":{severity:"error",label:"@extends/@extendProps targets that couldn't be verified"},"extend-props-duplicate":{severity:"warning",label:"Duplicate @extends/@extendProps tags"},"extend-props-override":{severity:"warning",label:"Own props overriding an @extends target's prop"},"jsdoc-unknown-tag":{severity:"warning",label:"Unknown JSDoc tags"},"typedef-duplicate":{severity:"warning",label:"Duplicate @typedef/@callback names"},"property-duplicate":{severity:"warning",label:"Duplicate @property names"},"generics-conflict":{severity:"warning",label:"Duplicate @generics/@template names"},"event-description-ambiguous":{severity:"warning",label:"Text after an @event read as the next tag's description"},"jsdoc-tag-dropped":{severity:"warning",label:"Passthrough JSDoc tags that couldn't attach"},"internal-typedef-referenced":{severity:"error",label:"Public types referencing an @internal typedef"},"cross-file-unresolved":{severity:"warning",label:"Imports a standalone parse couldn't read"},"export-ambiguous":{severity:"warning",label:"Ambiguous `export *` names left out of the entry exports"}};function a(te){return{...te,code:K[te.kind],severity:Ys[te.kind].severity}}function Io(te,ne){if(ne)return te;return te.filter((Me)=>Me.kind!=="jsdoc-unknown-tag")}function Oo(te,ne){if(!ne)return[];return te.filter((Me)=>!Me.ignored&&(ne!=="errors"||Me.severity==="error"))}function ll(te,ne){if(ne.code!==void 0&&ne.code!==te.code)return!1;if(ne.name!==void 0&&ne.name!==te.name)return!1;if(ne.component!==void 0&&!Ro(ne.component,te.component))return!1;return!0}function Lo(te,ne){if(!ne||ne.length===0)return te;return te.map((Me)=>Me.ignored||ne.some((Ot)=>ll(Me,Ot))?{...Me,ignored:!0}:Me)}var Mo=Object.keys(Ys),K=Object.fromEntries(Mo.map((te)=>[te,`sveld/${te}`]));function Fo(te){let ne=new Set,Me=[];for(let Ot of te){let Mt=`${Ot.component}:${Ot.kind}:${Ot.name}`;if(ne.has(Mt))continue;ne.add(Mt),Me.push(Ot)}return Me}function Bo(te){let ne=te.filter((Gt)=>!Gt.ignored),Me=te.length-ne.length,Ot=Me>0?` (${Me} ignored)`:"";if(ne.length===0)return`sveld: no diagnostics${Ot}.`;let Mt=[],Vt=(Gt,Ut)=>`${Gt} ${Ut}${Gt===1?"":"s"}`,Wt=ne.filter((Gt)=>Gt.severity==="error").length,jt=`${Vt(Wt,"error")}, ${Vt(ne.length-Wt,"warning")}`;Mt.push(`sveld: ${Vt(ne.length,"diagnostic")} (${jt})${Ot}.`);for(let Gt of Mo){let Ut=ne.filter((qt)=>qt.kind===Gt);if(Ut.length===0)continue;Mt.push(""),Mt.push(`${Ys[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){Mt.push(` ${qt}`);for(let Xt of zt){let Jt=Xt.source?` (${qt}:${Xt.source.start.line}:${Xt.source.start.column})`:"";Mt.push(` - ${Xt.message}${Jt} [${Xt.code}]`)}}}return Mt.join(`
|
|
6
|
-
`)}function jo(te){return te.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
7
|
-
`,"%0A")}function ul(te){return jo(te).replaceAll(":","%3A").replaceAll(",","%2C")}function hl(te){let Me=[["file",te.file],["line",te.line],["col",te.column],["endLine",te.endLine],["endColumn",te.endColumn],["title",te.title]].filter((Ot)=>Ot[1]!==void 0).map(([Ot,Mt])=>`${Ot}=${ul(String(Mt))}`).join(",");return`::${te.severity} ${Me}::${jo(te.message)}`}function Vo(te,ne){let Me=te.filter((Mt)=>!Mt.ignored);return[...Me.filter((Mt)=>Mt.severity==="error"),...Me.filter((Mt)=>Mt.severity!=="error")].map(({source:Mt,...Vt})=>{let Wt=Mt!==void 0&&Mt.start.line===Mt.end.line;return hl({severity:Vt.severity,title:Vt.code,message:Vt.message,file:ne(Vt.component),line:Mt?.start.line,column:Wt?Mt.start.column+1:void 0,endLine:Mt?.end.line,endColumn:Wt?Mt.end.column+1:void 0})}).join(`
|
|
8
|
-
`)}var Be=1;function Go(te){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Be,diagnostics:te},null,2)}
|
|
9
|
-
`}function gi(te,ne){if(ne.length===0)return;te.diagnostics=[...te.diagnostics??[],...ne]}var dl=/\*\//g,fl=/[.*+?^${}()|[\]\\]/g;function R(te){return te.replace(fl,"\\$&")}function B(te){return te.replace(dl,"*\\/")}function h(te){return te.map((ne)=>`${ne.name}${ne.optional?"?":""}: ${ne.type}`).join(", ")}var ml=new Intl.Collator("en");function u(te,ne){return ml.compare(te,ne)}var gl=/(?:_|[^\p{ID_Continue}$])+/u,yl=/^[\p{ID_Start}$]/u;function X(te){let Ot=`${te.split(gl).map((Mt)=>Mt.charAt(0).toUpperCase()+Mt.slice(1)).join("")}Context`;return yl.test(Ot)?Ot:`_${Ot}`}var xl=/^\{([\s\S]*)\}$/,vl=/^[A-Za-z_$][\w$]*$/,El=/^readonly\s+/,Sl=/^\[[\w$]+\s*:[^\]]+\]$/;function d(te,{skipIndexSignatures:ne=!1,withReadonly:Me=!1}={}){let Ot=te.trim(),Mt=xl.exec(Ot);if(!Mt)return null;let Vt=Mt[1].trim();if(Vt==="")return[];let Wt=[];for(let jt of r(Vt,";,")){let Gt=jt.trim();if(!Gt)continue;let Ut=T(Gt,":");if(Ut===-1)return null;let Ht=Gt.slice(0,Ut).trim(),qt=Ht.replace(El,""),zt=Gt.slice(Ut+1).trim();if(!zt)return null;if(ne&&Sl.test(qt))continue;let Xt=!1;if(qt.endsWith("?"))Xt=!0,qt=qt.slice(0,-1).trim();if(!vl.test(qt))return null;Wt.push(Me?{name:qt,type:zt,optional:Xt,readonly:Ht!==qt}:{name:qt,type:zt,optional:Xt})}return Wt}function oe({imported:te}){return te.type==="Identifier"?te.name:te.value}function Y(te,ne){let Me=ne.source.value;if(typeof Me!=="string"||ne.importKind==="type")return;for(let Ot of ne.specifiers){if(Ot.type!=="ImportSpecifier"||Ot.importKind==="type")continue;let Mt=Ot.local.name,Vt=oe(Ot);te.valueImportBindingsByLocalName.set(Mt,{localName:Mt,importedName:Vt,source:Me})}}function ae(te){return[te.importedName,...te.members??[]].join(".")}function Ce(te,ne){let Me=[],Ot=ne;while(w(Ot)){if(Ot.computed||!t(Ot.property))return;Me.unshift(Ot.property.name),Ot=Ot.object}if(!t(Ot))return;return Q(te,Ot.name,Me)}function Q(te,ne,Me=[]){let Ot=(Vt,Wt,jt)=>jt.length>0?{source:Vt,importedName:Wt,members:jt}:{source:Vt,importedName:Wt},Mt=te.valueImportBindingsByLocalName.get(ne);if(Mt)return Ot(Mt.source,Mt.importedName,Me);for(let Vt of[te.parsed?.instance,te.parsed?.module])for(let Wt of Vt?.content.body??[]){if(Wt.type!=="ImportDeclaration")continue;let jt=Wt.source.value;if(Wt.importKind==="type"||typeof jt!=="string")continue;let Gt=Wt.specifiers.find((Ut)=>Ut.local.name===ne);if(Gt?.type==="ImportDefaultSpecifier")return Ot(jt,"default",Me);if(Gt?.type==="ImportNamespaceSpecifier"&&Me.length>0)return Ot(jt,Me[0],Me.slice(1))}return}function le(te,ne){if(!w(ne))return;return Ce(te,ne)}function je(te){let ne=new Map;for(let Me of te.content.body){if(Me.type!=="ImportDeclaration"||Me.importKind==="type")continue;let Ot=Me.source.value;if(typeof Ot!=="string")continue;for(let Mt of Me.specifiers){if(Mt.type==="ImportSpecifier"&&Mt.importKind==="type")continue;let Vt=Mt.local.name,Wt;if(Mt.type==="ImportDefaultSpecifier")Wt="default";else if(Mt.type==="ImportNamespaceSpecifier")Wt="*";else Wt=oe(Mt);ne.set(Vt,{from:Ot,imported:Wt})}}return ne}function ke(te,ne){for(let Me of ne?.content.body??[]){if(Me.type==="ImportDeclaration"){Y(te,Me);continue}let Ot=Me.type==="ExportNamedDeclaration"&&Me.declaration?Me.declaration:Me;if(Ot.type==="FunctionDeclaration"&&Ot.id?.name)te.funcDecls.set(Ot.id.name,Ot)}}function pe(te){return te==="TSTypeAnnotation"||te==="TSTypeAliasDeclaration"||te==="TSInterfaceDeclaration"||te==="TSTypeParameterDeclaration"||te==="TSTypeParameterInstantiation"}function Z(te){let ne=[];return o(te,{enter(Me){if(Me.type==="FunctionDeclaration"||Me.type==="FunctionExpression"||Me.type==="ArrowFunctionExpression")return p;if(Me.type==="ReturnStatement")ne.push(Me.argument??null)}}),ne}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",bl={5:Zs,"5module":Zs+" export import",6:Zs+" const class extends export import super"},qo=/^in(stanceof)?$/,Cl=/\p{ID_Start}/u,Tl=/[\p{ID_Continue}\u200c\u200d]/u;function g(te,ne){if(te<65)return te===36;if(te<91)return!0;if(te<97)return te===95;if(te<123)return!0;if(te>65535&&ne===!1)return!1;return te>=170&&Cl.test(String.fromCodePoint(te))}function v(te,ne){if(te<48)return te===36;if(te<58)return!0;if(te<65)return!1;if(te<91)return!0;if(te<97)return te===95;if(te<123)return!0;if(te>65535&&ne===!1)return!1;return te>=170&&Tl.test(String.fromCodePoint(te))}var pn=function(te,ne){if(ne===void 0)ne={};this.label=te,this.keyword=ne.keyword,this.beforeExpr=!!ne.beforeExpr,this.startsExpr=!!ne.startsExpr,this.isLoop=!!ne.isLoop,this.isAssign=!!ne.isAssign,this.prefix=!!ne.prefix,this.postfix=!!ne.postfix,this.binop=ne.binop||null,this.updateContext=null};function Cn(te,ne){return new pn(te,{beforeExpr:!0,binop:ne})}var Tn={beforeExpr:!0},vn={startsExpr:!0},ir={};function an(te,ne){if(ne===void 0)ne={};return ne.keyword=te,ir[te]=new pn(te,ne)}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(",",Tn),semi:new pn(";",Tn),colon:new pn(":",Tn),dot:new pn("."),question:new pn("?",Tn),questionDot:new pn("?."),arrow:new pn("=>",Tn),template:new pn("template"),invalidTemplate:new pn("invalidTemplate"),ellipsis:new pn("...",Tn),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",Tn),_catch:an("catch"),_continue:an("continue"),_debugger:an("debugger"),_default:an("default",Tn),_do:an("do",{isLoop:!0,beforeExpr:!0}),_else:an("else",Tn),_finally:an("finally"),_for:an("for",{isLoop:!0}),_function:an("function",vn),_if:an("if"),_return:an("return",Tn),_switch:an("switch"),_throw:an("throw",Tn),_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",Tn),_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/,wl=new RegExp(En.source,"g");function yi(te){return te===10||te===13||te===8232||te===8233}function zo(te,ne,Me){if(Me===void 0)Me=te.length;for(var Ot=ne;Ot<Me;Ot++){var Mt=te.charCodeAt(Ot);if(yi(Mt))return Ot<Me-1&&Mt===13&&te.charCodeAt(Ot+1)===10?Ot+2:Ot+1}return-1}var Xo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,dn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,kl=Object.prototype,{hasOwnProperty:Al,toString:Pl}=kl,_i=Object.hasOwn||function(te,ne){return Al.call(te,ne)},Wo=Array.isArray||function(te){return Pl.call(te)==="[object Array]"},Uo=Object.create(null);function ss(te){return Uo[te]||(Uo[te]=new RegExp("^(?:"+te.replace(/ /g,"|")+")$"))}function ps(te){if(te<=65535)return String.fromCharCode(te);return te-=65536,String.fromCharCode((te>>10)+55296,(te&1023)+56320)}var _l=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Pi=function(te,ne){this.line=te,this.column=ne};Pi.prototype.offset=function(te){return new Pi(this.line,this.column+te)};var cs=function(te,ne,Me){if(this.start=ne,this.end=Me,te.sourceFile!==null)this.source=te.sourceFile};function Jo(te,ne){for(var Me=1,Ot=0;;){var Mt=zo(te,Ot,ne);if(Mt<0)return new Pi(Me,ne-Ot);++Me,Ot=Mt}}var er={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},Ho=!1;function $l(te){var ne={};for(var Me in er)ne[Me]=te&&_i(te,Me)?te[Me]:er[Me];if(ne.ecmaVersion==="latest")ne.ecmaVersion=1e8;else if(ne.ecmaVersion==null){if(!Ho&&typeof console==="object"&&console.warn)Ho=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
10
|
-
Defaulting to 2020, but this will stop working in the future.`);ne.ecmaVersion=11}else if(ne.ecmaVersion>=2015)ne.ecmaVersion-=2009;if(ne.allowReserved==null)ne.allowReserved=ne.ecmaVersion<5;if(!te||te.allowHashBang==null)ne.allowHashBang=ne.ecmaVersion>=14;if(Wo(ne.onToken)){var Ot=ne.onToken;ne.onToken=function(Mt){return Ot.push(Mt)}}if(Wo(ne.onComment))ne.onComment=Nl(ne,ne.onComment);if(ne.sourceType==="commonjs"&&ne.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return ne}function Nl(te,ne){return function(Me,Ot,Mt,Vt,Wt,jt){var Gt={type:Me?"Block":"Line",value:Ot,start:Mt,end:Vt};if(te.locations)Gt.loc=new cs(this,Wt,jt);if(te.ranges)Gt.range=[Mt,Vt];ne.push(Gt)}}var ri=1,oi=2,sr=4,Yo=8,rr=16,Qo=32,ls=64,Zo=128,ai=256,$i=512,ea=1024,us=ri|oi|ai;function or(te,ne){return oi|(te?sr:0)|(ne?Yo:0)}var rs=0,ar=1,jn=2,ta=3,na=4,ia=5,s=function(te,ne,Me){this.options=te=$l(te),this.sourceFile=te.sourceFile,this.keywords=ss(bl[te.ecmaVersion>=6?6:te.sourceType==="module"?"5module":5]);var Ot="";if(te.allowReserved!==!0){if(Ot=Qs[te.ecmaVersion>=6?6:te.ecmaVersion===5?5:3],te.sourceType==="module")Ot+=" await"}this.reservedWords=ss(Ot);var Mt=(Ot?Ot+" ":"")+Qs.strict;if(this.reservedWordsStrict=ss(Mt),this.reservedWordsStrictBind=ss(Mt+" "+Qs.strictBind),this.input=String(ne),this.containsEsc=!1,this.pos=Me||0,this.curLine=1,te.startLocation)this.lineStart=this.pos-te.startLocation.column,this.curLine=te.startLocation.line;else if(Me){if(this.lineStart=this.input.lastIndexOf(`
|
|
11
|
-
`,Me-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=te.sourceType==="module",this.strict=this.inModule||te.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&te.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?oi:ri),this.regexpState=null,this.privateNameStack=[]},wn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};s.prototype.parse=function(){var te=this,ne=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return te.parseTopLevel(ne)})};wn.inFunction.get=function(){return(this.currentVarScope().flags&oi)>0};wn.inGenerator.get=function(){return(this.currentVarScope().flags&Yo)>0};wn.inAsync.get=function(){return(this.currentVarScope().flags&sr)>0};wn.canAwait.get=function(){for(var te=this.scopeStack.length-1;te>=0;te--){var ne=this.scopeStack[te],Me=ne.flags;if(Me&(ai|$i))return!1;if(Me&oi)return(Me&sr)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};wn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ri)return!0;return!1};wn.allowSuper.get=function(){var te=this.currentThisScope(),ne=te.flags;return(ne&ls)>0||this.options.allowSuperOutsideMethod};wn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Zo)>0};wn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};wn.allowNewDotTarget.get=function(){for(var te=this.scopeStack.length-1;te>=0;te--){var ne=this.scopeStack[te],Me=ne.flags;if(Me&(ai|$i)||Me&oi&&!(Me&rr))return!0}return!1};wn.allowUsing.get=function(){var te=this.currentScope(),ne=te.flags;if(ne&ea)return!1;if(!this.inModule&&ne&ri)return!1;return!0};wn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ai)>0};s.extend=function(){var te=[],ne=arguments.length;while(ne--)te[ne]=arguments[ne];var Me=this;for(var Ot=0;Ot<te.length;Ot++)Me=te[Ot](Me);return Me};s.parse=function(te,ne){return new this(ne,te).parse()};s.parseExpressionAt=function(te,ne,Me){var Ot=new this(Me,te,ne);return Ot.nextToken(),Ot.parseExpression()};s.tokenizer=function(te,ne){return new this(ne,te)};Object.defineProperties(s.prototype,wn);var yn=s.prototype,Dl=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;yn.strictDirective=function(te){if(this.options.ecmaVersion<5)return!1;for(;;){dn.lastIndex=te,te+=dn.exec(this.input)[0].length;var ne=Dl.exec(this.input.slice(te));if(!ne)return!1;if((ne[1]||ne[2])==="use strict"){dn.lastIndex=te+ne[0].length;var Me=dn.exec(this.input),Ot=Me.index+Me[0].length,Mt=this.input.charAt(Ot);return Mt===";"||Mt==="}"||En.test(Me[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Mt)||Mt==="!"&&this.input.charAt(Ot+1)==="="||Mt==="i"&&Rl(this,Ot))}if(te+=ne[0].length,dn.lastIndex=te,te+=dn.exec(this.input)[0].length,this.input[te]===";")te++}};function Rl(te,ne){var Me=ne+1,Ot=Math.min(te.input.length,ne+11);while(Me<Ot){var Mt=te.fullCharCodeAt(Me);if(!v(Mt,!0))break;Me+=Mt<=65535?1:2}return Me===ne+2&&te.input.slice(ne,Me)==="in"||Me===ne+10&&te.input.slice(ne,Me)==="instanceof"}yn.eat=function(te){if(this.type===te)return this.next(),!0;else return!1};yn.isContextual=function(te){return this.type===Kt.name&&this.value===te&&!this.containsEsc};yn.eatContextual=function(te){if(!this.isContextual(te))return!1;return this.next(),!0};yn.catchStackOverflow=function(te){try{return te()}catch(ne){if(ne instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(ne.message)||/\btoo much recursion\b/i.test(ne.message)))this.raise(this.start,"Not enough stack space to parse input");else throw ne}};yn.expectContextual=function(te){if(!this.eatContextual(te))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(te,ne){if(this.type===te){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!ne)this.next();return!0}};yn.expect=function(te){this.eat(te)||this.unexpected()};yn.unexpected=function(te){this.raise(te!=null?te:this.start,"Unexpected token")};var hs=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};yn.checkPatternErrors=function(te,ne){if(!te)return;if(te.trailingComma>-1)this.raiseRecoverable(te.trailingComma,"Comma is not permitted after the rest element");var Me=ne?te.parenthesizedAssign:te.parenthesizedBind;if(Me>-1)this.raiseRecoverable(Me,ne?"Assigning to rvalue":"Parenthesized pattern")};yn.checkExpressionErrors=function(te,ne){if(!te)return!1;var{shorthandAssign:Me,doubleProto:Ot}=te;if(!ne)return Me>=0||Ot>=0;if(Me>=0)this.raise(Me,"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(te){if(te.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(te.expression);return te.type==="Identifier"||te.type==="MemberExpression"};var Zt=s.prototype;Zt.parseTopLevel=function(te){var ne=Object.create(null);if(!te.body)te.body=[];while(this.type!==Kt.eof){var Me=this.parseStatement(null,!0,ne);te.body.push(Me)}if(this.inModule)for(var Ot=0,Mt=Object.keys(this.undefinedExports);Ot<Mt.length;Ot+=1){var Vt=Mt[Ot];this.raiseRecoverable(this.undefinedExports[Vt].start,"Export '"+Vt+"' is not defined")}return this.adaptDirectivePrologue(te.body),this.next(),te.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(te,"Program")};var pr={kind:"loop"},Il={kind:"switch"};Zt.isLet=function(te){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;dn.lastIndex=this.pos;var ne=dn.exec(this.input),Me=this.pos+ne[0].length,Ot=this.fullCharCodeAt(Me);if(Ot===91||Ot===92)return!0;if(te)return!1;if(Ot===123)return!0;if(g(Ot)){var Mt=Me;do Me+=Ot<=65535?1:2;while(v(Ot=this.fullCharCodeAt(Me)));if(Ot===92)return!0;var Vt=this.input.slice(Mt,Me);if(!qo.test(Vt))return!0}return!1};Zt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dn.lastIndex=this.pos;var te=dn.exec(this.input),ne=this.pos+te[0].length,Me;return!En.test(this.input.slice(this.pos,ne))&&this.input.slice(ne,ne+8)==="function"&&(ne+8===this.input.length||!(v(Me=this.fullCharCodeAt(ne+8))||Me===92))};Zt.isUsingKeyword=function(te,ne){if(this.options.ecmaVersion<17||!this.isContextual(te?"await":"using"))return!1;dn.lastIndex=this.pos;var Me=dn.exec(this.input),Ot=this.pos+Me[0].length;if(En.test(this.input.slice(this.pos,Ot)))return!1;if(te){var Mt=Ot+5,Vt;if(this.input.slice(Ot,Mt)!=="using"||Mt===this.input.length||v(Vt=this.fullCharCodeAt(Mt))||Vt===92)return!1;dn.lastIndex=Mt;var Wt=dn.exec(this.input);if(Ot=Mt+Wt[0].length,Wt&&En.test(this.input.slice(Mt,Ot)))return!1}var jt=this.fullCharCodeAt(Ot);if(!g(jt)&&jt!==92)return!1;var Gt=Ot;do Ot+=jt<=65535?1:2;while(v(jt=this.fullCharCodeAt(Ot)));if(jt===92)return!0;var Ut=this.input.slice(Gt,Ot);if(qo.test(Ut))return!1;if(ne&&!te&&Ut==="of"){dn.lastIndex=Ot;var Ht=dn.exec(this.input);if(Ot=Ot+Ht[0].length,this.input.charCodeAt(Ot)!==61||(jt=this.input.charCodeAt(Ot+1))===61||jt===62)return!1}return!0};Zt.isAwaitUsing=function(te){return this.isUsingKeyword(!0,te)};Zt.isUsing=function(te){return this.isUsingKeyword(!1,te)};Zt.parseStatement=function(te,ne,Me){var Ot=this.type,Mt=this.startNode(),Vt;if(this.isLet(te))Ot=Kt._var,Vt="let";switch(Ot){case Kt._break:case Kt._continue:return this.parseBreakContinueStatement(Mt,Ot.keyword);case Kt._debugger:return this.parseDebuggerStatement(Mt);case Kt._do:return this.parseDoStatement(Mt);case Kt._for:return this.parseForStatement(Mt);case Kt._function:if(te&&(this.strict||te!=="if"&&te!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Mt,!1,!te);case Kt._class:if(te)this.unexpected();return this.parseClass(Mt,!0);case Kt._if:return this.parseIfStatement(Mt);case Kt._return:return this.parseReturnStatement(Mt);case Kt._switch:return this.parseSwitchStatement(Mt);case Kt._throw:return this.parseThrowStatement(Mt);case Kt._try:return this.parseTryStatement(Mt);case Kt._const:case Kt._var:if(Vt=Vt||this.value,te&&Vt!=="var")this.unexpected();return this.parseVarStatement(Mt,Vt);case Kt._while:return this.parseWhileStatement(Mt);case Kt._with:return this.parseWithStatement(Mt);case Kt.braceL:return this.parseBlock(!0,Mt);case Kt.semi:return this.parseEmptyStatement(Mt);case Kt._export:case Kt._import:if(this.options.ecmaVersion>10&&Ot===Kt._import){dn.lastIndex=this.pos;var Wt=dn.exec(this.input),jt=this.pos+Wt[0].length,Gt=this.input.charCodeAt(jt);if(Gt===40||Gt===46)return this.parseExpressionStatement(Mt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!ne)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return Ot===Kt._import?this.parseImport(Mt):this.parseExport(Mt,Me);default:if(this.isAsyncFunction()){if(te)this.unexpected();return this.next(),this.parseFunctionStatement(Mt,!0,!te)}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(te)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(Mt,!1,Ut),this.semicolon(),this.finishNode(Mt,"VariableDeclaration")}var Ht=this.value,qt=this.parseExpression();if(Ot===Kt.name&&qt.type==="Identifier"&&this.eat(Kt.colon))return this.parseLabeledStatement(Mt,Ht,qt,te);else return this.parseExpressionStatement(Mt,qt)}};Zt.parseBreakContinueStatement=function(te,ne){var Me=ne==="break";if(this.next(),this.eat(Kt.semi)||this.insertSemicolon())te.label=null;else if(this.type!==Kt.name)this.unexpected();else te.label=this.parseIdent(),this.semicolon();var Ot=0;for(;Ot<this.labels.length;++Ot){var Mt=this.labels[Ot];if(te.label==null||Mt.name===te.label.name){if(Mt.kind!=null&&(Me||Mt.kind==="loop"))break;if(te.label&&Me)break}}if(Ot===this.labels.length)this.raise(te.start,"Unsyntactic "+ne);return this.finishNode(te,Me?"BreakStatement":"ContinueStatement")};Zt.parseDebuggerStatement=function(te){return this.next(),this.semicolon(),this.finishNode(te,"DebuggerStatement")};Zt.parseDoStatement=function(te){if(this.next(),this.labels.push(pr),te.body=this.parseStatement("do"),this.labels.pop(),this.expect(Kt._while),te.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Kt.semi);else this.semicolon();return this.finishNode(te,"DoWhileStatement")};Zt.parseForStatement=function(te){this.next();var ne=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(pr),this.enterScope(0),this.expect(Kt.parenL),this.type===Kt.semi){if(ne>-1)this.unexpected(ne);return this.parseFor(te,null)}var Me=this.isLet();if(this.type===Kt._var||this.type===Kt._const||Me){var Ot=this.startNode(),Mt=Me?"let":this.value;return this.next(),this.parseVar(Ot,!0,Mt),this.finishNode(Ot,"VariableDeclaration"),this.parseForAfterInit(te,Ot,ne)}var Vt=this.isContextual("let"),Wt=!1,jt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(jt){var Gt=this.startNode();if(this.next(),jt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Gt,!0,jt),this.finishNode(Gt,"VariableDeclaration"),this.parseForAfterInit(te,Gt,ne)}var Ut=this.containsEsc,Ht=new hs,qt=this.start,zt=ne>-1?this.parseExprSubscripts(Ht,"await"):this.parseExpression(!0,Ht);if(this.type===Kt._in||(Wt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(ne>-1){if(this.type===Kt._in)this.unexpected(ne);te.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)te.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(te,zt)}else this.checkExpressionErrors(Ht,!0);if(ne>-1)this.unexpected(ne);return this.parseFor(te,zt)};Zt.parseForAfterInit=function(te,ne,Me){if((this.type===Kt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&ne.declarations.length===1){if(this.type===Kt._in){if((ne.kind==="using"||ne.kind==="await using")&&!ne.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Me>-1)this.unexpected(Me)}else if(this.options.ecmaVersion>=9)te.await=Me>-1;return this.parseForIn(te,ne)}if(Me>-1)this.unexpected(Me);return this.parseFor(te,ne)};Zt.parseFunctionStatement=function(te,ne,Me){return this.next(),this.parseFunction(te,Ai|(Me?0:tr),!1,ne)};Zt.parseIfStatement=function(te){return this.next(),te.test=this.parseParenExpression(),te.consequent=this.parseStatement("if"),te.alternate=this.eat(Kt._else)?this.parseStatement("if"):null,this.finishNode(te,"IfStatement")};Zt.parseReturnStatement=function(te){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Kt.semi)||this.insertSemicolon())te.argument=null;else te.argument=this.parseExpression(),this.semicolon();return this.finishNode(te,"ReturnStatement")};Zt.parseSwitchStatement=function(te){this.next(),te.discriminant=this.parseParenExpression(),te.cases=[],this.expect(Kt.braceL),this.labels.push(Il),this.enterScope(ea);var ne;for(var Me=!1;this.type!==Kt.braceR;)if(this.type===Kt._case||this.type===Kt._default){var Ot=this.type===Kt._case;if(ne)this.finishNode(ne,"SwitchCase");if(te.cases.push(ne=this.startNode()),ne.consequent=[],this.next(),Ot)ne.test=this.parseExpression();else{if(Me)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Me=!0,ne.test=null}this.expect(Kt.colon)}else{if(!ne)this.unexpected();ne.consequent.push(this.parseStatement(null))}if(this.exitScope(),ne)this.finishNode(ne,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(te,"SwitchStatement")};Zt.parseThrowStatement=function(te){if(this.next(),En.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return te.argument=this.parseExpression(),this.semicolon(),this.finishNode(te,"ThrowStatement")};var Ol=[];Zt.parseCatchClauseParam=function(){var te=this.parseBindingAtom(),ne=te.type==="Identifier";return this.enterScope(ne?Qo:0),this.checkLValPattern(te,ne?na:jn),this.expect(Kt.parenR),te};Zt.parseTryStatement=function(te){if(this.next(),te.block=this.parseBlock(),te.handler=null,this.type===Kt._catch){var ne=this.startNode();if(this.next(),this.eat(Kt.parenL))ne.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();ne.param=null,this.enterScope(0)}ne.body=this.parseBlock(!1),this.exitScope(),te.handler=this.finishNode(ne,"CatchClause")}if(te.finalizer=this.eat(Kt._finally)?this.parseBlock():null,!te.handler&&!te.finalizer)this.raise(te.start,"Missing catch or finally clause");return this.finishNode(te,"TryStatement")};Zt.parseVarStatement=function(te,ne,Me){return this.next(),this.parseVar(te,!1,ne,Me),this.semicolon(),this.finishNode(te,"VariableDeclaration")};Zt.parseWhileStatement=function(te){return this.next(),te.test=this.parseParenExpression(),this.labels.push(pr),te.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(te,"WhileStatement")};Zt.parseWithStatement=function(te){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),te.object=this.parseParenExpression(),te.body=this.parseStatement("with"),this.finishNode(te,"WithStatement")};Zt.parseEmptyStatement=function(te){return this.next(),this.finishNode(te,"EmptyStatement")};Zt.parseLabeledStatement=function(te,ne,Me,Ot){for(var Mt=0,Vt=this.labels;Mt<Vt.length;Mt+=1){var Wt=Vt[Mt];if(Wt.name===ne)this.raise(Me.start,"Label '"+ne+"' is already declared")}var jt=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===te.start)Ut.statementStart=this.start,Ut.kind=jt;else break}return this.labels.push({name:ne,kind:jt,statementStart:this.start}),te.body=this.parseStatement(Ot?Ot.indexOf("label")===-1?Ot+"label":Ot:"label"),this.labels.pop(),te.label=Me,this.finishNode(te,"LabeledStatement")};Zt.parseExpressionStatement=function(te,ne){return te.expression=ne,this.semicolon(),this.finishNode(te,"ExpressionStatement")};Zt.parseBlock=function(te,ne,Me){if(te===void 0)te=!0;if(ne===void 0)ne=this.startNode();if(ne.body=[],this.expect(Kt.braceL),te)this.enterScope(0);while(this.type!==Kt.braceR){var Ot=this.parseStatement(null);ne.body.push(Ot)}if(Me)this.strict=!1;if(this.next(),te)this.exitScope();return this.finishNode(ne,"BlockStatement")};Zt.parseFor=function(te,ne){return te.init=ne,this.expect(Kt.semi),te.test=this.type===Kt.semi?null:this.parseExpression(),this.expect(Kt.semi),te.update=this.type===Kt.parenR?null:this.parseExpression(),this.expect(Kt.parenR),te.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(te,"ForStatement")};Zt.parseForIn=function(te,ne){var Me=this.type===Kt._in;if(this.next(),ne.type==="VariableDeclaration"&&ne.declarations[0].init!=null&&(!Me||this.options.ecmaVersion<8||this.strict||ne.kind!=="var"||ne.declarations[0].id.type!=="Identifier"))this.raise(ne.start,(Me?"for-in":"for-of")+" loop variable declaration may not have an initializer");return te.left=ne,te.right=Me?this.parseExpression():this.parseMaybeAssign(),this.expect(Kt.parenR),te.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(te,Me?"ForInStatement":"ForOfStatement")};Zt.parseVar=function(te,ne,Me,Ot){te.declarations=[],te.kind=Me;for(;;){var Mt=this.startNode();if(this.parseVarId(Mt,Me),this.eat(Kt.eq))Mt.init=this.parseMaybeAssign(ne);else if(!Ot&&Me==="const"&&!(this.type===Kt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ot&&(Me==="using"||Me==="await using")&&this.options.ecmaVersion>=17&&this.type!==Kt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Me+" declaration");else if(!Ot&&Mt.id.type!=="Identifier"&&!(ne&&(this.type===Kt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Mt.init=null;if(te.declarations.push(this.finishNode(Mt,"VariableDeclarator")),!this.eat(Kt.comma))break}return te};Zt.parseVarId=function(te,ne){te.id=ne==="using"||ne==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(te.id,ne==="var"?ar:jn,!1)};var Ai=1,tr=2,sa=4;Zt.parseFunction=function(te,ne,Me,Ot,Mt){if(this.initFunction(te),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ot){if(this.type===Kt.star&&ne&tr)this.unexpected();te.generator=this.eat(Kt.star)}if(this.options.ecmaVersion>=8)te.async=!!Ot;if(ne&Ai){if(te.id=ne&sa&&this.type!==Kt.name?null:this.parseIdent(),te.id&&!(ne&tr))this.checkLValSimple(te.id,this.strict||te.generator||te.async?this.treatFunctionsAsVar?ar:jn:ta)}var Vt=this.yieldPos,Wt=this.awaitPos,jt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(or(te.async,te.generator)),!(ne&Ai))te.id=this.type===Kt.name?this.parseIdent():null;return this.parseFunctionParams(te),this.parseFunctionBody(te,Me,!1,Mt),this.yieldPos=Vt,this.awaitPos=Wt,this.awaitIdentPos=jt,this.finishNode(te,ne&Ai?"FunctionDeclaration":"FunctionExpression")};Zt.parseFunctionParams=function(te){this.expect(Kt.parenL),te.params=this.parseBindingList(Kt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Zt.parseClass=function(te,ne){this.next();var Me=this.strict;this.strict=!0,this.parseClassId(te,ne),this.parseClassSuper(te);var Ot=this.enterClassBody(),Mt=this.startNode(),Vt=!1;Mt.body=[],this.expect(Kt.braceL);while(this.type!==Kt.braceR){var Wt=this.parseClassElement(te.superClass!==null);if(Wt){if(Mt.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"&&Ll(Ot,Wt))this.raiseRecoverable(Wt.key.start,"Identifier '#"+Wt.key.name+"' has already been declared")}}return this.strict=Me,this.next(),te.body=this.finishNode(Mt,"ClassBody"),this.exitClassBody(),this.finishNode(te,ne?"ClassDeclaration":"ClassExpression")};Zt.parseClassElement=function(te){if(this.eat(Kt.semi))return null;var ne=this.options.ecmaVersion,Me=this.startNode(),Ot="",Mt=!1,Vt=!1,Wt="method",jt=!1;if(this.eatContextual("static")){if(ne>=13&&this.eat(Kt.braceL))return this.parseClassStaticBlock(Me),Me;if(this.isClassElementNameStart()||this.type===Kt.star)jt=!0;else Ot="static"}if(Me.static=jt,!Ot&&ne>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Kt.star)&&!this.canInsertSemicolon())Vt=!0;else Ot="async";if(!Ot&&(ne>=9||!Vt)&&this.eat(Kt.star))Mt=!0;if(!Ot&&!Vt&&!Mt){var Gt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Wt=Gt;else Ot=Gt}if(Ot)Me.computed=!1,Me.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Me.key.name=Ot,this.finishNode(Me.key,"Identifier");else this.parseClassElementName(Me);if(ne<13||this.type===Kt.parenL||Wt!=="method"||Mt||Vt){var Ut=!Me.static&&os(Me,"constructor"),Ht=Ut&&te;if(Ut&&Wt!=="method")this.raise(Me.key.start,"Constructor can't have get/set modifier");Me.kind=Ut?"constructor":Wt,this.parseClassMethod(Me,Mt,Vt,Ht)}else this.parseClassField(Me);return Me};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(te){if(this.type===Kt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");te.computed=!1,te.key=this.parsePrivateIdent()}else this.parsePropertyName(te)};Zt.parseClassMethod=function(te,ne,Me,Ot){var Mt=te.key;if(te.kind==="constructor"){if(ne)this.raise(Mt.start,"Constructor can't be a generator");if(Me)this.raise(Mt.start,"Constructor can't be an async method")}else if(te.static&&os(te,"prototype"))this.raise(Mt.start,"Classes may not have a static property named prototype");var Vt=te.value=this.parseMethod(ne,Me,Ot);if(te.kind==="get"&&Vt.params.length!==0)this.raiseRecoverable(Vt.start,"getter should have no params");if(te.kind==="set"&&Vt.params.length!==1)this.raiseRecoverable(Vt.start,"setter should have exactly one param");if(te.kind==="set"&&Vt.params[0].type==="RestElement")this.raiseRecoverable(Vt.params[0].start,"Setter cannot use rest params");return this.finishNode(te,"MethodDefinition")};Zt.parseClassField=function(te){if(os(te,"constructor"))this.raise(te.key.start,"Classes can't have a field named 'constructor'");else if(te.static&&os(te,"prototype"))this.raise(te.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Kt.eq))this.enterScope($i|ls),te.value=this.parseMaybeAssign(),this.exitScope();else te.value=null;return this.semicolon(),this.finishNode(te,"PropertyDefinition")};Zt.parseClassStaticBlock=function(te){te.body=[];var ne=this.labels;this.labels=[],this.enterScope(ai|ls);while(this.type!==Kt.braceR){var Me=this.parseStatement(null);te.body.push(Me)}return this.next(),this.exitScope(),this.labels=ne,this.finishNode(te,"StaticBlock")};Zt.parseClassId=function(te,ne){if(this.type===Kt.name){if(te.id=this.parseIdent(),ne)this.checkLValSimple(te.id,jn,!1)}else{if(ne===!0)this.unexpected();te.id=null}};Zt.parseClassSuper=function(te){te.superClass=this.eat(Kt._extends)?this.parseExprSubscripts(null,!1):null};Zt.enterClassBody=function(){var te={declared:Object.create(null),used:[]};return this.privateNameStack.push(te),te.declared};Zt.exitClassBody=function(){var te=this.privateNameStack.pop(),{declared:ne,used:Me}=te;if(!this.options.checkPrivateFields)return;var Ot=this.privateNameStack.length,Mt=Ot===0?null:this.privateNameStack[Ot-1];for(var Vt=0;Vt<Me.length;++Vt){var Wt=Me[Vt];if(!_i(ne,Wt.name))if(Mt)Mt.used.push(Wt);else this.raiseRecoverable(Wt.start,"Private field '#"+Wt.name+"' must be declared in an enclosing class")}};function Ll(te,ne){var Me=ne.key.name,Ot=te[Me],Mt="true";if(ne.type==="MethodDefinition"&&(ne.kind==="get"||ne.kind==="set"))Mt=(ne.static?"s":"i")+ne.kind;if(Ot==="iget"&&Mt==="iset"||Ot==="iset"&&Mt==="iget"||Ot==="sget"&&Mt==="sset"||Ot==="sset"&&Mt==="sget")return te[Me]="true",!1;else if(!Ot)return te[Me]=Mt,!1;else return!0}function os(te,ne){var{computed:Me,key:Ot}=te;return!Me&&(Ot.type==="Identifier"&&Ot.name===ne||Ot.type==="Literal"&&Ot.value===ne)}Zt.parseExportAllDeclaration=function(te,ne){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))te.exported=this.parseModuleExportName(),this.checkExport(ne,te.exported,this.lastTokStart);else te.exported=null;if(this.expectContextual("from"),this.type!==Kt.string)this.unexpected();if(te.source=this.parseExprAtom(),this.options.ecmaVersion>=16)te.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(te,"ExportAllDeclaration")};Zt.parseExport=function(te,ne){if(this.next(),this.eat(Kt.star))return this.parseExportAllDeclaration(te,ne);if(this.eat(Kt._default))return this.checkExport(ne,"default",this.lastTokStart),te.declaration=this.parseExportDefaultDeclaration(),this.finishNode(te,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(te.declaration=this.parseExportDeclaration(te),te.declaration.type==="VariableDeclaration")this.checkVariableExport(ne,te.declaration.declarations);else this.checkExport(ne,te.declaration.id,te.declaration.id.start);if(te.specifiers=[],te.source=null,this.options.ecmaVersion>=16)te.attributes=[]}else{if(te.declaration=null,te.specifiers=this.parseExportSpecifiers(ne),this.eatContextual("from")){if(this.type!==Kt.string)this.unexpected();if(te.source=this.parseExprAtom(),this.options.ecmaVersion>=16)te.attributes=this.parseWithClause()}else{for(var Me=0,Ot=te.specifiers;Me<Ot.length;Me+=1){var Mt=Ot[Me];if(this.checkUnreserved(Mt.local),this.checkLocalExport(Mt.local),Mt.local.type==="Literal")this.raise(Mt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(te.source=null,this.options.ecmaVersion>=16)te.attributes=[]}this.semicolon()}return this.finishNode(te,"ExportNamedDeclaration")};Zt.parseExportDeclaration=function(te){return this.parseStatement(null)};Zt.parseExportDefaultDeclaration=function(){var te;if(this.type===Kt._function||(te=this.isAsyncFunction())){var ne=this.startNode();if(this.next(),te)this.next();return this.parseFunction(ne,Ai|sa,!1,te)}else if(this.type===Kt._class){var Me=this.startNode();return this.parseClass(Me,"nullableID")}else{var Ot=this.parseMaybeAssign();return this.semicolon(),Ot}};Zt.checkExport=function(te,ne,Me){if(!te)return;if(typeof ne!=="string")ne=ne.type==="Identifier"?ne.name:ne.value;if(_i(te,ne))this.raiseRecoverable(Me,"Duplicate export '"+ne+"'");te[ne]=!0};Zt.checkPatternExport=function(te,ne){var Me=ne.type;if(Me==="Identifier")this.checkExport(te,ne,ne.start);else if(Me==="ObjectPattern")for(var Ot=0,Mt=ne.properties;Ot<Mt.length;Ot+=1){var Vt=Mt[Ot];this.checkPatternExport(te,Vt)}else if(Me==="ArrayPattern")for(var Wt=0,jt=ne.elements;Wt<jt.length;Wt+=1){var Gt=jt[Wt];if(Gt)this.checkPatternExport(te,Gt)}else if(Me==="Property")this.checkPatternExport(te,ne.value);else if(Me==="AssignmentPattern")this.checkPatternExport(te,ne.left);else if(Me==="RestElement")this.checkPatternExport(te,ne.argument)};Zt.checkVariableExport=function(te,ne){if(!te)return;for(var Me=0,Ot=ne;Me<Ot.length;Me+=1){var Mt=Ot[Me];this.checkPatternExport(te,Mt.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(te){var ne=this.startNode();return ne.local=this.parseModuleExportName(),ne.exported=this.eatContextual("as")?this.parseModuleExportName():ne.local,this.checkExport(te,ne.exported,ne.exported.start),this.finishNode(ne,"ExportSpecifier")};Zt.parseExportSpecifiers=function(te){var ne=[],Me=!0;this.expect(Kt.braceL);while(!this.eat(Kt.braceR)){if(!Me){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else Me=!1;ne.push(this.parseExportSpecifier(te))}return ne};Zt.parseImport=function(te){if(this.next(),this.type===Kt.string)te.specifiers=Ol,te.source=this.parseExprAtom();else te.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),te.source=this.type===Kt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)te.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(te,"ImportDeclaration")};Zt.parseImportSpecifier=function(){var te=this.startNode();if(te.imported=this.parseModuleExportName(),this.eatContextual("as"))te.local=this.parseIdent();else this.checkUnreserved(te.imported),te.local=te.imported;return this.checkLValSimple(te.local,jn),this.finishNode(te,"ImportSpecifier")};Zt.parseImportDefaultSpecifier=function(){var te=this.startNode();return te.local=this.parseIdent(),this.checkLValSimple(te.local,jn),this.finishNode(te,"ImportDefaultSpecifier")};Zt.parseImportNamespaceSpecifier=function(){var te=this.startNode();return this.next(),this.expectContextual("as"),te.local=this.parseIdent(),this.checkLValSimple(te.local,jn),this.finishNode(te,"ImportNamespaceSpecifier")};Zt.parseImportSpecifiers=function(){var te=[],ne=!0;if(this.type===Kt.name){if(te.push(this.parseImportDefaultSpecifier()),!this.eat(Kt.comma))return te}if(this.type===Kt.star)return te.push(this.parseImportNamespaceSpecifier()),te;this.expect(Kt.braceL);while(!this.eat(Kt.braceR)){if(!ne){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else ne=!1;te.push(this.parseImportSpecifier())}return te};Zt.parseWithClause=function(){var te=[];if(!this.eat(Kt._with))return te;this.expect(Kt.braceL);var ne={},Me=!0;while(!this.eat(Kt.braceR)){if(!Me){if(this.expect(Kt.comma),this.afterTrailingComma(Kt.braceR))break}else Me=!1;var Ot=this.parseImportAttribute(),Mt=Ot.key.type==="Identifier"?Ot.key.name:Ot.key.value;if(_i(ne,Mt))this.raiseRecoverable(Ot.key.start,"Duplicate attribute key '"+Mt+"'");ne[Mt]=!0,te.push(Ot)}return te};Zt.parseImportAttribute=function(){var te=this.startNode();if(te.key=this.type===Kt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Kt.colon),this.type!==Kt.string)this.unexpected();return te.value=this.parseExprAtom(),this.finishNode(te,"ImportAttribute")};Zt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Kt.string){var te=this.parseLiteral(this.value);if(_l.test(te.value))this.raise(te.start,"An export name cannot include a lone surrogate.");return te}return this.parseIdent(!0)};Zt.adaptDirectivePrologue=function(te){for(var ne=0;ne<te.length&&this.isDirectiveCandidate(te[ne]);++ne)te[ne].directive=te[ne].expression.raw.slice(1,-1)};Zt.isDirectiveCandidate=function(te){return this.options.ecmaVersion>=5&&te.type==="ExpressionStatement"&&te.expression.type==="Literal"&&typeof te.expression.value==="string"&&(this.input[te.start]==='"'||this.input[te.start]==="'")};var kn=s.prototype;kn.toAssignable=function(te,ne,Me){if(this.options.ecmaVersion>=6&&te)switch(te.type){case"Identifier":if(this.inAsync&&te.name==="await")this.raise(te.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(te.type="ObjectPattern",Me)this.checkPatternErrors(Me,!0);for(var Ot=0,Mt=te.properties;Ot<Mt.length;Ot+=1){var Vt=Mt[Ot];if(this.toAssignable(Vt,ne),Vt.type==="RestElement"&&(Vt.argument.type==="ArrayPattern"||Vt.argument.type==="ObjectPattern"))this.raise(Vt.argument.start,"Unexpected token")}break;case"Property":if(te.kind!=="init")this.raise(te.key.start,"Object pattern can't contain getter or setter");this.toAssignable(te.value,ne);break;case"ArrayExpression":if(te.type="ArrayPattern",Me)this.checkPatternErrors(Me,!0);this.toAssignableList(te.elements,ne);break;case"SpreadElement":if(te.type="RestElement",this.toAssignable(te.argument,ne),te.argument.type==="AssignmentPattern")this.raise(te.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(te.operator!=="=")this.raise(te.left.end,"Only '=' operator can be used for specifying default value.");te.type="AssignmentPattern",delete te.operator,this.toAssignable(te.left,ne);break;case"ParenthesizedExpression":this.toAssignable(te.expression,ne,Me);break;case"ChainExpression":this.raiseRecoverable(te.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ne)break;default:this.raise(te.start,"Assigning to rvalue")}else if(Me)this.checkPatternErrors(Me,!0);return te};kn.toAssignableList=function(te,ne){var Me=te.length;for(var Ot=0;Ot<Me;Ot++){var Mt=te[Ot];if(Mt)this.toAssignable(Mt,ne)}if(Me){var Vt=te[Me-1];if(this.options.ecmaVersion===6&&ne&&Vt&&Vt.type==="RestElement"&&Vt.argument.type!=="Identifier")this.unexpected(Vt.argument.start)}return te};kn.parseSpread=function(te){var ne=this.startNode();return this.next(),ne.argument=this.parseMaybeAssign(!1,te),this.finishNode(ne,"SpreadElement")};kn.parseRestBinding=function(){var te=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Kt.name)this.unexpected();return te.argument=this.parseBindingAtom(),this.finishNode(te,"RestElement")};kn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Kt.bracketL:var te=this.startNode();return this.next(),te.elements=this.parseBindingList(Kt.bracketR,!0,!0),this.finishNode(te,"ArrayPattern");case Kt.braceL:return this.parseObj(!0)}return this.parseIdent()};kn.parseBindingList=function(te,ne,Me,Ot){var Mt=[],Vt=!0;while(!this.eat(te)){if(Vt)Vt=!1;else this.expect(Kt.comma);if(ne&&this.type===Kt.comma)Mt.push(null);else if(Me&&this.afterTrailingComma(te))break;else if(this.type===Kt.ellipsis){var Wt=this.parseRestBinding();if(this.parseBindingListItem(Wt),Mt.push(Wt),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(te);break}else Mt.push(this.parseAssignableListItem(Ot))}return Mt};kn.parseAssignableListItem=function(te){var ne=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ne),ne};kn.parseBindingListItem=function(te){return te};kn.parseMaybeDefault=function(te,ne,Me){if(Me=Me||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Kt.eq))return Me;var Ot=this.startNodeAt(te,ne);return Ot.left=Me,Ot.right=this.parseMaybeAssign(),this.finishNode(Ot,"AssignmentPattern")};kn.checkLValSimple=function(te,ne,Me){if(ne===void 0)ne=rs;var Ot=ne!==rs;switch(te.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(te.name))this.raiseRecoverable(te.start,(Ot?"Binding ":"Assigning to ")+te.name+" in strict mode");if(Ot){if(ne===jn&&te.name==="let")this.raiseRecoverable(te.start,"let is disallowed as a lexically bound name");if(Me){if(_i(Me,te.name))this.raiseRecoverable(te.start,"Argument name clash");Me[te.name]=!0}if(ne!==ia)this.declareName(te.name,ne,te.start)}break;case"ChainExpression":this.raiseRecoverable(te.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ot)this.raiseRecoverable(te.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ot)this.raiseRecoverable(te.start,"Binding parenthesized expression");return this.checkLValSimple(te.expression,ne,Me);default:this.raise(te.start,(Ot?"Binding":"Assigning to")+" rvalue")}};kn.checkLValPattern=function(te,ne,Me){if(ne===void 0)ne=rs;switch(te.type){case"ObjectPattern":for(var Ot=0,Mt=te.properties;Ot<Mt.length;Ot+=1){var Vt=Mt[Ot];this.checkLValInnerPattern(Vt,ne,Me)}break;case"ArrayPattern":for(var Wt=0,jt=te.elements;Wt<jt.length;Wt+=1){var Gt=jt[Wt];if(Gt)this.checkLValInnerPattern(Gt,ne,Me)}break;default:this.checkLValSimple(te,ne,Me)}};kn.checkLValInnerPattern=function(te,ne,Me){if(ne===void 0)ne=rs;switch(te.type){case"Property":this.checkLValInnerPattern(te.value,ne,Me);break;case"AssignmentPattern":this.checkLValPattern(te.left,ne,Me);break;case"RestElement":this.checkLValPattern(te.argument,ne,Me);break;default:this.checkLValPattern(te,ne,Me)}};var $n=function(te,ne,Me,Ot,Mt){this.token=te,this.isExpr=!!ne,this.preserveSpace=!!Me,this.override=Ot,this.generator=!!Mt},ln={b_stat:new $n("{",!1),b_expr:new $n("{",!0),b_tmpl:new $n("${",!1),p_stat:new $n("(",!1),p_expr:new $n("(",!0),q_tmpl:new $n("`",!0,!0,function(te){return te.tryReadTemplateToken()}),f_stat:new $n("function",!1),f_expr:new $n("function",!0),f_expr_gen:new $n("function",!0,!1,null,!0),f_gen:new $n("function",!1,!1,null,!0)},xi=s.prototype;xi.initialContext=function(){return[ln.b_stat]};xi.curContext=function(){return this.context[this.context.length-1]};xi.braceIsBlock=function(te){var ne=this.curContext();if(ne===ln.f_expr||ne===ln.f_stat)return!0;if(te===Kt.colon&&(ne===ln.b_stat||ne===ln.b_expr))return!ne.isExpr;if(te===Kt._return||te===Kt.name&&this.exprAllowed)return En.test(this.input.slice(this.lastTokEnd,this.start));if(te===Kt._else||te===Kt.semi||te===Kt.eof||te===Kt.parenR||te===Kt.arrow)return!0;if(te===Kt.braceL)return ne===ln.b_stat;if(te===Kt._var||te===Kt._const||te===Kt.name)return!1;return!this.exprAllowed};xi.inGeneratorContext=function(){for(var te=this.context.length-1;te>=1;te--){var ne=this.context[te];if(ne.token==="function")return ne.generator}return!1};xi.updateContext=function(te){var ne,Me=this.type;if(Me.keyword&&te===Kt.dot)this.exprAllowed=!1;else if(ne=Me.updateContext)ne.call(this,te);else this.exprAllowed=Me.beforeExpr};xi.overrideContext=function(te){if(this.curContext()!==te)this.context[this.context.length-1]=te};Kt.parenR.updateContext=Kt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var te=this.context.pop();if(te===ln.b_stat&&this.curContext().token==="function")te=this.context.pop();this.exprAllowed=!te.isExpr};Kt.braceL.updateContext=function(te){this.context.push(this.braceIsBlock(te)?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(te){var ne=te===Kt._if||te===Kt._for||te===Kt._with||te===Kt._while;this.context.push(ne?ln.p_stat:ln.p_expr),this.exprAllowed=!0};Kt.incDec.updateContext=function(){};Kt._function.updateContext=Kt._class.updateContext=function(te){if(te.beforeExpr&&te!==Kt._else&&!(te===Kt.semi&&this.curContext()!==ln.p_stat)&&!(te===Kt._return&&En.test(this.input.slice(this.lastTokEnd,this.start)))&&!((te===Kt.colon||te===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(te){if(te===Kt._function){var ne=this.context.length-1;if(this.context[ne]===ln.f_expr)this.context[ne]=ln.f_expr_gen;else this.context[ne]=ln.f_gen}this.exprAllowed=!0};Kt.name.updateContext=function(te){var ne=!1;if(this.options.ecmaVersion>=6&&te!==Kt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())ne=!0}this.exprAllowed=ne};var tn=s.prototype;tn.checkPropClash=function(te,ne,Me){if(this.options.ecmaVersion>=9&&te.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(te.computed||te.method||te.shorthand))return;var Ot=te.key,Mt;switch(Ot.type){case"Identifier":Mt=Ot.name;break;case"Literal":Mt=String(Ot.value);break;default:return}var Vt=te.kind;if(this.options.ecmaVersion>=6){if(Mt==="__proto__"&&Vt==="init"){if(ne.proto)if(Me){if(Me.doubleProto<0)Me.doubleProto=Ot.start}else this.raiseRecoverable(Ot.start,"Redefinition of __proto__ property");ne.proto=!0}return}Mt="$"+Mt;var Wt=ne[Mt];if(Wt){var jt;if(Vt==="init")jt=this.strict&&Wt.init||Wt.get||Wt.set;else jt=Wt.init||Wt[Vt];if(jt)this.raiseRecoverable(Ot.start,"Redefinition of property")}else Wt=ne[Mt]={init:!1,get:!1,set:!1};Wt[Vt]=!0};tn.parseExpression=function(te,ne){var Me=this;return this.catchStackOverflow(function(){var{start:Ot,startLoc:Mt}=Me,Vt=Me.parseMaybeAssign(te,ne);if(Me.type===Kt.comma){var Wt=Me.startNodeAt(Ot,Mt);Wt.expressions=[Vt];while(Me.eat(Kt.comma))Wt.expressions.push(Me.parseMaybeAssign(te,ne));return Me.finishNode(Wt,"SequenceExpression")}return Vt})};tn.parseMaybeAssign=function(te,ne,Me){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(te);else this.exprAllowed=!1;var Ot=!1,Mt=-1,Vt=-1,Wt=-1;if(ne)Mt=ne.parenthesizedAssign,Vt=ne.trailingComma,Wt=ne.doubleProto,ne.parenthesizedAssign=ne.trailingComma=-1;else ne=new hs,Ot=!0;var jt=this.start,Gt=this.startLoc;if(this.type===Kt.parenL||this.type===Kt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=te==="await";var Ut=this.parseMaybeConditional(te,ne);if(Me)Ut=Me.call(this,Ut,jt,Gt);if(this.type.isAssign){var Ht=this.startNodeAt(jt,Gt);if(Ht.operator=this.value,this.type===Kt.eq)Ut=this.toAssignable(Ut,!1,ne);if(!Ot){if(ne.parenthesizedAssign=ne.trailingComma=-1,ne.shorthandAssign>=Ut.start)ne.shorthandAssign=-1;if(ne.doubleProto>=Ut.start)ne.doubleProto=-1}if(this.type===Kt.eq)this.checkLValPattern(Ut);else this.checkLValSimple(Ut);if(Ht.left=Ut,this.next(),Ht.right=this.parseMaybeAssign(te),Wt>-1)ne.doubleProto=Wt;return this.finishNode(Ht,"AssignmentExpression")}else if(Ot)this.checkExpressionErrors(ne,!0);if(Mt>-1)ne.parenthesizedAssign=Mt;if(Vt>-1)ne.trailingComma=Vt;return Ut};tn.parseMaybeConditional=function(te,ne){var Me=this.start,Ot=this.startLoc,Mt=this.parseExprOps(te,ne);if(this.checkExpressionErrors(ne))return Mt;if(!(Mt.type==="ArrowFunctionExpression"&&Mt.start===Me)&&this.eat(Kt.question)){var Vt=this.startNodeAt(Me,Ot);return Vt.test=Mt,Vt.consequent=this.parseMaybeAssign(),this.expect(Kt.colon),Vt.alternate=this.parseMaybeAssign(te),this.finishNode(Vt,"ConditionalExpression")}return Mt};tn.parseExprOps=function(te,ne){var Me=this.start,Ot=this.startLoc,Mt=this.parseMaybeUnary(ne,!1,!1,te);if(this.checkExpressionErrors(ne))return Mt;return Mt.start===Me&&Mt.type==="ArrowFunctionExpression"?Mt:this.parseExprOp(Mt,Me,Ot,-1,te)};tn.parseExprOp=function(te,ne,Me,Ot,Mt){var Vt=this.type.binop;if(Vt!=null&&(!Mt||this.type!==Kt._in)){if(Vt>Ot){var Wt=this.type===Kt.logicalOR||this.type===Kt.logicalAND,jt=this.type===Kt.coalesce;if(jt)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,Mt),Ut,Ht,Vt,Mt),zt=this.buildBinary(ne,Me,te,qt,Gt,Wt||jt);if(Wt&&this.type===Kt.coalesce||jt&&(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,ne,Me,Ot,Mt)}}return te};tn.buildBinary=function(te,ne,Me,Ot,Mt,Vt){if(Ot.type==="PrivateIdentifier")this.raise(Ot.start,"Private identifier can only be left side of binary expression");var Wt=this.startNodeAt(te,ne);return Wt.left=Me,Wt.operator=Mt,Wt.right=Ot,this.finishNode(Wt,Vt?"LogicalExpression":"BinaryExpression")};tn.parseMaybeUnary=function(te,ne,Me,Ot){var Mt=this.start,Vt=this.startLoc,Wt;if(this.isContextual("await")&&this.canAwait)Wt=this.parseAwait(Ot),ne=!0;else if(this.type.prefix){var jt=this.startNode(),Gt=this.type===Kt.incDec;if(jt.operator=this.value,jt.prefix=!0,this.next(),jt.argument=this.parseMaybeUnary(null,!0,Gt,Ot),this.checkExpressionErrors(te,!0),Gt)this.checkLValSimple(jt.argument);else if(this.strict&&jt.operator==="delete"&&ra(jt.argument))this.raiseRecoverable(jt.start,"Deleting local variable in strict mode");else if(jt.operator==="delete"&&nr(jt.argument))this.raiseRecoverable(jt.start,"Private fields can not be deleted");else ne=!0;Wt=this.finishNode(jt,Gt?"UpdateExpression":"UnaryExpression")}else if(!ne&&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(te,Ot),this.checkExpressionErrors(te))return Wt;while(this.type.postfix&&!this.canInsertSemicolon()){var Ut=this.startNodeAt(Mt,Vt);Ut.operator=this.value,Ut.prefix=!1,Ut.argument=Wt,this.checkLValSimple(Wt),this.next(),Wt=this.finishNode(Ut,"UpdateExpression")}}if(!Me&&!(Wt.type==="ArrowFunctionExpression"&&Wt.start===Mt)&&this.eat(Kt.starstar))if(ne)this.unexpected(this.lastTokStart);else return this.buildBinary(Mt,Vt,Wt,this.parseMaybeUnary(null,!1,!1,Ot),"**",!1);else return Wt};function ra(te){return te.type==="Identifier"||te.type==="ParenthesizedExpression"&&ra(te.expression)}function nr(te){return te.type==="MemberExpression"&&te.property.type==="PrivateIdentifier"||te.type==="ChainExpression"&&nr(te.expression)||te.type==="ParenthesizedExpression"&&nr(te.expression)}tn.parseExprSubscripts=function(te,ne){var Me=this.start,Ot=this.startLoc,Mt=-1,Vt=-1;if(te)Mt=te.doubleProto,Vt=te.shorthandAssign,te.doubleProto=te.shorthandAssign=-1;var Wt=this.parseExprAtom(te,ne);if(Wt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Wt;var jt=this.parseSubscripts(Wt,Me,Ot,!1,ne);if(te){if(jt.end>Wt.end){if(this.checkExpressionErrors(te,!0),te.parenthesizedAssign>=jt.start)te.parenthesizedAssign=-1;if(te.parenthesizedBind>=jt.start)te.parenthesizedBind=-1;if(te.trailingComma>=jt.start)te.trailingComma=-1}if(Mt>-1)te.doubleProto=Mt;if(Vt>-1)te.shorthandAssign=Vt}return jt};tn.parseSubscripts=function(te,ne,Me,Ot,Mt){var Vt=this.options.ecmaVersion>=8&&te.type==="Identifier"&&te.name==="async"&&this.lastTokEnd===te.end&&!this.canInsertSemicolon()&&te.end-te.start===5&&this.potentialArrowAt===te.start,Wt=!1;while(!0){var jt=this.parseSubscript(te,ne,Me,Ot,Vt,Wt,Mt);if(jt.optional)Wt=!0;if(jt.end===te.end||jt.type==="ArrowFunctionExpression"){if(Wt){var Gt=this.startNodeAt(ne,Me);Gt.expression=jt,jt=this.finishNode(Gt,"ChainExpression")}return jt}te=jt,Vt=!1}};tn.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Kt.arrow)};tn.parseSubscriptAsyncArrow=function(te,ne,Me,Ot){return this.parseArrowExpression(this.startNodeAt(te,ne),Me,!0,Ot)};tn.parseSubscript=function(te,ne,Me,Ot,Mt,Vt,Wt){var jt=this.options.ecmaVersion>=11,Gt=jt&&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(ne,Me);if(Ht.object=te,Ut)Ht.property=this.parseExpression(),this.expect(Kt.bracketR);else if(this.type===Kt.privateId&&te.type!=="Super")Ht.property=this.parsePrivateIdent();else Ht.property=this.parseIdent(this.options.allowReserved!=="never");if(Ht.computed=!!Ut,jt)Ht.optional=Gt;te=this.finishNode(Ht,"MemberExpression")}else if(!Ot&&this.eat(Kt.parenL)){var qt=new hs,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(Mt&&!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(ne,Me,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(ne,Me);if(Yt.callee=te,Yt.arguments=Qt,jt)Yt.optional=Gt;te=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(ne,Me);nn.tag=te,nn.quasi=this.parseTemplate({isTagged:!0}),te=this.finishNode(nn,"TaggedTemplateExpression")}return te};tn.parseExprAtom=function(te,ne,Me){if(this.type===Kt.slash)this.readRegexp();var Ot,Mt=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,jt=this.containsEsc,Gt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!jt&&Gt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Kt._function))return this.overrideContext(ln.f_expr),this.parseFunction(this.startNodeAt(Vt,Wt),0,!1,!0,ne);if(Mt&&!this.canInsertSemicolon()){if(this.eat(Kt.arrow))return this.parseArrowExpression(this.startNodeAt(Vt,Wt),[Gt],!1,ne);if(this.options.ecmaVersion>=8&&Gt.name==="async"&&this.type===Kt.name&&!jt&&(!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,ne)}}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(Mt,ne);if(te){if(te.parenthesizedAssign<0&&!this.isSimpleAssignTarget(qt))te.parenthesizedAssign=Ht;if(te.parenthesizedBind<0)te.parenthesizedBind=Ht}return qt;case Kt.bracketL:return Ot=this.startNode(),this.next(),Ot.elements=this.parseExprList(Kt.bracketR,!0,!0,te),this.finishNode(Ot,"ArrayExpression");case Kt.braceL:return this.overrideContext(ln.b_expr),this.parseObj(!1,te);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(Me);else return this.unexpected();default:return this.parseExprAtomDefault()}};tn.parseExprAtomDefault=function(){this.unexpected()};tn.parseExprImport=function(te){var ne=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Kt.parenL&&!te)return this.parseDynamicImport(ne);else if(this.type===Kt.dot){var Me=this.startNodeAt(ne.start,ne.loc&&ne.loc.start);return Me.name="import",ne.meta=this.finishNode(Me,"Identifier"),this.parseImportMeta(ne)}else this.unexpected()};tn.parseDynamicImport=function(te){if(this.next(),te.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Kt.parenR))if(this.expect(Kt.comma),!this.afterTrailingComma(Kt.parenR)){if(te.options=this.parseMaybeAssign(),!this.eat(Kt.parenR)){if(this.expect(Kt.comma),!this.afterTrailingComma(Kt.parenR))this.unexpected()}}else te.options=null;else te.options=null;else if(!this.eat(Kt.parenR)){var ne=this.start;if(this.eat(Kt.comma)&&this.eat(Kt.parenR))this.raiseRecoverable(ne,"Trailing comma is not allowed in import()");else this.unexpected(ne)}return this.finishNode(te,"ImportExpression")};tn.parseImportMeta=function(te){this.next();var ne=this.containsEsc;if(te.property=this.parseIdent(!0),te.property.name!=="meta")this.raiseRecoverable(te.property.start,"The only valid meta property for import is 'import.meta'");if(ne)this.raiseRecoverable(te.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(te.start,"Cannot use 'import.meta' outside a module");return this.finishNode(te,"MetaProperty")};tn.parseLiteral=function(te){var ne=this.startNode();if(ne.value=te,ne.raw=this.input.slice(this.start,this.end),ne.raw.charCodeAt(ne.raw.length-1)===110)ne.bigint=ne.value!=null?ne.value.toString():ne.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(ne,"Literal")};tn.parseParenExpression=function(){this.expect(Kt.parenL);var te=this.parseExpression();return this.expect(Kt.parenR),te};tn.shouldParseArrow=function(te){return!this.canInsertSemicolon()};tn.parseParenAndDistinguishExpression=function(te,ne){var Me=this.start,Ot=this.startLoc,Mt,Vt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Wt=this.start,jt=this.startLoc,Gt=[],Ut=!0,Ht=!1,qt=new hs,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),te&&this.shouldParseArrow(Gt)&&this.eat(Kt.arrow))return this.checkPatternErrors(qt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=zt,this.awaitPos=Xt,this.parseParenArrowList(Me,Ot,Gt,ne);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)Mt=this.startNodeAt(Wt,jt),Mt.expressions=Gt,this.finishNodeAt(Mt,"SequenceExpression",Qt,Yt);else Mt=Gt[0]}else Mt=this.parseParenExpression();if(this.options.preserveParens){var nn=this.startNodeAt(Me,Ot);return nn.expression=Mt,this.finishNode(nn,"ParenthesizedExpression")}else return Mt};tn.parseParenItem=function(te){return te};tn.parseParenArrowList=function(te,ne,Me,Ot){return this.parseArrowExpression(this.startNodeAt(te,ne),Me,!1,Ot)};var Ml=[];tn.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var te=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Kt.dot){var ne=this.startNodeAt(te.start,te.loc&&te.loc.start);ne.name="new",te.meta=this.finishNode(ne,"Identifier"),this.next();var Me=this.containsEsc;if(te.property=this.parseIdent(!0),te.property.name!=="target")this.raiseRecoverable(te.property.start,"The only valid meta property for new is 'new.target'");if(Me)this.raiseRecoverable(te.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(te.start,"'new.target' can only be used in functions and class static block");return this.finishNode(te,"MetaProperty")}var Ot=this.start,Mt=this.startLoc;if(te.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ot,Mt,!0,!1),te.callee.type==="Super")this.raiseRecoverable(Ot,"Invalid use of 'super'");if(this.eat(Kt.parenL))te.arguments=this.parseExprList(Kt.parenR,this.options.ecmaVersion>=8,!1);else te.arguments=Ml;return this.finishNode(te,"NewExpression")};tn.parseTemplateElement=function(te){var ne=te.isTagged,Me=this.startNode();if(this.type===Kt.invalidTemplate){if(!ne)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Me.value={raw:this.value.replace(/\r\n?/g,`
|
|
12
|
-
`),cooked:null}}else Me.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
13
|
-
`),cooked:this.value};return this.next(),Me.tail=this.type===Kt.backQuote,this.finishNode(Me,"TemplateElement")};tn.parseTemplate=function(te){if(te===void 0)te={};var ne=te.isTagged;if(ne===void 0)ne=!1;var Me=this.startNode();this.next(),Me.expressions=[];var Ot=this.parseTemplateElement({isTagged:ne});Me.quasis=[Ot];while(!Ot.tail){if(this.type===Kt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Kt.dollarBraceL),Me.expressions.push(this.parseExpression()),this.expect(Kt.braceR),Me.quasis.push(Ot=this.parseTemplateElement({isTagged:ne}))}return this.next(),this.finishNode(Me,"TemplateLiteral")};tn.isAsyncProp=function(te){return!te.computed&&te.key.type==="Identifier"&&te.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(te,ne){var Me=this.startNode(),Ot=!0,Mt={};Me.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(te,ne);if(!te)this.checkPropClash(Vt,Mt,ne);Me.properties.push(Vt)}return this.finishNode(Me,te?"ObjectPattern":"ObjectExpression")};tn.parseProperty=function(te,ne){var Me=this.startNode(),Ot,Mt,Vt,Wt;if(this.options.ecmaVersion>=9&&this.eat(Kt.ellipsis)){if(te){if(Me.argument=this.parseIdent(!1),this.type===Kt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Me,"RestElement")}if(Me.argument=this.parseMaybeAssign(!1,ne),this.type===Kt.comma&&ne&&ne.trailingComma<0)ne.trailingComma=this.start;return this.finishNode(Me,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Me.method=!1,Me.shorthand=!1,te||ne)Vt=this.start,Wt=this.startLoc;if(!te)Ot=this.eat(Kt.star)}var jt=this.containsEsc;if(this.parsePropertyName(Me),!te&&!jt&&this.options.ecmaVersion>=8&&!Ot&&this.isAsyncProp(Me))Mt=!0,Ot=this.options.ecmaVersion>=9&&this.eat(Kt.star),this.parsePropertyName(Me);else Mt=!1;return this.parsePropertyValue(Me,te,Ot,Mt,Vt,Wt,ne,jt),this.finishNode(Me,"Property")};tn.parseGetterSetter=function(te){var ne=te.key.name;this.parsePropertyName(te),te.value=this.parseMethod(!1),te.kind=ne;var Me=te.kind==="get"?0:1;if(te.value.params.length!==Me){var Ot=te.value.start;if(te.kind==="get")this.raiseRecoverable(Ot,"getter should have no params");else this.raiseRecoverable(Ot,"setter should have exactly one param")}else if(te.kind==="set"&&te.value.params[0].type==="RestElement")this.raiseRecoverable(te.value.params[0].start,"Setter cannot use rest params")};tn.parsePropertyValue=function(te,ne,Me,Ot,Mt,Vt,Wt,jt){if((Me||Ot)&&this.type===Kt.colon)this.unexpected();if(this.eat(Kt.colon))te.value=ne?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Wt),te.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Kt.parenL){if(ne)this.unexpected();te.method=!0,te.value=this.parseMethod(Me,Ot),te.kind="init"}else if(!ne&&!jt&&this.options.ecmaVersion>=5&&!te.computed&&te.key.type==="Identifier"&&(te.key.name==="get"||te.key.name==="set")&&(this.type!==Kt.comma&&this.type!==Kt.braceR&&this.type!==Kt.eq)){if(Me||Ot)this.unexpected();this.parseGetterSetter(te)}else if(this.options.ecmaVersion>=6&&!te.computed&&te.key.type==="Identifier"){if(Me||Ot)this.unexpected();if(this.checkUnreserved(te.key),te.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Mt;if(ne)te.value=this.parseMaybeDefault(Mt,Vt,this.copyNode(te.key));else if(this.type===Kt.eq&&Wt){if(Wt.shorthandAssign<0)Wt.shorthandAssign=this.start;te.value=this.parseMaybeDefault(Mt,Vt,this.copyNode(te.key))}else te.value=this.copyNode(te.key);te.kind="init",te.shorthand=!0}else this.unexpected()};tn.parsePropertyName=function(te){if(this.options.ecmaVersion>=6)if(this.eat(Kt.bracketL))return te.computed=!0,te.key=this.parseMaybeAssign(),this.expect(Kt.bracketR),te.key;else te.computed=!1;return te.key=this.type===Kt.num||this.type===Kt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};tn.initFunction=function(te){if(te.id=null,this.options.ecmaVersion>=6)te.generator=te.expression=!1;if(this.options.ecmaVersion>=8)te.async=!1};tn.parseMethod=function(te,ne,Me){var Ot=this.startNode(),Mt=this.yieldPos,Vt=this.awaitPos,Wt=this.awaitIdentPos;if(this.initFunction(Ot),this.options.ecmaVersion>=6)Ot.generator=te;if(this.options.ecmaVersion>=8)Ot.async=!!ne;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(or(ne,Ot.generator)|ls|(Me?Zo: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=Mt,this.awaitPos=Vt,this.awaitIdentPos=Wt,this.finishNode(Ot,"FunctionExpression")};tn.parseArrowExpression=function(te,ne,Me,Ot){var Mt=this.yieldPos,Vt=this.awaitPos,Wt=this.awaitIdentPos;if(this.enterScope(or(Me,!1)|rr),this.initFunction(te),this.options.ecmaVersion>=8)te.async=!!Me;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,te.params=this.toAssignableList(ne,!0),this.parseFunctionBody(te,!0,!1,Ot),this.yieldPos=Mt,this.awaitPos=Vt,this.awaitIdentPos=Wt,this.finishNode(te,"ArrowFunctionExpression")};tn.parseFunctionBody=function(te,ne,Me,Ot){var Mt=ne&&this.type!==Kt.braceL,Vt=this.strict,Wt=!1;if(Mt)te.body=this.parseMaybeAssign(Ot),te.expression=!0,this.checkParams(te,!1);else{var jt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(te.params);if(!Vt||jt){if(Wt=this.strictDirective(this.end),Wt&&jt)this.raiseRecoverable(te.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(te,!Vt&&!Wt&&!ne&&!Me&&this.isSimpleParamList(te.params)),this.strict&&te.id)this.checkLValSimple(te.id,ia);te.body=this.parseBlock(!1,void 0,Wt&&!Vt),te.expression=!1,this.adaptDirectivePrologue(te.body.body),this.labels=Gt}this.exitScope()};tn.isSimpleParamList=function(te){for(var ne=0,Me=te;ne<Me.length;ne+=1){var Ot=Me[ne];if(Ot.type!=="Identifier")return!1}return!0};tn.checkParams=function(te,ne){var Me=Object.create(null);for(var Ot=0,Mt=te.params;Ot<Mt.length;Ot+=1){var Vt=Mt[Ot];this.checkLValInnerPattern(Vt,ar,ne?null:Me)}};tn.parseExprList=function(te,ne,Me,Ot){var Mt=[],Vt=!0;while(!this.eat(te)){if(!Vt){if(this.expect(Kt.comma),ne&&this.afterTrailingComma(te))break}else Vt=!1;var Wt=void 0;if(Me&&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);Mt.push(Wt)}return Mt};tn.checkUnreserved=function(te){var{start:ne,end:Me,name:Ot}=te;if(this.inGenerator&&Ot==="yield")this.raiseRecoverable(ne,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ot==="await")this.raiseRecoverable(ne,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&us)&&Ot==="arguments")this.raiseRecoverable(ne,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ot==="arguments"||Ot==="await"))this.raise(ne,"Cannot use "+Ot+" in class static initialization block");if(this.keywords.test(Ot))this.raise(ne,"Unexpected keyword '"+Ot+"'");if(this.options.ecmaVersion<6&&this.input.slice(ne,Me).indexOf("\\")!==-1)return;var Mt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Mt.test(Ot)){if(!this.inAsync&&Ot==="await")this.raiseRecoverable(ne,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(ne,"The keyword '"+Ot+"' is reserved")}};tn.parseIdent=function(te){var ne=this.parseIdentNode();if(this.next(!!te),this.finishNode(ne,"Identifier"),!te){if(this.checkUnreserved(ne),ne.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=ne.start}return ne};tn.parseIdentNode=function(){var te=this.startNode();if(this.type===Kt.name)te.name=this.value;else if(this.type.keyword){if(te.name=this.type.keyword,(te.name==="class"||te.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Kt.name}else this.unexpected();return te};tn.parsePrivateIdent=function(){var te=this.startNode();if(this.type===Kt.privateId)te.name=this.value;else this.unexpected();if(this.next(),this.finishNode(te,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(te.start,"Private field '#"+te.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(te);return te};tn.parseYield=function(te){if(!this.yieldPos)this.yieldPos=this.start;var ne=this.startNode();if(this.next(),this.type===Kt.semi||this.canInsertSemicolon()||this.type!==Kt.star&&!this.type.startsExpr)ne.delegate=!1,ne.argument=null;else ne.delegate=this.eat(Kt.star),ne.argument=this.parseMaybeAssign(te);return this.finishNode(ne,"YieldExpression")};tn.parseAwait=function(te){if(!this.awaitPos)this.awaitPos=this.start;var ne=this.startNode();return this.next(),ne.argument=this.parseMaybeUnary(null,!0,!1,te),this.finishNode(ne,"AwaitExpression")};var as=s.prototype;as.raise=function(te,ne){var Me=Jo(this.input,te);if(ne+=" ("+Me.line+":"+Me.column+")",this.sourceFile)ne+=" in "+this.sourceFile;var Ot=SyntaxError(ne);throw Ot.pos=te,Ot.loc=Me,Ot.raisedAt=this.pos,Ot};as.raiseRecoverable=as.raise;as.curPosition=function(){if(this.options.locations)return new Pi(this.curLine,this.pos-this.lineStart)};var Kn=s.prototype,Fl=function(te){this.flags=te,this.var=[],this.lexical=[],this.functions=[]};Kn.enterScope=function(te){this.scopeStack.push(new Fl(te))};Kn.exitScope=function(){this.scopeStack.pop()};Kn.treatFunctionsAsVarInScope=function(te){return te.flags&oi||!this.inModule&&te.flags&ri};Kn.declareName=function(te,ne,Me){var Ot=!1;if(ne===jn){var Mt=this.currentScope();if(Ot=Mt.lexical.indexOf(te)>-1||Mt.functions.indexOf(te)>-1||Mt.var.indexOf(te)>-1,Mt.lexical.push(te),this.inModule&&Mt.flags&ri)delete this.undefinedExports[te]}else if(ne===na){var Vt=this.currentScope();Vt.lexical.push(te)}else if(ne===ta){var Wt=this.currentScope();if(this.treatFunctionsAsVar)Ot=Wt.lexical.indexOf(te)>-1;else Ot=Wt.lexical.indexOf(te)>-1||Wt.var.indexOf(te)>-1;Wt.functions.push(te)}else for(var jt=this.scopeStack.length-1;jt>=0;--jt){var Gt=this.scopeStack[jt];if(Gt.lexical.indexOf(te)>-1&&!(Gt.flags&Qo&&Gt.lexical[0]===te)||!this.treatFunctionsAsVarInScope(Gt)&&Gt.functions.indexOf(te)>-1){Ot=!0;break}if(Gt.var.push(te),this.inModule&&Gt.flags&ri)delete this.undefinedExports[te];if(Gt.flags&us)break}if(Ot)this.raiseRecoverable(Me,"Identifier '"+te+"' has already been declared")};Kn.checkLocalExport=function(te){if(this.scopeStack[0].lexical.indexOf(te.name)===-1&&this.scopeStack[0].var.indexOf(te.name)===-1)this.undefinedExports[te.name]=te};Kn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Kn.currentVarScope=function(){for(var te=this.scopeStack.length-1;;te--){var ne=this.scopeStack[te];if(ne.flags&(us|$i|ai))return ne}};Kn.currentThisScope=function(){for(var te=this.scopeStack.length-1;;te--){var ne=this.scopeStack[te];if(ne.flags&(us|$i|ai)&&!(ne.flags&rr))return ne}};var ds=function(te,ne,Me){if(this.type="",this.start=ne,this.end=0,te.options.locations)this.loc=new cs(te,Me);if(te.options.directSourceFile)this.sourceFile=te.options.directSourceFile;if(te.options.ranges)this.range=[ne,0]},Ni=s.prototype;Ni.startNode=function(){return new ds(this,this.start,this.startLoc)};Ni.startNodeAt=function(te,ne){return new ds(this,te,ne)};function oa(te,ne,Me,Ot){if(te.type=ne,te.end=Me,this.options.locations)te.loc.end=Ot;if(this.options.ranges)te.range[1]=Me;return te}Ni.finishNode=function(te,ne){return oa.call(this,te,ne,this.lastTokEnd,this.lastTokEndLoc)};Ni.finishNodeAt=function(te,ne,Me,Ot){return oa.call(this,te,ne,Me,Ot)};Ni.copyNode=function(te){var ne=new ds(this,te.start,this.startLoc);for(var Me in te)ne[Me]=te[Me];return ne};var aa=function(){};aa.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var cr=function(te){if(this.type=te.type,this.value=te.value,this.start=te.start,this.end=te.end,te.options.locations)this.loc=new cs(te,te.startLoc,te.endLoc);if(te.options.ranges)this.range=[te.start,te.end]},rn=s.prototype;rn.next=function(te){if(!te&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new cr(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 cr(this)};if(typeof Symbol<"u")rn[Symbol.iterator]=function(){var te=this;return{next:function(){var ne=te.getToken();return{done:ne.type===Kt.eof,value:ne}}}};rn.nextToken=function(){var te=this.curContext();if(!te||!te.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Kt.eof);if(te.override)return te.override(this);else this.readToken(this.fullCharCodeAtPos())};rn.readToken=function(te){if(g(te,this.options.ecmaVersion>=6)||te===92)return this.readWord();return this.getTokenFromCode(te)};rn.fullCharCodeAt=function(te){var ne=this.input.charCodeAt(te);if(ne<=55295||ne>=56320)return ne;var Me=this.input.charCodeAt(te+1);return Me<=56319||Me>=57344?ne:(ne<<10)+Me-56613888};rn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};rn.skipBlockComment=function(){var te=this.options.onComment&&this.curPosition(),ne=this.pos,Me=this.input.indexOf("*/",this.pos+=2);if(Me===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Me+2,this.options.locations)for(var Ot=void 0,Mt=ne;(Ot=zo(this.input,Mt,this.pos))>-1;)++this.curLine,Mt=this.lineStart=Ot;if(this.options.onComment)this.options.onComment(!0,this.input.slice(ne+2,Me),ne,this.pos,te,this.curPosition())};rn.skipLineComment=function(te){var ne=this.pos,Me=this.options.onComment&&this.curPosition(),Ot=this.input.charCodeAt(this.pos+=te);while(this.pos<this.input.length&&!yi(Ot))Ot=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(ne+te,this.pos),ne,this.pos,Me,this.curPosition())};rn.skipSpace=function(){e:while(this.pos<this.input.length){var te=this.input.charCodeAt(this.pos);switch(te){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++this.pos,this.options.locations)++this.curLine,this.lineStart=this.pos;break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(te>8&&te<14||te>=5760&&Xo.test(String.fromCharCode(te)))++this.pos;else break e}}};rn.finishToken=function(te,ne){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Me=this.type;this.type=te,this.value=ne,this.updateContext(Me)};rn.readToken_dot=function(){var te=this.input.charCodeAt(this.pos+1);if(te>=48&&te<=57)return this.readNumber(!0);var ne=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&te===46&&ne===46)return this.pos+=3,this.finishToken(Kt.ellipsis);else return++this.pos,this.finishToken(Kt.dot)};rn.readToken_slash=function(){var te=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(te===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.slash,1)};rn.readToken_mult_modulo_exp=function(te){var ne=this.input.charCodeAt(this.pos+1),Me=1,Ot=te===42?Kt.star:Kt.modulo;if(this.options.ecmaVersion>=7&&te===42&&ne===42)++Me,Ot=Kt.starstar,ne=this.input.charCodeAt(this.pos+2);if(ne===61)return this.finishOp(Kt.assign,Me+1);return this.finishOp(Ot,Me)};rn.readToken_pipe_amp=function(te){var ne=this.input.charCodeAt(this.pos+1);if(ne===te){if(this.options.ecmaVersion>=12){var Me=this.input.charCodeAt(this.pos+2);if(Me===61)return this.finishOp(Kt.assign,3)}return this.finishOp(te===124?Kt.logicalOR:Kt.logicalAND,2)}if(ne===61)return this.finishOp(Kt.assign,2);return this.finishOp(te===124?Kt.bitwiseOR:Kt.bitwiseAND,1)};rn.readToken_caret=function(){var te=this.input.charCodeAt(this.pos+1);if(te===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.bitwiseXOR,1)};rn.readToken_plus_min=function(te){var ne=this.input.charCodeAt(this.pos+1);if(ne===te){if(ne===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||En.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Kt.incDec,2)}if(ne===61)return this.finishOp(Kt.assign,2);return this.finishOp(Kt.plusMin,1)};rn.readToken_lt_gt=function(te){var ne=this.input.charCodeAt(this.pos+1),Me=1;if(ne===te){if(Me=te===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Me)===61)return this.finishOp(Kt.assign,Me+1);return this.finishOp(Kt.bitShift,Me)}if(ne===33&&te===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(ne===61)Me=2;return this.finishOp(Kt.relational,Me)};rn.readToken_eq_excl=function(te){var ne=this.input.charCodeAt(this.pos+1);if(ne===61)return this.finishOp(Kt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(te===61&&ne===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Kt.arrow);return this.finishOp(te===61?Kt.eq:Kt.prefix,1)};rn.readToken_question=function(){var te=this.options.ecmaVersion;if(te>=11){var ne=this.input.charCodeAt(this.pos+1);if(ne===46){var Me=this.input.charCodeAt(this.pos+2);if(Me<48||Me>57)return this.finishOp(Kt.questionDot,2)}if(ne===63){if(te>=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 te=this.options.ecmaVersion,ne=35;if(te>=13){if(++this.pos,ne=this.fullCharCodeAtPos(),g(ne,!0)||ne===92)return this.finishToken(Kt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+ps(ne)+"'")};rn.getTokenFromCode=function(te){switch(te){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 ne=this.input.charCodeAt(this.pos+1);if(ne===120||ne===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(ne===111||ne===79)return this.readRadixNumber(8);if(ne===98||ne===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(te);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(te);case 124:case 38:return this.readToken_pipe_amp(te);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(te);case 60:case 62:return this.readToken_lt_gt(te);case 61:case 33:return this.readToken_eq_excl(te);case 63:return this.readToken_question();case 126:return this.finishOp(Kt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ps(te)+"'")};rn.finishOp=function(te,ne){var Me=this.input.slice(this.pos,this.pos+ne);return this.pos+=ne,this.finishToken(te,Me)};rn.readRegexp=function(){var te,ne,Me=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Me,"Unterminated regular expression");var Ot=this.input.charAt(this.pos);if(En.test(Ot))this.raise(Me,"Unterminated regular expression");if(!te){if(Ot==="[")ne=!0;else if(Ot==="]"&&ne)ne=!1;else if(Ot==="/"&&!ne)break;te=Ot==="\\"}else te=!1;++this.pos}var Mt=this.input.slice(Me,this.pos);++this.pos;var Vt=this.pos,Wt=this.readWord1();if(this.containsEsc)this.unexpected(Vt);var jt=this.regexpState||(this.regexpState=new aa(this));jt.reset(Me,Mt,Wt),this.validateRegExpFlags(jt),this.validateRegExpPattern(jt);var Gt=null;try{Gt=new RegExp(Mt,Wt)}catch(Ut){}return this.finishToken(Kt.regexp,{pattern:Mt,flags:Wt,value:Gt})};rn.readInt=function(te,ne,Me){var Ot=this.options.ecmaVersion>=12&&ne===void 0,Mt=Me&&this.input.charCodeAt(this.pos)===48,Vt=this.pos,Wt=0,jt=0;for(var Gt=0,Ut=ne==null?1/0:ne;Gt<Ut;++Gt,++this.pos){var Ht=this.input.charCodeAt(this.pos),qt=void 0;if(Ot&&Ht===95){if(Mt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(jt===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");jt=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>=te)break;jt=Ht,Wt=Wt*te+qt}if(Ot&&jt===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Vt||ne!=null&&this.pos-Vt!==ne)return null;return Wt};function Bl(te,ne){if(ne)return parseInt(te,8);return parseFloat(te.replace(/_/g,""))}function pa(te){if(typeof BigInt!=="function")return null;return BigInt(te.replace(/_/g,""))}rn.readRadixNumber=function(te){var ne=this.pos;this.pos+=2;var Me=this.readInt(te);if(Me==null)this.raise(this.start+2,"Expected number in radix "+te);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Me=pa(this.input.slice(ne,this.pos)),++this.pos;else if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Kt.num,Me)};rn.readNumber=function(te){var ne=this.pos;if(!te&&this.readInt(10,void 0,!0)===null)this.raise(ne,"Invalid number");var Me=this.pos-ne>=2&&this.input.charCodeAt(ne)===48;if(Me&&this.strict)this.raise(ne,"Invalid number");var Ot=this.input.charCodeAt(this.pos);if(!Me&&!te&&this.options.ecmaVersion>=11&&Ot===110){var Mt=pa(this.input.slice(ne,this.pos));if(++this.pos,g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Kt.num,Mt)}if(Me&&/[89]/.test(this.input.slice(ne,this.pos)))Me=!1;if(Ot===46&&!Me)++this.pos,this.readInt(10),Ot=this.input.charCodeAt(this.pos);if((Ot===69||Ot===101)&&!Me){if(Ot=this.input.charCodeAt(++this.pos),Ot===43||Ot===45)++this.pos;if(this.readInt(10)===null)this.raise(ne,"Invalid number")}if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Vt=Bl(this.input.slice(ne,this.pos),Me);return this.finishToken(Kt.num,Vt)};rn.readCodePoint=function(){var te=this.input.charCodeAt(this.pos),ne;if(te===123){if(this.options.ecmaVersion<6)this.unexpected();var Me=++this.pos;if(ne=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ne>1114111)this.invalidStringToken(Me,"Code point out of bounds")}else ne=this.readHexChar(4);return ne};rn.readString=function(te){var ne="",Me=++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===te)break;if(Ot===92)ne+=this.input.slice(Me,this.pos),ne+=this.readEscapedChar(!1),Me=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(yi(Ot))this.raise(this.start,"Unterminated string constant");++this.pos}}return ne+=this.input.slice(Me,this.pos++),this.finishToken(Kt.string,ne)};var ca={};rn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(te){if(te===ca)this.readInvalidTemplateToken();else throw te}this.inTemplateElement=!1};rn.invalidStringToken=function(te,ne){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ca;else this.raise(te,ne)};rn.readTmplToken=function(){var te="",ne=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Me=this.input.charCodeAt(this.pos);if(Me===96||Me===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Kt.template||this.type===Kt.invalidTemplate))if(Me===36)return this.pos+=2,this.finishToken(Kt.dollarBraceL);else return++this.pos,this.finishToken(Kt.backQuote);return te+=this.input.slice(ne,this.pos),this.finishToken(Kt.template,te)}if(Me===92)te+=this.input.slice(ne,this.pos),te+=this.readEscapedChar(!0),ne=this.pos;else if(yi(Me)){switch(te+=this.input.slice(ne,this.pos),++this.pos,Me){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:te+=`
|
|
14
|
-
`;break;default:te+=String.fromCharCode(Me);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;ne=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]===`
|
|
15
|
-
`)++this.pos;case`
|
|
16
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};rn.readEscapedChar=function(te){var ne=this.input.charCodeAt(++this.pos);switch(++this.pos,ne){case 110:return`
|
|
17
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ps(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(te){var Me=this.pos-1;this.invalidStringToken(Me,"Invalid escape sequence in template string")}default:if(ne>=48&&ne<=55){var Ot=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Mt=parseInt(Ot,8);if(Mt>255)Ot=Ot.slice(0,-1),Mt=parseInt(Ot,8);if(this.pos+=Ot.length-1,ne=this.input.charCodeAt(this.pos),(Ot!=="0"||ne===56||ne===57)&&(this.strict||te))this.invalidStringToken(this.pos-1-Ot.length,te?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Mt)}if(yi(ne)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ne)}};rn.readHexChar=function(te){var ne=this.pos,Me=this.readInt(16,te);if(Me===null)this.invalidStringToken(ne,"Bad character escape sequence");return Me};rn.readWord1=function(){this.containsEsc=!1;var te="",ne=!0,Me=this.pos,Ot=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Mt=this.fullCharCodeAtPos();if(v(Mt,Ot))this.pos+=Mt<=65535?1:2;else if(Mt===92){this.containsEsc=!0,te+=this.input.slice(Me,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(!(ne?g:v)(Wt,Ot))this.invalidStringToken(Vt,"Invalid Unicode escape");te+=ps(Wt),Me=this.pos}else break;ne=!1}return te+this.input.slice(Me,this.pos)};rn.readWord=function(){var te=this.readWord1(),ne=Kt.name;if(this.keywords.test(te))ne=ir[te];return this.finishToken(ne,te)};var jl="8.19.0";s.acorn={Parser:s,version:jl,defaultOptions:er,Position:Pi,SourceLocation:cs,getLineInfo:Jo,Node:ds,TokenType:pn,tokTypes:Kt,keywordTypes:ir,TokContext:$n,tokContexts:ln,isIdentifierChar:v,isIdentifierStart:g,Token:cr,isNewLine:yi,lineBreak:En,lineBreakG:wl,nonASCIIwhitespace:Xo};function Di(te){return(ne)=>te(ne)}function fs(...te){return s.extend(...te)}function Ri(te,ne,Me){for(let Ot=ne;Ot<Me;Ot++){let Mt=te.charCodeAt(Ot);if(Mt===10||Mt===13||Mt===8232||Mt===8233)return!0}return!1}var Ko=new WeakMap;function Sn(te,ne){if(te===void 0)return!1;if(te.length<16)return te.includes(ne);let Me=Ko.get(te);if(Me===void 0||Me.length>te.length)Me={names:new Set,length:0},Ko.set(te,Me);while(Me.length<te.length)Me.names.add(te[Me.length++]);return Me.names.has(ne)}var lr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,Vl=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"]]),Gl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),Wl=new Set("public private protected readonly override".split(" ")),Ul=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),Hl=new Set("var let const function class interface enum".split(" ")),la=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),ua=1,Kl=32,ql=256,zl=0,Xl=1,Oi=2,Jl=3,Yl=4,ur=6,ha=7,xa=256,mr=1024,Ql=8|mr,Zl=Oi|xa,da=1,eu=2,fa=40,tu=41,nu=44,ma=46,ga=58,Ii=61,ya=60,iu=62,ms=123,su=91,hr=42,ru=35,dr=34,fr=39,ou=SyntaxError("speculative parse failed"),ce=Di((te)=>{let{tokTypes:ne,keywordTypes:Me,isIdentifierChar:Ot,isIdentifierStart:Mt}=te.acorn,Vt=new te.acorn.TokenType("@");class Wt extends te{inType=!1;$4=!1;$5=!1;$7=null;$l=null;$j=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(jt,Gt,Ut){super(jt,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.$l=null,this.$j=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(jt){if(jt===64)return++this.pos,this.finishToken(Vt);return super.getTokenFromCode(jt)}readToken_lt_gt(jt){if(this.inType)return this.finishOp(ne.relational,1);return super.readToken_lt_gt(jt)}$a(jt){let Gt=this.inType;this.inType=!0;let Ut=jt();if(this.inType=Gt,!Gt&&this.type===ne.relational)this.pos=this.start,this.nextToken();return Ut}$1(){return this.type===ne.relational&&this.value==="<"}$p(){if(this.type===ne.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(ne.relational,"<");return this.$1()}$c(){return this.type===ne.relational&&this.value===">"}$u(){return this.type===ne.prefix&&this.value==="!"}hasPrecedingLineBreak(){return Ri(this.input,this.lastTokEnd,this.start)}$d(jt=this.pos){return lr.lastIndex=jt,lr.exec(this.input),lr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let jt=this.$d(),Gt=jt;while(Gt<this.input.length&&Ot(this.input.charCodeAt(Gt)))Gt++;return this.input.slice(jt,Gt)}$b(){return!Ri(this.input,this.pos,this.$d())}$14(){return this.$b()&&Mt(this.$2())&&!Object.hasOwn(Me,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(jt){this.pos=jt.pos,this.type=jt.type,this.value=jt.value,this.start=jt.start,this.end=jt.end,this.startLoc=jt.startLoc,this.endLoc=jt.endLoc,this.lastTokStart=jt.lastTokStart,this.lastTokEnd=jt.lastTokEnd,this.lastTokStartLoc=jt.lastTokStartLoc,this.lastTokEndLoc=jt.lastTokEndLoc,this.curLine=jt.curLine,this.lineStart=jt.lineStart,this.context=jt.context,this.exprAllowed=jt.exprAllowed,this.containsEsc=jt.containsEsc,this.inType=jt.inType,this.$4=jt.$4,this.$5=jt.$5,this.$7=jt.$7,this.$j=!1,this.scopeStack.length=jt.scopes,this.privateNameStack.length=jt.privateNames,this.labels=jt.labels,this.labels.length=jt.labelCount,this.strict=jt.strict,this.yieldPos=jt.yieldPos,this.awaitPos=jt.awaitPos,this.awaitIdentPos=jt.awaitIdentPos,this.potentialArrowAt=jt.potentialArrowAt,this.potentialArrowInForAwait=jt.potentialArrowInForAwait}raise(jt,Gt){if(this.$n>0)throw ou;return super.raise(jt,Gt)}$1y(jt,Gt){try{super.raise(jt,Gt)}catch(Ut){if(Ut instanceof SyntaxError)Ut.$1z=!0;throw Ut}throw Error("unreachable")}$g(jt,Gt=!1){let Ut=this.$15();this.$n++;try{let Ht=jt();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(jt){return this.$g(jt,!0)===!0}$17(jt){if(jt.end=this.lastTokEnd,this.options.locations)jt.loc.end=this.lastTokEndLoc}$q(jt,Gt){if(jt.start=Gt.start,this.options.locations)jt.loc.start=Gt.loc.start}$6(jt=!1){let Gt=this.startNode();return Gt.typeAnnotation=this.$a(()=>(this.next(),jt?this.$20():this.$0())),this.finishNode(Gt,"TSTypeAnnotation")}$h(jt,Gt){if(Gt&&this.eat(ne.question))jt.optional=!0,this.$17(jt);if(this.type===ne.colon)jt.typeAnnotation=this.$6(),this.$17(jt);return jt}$20(){if(this.type!==ne.name&&this.type!==ne._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Mt(this.$2())){let jt=this.startNode();if(this.next(),jt.parameterName=this.type===ne._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(jt,!0);return jt.asserts=!0,jt.typeAnnotation=null,this.finishNode(jt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let jt=this.startNode();return jt.parameterName=this.type===ne._this?this.$w():this.parseIdent(!0),this.$x(jt,!1)}return this.$0()}$x(jt,Gt){this.next();let Ut=this.startNode();return Ut.typeAnnotation=this.$0(),jt.typeAnnotation=this.finishNode(Ut,"TSTypeAnnotation"),jt.asserts=Gt,this.finishNode(jt,"TSTypePredicate")}$w(){let jt=this.startNode();return this.next(),this.finishNode(jt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let jt=this.$0();if(this.type!==ne.eof)this.unexpected();return jt}$0(){let jt=this.$18();if(this.$4||this.type!==ne._extends||this.hasPrecedingLineBreak())return jt;let Gt=this.startNodeAt(jt.start,jt.loc?.start);return this.next(),Gt.checkType=jt,Gt.extendsType=this.$i(!0,()=>this.$18()),this.expect(ne.question),Gt.trueType=this.$i(!1,()=>this.$0()),this.expect(ne.colon),Gt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Gt,"TSConditionalType")}$i(jt,Gt){let Ut=this.$4;this.$4=jt;let Ht=Gt();return this.$4=Ut,Ht}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===ne._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",ne.bitwiseOR,()=>this.$1a("TSIntersectionType",ne.bitwiseAND,()=>this.$1b()))}$19(jt){let Gt=this.startNode();if(jt==="TSConstructorType"){if(Gt.abstract=this.isContextual("abstract"),Gt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Gt,ne.arrow)),this.finishNode(Gt,jt)}$r(jt,Gt){if(this.$1())jt.typeParameters=this.$8();if(this.expect(ne.parenL),jt.parameters=this.parseBindingList(ne.parenR,!1,!0),this.type===Gt)jt.typeAnnotation=this.$6(!0);else if(Gt===ne.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==ne.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===ne.parenR||this.type===ne.ellipsis)return!0;if(this.type===ne.name||this.type===ne._this)this.next();else if(this.type===ne.braceL||this.type===ne.bracketL)this.parseBindingAtom();else return!1;let jt=this.type;if(jt===ne.colon||jt===ne.comma||jt===ne.question||jt===ne.eq)return!0;if(jt!==ne.parenR)return!1;return this.next(),this.type===ne.arrow})}$1a(jt,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,jt)}$1b(){if(this.type===ne.name&&!this.containsEsc){let jt=this.value;if(jt==="keyof"||jt==="unique"||jt==="readonly"){let Gt=this.startNode();return this.next(),Gt.operator=jt,Gt.typeAnnotation=this.$1b(),this.finishNode(Gt,"TSTypeOperator")}if(jt==="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(ne._extends))return;let jt=this.$i(!0,()=>this.$0());return this.$4||this.type!==ne.question?jt:void 0}$y(){if(this.type!==ne.name&&!this.type.keyword)this.unexpected();let jt=this.type===ne.name?this.value:this.type.keyword;return this.next(),jt}$23(){let jt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(ne.bracketL)){let Gt=this.startNodeAt(jt.start,jt.loc?.start);if(this.eat(ne.bracketR))Gt.elementType=jt,jt=this.finishNode(Gt,"TSArrayType");else Gt.objectType=jt,Gt.indexType=this.$0(),this.expect(ne.bracketR),jt=this.finishNode(Gt,"TSIndexedAccessType")}return jt}$24(){switch(this.type){case ne.name:case ne._void:case ne._null:{let jt=Vl.get(this.value);if(jt&&(this.type!==ne.name||!this.containsEsc&&this.$2()!==ma)){let Gt=this.startNode();return this.next(),this.finishNode(Gt,jt)}return this.$1c()}case ne.string:case ne.num:case ne._true:case ne._false:{let jt=this.startNode();return jt.literal=this.parseExprAtom(),this.finishNode(jt,"TSLiteralType")}case ne.plusMin:{if(this.value!=="-")break;let jt=this.startNode(),Gt=this.startNode();if(this.next(),this.type!==ne.num)this.unexpected();return Gt.operator="-",Gt.prefix=!0,Gt.argument=this.parseExprAtom(),jt.literal=this.finishNode(Gt,"UnaryExpression"),this.finishNode(jt,"TSLiteralType")}case ne.backQuote:return this.$25();case ne._this:{let jt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Gt=this.startNodeAt(jt.start,jt.loc?.start);return Gt.parameterName=jt,this.$x(Gt,!1)}return jt}case ne._typeof:return this.$26();case ne._import:return this.$1d();case ne.braceL:return this.$27()?this.$28():this.$29();case ne.bracketL:return this.$2a();case ne.parenL:{let jt=this.startNode();return this.next(),jt.typeAnnotation=this.$0(),this.expect(ne.parenR),this.finishNode(jt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let jt=this.startNode();if(jt.typeName=this.$k(),!this.hasPrecedingLineBreak()&&this.$1())jt.typeArguments=this.$e();return this.finishNode(jt,"TSTypeReference")}$k(){let jt=this.parseIdent(!0);while(this.eat(ne.dot)){let Gt=this.startNodeAt(jt.start,jt.loc?.start);Gt.left=jt,Gt.right=this.parseIdent(!0),jt=this.finishNode(Gt,"TSQualifiedName")}return jt}$26(){let jt=this.startNode();if(this.next(),jt.exprName=this.type===ne._import?this.$1d():this.$k(),!this.hasPrecedingLineBreak()&&this.$1())jt.typeArguments=this.$e();return this.finishNode(jt,"TSTypeQuery")}$1d(){let jt=this.startNode();if(this.next(),jt.argument=this.$1e(),this.eat(ne.dot))jt.qualifier=this.$k();if(this.$1())jt.typeArguments=this.$e();return this.finishNode(jt,"TSImportType")}$z(){if(this.type!==ne.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(ne.parenL);let jt=this.$z();return this.expect(ne.parenR),jt}$25(){let jt=this.startNode(),Gt=this.startNode();this.next(),Gt.expressions=[];let Ut=this.parseTemplateElement({isTagged:!1});Gt.quasis=[Ut];while(!Ut.tail){if(this.type===ne.eof)this.raise(this.pos,"Unterminated template literal");this.expect(ne.dollarBraceL),Gt.expressions.push(this.$0()),this.expect(ne.braceR),Ut=this.parseTemplateElement({isTagged:!1}),Gt.quasis.push(Ut)}return this.next(),jt.literal=this.finishNode(Gt,"TemplateLiteral"),this.finishNode(jt,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===ne.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==ne.bracketL)return!1;if(this.next(),this.type!==ne.name)return!1;return this.next(),this.type===ne._in})}$28(){let jt=this.startNode();if(this.expect(ne.braceL),this.type===ne.plusMin)jt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))jt.readonly=!0;this.expect(ne.bracketL);let Gt=this.startNode();if(Gt.name=this.$y(),this.expect(ne._in),Gt.constraint=this.$0(),jt.typeParameter=this.finishNode(Gt,"TSTypeParameter"),jt.nameType=this.eatContextual("as")?this.$0():null,this.expect(ne.bracketR),this.type===ne.plusMin)jt.optional=this.value,this.next(),this.expect(ne.question);else if(this.eat(ne.question))jt.optional=!0;if(this.eat(ne.colon))jt.typeAnnotation=this.$0();return this.semicolon(),this.expect(ne.braceR),this.finishNode(jt,"TSMappedType")}$29(){let jt=this.startNode();return jt.members=this.$1f(),this.finishNode(jt,"TSTypeLiteral")}$1f(){this.expect(ne.braceL);let jt=[];while(!this.eat(ne.braceR))jt.push(this.$2b());return jt}$2b(){let jt=this.startNode(),Gt="TSPropertySignature",Ut=this.type===ne._new?this.$2():-1;if(this.type===ne.parenL||this.$1())Gt="TSCallSignatureDeclaration",this.$r(jt,ne.colon);else if(Ut===fa||Ut===ya)Gt="TSConstructSignatureDeclaration",this.next(),this.$r(jt,ne.colon);else{let Ht=this.type===ne._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),jt.readonly=!0;if(this.type===ne.bracketL&&this.$1g())return this.$1h(jt);let qt="method";if(Ht)jt.key=Ht;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))qt=this.value,this.next();this.parsePropertyName(jt)}if(this.eat(ne.question))jt.optional=!0;if(this.type===ne.parenL||this.$1()){if(Gt="TSMethodSignature",qt!=="method")jt.kind=qt;this.$r(jt,ne.colon),jt.kind=qt}else if(this.type===ne.colon)jt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(jt,Gt)}$1i(){if(!this.eat(ne.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==ne.name)return!1;return this.next(),this.type===ne.colon})}$1h(jt){if(this.expect(ne.bracketL),jt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(ne.bracketR),this.type===ne.colon)jt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(jt,"TSIndexSignature")}$2a(){let jt=this.startNode();this.expect(ne.bracketL),jt.elementTypes=[];while(!this.eat(ne.bracketR))if(jt.elementTypes.push(this.$2c()),this.type!==ne.bracketR)this.expect(ne.comma);return this.finishNode(jt,"TSTupleType")}$2c(){let jt=this.start,Gt=this.startLoc,Ut=this.eat(ne.ellipsis),Ht;if((this.type===ne.name||this.type.keyword)&&this.$2d()){let qt=this.startNode();qt.label=this.parseIdent(!0),qt.optional=this.eat(ne.question),this.expect(ne.colon),qt.elementType=this.$0(),Ht=this.finishNode(qt,"TSNamedTupleMember")}else if(Ht=this.$0(),this.eat(ne.question)){let qt=this.startNodeAt(Ht.start,Ht.loc?.start);qt.typeAnnotation=Ht,Ht=this.finishNode(qt,"TSOptionalType")}if(Ut){let qt=this.startNodeAt(jt,Gt);qt.typeAnnotation=Ht,Ht=this.finishNode(qt,"TSRestType")}return Ht}$2d(){let jt=this.$d();if(this.input.charCodeAt(jt)===63)jt=this.$d(jt+1);return this.input.charCodeAt(jt)===ga}$8(){return this.$a(()=>{let jt=this.startNode();this.next(),jt.params=[];while(!this.$c()){let Gt=this.startNode();while((this.type===ne._const||this.type===ne._in||this.isContextual("out"))&&Mt(this.$2()))Gt[this.value]=!0,this.next();if(Gt.name=this.$y(),this.eat(ne._extends))Gt.constraint=this.$0();if(this.eat(ne.eq))Gt.default=this.$0();if(jt.params.push(this.finishNode(Gt,"TSTypeParameter")),!this.$c()){if(this.expect(ne.comma),this.$c())jt.extra={trailingComma:this.lastTokStart}}}if(this.next(),jt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(jt,"TSTypeParameterDeclaration")})}$e(jt=!1){return this.$a(()=>{let Gt=this.startNode();this.next(),Gt.params=[];while(!this.$c())if(Gt.params.push(this.$0()),!this.$c())this.expect(ne.comma);if(Gt.params.length===0)this.unexpected();if(jt){let Ut=this.input.charCodeAt(this.start+1);if(Ut===Ii||Ut===iu)this.unexpected()}return this.next(),this.finishNode(Gt,"TSTypeParameterInstantiation")})}$1j(){let jt=[];do{let Gt=this.startNode();if(Gt.expression=this.$k(),this.$1())Gt.typeParameters=this.$e();jt.push(this.finishNode(Gt,"TSExpressionWithTypeArguments"))}while(this.eat(ne.comma));return jt}$1k(jt=!1){if(this.type!==ne.name||this.containsEsc){if(this.type===ne._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(jt);return this.$1l(this.startNode(),this.value)}$2e(jt){switch(jt){case"interface":case"type":case"namespace":return this.$14();case"enum":return Mt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Gt=this.$2();return this.$b()&&(Gt===dr||Gt===fr||Mt(Gt))}case"declare":return this.$b()&&Ul.has(this.$3());case"global":return this.$b()&&this.$2()===ms}return!1}$1l(jt,Gt){switch(Gt){case"interface":return this.$1m(jt);case"type":return this.$2g(jt);case"enum":return this.$10(jt);case"abstract":return this.$1n(jt,!0);case"global":return jt.global=!0,jt.id=this.parseIdent(),jt.body=this.$11(),this.finishNode(jt,"TSModuleDeclaration")}return this.$2h(jt)}$2f(jt){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(!jt&&Hl.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,da,!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(jt,Gt){return this.next(),jt.abstract=!0,this.parseClass(jt,Gt)}$1m(jt){if(this.next(),jt.id=this.parseIdent(),this.checkLValSimple(jt.id,ha),this.$1())jt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(ne._extends))jt.extends=this.$1j();let Gt=this.startNode();Gt.body=this.$1f(),jt.body=this.finishNode(Gt,"TSInterfaceBody")}),this.finishNode(jt,"TSInterfaceDeclaration")}$2g(jt){if(this.next(),jt.id=this.parseIdent(),this.checkLValSimple(jt.id,ur),this.$1())jt.typeParameters=this.$8();return jt.typeAnnotation=this.$a(()=>(this.expect(ne.eq),this.$0())),this.semicolon(),this.finishNode(jt,"TSTypeAliasDeclaration")}$10(jt){if(this.type===ne._const)jt.const=!0,this.next();this.next(),jt.id=this.parseIdent(),this.checkLValSimple(jt.id,Zl),this.expect(ne.braceL),jt.members=[];while(!this.eat(ne.braceR)){let Gt=this.startNode();if(Gt.id=this.type===ne.string?this.parseExprAtom():this.parseIdent(!0),this.eat(ne.eq))Gt.initializer=this.parseMaybeAssign();if(jt.members.push(this.finishNode(Gt,"TSEnumMember")),this.type!==ne.braceR)this.expect(ne.comma)}return this.finishNode(jt,"TSEnumDeclaration")}$2h(jt){if(this.next(),this.type===ne.string){if(jt.id=this.parseExprAtom(),this.type===ne.braceL)jt.body=this.$11();else this.semicolon();return this.finishNode(jt,"TSModuleDeclaration")}return jt.id=this.parseIdent(),this.checkLValSimple(jt.id,Ql),this.$1o(jt)}$1o(jt){if(this.eat(ne.dot)){let Gt=this.startNode();Gt.id=this.parseIdent(),jt.body=this.$1o(Gt)}else jt.body=this.$11();return this.finishNode(jt,"TSModuleDeclaration")}$11(){this.enterScope(ql);let jt=this.startNode();this.enterScope(0),this.expect(ne.braceL),jt.body=[];while(!this.eat(ne.braceR))jt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(jt,"TSModuleBlock")}$1p(jt,Gt){if(jt.isExport=Gt,jt.id=this.parseIdent(),this.checkLValSimple(jt.id,Oi),this.expect(ne.eq),this.isContextual("require")&&this.$2()===fa){let Ut=this.startNode();this.next(),Ut.expression=this.$1e(),jt.moduleReference=this.finishNode(Ut,"TSExternalModuleReference")}else jt.moduleReference=this.$k();return this.semicolon(),this.finishNode(jt,"TSImportEqualsDeclaration")}$2i(){let jt=this.$d();if(this.input.charCodeAt(jt)!==Ii)return!1;let Gt=this.input.charCodeAt(jt+1);return Gt!==Ii&&Gt!==62}parseStatement(jt,Gt,Ut){if(this.type===Vt)this.$1q(!0);let Ht=this.$1k();if(Ht)return Ht;return super.parseStatement(jt,Gt,Ut)}parseVarStatement(jt,Gt,Ut){return super.parseVarStatement(jt,Gt,Ut||this.$5)}parseVarId(jt,Gt){if(super.parseVarId(jt,Gt),jt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),jt.definite=!0;this.$h(jt.id,!1)}parseCatchClauseParam(){let jt=this.$h(this.parseBindingAtom(),!1),Gt=jt.type==="Identifier";return this.enterScope(Gt?Kl:0),this.checkLValPattern(jt,Gt?Yl:Oi),this.expect(ne.parenR),jt}parseImport(jt){if(this.next(),jt.importKind="value",this.type===ne.string)jt.specifiers=[],jt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Gt=this.$2();if(Gt===ms||Gt===hr||Mt(Gt)&&this.$3()!=="from")jt.importKind="type",this.next()}if(this.type===ne.name&&this.$2i())return this.$1p(jt,!1);jt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),jt.source=this.$z()}return this.$1r(jt),this.semicolon(),this.finishNode(jt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=ne._with;return this.type===ne._with?super.parseWithClause():void 0}$1r(jt){let Gt=this.parseWithClause();if(Gt)jt.attributes=Gt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(jt){return this.$1s("exportKind",()=>super.parseExportSpecifier(jt))}$1s(jt,Gt){let Ut=this.isContextual("type")?this.$2():-1;if(Ut===dr||Ut===fr||Mt(Ut)&&this.$3()!=="as"){let qt=this.startNode();this.next();let zt=Gt();return this.$q(zt,qt),zt[jt]="type",zt}let Ht=Gt();return Ht[jt]="value",Ht}parseExport(jt,Gt){if(this.next(),this.eat(ne._import)){if(jt.importKind="value",this.isContextual("type")&&Mt(this.$2())&&this.$3()!=="from")jt.importKind="type",this.next();return this.$1p(jt,!0)}if(this.eat(ne.eq))return jt.expression=this.parseExpression(),this.semicolon(),this.finishNode(jt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),jt.id=this.parseIdent(),this.semicolon(),this.finishNode(jt,"TSNamespaceExportDeclaration");if(jt.exportKind="value",this.isContextual("type")){let qt=this.$2();if(qt===ms||qt===hr)jt.exportKind="type",this.next()}if(this.eat(ne.star))return this.parseExportAllDeclaration(jt,Gt);if(this.eat(ne._default)){if(this.isContextual("interface")&&this.$14())jt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")jt.declaration=this.$1n(this.startNode(),"nullableID");else jt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(jt,"ExportDefaultDeclaration")}let Ut=this.isContextual("declare"),Ht=this.$1k(!0);if(Ht||this.shouldParseExportStatement()){if(jt.declaration=Ht??this.parseStatement(null),Ut||jt.declaration.type==="TSInterfaceDeclaration"||jt.declaration.type==="TSTypeAliasDeclaration")jt.exportKind="type";return jt.specifiers=[],jt.source=null,this.finishNode(jt,"ExportNamedDeclaration")}if(jt.declaration=null,jt.specifiers=this.parseExportSpecifiers(Gt),this.eatContextual("from"))jt.source=this.$z(),this.$1r(jt);else{for(let qt of jt.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`.");jt.source=null}return this.semicolon(),this.finishNode(jt,"ExportNamedDeclaration")}parseFunction(jt,Gt,Ut,Ht,qt){let zt=Gt&da;if(zt)this.$f=jt,this.$o=jt.start;super.parseFunction(jt,Gt,Ut,Ht,qt),this.$f=null;let Xt=!jt.body;if(Xt)jt.type="TSDeclareFunction";if(zt&&jt.id){if(Xt){if(this.$5&&this.currentScope().flags&ua)this.declareName(jt.id.name,mr,jt.id.start);this.checkLValSimple(jt.id,zl)}else if(!(Gt&eu)){let Jt=Jl;if(this.strict||jt.generator||jt.async)Jt=this.treatFunctionsAsVar?Xl:Oi;this.checkLValSimple(jt.id,Jt)}}return jt}parseFunctionParams(jt){if(this.$1())jt.typeParameters=this.$8();if(super.parseFunctionParams(jt),this.type===ne.colon)jt.returnType=this.$6(!0)}parseFunctionBody(jt,Gt,Ut,Ht){if(Ut&&this.type===ne.colon)jt.returnType=this.$6(!0);if(Gt||this.type===ne.braceL||jt.start!==this.$o){super.parseFunctionBody(jt,Gt,Ut,Ht);return}this.semicolon(),this.exitScope()}parseMethod(jt,Gt,Ut){let Ht=this.$l;this.$l=null,this.$j=!0;let qt=super.parseMethod(jt,Gt,Ut);if(!qt.body)qt.type="TSDeclareMethod";if(Ht)qt.typeParameters=Ht;return qt}parseBindingList(jt,Gt,Ut,Ht){let qt=Ht===!0||this.$j;return this.$j=!1,super.parseBindingList(jt,Gt,Ut,qt)}$s(jt){if(!jt&&!this.$b())return!1;let Gt=this.$2();return Gt===su||Gt===ms||Gt===hr||Gt===ma||Gt===ru||Gt===dr||Gt===fr||Gt>=48&&Gt<=57||Mt(Gt)}parseAssignableListItem(jt){let Gt=this.$12(),Ut=this.start,Ht=this.startLoc,qt,zt=!1,Xt=!1;if(jt)while(this.type===ne.name&&Wl.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===ne._this)Jt=this.startNode(),Jt.name="this",this.next(),this.finishNode(Jt,"Identifier");else Jt=this.parseBindingAtom();let Qt=this.type===ne.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;if(Qt.type!=="Identifier"&&Qt.type!=="AssignmentPattern")this.raise(Ut,"A parameter property may not be declared using a binding pattern.");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(jt){if(jt.type==="RestElement")this.$h(jt,!0);return jt}checkLValSimple(jt,Gt,Ut){if(this.$f&&jt===this.$f.id){this.$f=null;return}if(!Gt&&la.has(jt.type)){this.checkLValSimple(jt.expression,Gt,Ut);return}switch(jt.type){case"TSParameterProperty":this.checkLValInnerPattern(jt.parameter,Gt,Ut);return;case"Identifier":if(jt.name==="this")return}super.checkLValSimple(jt,Gt,Ut)}toAssignable(jt,Gt,Ut){if(jt&&!Gt&&la.has(jt.type))return jt;return super.toAssignable(jt,Gt,Ut)}declareName(jt,Gt,Ut){let Ht=this.currentScope();if(Gt&mr){this.$1t(Ht,jt),Ht.$1u??=[],Ht.$1u.push(jt);return}if(Gt===ur||Gt===ha){if(Ht.$13??=[],Gt===ur&&Sn(Ht.$13,jt))this.raise(Ut,`type '${jt}' has already been declared.`);Ht.$13.push(jt),this.$1t(Ht,jt);return}if(Gt&xa){if(Ht.$1v??=[],Sn(Ht.$1v,jt))return;super.declareName(jt,Oi,Ut),Ht.$1v.push(jt);return}super.declareName(jt,Gt,Ut)}$1t(jt,Gt){if(this.inModule&&jt.flags&ua)delete this.undefinedExports[Gt]}checkLocalExport(jt){for(let Gt=this.scopeStack.length-1;Gt>=0;Gt--){let Ut=this.scopeStack[Gt];if(Sn(Ut.$13,jt.name)||Sn(Ut.$1u,jt.name))return}super.checkLocalExport(jt)}checkExport(){}raiseRecoverable(jt,Gt){if(Gt==="Duplicate constructor in the same class")return;super.raiseRecoverable(jt,Gt)}$12(){let jt=[];while(this.type===Vt)jt.push(this.$1w());return jt}$1q(jt){let Gt=this.$9[this.$9.length-1];while(this.type===Vt)Gt.push(this.$1w());if(this.type===ne._export){if(!jt)this.unexpected()}else if(this.type!==ne._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let jt=this.startNode();this.next(),this.$9.push([]);let Gt=this.start,Ut=this.startLoc,Ht;if(this.type===ne.parenL){if(this.next(),Ht=this.parseExpression(),this.expect(ne.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(ne.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(!0):void 0;if(this.eat(ne.parenL)){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);if(zt.callee=Ht,zt.arguments=this.parseExprList(ne.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 jt.expression=Ht,this.$9.pop(),this.finishNode(jt,"Decorator")}shouldParseExportStatement(){return this.type===Vt||super.shouldParseExportStatement()}parseExprAtom(jt,Gt,Ut){if(this.type===Vt)this.$1q(!1);return super.parseExprAtom(jt,Gt,Ut)}parseProperty(jt,Gt){if(jt||this.type!==Vt)return super.parseProperty(jt,Gt);let Ut=this.$12(),Ht=super.parseProperty(jt,Gt);if(Ht.type==="SpreadElement")this.raise(Ht.start,"Decorators can't be used with SpreadElement");return Ht.decorators=Ut,Ht}parseClassId(jt,Gt){let Ut=this.$9.length-1,Ht=this.$9[Ut];if(Ht.length>0)jt.decorators=Ht,this.$q(jt,Ht[0]),this.$9[Ut]=[];if(!this.isContextual("implements")||Gt===!0)super.parseClassId(jt,Gt);if(this.$1())jt.typeParameters=this.$8()}parseClassSuper(jt){if(super.parseClassSuper(jt),jt.superClass&&this.$1())jt.superTypeParameters=this.$e(!0);if(this.eatContextual("implements"))jt.implements=this.$a(()=>this.$1j())}parseClassElement(jt){if(this.type===Vt){let Xt=this.$12();if(this.type===ne.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Jt=this.parseClassElement(jt);return Jt.decorators=Xt,this.$q(Jt,Xt[0]),Jt}if(this.eat(ne.semi))return null;let Gt=this.startNode();while(this.type===ne.name&&Gl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let Xt=this.value;if(this.next(),Xt==="static"&&this.type===ne.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===ne.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===ne.star)&&!this.canInsertSemicolon())qt=!0;else Ut="async";if(!Ut&&this.eat(ne.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(ne.question))Gt.optional=!0;if(this.type===ne.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.$o=this.start,this.parseClassMethod(Gt,Ht,qt,Jt&&jt)}else{if(!Gt.optional&&this.$u())this.next(),Gt.definite=!0;if(this.type===ne.colon)Gt.typeAnnotation=this.$6();this.parseClassField(Gt)}return Gt}parseMaybeAssign(jt,Gt,Ut){if(this.$p()){let Ht=this.$g(()=>{let qt=this.$8(),zt=super.parseMaybeAssign(jt,Gt,Ut);if(zt.type!=="ArrowFunctionExpression")return;return zt.typeParameters=qt,this.$q(zt,qt),zt});if(Ht)return Ht}return super.parseMaybeAssign(jt,Gt,Ut)}parseMaybeUnary(jt,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(jt,Gt,Ut,Ht)}parseMaybeConditional(jt,Gt){let Ut=this.start,Ht=this.startLoc,qt=this.parseExprOps(jt,Gt);if(this.checkExpressionErrors(Gt))return qt;if(this.type===ne.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(ne.colon),zt.alternate=this.parseMaybeAssign(jt),this.finishNode(zt,"ConditionalExpression")}return qt}$2j(){let jt=this.$d(),Gt=this.input.charCodeAt(jt);if(Gt===ga||Gt===nu||Gt===tu)return!0;return Gt===Ii&&this.input.charCodeAt(jt+1)!==Ii}parseParenItem(jt){return this.$h(jt,!0)}$1x(){if(this.type!==ne.colon)return!0;let jt=this.$g(()=>{let Gt=this.$6(!0);return this.type===ne.arrow&&!this.canInsertSemicolon()?Gt:void 0});if(!jt)return!1;return this.$7=jt,!0}shouldParseArrow(jt){return this.$1x()&&super.shouldParseArrow(jt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(jt,Gt,Ut,Ht){if(this.$7)jt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(jt,Gt,Ut,Ht)}parseExprList(jt,Gt,Ut,Ht){if(!this.$m)return super.parseExprList(jt,Gt,Ut,Ht);this.$m=!1;let qt=[],zt=!0;while(!this.eat(jt)){if(zt)zt=!1;else if(this.expect(ne.comma),Gt&&this.afterTrailingComma(jt))break;if(this.type===ne.ellipsis){let Xt=this.parseSpread(Ht);if(this.eat(ne.question))Xt.optional=!0;if(this.type===ne.colon)Xt.typeAnnotation=this.$6();qt.push(Xt)}else qt.push(this.parseMaybeAssign(!1,Ht,this.parseParenItem))}return qt}parseSubscript(jt,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=jt,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===ne.questionDot&&this.$2()===ya;if(this.$1()||Jt||this.type===ne.bitShift&&this.value==="<<"){let Qt=this.$g(()=>{if(Jt)this.next();this.$p();let Yt=this.$e(!0);if(this.type===ne.parenL&&!Ht)return Yt;if(this.type===ne.backQuote)return Jt?void 0:Yt;if(Jt)return;if(this.$c()||this.type===ne.bitShift||this.type.startsExpr&&this.type!==ne.parenL&&!this.hasPrecedingLineBreak())return;return Yt});if(Qt){let Yt=this.startNodeAt(Gt,Ut);if(this.type===ne.parenL&&!Ht){if(this.next(),Yt.callee=jt,Yt.arguments=this.parseExprList(ne.parenR,!0,!1),Yt.typeArguments=Qt,Jt)jt.optional=!0;if(Jt||zt)Yt.optional=Jt;return this.finishNode(Yt,"CallExpression")}if(this.type===ne.backQuote)return Yt.tag=jt,Yt.quasi=this.parseTemplate({isTagged:!0}),Yt.typeArguments=Qt,this.finishNode(Yt,"TaggedTemplateExpression");return Yt.expression=jt,Yt.typeArguments=Qt,this.finishNode(Yt,"TSInstantiationExpression")}}if(qt&&this.type===ne.parenL)this.$m=!0;return super.parseSubscript(jt,Gt,Ut,Ht,qt,zt,Xt)}$2k(jt,Gt,Ut){let Ht=this.startNodeAt(jt,Gt);if(Ht.typeParameters=this.$8(),this.expect(ne.parenL),Ht.params=this.parseBindingList(ne.parenR,!1,!0),this.type===ne.colon)Ht.returnType=this.$6(!0);if(this.type!==ne.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Ht,Ht.params,!0,Ut)}parseDynamicImport(jt){if(this.next(),jt.source=this.parseMaybeAssign(),this.eat(ne.comma)&&this.type!==ne.parenR)jt.arguments=[this.parseExpression()];return this.expect(ne.parenR),this.finishNode(jt,"ImportExpression")}parseNew(){let jt=super.parseNew();if(jt.callee?.type!=="TSInstantiationExpression")return jt;let Gt=this.startNodeAt(jt.start,jt.loc?.start);return Gt.callee=jt.callee.expression,Gt.typeArguments=jt.callee.typeArguments,Gt.arguments=jt.arguments,this.finishNodeAt(Gt,"NewExpression",jt.end,jt.loc?.end)}parseExprOp(jt,Gt,Ut,Ht,qt){if(ne._in.binop>Ht&&this.type===ne.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let zt=this.value==="satisfies",Xt=this.startNodeAt(Gt,Ut);return Xt.expression=jt,Xt.typeAnnotation=this.$a(()=>{if(this.next(),!zt&&this.type===ne._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(jt,Gt,Ut,Ht,qt)}parseGetterSetter(jt){jt.kind=jt.key.name,super.parseGetterSetter(jt)}parsePropertyValue(jt,Gt,Ut,Ht,qt,zt,Xt,Jt){if(!Gt&&this.$1()){if(this.$l=this.$8(),this.type!==ne.parenL)this.unexpected();jt.kind="init"}return super.parsePropertyValue(jt,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 au=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(te,ne,Me){super(`${Me}
|
|
18
|
-
https://svelte.dev/e/${ne}`);this.code=ne,this.reason=Me;let Ot=typeof te==="number"?te:te?.start,Mt=typeof te==="number"?te:te?.end;if(Ot!==void 0)this.position=[Ot,Mt??Ot],this.start=x(this.position[0]),this.end=x(this.position[1]),this.frame=pu(this.start.line-1,this.end.column)}}var va=(te)=>te.replace(au,(ne)=>" ".repeat(ne.length));function pu(te,ne){let Me=Math.max(0,te-2),Ot=[];for(let Vt=Me;Vt<te+3;Vt++){let Wt=$o(Vt);if(Wt===void 0)break;Ot.push(Wt)}let Mt=String(Me+Ot.length+1).length;return Ot.map((Vt,Wt)=>{let jt=`${String(Me+Wt+1).padStart(Mt," ")}: ${va(Vt)}`;if(Me+Wt!==te)return jt;return`${jt}
|
|
19
|
-
${" ".repeat(Mt+2+va(Vt.slice(0,ne)).length)}^`}).join(`
|
|
20
|
-
`)}function Ve(te){throw new e(te,"attribute_duplicate","Attributes need to be unique")}function qe(te){throw new e(te,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function de(te,ne){throw new e(te,"block_duplicate_clause",`${ne} cannot appear more than once within a block`)}function Ge(te){throw new e(te,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function We(te){throw new e(te,"block_invalid_elseif","'elseif' should be 'else if'")}function He(te,ne,Me){throw new e(te,"block_invalid_placement",`{#${ne} ...} block cannot be ${Me}`)}function Ue(te){throw new e(te,"block_unclosed","Block was left open")}function ze(te){throw new e(te,"block_unexpected_close","Unexpected block closing tag")}function Je(te){throw new e(te,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Ke(te){throw new e(te,"css_empty_declaration","Declaration cannot be empty")}function we(te){throw new e(te,"css_expected_identifier","Expected a valid CSS identifier")}function Xe(te){throw new e(te,"css_selector_invalid","Invalid selector")}function Ye(te){throw new e(te,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function Pe(te){throw new e(te,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function Qe(te){throw new e(te,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function Ze(te,ne){throw new e(te,"directive_missing_name",`\`${ne}\` name cannot be empty`)}function et(te,ne){throw new e(te,"element_invalid_closing_tag",`\`</${ne}>\` attempted to close an element that was not open`)}function tt(te,ne,Me){throw new e(te,"element_invalid_closing_tag_autoclosed",`\`</${ne}>\` attempted to close element that was already automatically closed by \`<${Me}>\` (cannot nest \`<${Me}>\` inside \`<${ne}>\`)`)}function Ae(te,ne){throw new e(te,"element_unclosed",`\`<${ne}>\` was left open`)}function De(te){throw new e(te,"expected_attribute_value","Expected attribute value")}function nt(te){throw new e(te,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function Ne(te){throw new e(te,"expected_identifier","Expected an identifier")}function rt(te){throw new e(te,"expected_pattern","Expected identifier or destructure pattern")}function it(te){throw new e(te,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function D(te,ne){throw new e(te,"expected_token",`Expected token ${ne}`)}function st(te){throw new e(te,"expected_whitespace","Expected whitespace")}function cu(te,ne){throw new e(te,"js_parse_error",`${ne}`)}function ot(te){throw new e(te,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function at(te){throw new e(te,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function lt(te,ne){throw new e(te,"script_invalid_attribute_value",`If the \`${ne}\` attribute is supplied, it must be a boolean attribute`)}function pt(te){throw new e(te,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function ct(te,ne){throw new e(te,"script_reserved_attribute",`The \`${ne}\` attribute is reserved and cannot be used`)}function ut(te){throw new e(te,"style_duplicate","A component can have a single top-level `<style>` element")}function dt(te){throw new e(te,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function ft(te){throw new e(te,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function _e(te){throw new e(te,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function mt(te,ne){throw new e(te,"svelte_meta_duplicate",`A component can only have one \`<${ne}>\` element`)}function ht(te,ne){throw new e(te,"svelte_meta_invalid_content",`<${ne}> cannot have children`)}function gt(te,ne){throw new e(te,"svelte_meta_invalid_placement",`\`<${ne}>\` tags cannot be inside elements or blocks`)}function yt(te,ne){throw new e(te,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${ne}`)}function xt(te){throw new e(te,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function Et(te){throw new e(te,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function fe(te,ne){throw new e(te,"svelte_options_invalid_attribute_value",`Value must be ${ne}, if specified`)}function vt(te){throw new e(te,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function St(te){throw new e(te,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function bt(te){throw new e(te,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function $e(te){throw new e(te,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function Tt(te){throw new e(te,"svelte_options_reserved_tagname","Tag name is reserved")}function Ct(te,ne){throw new e(te,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${ne}'`)}function kt(te){throw new e(te,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function wt(te,ne,Me){throw new e(te,"tag_invalid_placement",`{@${ne} ...} tag cannot be ${Me}`)}function f(te){throw new e(te,"unexpected_eof","Unexpected end of input")}function Pt(te,ne){throw new e(te,"unexpected_reserved_word",`'${ne}' is a reserved word in JavaScript and cannot be used here`)}function At(te){throw new e(te,"unterminated_string_constant","Unterminated string constant")}function Dt(te){throw new e(te,"void_element_invalid_content","Void elements cannot have children or closing tags")}var vi="",ba=[],ys=0,fn=[],mn=0;function lu(te,ne){vi=te,ba=ne,ys=0}function uu(){return ys}function hu(te,ne,Me,Ot){ys=Ot}function du(te,ne,Me,Ot,Mt,Vt){ys=Ot;let Wt=ne;if(te&&Wt.includes(`
|
|
21
|
-
`)){let Gt=vi.lastIndexOf(`
|
|
22
|
-
`,Me-1)+1,Ut=Gt,Ht=vi.charCodeAt(Ut);while(Ht===32||Ht===9)Ht=vi.charCodeAt(++Ut);if(Ut>Gt)Wt=fu(Wt,vi.slice(Gt,Ut))}let jt={type:te?"Block":"Line",value:Wt,start:Me,end:Ot};if(Mt&&Vt)jt.loc={start:Mt,end:Vt};ba.push(jt)}function fu(te,ne){let Me=te.startsWith(ne)?ne.length:0,Ot="",Mt=te.indexOf(`
|
|
23
|
-
`,Me);while(Mt!==-1){if(Ot+=te.slice(Me,Mt+1),Me=Mt+1,te.startsWith(ne,Me))Me+=ne.length;Mt=te.indexOf(`
|
|
24
|
-
`,Me)}return Ot+te.slice(Me)}function mu(te,ne,Me){let Ot=0,Mt=ne.length;while(Ot<Mt){let Vt=Ot+Mt>>>1;if(ne[Vt].start<Me)Ot=Vt+1;else Mt=Vt}if(Ot>=ne.length)return;if(fn=ne.slice(Ot).map(({type:Vt,value:Wt,start:jt,end:Gt})=>({type:Vt,value:Wt,start:jt,end:Gt})),mn=0,yr(te,void 0,!1),mn<fn.length&&(fn[mn].start>=te.end||te.type==="Program")){te.trailingComments??=[];while(mn<fn.length)te.trailingComments.push(fn[mn++])}}var gu=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function Ea(te,ne){for(let Me=te;Me<ne;Me++){let Ot=vi.charCodeAt(Me);if(Ot!==44&&Ot!==41&&Ot!==32&&Ot!==9)return!0}return!1}function yr(te,ne,Me){while(mn<fn.length&&fn[mn].start<te.start)te.leadingComments??=[],te.leadingComments.push(fn[mn++]);if(mn>=fn.length)return;let Ot=fn[mn].start;if(Ot<te.end||!Ea(te.end,Ot)){let Mt=ni(te),Vt=gu.get(te.type),Wt=Vt===void 0?void 0:Mt[Vt],jt=Array.isArray(Wt)&&Wt.length===0;for(let Gt in Mt){if(mn>=fn.length)return;if(Gt==="type")continue;let Ut=Mt[Gt];if(Array.isArray(Ut)){let Ht=Gt===Vt;for(let qt=0;qt<Ut.length;qt++){let zt=Ut[qt];if(Bn(zt))yr(zt,te,Ht?qt===Ut.length-1:jt)}}else if(Bn(Ut))yr(Ut,te,jt)}if(mn>=fn.length)return}if(ne!==void 0&&te.end===ne.end)return;if(Me)while(mn<fn.length){if(ne&&fn[mn].start>=ne.end)break;te.trailingComments??=[],te.trailingComments.push(fn[mn++])}else if(te.end<=fn[mn].start&&!Ea(te.end,fn[mn].start))te.trailingComments=[fn[mn++]]}var me=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(" ")),xs=!1,Li=1,yu=2,xu=32,vu=256,Eu=Li|yu|vu,Su=2,bu=3,Cu=4,Tu=/\r\n?|\n|\u2028|\u2029/,Sa=new Map;function gs(te){if(!(te instanceof RegExp))return te;let ne=Sa.get(te);if(!ne){let Me=new Set(te.source.slice(4,-2).split("|"));ne={test:(Ot)=>Me.has(Ot)},Sa.set(te,ne)}return ne}var xr=Di((te)=>class extends te{declareName(ne,Me,Ot){let Mt=!1;if(Me===Su){let Vt=this.currentScope();if(Mt=Sn(Vt.lexical,ne)||Sn(Vt.functions,ne)||Sn(Vt.var,ne),Vt.lexical.push(ne),this.inModule&&Vt.flags&Li)delete this.undefinedExports[ne]}else if(Me===Cu)this.currentScope().lexical.push(ne);else if(Me===bu){let Vt=this.currentScope();Mt=this.treatFunctionsAsVar?Sn(Vt.lexical,ne):Sn(Vt.lexical,ne)||Sn(Vt.var,ne),Vt.functions.push(ne)}else for(let Vt=this.scopeStack.length-1;Vt>=0;--Vt){let Wt=this.scopeStack[Vt];if(Sn(Wt.lexical,ne)&&!(Wt.flags&xu&&Wt.lexical[0]===ne)||!this.treatFunctionsAsVarInScope(Wt)&&Sn(Wt.functions,ne)){Mt=!0;break}if(Wt.var.push(ne),this.inModule&&Wt.flags&Li)delete this.undefinedExports[ne];if(Wt.flags&Eu)break}if(Mt)this.raiseRecoverable(Ot,`Identifier '${ne}' has already been declared`)}}),vr=Di((te)=>{let{keywordTypes:ne,tokTypes:Me}=te.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,ne[Vt]])),Mt;return class extends te{constructor(Vt,Wt,jt){super(Vt,Wt,jt);this.keywords=gs(this.keywords),this.reservedWords=gs(this.reservedWords),this.reservedWordsStrict=gs(this.reservedWordsStrict),this.reservedWordsStrictBind=gs(this.reservedWordsStrictBind),Mt??=this.context[0]}reset(Vt,Wt,jt){if(super.reset?.(Vt,Wt,jt),this.input=Vt,this.containsEsc=!1,this.pos=Wt,jt)this.lineStart=Wt-jt.column,this.curLine=jt.line;else this.lineStart=Vt.lastIndexOf(`
|
|
25
|
-
`,Wt-1)+1,this.curLine=this.options.locations?Vt.slice(0,this.lineStart).split(Tu).length:1;this.type=Me.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]!==Mt)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!==Li||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(Li);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(Vt,Wt){let jt=super.parseParenAndDistinguishExpression(Vt,Wt);if(jt.type==="ParenthesizedExpression")xs=!0;return jt}checkUnreserved(Vt){if(me.has(Vt.name))super.checkUnreserved(Vt)}canInsertSemicolon(){let Vt=this.type;return Vt===Me.eof||Vt===Me.braceR||Ri(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let Vt=this.input,Wt=this.options.locations,jt=this.pos,Gt=Vt.charCodeAt(jt);for(;;)if(Gt===32||Gt===9)Gt=Vt.charCodeAt(++jt);else if(Gt===10){if(Gt=Vt.charCodeAt(++jt),Wt)this.curLine++,this.lineStart=jt}else break;if(this.pos=jt,Gt===47||Gt<33||Gt>=128)super.skipSpace()}readWord1(){let Vt=this.input,Wt=this.pos,jt=Wt,Gt=Vt.charCodeAt(jt),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(++jt);if(Gt>=128||Gt===92)return super.readWord1();return this.containsEsc=!1,this.pos=jt,Ao(Vt,Wt,jt,Ut)}readWord(){let Vt=this.readWord1();return this.finishToken(Ot.get(Vt)??Me.name,Vt)}}}),Ca=fs(xr,vr),wu=/ \(\d+:\d+\)$/;function Mi(te){return te}function Ta(te){return te instanceof SyntaxError&&"pos"in te&&typeof te.pos==="number"}function Er(te,ne,Me,Ot,Mt,Vt=te.root.comments.length){let Wt=te.root.comments;lu(ne,Wt);let jt={onComment:te.comments?du:hu,sourceType:"module",ecmaVersion:16,locations:te.loc,preserveParens:Ot};if(te.lfOnly)jt.startLocation=x(Me);let Gt=te.isTypeScript?te.typescript:Ca;if(!Gt)ue();let Ut;try{Ut=Mt(Gt,jt)}catch(Ht){if(!Ta(Ht))throw Ht;cu(Ht.pos,Ht.message.replace(wu,""))}if(Wt.length>Vt)mu(Mi(Ut),Wt,Me);return Ut}function he(te,ne,Me=0){return Mi(Er(te,ne,0,!1,(Ot,Mt)=>{if(Me>0&&Mt.locations)Mt.startLocation=x(Me);let Vt=new Ot(Mt,ne,Me).parse();return Vt.start=0,Vt},0))}function ku(te,ne){if(!ne)return{line:1,column:0};let{column:Me}=x(te);return{line:_o(te-Me)+1,column:Me}}var Au={count:0},gr,Pu=(te)=>te.parseExpression();function _u(te,ne,Me,Ot,Mt){let Vt=gr;if(gr=void 0,Vt?.ParserClass===te&&Vt.onComment===ne.onComment&&Vt.locations===ne.locations&&Vt.parser.reset)Vt.parser.reset(Me,Ot,ne.startLocation);else Vt={ParserClass:te,onComment:ne.onComment,locations:ne.locations,parser:new te(ne,Me,Ot)};let Wt=Vt.parser;Wt.nextToken();let jt=Mt(Wt);return Wt.input="",gr=Vt,jt}function wa(te,ne,Me,Ot){return Au.count+=1,xs=!1,Er(te,ne,Me,!0,(Mt,Vt)=>(Vt.startLocation??=ku(Me,Vt.locations),_u(Mt,Vt,ne,Me,Ot)))}function j(te,ne,Me,Ot=!1){let Mt=Mi(wa(te,ne,Me,Pu)),Vt=Math.max(Mt.end,uu());return{node:xs&&!Ot?Sr(Mt):Mt,end:Vt}}function Nt(te,ne,Me){let Ot=te.root.comments.length,Mt=!0,Vt=wa(te,ne,Me,(jt)=>{let Gt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Ut=jt.parseMaybeConditional(void 0,Gt);if(jt.type!==Ca.acorn.tokTypes.eof)return Mt=!1,Ut;let Ht=jt.toAssignable(Ut,!1,Gt);return jt.checkLValPattern(Ht),Ht});if(!Mt){te.root.comments.length=Ot;return}let Wt=Mi(Vt);return xs?Sr(Wt):Wt}function _t(te,ne,Me){return Mi(Er(te,ne,Me,!1,(Ot,Mt)=>{let Vt=new Ot(Mt,ne,Me);try{return Vt.nextToken(),Vt.parseStatement(null,!0,Object.create(null))}catch(Wt){if(Ta(Wt)&&Wt.pos===ne.length)f(ne.length);throw Wt}}))}function Sr(te){let ne=te;while(ne.type==="ParenthesizedExpression")ne=ne.expression;return z(ne,Sr),ne}var V=fs(xr,ce,vr);function ka(te,ne,Me){return re(te),he({isTypeScript:ne.typescript??!1,typescript:Me,loc:ne.loc??!1,comments:ne.comments??!0,root:{comments:[]}},te)}function I(te,ne={}){return ka(te,ne,V)}function ge(te,ne){let Me=u(te.name,ne.name);if(Me!==0)return Me;let Ot=u(te.type,ne.type);if(Ot!==0)return Ot;if(te.type==="forwarded"&&ne.type==="forwarded"){let Mt=u(te.element,ne.element);if(Mt!==0)return Mt}return u(te.detail??"",ne.detail??"")}function $u(te,ne){let Me=te.length+1,Ot=ne.length+1,Mt=Array.from({length:Me},()=>Array(Ot).fill(0));for(let Vt=0;Vt<Me;Vt++)Mt[Vt][0]=Vt;for(let Vt=0;Vt<Ot;Vt++)Mt[0][Vt]=Vt;for(let Vt=1;Vt<Me;Vt++)for(let Wt=1;Wt<Ot;Wt++){let jt=te[Vt-1]===ne[Wt-1]?0:1;if(Mt[Vt][Wt]=Math.min(Mt[Vt-1][Wt]+1,Mt[Vt][Wt-1]+1,Mt[Vt-1][Wt-1]+jt),Vt>1&&Wt>1&&te[Vt-1]===ne[Wt-2]&&te[Vt-2]===ne[Wt-1])Mt[Vt][Wt]=Math.min(Mt[Vt][Wt],Mt[Vt-2][Wt-2]+1)}return Mt[Me-1][Ot-1]}function L(te,ne,Me=3){let Ot,Mt=Number.POSITIVE_INFINITY;for(let Vt of ne){let Wt=$u(te,Vt);if(Wt<Mt)Ot=Vt,Mt=Wt}return Mt<=Me?Ot:void 0}import{readFile as Uh}from"node:fs/promises";import Br from"node:path";import Aa,{sep as br}from"node:path";var Nn=/\.svelte$/,Ei=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],Pa=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function Si(te){if(!te.endsWith(".svelte"))return!1;let ne=te.length-7;if(ne===0)return!1;let Me=te.charCodeAt(ne-1);return Me!==47&&(br==="/"||Me!==92)}function n(te){return br==="/"?te:te.split(br).join("/")}function _a(te,ne){return n(Aa.join(ne,Aa.normalize(te)))}function Fi(te){return`${JSON.stringify(te,null,2)}
|
|
26
|
-
`}var $a="sveld",vs="0.40.4";var $t={name:$a,version:vs,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"},"./browser":{types:"./dist/browser.d.ts",import:"./dist/browser.js",default:"./dist/browser.js"},"./schema/component-api.schema.json":"./schema/component-api.schema.json"},scripts:{test:"bun test --parallel","test:changed":"bivium run --suite unit","test:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"bun check --project tsconfig.fixtures.json","test:types-matrix":"bun scripts/typecheck-option-matrix.ts","test:svelte-versions":"bun scripts/typecheck-svelte-versions.ts","test:e2e":"bun tests/test-e2e.ts","test:inferred-types":"bun scripts/check-inferred-types.ts","lint:all":"bun fmt && bun lint --fix && svelte-lint --fix","lint:changed":"bun fmt --changed && bun lint --changed --fix && svelte-lint --changed --fix","lint:svelte":"svelte-lint",knip:"knip-bun",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@types/bun":"^1.4.4","@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.11.1",svelte:"^5.58.0","svelte-lint":"^0.1.1",typescript:"^7.0.2"},bin:{sveld:"dist/cli.js"},repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var Bi="5.58.0";var Es=1;function qn(te){return te.some((ne)=>ne.internal)?te.filter((ne)=>!ne.internal):te}function Du(te){return{...te,props:qn(te.props),moduleExports:qn(te.moduleExports),slots:qn(te.slots),events:qn(te.events),typedefs:qn(te.typedefs),...te.contexts?{contexts:qn(te.contexts).map((ne)=>({...ne,properties:qn(ne.properties)}))}:{}}}function y(te,ne={}){let Me=Array.from(te.values(),(Vt)=>{let{diagnostics:Wt,...jt}=Vt;return Du(jt)}).sort((Vt,Wt)=>u(Vt.moduleName,Wt.moduleName)),Ot={schemaVersion:Es,generator:{name:$a,version:vs,svelteVersion:Bi},total:Me.length,components:Me},Mt=ne.entryExports?qn(ne.entryExports):void 0;if(Mt&&Mt.length>0)Ot.totalExports=Mt.length,Ot.exports=Mt;return Ot}var Ru=" ",Iu=120,Ou=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Lu=200,Ia=/\s/,Mu=/\s{2}|[^\S ]/,Fu=/["'`{}/]/g,Bu=/["'`{};/]/g,Oa=9,Tr=10,ju=13,ji=32,bs=34,Vu=38,Cs=39,Gu=40,Wu=41,Ss=42,Na=46,kr=47,La=59,Uu=62,Hu=91,Ar=92,Ku=93,Ts=96,Pr=123,qu=124,_r=125;function zu(te){return Ou.test(Ju(te,Lu))}var Da=[""];function Xu(te){let ne=Da[te];if(ne===void 0)ne=Ru.repeat(te),Da[te]=ne;return ne}function Ju(te,ne){let Me="";for(let Ot=te.length-1;Ot>=0&&Me.length<ne;Ot--)Me=te[Ot]+Me;return Me.length>ne?Me.slice(-ne):Me}function Yu(te){if(te.length===0)return!1;let ne=te[te.length-1];return ne.charCodeAt(ne.length-1)===Tr}function Qu(te){while(te.length>0){let ne=te[te.length-1],Me=ne.length;while(Me>0){let Ot=ne.charCodeAt(Me-1);if(Ot!==ji&&Ot!==Oa)break;Me--}if(Me===ne.length)return;if(Me===0){te.pop();continue}te[te.length-1]=ne.slice(0,Me);return}}function Zu(te){while(te.length>0){let ne=te[te.length-1];if(!Ia.test(ne[ne.length-1]))return;let Me=ne.trimEnd();if(Me.length===ne.length)return;if(Me.length===0){te.pop();continue}te[te.length-1]=Me;return}}function eh(te){if(te.includes("{"))return!1;let ne=0,Me=0;for(let Ot=0;Ot<te.length;Ot++){let Mt=te.charCodeAt(Ot);if(ne!==0){if(Mt===ne&&te.charCodeAt(Ot-1)!==Ar)ne=0;continue}if(Mt===bs||Mt===Cs||Mt===Ts){ne=Mt;continue}if(Mt===La&&++Me>=2)return!0}return!1}function th(te){if(!Mu.test(te))return te.trimEnd();let ne="",Me=null,Ot=!1;for(let Mt=0;Mt<te.length;Mt++){let Vt=te[Mt],Wt=te[Mt-1];if(Me){if(ne+=Vt,Me==="double"&&Vt==='"'&&Wt!=="\\"||Me==="single"&&Vt==="'"&&Wt!=="\\"||Me==="template"&&Vt==="`"&&Wt!=="\\")Me=null;Ot=!1;continue}if(Vt==='"'||Vt==="'"||Vt==="`"){Me=Vt==='"'?"double":Vt==="'"?"single":"template",ne+=Vt,Ot=!1;continue}if(Ia.test(Vt)){if(!Ot&&ne.length>0)ne+=" ",Ot=!0;continue}ne+=Vt,Ot=!1}return ne.trimEnd()}function Ma(te,ne){let Me=te[ne],Ot=te.indexOf(Me,ne+1);while(Ot!==-1&&te.charCodeAt(Ot-1)===Ar)Ot=te.indexOf(Me,Ot+1);return Ot}function Fa(te,ne){let Me=te.indexOf("*/",ne+1);return Me===-1?-1:Me+1}function nh(te){let ne=new Map,Me=[],Ot=Fu,Mt=0;while(Mt<te.length){if(Ot.lastIndex=Mt,!Ot.test(te))break;Mt=Ot.lastIndex-1;let Vt=te.charCodeAt(Mt);if(Vt===kr){if(te.charCodeAt(Mt+1)===Ss){let Wt=Fa(te,Mt);if(Wt===-1)break;Mt=Wt}}else if(Vt===bs||Vt===Cs||Vt===Ts){let Wt=Ma(te,Mt);if(Wt===-1)break;Mt=Wt}else if(Vt===Pr)Me.push(Mt);else if(Vt===_r&&Me.length>0)ne.set(Me.pop(),Mt);Mt++}return ne}function ih(te,ne,Me){for(let Ot=ne;Ot<Me;Ot++)if(!wr(te.charCodeAt(Ot)))return!1;return!0}function wr(te){if(te<=ji)return te===ji||te>=Oa&&te<=ju;if(te<160)return!1;return te===160||te===5760||te>=8192&&te<=8202||te===8232||te===8233||te===8239||te===8287||te===12288||te===65279}function Ba(te,ne,Me,Ot){let Mt=[],Vt=Bu,Wt=ne,jt=ne;while(jt<Me){if(Vt.lastIndex=jt,!Vt.test(te))break;if(jt=Vt.lastIndex-1,jt>=Me)break;let Gt=te.charCodeAt(jt);if(Gt===kr){if(te.charCodeAt(jt+1)===Ss){let Ut=Fa(te,jt);if(Ut===-1)break;jt=Ut}jt++;continue}if(Gt===bs||Gt===Cs||Gt===Ts){let Ut=Ma(te,jt);if(Ut===-1)break;jt=Ut+1;continue}if(Gt===Pr){let Ut=Ot.get(jt);if(Ut===void 0||Ut>=Me){jt++;continue}if(Wt<jt)Mt.push(te.slice(Wt,jt));let Ht=jt+1;if(ih(te,Ht,Ut)){Mt.push("{}"),jt=Ut+1,Wt=jt;continue}let qt=te.slice(Ht,Ut),zt=te.charCodeAt(Ht)===Tr;if(!zt&&!qt.includes("/*")&&!eh(qt)&&!zu(Mt)){let Xt=Ba(te,Ht,Ut,Ot),Jt=Xt.trim();if(!Jt.includes(`
|
|
27
|
-
`)){let Qt=Jt.endsWith(";")?Jt.slice(0,-1):Jt,Yt=`{ ${th(Qt)} }`;if(Yt.length<=Iu){Mt.push(Yt),jt=Ut+1,Wt=jt;continue}}if(Mt.push("{"),Xt.charCodeAt(0)!==La)Mt.push(`
|
|
28
|
-
`);if(Xt.length>0)Mt.push(Xt);jt=Ut,Wt=Ut;continue}if(Mt.push("{"),!zt)Mt.push(`
|
|
29
|
-
`);jt=Ht,Wt=Ht;continue}if(Gt===_r){if(Wt<jt)Mt.push(te.slice(Wt,jt));if(Qu(Mt),!Yu(Mt))Mt.push(`
|
|
30
|
-
`);Mt.push("}"),jt++,Wt=jt;continue}if(Wt<jt)Mt.push(te.slice(Wt,jt));if(Zu(Mt),Mt.push(";"),te.charCodeAt(jt+1)!==Tr)Mt.push(`
|
|
31
|
-
`);jt++,Wt=jt}if(Wt<Me)Mt.push(te.slice(Wt,Me));return Mt.join("")}function sh(te){if(!te.includes(" "))return te;let ne="",Me=0;for(let Ot=0;Ot<te.length;Ot++){let Mt=te.charCodeAt(Ot);if(Me!==0){if(ne+=te[Ot],Mt===Me&&te.charCodeAt(Ot-1)!==Ar)Me=0;continue}if(Mt===bs||Mt===Cs||Mt===Ts){Me=Mt,ne+=te[Ot];continue}if(Mt===ji&&ne.charCodeAt(ne.length-1)===ji)continue;ne+=te[Ot]}return ne}function rh(te){return te===_r||te===Ku||te===Wu||te===Uu}function oh(te,ne,Me){return Me-ne>=3&&te.charCodeAt(ne)===kr&&te.charCodeAt(ne+1)===Ss&&te.charCodeAt(ne+2)===Ss}function Ra(te,ne,Me){let Ot=te.indexOf("*/",ne);return Ot!==-1&&Ot+2<=Me}function ah(te,ne,Me){let Ot=te.charCodeAt(ne);if(Ot===qu||Ot===Vu)return!0;return Ot===Na&&ne+1<Me&&te.charCodeAt(ne+1)!==Na}function ph(te){let ne=[],Me=[],Ot=te.length,Mt=0,Vt=!1,Wt=0,jt=0;while(jt<=Ot){let Ht=te.indexOf(`
|
|
32
|
-
`,jt);if(Ht===-1)Ht=Ot;let qt=Ht+1,zt=jt,Xt=Ht;while(zt<Xt&&wr(te.charCodeAt(zt)))zt++;while(Xt>zt&&wr(te.charCodeAt(Xt-1)))Xt--;if(zt===Xt){let sn=Me.length>0?Me[Me.length-1]:void 0;if(sn!==void 0&&sn!==""){let cn=sn.charCodeAt(sn.length-1);if(cn!==Pr&&cn!==Gu&&cn!==Hu)ne.push(0),Me.push("")}jt=qt;continue}if(Vt){if(ne.push(Wt),Me.push(` ${te.slice(zt,Xt)}`),Ra(te,zt,Xt))Vt=!1;jt=qt;continue}let Jt=oh(te,zt,Xt),Qt=Jt&&Ra(te,zt,Xt);if(Jt&&!Qt){ne.push(Mt),Me.push(te.slice(zt,Xt)),Vt=!0,Wt=Mt,jt=qt;continue}let Yt=rh(te.charCodeAt(zt)),nn=Math.max(0,Mt-(Yt?1:0))+(ah(te,zt,Xt)?1:0);if(Yt&&nn===0&&Me.length>0&&Me[Me.length-1]==="")ne.pop(),Me.pop();if(ne.push(nn),Me.push(sh(te.slice(zt,Xt))),jt=qt,Qt)continue;Mt=is(te,void 0,zt,Xt,Mt)}let Gt=Me.length;while(Gt>0&&Me[Gt-1]==="")Gt--;let Ut=[];for(let Ht=0;Ht<Gt;Ht++){if(Ht>0)Ut.push(`
|
|
33
|
-
`);let qt=ne[Ht];if(qt>0)Ut.push(Xu(qt));Ut.push(Me[Ht])}return Ut.join("")}function ja(te){return`${ph(Ba(te,0,te.length,nh(te)))}
|
|
34
|
-
`}var An="any",ch="Record<string, any>",Vi="Record<string, never>",Ka=/^[A-Za-z_$][A-Za-z0-9_$]*$/,lh=/CustomEvent/,uh=/^[A-Z]/,hh=/\n/,dh=/=>/,fh=/^\s*[(<]/,mh=/(?:^|\n)@default\b/,gh=/^([ \t]*\*) +$/gm,yh=/[^\S\r\n]*[\r\n]\s*/g,xh=/(^|[^.\w])Snippet(?:\s*<|\b)/,vh=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,Eh=/^const\s+/,Sh=/^export /,bh=/[^\w$]/g;function Nr(te){return te.replace(Eh,"")}function Ln(te){if(te.length===0)return"";return`/**
|
|
35
|
-
* ${B(te.join(`
|
|
36
|
-
* `))}
|
|
37
|
-
*/`}function Gi(te){return te?te.split(`
|
|
38
|
-
`):[]}function qa(te){if(te===void 0)return[];return(te===!0?"@deprecated":`@deprecated ${te}`).split(`
|
|
39
|
-
`)}function Dr(te){let ne=[];for(let{name:Me,body:Ot}of te??[])if(!Ot)ne.push(`@${Me}`);else if(Ot.includes(`
|
|
40
|
-
`))ne.push(`@${Me}`,...Ot.split(`
|
|
41
|
-
`));else ne.push(`@${Me} ${Ot}`);return ne}function bi(te,ne,Me){return[...Gi(te),...qa(ne),...Dr(Me)]}function za(te){if(!te)return"";return`/** ${B(te)} */`}function Rr(te){return te?.includes(`
|
|
42
|
-
`)?Ln(Gi(te)):za(te)}function Ir(te,ne,Me){let Ot=[...Dr(ne),...qa(Me)];if(Ot.length===0)return Rr(te);return Ln([...Gi(te),...Ot])}function Xa(te){if(te===void 0)return An;return`${te}
|
|
43
|
-
`}function ks(te){if(te.typedefs.length===0)return"";return te.typedefs.map((ne)=>{let Me=Ln([...Gi(ne.description),...Dr(ne.tags)]);return`${Me?`${Me}
|
|
44
|
-
`:""}export ${ne.ts}`.replace(gh,"$1")}).join(`
|
|
45
|
-
|
|
46
|
-
`)}var Va=new Map;function Ch(te,ne){let Me=Va.get(ne);if(Me===void 0)Me=new RegExp(`\\b${R(ne)}\\b`),Va.set(ne,Me);return Me.test(te)}var Ga,Wa=[];function ws(te){if(te!==Ga)Ga=te,Wa=r(te,",");return Wa}function Th(te){if(te===null)return[];return te[0].split(",").map((ne,Me)=>({name:ne.trim(),constraint:(ws(te[1]??"")[Me]??ne).trim()}))}function Ja(te,ne){let Me=Th(te).filter(({name:Ot})=>Ch(ne,Ot));if(Me.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Me.map(({constraint:Ot})=>Nr(Ot)).join(", ")}>`,refSuffix:`<${Me.map(({name:Ot})=>Ot).join(", ")}>`}}function Ya(te){if(!te.contexts||te.contexts.length===0)return"";return te.contexts.map((ne)=>{let Me=ne.properties.map((Wt)=>{let jt=Wt.description?`${Rr(Wt.description)}
|
|
47
|
-
`:"",Gt=Wt.optional?"?":"";return`${jt}${Dn(Wt.name)}${Gt}: ${Wt.type};`}).join(`
|
|
48
|
-
`),Ot=ne.description?`${Ln(Gi(ne.description))}
|
|
49
|
-
`:"",{declSuffix:Mt}=Ja(te.generics,[ne.type??"",...ne.properties.map((Wt)=>Wt.type)].join(`
|
|
50
|
-
`));if(ne.type!==void 0)return`${Ot}export type ${ne.typeName}${Mt} = ${ne.type};`;if(ne.properties.length===0)return`${Ot}export type ${ne.typeName} = ${ne.hasUnresolvedSpread?"Record<string, any>":Vi};`;let Vt=ne.hasUnresolvedSpread?" & Record<string, any>":"";return`${Ot}export type ${ne.typeName}${Mt} = {
|
|
51
|
-
${Me}
|
|
52
|
-
}${Vt};`}).join(`
|
|
53
|
-
|
|
54
|
-
`)}function Dn(te){return Ka.test(te)?te:JSON.stringify(te)}function Ua(te,ne){let Me=Ir(ne.description,ne.tags,ne.deprecated),Ot=Me?`${Me}
|
|
55
|
-
`:"",Mt=!ne.slot_props||ne.slot_props===Vi?"[]":Ah(ne.slot_props),Vt=Mt==="[]"?"(this: void) => void":`(this: void, ...args: ${Mt}) => void`;return`
|
|
56
|
-
${Ot}${te}?: ${Vt};`}function wh(te){let ne=te.props.filter((en)=>!zn(en)),Me=new Set([...ne.map((en)=>en.name),...Array.from(te.canonicalPropNames??[])]),Mt=(te.canonicalPropsType?ne.filter((en)=>!te.canonicalPropNames?.has(en.name)):ne).map((en)=>{let ui=typeof en.value==="string"?en.value.replace(yh," "):en.value,Qi=mh.test(en.description??"")||en.value===void 0||en.value==="undefined",Zi=Ln([...bi(en.description,en.deprecated,en.tags),...en.constant?["@constant"]:[],...Qi?[]:[`@default ${ui}`]]),es=en.constant&&!en.isFunction?en.value:en.type||An;return`
|
|
57
|
-
${Zi}
|
|
58
|
-
${Dn(en.name)}${en.isRequired?"":"?"}: ${es};`});for(let en of te.slots)if(!en.default&&en.name!=null&&!Me.has(en.name))Mt.push(Ua(Dn(en.name),en));let Vt=te.slots.find((en)=>en.default||en.name===null);if(Vt&&!Me.has("children"))Mt.push(Ua("children",Vt));let Wt=Mt.join(`
|
|
59
|
-
`),jt=Ci(te.moduleName),Gt=te.generics?`<${ws(te.generics[1]).map((en)=>Nr(en.trim())).join(", ")}>`:"",Ut=te.generics?`<${te.generics[0]}>`:"",qt=`${te.extends===void 0?"":`Omit<${te.extends.interface}, keyof $Props${Ut}> & `}$Props${Ut}`,zt=(en)=>`export type ${jt}${Gt} = ${en};`,Xt=`{${Wt}
|
|
60
|
-
}`;if(te.rest_props?.type!=="Element"){let en;if(te.canonicalPropsType){let ui=Wt.trim()===""?"":` & ${Xt}`;en=[`type $Props${Gt} = ${te.canonicalPropsType}${ui};`,zt(qt)]}else if(Wt.trim()==="")en=[zt(te.extends?.interface??Vi)];else if(te.extends===void 0)en=[zt(Xt)];else en=[`type $Props${Gt} = ${Xt};`,zt(qt)];return{props_name:jt,prop_def:en.join(`
|
|
61
|
-
|
|
62
|
-
`),elementsImport:void 0}}let{name:Jt,thisValue:Qt,thisType:Yt,description:nn}=te.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?`${Rr(nn)}
|
|
63
|
-
`:"",hn=te.canonicalPropsType?`(${te.canonicalPropsType}) & `:"",Fn=Yt?{name:Gt,ref:Ut}:{name:"",ref:""},ei=te.extends===void 0?`keyof $Props${Ut}`:`keyof ($Props${Ut} & ${te.extends.interface})`,ti=`Omit<$RestProps${Fn.ref}, ${ei}>`,gn=Yt?kh(Yt,te.generics,te.extends?.interface):void 0,Wn=gn?gn.ref:ti;return{props_name:jt,prop_def:[`${un}type $RestProps${Fn.name} = ${sn};`,...gn?[gn.declaration]:[],`type $Props${Gt} = ${hn}{${Wt}
|
|
64
|
-
|
|
65
|
-
${cn}
|
|
66
|
-
};`,zt(`${Wn} & ${qt}`)].join(`
|
|
67
|
-
|
|
68
|
-
`),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function kh(te,ne,Me){if(!ne)return;let Ot=ws(ne[0]).map((Jt)=>Jt.trim()),Mt=ws(ne[1]).map((Jt)=>Nr(Jt.trim())),Vt=Ot.indexOf(te),Wt=Mt[Vt];if(Vt===-1||!Wt?.startsWith(`${te} extends `))return;let jt=r(Wt.slice(`${te} extends `.length),"=")[0]?.trim();if(!jt)return;let Gt=Ot.filter((Jt,Qt)=>Qt!==Vt),Ut=Mt.filter((Jt,Qt)=>Qt!==Vt),Ht=Ut.length>0?`<${Ut.join(", ")}>`:"",qt=Gt.length>0?`<${Gt.join(", ")}>`:"",zt=`<${Ot.map((Jt)=>Jt===te?"$Tag":Jt).join(", ")}>`,Xt=Me===void 0?`keyof $Props${zt}`:`keyof ($Props${zt} & ${Me})`;return{declaration:`type $Elements${Ht} = { [$Tag in ${jt}]: Omit<$RestProps${zt}, ${Xt}> };`,ref:`$Elements${qt}[${te}]`}}function Ah(te){return ki(te)?te:`[${te}]`}function Ph(te){let ne=te.slots.filter((Ot)=>!ki(Ot.slot_props??""));if(ne.length===0)return Vi;let Me=ne.map(({name:Ot,slot_props:Mt,...Vt})=>{let Wt=Vt.default||Ot===null?"default":Dn(Ot??""),jt=Ir(Vt.description,Vt.tags,Vt.deprecated);return`${jt?`${jt}
|
|
69
|
-
`:""}${Wt}: ${Xa(Mt)};`}).join(`
|
|
70
|
-
`);return ne.length===1?`{${Me}}`:`{
|
|
71
|
-
${Me}
|
|
72
|
-
}`}var _h=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(te=An){if(lh.test(te))return te;return`CustomEvent<${te}>`}function As(te){switch(te.type){case"dispatched":return $r(te.detail);case"forwarded":{let ne=te.element,Me=ne&&uh.test(ne),Ot=!Me||_h.has(te.name);if(te.detail!==void 0&&te.detail!=="undefined"&&!(te.detail==="null"&&Ot&&!Me))return $r(te.detail);if(!Ot)return $r();return`${ne==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${te.name}"]`}default:return te}}function Ha(te){if(te.events.length===0)return ch;let ne=te.events.map((Me)=>{let Ot=Ir(Me.description,Me.tags,Me.deprecated);return`${Ot?`${Ot}
|
|
73
|
-
`:""}${Dn(Me.name)}: ${As(Me)};
|
|
74
|
-
`}).join("");return te.events.length===1?`{${ne}}`:`{
|
|
75
|
-
${ne}}`}function $h(te){let ne=te.type==="() => any";if(te.type&&dh.test(te.type)&&!ne)return te.type;if(te.params&&te.params.length>0)return`(${h(te.params)}) => ${te.returnType||An}`;if(te.returnType)return`() => ${te.returnType}`;return te.type||An}function zn(te){return te.isFunctionDeclaration===!0||te.kind==="const"}function Qa(te){return te.props.filter(zn).map((ne)=>`
|
|
76
|
-
${Ln(bi(ne.description,ne.deprecated,ne.tags))}
|
|
77
|
-
${Dn(ne.name)}: ${$h(ne)};`).join(`
|
|
78
|
-
`)}function Nh(te){let ne=Wi(te.moduleName),Me=Qa({props:te.props});if(Me.trim()==="")return{exports_ref:ne,exports_def:`export type ${ne} = ${Vi};`};let{declSuffix:Ot,refSuffix:Mt}=Ja(te.generics,Me);return{exports_ref:`${ne}${Mt}`,exports_def:`export type ${ne}${Ot} = {${Me}
|
|
79
|
-
};`}}function Dh(te){let ne=te.props.filter((Me)=>Me.bindable===!0||Me.binding==="writable").map((Me)=>JSON.stringify(Me.name));return ne.length>0?ne.join(" | "):'""'}function Za(te){return te==="default"?"$$Component":te}function Rh(te){let ne=Za(te.moduleName);return`declare const ${ne}: Component<
|
|
80
|
-
${te.propsRef},
|
|
81
|
-
${te.exportsRef},
|
|
82
|
-
${te.bindings}
|
|
83
|
-
>;
|
|
84
|
-
export default ${ne};`}function Ih(te){let ne=Za(te.moduleName),Me=`${ne}Component`,Ot=te.eventsRef?`$on?<K extends keyof ${te.eventsRef} & string>(type: K, callback: (e: ${te.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${Me} {
|
|
85
|
-
new ${te.generic}(
|
|
86
|
-
options: ComponentConstructorOptions<${te.propsRef}>
|
|
87
|
-
): SvelteComponent<${te.propsRef}${te.eventsRef?`, ${te.eventsRef}`:""}> & ${te.exportsRef};
|
|
88
|
-
${te.generic}(
|
|
89
|
-
this: void,
|
|
90
|
-
internals: ComponentInternals,
|
|
91
|
-
props: ${te.propsRef}
|
|
92
|
-
): {
|
|
93
|
-
${Ot}
|
|
94
|
-
$set?(props: Partial<${te.propsRef}>): void;
|
|
95
|
-
} & ${te.exportsRef};
|
|
96
|
-
element?: typeof HTMLElement;
|
|
97
|
-
z_$$bindings?: ${te.bindings};
|
|
98
|
-
}
|
|
99
|
-
declare const ${ne}: ${Me};
|
|
100
|
-
export default ${ne};`}function Oh(te){if(te.extends===void 0)return"";return`import type { ${Or(te.extends.interface)} } from ${te.extends.import};`}function Or(te){let ne=te.indexOf("<");return(ne===-1?te:te.slice(0,ne)).trim()}function Lh(te){if(!te.componentComment)return"";if(!hh.test(te.componentComment))return za(te.componentComment.trim());return`/*${B(te.componentComment).split(`
|
|
101
|
-
`).map((ne)=>`* ${ne}`).join(`
|
|
102
|
-
`)}
|
|
103
|
-
*/`}function Mh(te){let ne=[],Me=new Map;for(let Ot of te.moduleExports){if(Ot.kind!=="re-export"||!Ot.reExport)continue;let{from:Mt,imported:Vt}=Ot.reExport,Wt=Ln(bi(Ot.description,Ot.deprecated,Ot.tags)),jt=Dn(Ot.name);if(Vt==="*"){let Ht=Ot.name==="*"?"*":`* as ${jt}`;ne.push(`${Wt}
|
|
104
|
-
export ${Ht} from ${JSON.stringify(Mt)};`);continue}let Gt=`${Mt}\x00${Wt}`,Ut=Me.get(Gt);if(!Ut)Ut={comment:Wt,from:Mt,specifiers:[]},Me.set(Gt,Ut),ne.push(Gt);Ut.specifiers.push(Vt===Ot.name?jt:`${Dn(Vt)} as ${jt}`)}return ne.map((Ot)=>{let Mt=Me.get(Ot);if(!Mt)return Ot;return`${Mt.comment}
|
|
105
|
-
export { ${Mt.specifiers.join(", ")} } from ${JSON.stringify(Mt.from)};`}).join(`
|
|
106
|
-
|
|
107
|
-
`)}function Lr(te){let ne=[te.static?"static ":"",te.abstract?"abstract ":"",te.readonly?"readonly ":""].join(""),Me=te.optional?"?":"";if(te.kind==="property")return`${ne}${Dn(te.name)}${Me}: ${te.type??An}`;if(te.kind==="index")return`${ne}${te.name}: ${te.type??An}`;let Ot=h(te.params??[]);if(te.kind==="constructor")return`constructor(${Ot})`;let Mt=te.typeParameters?`<${te.typeParameters}>`:"";return`${ne}${Dn(te.name)}${Me}${Mt}(${Ot}): ${te.returnType??An}`}function Fh(te,ne){let Me=te.localName??te.name,Ot=Me!==te.name,Mt=`export { ${Me}${Ot?` as ${Dn(te.name)}`:""} };`;if(ne.has(Me))return Mt;ne.add(Me);let Vt=te.typeParameters?`<${te.typeParameters}>`:"",Wt=(te.members??[]).map((Ht)=>[Ln(bi(Ht.description,Ht.deprecated,Ht.tags)),`${Lr(Ht)};`].filter(Boolean).join(`
|
|
108
|
-
`)).join(`
|
|
109
|
-
|
|
110
|
-
`),jt=`${te.extends?` extends ${te.extends}`:""}${te.implements?.length?` implements ${te.implements.join(", ")}`:""}`,Gt=`${Ot?"":"export "}declare ${te.abstract?"abstract ":""}class ${Me}${Vt}${jt}`;return`
|
|
111
|
-
${[Ln(bi(te.description,te.deprecated,te.tags)),Wt?`${Gt} {
|
|
112
|
-
${Wt}
|
|
113
|
-
}`:`${Gt} {}`,Ot?Mt:""].filter(Boolean).join(`
|
|
114
|
-
`)}`}function Bh(te){let ne=Mh(te),Me=new Set,Ot=te.moduleExports.filter((Mt)=>Mt.kind!=="re-export").map((Mt)=>{if(Mt.kind==="class")return Fh(Mt,Me);let Vt=!Ka.test(Mt.name),Wt=Vt?{...Mt,name:jh(Mt.name)}:Mt,jt,Gt=Wt.type&&fh.test(Wt.type)?C(Wt.type):-1,Ut=Wt.typeParameters?`<${Wt.typeParameters}>`:"";if(Wt.kind==="const"&&Gt===-1)jt=`export declare const ${Wt.name}: ${Wt.type||An};
|
|
115
|
-
`;else if(Wt.kind==="let")jt=`export declare let ${Wt.name}: ${Wt.type||An};`;else if(Wt.params&&Wt.params.length>0)jt=`export declare function ${Wt.name}${Ut}(${h(Wt.params)}): ${Wt.returnType||An};`;else if(Wt.returnType)jt=`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();jt=`export declare function ${Wt.name}${Ht}: ${qt};`}else jt=`export declare let ${Wt.name}: ${Wt.type||An};`;if(Vt)jt=`${jt.replace(Sh,"").trimEnd()}
|
|
116
|
-
export { ${Wt.name} as ${JSON.stringify(Mt.name)} };`;return`
|
|
117
|
-
${Ln(bi(Wt.description,Wt.deprecated,Wt.tags))}
|
|
118
|
-
${jt}`}).join(`
|
|
119
|
-
`);return[ne,Ot].filter(Boolean).join(`
|
|
120
|
-
|
|
121
|
-
`)}function jh(te){return`__export_${te.replace(bh,"_")}`}var Vh=120;function Gh(te){let Me=`export default class ${te.moduleName==="default"?"":te.moduleName}${te.generic} extends SvelteComponentTyped<`,Ot=[te.genericProps,te.events,te.slots],Vt=[te.ownConstructor?`constructor(options: ComponentConstructorOptions<${te.genericProps}>);`:"",te.accessors.trim()].filter(Boolean).join(`
|
|
122
|
-
`);if(Vt===""&&Ot.every((Wt)=>!Wt.includes(`
|
|
123
|
-
`))){let Wt=`${Me}${Ot.join(", ")}> {}`;if(Wt.length<=Vh)return Wt}return`${Me}
|
|
124
|
-
${te.genericProps},
|
|
125
|
-
${te.events},
|
|
126
|
-
${te.slots}
|
|
127
|
-
> {
|
|
128
|
-
${Vt}
|
|
129
|
-
}`}function Ci(te){return`${te}Props`}function Wi(te){return`${te}Exports`}function Mr(te){return{format:te.format}}var Wh={format:"class"};function ep(te){let ne=Mr(te??{}),Me={};for(let[Ot,Mt]of Object.entries(ne))Me[Ot]=Mt??Wh[Ot];return JSON.stringify(Me)}function Fr(te,ne){let Me=ko(te),{moduleName:Ot,typedefs:Mt,generics:Vt,props:Wt,moduleExports:jt,slots:Gt,events:Ut,rest_props:Ht,extends:qt,componentComment:zt,contexts:Xt}=te,Jt=ne?.format==="component",Qt=Vt!==null,{props_name:Yt,prop_def:nn,elementsImport:sn}=wh({moduleName:Ot,props:Wt,rest_props:Ht,extends:qt,generics:Vt,slots:Gt,canonicalPropNames:new Set(Me?.canonicalPropNames??[]),canonicalPropsType:Me?.canonicalPropsType}),cn=Vt?`<${Vt[1]}>`:"",un=Vt?`${Yt}<${Vt[0]}>`:Yt,hn=Jt&&Ut.length>0?`type $Events${cn} = ${Ha({events:Ut})};`:"",Fn=Vt?`$Events<${Vt[0]}>`:"$Events",ei=Jt&&(Qt||hn!==""),ti=Bh({moduleExports:jt}),gn=ks({typedefs:Mt}),Wn=Ya({contexts:Xt,generics:Vt}),en=(Me?.typeImportStatements??[]).join(`
|
|
130
|
-
`),ui=[...Me?.localTypeDeclarations??[],...Me?.moduleTypeDeclarations??[]].join(`
|
|
131
|
-
|
|
132
|
-
`),{exports_ref:Qi,exports_def:Zi}=Jt?Nh({props:Wt,moduleName:Ot,generics:Vt}):{exports_ref:"",exports_def:""},es=Jt?Dh({props:Wt}):"",To=Ht?.type==="Element"&&Ht.thisType!==void 0,Hs=!vh.test(en)&&[nn,ti,gn,Wn,ui,Zi].some((Ks)=>xh.test(Ks)),Hc=[Jt?ei?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Hs?", Snippet":""} } from "svelte";`:`import type { Component${Hs?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${To?", type ComponentConstructorOptions":""}${Hs?", type Snippet":""} } from "svelte";`,sn?`import type { ${sn} } from "svelte/elements";`:"",en,Oh({extends:qt})].filter(Boolean).join(`
|
|
133
|
-
`),Kc=Jt?ei?Ih({moduleName:Ot,generic:cn,propsRef:un,exportsRef:Qi,bindings:es,...hn?{eventsRef:Fn}:{}}):Rh({moduleName:Ot,propsRef:un,exportsRef:Qi,bindings:es}):Gh({moduleName:Ot,generic:cn,genericProps:un,events:Ha({events:Ut}),slots:Ph({slots:Gt}),accessors:Qa({props:Wt}),ownConstructor:To}),qc=[ti,gn,ui,Wn,nn,Zi,hn,[Lh({componentComment:zt}),Kc].filter(Boolean).join(`
|
|
134
|
-
`)].map((Ks)=>Ks.trim()).filter(Boolean).join(`
|
|
135
|
-
|
|
136
|
-
`);return ja([Hc,qc].filter(Boolean).join(`
|
|
137
|
-
|
|
138
|
-
`))}var Hh=/[:=]/,tp=/^HTML\w+Element$|^HTMLElementTagNameMap\[[\w$]+\]$/,np=/^SVG\w+Element$/,Kh=/[\w$]+/g,qh=/^CustomEvent<([\s\S]*)>$/,zh=/^(Readonly)?Array</,Vr="COMPONENT_API.json",Ps={none:0,patch:1,minor:2,major:3};function Vn(te,ne){return Ps[ne]>Ps[te]?ne:te}function Xh(te){return te.reduce((ne,Me)=>Vn(ne,Me.bump),"none")}function dp(te,ne){return Ps[te]>=Ps[ne]}function ip(te){let ne=mi(_n(te));if(C(ne)!==-1)return new Set([ne]);return new Set(r(ne,"|").map((Me)=>mi(Me)).filter((Me)=>Me.length>0))}function fp(te,ne,Me){let Ot=rp(te),Mt=rp(ne);if(Ot&&Mt)return Yh(Ot,Mt,Me);let Vt=Qh(ap(te),ap(ne),Me);if(Vt!==void 0)return Vt;return Zh(te,ne,Me)}function Jh(te,ne){if(te===ne)return!1;if(ne==="HTMLElement")return tp.test(te);if(ne==="SVGElement")return np.test(te);if(ne==="Element")return te==="HTMLElement"||te==="SVGElement"||te==="MathMLElement"||tp.test(te)||np.test(te);return!1}function sp(te,ne){for(let Me of ne)if(Jh(te,Me))return!0;return!1}function rp(te){let ne=C(te);if(ne===-1)return;let Me=te.slice(0,ne).trim(),Ot=te.slice(ne+2).trim();if(!Me.startsWith("(")||!Me.endsWith(")"))return;let Mt=Me.slice(1,-1).trim();return{params:Mt.length===0?[]:r(Mt,",").map((Wt)=>Wt.trim()),returnType:Ot}}function mp(te){return(te.split(Hh,1)[0]??"").trimEnd().endsWith("?")}function op(te){if(te.startsWith("..."))return;let ne=T(te,":");if(ne===-1)return;let Me=te.slice(ne+1).trim();return mp(te)?`(${Me}) | undefined`:Me}function Yh(te,ne,Me){if(ne.params.length<te.params.length)return"major";let Ot=!Me&&ne.returnType==="void"?"none":Pn(te.returnType,ne.returnType,{readOnly:Me});for(let Vt=0;Vt<te.params.length;Vt++){let Wt=op(te.params[Vt]),jt=op(ne.params[Vt]);if(Wt===void 0||jt===void 0){if(_n(te.params[Vt])!==_n(ne.params[Vt]))return"major";continue}Ot=Vn(Ot,Pn(Wt,jt,{readOnly:!Me}))}let Mt=ne.params.slice(te.params.length);if(Mt.length>0)Ot=Vn(Ot,!Me||Mt.every(mp)?"minor":"major");return Ot}function ap(te){let ne=_n(te),Me=!1;if(ne.startsWith("readonly "))Me=!0,ne=ne.slice(9);let Ot=zh.exec(ne);if(Ot){let Vt=Ot[0].length-1;if(Me||E(ne,Vt)!==ne.length-1)return;return{readonly:Ot[1]!==void 0,elements:[ne.slice(Vt+1,-1)],tuple:!1}}if(ki(ne)){let Vt=ne.slice(1,-1).trim(),Wt=Vt===""?[]:r(Vt,",").map((jt)=>jt.trim());if(Wt.some((jt)=>jt.startsWith("...")||T(jt,":?")!==-1))return;return{readonly:Me,elements:Wt,tuple:!0}}if(!ne.endsWith("[]"))return;let Mt=ne.slice(0,-2);if(Mt===""||T(Mt," |&")!==-1)return;return{readonly:Me,elements:[Mt],tuple:!1}}function Qh(te,ne,Me){if(!te||!ne||te.tuple!==ne.tuple)return;if(te.elements.length!==ne.elements.length)return"major";let Ot="none";if(te.readonly!==ne.readonly)Ot=ne.readonly===Me?"major":"minor";for(let Mt=0;Mt<te.elements.length;Mt++)Ot=Vn(Ot,Pn(te.elements[Mt],ne.elements[Mt],{readOnly:Me}));return Ot}function Zh(te,ne,Me){let Ot=d(te,{withReadonly:!0}),Mt=d(ne,{withReadonly:!0});if(!Ot||!Mt)return;let{added:Vt,removed:Wt,common:jt}=Xn(Ot,Mt,(Ut)=>Ut.name);if(Wt.length>0)return"major";if(!Me&&Vt.some(([,Ut])=>!Ut.optional))return"major";let Gt=Vt.length>0?"minor":"none";for(let[,Ut,Ht]of jt){if(Ut.optional!==Ht.optional)Gt=Vn(Gt,Ht.optional===Me?"major":"minor");if(Me&&Ut.readonly!==Ht.readonly)Gt=Vn(Gt,Ht.readonly?"major":"minor");Gt=Vn(Gt,Pn(Ut.type,Ht.type,{readOnly:Me}))}return Gt}function Pn(te,ne,{readOnly:Me=!1}={}){if(te===ne)return"none";if(te===void 0||ne===void 0)return"major";if(_n(te)===_n(ne))return"none";let Ot=fp(mi(te),mi(ne),Me);if(Ot!==void 0)return Ot;return ed(ip(te),ip(ne),Me)}function ed(te,ne,Me){let Ot=[...ne].filter((Ut)=>!te.has(Ut)&&!sp(Ut,te)),Mt=[...te].filter((Ut)=>!ne.has(Ut)&&!sp(Ut,ne));if(Ot.length===1&&Mt.length===1){let Ut=fp(Mt[0],Ot[0],Me);if(Ut!==void 0)return Ut}let Vt=Ot.length>0,Wt=Mt.length>0,[jt,Gt]=Me?[Vt,Wt]:[Wt,Vt];if(jt)return"major";return Gt?"minor":"none"}function pp(te,ne){return te==="moduleExport"||zn(ne)}function jr(te){return te.bindable===!0||te.binding==="writable"}function Xn(te,ne,Me){let Ot=new Map(te.map((Gt)=>[Me(Gt),Gt])),Mt=new Map(ne.map((Gt)=>[Me(Gt),Gt])),Vt=[...Mt].filter(([Gt])=>!Ot.has(Gt)),Wt=[...Ot.keys()].filter((Gt)=>!Mt.has(Gt)),jt=[];for(let[Gt,Ut]of Ot){let Ht=Mt.get(Gt);if(Ht)jt.push([Gt,Ut,Ht])}return{added:Vt,removed:Wt,common:jt}}function $s(te,ne,Me,Ot){return(Mt,Vt,Wt)=>te.push({component:ne,kind:Me,name:Mt,bump:Vt,message:`${Ot} "${Mt}" ${Wt}`})}function cp(te,ne,Me,Ot){let Mt=[],Vt=$s(Mt,te,ne,ne==="prop"?"prop":"export"),{added:Wt,removed:jt,common:Gt}=Xn(Me,Ot,(Ut)=>Ut.name);for(let[Ut,Ht]of Wt)Vt(Ut,Ht.isRequired?"major":"minor",`added${Ht.isRequired?" (required)":""}`);for(let Ut of jt)Vt(Ut,"major","removed");for(let[Ut,Ht,qt]of Gt){let zt=zn(qt);if(ne==="prop"&&zn(Ht)!==zt){Vt(Ut,"major",zt?"became a read-only accessor":"stopped being a read-only accessor");continue}if(Ht.isRequired!==qt.isRequired)Vt(Ut,qt.isRequired?"major":"minor",`became ${qt.isRequired?"required":"optional"}`);let Xt=pp(ne,Ht)&&pp(ne,qt),Jt=Pn(Ht.type,qt.type,{readOnly:Xt});if(Jt!=="none")Vt(Ut,Jt,`type changed from \`${Ht.type??"unknown"}\` to \`${qt.type??"unknown"}\``);let Qt=jr(qt);if(jr(Ht)!==Qt)Vt(Ut,Qt?"minor":"major",Qt?"gained a writable binding":"lost its writable binding");if(Ht.value!==qt.value&&Jt==="none")Vt(Ut,"patch",`default changed from \`${Ht.value??"none"}\` to \`${qt.value??"none"}\``);let Yt=qt.deprecated!==void 0;if(Ht.deprecated!==void 0!==Yt)Vt(Ut,Yt?"minor":"patch",Yt?"marked as deprecated":"no longer deprecated");if(ne==="moduleExport"&&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 Mt}function lp(te){if(r(te,"|").length>1)return;return qh.exec(te)?.[1]}function td(te,ne){let Me=lp(te),Ot=lp(ne);if(Me===void 0||Ot===void 0)return"major";return Pn(Me,Ot,{readOnly:!0})}function nd(te,ne,Me){let Ot=[],Mt=$s(Ot,te,"event","event"),{added:Vt,removed:Wt,common:jt}=Xn(ne,Me,(Gt)=>Gt.name);for(let[Gt]of Vt)Mt(Gt,"minor","added");for(let Gt of Wt)Mt(Gt,"major","removed");for(let[Gt,Ut,Ht]of jt){if(Ut.type!==Ht.type){Mt(Gt,"major",`changed from ${Ut.type} to ${Ht.type}`);continue}if(Ut.type==="forwarded"&&Ht.type==="forwarded"){let Jt=As(Ut),Qt=As(Ht),Yt=Jt===Qt?"none":td(Jt,Qt);if(Yt!=="none")Mt(Gt,Yt,`type changed from \`${Jt}\` to \`${Qt}\``);continue}let qt=Ut.type==="dispatched"?Ut.detail:void 0,zt=Ht.type==="dispatched"?Ht.detail:void 0,Xt=Pn(qt,zt,{readOnly:!0});if(Xt!=="none")Mt(Gt,Xt,`detail changed from \`${qt??"unknown"}\` to \`${zt??"unknown"}\``)}return Ot}function id(te,ne,Me){let Ot=[],Mt=$s(Ot,te,"slot","slot"),{added:Vt,removed:Wt,common:jt}=Xn(ne,Me,(Gt)=>Gt.name??"default");for(let[Gt]of Vt)Mt(Gt,"minor","added");for(let Gt of Wt)Mt(Gt,"major","removed");for(let[Gt,Ut,Ht]of jt){let qt=Pn(Ut.slot_props,Ht.slot_props,{readOnly:!0});if(qt!=="none")Mt(Gt,qt,`props changed from \`${Ut.slot_props??"none"}\` to \`${Ht.slot_props??"none"}\``)}return Ot}function up(te){return te.type===void 0?"an object of properties":`\`${te.type}\``}function sd(te,ne=[],Me=[]){let Ot=[],{added:Mt,removed:Vt,common:Wt}=Xn(ne,Me,(jt)=>jt.key);for(let[jt]of Mt)Ot.push({component:te,kind:"context",name:jt,bump:"minor",message:`context "${jt}" added`});for(let jt of Vt)Ot.push({component:te,kind:"context",name:jt,bump:"major",message:`context "${jt}" removed`});for(let[jt,Gt,Ut]of Wt){let Ht=(zt,Xt,Jt)=>Ot.push({component:te,kind:"context",name:jt,...Jt===void 0?{}:{property:Jt},bump:zt,message:`context "${jt}" ${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?Pn(Gt.type,Ut.type,{readOnly:!0}):"major";if(zt!=="none")Ht(zt,`type changed from ${up(Gt)} to ${up(Ut)}`)}continue}let qt=Xn(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=Pn(Xt.type,Jt.type,{readOnly:!0});if(Qt!=="none")Ht(Qt,`type changed from \`${Xt.type}\` to \`${Jt.type}\``,zt)}}return Ot}var rd=new Set(["description","source","componentCommentSource","tags"]);function _s(te){if(Array.isArray(te))return te.map(_s);if(i(te)){let ne={};for(let[Me,Ot]of Object.entries(te)){if(rd.has(Me))continue;ne[Me]=_s(Ot)}return ne}return te}var od=["generics","rest_props","extends"];function ad(te,ne,Me){let Ot=[];for(let Mt of od){let Vt=JSON.stringify(_s(ne[Mt])),Wt=JSON.stringify(_s(Me[Mt]));if(Vt===Wt)continue;if(Mt==="rest_props"&&ne.rest_props===void 0){Ot.push({component:te,kind:"shape",name:Mt,bump:"minor",message:`"${Mt}" added`});continue}Ot.push({component:te,kind:"shape",name:Mt,bump:"major",message:`"${Mt}" changed (breaking)`})}return Ot}function Gr(te){return te.name.split("<",1)[0].trim()}function hp(te){return new Set(te?.match(Kh))}function pd(te,ne){let Me=new Map(ne.map((Ht)=>[Ht,{write:!1,read:!1}])),Ot=(Ht,qt)=>{for(let zt of hp(Ht)){let Xt=Me.get(zt);if(!Xt)continue;Xt.write||=qt.write,Xt.read||=qt.read}},Mt={write:!0,read:!0},Vt={write:!0,read:!1},Wt={write:!1,read:!0},jt=(Ht,qt)=>Ot(Ht,Ht?.includes("=>")?Mt:qt);for(let Ht of te){for(let qt of Ht.props)jt(qt.type,jr(qt)?Mt:Vt);for(let qt of Ht.moduleExports)Ot(qt.type,Mt);for(let qt of Ht.events)jt("detail"in qt?qt.detail:void 0,Wt);for(let qt of Ht.slots)jt(qt.slot_props,Wt);for(let qt of Ht.contexts??[]){Ot(qt.type,Mt);for(let zt of qt.properties)Ot(zt.type,Mt)}}let Gt=te.flatMap((Ht)=>Ht.typedefs.map((qt)=>({name:Gr(qt),callback:qt.type.includes("=>"),mentioned:[...hp(qt.type)].filter((zt)=>Me.has(zt))}))),Ut=!0;while(Ut){Ut=!1;for(let{name:Ht,callback:qt,mentioned:zt}of Gt){let Xt=Me.get(Ht);if(!Xt)continue;for(let Jt of zt){let Qt=Me.get(Jt);if(!Qt||Jt===Ht)continue;let Yt=Qt.write||Xt.write||qt&&Xt.read,nn=Qt.read||Xt.read||qt&&Xt.write;if(Yt!==Qt.write||nn!==Qt.read)Qt.write=Yt,Qt.read=nn,Ut=!0}}}for(let Ht of Me.values())if(!Ht.write&&!Ht.read)Object.assign(Ht,Mt);return Me}function cd(te,ne,Me,Ot){let Mt=[],Vt=$s(Mt,te,"typedef","typedef"),{added:Wt,removed:jt,common:Gt}=Xn(ne.typedefs,Me.typedefs,Gr);for(let[Ht]of Wt)Vt(Ht,"minor","added");for(let Ht of jt)Vt(Ht,"major","removed");let Ut=Gt.filter(([,Ht,qt])=>Ht.name!==qt.name||_n(Ht.type)!==_n(qt.type));if(Ut.length===0)return Mt;for(let[Ht,qt,zt]of Ut){if(qt.name!==zt.name){Vt(Ht,"major",`type parameters changed from \`${qt.name}\` to \`${zt.name}\``);continue}let Xt=_n(qt.type),Jt=_n(zt.type),Qt=Ot().get(Ht)??{write:!0,read:!0},Yt="none";if(Qt.write)Yt=Vn(Yt,Pn(Xt,Jt));if(Qt.read)Yt=Vn(Yt,Pn(Xt,Jt,{readOnly:!0}));if(Yt==="none")continue;Vt(Ht,Yt,`type changed from \`${Xt}\` to \`${Jt}\``)}return Mt}function ld(te,ne,Me){let Ot=ne.moduleName;return[...cp(Ot,"prop",te.props,ne.props),...cp(Ot,"moduleExport",te.moduleExports,ne.moduleExports),...nd(Ot,te.events,ne.events),...id(Ot,te.slots,ne.slots),...sd(Ot,te.contexts,ne.contexts),...cd(Ot,te,ne,Me),...ad(Ot,te,ne)]}function Rt(te,ne){let Me=[],{added:Ot,removed:Mt,common:Vt}=Xn(te.components,ne.components,(Ut)=>Ut.moduleName);for(let[Ut]of Ot)Me.push({component:Ut,kind:"component",bump:"minor",message:`component "${Ut}" added`});for(let Ut of Mt)Me.push({component:Ut,kind:"component",bump:"major",message:`component "${Ut}" removed`});let Wt=[...te.components,...ne.components],jt,Gt=()=>(jt??=pd(Wt,[...new Set(Wt.flatMap((Ut)=>Ut.typedefs.map(Gr)))]),jt);for(let[,Ut,Ht]of Vt)Me.push(...ld(Ut,Ht,Gt));return Me}async function ud(te){let ne;try{ne=await Uh(Br.resolve(te),"utf-8")}catch(Me){if(Me.code==="ENOENT")return null;throw Me}try{return JSON.parse(ne)}catch{throw Error(`sveld: could not parse "${te}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function gp(te){if(typeof te.check==="string")return te.check;return te.jsonOptions?.outFile??Vr}function yp(te,ne){if(!te.json||te.stdout||te.jsonOptions?.outDir)return!1;return Br.resolve(te.jsonOptions?.outFile??Vr)===Br.resolve(ne)}async function Re(te,ne,Me={}){let Ot=await ud(ne);if(Ot===null)return{snapshotExists:!1,snapshotFile:ne,changes:[],bump:"none"};if(Ot.schemaVersion!==Es)return{snapshotExists:!0,snapshotFile:ne,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ot.schemaVersion} differs from ${Es}; regenerate the snapshot`}],bump:"none"};let Mt=y(te,{entryExports:Me.entryExports}),Vt=Rt(Ot,Mt);return{snapshotExists:!0,snapshotFile:ne,changes:Vt,bump:Xh(Vt)}}var hd={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ye(te){if(!te.snapshotExists){let Mt=te.snapshotFile===Vr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${te.snapshotFile}"\``;return`sveld --check: no snapshot found at "${te.snapshotFile}". Generate it with ${Mt} and commit it.`}if(te.changes.length===0)return`sveld --check: no API changes detected against "${te.snapshotFile}".`;let ne=te.changes.length,Me=[`sveld --check: ${ne} API change${ne===1?"":"s"} detected against "${te.snapshotFile}".`,`Suggested semver bump: ${te.bump}.`],Ot=new Map;for(let Mt of te.changes){let Vt=Ot.get(Mt.component)??[];Vt.push(Mt),Ot.set(Mt.component,Vt)}for(let[Mt,Vt]of Ot){Me.push("",` ${Mt}`);for(let Wt of Vt){let jt=Wt.kind==="schema"?"schema":hd[Wt.bump];Me.push(` [${jt}] ${Wt.message}`)}}return Me.join(`
|
|
139
|
-
`)}var It=1;function xe(te){let ne={kind:"check-report",schemaVersion:It,...te};return Fi(ne)}import{existsSync as Ep}from"node:fs";import{join as dd,resolve as fd}from"node:path";import{pathToFileURL as md}from"node:url";var gd=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Ft(te){return te}function yd(te=process.cwd()){for(let ne of gd){let Me=dd(te,ne);if(Ep(Me))return Me}return null}async function Sp(te){let ne;try{ne=await import(`${md(te).href}?t=${Date.now()}`)}catch(Ot){let Mt=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: failed to load config file "${te}".
|
|
140
|
-
${Mt}`,{cause:Ot})}let Me=ne.default;if(!i(Me)||Array.isArray(Me))throw Error(`sveld: config file "${te}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Me}async function xd(te=process.cwd()){let ne=yd(te);return ne===null?{}:Sp(ne)}async function q(te,ne,Me){if(typeof te==="string"){let Ot=fd(ne,te);if(!Ep(Ot))throw Error(`sveld: config file "${te}" does not exist.`);return Sp(Ot)}return te??Me?xd(ne):{}}function O(...te){let ne={};for(let Me of te){if(!Me)continue;for(let[Ot,Mt]of Object.entries(Me)){let Vt=ne[Ot];ne[Ot]=i(Vt)&&!Array.isArray(Vt)&&i(Mt)&&!Array.isArray(Mt)?{...Vt,...Mt}:Mt}}return ne}var xp=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],vd={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function vp(te,ne,Me){let Ot=te===null?ne:`${te}.${ne}`,Mt=L(ne,Me),Vt=Mt===void 0?void 0:te===null?Mt:`${te}.${Mt}`;console.warn(`sveld: unknown option "${Ot}".${Vt?` Did you mean "${Vt}"?`:""}`)}function G(te){for(let ne of Object.keys(te))if(!xp.includes(ne))vp(null,ne,xp);for(let[ne,Me]of Object.entries(vd)){let Ot=te[ne];if(!i(Ot))continue;for(let Mt of Object.keys(Ot))if(!Me.includes(Mt))vp(ne,Mt,Me)}}import{dirname as Vc}from"node:path";import{lstatSync as om}from"node:fs";import{readFile as am}from"node:fs/promises";import{resolve as hc}from"node:path";import{dirname as Ed}from"node:path";var Sd=[...Ei,".svelte"];function bd(te){let ne=te.trim();if(ne.length<2)return;let Me=ne[0],Ot=ne[ne.length-1];if((Me==='"'||Me==="'"||Me==="`")&&Me===Ot)return ne.slice(1,-1);return}function bp(te){let ne=[],Me=te.moduleExports.filter((Mt)=>Mt.kind==="re-export");if(Me.length===0)return ne;let Ot=new Set([Ci(te.moduleName),Wi(te.moduleName)]);for(let Mt of Me){if(!Ot.has(Mt.name))continue;ne.push(a({component:te.filePath,kind:"module-export-conflict",name:Mt.name,message:`Re-export "${Mt.name}" has the same name as the generated "${Mt.name}" type; the .d.ts won't type-check if "${Mt.reExport?.from}" exports a type by that name.`,source:Mt.source}))}return ne}function Cp(te,ne,Me){let Ot=new Map(Array.from(te.values()).map((Mt)=>[ne(Mt.filePath),Mt]));return(Mt)=>{let Vt=Mt.extends;if(!Vt)return[];let Wt=bd(Vt.import);if(Wt===void 0||!Wt.startsWith(".")&&!Wt.startsWith("/"))return[];let jt=ne(Mt.filePath),Gt=Me.resolve(Wt,Ed(jt),Sd);if(Gt===null)return[a({component:Mt.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=Ci(Ut.moduleName);if(Or(Vt.interface)!==Ht)return[a({component:Mt.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 Mt.props){let Xt=Ut.props.find((Jt)=>Jt.name===zt.name);if(Xt&&Xt.type!==zt.type){let Jt=a({component:Mt.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=wo(Mt)?.[zt.name]?.some((nn)=>nn===""||nn===Jt.code);qt.push(Yt?{...Jt,ignored:!0}:Jt)}}return qt}}import{lstatSync as Wd,readFileSync as Ud,realpathSync as Hd,statSync as Kd}from"node:fs";import{dirname as qd,isAbsolute as zd,join as jp,parse as Xd,relative as Zr,resolve as Hi}from"node:path";function ee(te){return te}function Rn(te){if(te==="")return te;return te==="."||te===".."||te.startsWith("./")||te.startsWith("../")?te:`./${te}`}import{readFileSync as Fp}from"node:fs";import{dirname as Yr,join as Vd,relative as Lp,resolve as Mp}from"node:path";import{readFileSync as Dd,statSync as Rd}from"node:fs";import{basename as Xr,dirname as Ns,isAbsolute as Id,join as Od,resolve as Ld}from"node:path";import{existsSync as kp,readdirSync as Cd}from"node:fs";import{dirname as Tp,join as Ap,resolve as Td}from"node:path";function W(te,ne){for(let Me=Td(te);;Me=Tp(Me)){for(let Ot of ne){let Mt=Ap(Me,Ot);if(kp(Mt))return Mt}if(Tp(Me)===Me)return null}}function wp(te){return te.normalize("NFC").toLowerCase()}class Wr{listings=new Map;clear(){this.listings.clear()}entries(te){return this.read(te)?.entries??null}entry(te,ne){let Me=this.read(te);if(Me===null)return;if(Me.byName===void 0){Me.byName=new Map;for(let Ot of Me.entries)Me.byName.set(Ot.name,Ot)}return Me.byName.get(ne)}has(te,ne){let Me=this.read(te);if(Me===null)return!1;if(Me.names.has(ne))return!0;if(Me.folded===void 0){Me.folded=new Map;for(let Mt of Me.names)Me.folded.set(wp(Mt),Mt)}let Ot=Me.folded.get(wp(ne));return Ot!==void 0&&Ot!==ne&&kp(Ap(te,ne))}read(te){let ne=this.listings.get(te);if(ne!==void 0)return ne;try{let Me=Cd(te,{withFileTypes:!0}),Ot=new Set;for(let Mt of Me)Ot.add(Mt.name);ne={entries:Me,names:Ot}}catch{ne=null}return this.listings.set(te,ne),ne}}var Ur=!1;function H(te){Ur=te}function Gn(te){if(!Ur)console.error(te)}function Pp(te){if(!Ur)console.error(te)}function Ee(te){if(te instanceof e)return te.start?`${te.reason} (${te.start.line}:${te.start.column})`:te.reason;return te instanceof Error?te.message:String(te)}var Ui=null,Hr=null;function Jn(){if(Ui)return Promise.resolve(Ui);if(!Hr)Hr=import("./chunk-yp51zj9v.js").then((te)=>(Ui=te,te));return Hr}function In(){if(!Ui)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Ui}import{existsSync as Kr,readFileSync as wd}from"node:fs";import{dirname as Rp,isAbsolute as Ip,relative as kd,resolve as qr}from"node:path";function _p(te){if(!i(te))return{};let ne={};if(typeof te.svelte==="string")ne.svelte=te.svelte;if(typeof te.name==="string")ne.name=te.name;if(typeof te.description==="string")ne.description=te.description;return ne}function $p(te){if(!i(te))return{};let ne={};if(typeof te.extends==="string")ne.extends=te.extends;if(i(te.compilerOptions)){let Me={};if(typeof te.compilerOptions.baseUrl==="string")Me.baseUrl=te.compilerOptions.baseUrl;if(i(te.compilerOptions.paths)){let Ot={};for(let[Mt,Vt]of Object.entries(te.compilerOptions.paths))if(Array.isArray(Vt)&&Vt.every((Wt)=>typeof Wt==="string"))Ot[Mt]=Vt;if(Object.keys(Ot).length>0)Me.paths=Ot}if(Object.keys(Me).length>0)ne.compilerOptions=Me}return ne}var Ad=["tsconfig.json","jsconfig.json"],Np=new Map,Pd=/\/\*[\s\S]*?\*\/|\/\/.*/g,_d=[".svelte",...Ei];class U extends Error{specifier;fromFile;searched;constructor(te,ne,Me){super(`cannot resolve "${te}" from ${ne||"."} (${Me})`);this.name="UnresolvedModuleError",this.specifier=te,this.fromFile=ne,this.searched=Me}}function $d(te){if(Kr(te))return!0;return _d.some((ne)=>Kr(te+ne))}function Dp(te){let ne=te.indexOf("*");return ne===-1?te.length:ne}function Op(te,ne){if(ne.has(te))return ne.get(te)??null;try{let Me=wd(te,"utf-8"),Ot;try{Ot=JSON.parse(Me)}catch{let Vt=Me.replace(Pd,"");Ot=JSON.parse(Vt)}let Mt=$p(Ot);if(Mt.extends){let Vt=Ip(Mt.extends)?Mt.extends:qr(Rp(te),Mt.extends),Wt=Vt.endsWith(".json")?Vt:`${Vt}.json`;if(Kr(Wt)){let jt=Op(Wt,ne);if(jt)Mt.compilerOptions={...jt.compilerOptions,...Mt.compilerOptions,paths:{...jt.compilerOptions?.paths,...Mt.compilerOptions?.paths}}}}return ne.set(te,Mt),Mt}catch{return ne.set(te,null),null}}function Nd(te){let ne=Np.get(te);if(!ne){let Me=te.split("*").map(R).join("(.*)");ne=new RegExp(`^${Me}$`),Np.set(te,ne)}return ne}class zr{configs=new Map;lookup(te,ne){if(te.startsWith(".")||Ip(te))return{resolved:te,unresolved:!1,searched:""};let Me=W(ne,Ad),Ot=Me?Op(Me,this.configs)?.compilerOptions:void 0,Mt=Ot?.paths;if(!Me||!Ot||!Mt)return{resolved:te,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Vt=qr(Rp(Me),Ot.baseUrl??"."),Wt=Object.entries(Mt).sort(([jt],[Gt])=>Dp(Gt)-Dp(jt));for(let[jt,Gt]of Wt){let Ut=te.match(Nd(jt));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=qr(Vt,zt);if(Ht??=Xt,$d(Xt))return{resolved:Xt,unresolved:!1,searched:Me}}return{resolved:Ht??te,unresolved:!1,searched:Me}}return{resolved:te,unresolved:!0,searched:`tsconfig paths (${Me})`}}absolute(te,ne){return this.lookup(te,ne).resolved}relative(te,ne){let Me=this.absolute(te,ne);if(Me===te)return te;return Rn(n(kd(ne,Me)))}}var Md=/\.[mc]?jsx?$/,Fd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function Bd(te){return te==="."||te===".."||te.startsWith("./")||te.startsWith("../")||Id(te)}class Yn{aliases=new zr;listings=new Wr;modules=new Map;programs=new Map;listDirectory(te){return this.listings.entries(te)}exists(te){return this.listings.has(Ns(te),Xr(te))}resolve(te,ne,Me=Ei){let Ot=this.aliases.absolute(te,ne);if(Ot===te&&!Bd(te))return null;let Mt=Ld(ne,Ot),Vt=Ns(Mt),Wt=Xr(Mt),jt=this.listings.has(Vt,Wt),Gt;if(jt){let Ut=this.listings.entry(Vt,Wt);if(Gt=Ut&&!Ut.isSymbolicLink()?Ut:Rd(Mt,{throwIfNoEntry:!1}),Gt?.isFile())return Mt}for(let Ut of Me)if(this.listings.has(Vt,Wt+Ut))return Mt+Ut;if(!jt)return this.typeScriptCounterpart(Mt)??null;if(Gt?.isDirectory()){for(let Ut of Me)if(this.listings.has(Mt,`index${Ut}`))return Od(Mt,`index${Ut}`)}return null}parse(te){let ne=this.modules.get(te);if(ne===void 0)ne=jd(te),this.modules.set(te,ne);return ne}parseJavaScript(te,ne){let Me=this.programs.get(te);if(Me?.source===ne)return Me.ast;let Ot;try{Ot=I(ne)}catch(Mt){throw Error(Ee(Mt),{cause:Mt})}return this.programs.set(te,{source:ne,ast:Ot}),Ot}invalidate(...te){this.listings.clear();for(let ne of te)this.modules.delete(ne),this.programs.delete(ne)}typeScriptCounterpart(te){let ne=Md.exec(te)?.[0];if(ne===void 0)return;let Me=te.slice(0,-ne.length),Ot=Ns(Me),Mt=Xr(Me);for(let Vt of Fd[ne]??[])if(this.listings.has(Ot,Mt+Vt))return Me+Vt;return}}function jd(te){let ne;try{ne=Dd(te,"utf-8")}catch{return null}try{let Me=te.endsWith(".svelte")?In().parseSvelteScripts(ne).module?.content.body??[]:In().parseModule(ne,{typescript:!0}).body;return{source:{text:ne,filePath:te,dir:Ns(te)},body:Me}}catch(Me){return Pp(`Warning: sveld couldn't parse ${te} to read its exports (${Ee(Me)}); skipping it.`),null}}function Jr(te){return te.type==="Identifier"?te.name:te.value}function Gd(te,ne,Me,Ot){let Mt=te.resolve(ne,Me);if(!Mt)return null;let Vt=Yr(Mt);if(Ot.has(Mt))return{dir:Vt,exports:{}};Ot.add(Mt);try{return{dir:Vt,exports:Qr(te,Fp(Mt,"utf-8"),Vt,Ot,Mt)}}catch{return{dir:Vt,exports:{}}}finally{Ot.delete(Mt)}}function Bp(te,ne,Me=new Yn,Ot=new Set,Mt=ne){return Qr(Me,te,ne,Ot,Mt)}function Qr(te,ne,Me,Ot,Mt){let Vt=te.parseJavaScript(Mt,ne),Wt={};for(let jt of Vt.body)if(jt.type==="ExportDefaultDeclaration"){if(jt.declaration.type!=="Identifier")continue;let Gt=jt.declaration.name;if(Gt in Wt)Wt[Gt].default=!0;else Wt[Gt]={source:Rn(""),default:!0}}else if(jt.type==="ExportAllDeclaration"){let Gt=jt.source.value,Ut=te.resolve(Gt,Me);if(!Ut){let Xt=te.aliases.lookup(Gt,Me);throw new U(Gt,Mt,Xt.unresolved?Xt.searched:"no matching file or index found")}if(Ot.has(Ut))continue;Ot.add(Ut);let Ht=Fp(Ut,"utf-8"),qt=Qr(te,Ht,Yr(Ut),Ot,Ut);Ot.delete(Ut);let zt=Object.entries(qt);if(zt.length===0&&!Nn.test(Gt)){let Xt=Rn(n(Gt));Wt[`*:${Gt}`]={source:Xt,default:!1,star:!0}}for(let[Xt,Jt]of zt){let Qt=Rn(n(Jt.source.startsWith(".")?`./${Lp(Me,Mp(Yr(Ut),Jt.source))}`:`./${Vd(Gt,Jt.source)}`));Wt[Xt]={...Jt,source:Qt}}}else if(jt.type==="ExportNamedDeclaration"){let Gt=jt.source?.value,Ut=Gt!==void 0&&Nn.test(Gt);if(Ut){let zt=te.aliases.lookup(Gt,Me);if(zt.unresolved)throw new U(Gt,Mt,zt.searched)}let qt=Gt!==void 0&&!Ut?Gd(te,Gt,Me,Ot):void 0;if(qt===null){console.warn(`sveld: could not resolve re-exported module "${Gt}" from barrel "${Me||"."}"; skipping.`);continue}for(let zt of jt.specifiers){let Xt=Jr(zt.exported),Jt=Jr(zt.local),Qt=Xt||Jt,Yt=qt?.exports[Jt],nn=Yt?Rn(n(`./${Lp(Me,Mp(qt.dir,Yt.source))}`)):Rn(te.aliases.relative(Gt??"",Me)),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(jt.type==="ImportDeclaration"){let Gt=jt.specifiers[0];if(!Gt)continue;let Ut=Gt.local.name,Ht=Rn(te.aliases.relative(jt.source.value,Me)),qt=Gt.type==="ImportSpecifier"?Jr(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 Jd=/-/g,Yd=/[^A-Za-z0-9_$]/g,Qd=/^[0-9]/;function Zd(te,ne){let Me=te.replace(Yd,""),Ot=Qd.test(Me)?`_${Me}`:Me;if(Ot!==te&&!ne?.has(te))ne?.add(te),console.warn(`Warning: "${te}" is not a valid identifier; using "${Ot}" instead.`);return Ot}function Vp(te,ne){return Zd(Xd(te).name.replace(Jd,""),ne)}function Gp(te,ne,Me=[],Ot=new Set,Mt){let Vt;try{Vt=Mt??Hd(ne)}catch{return Me}if(Ot.has(Vt))return Me;Ot.add(Vt);let Wt=te.listDirectory(ne);if(Wt===null)return Me;for(let jt of Wt){if(jt.name.startsWith("."))continue;let Gt=jp(ne,jt.name),Ut=jt.isSymbolicLink(),Ht=Ut?Kd(Gt,{throwIfNoEntry:!1}):jt;if(!Ht)continue;if(Ht.isDirectory())Gp(te,Gt,Me,Ot,Ut?void 0:jp(Vt,jt.name));else if(Ht.isFile()&&jt.name.endsWith(".svelte"))Me.push(Gt)}return Me}function ef(te,ne){return Gp(te,ne).map((Me)=>({moduleName:Vp(Me),source:Rn(n(`./${Zr(ne,Me)}`))})).sort((Me,Ot)=>u(Me.source,Ot.source))}function tf(te){return!Si(te)}function nf(te,ne){let Me=te.endsWith("/")?te:`${te}/`;return ne.startsWith(Me)}function Ds(te,ne){return{seenPaths:new Set(te.map(([,Me])=>ne(Me.source))),seenModuleNamePaths:new Map(te.map(([Me,Ot])=>[Me,ne(Ot.source)])),warnedModuleNames:new Set}}function eo(te,ne,Me,Ot,Mt,Vt){for(let{moduleName:Wt,source:jt}of ef(te,ne)){let Gt=Mt(jt),Ut=Me[Wt];if(Ut&&tf(Ut.source)&&nf(Ut.source,jt)){Vt.seenPaths.delete(Mt(Ut.source)),Ut.source=jt,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(ne,Ht))} and ${n(Zr(ne,Gt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Wt,{source:jt,default:!1}])}}function to(te,ne,Me,Ot){let Mt=Wd(te).isFile(),Vt=Mt?qd(te):te,Wt=Hi(Vt),jt=new Map,Gt=(qt)=>{let zt=jt.get(qt);if(zt===void 0)zt=zd(qt)?Hi(qt):Hi(Wt,qt),jt.set(qt,zt);return zt},Ut={};if(Mt){let qt=Ud(te,"utf-8");try{Ut=Bp(qt,Wt,Ot,new Set([Hi(te)]),Hi(te))}catch(zt){if(!Me)throw zt;let Xt=zt instanceof Error?zt.message:String(zt);console.warn(`Warning: Failed to parse component exports from ${te}: ${Xt}`)}}let Ht=Object.entries(Ut);if(ne){let qt=Ds(Ht,Gt);if(eo(Ot,Wt,Ut,Ht,Gt,qt),!Mt)Ut=Object.fromEntries(Ht.map(([zt,Xt])=>[zt,{...Xt,default:!0}]))}return{exports:Ut,allComponentEntries:Ht,rootDir:Wt,resolveComponentFilePath:Gt}}function Wp(te,ne,Me,Ot){if(Me!==1||te!=="default")return te;return Vp(ne,Ot)}import{dirname as Ff}from"node:path";import{resolve as sf}from"node:path";var rf=/\r?\n/,of=/^\s*\*+/;function Rs(te){return{graph:te,cache:new Map,computing:new Set}}function xn(te){return te?.type==="Identifier"?te.name:void 0}function af(te){let ne=te.trimEnd();for(;;){let Me=ne.lastIndexOf(`
|
|
141
|
-
`)+1;if(ne.slice(Me).trimStart().startsWith("//")){ne=ne.slice(0,Me).trimEnd();continue}let Ot=ne.endsWith("*/")?ne.lastIndexOf("/*",ne.length-3):-1;if(Ot!==-1&&ne[Ot+2]!=="*"){ne=ne.slice(0,Ot).trimEnd();continue}return ne}}function pf(te,ne){let Me=af(te.slice(0,ne));if(!Me.endsWith("*/"))return;let Ot=Me.length-2,Mt=Me.lastIndexOf("/**",Ot);if(Mt===-1)return;return Me.slice(Mt,Ot+2)}function cf(te){let ne=[];for(let Me of te.slice(3,-2).split(rf)){let Ot=Me.replace(of,"").trim();if(Ot.startsWith("@"))break;if(Ot)ne.push(Ot)}return ne.join(" ")||void 0}function pi(te,ne){if(!ne)return;return te.text.slice(ne.start,ne.end)}function lf(te,ne){return"typeAnnotation"in ne?pi(te,ne.typeAnnotation?.typeAnnotation):void 0}function Hp(te,ne){return pi(te,ne.returnType?.typeAnnotation)}function no(te,ne,Me){return`(${ne.params.map((Mt)=>pi(te,Mt)??"").join(", ")}) => ${Hp(te,ne)??Me??"any"}`}function Kp(te){if(te.type==="Literal"){let ne=te.value;if(typeof ne==="string")return"string";if(typeof ne==="number")return"number";if(typeof ne==="boolean")return"boolean"}if(te.type==="TemplateLiteral")return"string";if(te.type==="UnaryExpression"&&(te.operator==="-"||te.operator==="+"))return te.argument.type==="Literal"&&typeof te.argument.value==="number"?"number":void 0;if(te.type==="CallExpression"&&te.callee.type==="Identifier")return uf[te.callee.name];return}var uf={String:"string",Number:"number",Boolean:"boolean"};function qp(te){if(te.type==="Literal"){let ne=te.value;return typeof ne==="string"||typeof ne==="number"||typeof ne==="boolean"?ne:void 0}if(te.type==="UnaryExpression"&&te.operator==="-"){let ne=te.argument;return ne.type==="Literal"&&typeof ne.value==="number"?-ne.value:void 0}return te.type==="TemplateLiteral"?A(te)??void 0:void 0}function hf(te,ne){let Me=pi(te,ne),Ot=qp(ne);if(Me===void 0||Ot===void 0)return;return{raw:Me,value:Ot,type:typeof Ot}}function df(te,ne){if(te.type!=="CallExpression"&&te.type!=="NewExpression")return;let Me=te.callee;if(!(xn(Me)==="Symbol"||Me.type==="MemberExpression"&&!Me.computed&&xn(Me.object)==="Symbol"&&xn(Me.property)==="for"))return;let[Mt]=te.arguments;return(Mt?.type==="Literal"&&typeof Mt.value!=="string"?null:A(Mt))||ne}var ff=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),mf=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,gf=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function yf(te,ne){let Me=ne?In().extractJsDocType(ne):void 0,Ot=te?{type:te,source:"typescript"}:Me?{type:Me,source:"jsdoc"}:void 0;if(!Ot||Ot.type.includes("`"))return;return(Ot.type.replace(mf,'""').match(gf)??[]).every((Vt)=>ff.has(Vt))?Ot:void 0}function zp(te){if(te.async||te.generator||te.type==="TSDeclareFunction")return;let ne=te.body,Me=ne.type==="BlockStatement"?Z(ne):[ne];if(Me.length===0)return;let Ot;for(let Mt of Me){if(!Mt)return;let Vt=Kp(Mt);if(!Vt)return;if(Ot===void 0)Ot=Vt;else if(Ot!==Vt)return}return Ot}function xf(te){if(te.type==="TemplateLiteral")return;let ne=qp(te);return typeof ne==="boolean"?void 0:ne}function vf(te){let ne=te.members;if(ne.length===0)return;let Me=[],Ot=0;for(let Mt of ne){if(!Mt.initializer){Me.push(String(Ot)),Ot+=1;continue}let Vt=xf(Mt.initializer);if(Vt===void 0)return;Me.push(typeof Vt==="string"?JSON.stringify(Vt):String(Vt)),Ot=typeof Vt==="number"?Vt+1:Ot}return Me.join(" | ")}function io(te,ne,Me,Ot){let Mt=pf(te.text,Me),Vt=Mt?cf(Mt):void 0,Wt=Mt?In().extractJsDocReturnType(Mt):void 0,{deprecated:jt,tags:Gt,internal:Ut}=Mt?In().extractJsDocDeprecatedAndTags(Mt):{deprecated:void 0,tags:void 0,internal:!1},Ht={description:Vt,deprecated:jt,tags:Gt,...Ut?{internal:!0}:{},declFile:te.filePath},qt=(Xt,Jt,Qt=!1)=>Xt?[{name:Xt,...Jt,...Ht,isTypeOnly:Qt}]:[],zt=(Xt,Jt)=>Hp(te,Xt)??Wt??ie(Jt)??zp(Xt);if(ne.type==="VariableDeclaration"){let Xt=ne.kind==="let"||ne.kind==="var"?ne.kind:"const";return ne.declarations.flatMap((Jt)=>{let Qt=Jt.id,Yt=xn(Qt);if(!Yt)return[];let nn=lf(te,Qt),sn=nn,cn,un,hn,Fn,ei,ti,gn=Jt.init;if(gn)if(gn.type==="ArrowFunctionExpression"||gn.type==="FunctionExpression"){if(ti=gn,un=zt(gn,sn),!sn)sn=no(te,gn,un)}else{if(cn=pi(te,gn),!sn)sn=Kp(gn);let Wn=P(gn);if(hn=A(Wn)??df(Wn,Yt),Xt==="const")Fn=hf(te,Wn),ei=yf(nn,Mt)}return qt(Yt,{kind:Xt,type:sn,value:cn,returnType:un,literalValue:hn,primitiveLiteral:Fn,declaredType:ei,functionNode:ti})})}if(ne.type==="FunctionDeclaration"||ne.type==="TSDeclareFunction"){let Xt=zt(ne);return qt(xn(ne.id)??Ot,{kind:"function",type:no(te,ne,Xt),returnType:Xt,...ne.type==="FunctionDeclaration"?{functionNode:ne}:{}})}if(ne.type==="ClassDeclaration"){let Xt=xn(ne.id);return qt(Xt??Ot,{kind:"class",...Xt?{type:Xt}:{}})}if(ne.type==="TSTypeAliasDeclaration")return qt(xn(ne.id),{kind:"type",type:pi(te,ne.typeAnnotation)},!0);if(ne.type==="TSInterfaceDeclaration")return qt(xn(ne.id),{kind:"interface",type:pi(te,ne.body)},!0);if(ne.type==="TSEnumDeclaration"){let Xt=xn(ne.id);return qt(Xt,{kind:"enum",type:vf(ne)??Xt})}return[]}function Ef(te,ne,Me){let Ot=ne.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Wt]=io(te,Ot,ne.start,"default");return Wt?{...Wt,name:"default"}:void 0}if(Ot.type==="FunctionExpression"||Ot.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:no(te,Ot,zp(Ot)),functionNode:Ot,declFile:te.filePath,isTypeOnly:!1};let Mt=xn(Ot),Vt=Mt?Me(Mt):null;return Vt?{...Vt,name:"default"}:void 0}function Sf(te,ne){for(let Me of te){if(Me.type!=="ImportDeclaration")continue;let Ot=Me.source.value;for(let Mt of Me.specifiers){if(Mt.local.name!==ne)continue;let Vt=Me.importKind==="type"||Mt.type==="ImportSpecifier"&&Mt.importKind==="type";if(Mt.type==="ImportDefaultSpecifier")return{specifier:Ot,importedName:"default",isTypeOnly:Vt};if(Mt.type==="ImportNamespaceSpecifier")return{specifier:Ot,importedName:"*",isTypeOnly:Vt};if(Mt.type==="ImportSpecifier"){let Wt=xn(Mt.imported)??ne;return{specifier:Ot,importedName:Wt,isTypeOnly:Vt}}}}return null}function Up(te,ne,Me){return{name:te,kind:"const",declFile:ne,namespaceFile:ne,isTypeOnly:Me}}function Is(te,ne){let Me=ne.cache.get(te);if(Me)return Me;if(ne.computing.has(te))return[];ne.computing.add(te);let Ot=ne.graph.parse(te);if(!Ot)return ne.computing.delete(te),ne.cache.set(te,[]),[];let{source:Mt,body:Vt}=Ot,Wt=[],jt=new Map;for(let zt of Vt){let Xt=zt.type==="ExportNamedDeclaration"?zt.declaration:zt;if(!Xt)continue;for(let Jt of io(Mt,Xt,Xt.start))jt.set(Jt.name,Jt)}let Gt=(zt,Xt)=>({name:zt,kind:"const",declFile:sf(Mt.dir,Xt),isTypeOnly:!1}),Ut=(zt)=>{let Xt=jt.get(zt);if(Xt)return Xt;let Jt=Sf(Vt,zt);if(!Jt)return null;if(Jt.specifier.endsWith(".svelte"))return Gt(zt,Jt.specifier);let Qt=ne.graph.resolve(Jt.specifier,Mt.dir);if(!Qt)return null;if(Jt.importedName==="*")return Up(zt,Qt,Jt.isTypeOnly);return ci(Qt,Jt.importedName,ne)??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=ne.graph.resolve(Yt,Mt.dir);if(!nn)continue;let sn=zt.exportKind==="type",cn=xn(zt.exported);if(cn){Wt.push(Up(cn,nn,sn));continue}for(let un of Is(nn,ne)){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=Ef(Mt,zt,Ut);if(Yt)Wt.push(Yt);continue}if(zt.type!=="ExportNamedDeclaration")continue;let Xt=zt.declaration;if(Xt){Wt.push(...io(Mt,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=ne.graph.resolve(Jt,Mt.dir);if(hn)un=ci(hn,sn,ne)??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:te,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 ne.onAmbiguousStarExport?.(te,zt,Xt)}return ne.computing.delete(te),ne.cache.set(te,Wt),Wt}function ci(te,ne,Me){return Is(te,Me).findLast((Ot)=>Ot.name===ne)}function Ti(te,{importedName:ne,members:Me=[]},Ot){let Mt=ci(te,ne,Ot);for(let Vt of Me){if(Mt?.namespaceFile===void 0)return;Mt=ci(Mt.namespaceFile,Vt,Ot)}return Mt}function Qn(te,ne,Me){if(te[ne]===void 0)delete te[ne];te[ne]=Me}function Os(te,ne){return(ne.location==="props"?te.props:te.moduleExports).find((Ot)=>Ot.name===ne.propName)}function Ls(te,ne){if(ne.location!=="props")return;te.diagnostics=(te.diagnostics??[]).filter((Me)=>!(Me.kind==="prop-unknown-type"&&Me.name===ne.propName))}var bf=/\.[^./\\]+$/;function Cf(te,ne){if(te.endsWith(".d.ts"))return null;let Me=te.replace(bf,".d.ts");return ne.exists(Me)?Me:null}function Tf(te,ne,Me){return ne.map((Ot)=>{if(!Ot.importSource||!Ot.importedName)return{candidate:Ot};let Mt=Me.graph.resolve(Ot.importSource,te);if(!Mt)return{candidate:Ot,failureReason:"module-not-found"};let Vt=ci(Mt,Ot.importedName,Me);if(!Vt)return{candidate:Ot,failureReason:"export-not-found"};if(Vt.returnType)return{candidate:Ot,type:Vt.returnType};let Wt=Cf(Mt,Me.graph);if(Wt){let jt=ci(Wt,Ot.importedName,Me);if(jt?.returnType)return{candidate:Ot,type:jt.returnType}}return{candidate:Ot,failureReason:"return-type-unresolved"}})}function wf(te,ne){switch(ne){case"module-not-found":return`Prop "${te.propName}" default calls "${te.calleeName}()", but "${te.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${te.propName}" default calls "${te.calleeName}()", but "${te.importedName}" is not exported from "${te.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${te.propName}" default calls "${te.calleeName}()" imported from "${te.importSource}", but its return type could not be resolved; falling back to "any".`}}function kf(te,ne){for(let{candidate:Me,type:Ot,failureReason:Mt}of ne){let Vt=Os(te,Me);if(Vt?.typeSource!=="unknown")continue;if(Ot){Qn(Vt,"type",Ot),Qn(Vt,"typeSource","typescript"),Ls(te,Me);continue}if(Me.location==="props"&&Mt){let Wt=te.diagnostics?.find((jt)=>jt.kind==="prop-unknown-type"&&jt.name===Me.propName);if(Wt)Wt.message=wf(Me,Mt)}}}var Xp={collect:(te)=>te.pendingCallDefaultCandidates?.filter((ne)=>ne.importSource!==void 0)??[],resolve:Tf,apply:kf};function Af(te,ne,Me){return ne.map((Ot)=>{let Mt=Me.graph.resolve(Ot.importSource,te);if(!Mt)return{candidate:Ot};let Vt=Ti(Mt,Ot,Me);if(!Vt?.primitiveLiteral)return{candidate:Ot};return{candidate:Ot,literal:Vt.primitiveLiteral,declaredType:Vt.declaredType}})}function Pf(te,ne){for(let{candidate:Me,literal:Ot,declaredType:Mt}of ne){if(!Ot)continue;let Vt=Os(te,Me);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",Mt?.type??Ot.type),Qn(Vt,"typeSource",Mt?.source??"default"),Ls(te,Me)}}var Jp={collect:(te)=>te.pendingConstDefaultCandidates??[],resolve:Af,apply:Pf};function _f(te,ne,Me){return ne.map((Ot)=>{let Mt=Me.graph.resolve(Ot.importSource,te);if(!Mt)return{candidate:Ot};let Vt=Ti(Mt,Ot,Me);if(Vt?.kind!=="const"||Vt.literalValue===void 0)return{candidate:Ot};return{candidate:Ot,key:Vt.literalValue}})}function $f(te,ne){for(let{candidate:Me,key:Ot}of ne){if(!Ot){let jt=ae(Me);gi(te,[a({component:te.filePath,kind:"context-key-unresolved",name:jt,message:`setContext key \`${jt}\` from "${Me.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Me.source?{source:Me.source}:{}})]);continue}let Mt=[...te.contexts??[]],Vt=Mt.findIndex((jt)=>jt.key===Ot);if(Vt!==-1){let jt=Mt[Vt],Gt=Yp(jt.source,Me.source),Ut=Gt?jt.source:Me.source;if(gi(te,[a({component:te.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;Mt.splice(Vt,1)}let Wt=Mt.findIndex((jt)=>Yp(jt.source,Me.source));Mt.splice(Wt===-1?Mt.length:Wt,0,{key:Ot,typeName:X(Ot),...Me.type===void 0?{}:{type:Me.type},description:Me.description,properties:Me.properties,...Me.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Me.internal?{internal:!0}:{},source:Me.source}),te.contexts=Mt}}function Yp(te,ne){if(!te||!ne)return!1;let{line:Me,column:Ot}=te.start;return Me>ne.start.line||Me===ne.start.line&&Ot>ne.start.column}var Qp={collect:(te)=>te.pendingContextKeyCandidates??[],resolve:_f,apply:$f};function Nf(te,ne,Me){return ne.map((Ot)=>{let Mt=Me.graph.resolve(Ot.importSource,te);if(!Mt)return{candidate:Ot,failureReason:"module-not-found"};let Vt=Ti(Mt,Ot,Me)?.functionNode;if(!Vt)return{candidate:Ot,failureReason:"not-a-function"};let Wt=Df(Vt,Ot);if(!Wt)return{candidate:Ot,failureReason:"parameter-not-found"};return Of(Vt,Wt,Ot)})}function Zp(te){return te?.type==="AssignmentPattern"?te.left:te}function Df(te,ne){let Me=Zp(te.params[ne.argumentIndex]);if(ne.property===void 0)return Me?.type==="Identifier"?{name:Me.name}:void 0;if(!ne.property)return;if(Me?.type==="Identifier")return{object:Me.name,property:ne.property};if(Me?.type!=="ObjectPattern")return;for(let Ot of Me.properties){if(Ot.type!=="Property"||Ot.computed)continue;if(Ot.key.type!=="Identifier"||Ot.key.name!==ne.property)continue;let Mt=Zp(Ot.value);return Mt?.type==="Identifier"?{name:Mt.name}:void 0}return}function so(te){if(!te)return null;if(te.type==="ConditionalExpression"){let Me=so(te.consequent),Ot=so(te.alternate);return Me&&Ot?[...Me,...Ot]:null}let ne=A(te);return ne?[ne]:null}var Rf={variableType:()=>{return}};function If(te){if(!te)return"null";let{deriveLiteralDetailType:ne,literalDetailToTypeText:Me}=In();if(te.type==="Literal")return Me(te.value);return ne(Rf,te)??"any"}function ec(te,ne){if("name"in ne)return te.type==="Identifier"&&te.name===ne.name;if(te.type!=="MemberExpression"||te.computed)return!1;return te.object.type==="Identifier"&&te.object.name===ne.object&&te.property.type==="Identifier"&&te.property.name===ne.property}function Of(te,ne,Me){let Ot=new Map,Mt="name"in ne?ne.name:ne.object,Vt;if(o(te.body,{enter(jt,Gt,Ut){if(jt.type==="CallExpression"){if(!ec(jt.callee,ne))return;let qt=jt.arguments,zt=so(qt[0]);if(!zt)return Vt="dynamic-event-name",b;for(let Xt of zt){let Jt=Ot.get(Xt)??new Set;Jt.add(If(qt[1])),Ot.set(Xt,Jt)}return}let Ht=Gt?.type==="CallExpression"&&Ut==="callee";if(jt.type==="MemberExpression"&&ec(jt,ne)&&!Ht)return Vt="passed-on",b;if(jt.type!=="Identifier"||jt.name!==Mt)return;if(Ht)return;if(!("name"in ne)&&Gt?.type==="MemberExpression"&&Ut==="object")return;if(!J(jt,Gt))return;return Vt="passed-on",b}}),Vt)return{candidate:Me,failureReason:Vt};let Wt=Array.from(Ot,([jt,Gt])=>{let Ut=Array.from(Gt);return{name:jt,detail:Ut.includes("any")?"any":Ut.join(" | ")}});return{candidate:Me,events:Wt}}function Lf(te,ne){let Me=te.members?`"${te.calleeText}"`:te.importedName==="default"?"the default export":`"${te.importedName}"`;switch(ne){case"module-not-found":return`"${te.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Me} isn't a function declared in "${te.importSource}"`;case"parameter-not-found":return`no parameter of ${Me} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Me} passes it on`}}function Mf(te,ne,{deferredEventNoSourceDiagnostics:Me=[],untypedJsDocEventNames:Ot=[]}){let Mt=new Map,Vt=[...te.diagnostics??[]],Wt=!0;for(let{candidate:Xt,events:Jt,failureReason:Qt}of ne){if(Qt){Wt=!1,Vt.push(a({component:te.filePath,kind:"dispatch-escapes",name:Xt.dispatcherName,message:`\`${Xt.dispatcherName}\` is passed to \`${Xt.calleeText}\`, but sveld couldn't read the events it dispatches: ${Lf(Xt,Qt)}. Document them with @event tags.`,...Xt.source?{source:Xt.source}:{},...Xt.ignored?{ignored:!0}:{}}));continue}for(let Yt of Jt??[]){if(Mt.has(Yt.name))continue;Mt.set(Yt.name,{type:"dispatched",name:Yt.name,detail:Yt.detail,...Xt.source?{source:Xt.source}:{}})}}if(Wt){for(let Xt of Me)if(!Mt.has(Xt.name))Vt.push(Xt)}if(te.diagnostics=Vt,Mt.size===0)return;let jt=new Map,Gt=new Set;for(let Xt of te.events)if(Xt.type==="dispatched")Gt.add(Xt.name);else if(!jt.has(Xt.name))jt.set(Xt.name,Xt);let Ut=new Set(Ot),Ht=new Map,qt=[];for(let Xt of Mt.values()){if(Gt.has(Xt.name)){if(Ut.has(Xt.name)&&Xt.detail!==void 0)Ht.set(Xt.name,Xt.detail);continue}let Jt=jt.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));te.events=[...te.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 tc={collect:(te)=>te.pendingDispatchEscapeCandidates??[],resolve:Nf,apply:Mf};function Ms(te){return(ne)=>{let Me=te.collect(ne);if(Me.length===0)return;return(Ot,Mt,Vt)=>te.apply(Ot,te.resolve(Mt,Me,Vt),ne)}}var Bf=[Ms(Xp),Ms(Jp),Ms(Qp),Ms(tc)];async function nc(te,ne,Me,Ot){let Mt=[];for(let Wt of te){let jt=Me(Wt);if(jt===void 0)continue;let Gt=Bf.flatMap((Ut)=>Ut(jt)??[]);if(Gt.length>0)Mt.push({component:Wt,passes:Gt})}let Vt=new Map;if(Mt.length===0)return Vt;await Jn();for(let{component:Wt,passes:jt}of Mt){let Gt=Rs(Ot),Ut=Ff(ne(Wt.filePath));for(let Ht of jt)Ht(Wt,Ut,Gt);Vt.set(Wt.filePath,Array.from(Gt.cache.keys()))}return Vt}var jf=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,Vf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),Gf=new Set(["svelte","html"]);function Wf(te){let ne=te.trim();if(ne==="")return null;let Me=ne.match(jf);if(Me){let Ot=Me[1].toLowerCase(),Mt=Me[2].trim();if(Mt==="")return null;if(Vf.has(Ot))return{kind:"compile",code:Mt};if(Gf.has(Ot))return{kind:"syntax",code:Mt};return null}if(ne.startsWith("<"))return null;return{kind:"compile",code:ne}}function ic(te){if(!te.isFunction)return"any";return`(${(te.params??[]).map((Me)=>`${Me.name}${Me.optional?"?":""}: any`).join(", ")}) => any`}function Fs(te,ne,Me,Ot,Mt){let Vt=(te??[]).filter((jt)=>jt.name==="example"),Wt=Vt.length>1;return Vt.flatMap((jt,Gt)=>{let Ut=Wf(jt.body);if(Ut===null)return[];return[{id:Wt?`${ne}#${Gt}`:ne,name:Wt?`${Me} (example ${Gt+1})`:Me,type:Ot,code:Ut.code,kind:Ut.kind,...Mt?{source:Mt}:{}}]})}function Uf(te){let ne=[];for(let Me of te.props)ne.push(...Fs(Me.tags,`prop:${Me.name}`,Me.name,ic(Me),Me.source));for(let Me of te.moduleExports)ne.push(...Fs(Me.tags,`export:${Me.name}`,Me.name,ic(Me),Me.source));for(let Me of te.slots){let Ot=Me.name??"default";ne.push(...Fs(Me.tags,`slot:${Ot}`,Ot,"any",Me.source))}for(let Me of te.events)ne.push(...Fs(Me.tags,`event:${Me.name}`,Me.name,"any",Me.source));return ne}function sc(te,ne){return te.flatMap(({component:Me,sources:Ot})=>{let Mt=Ot.filter((Vt)=>Vt.kind===ne);return Mt.length===0?[]:[{component:Me,sources:Mt}]})}async function Hf(te){let{formatParseError:ne,parseSvelte:Me}=await Jn(),Ot=new Map;for(let{component:Mt,sources:Vt}of te){let Wt=[];for(let jt of Vt)try{Me(jt.code)}catch(Gt){Wt.push(a({component:Mt.filePath,kind:"example-syntax-error",name:jt.name,message:ne(Gt),...jt.source?{source:jt.source}:{}}))}Ot.set(Mt,Wt)}return Ot}async function Kf(te,ne,Me){let Ot=await ne.checkExamples(te.map(({component:Vt,sources:Wt})=>({moduleName:Vt.moduleName,filePath:Me(Vt.filePath),sources:Wt}))),Mt=new Map;for(let{component:Vt,sources:Wt}of te){let jt=Ot.get(Me(Vt.filePath));if(!jt||jt.length===0)continue;let Gt=new Map(Wt.map((Ut)=>[Ut.id,Ut.source]));Mt.set(Vt,jt.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 Mt}async function rc(te,ne,Me,Ot){let Mt=Array.from(te,(Ut)=>({component:Ut,sources:Uf(Ut)})),Vt=ne===!0?sc(Mt,"compile"):[],Wt=sc(Mt,"syntax"),jt=new Map,Gt=(Ut)=>{for(let[Ht,qt]of Ut)jt.set(Ht,[...jt.get(Ht)??[],...qt])};if(Wt.length>0)Gt(await Hf(Wt));if(Vt.length>0){let{TypeResolver:Ut}=await import("./chunk-qwe39hva.js"),Ht=await Ut.create(Me);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 jt}import{hash as qf}from"node:crypto";import{mkdirSync as zf,readFileSync as Xf,renameSync as Jf,writeFileSync as oc}from"node:fs";import{dirname as ac,isAbsolute as Yf,join as Qf,resolve as ro}from"node:path";var pc=11,Zf=Qf("node_modules",".cache","sveld","parse-cache.json"),em="97696ef3fb5839ba";function cc(){return`${vs}+${em}+svelte@${Bi}`}function tm(te){let ne=W(te,["package.json"]);return ne===null?ro(te):ac(ne)}function lc(te,ne){let Me=tm(te);if(typeof ne==="string")return Yf(ne)?ne:ro(Me,ne);return ro(Me,Zf)}function Bs(te){return qf("sha256",te,"hex")}function oo(){return{formatVersion:pc,toolchainVersion:cc(),entries:{}}}function nm(te){try{let ne=JSON.parse(Xf(te,"utf-8"));if(ne.formatVersion!==pc||ne.toolchainVersion!==cc())return oo();return ne}catch{return oo()}}class ao{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(te){this.cacheFilePath=te,this.file=nm(te),this.savedEntryCount=Object.keys(this.file.entries).length}has(te,ne){return this.lookup(te,ne)!==void 0}lookup(te,ne){let Me=this.next.get(te);if(Me?.hash===ne)return Me;let Ot=this.file.entries[te];return Ot?.hash===ne?Ot:void 0}get(te,ne){let Me=this.lookup(te,ne);if(Me===void 0)return null;this.next.set(te,Me);let{component:Ot,typeScriptMetadata:Mt,propIgnores:Vt,pending:Wt}=structuredClone({component:Me.component,typeScriptMetadata:Me.typeScriptMetadata,propIgnores:Me.propIgnores,pending:Me.pending});if(Mt!==void 0)Ot[S]=Mt;if(Vt!==void 0)Ot[M]=Vt;return Wt===void 0?{component:Ot}:{component:Ot,pending:Wt}}set(te,ne,{component:Me,pending:Ot}){this.dirty=!0,this.next.set(te,{hash:ne,...structuredClone({component:Me,typeScriptMetadata:Me[S],propIgnores:Me[M],pending:Ot})})}getGeneratedText(te,ne){let Me=this.next.get(te);if(Me?.generatedText===void 0||Me.generatedText.key!==ne)return;return Me.generatedText.text}setGeneratedText(te,ne,Me){let Ot=this.next.get(te);if(Ot===void 0)return;if(Ot.generatedText?.key===ne&&Ot.generatedText.text===Me)return;Ot.generatedText={key:ne,text:Me},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,zf(ac(this.cacheFilePath),{recursive:!0});let te={...oo(),entries:Object.fromEntries(this.next)},ne=JSON.stringify(te),Me=`${this.cacheFilePath}.${process.pid}.tmp`;try{oc(Me,ne),Jf(Me,this.cacheFilePath)}catch{try{oc(this.cacheFilePath,ne)}catch{}}}}import{dirname as im,relative as sm,resolve as rm}from"node:path";async function uc(te,ne={}){await Jn();let Me=rm(te),Ot=im(Me),Mt=(jt)=>n(`./${sm(Ot,jt)}`),Vt=Is(Me,{...Rs(ne.graph??new Yn),onAmbiguousStarExport:(jt,Gt,Ut)=>{if(jt!==Me||!ne.diagnostics)return;if(Ut.every((Xt)=>Xt.declFile.endsWith(".svelte")))return;let Ht=Array.from(new Set(Ut.map((Xt)=>Mt(Xt.declFile)))),qt=Ht.map((Xt)=>`"${Xt}"`),zt=`${qt.slice(0,-1).join(", ")} and ${qt[qt.length-1]}`;ne.diagnostics.push(a({component:Mt(Me),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 jt of Vt){if(jt.name==="default"||jt.declFile.endsWith(".svelte"))continue;let{declFile:Gt,returnType:Ut,literalValue:Ht,primitiveLiteral:qt,declaredType:zt,functionNode:Xt,namespaceFile:Jt,...Qt}=jt,Yt=Mt(Gt);if(Jt!==void 0)Qt.type=`typeof import(${JSON.stringify(Mt(Jt))})`;Wt.set(jt.name,{...Qt,source:Yt})}return Array.from(Wt.values()).sort((jt,Gt)=>u(jt.name,Gt.name))}async function pm(te){let ne=await Promise.all(Array.from(te,async(Me)=>{try{return[Me,await am(Me,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Me}:`,Ot),[Me,null]}}));return new Map(ne)}function dc(te){if(te.length===0)return;console.error(`sveld: failed to parse ${te.length} component(s):`);for(let{filePath:ne,message:Me}of te)console.error(` - ${ne}: ${Me}`)}class Ki{input;glob;options;graph=new Yn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(te,ne,Me={}){this.input=te,this.glob=ne,this.options=Me}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Yn,this.collected=to(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Ds(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=om(this.input).isFile()?hc(this.input):null,this.cache=this.options.cache===!1?void 0:new ao(lc(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),dc(Array.from(this.parseErrors.values())),this.assemble()}async update(te){let ne=te.map((Ut)=>hc(Ut));if(this.graph.invalidate(...ne),ne.length===0)return{result:this.assemble(),reparsed:[]};let Me=this.entryFile!==null&&ne.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Ut,exports:Ht,allComponentEntries:qt,resolveComponentFilePath:zt}=this.collected;eo(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 Mt=Array.from(this.records).flatMap(([Ut,{crossFileReads:Ht}])=>Ht?.some((qt)=>ne.includes(qt))?[Ut]:[]),Vt=new Set([...ne.filter((Ut)=>Nn.test(Ut)),...Me,...Mt]),Wt=new Set(Array.from(Ot).filter((Ut)=>Vt.has(Ut))),jt=await this.process(Wt),Gt=this.assemble();return dc(Gt.errors),{result:Gt,reparsed:jt}}async recollect(){let te=this.collected,ne=to(this.input,this.glob,this.documentExports,this.graph),Me=[];for(let[Ot,Mt]of Object.entries(ne.exports)){let Vt=ne.resolveComponentFilePath(Mt.source),Wt=Object.hasOwn(te.exports,Ot)?te.exports[Ot]:void 0;if(Wt===void 0||te.resolveComponentFilePath(Wt.source)!==Vt)Me.push(Vt)}return this.collected=ne,this.globMergeState=Ds(ne.allComponentEntries,ne.resolveComponentFilePath),await this.readEntryExports(),Me}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await uc(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:te,allComponentEntries:ne,resolveComponentFilePath:Me}=this.collected,Ot=new Set;for(let[,Mt]of[...Object.entries(te),...ne])if(Si(Mt.source))Ot.add(Me(Mt.source));return Ot}indexEntries(){let{exports:te,allComponentEntries:ne,resolveComponentFilePath:Me}=this.collected;this.canonicalEntries=new Map;for(let Ot of[Object.entries(te),ne])for(let Mt of Ot){if(!Si(Mt[1].source))continue;this.canonicalEntries.set(Me(Mt[1].source),this.entryIdentity(Ot,Mt))}}entryIdentity(te,[ne,{source:Me}]){return{moduleName:Wp(ne,Me,te.length,this.warnedModuleNames),filePath:n(Me)}}canonicalEntry(te){let ne=this.canonicalEntries.get(te);if(ne===void 0)throw Error(`sveld: no entry lists ${te}.`);return ne}async process(te){let ne=new Map,Me=await this.parse(te,ne);this.cache?.save();let Ot=await this.settle(Me);for(let Mt of te)this.records.delete(Mt),this.parseErrors.delete(Mt);for(let[Mt,Vt]of Ot)this.records.set(Mt,Vt);for(let[Mt,Vt]of ne)this.parseErrors.set(Mt,Vt);return Array.from(Ot.keys())}async parse(te,ne){let Me=await pm(te),Ot=this.cache,Mt=new Map,Vt=new Set;if(Ot)for(let[jt,Gt]of Me){if(Gt===null)continue;let Ut=Bs(Gt);if(Mt.set(jt,Ut),!Ot.has(jt,Ut))Vt.add(jt)}if(te.size>0&&(!Ot||Vt.size>0))await Jn();let Wt=new Map;for(let jt of te){let Gt=Me.get(jt);if(Gt===null||Gt===void 0)continue;let Ut=this.parseOne(jt,Gt,Mt.get(jt),ne);if(Ut)Wt.set(jt,Ut)}return Wt}parseOne(te,ne,Me,Ot){let Mt=Me===void 0?null:this.cache?.get(te,Me);if(Mt)return Mt;let{moduleName:Vt,filePath:Wt}=this.canonicalEntry(te),jt;try{jt=new(In()).ComponentParser().parse(ne,{moduleName:Vt,filePath:Wt})}catch(Gt){if(this.options.failFast)throw Gt;Ot.set(te,{filePath:Wt,moduleName:Vt,message:Gt instanceof Error?Gt.message:String(Gt),stack:Gt instanceof Error?Gt.stack:void 0});return}if(Me!==void 0)this.cache?.set(te,Me,jt);return jt}async settle(te){let{rootDir:ne,resolveComponentFilePath:Me}=this.collected,Ot=new Map,Mt=new Map;for(let[Gt,{component:Ut,pending:Ht}]of te){let qt={...this.canonicalEntry(Gt),...Ut};Ot.set(Gt,qt),Mt.set(qt,Ht)}let{checkExamples:Vt}=this.options;if(Vt){let Gt=await rc(Ot.values(),Vt,ne,Me);for(let[Ut,Ht]of Gt)gi(Ut,Ht)}let Wt=await nc(Ot.values(),Me,(Gt)=>Mt.get(Gt),this.graph),jt=new Map;for(let[Gt,Ut]of Ot){let{moduleName:Ht,filePath:qt,...zt}=Ut,Xt=Wt.get(qt);jt.set(Gt,Xt===void 0?{component:zt}:{component:zt,crossFileReads:Xt})}return jt}assemble(){let{exports:te,allComponentEntries:ne,resolveComponentFilePath:Me}=this.collected,Ot=this.cache,Mt=(qt,zt)=>{let{source:Xt}=zt[1];if(!Si(Xt))return;let Jt=this.records.get(Me(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,jt=Ot?new Map:void 0;for(let qt of ne){let zt=Mt(ne,qt);if(zt===void 0)continue;let{filePath:Xt}=zt.component;Vt.set(Xt,zt.component),(zt.record.crossFileReads===void 0?Wt:jt)?.set(Xt,Me(qt[1].source))}let Gt=Cp(Vt,Me,this.graph);for(let qt of Vt.values())gi(qt,[...Gt(qt),...bp(qt)]);let Ut=new Map,Ht=Object.entries(te);for(let qt of Ht){let zt=Mt(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:te,entryExports:this.entryExports,components:Ut,allComponentsForTypes:Vt,errors:Array.from(this.parseErrors.values()),diagnostics:Lo(Fo([...Array.from(Vt.values()).flatMap((qt)=>qt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ot,resolvedPathByFilePath:Wt,crossFileResolvedPathByFilePath:jt}}}function qi(te){return{failFast:te?.failFast,documentExports:te?.documentExports===!0,cache:te?.cache,checkExamples:te?.checkExamples==="syntax"?"syntax":te?.checkExamples===!0,diagnostics:te?.diagnostics}}async function zi(te,ne,Me={}){return new Ki(te,ne,Me).build()}import{existsSync as po,readFileSync as cm}from"node:fs";import{isAbsolute as lm,join as mc}from"node:path";var Xi='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function fc(te){return lm(te)?te:mc(process.cwd(),te)}function Ie(te){if(te){let Mt=fc(te);if(po(Mt))return{entry:ee(te)};return{entry:null,configured:!0,message:`Invalid entry point: ${Mt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let ne=mc(process.cwd(),"package.json");if(!po(ne))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Me;try{Me=_p(JSON.parse(cm(ne,"utf-8")))}catch(Mt){throw console.error("Error reading package.json:",Mt),Mt}let Ot=Me.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(!po(fc(Ot)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ot}", which does not exist.`};return{entry:ee(Ot)}}function js(te){let ne=Ie(te);if(ne.entry===null)console.error(ne.message);return ne.entry}async function gc(te,ne,Me={}){let Ot=new Ki(te,ne,{...Me,failFast:!1}),Mt=await Ot.build();return{get result(){return Promise.resolve(Mt)},async update(Vt){let Wt=await Ot.update(Vt);return Mt=Wt.result,Wt}}}import lo from"node:path";function yc(te){let ne=new Map,Me=[];for(let[Ot,Mt]of Object.entries(te)){if(Mt.star){Me.push(`export * from "${Mt.source}";`);continue}let Vt=ne.get(Mt.source)??[];Vt.push({id:Ot,exportee:Mt}),ne.set(Mt.source,Vt)}for(let[Ot,Mt]of ne){let Vt=Nn.test(Ot),Wt=Mt.some(({id:zt,exportee:Xt})=>zt!=="default"&&Xt.default),jt=Mt.some(({exportee:zt})=>!zt.default),Gt=Vt&&Wt&&jt,Ut=[],Ht=[],qt=[];for(let{id:zt,exportee:Xt}of Mt){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)Me.push(`export { ${[...qt,...Ut].join(", ")} } from "${Ot}";`);else{if(Ut.length>0)Me.push(`export { ${Ut.join(", ")} } from "${Ot}";`);if(qt.length>0)Me.push(`export { ${qt.join(", ")} } from "${Ot}";`)}Me.push(...Ht)}return Me.join(`
|
|
142
|
-
`)}function xc(te){return te.filter((ne)=>ne.names.length>0).map((ne)=>`export type { ${ne.names.join(", ")} } from "${ne.source}";`).join(`
|
|
143
|
-
`)}function vc(te){return te.replace(Nn,"")}function co(te){return te.replace(Nn,".svelte.d.ts")}import{mkdir as um,readFile as hm,writeFile as dm}from"node:fs/promises";import{parse as fm}from"node:path";class Mn{ensuredDirs=new Set;async write(te,ne){try{if(await hm(te,"utf-8")===ne)return!1}catch{}let Me=fm(te).dir;if(!this.ensuredDirs.has(Me))await um(Me,{recursive:!0}),this.ensuredDirs.add(Me);return await dm(te,ne),!0}}function mm(te){return i(te)&&!Array.isArray(te)&&"start"in te&&"end"in te}function uo(te){if(Array.isArray(te))return te.map((ne)=>uo(ne));if(i(te)){let ne={};for(let[Me,Ot]of Object.entries(te)){if((Me==="source"||Me==="componentCommentSource")&&mm(Ot))continue;ne[Me]=uo(Ot)}return ne}return te}function gm(te,ne,Me){if(!ne)return`${te.moduleName}.api.json`;if(!Me.has(te.moduleName))Me.add(te.moduleName),console.warn(`Warning: multiple components named "${te.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${vc(te.filePath)}.api.json`}async function ym(te,ne,Me){let Ot=Vs(te,{inputDir:ne.inputDir,source:ne.source}).components,Mt=new Map;for(let jt of Ot)Mt.set(jt.moduleName,(Mt.get(jt.moduleName)??0)+1);let Vt=new Set,Wt=new Mn;await Promise.all(Ot.map(async(jt)=>{let Gt=(Mt.get(jt.moduleName)??0)>1,Ut=gm(jt,Gt,Vt),Ht=lo.resolve(lo.join(Me,Ut)),qt=await Wt.write(Ht,Fi(jt));Gn(`${qt?"created":"unchanged"} "${Ht}".`)}))}function Vs(te,ne){let Me=y(te,{entryExports:ne.entryExports}),Ot={...Me,components:Me.components.map((Mt)=>({...Mt,filePath:_a(Mt.filePath,ne.inputDir)}))};return ne.source===!1?uo(Ot):Ot}function ho(te,ne){return Fi(Vs(te,ne))}async function fo(te,ne){if(ne.outDir){await ym(te,ne,ne.outDir);return}let Me=await new Mn().write(lo.resolve(ne.outFile),ho(te,ne));Gn(`${Me?"created":"unchanged"} "${ne.outFile}".`)}import{join as Bc,resolve as So}from"node:path";var Ec=/`/g,Sc=/\s+/g,Zn="--",bc=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
144
|
-
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
145
|
-
`,Cc=`| Slot name | Default | Props | Fallback | Description |
|
|
146
|
-
| :- | :- | :- | :- | :- |
|
|
147
|
-
`,Tc=`| Event name | Type | Detail | Description |
|
|
148
|
-
| :- | :- | :- | :- |
|
|
149
|
-
`,mo=`| Name | Kind | Type | Description |
|
|
150
|
-
| :- | :- | :- | :- |
|
|
151
|
-
`,xm=`| Member | Signature | Description |
|
|
152
|
-
| :- | :- | :- |
|
|
153
|
-
`,wc=`| Part name | Description |
|
|
154
|
-
| :- | :- |
|
|
155
|
-
`,kc=`| Property name | Type | Default value | Description |
|
|
156
|
-
| :- | :- | :- | :- |
|
|
157
|
-
`,Ac=/\|/g,vm=/</g,Em=/>/g,Gs=/\n/g,Sm=/^[A-Za-z_$][\w$]*$/,bm=/\s*\n\s*/g,Cm=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,Tm=/[&<|`*\\_]/;function go(te){if(!Tm.test(te))return te;return te.replace(Cm,(ne)=>ne==="&"?"&":ne==="<"?"<":ne==="_"?"_":`&#${ne.charCodeAt(0)};`)}function wm(te){return`<code>${go(te.includes(`
|
|
158
|
-
`)?te.replace(bm," "):te)}</code>`}var km=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function Am(te){if(!te.includes("{@link"))return te;return te.replace(km,(ne,Me,Ot)=>`[${Ot===void 0?Me:Ot.trim()}](${Me})`)}function Pm(te){return te.includes("```")||te.includes("~~~")}function _m(te){return Nc(Am(te))}var $m=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Nm=/^\n/,Dm=/\n$/;function Pc(te){let ne=(Vt)=>({kind:"prose",text:_m(Vt.join(`
|
|
159
|
-
`))});if(!Pm(te))return[ne([te])];let Me=te.split(`
|
|
160
|
-
`),Ot=[],Mt=[];for(let Vt=0;Vt<Me.length;Vt++){let Wt=$m.exec(Me[Vt]),[,jt="",Gt="",Ut=""]=Wt??[];if(!Wt||Gt[0]==="`"&&Ut.includes("`")){Mt.push(Me[Vt]);continue}if(Mt.push(""),Mt.length>1)Ot.push(ne(Mt));let Ht=[],qt=new RegExp(`^[ \\t]*${Gt[0]}{${Gt.length},}[ \\t]*$`);for(Vt++;Vt<Me.length&&!qt.test(Me[Vt]);Vt++){let zt=Me[Vt],Xt=0;while(Xt<jt.length&&(zt[Xt]===" "||zt[Xt]==="\t"))Xt++;Ht.push(zt.slice(Xt))}Ot.push({kind:"code",code:Ht.join(`
|
|
161
|
-
`)}),Mt=[""]}if(Mt.length>1||Ot.length===0)Ot.push(ne(Mt));return Ot}function _c(te){let ne="";for(let Me=0;Me<te.length;Me++){let Ot=te[Me];if(Ot.kind==="code"){ne+=`<pre><code>${go(Ot.code).replace(Gs,"<br />")}</code></pre>`;continue}let Mt=Ot.text;if(te[Me-1]?.kind==="code")Mt=Mt.replace(Nm,"");if(te[Me+1]?.kind==="code")Mt=Mt.replace(Dm,"");ne+=Mt.replace(Ac,"|").replace(Gs,"<br />")}return ne}function bn(te){if(te===void 0)return Zn;return wm(te)}function $c(te){if(!te.reExport)return bn(te.type);let{from:ne,imported:Me}=te.reExport,Ot=Me==="*"?"":Sm.test(Me)?`.${Me}`:`[${JSON.stringify(Me)}]`;return bn(`typeof import(${JSON.stringify(ne)})${Ot}`)}function Nc(te){if(!te.includes("<")&&!te.includes(">"))return te;return te.replace(vm,"<").replace(Em,">")}function li(te,ne){if(ne===void 0)return te;let Me=typeof ne==="string"&&ne.trim().length>0?`: ${Nc(ne).replace(Gs," ").replace(Ac,"|")}`:"";return`<s>${te}</s><br />**Deprecated**${Me}`}function Ws(te){if(te===void 0||te.trim().length===0)return Zn;return _c(Pc(te))}function Dc(te){if(te===void 0||te==="{}"||te==="Record<string, never>")return Zn;return bn(te.trim())}function Rc(te){if(te===void 0)return Zn;return`<code>${go(te).replace(Gs,"<br />")}</code>`}function wi(te,ne){let Me=[],Ot=(Vt)=>{let Wt=Me.at(-1);if(Wt?.kind==="prose")Wt.text+=Vt;else Me.push({kind:"prose",text:Vt})},Mt=(Vt,Wt)=>{if(Me.length>0)Ot(`
|
|
162
|
-
`);if(Vt)Ot(Vt);for(let jt of Pc(Wt))if(jt.kind==="prose")Ot(jt.text);else Me.push(jt)};if(te?.trim())Mt("",te);for(let{name:Vt,body:Wt}of ne??[]){let jt=Wt?.trim();Mt(jt?`@${Vt} `:`@${Vt}`,jt??"")}if(Me.length===0)return Zn;return _c(Me)}function Ic(te){return bn(te)}function Rm(te){let ne=[te.extends?`Extends ${bn(te.extends)}.`:"",te.implements?.length?`Implements ${te.implements.map((Me)=>bn(Me)).join(", ")}.`:""].filter(Boolean);return ne.length>0?ne.join(" "):void 0}function Oc(te,ne){let Me=new Set;for(let Ot of ne){if(Ot.kind!=="class")continue;let Mt=Rm(Ot);if(!Ot.members?.length&&!Mt)continue;let Vt=Ot.localName??Ot.name;if(Me.has(Vt))continue;if(Me.add(Vt),te.append("h4",`\`${Vt}\` members`),Mt)te.append("raw",`${Mt}
|
|
163
|
-
|
|
164
|
-
`);if(!Ot.members?.length)continue;te.append("raw",xm);for(let Wt of Ot.members)te.append("raw",`| ${li(Wt.name,Wt.deprecated)} | ${bn(Lr(Wt))} | ${wi(Wt.description,Wt.tags)} |
|
|
165
|
-
`);te.append("raw",`
|
|
166
|
-
`)}}function Lc(te,ne,Me){if(te.append("h1","Component Index"),te.append("h2","Components").tableOfContents(),te.append("divider"),Me&&Me.length>0)Fc(te,Me);for(let Ot of y(ne).components)xo(te,Ot)}function Mc(te,ne,Me){te.append("h1","Component Index"),te.append("h2","Components");for(let Ot of ne)te.append("raw",`- [${Ot.moduleName}](./${Ot.moduleName}.md)
|
|
167
|
-
`);if(te.append("raw",`
|
|
168
|
-
`),te.append("divider"),Me&&Me.length>0)Fc(te,Me)}function Fc(te,ne){te.append("h2","Exports"),te.append("raw",mo);for(let Me of ne){let Ot=(Me.type??Me.value)?.replace(Sc," ").trim();te.append("raw",`| ${li(Me.name,Me.deprecated)} | <code>${Me.kind}</code> | ${bn(Ot)} | ${Ws(Me.description)} |
|
|
169
|
-
`)}te.append("raw",`
|
|
170
|
-
`),te.append("divider")}function Im(te,ne){te.append("h3","Module exports"),te.append("raw",mo);for(let Me of ne)te.append("raw",`| ${li(Me.name,Me.deprecated)} | <code>${Me.kind}</code> | ${$c(Me)} | ${wi(Me.description,Me.tags)} |
|
|
171
|
-
`);te.append("raw",`
|
|
172
|
-
`),Oc(te,ne)}function yo(te,ne,Me){if(ne.length>0)Me(),te.append("raw",`
|
|
173
|
-
`);else te.append("p","None.")}function xo(te,ne){if(te.append("h2",`\`${ne.moduleName}\``),ne.generics)te.append("p",`**Type parameters:** ${bn(`<${ne.generics[1]}>`)}`);if(ne.typedefs.length>0)te.append("h3","Types").append("raw",`\`\`\`ts
|
|
174
|
-
${ks({typedefs:ne.typedefs})}
|
|
175
|
-
\`\`\`
|
|
176
|
-
|
|
177
|
-
`);if(te.append("h3","Props"),yo(te,ne.props,()=>{te.append("raw",bc);let Me=(Mt)=>Mt.reactive?0:Mt.constant?2:1,Ot=ne.props.map((Mt,Vt)=>({prop:Mt,index:Vt})).sort((Mt,Vt)=>Me(Mt.prop)-Me(Vt.prop)||Mt.index-Vt.index).map(({prop:Mt})=>Mt);for(let Mt of Ot){let Vt=zn(Mt)?"accessor":Mt.kind;te.append("raw",`| ${li(Mt.name,Mt.deprecated)} | ${Mt.isRequired?"Yes":"No"} | <code>${Vt}</code> | ${Mt.reactive?"Yes":"No"} | ${Mt.binding??"--"} | ${bn(Mt.type)} | ${bn(Mt.value)} | ${wi(Mt.description,Mt.tags)} |
|
|
178
|
-
`)}}),ne.moduleExports.length>0)Im(te,ne.moduleExports);if(te.append("h3","Slots"),yo(te,ne.slots,()=>{te.append("raw",Cc);for(let Me of ne.slots)te.append("raw",`| ${li(Me.default?Zn:Me.name??Zn,Me.deprecated)} | ${Me.default?"Yes":"No"} | ${Dc(Me.slot_props)} | ${Rc(Me.fallback)} | ${wi(Me.description,Me.tags)} |
|
|
179
|
-
`)}),te.append("h3","Events"),yo(te,ne.events,()=>{te.append("raw",Tc);for(let Me of ne.events)te.append("raw",`| ${li(Me.name,Me.deprecated)} | ${Me.type} | ${Ic(Me.detail)} | ${wi(Me.description,Me.tags)} |
|
|
180
|
-
`)}),ne.cssParts&&ne.cssParts.length>0){te.append("h3","CSS Parts"),te.append("raw",wc);for(let Me of ne.cssParts)te.append("raw",`| ${Me.name} | ${Ws(Me.description)} |
|
|
181
|
-
`);te.append("raw",`
|
|
182
|
-
`)}if(ne.cssProperties&&ne.cssProperties.length>0){te.append("h3","CSS Custom Properties"),te.append("raw",kc);for(let Me of ne.cssProperties)te.append("raw",`| ${Me.name} | ${bn(Me.type)} | ${bn(Me.default)} | ${Ws(Me.description)} |
|
|
183
|
-
`);te.append("raw",`
|
|
184
|
-
`)}}var Om=/[^\w\- ]+/g,Lm=/\s+/g,vo="<!-- __TOC__ -->";function Mm(te,ne){let Me=te.toLowerCase().replace(Ec,"").replace(Om,"").replace(Lm,"-"),Ot=ne.get(Me)??0;return ne.set(Me,Ot+1),Ot===0?Me:`${Me}-${Ot}`}class Eo{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(te={}){this.onAppend=te.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
185
|
-
|
|
186
|
-
`),this}append(te,ne){switch(te){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(te.slice(-1)))} ${ne}`),this.hasToC&&te==="h2")this.toc.push({indent:0,raw:ne??""});break}case"quote":this.sourceParts.push(`> ${ne}`);break;case"p":this.sourceParts.push(ne??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(ne??"");break}if(te!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,te,this),this}tableOfContents(){return this.sourceParts.push(vo),this.hasToC=!0,this.appendLineBreaks(),this}end(){let te=this.sourceParts.join("");if(!this.hasToC)return te;let ne=te.indexOf(vo);if(ne===-1)return te;let Me=new Map,Ot=this.toc.map(({indent:Mt,raw:Vt})=>`${" ".repeat(Mt)}- [${Vt}](#${Mm(Vt,Me)})`).join(`
|
|
187
|
-
`);return te.slice(0,ne)+Ot+te.slice(ne+vo.length)}}function Us(te,ne){return new Eo({onAppend:(Me,Ot)=>{ne?.onAppend?.call(null,Me,Ot,te)}})}function Ji(te,ne){let Me=Us(te,ne);return Lc(Me,te,ne.entryExports),Me.end()}async function Fm(te,ne,Me){let Ot=y(te,{entryExports:ne.entryExports}),Mt=new Mn,Vt=Us(te,ne);Mc(Vt,Ot.components,ne.entryExports);let Wt=So(Bc(Me,"README.md")),jt=await Mt.write(Wt,Vt.end());Gn(`${jt?"created":"unchanged"} "${Wt}".`),await Promise.all(Ot.components.map(async(Gt)=>{let Ut=Us(te,ne);xo(Ut,Gt);let Ht=So(Bc(Me,`${Gt.moduleName}.md`)),qt=await Mt.write(Ht,Ut.end());Gn(`${qt?"created":"unchanged"} "${Ht}".`)}))}async function bo(te,ne){if(ne.outDir){await Fm(te,ne,ne.outDir);return}let Me=So(ne.outFile),Ot=await new Mn().write(Me,Ji(te,ne));Gn(`${Ot?"created":"unchanged"} "${ne.outFile}".`)}import{join as Bm,resolve as jm}from"node:path";function Vm(te,ne){if(!ne.indexTypes)return[];let Me=ne.format==="component",Ot=new Set,Mt=[];for(let Vt of Object.values(ne.exports)){if(!Vt.default||!Nn.test(Vt.source))continue;let Wt=n(Vt.source);if(Ot.has(Wt))continue;Ot.add(Wt);let jt=te.components.find((Ut)=>Ut.filePath===Wt);if(!jt)continue;let Gt=[Ci(jt.moduleName)];if(Me)Gt.push(Wi(jt.moduleName));Mt.push({source:Vt.source,names:Gt})}return Mt}async function jc(te,ne,Me){if(!te)return ne;try{let Ot=await te(ne,Me);if(typeof Ot!=="string")throw TypeError(`must return a string, got ${typeof Ot}`);return Ot}catch(Ot){let Mt=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: typesOptions.transform failed for "${Me.filePath}": ${Mt}`,{cause:Ot})}}function Gm(te,ne){return`${te}
|
|
188
|
-
${ep(ne)}`}async function Co(te,ne){let Me=jm(ne.outDir,"index.d.ts"),Ot=new Mn,Mt=y(te),Vt=xc(Vm(Mt,ne)),Wt=ne.preamble+[yc(ne.exports),Vt].filter((Xt)=>Xt!=="").join(`
|
|
189
|
-
|
|
190
|
-
`),jt=Mr(ne),Gt=Mt.components.map(async(Xt)=>{let Jt=co(Bm(ne.outDir,Xt.filePath)),Qt=n(co(Xt.filePath)),Yt=ne.resolvedPathByFilePath?.get(Xt.filePath),nn=Yt?void 0:ne.crossFileResolvedPathByFilePath?.get(Xt.filePath),sn=Yt??nn,cn=Gm(Xt.moduleName,jt),un=nn?`${cn}
|
|
191
|
-
${Bs(JSON.stringify(Xt))}`:cn,hn=sn?ne.cache?.getGeneratedText(sn,un):void 0;if(hn===void 0){if(hn=Fr(Xt,jt),sn)ne.cache?.setGeneratedText(sn,un,hn)}let Fn=await jc(ne.transform,hn,{kind:"component",component:Xt,filePath:Qt});return Ot.write(Jt,Fn)}),Ut=(async()=>{let Xt=await jc(ne.transform,Wt,{kind:"index",filePath:"index.d.ts"});return Ot.write(Me,`${Xt}
|
|
192
|
-
`)})(),Ht=(await Promise.all([...Gt,Ut])).filter(Boolean).length,qt=Gt.length+1,zt=Ht===0?`unchanged ${qt}`:`created ${Ht} of ${qt}`;Gn(`${zt} TypeScript definitions in "${ne.outDir}".`)}var Wm=["reportDiagnostics","strict","check","checkLevel","stdout","format"],Um=50;function Hm(te){let ne=Promise.resolve();return()=>{ne=ne.then(te,te)}}function Lt(te){let ne=te?.watch===!0,Me,Ot,Mt=te??{},Vt,Wt=null,jt,Gt=new Set,Ht=Hm(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 Yi(Xt,Mt,Ot)}catch(Xt){console.error("sveld: failed to regenerate types in watch mode:",Xt)}}),qt=(zt)=>{if(!ne||Wt==null||!Pa.test(zt))return;Gt.add(zt),clearTimeout(jt),jt=setTimeout(Ht,Um)};return{name:"vite-plugin-sveld",apply:ne?void 0:"build",enforce:"post",configResolved(zt){Vt=zt.root},async buildStart(){if(te?.config){let Xt=await q(te.config,Vt??process.cwd(),!1);Mt=O(Xt,te)}G(Mt);let zt=Wm.filter((Xt)=>(Xt in Mt));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(H(Mt.quiet===!0),Ot=js(Mt.entry),ne&&Ot!=null)try{Wt=await gc(Ot,Mt.glob===!0,qi(Mt)),await Yi(await Wt.result,Mt,Ot)}catch(Xt){console.error("sveld: failed to generate initial types in watch mode:",Xt)}},async generateBundle(){if(ne)return;if(Ot==null)this.error(Xi);Me=await zi(Ot,Mt.glob===!0,qi(Mt))},async writeBundle(){if(ne)return;if(Ot==null)this.error(Xi);await Yi(Me,Mt,Ot)},handleHotUpdate(zt){qt(zt.file)},watchChange(zt){qt(zt)}}}async function Yi(te,ne,Me){let Ot=Vc(Me);if(ne.types!==!1)await Co(te.allComponentsForTypes,{outDir:"types",preamble:"",...ne.typesOptions,exports:te.exports,inputDir:Ot,cache:te.cache,resolvedPathByFilePath:te.resolvedPathByFilePath,crossFileResolvedPathByFilePath:te.crossFileResolvedPathByFilePath});if(ne.json)await fo(te.components,{outFile:"COMPONENT_API.json",...ne.jsonOptions,inputDir:Ot,entryExports:te.entryExports});if(ne.markdown)await bo(te.components,{outFile:"COMPONENT_INDEX.md",...ne.markdownOptions,entryExports:te.entryExports});te.cache?.save()}async function Gc(te,ne,Me){if(ne.json){let Ot=ho(te.components,{...ne.jsonOptions,inputDir:Vc(Me),entryExports:te.entryExports});process.stdout.write(Ot);return}if(ne.markdown){let Ot=Ji(te.components,{...ne.markdownOptions,entryExports:te.entryExports});process.stdout.write(Ot)}}import{realpathSync as Wc,statSync as Km}from"node:fs";import{dirname as Uc,relative as qm,resolve as zm}from"node:path";function Xm(te){if(te.check&&!te.check.snapshotExists&&!te.writesSnapshot)return 1;if(te.check?.changes.some((ne)=>ne.kind==="schema"))return 1;if(te.errors.length>0)return 2;if(te.check&&dp(te.check.bump,te.checkLevel??"major"))return 3;if(Oo(te.diagnostics,te.strict).length>0)return 4;return 0}async function Le(te,ne,Me=!1){let Ot=await zi(te,ne.glob===!0,qi(ne)),Mt=ne.check?await Re(Ot.components,gp(ne),{entryExports:Ot.entryExports}):void 0;return await(Me?Gc:Yi)(Ot,ne,te),{result:Ot,check:Mt}}function Jm(te){let ne=Wc(Km(te).isFile()?Uc(te):te),Me=Wc(process.env.GITHUB_WORKSPACE||process.cwd());return(Ot)=>n(qm(Me,zm(ne,Ot)))}function Oe(te,ne,Me,Ot){let Mt=Me.reportDiagnostics||Me.strict,Vt=Io(te.diagnostics,Mt);if(Mt&&Vt.length>0)if(Me.format==="json")process.stderr.write(Go(Vt));else{if(Me.format==="github"){let jt=Vo(Vt,Jm(Ot));if(jt)console.error(jt)}console.error(Bo(Vt))}let Wt=Xm({errors:te.errors,check:ne,writesSnapshot:ne?yp(Me,ne.snapshotFile):!1,checkLevel:Me.checkLevel,diagnostics:Vt,strict:Me.strict});return{diagnostics:Vt,exitCode:Wt}}async function Bt(te){if(te&&"input"in te)throw Error("sveld: the `input` option was renamed to `entry`.");if(typeof te?.config==="string")throw Error("sveld: `config` takes `true` or `false`; import another config file and pass its options instead.");let{entry:ne,...Me}=te??{},Ot=await q(Me.config,process.cwd(),!0),Mt=js(ne??Ot.entry);if(Mt===null)throw Error(Xi);let Vt=O(Ot,Me,{entry:Mt});G(Vt),H(Vt.quiet===!0);let{result:Wt,check:jt}=await Le(Mt,Vt),{diagnostics:Gt,exitCode:Ut}=Oe(Wt,jt,Vt,Mt),Ht=Vs(Wt.components,{inputDir:Uc(Mt),entryExports:Wt.entryExports,source:Vt.jsonOptions?.source});return{diagnostics:Gt,check:jt,errors:Wt.errors,document:Ht,exitCode:Ut}}
|
|
193
|
-
export{S,M,re,x,N,ve,z,Se,be,J,b,p,o,i,k,t,w,c,m,P,Fe,Te,A,l,F,_,r,T,C,E,ie,se,a,K,Be,R,B,h,u,X,d,oe,Y,ae,Ce,Q,le,je,ke,pe,Z,g,v,s,ce,ue,e,Ve,qe,de,Ge,We,He,Ue,ze,Je,Ke,we,Xe,Ye,Pe,Qe,Ze,et,tt,Ae,De,nt,Ne,rt,it,D,st,ot,at,lt,pt,ct,ut,dt,ft,_e,mt,ht,gt,yt,xt,Et,fe,vt,St,bt,$e,Tt,Ct,kt,wt,f,Pt,At,Dt,me,he,j,Nt,_t,V,I,ge,L,n,$t,y,Rt,Re,ye,It,xe,Ft,q,O,G,ee,W,H,Ee,U,Ie,Lt,Le,Oe,Bt};
|