sveld 0.38.2 → 0.38.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.d.ts +5 -0
- package/browser.js +143 -143
- package/chunk-1azsj0zd.js +13 -0
- package/{chunk-261qwh99.js → chunk-3z90f57k.js} +1 -1
- package/chunk-4kzw8twf.js +1 -0
- package/chunk-6s52n40s.js +29 -0
- package/chunk-8v3hb5br.js +234 -0
- package/cli-entry.js +2 -2
- package/index.d.ts +5 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/schema/component-api.schema.json +1 -0
- package/chunk-28h1esfd.js +0 -29
- package/chunk-80eafzch.js +0 -1
- package/chunk-rn01dzny.js +0 -234
- package/chunk-wpqsw5ca.js +0 -13
package/chunk-rn01dzny.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
function Cc(V){let K="";for(let be=0;be<V.length;be++){let Be=V[be];if(Be==="*"&&V[be+1]==="*"){if(K+=".*",be++,V[be+1]==="/")be++;continue}if(Be==="*"){K+="[^/]*";continue}if(Be==="?"){K+="[^/]";continue}K+=".+^$()[]{}|\\".includes(Be)?`\\${Be}`:Be}return K}function Co(V,K){return new RegExp(`^${Cc(V)}$`).test(K)}var wc={"prop-unknown-type":"warning","context-any-type":"warning","slot-missing-type":"warning","slot-not-rendered":"warning","event-no-source":"warning","dispatch-escapes":"warning","example-compile-error":"error","example-syntax-error":"error","syntax-skipped":"error","type-syntax-error":"error","rest-props-unresolved":"warning","context-duplicate-key":"warning","context-key-unresolved":"warning","context-value-unresolved":"warning","spread-unresolved":"warning","export-unresolved":"warning","module-export-conflict":"warning","extend-props-target-missing":"error","extend-props-duplicate":"warning","extend-props-override":"warning","jsdoc-unknown-tag":"warning","typedef-duplicate":"warning","property-duplicate":"warning","generics-conflict":"warning","event-description-ambiguous":"warning","jsdoc-tag-dropped":"warning","internal-typedef-referenced":"error","cross-file-unresolved":"warning","export-ambiguous":"warning"};function o(V){return{...V,code:G[V.kind],severity:wc[V.kind]}}function ie(V,K){if(K)return V;return V.filter((be)=>be.kind!=="jsdoc-unknown-tag")}function wo(V,K){if(!K)return[];return V.filter((be)=>!be.ignored&&(K!=="errors"||be.severity==="error"))}function Tc(V,K){if(K.code!==void 0&&K.code!==V.code)return!1;if(K.name!==void 0&&K.name!==V.name)return!1;if(K.component!==void 0&&!Co(K.component,V.component))return!1;return!0}function To(V,K){if(!K||K.length===0)return V;return V.map((be)=>be.ignored||K.some((Be)=>Tc(be,Be))?{...be,ignored:!0}:be)}var ko={"prop-unknown-type":"Props without inferred types","context-any-type":"Context values typed as `any`","slot-missing-type":"@slot/@snippet tags missing a {Type} annotation","slot-not-rendered":"@slot/@snippet tags for slots the component doesn't render","event-no-source":"@event tags with no dispatch or callback","dispatch-escapes":"Dispatchers passed to functions sveld can't follow","example-compile-error":"@example blocks that failed to compile","example-syntax-error":"@example blocks that failed to parse","syntax-skipped":"Component syntax sveld skipped","type-syntax-error":"JSDoc types that aren't valid TypeScript","rest-props-unresolved":"$$restProps spread only onto components","context-duplicate-key":"Duplicate setContext keys","context-key-unresolved":"setContext keys sveld couldn't resolve","context-value-unresolved":"setContext values sveld couldn't describe","spread-unresolved":"Unresolved spreads widened to Record<string, any>","export-unresolved":"Unresolved named export specifiers","module-export-conflict":"Module-script exports colliding with generated names","extend-props-target-missing":"@extends/@extendProps targets that couldn't be verified","extend-props-duplicate":"Duplicate @extends/@extendProps tags","extend-props-override":"Own props overriding an @extends target's prop","jsdoc-unknown-tag":"Unknown JSDoc tags","typedef-duplicate":"Duplicate @typedef/@callback names","property-duplicate":"Duplicate @property names","generics-conflict":"Duplicate @generics/@template names","event-description-ambiguous":"Text after an @event read as the next tag's description","jsdoc-tag-dropped":"Passthrough JSDoc tags that couldn't attach","internal-typedef-referenced":"Public types referencing an @internal typedef","cross-file-unresolved":"Imports a standalone parse couldn't read","export-ambiguous":"Ambiguous `export *` names left out of the entry exports"},Po=Object.keys(ko),G=Object.fromEntries(Po.map((V)=>[V,`sveld/${V}`]));function $o(V){let K=new Set,be=[];for(let Be of V){let Gt=`${Be.component}:${Be.kind}:${Be.name}`;if(K.has(Gt))continue;K.add(Gt),be.push(Be)}return be}function se(V){let K=V.filter((Ut)=>!Ut.ignored),be=V.length-K.length,Be=be>0?` (${be} ignored)`:"";if(K.length===0)return`sveld: no diagnostics${Be}.`;let Gt=[],Wt=(Ut,Ht)=>`${Ut} ${Ht}${Ut===1?"":"s"}`,Kt=K.filter((Ut)=>Ut.severity==="error").length,Vt=`${Wt(Kt,"error")}, ${Wt(K.length-Kt,"warning")}`;Gt.push(`sveld: ${Wt(K.length,"diagnostic")} (${Vt})${Be}.`);for(let Ut of Po){let Ht=K.filter((Yt)=>Yt.kind===Ut);if(Ht.length===0)continue;Gt.push(""),Gt.push(`${ko[Ut]} (${Ht.length}):`);let zt=new Map;for(let Yt of Ht){let Jt=zt.get(Yt.component)??[];Jt.push(Yt),zt.set(Yt.component,Jt)}for(let[Yt,Jt]of zt){Gt.push(` ${Yt}`);for(let Qt of Jt){let Zt=Qt.source?` (${Yt}:${Qt.source.start.line}:${Qt.source.start.column})`:"";Gt.push(` - ${Qt.message}${Zt} [${Qt.code}]`)}}}return Gt.join(`
|
|
2
|
-
`)}var qe=1;function oe(V){return`${JSON.stringify({kind:"diagnostics",schemaVersion:qe,diagnostics:V},null,2)}
|
|
3
|
-
`}function _i(V,K){if(K.length===0)return;V.diagnostics=[...V.diagnostics??[],...K]}var Ri={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"},Ii="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",kc={5:Ii,"5module":Ii+" export import",6:Ii+" const class extends export import super"},Ro=/^in(stanceof)?$/,Pc=/\p{ID_Start}/u,$c=/[\p{ID_Continue}\u200c\u200d]/u;function m(V,K){if(V<65)return V===36;if(V<91)return!0;if(V<97)return V===95;if(V<123)return!0;if(V>65535&&K===!1)return!1;return V>=170&&Pc.test(String.fromCodePoint(V))}function S(V,K){if(V<48)return V===36;if(V<58)return!0;if(V<65)return!1;if(V<91)return!0;if(V<97)return V===95;if(V<123)return!0;if(V>65535&&K===!1)return!1;return V>=170&&$c.test(String.fromCodePoint(V))}var pn=function(V,K){if(K===void 0)K={};this.label=V,this.keyword=K.keyword,this.beforeExpr=!!K.beforeExpr,this.startsExpr=!!K.startsExpr,this.isLoop=!!K.isLoop,this.isAssign=!!K.isAssign,this.prefix=!!K.prefix,this.postfix=!!K.postfix,this.binop=K.binop||null,this.updateContext=null};function Cn(V,K){return new pn(V,{beforeExpr:!0,binop:K})}var wn={beforeExpr:!0},vn={startsExpr:!0},Fi={};function an(V,K){if(K===void 0)K={};return K.keyword=V,Fi[V]=new pn(V,K)}var Xt={num:new pn("num",vn),regexp:new pn("regexp",vn),string:new pn("string",vn),name:new pn("name",vn),privateId:new pn("privateId",vn),eof:new pn("eof"),bracketL:new pn("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new pn("]"),braceL:new pn("{",{beforeExpr:!0,startsExpr:!0}),braceR:new pn("}"),parenL:new pn("(",{beforeExpr:!0,startsExpr:!0}),parenR:new pn(")"),comma:new pn(",",wn),semi:new pn(";",wn),colon:new pn(":",wn),dot:new pn("."),question:new pn("?",wn),questionDot:new pn("?."),arrow:new pn("=>",wn),template:new pn("template"),invalidTemplate:new pn("invalidTemplate"),ellipsis:new pn("...",wn),backQuote:new pn("`",vn),dollarBraceL:new pn("${",{beforeExpr:!0,startsExpr:!0}),eq:new pn("=",{beforeExpr:!0,isAssign:!0}),assign:new pn("_=",{beforeExpr:!0,isAssign:!0}),incDec:new pn("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new pn("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Cn("||",1),logicalAND:Cn("&&",2),bitwiseOR:Cn("|",3),bitwiseXOR:Cn("^",4),bitwiseAND:Cn("&",5),equality:Cn("==/!=/===/!==",6),relational:Cn("</>/<=/>=",7),bitShift:Cn("<</>>/>>>",8),plusMin:new pn("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Cn("%",10),star:Cn("*",10),slash:Cn("/",10),starstar:new pn("**",{beforeExpr:!0}),coalesce:Cn("??",1),_break:an("break"),_case:an("case",wn),_catch:an("catch"),_continue:an("continue"),_debugger:an("debugger"),_default:an("default",wn),_do:an("do",{isLoop:!0,beforeExpr:!0}),_else:an("else",wn),_finally:an("finally"),_for:an("for",{isLoop:!0}),_function:an("function",vn),_if:an("if"),_return:an("return",wn),_switch:an("switch"),_throw:an("throw",wn),_try:an("try"),_var:an("var"),_const:an("const"),_while:an("while",{isLoop:!0}),_with:an("with"),_new:an("new",{beforeExpr:!0,startsExpr:!0}),_this:an("this",vn),_super:an("super",vn),_class:an("class",vn),_extends:an("extends",wn),_export:an("export"),_import:an("import",vn),_null:an("null",vn),_true:an("true",vn),_false:an("false",vn),_in:an("in",{beforeExpr:!0,binop:7}),_instanceof:an("instanceof",{beforeExpr:!0,binop:7}),_typeof:an("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:an("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:an("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},En=/\r\n?|\n|\u2028|\u2029/,Ac=new RegExp(En.source,"g");function os(V){return V===10||V===13||V===8232||V===8233}function Io(V,K,be){if(be===void 0)be=V.length;for(var Be=K;Be<be;Be++){var Gt=V.charCodeAt(Be);if(os(Gt))return Be<be-1&&Gt===13&&V.charCodeAt(Be+1)===10?Be+2:Be+1}return-1}var Lo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,dn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Dc=Object.prototype,{hasOwnProperty:Nc,toString:_c}=Dc,Cs=Object.hasOwn||function(V,K){return Nc.call(V,K)},Ao=Array.isArray||function(V){return _c.call(V)==="[object Array]"},Do=Object.create(null);function js(V){return Do[V]||(Do[V]=new RegExp("^(?:"+V.replace(/ /g,"|")+")$"))}function Ws(V){if(V<=65535)return String.fromCharCode(V);return V-=65536,String.fromCharCode((V>>10)+55296,(V&1023)+56320)}var Rc=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ss=function(V,K){this.line=V,this.column=K};Ss.prototype.offset=function(V){return new Ss(this.line,this.column+V)};var Us=function(V,K,be){if(this.start=K,this.end=be,V.sourceFile!==null)this.source=V.sourceFile};function Oo(V,K){for(var be=1,Be=0;;){var Gt=Io(V,Be,K);if(Gt<0)return new Ss(be,K-Be);++be,Be=Gt}}var Li={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},No=!1;function Ic(V){var K={};for(var be in Li)K[be]=V&&Cs(V,be)?V[be]:Li[be];if(K.ecmaVersion==="latest")K.ecmaVersion=1e8;else if(K.ecmaVersion==null){if(!No&&typeof console==="object"&&console.warn)No=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
4
|
-
Defaulting to 2020, but this will stop working in the future.`);K.ecmaVersion=11}else if(K.ecmaVersion>=2015)K.ecmaVersion-=2009;if(K.allowReserved==null)K.allowReserved=K.ecmaVersion<5;if(!V||V.allowHashBang==null)K.allowHashBang=K.ecmaVersion>=14;if(Ao(K.onToken)){var Be=K.onToken;K.onToken=function(Gt){return Be.push(Gt)}}if(Ao(K.onComment))K.onComment=Lc(K,K.onComment);if(K.sourceType==="commonjs"&&K.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return K}function Lc(V,K){return function(be,Be,Gt,Wt,Kt,Vt){var Ut={type:be?"Block":"Line",value:Be,start:Gt,end:Wt};if(V.locations)Ut.loc=new Us(this,Kt,Vt);if(V.ranges)Ut.range=[Gt,Wt];K.push(Ut)}}var Xn=1,Jn=2,ji=4,Mo=8,Bi=16,Fo=32,Ks=64,jo=128,Yn=256,ws=512,Bo=1024,Hs=Xn|Jn|Yn;function Vi(V,K){return Jn|(V?ji:0)|(K?Mo:0)}var Bs=0,Gi=1,Mn=2,Vo=3,Go=4,Wo=5,r=function(V,K,be){this.options=V=Ic(V),this.sourceFile=V.sourceFile,this.keywords=js(kc[V.ecmaVersion>=6?6:V.sourceType==="module"?"5module":5]);var Be="";if(V.allowReserved!==!0){if(Be=Ri[V.ecmaVersion>=6?6:V.ecmaVersion===5?5:3],V.sourceType==="module")Be+=" await"}this.reservedWords=js(Be);var Gt=(Be?Be+" ":"")+Ri.strict;if(this.reservedWordsStrict=js(Gt),this.reservedWordsStrictBind=js(Gt+" "+Ri.strictBind),this.input=String(K),this.containsEsc=!1,this.pos=be||0,this.curLine=1,V.startLocation)this.lineStart=this.pos-V.startLocation.column,this.curLine=V.startLocation.line;else if(be){if(this.lineStart=this.input.lastIndexOf(`
|
|
5
|
-
`,be-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(En).length}else this.lineStart=0;if(this.type=Xt.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=V.sourceType==="module",this.strict=this.inModule||V.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&&V.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Jn:Xn),this.regexpState=null,this.privateNameStack=[]},Tn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};r.prototype.parse=function(){var V=this,K=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return V.parseTopLevel(K)})};Tn.inFunction.get=function(){return(this.currentVarScope().flags&Jn)>0};Tn.inGenerator.get=function(){return(this.currentVarScope().flags&Mo)>0};Tn.inAsync.get=function(){return(this.currentVarScope().flags&ji)>0};Tn.canAwait.get=function(){for(var V=this.scopeStack.length-1;V>=0;V--){var K=this.scopeStack[V],be=K.flags;if(be&(Yn|ws))return!1;if(be&Jn)return(be&ji)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Tn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Xn)return!0;return!1};Tn.allowSuper.get=function(){var V=this.currentThisScope(),K=V.flags;return(K&Ks)>0||this.options.allowSuperOutsideMethod};Tn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&jo)>0};Tn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Tn.allowNewDotTarget.get=function(){for(var V=this.scopeStack.length-1;V>=0;V--){var K=this.scopeStack[V],be=K.flags;if(be&(Yn|ws)||be&Jn&&!(be&Bi))return!0}return!1};Tn.allowUsing.get=function(){var V=this.currentScope(),K=V.flags;if(K&Bo)return!1;if(!this.inModule&&K&Xn)return!1;return!0};Tn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Yn)>0};r.extend=function(){var V=[],K=arguments.length;while(K--)V[K]=arguments[K];var be=this;for(var Be=0;Be<V.length;Be++)be=V[Be](be);return be};r.parse=function(V,K){return new this(K,V).parse()};r.parseExpressionAt=function(V,K,be){var Be=new this(be,V,K);return Be.nextToken(),Be.parseExpression()};r.tokenizer=function(V,K){return new this(K,V)};Object.defineProperties(r.prototype,Tn);var gn=r.prototype,Oc=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;gn.strictDirective=function(V){if(this.options.ecmaVersion<5)return!1;for(;;){dn.lastIndex=V,V+=dn.exec(this.input)[0].length;var K=Oc.exec(this.input.slice(V));if(!K)return!1;if((K[1]||K[2])==="use strict"){dn.lastIndex=V+K[0].length;var be=dn.exec(this.input),Be=be.index+be[0].length,Gt=this.input.charAt(Be);return Gt===";"||Gt==="}"||En.test(be[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Gt)||Gt==="!"&&this.input.charAt(Be+1)==="=")}if(V+=K[0].length,dn.lastIndex=V,V+=dn.exec(this.input)[0].length,this.input[V]===";")V++}};gn.eat=function(V){if(this.type===V)return this.next(),!0;else return!1};gn.isContextual=function(V){return this.type===Xt.name&&this.value===V&&!this.containsEsc};gn.eatContextual=function(V){if(!this.isContextual(V))return!1;return this.next(),!0};gn.catchStackOverflow=function(V){try{return V()}catch(K){if(K instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(K.message)||/\btoo much recursion\b/i.test(K.message)))this.raise(this.start,"Not enough stack space to parse input");else throw K}};gn.expectContextual=function(V){if(!this.eatContextual(V))this.unexpected()};gn.canInsertSemicolon=function(){return this.type===Xt.eof||this.type===Xt.braceR||En.test(this.input.slice(this.lastTokEnd,this.start))};gn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};gn.semicolon=function(){if(!this.eat(Xt.semi)&&!this.insertSemicolon())this.unexpected()};gn.afterTrailingComma=function(V,K){if(this.type===V){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!K)this.next();return!0}};gn.expect=function(V){this.eat(V)||this.unexpected()};gn.unexpected=function(V){this.raise(V!=null?V:this.start,"Unexpected token")};var qs=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};gn.checkPatternErrors=function(V,K){if(!V)return;if(V.trailingComma>-1)this.raiseRecoverable(V.trailingComma,"Comma is not permitted after the rest element");var be=K?V.parenthesizedAssign:V.parenthesizedBind;if(be>-1)this.raiseRecoverable(be,K?"Assigning to rvalue":"Parenthesized pattern")};gn.checkExpressionErrors=function(V,K){if(!V)return!1;var{shorthandAssign:be,doubleProto:Be}=V;if(!K)return be>=0||Be>=0;if(be>=0)this.raise(be,"Shorthand property assignments are valid only in destructuring patterns");if(Be>=0)this.raiseRecoverable(Be,"Redefinition of __proto__ property")};gn.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};gn.isSimpleAssignTarget=function(V){if(V.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(V.expression);return V.type==="Identifier"||V.type==="MemberExpression"};var nn=r.prototype;nn.parseTopLevel=function(V){var K=Object.create(null);if(!V.body)V.body=[];while(this.type!==Xt.eof){var be=this.parseStatement(null,!0,K);V.body.push(be)}if(this.inModule)for(var Be=0,Gt=Object.keys(this.undefinedExports);Be<Gt.length;Be+=1){var Wt=Gt[Be];this.raiseRecoverable(this.undefinedExports[Wt].start,"Export '"+Wt+"' is not defined")}return this.adaptDirectivePrologue(V.body),this.next(),V.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(V,"Program")};var Wi={kind:"loop"},Mc={kind:"switch"};nn.isLet=function(V){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;dn.lastIndex=this.pos;var K=dn.exec(this.input),be=this.pos+K[0].length,Be=this.fullCharCodeAt(be);if(Be===91||Be===92)return!0;if(V)return!1;if(Be===123)return!0;if(m(Be)){var Gt=be;do be+=Be<=65535?1:2;while(S(Be=this.fullCharCodeAt(be)));if(Be===92)return!0;var Wt=this.input.slice(Gt,be);if(!Ro.test(Wt))return!0}return!1};nn.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;dn.lastIndex=this.pos;var V=dn.exec(this.input),K=this.pos+V[0].length,be;return!En.test(this.input.slice(this.pos,K))&&this.input.slice(K,K+8)==="function"&&(K+8===this.input.length||!(S(be=this.fullCharCodeAt(K+8))||be===92))};nn.isUsingKeyword=function(V,K){if(this.options.ecmaVersion<17||!this.isContextual(V?"await":"using"))return!1;dn.lastIndex=this.pos;var be=dn.exec(this.input),Be=this.pos+be[0].length;if(En.test(this.input.slice(this.pos,Be)))return!1;if(V){var Gt=Be+5,Wt;if(this.input.slice(Be,Gt)!=="using"||Gt===this.input.length||S(Wt=this.fullCharCodeAt(Gt))||Wt===92)return!1;dn.lastIndex=Gt;var Kt=dn.exec(this.input);if(Be=Gt+Kt[0].length,Kt&&En.test(this.input.slice(Gt,Be)))return!1}var Vt=this.fullCharCodeAt(Be);if(!m(Vt)&&Vt!==92)return!1;var Ut=Be;do Be+=Vt<=65535?1:2;while(S(Vt=this.fullCharCodeAt(Be)));if(Vt===92)return!0;var Ht=this.input.slice(Ut,Be);if(Ro.test(Ht))return!1;if(K&&!V&&Ht==="of"){dn.lastIndex=Be;var zt=dn.exec(this.input);if(Be=Be+zt[0].length,this.input.charCodeAt(Be)!==61||(Vt=this.input.charCodeAt(Be+1))===61||Vt===62)return!1}return!0};nn.isAwaitUsing=function(V){return this.isUsingKeyword(!0,V)};nn.isUsing=function(V){return this.isUsingKeyword(!1,V)};nn.parseStatement=function(V,K,be){var Be=this.type,Gt=this.startNode(),Wt;if(this.isLet(V))Be=Xt._var,Wt="let";switch(Be){case Xt._break:case Xt._continue:return this.parseBreakContinueStatement(Gt,Be.keyword);case Xt._debugger:return this.parseDebuggerStatement(Gt);case Xt._do:return this.parseDoStatement(Gt);case Xt._for:return this.parseForStatement(Gt);case Xt._function:if(V&&(this.strict||V!=="if"&&V!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Gt,!1,!V);case Xt._class:if(V)this.unexpected();return this.parseClass(Gt,!0);case Xt._if:return this.parseIfStatement(Gt);case Xt._return:return this.parseReturnStatement(Gt);case Xt._switch:return this.parseSwitchStatement(Gt);case Xt._throw:return this.parseThrowStatement(Gt);case Xt._try:return this.parseTryStatement(Gt);case Xt._const:case Xt._var:if(Wt=Wt||this.value,V&&Wt!=="var")this.unexpected();return this.parseVarStatement(Gt,Wt);case Xt._while:return this.parseWhileStatement(Gt);case Xt._with:return this.parseWithStatement(Gt);case Xt.braceL:return this.parseBlock(!0,Gt);case Xt.semi:return this.parseEmptyStatement(Gt);case Xt._export:case Xt._import:if(this.options.ecmaVersion>10&&Be===Xt._import){dn.lastIndex=this.pos;var Kt=dn.exec(this.input),Vt=this.pos+Kt[0].length,Ut=this.input.charCodeAt(Vt);if(Ut===40||Ut===46)return this.parseExpressionStatement(Gt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!K)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 Be===Xt._import?this.parseImport(Gt):this.parseExport(Gt,be);default:if(this.isAsyncFunction()){if(V)this.unexpected();return this.next(),this.parseFunctionStatement(Gt,!0,!V)}var Ht=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Ht){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(V)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Ht==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Gt,!1,Ht),this.semicolon(),this.finishNode(Gt,"VariableDeclaration")}var zt=this.value,Yt=this.parseExpression();if(Be===Xt.name&&Yt.type==="Identifier"&&this.eat(Xt.colon))return this.parseLabeledStatement(Gt,zt,Yt,V);else return this.parseExpressionStatement(Gt,Yt)}};nn.parseBreakContinueStatement=function(V,K){var be=K==="break";if(this.next(),this.eat(Xt.semi)||this.insertSemicolon())V.label=null;else if(this.type!==Xt.name)this.unexpected();else V.label=this.parseIdent(),this.semicolon();var Be=0;for(;Be<this.labels.length;++Be){var Gt=this.labels[Be];if(V.label==null||Gt.name===V.label.name){if(Gt.kind!=null&&(be||Gt.kind==="loop"))break;if(V.label&&be)break}}if(Be===this.labels.length)this.raise(V.start,"Unsyntactic "+K);return this.finishNode(V,be?"BreakStatement":"ContinueStatement")};nn.parseDebuggerStatement=function(V){return this.next(),this.semicolon(),this.finishNode(V,"DebuggerStatement")};nn.parseDoStatement=function(V){if(this.next(),this.labels.push(Wi),V.body=this.parseStatement("do"),this.labels.pop(),this.expect(Xt._while),V.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Xt.semi);else this.semicolon();return this.finishNode(V,"DoWhileStatement")};nn.parseForStatement=function(V){this.next();var K=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Wi),this.enterScope(0),this.expect(Xt.parenL),this.type===Xt.semi){if(K>-1)this.unexpected(K);return this.parseFor(V,null)}var be=this.isLet();if(this.type===Xt._var||this.type===Xt._const||be){var Be=this.startNode(),Gt=be?"let":this.value;return this.next(),this.parseVar(Be,!0,Gt),this.finishNode(Be,"VariableDeclaration"),this.parseForAfterInit(V,Be,K)}var Wt=this.isContextual("let"),Kt=!1,Vt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Vt){var Ut=this.startNode();if(this.next(),Vt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Ut,!0,Vt),this.finishNode(Ut,"VariableDeclaration"),this.parseForAfterInit(V,Ut,K)}var Ht=this.containsEsc,zt=new qs,Yt=this.start,Jt=K>-1?this.parseExprSubscripts(zt,"await"):this.parseExpression(!0,zt);if(this.type===Xt._in||(Kt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(K>-1){if(this.type===Xt._in)this.unexpected(K);V.await=!0}else if(Kt&&this.options.ecmaVersion>=8){if(Jt.start===Yt&&!Ht&&Jt.type==="Identifier"&&Jt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)V.await=!1}if(Wt&&Kt)this.raise(Jt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(Jt,!1,zt),this.checkLValPattern(Jt),this.parseForIn(V,Jt)}else this.checkExpressionErrors(zt,!0);if(K>-1)this.unexpected(K);return this.parseFor(V,Jt)};nn.parseForAfterInit=function(V,K,be){if((this.type===Xt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&K.declarations.length===1){if(this.type===Xt._in){if((K.kind==="using"||K.kind==="await using")&&!K.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&be>-1)this.unexpected(be)}else if(this.options.ecmaVersion>=9)V.await=be>-1;return this.parseForIn(V,K)}if(be>-1)this.unexpected(be);return this.parseFor(V,K)};nn.parseFunctionStatement=function(V,K,be){return this.next(),this.parseFunction(V,bs|(be?0:Oi),!1,K)};nn.parseIfStatement=function(V){return this.next(),V.test=this.parseParenExpression(),V.consequent=this.parseStatement("if"),V.alternate=this.eat(Xt._else)?this.parseStatement("if"):null,this.finishNode(V,"IfStatement")};nn.parseReturnStatement=function(V){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Xt.semi)||this.insertSemicolon())V.argument=null;else V.argument=this.parseExpression(),this.semicolon();return this.finishNode(V,"ReturnStatement")};nn.parseSwitchStatement=function(V){this.next(),V.discriminant=this.parseParenExpression(),V.cases=[],this.expect(Xt.braceL),this.labels.push(Mc),this.enterScope(Bo);var K;for(var be=!1;this.type!==Xt.braceR;)if(this.type===Xt._case||this.type===Xt._default){var Be=this.type===Xt._case;if(K)this.finishNode(K,"SwitchCase");if(V.cases.push(K=this.startNode()),K.consequent=[],this.next(),Be)K.test=this.parseExpression();else{if(be)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");be=!0,K.test=null}this.expect(Xt.colon)}else{if(!K)this.unexpected();K.consequent.push(this.parseStatement(null))}if(this.exitScope(),K)this.finishNode(K,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(V,"SwitchStatement")};nn.parseThrowStatement=function(V){if(this.next(),En.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return V.argument=this.parseExpression(),this.semicolon(),this.finishNode(V,"ThrowStatement")};var Fc=[];nn.parseCatchClauseParam=function(){var V=this.parseBindingAtom(),K=V.type==="Identifier";return this.enterScope(K?Fo:0),this.checkLValPattern(V,K?Go:Mn),this.expect(Xt.parenR),V};nn.parseTryStatement=function(V){if(this.next(),V.block=this.parseBlock(),V.handler=null,this.type===Xt._catch){var K=this.startNode();if(this.next(),this.eat(Xt.parenL))K.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();K.param=null,this.enterScope(0)}K.body=this.parseBlock(!1),this.exitScope(),V.handler=this.finishNode(K,"CatchClause")}if(V.finalizer=this.eat(Xt._finally)?this.parseBlock():null,!V.handler&&!V.finalizer)this.raise(V.start,"Missing catch or finally clause");return this.finishNode(V,"TryStatement")};nn.parseVarStatement=function(V,K,be){return this.next(),this.parseVar(V,!1,K,be),this.semicolon(),this.finishNode(V,"VariableDeclaration")};nn.parseWhileStatement=function(V){return this.next(),V.test=this.parseParenExpression(),this.labels.push(Wi),V.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(V,"WhileStatement")};nn.parseWithStatement=function(V){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),V.object=this.parseParenExpression(),V.body=this.parseStatement("with"),this.finishNode(V,"WithStatement")};nn.parseEmptyStatement=function(V){return this.next(),this.finishNode(V,"EmptyStatement")};nn.parseLabeledStatement=function(V,K,be,Be){for(var Gt=0,Wt=this.labels;Gt<Wt.length;Gt+=1){var Kt=Wt[Gt];if(Kt.name===K)this.raise(be.start,"Label '"+K+"' is already declared")}var Vt=this.type.isLoop?"loop":this.type===Xt._switch?"switch":null;for(var Ut=this.labels.length-1;Ut>=0;Ut--){var Ht=this.labels[Ut];if(Ht.statementStart===V.start)Ht.statementStart=this.start,Ht.kind=Vt;else break}return this.labels.push({name:K,kind:Vt,statementStart:this.start}),V.body=this.parseStatement(Be?Be.indexOf("label")===-1?Be+"label":Be:"label"),this.labels.pop(),V.label=be,this.finishNode(V,"LabeledStatement")};nn.parseExpressionStatement=function(V,K){return V.expression=K,this.semicolon(),this.finishNode(V,"ExpressionStatement")};nn.parseBlock=function(V,K,be){if(V===void 0)V=!0;if(K===void 0)K=this.startNode();if(K.body=[],this.expect(Xt.braceL),V)this.enterScope(0);while(this.type!==Xt.braceR){var Be=this.parseStatement(null);K.body.push(Be)}if(be)this.strict=!1;if(this.next(),V)this.exitScope();return this.finishNode(K,"BlockStatement")};nn.parseFor=function(V,K){return V.init=K,this.expect(Xt.semi),V.test=this.type===Xt.semi?null:this.parseExpression(),this.expect(Xt.semi),V.update=this.type===Xt.parenR?null:this.parseExpression(),this.expect(Xt.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,"ForStatement")};nn.parseForIn=function(V,K){var be=this.type===Xt._in;if(this.next(),K.type==="VariableDeclaration"&&K.declarations[0].init!=null&&(!be||this.options.ecmaVersion<8||this.strict||K.kind!=="var"||K.declarations[0].id.type!=="Identifier"))this.raise(K.start,(be?"for-in":"for-of")+" loop variable declaration may not have an initializer");return V.left=K,V.right=be?this.parseExpression():this.parseMaybeAssign(),this.expect(Xt.parenR),V.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(V,be?"ForInStatement":"ForOfStatement")};nn.parseVar=function(V,K,be,Be){V.declarations=[],V.kind=be;for(;;){var Gt=this.startNode();if(this.parseVarId(Gt,be),this.eat(Xt.eq))Gt.init=this.parseMaybeAssign(K);else if(!Be&&be==="const"&&!(this.type===Xt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Be&&(be==="using"||be==="await using")&&this.options.ecmaVersion>=17&&this.type!==Xt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+be+" declaration");else if(!Be&&Gt.id.type!=="Identifier"&&!(K&&(this.type===Xt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Gt.init=null;if(V.declarations.push(this.finishNode(Gt,"VariableDeclarator")),!this.eat(Xt.comma))break}return V};nn.parseVarId=function(V,K){V.id=K==="using"||K==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(V.id,K==="var"?Gi:Mn,!1)};var bs=1,Oi=2,Uo=4;nn.parseFunction=function(V,K,be,Be,Gt){if(this.initFunction(V),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Be){if(this.type===Xt.star&&K&Oi)this.unexpected();V.generator=this.eat(Xt.star)}if(this.options.ecmaVersion>=8)V.async=!!Be;if(K&bs){if(V.id=K&Uo&&this.type!==Xt.name?null:this.parseIdent(),V.id&&!(K&Oi))this.checkLValSimple(V.id,this.strict||V.generator||V.async?this.treatFunctionsAsVar?Gi:Mn:Vo)}var Wt=this.yieldPos,Kt=this.awaitPos,Vt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Vi(V.async,V.generator)),!(K&bs))V.id=this.type===Xt.name?this.parseIdent():null;return this.parseFunctionParams(V),this.parseFunctionBody(V,be,!1,Gt),this.yieldPos=Wt,this.awaitPos=Kt,this.awaitIdentPos=Vt,this.finishNode(V,K&bs?"FunctionDeclaration":"FunctionExpression")};nn.parseFunctionParams=function(V){this.expect(Xt.parenL),V.params=this.parseBindingList(Xt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};nn.parseClass=function(V,K){this.next();var be=this.strict;this.strict=!0,this.parseClassId(V,K),this.parseClassSuper(V);var Be=this.enterClassBody(),Gt=this.startNode(),Wt=!1;Gt.body=[],this.expect(Xt.braceL);while(this.type!==Xt.braceR){var Kt=this.parseClassElement(V.superClass!==null);if(Kt){if(Gt.body.push(Kt),Kt.type==="MethodDefinition"&&Kt.kind==="constructor"){if(Wt)this.raiseRecoverable(Kt.start,"Duplicate constructor in the same class");Wt=!0}else if(Kt.key&&Kt.key.type==="PrivateIdentifier"&&jc(Be,Kt))this.raiseRecoverable(Kt.key.start,"Identifier '#"+Kt.key.name+"' has already been declared")}}return this.strict=be,this.next(),V.body=this.finishNode(Gt,"ClassBody"),this.exitClassBody(),this.finishNode(V,K?"ClassDeclaration":"ClassExpression")};nn.parseClassElement=function(V){if(this.eat(Xt.semi))return null;var K=this.options.ecmaVersion,be=this.startNode(),Be="",Gt=!1,Wt=!1,Kt="method",Vt=!1;if(this.eatContextual("static")){if(K>=13&&this.eat(Xt.braceL))return this.parseClassStaticBlock(be),be;if(this.isClassElementNameStart()||this.type===Xt.star)Vt=!0;else Be="static"}if(be.static=Vt,!Be&&K>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Xt.star)&&!this.canInsertSemicolon())Wt=!0;else Be="async";if(!Be&&(K>=9||!Wt)&&this.eat(Xt.star))Gt=!0;if(!Be&&!Wt&&!Gt){var Ut=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Kt=Ut;else Be=Ut}if(Be)be.computed=!1,be.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),be.key.name=Be,this.finishNode(be.key,"Identifier");else this.parseClassElementName(be);if(K<13||this.type===Xt.parenL||Kt!=="method"||Gt||Wt){var Ht=!be.static&&Vs(be,"constructor"),zt=Ht&&V;if(Ht&&Kt!=="method")this.raise(be.key.start,"Constructor can't have get/set modifier");be.kind=Ht?"constructor":Kt,this.parseClassMethod(be,Gt,Wt,zt)}else this.parseClassField(be);return be};nn.isClassElementNameStart=function(){return this.type===Xt.name||this.type===Xt.privateId||this.type===Xt.num||this.type===Xt.string||this.type===Xt.bracketL||this.type.keyword};nn.parseClassElementName=function(V){if(this.type===Xt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");V.computed=!1,V.key=this.parsePrivateIdent()}else this.parsePropertyName(V)};nn.parseClassMethod=function(V,K,be,Be){var Gt=V.key;if(V.kind==="constructor"){if(K)this.raise(Gt.start,"Constructor can't be a generator");if(be)this.raise(Gt.start,"Constructor can't be an async method")}else if(V.static&&Vs(V,"prototype"))this.raise(Gt.start,"Classes may not have a static property named prototype");var Wt=V.value=this.parseMethod(K,be,Be);if(V.kind==="get"&&Wt.params.length!==0)this.raiseRecoverable(Wt.start,"getter should have no params");if(V.kind==="set"&&Wt.params.length!==1)this.raiseRecoverable(Wt.start,"setter should have exactly one param");if(V.kind==="set"&&Wt.params[0].type==="RestElement")this.raiseRecoverable(Wt.params[0].start,"Setter cannot use rest params");return this.finishNode(V,"MethodDefinition")};nn.parseClassField=function(V){if(Vs(V,"constructor"))this.raise(V.key.start,"Classes can't have a field named 'constructor'");else if(V.static&&Vs(V,"prototype"))this.raise(V.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Xt.eq))this.enterScope(ws|Ks),V.value=this.parseMaybeAssign(),this.exitScope();else V.value=null;return this.semicolon(),this.finishNode(V,"PropertyDefinition")};nn.parseClassStaticBlock=function(V){V.body=[];var K=this.labels;this.labels=[],this.enterScope(Yn|Ks);while(this.type!==Xt.braceR){var be=this.parseStatement(null);V.body.push(be)}return this.next(),this.exitScope(),this.labels=K,this.finishNode(V,"StaticBlock")};nn.parseClassId=function(V,K){if(this.type===Xt.name){if(V.id=this.parseIdent(),K)this.checkLValSimple(V.id,Mn,!1)}else{if(K===!0)this.unexpected();V.id=null}};nn.parseClassSuper=function(V){V.superClass=this.eat(Xt._extends)?this.parseExprSubscripts(null,!1):null};nn.enterClassBody=function(){var V={declared:Object.create(null),used:[]};return this.privateNameStack.push(V),V.declared};nn.exitClassBody=function(){var V=this.privateNameStack.pop(),{declared:K,used:be}=V;if(!this.options.checkPrivateFields)return;var Be=this.privateNameStack.length,Gt=Be===0?null:this.privateNameStack[Be-1];for(var Wt=0;Wt<be.length;++Wt){var Kt=be[Wt];if(!Cs(K,Kt.name))if(Gt)Gt.used.push(Kt);else this.raiseRecoverable(Kt.start,"Private field '#"+Kt.name+"' must be declared in an enclosing class")}};function jc(V,K){var be=K.key.name,Be=V[be],Gt="true";if(K.type==="MethodDefinition"&&(K.kind==="get"||K.kind==="set"))Gt=(K.static?"s":"i")+K.kind;if(Be==="iget"&&Gt==="iset"||Be==="iset"&&Gt==="iget"||Be==="sget"&&Gt==="sset"||Be==="sset"&&Gt==="sget")return V[be]="true",!1;else if(!Be)return V[be]=Gt,!1;else return!0}function Vs(V,K){var{computed:be,key:Be}=V;return!be&&(Be.type==="Identifier"&&Be.name===K||Be.type==="Literal"&&Be.value===K)}nn.parseExportAllDeclaration=function(V,K){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))V.exported=this.parseModuleExportName(),this.checkExport(K,V.exported,this.lastTokStart);else V.exported=null;if(this.expectContextual("from"),this.type!==Xt.string)this.unexpected();if(V.source=this.parseExprAtom(),this.options.ecmaVersion>=16)V.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(V,"ExportAllDeclaration")};nn.parseExport=function(V,K){if(this.next(),this.eat(Xt.star))return this.parseExportAllDeclaration(V,K);if(this.eat(Xt._default))return this.checkExport(K,"default",this.lastTokStart),V.declaration=this.parseExportDefaultDeclaration(),this.finishNode(V,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(V.declaration=this.parseExportDeclaration(V),V.declaration.type==="VariableDeclaration")this.checkVariableExport(K,V.declaration.declarations);else this.checkExport(K,V.declaration.id,V.declaration.id.start);if(V.specifiers=[],V.source=null,this.options.ecmaVersion>=16)V.attributes=[]}else{if(V.declaration=null,V.specifiers=this.parseExportSpecifiers(K),this.eatContextual("from")){if(this.type!==Xt.string)this.unexpected();if(V.source=this.parseExprAtom(),this.options.ecmaVersion>=16)V.attributes=this.parseWithClause()}else{for(var be=0,Be=V.specifiers;be<Be.length;be+=1){var Gt=Be[be];if(this.checkUnreserved(Gt.local),this.checkLocalExport(Gt.local),Gt.local.type==="Literal")this.raise(Gt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(V.source=null,this.options.ecmaVersion>=16)V.attributes=[]}this.semicolon()}return this.finishNode(V,"ExportNamedDeclaration")};nn.parseExportDeclaration=function(V){return this.parseStatement(null)};nn.parseExportDefaultDeclaration=function(){var V;if(this.type===Xt._function||(V=this.isAsyncFunction())){var K=this.startNode();if(this.next(),V)this.next();return this.parseFunction(K,bs|Uo,!1,V)}else if(this.type===Xt._class){var be=this.startNode();return this.parseClass(be,"nullableID")}else{var Be=this.parseMaybeAssign();return this.semicolon(),Be}};nn.checkExport=function(V,K,be){if(!V)return;if(typeof K!=="string")K=K.type==="Identifier"?K.name:K.value;if(Cs(V,K))this.raiseRecoverable(be,"Duplicate export '"+K+"'");V[K]=!0};nn.checkPatternExport=function(V,K){var be=K.type;if(be==="Identifier")this.checkExport(V,K,K.start);else if(be==="ObjectPattern")for(var Be=0,Gt=K.properties;Be<Gt.length;Be+=1){var Wt=Gt[Be];this.checkPatternExport(V,Wt)}else if(be==="ArrayPattern")for(var Kt=0,Vt=K.elements;Kt<Vt.length;Kt+=1){var Ut=Vt[Kt];if(Ut)this.checkPatternExport(V,Ut)}else if(be==="Property")this.checkPatternExport(V,K.value);else if(be==="AssignmentPattern")this.checkPatternExport(V,K.left);else if(be==="RestElement")this.checkPatternExport(V,K.argument)};nn.checkVariableExport=function(V,K){if(!V)return;for(var be=0,Be=K;be<Be.length;be+=1){var Gt=Be[be];this.checkPatternExport(V,Gt.id)}};nn.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};nn.parseExportSpecifier=function(V){var K=this.startNode();return K.local=this.parseModuleExportName(),K.exported=this.eatContextual("as")?this.parseModuleExportName():K.local,this.checkExport(V,K.exported,K.exported.start),this.finishNode(K,"ExportSpecifier")};nn.parseExportSpecifiers=function(V){var K=[],be=!0;this.expect(Xt.braceL);while(!this.eat(Xt.braceR)){if(!be){if(this.expect(Xt.comma),this.afterTrailingComma(Xt.braceR))break}else be=!1;K.push(this.parseExportSpecifier(V))}return K};nn.parseImport=function(V){if(this.next(),this.type===Xt.string)V.specifiers=Fc,V.source=this.parseExprAtom();else V.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),V.source=this.type===Xt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)V.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(V,"ImportDeclaration")};nn.parseImportSpecifier=function(){var V=this.startNode();if(V.imported=this.parseModuleExportName(),this.eatContextual("as"))V.local=this.parseIdent();else this.checkUnreserved(V.imported),V.local=V.imported;return this.checkLValSimple(V.local,Mn),this.finishNode(V,"ImportSpecifier")};nn.parseImportDefaultSpecifier=function(){var V=this.startNode();return V.local=this.parseIdent(),this.checkLValSimple(V.local,Mn),this.finishNode(V,"ImportDefaultSpecifier")};nn.parseImportNamespaceSpecifier=function(){var V=this.startNode();return this.next(),this.expectContextual("as"),V.local=this.parseIdent(),this.checkLValSimple(V.local,Mn),this.finishNode(V,"ImportNamespaceSpecifier")};nn.parseImportSpecifiers=function(){var V=[],K=!0;if(this.type===Xt.name){if(V.push(this.parseImportDefaultSpecifier()),!this.eat(Xt.comma))return V}if(this.type===Xt.star)return V.push(this.parseImportNamespaceSpecifier()),V;this.expect(Xt.braceL);while(!this.eat(Xt.braceR)){if(!K){if(this.expect(Xt.comma),this.afterTrailingComma(Xt.braceR))break}else K=!1;V.push(this.parseImportSpecifier())}return V};nn.parseWithClause=function(){var V=[];if(!this.eat(Xt._with))return V;this.expect(Xt.braceL);var K={},be=!0;while(!this.eat(Xt.braceR)){if(!be){if(this.expect(Xt.comma),this.afterTrailingComma(Xt.braceR))break}else be=!1;var Be=this.parseImportAttribute(),Gt=Be.key.type==="Identifier"?Be.key.name:Be.key.value;if(Cs(K,Gt))this.raiseRecoverable(Be.key.start,"Duplicate attribute key '"+Gt+"'");K[Gt]=!0,V.push(Be)}return V};nn.parseImportAttribute=function(){var V=this.startNode();if(V.key=this.type===Xt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Xt.colon),this.type!==Xt.string)this.unexpected();return V.value=this.parseExprAtom(),this.finishNode(V,"ImportAttribute")};nn.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Xt.string){var V=this.parseLiteral(this.value);if(Rc.test(V.value))this.raise(V.start,"An export name cannot include a lone surrogate.");return V}return this.parseIdent(!0)};nn.adaptDirectivePrologue=function(V){for(var K=0;K<V.length&&this.isDirectiveCandidate(V[K]);++K)V[K].directive=V[K].expression.raw.slice(1,-1)};nn.isDirectiveCandidate=function(V){return this.options.ecmaVersion>=5&&V.type==="ExpressionStatement"&&V.expression.type==="Literal"&&typeof V.expression.value==="string"&&(this.input[V.start]==='"'||this.input[V.start]==="'")};var kn=r.prototype;kn.toAssignable=function(V,K,be){if(this.options.ecmaVersion>=6&&V)switch(V.type){case"Identifier":if(this.inAsync&&V.name==="await")this.raise(V.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(V.type="ObjectPattern",be)this.checkPatternErrors(be,!0);for(var Be=0,Gt=V.properties;Be<Gt.length;Be+=1){var Wt=Gt[Be];if(this.toAssignable(Wt,K),Wt.type==="RestElement"&&(Wt.argument.type==="ArrayPattern"||Wt.argument.type==="ObjectPattern"))this.raise(Wt.argument.start,"Unexpected token")}break;case"Property":if(V.kind!=="init")this.raise(V.key.start,"Object pattern can't contain getter or setter");this.toAssignable(V.value,K);break;case"ArrayExpression":if(V.type="ArrayPattern",be)this.checkPatternErrors(be,!0);this.toAssignableList(V.elements,K);break;case"SpreadElement":if(V.type="RestElement",this.toAssignable(V.argument,K),V.argument.type==="AssignmentPattern")this.raise(V.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(V.operator!=="=")this.raise(V.left.end,"Only '=' operator can be used for specifying default value.");V.type="AssignmentPattern",delete V.operator,this.toAssignable(V.left,K);break;case"ParenthesizedExpression":this.toAssignable(V.expression,K,be);break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!K)break;default:this.raise(V.start,"Assigning to rvalue")}else if(be)this.checkPatternErrors(be,!0);return V};kn.toAssignableList=function(V,K){var be=V.length;for(var Be=0;Be<be;Be++){var Gt=V[Be];if(Gt)this.toAssignable(Gt,K)}if(be){var Wt=V[be-1];if(this.options.ecmaVersion===6&&K&&Wt&&Wt.type==="RestElement"&&Wt.argument.type!=="Identifier")this.unexpected(Wt.argument.start)}return V};kn.parseSpread=function(V){var K=this.startNode();return this.next(),K.argument=this.parseMaybeAssign(!1,V),this.finishNode(K,"SpreadElement")};kn.parseRestBinding=function(){var V=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Xt.name)this.unexpected();return V.argument=this.parseBindingAtom(),this.finishNode(V,"RestElement")};kn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Xt.bracketL:var V=this.startNode();return this.next(),V.elements=this.parseBindingList(Xt.bracketR,!0,!0),this.finishNode(V,"ArrayPattern");case Xt.braceL:return this.parseObj(!0)}return this.parseIdent()};kn.parseBindingList=function(V,K,be,Be){var Gt=[],Wt=!0;while(!this.eat(V)){if(Wt)Wt=!1;else this.expect(Xt.comma);if(K&&this.type===Xt.comma)Gt.push(null);else if(be&&this.afterTrailingComma(V))break;else if(this.type===Xt.ellipsis){var Kt=this.parseRestBinding();if(this.parseBindingListItem(Kt),Gt.push(Kt),this.type===Xt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(V);break}else Gt.push(this.parseAssignableListItem(Be))}return Gt};kn.parseAssignableListItem=function(V){var K=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(K),K};kn.parseBindingListItem=function(V){return V};kn.parseMaybeDefault=function(V,K,be){if(be=be||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Xt.eq))return be;var Be=this.startNodeAt(V,K);return Be.left=be,Be.right=this.parseMaybeAssign(),this.finishNode(Be,"AssignmentPattern")};kn.checkLValSimple=function(V,K,be){if(K===void 0)K=Bs;var Be=K!==Bs;switch(V.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(V.name))this.raiseRecoverable(V.start,(Be?"Binding ":"Assigning to ")+V.name+" in strict mode");if(Be){if(K===Mn&&V.name==="let")this.raiseRecoverable(V.start,"let is disallowed as a lexically bound name");if(be){if(Cs(be,V.name))this.raiseRecoverable(V.start,"Argument name clash");be[V.name]=!0}if(K!==Wo)this.declareName(V.name,K,V.start)}break;case"ChainExpression":this.raiseRecoverable(V.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Be)this.raiseRecoverable(V.start,"Binding member expression");break;case"ParenthesizedExpression":if(Be)this.raiseRecoverable(V.start,"Binding parenthesized expression");return this.checkLValSimple(V.expression,K,be);default:this.raise(V.start,(Be?"Binding":"Assigning to")+" rvalue")}};kn.checkLValPattern=function(V,K,be){if(K===void 0)K=Bs;switch(V.type){case"ObjectPattern":for(var Be=0,Gt=V.properties;Be<Gt.length;Be+=1){var Wt=Gt[Be];this.checkLValInnerPattern(Wt,K,be)}break;case"ArrayPattern":for(var Kt=0,Vt=V.elements;Kt<Vt.length;Kt+=1){var Ut=Vt[Kt];if(Ut)this.checkLValInnerPattern(Ut,K,be)}break;default:this.checkLValSimple(V,K,be)}};kn.checkLValInnerPattern=function(V,K,be){if(K===void 0)K=Bs;switch(V.type){case"Property":this.checkLValInnerPattern(V.value,K,be);break;case"AssignmentPattern":this.checkLValPattern(V.left,K,be);break;case"RestElement":this.checkLValPattern(V.argument,K,be);break;default:this.checkLValPattern(V,K,be)}};var $n=function(V,K,be,Be,Gt){this.token=V,this.isExpr=!!K,this.preserveSpace=!!be,this.override=Be,this.generator=!!Gt},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(V){return V.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)},as=r.prototype;as.initialContext=function(){return[ln.b_stat]};as.curContext=function(){return this.context[this.context.length-1]};as.braceIsBlock=function(V){var K=this.curContext();if(K===ln.f_expr||K===ln.f_stat)return!0;if(V===Xt.colon&&(K===ln.b_stat||K===ln.b_expr))return!K.isExpr;if(V===Xt._return||V===Xt.name&&this.exprAllowed)return En.test(this.input.slice(this.lastTokEnd,this.start));if(V===Xt._else||V===Xt.semi||V===Xt.eof||V===Xt.parenR||V===Xt.arrow)return!0;if(V===Xt.braceL)return K===ln.b_stat;if(V===Xt._var||V===Xt._const||V===Xt.name)return!1;return!this.exprAllowed};as.inGeneratorContext=function(){for(var V=this.context.length-1;V>=1;V--){var K=this.context[V];if(K.token==="function")return K.generator}return!1};as.updateContext=function(V){var K,be=this.type;if(be.keyword&&V===Xt.dot)this.exprAllowed=!1;else if(K=be.updateContext)K.call(this,V);else this.exprAllowed=be.beforeExpr};as.overrideContext=function(V){if(this.curContext()!==V)this.context[this.context.length-1]=V};Xt.parenR.updateContext=Xt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var V=this.context.pop();if(V===ln.b_stat&&this.curContext().token==="function")V=this.context.pop();this.exprAllowed=!V.isExpr};Xt.braceL.updateContext=function(V){this.context.push(this.braceIsBlock(V)?ln.b_stat:ln.b_expr),this.exprAllowed=!0};Xt.dollarBraceL.updateContext=function(){this.context.push(ln.b_tmpl),this.exprAllowed=!0};Xt.parenL.updateContext=function(V){var K=V===Xt._if||V===Xt._for||V===Xt._with||V===Xt._while;this.context.push(K?ln.p_stat:ln.p_expr),this.exprAllowed=!0};Xt.incDec.updateContext=function(){};Xt._function.updateContext=Xt._class.updateContext=function(V){if(V.beforeExpr&&V!==Xt._else&&!(V===Xt.semi&&this.curContext()!==ln.p_stat)&&!(V===Xt._return&&En.test(this.input.slice(this.lastTokEnd,this.start)))&&!((V===Xt.colon||V===Xt.braceL)&&this.curContext()===ln.b_stat))this.context.push(ln.f_expr);else this.context.push(ln.f_stat);this.exprAllowed=!1};Xt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Xt.backQuote.updateContext=function(){if(this.curContext()===ln.q_tmpl)this.context.pop();else this.context.push(ln.q_tmpl);this.exprAllowed=!1};Xt.star.updateContext=function(V){if(V===Xt._function){var K=this.context.length-1;if(this.context[K]===ln.f_expr)this.context[K]=ln.f_expr_gen;else this.context[K]=ln.f_gen}this.exprAllowed=!0};Xt.name.updateContext=function(V){var K=!1;if(this.options.ecmaVersion>=6&&V!==Xt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())K=!0}this.exprAllowed=K};var sn=r.prototype;sn.checkPropClash=function(V,K,be){if(this.options.ecmaVersion>=9&&V.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(V.computed||V.method||V.shorthand))return;var Be=V.key,Gt;switch(Be.type){case"Identifier":Gt=Be.name;break;case"Literal":Gt=String(Be.value);break;default:return}var Wt=V.kind;if(this.options.ecmaVersion>=6){if(Gt==="__proto__"&&Wt==="init"){if(K.proto)if(be){if(be.doubleProto<0)be.doubleProto=Be.start}else this.raiseRecoverable(Be.start,"Redefinition of __proto__ property");K.proto=!0}return}Gt="$"+Gt;var Kt=K[Gt];if(Kt){var Vt;if(Wt==="init")Vt=this.strict&&Kt.init||Kt.get||Kt.set;else Vt=Kt.init||Kt[Wt];if(Vt)this.raiseRecoverable(Be.start,"Redefinition of property")}else Kt=K[Gt]={init:!1,get:!1,set:!1};Kt[Wt]=!0};sn.parseExpression=function(V,K){var be=this;return this.catchStackOverflow(function(){var{start:Be,startLoc:Gt}=be,Wt=be.parseMaybeAssign(V,K);if(be.type===Xt.comma){var Kt=be.startNodeAt(Be,Gt);Kt.expressions=[Wt];while(be.eat(Xt.comma))Kt.expressions.push(be.parseMaybeAssign(V,K));return be.finishNode(Kt,"SequenceExpression")}return Wt})};sn.parseMaybeAssign=function(V,K,be){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(V);else this.exprAllowed=!1;var Be=!1,Gt=-1,Wt=-1,Kt=-1;if(K)Gt=K.parenthesizedAssign,Wt=K.trailingComma,Kt=K.doubleProto,K.parenthesizedAssign=K.trailingComma=-1;else K=new qs,Be=!0;var Vt=this.start,Ut=this.startLoc;if(this.type===Xt.parenL||this.type===Xt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=V==="await";var Ht=this.parseMaybeConditional(V,K);if(be)Ht=be.call(this,Ht,Vt,Ut);if(this.type.isAssign){var zt=this.startNodeAt(Vt,Ut);if(zt.operator=this.value,this.type===Xt.eq)Ht=this.toAssignable(Ht,!1,K);if(!Be)K.parenthesizedAssign=K.trailingComma=K.doubleProto=-1;if(K.shorthandAssign>=Ht.start)K.shorthandAssign=-1;if(this.type===Xt.eq)this.checkLValPattern(Ht);else this.checkLValSimple(Ht);if(zt.left=Ht,this.next(),zt.right=this.parseMaybeAssign(V),Kt>-1)K.doubleProto=Kt;return this.finishNode(zt,"AssignmentExpression")}else if(Be)this.checkExpressionErrors(K,!0);if(Gt>-1)K.parenthesizedAssign=Gt;if(Wt>-1)K.trailingComma=Wt;return Ht};sn.parseMaybeConditional=function(V,K){var be=this.start,Be=this.startLoc,Gt=this.parseExprOps(V,K);if(this.checkExpressionErrors(K))return Gt;if(!(Gt.type==="ArrowFunctionExpression"&&Gt.start===be)&&this.eat(Xt.question)){var Wt=this.startNodeAt(be,Be);return Wt.test=Gt,Wt.consequent=this.parseMaybeAssign(),this.expect(Xt.colon),Wt.alternate=this.parseMaybeAssign(V),this.finishNode(Wt,"ConditionalExpression")}return Gt};sn.parseExprOps=function(V,K){var be=this.start,Be=this.startLoc,Gt=this.parseMaybeUnary(K,!1,!1,V);if(this.checkExpressionErrors(K))return Gt;return Gt.start===be&&Gt.type==="ArrowFunctionExpression"?Gt:this.parseExprOp(Gt,be,Be,-1,V)};sn.parseExprOp=function(V,K,be,Be,Gt){var Wt=this.type.binop;if(Wt!=null&&(!Gt||this.type!==Xt._in)){if(Wt>Be){var Kt=this.type===Xt.logicalOR||this.type===Xt.logicalAND,Vt=this.type===Xt.coalesce;if(Vt)Wt=Xt.logicalAND.binop;var Ut=this.value;this.next();var Ht=this.start,zt=this.startLoc,Yt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Gt),Ht,zt,Wt,Gt),Jt=this.buildBinary(K,be,V,Yt,Ut,Kt||Vt);if(Kt&&this.type===Xt.coalesce||Vt&&(this.type===Xt.logicalOR||this.type===Xt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(Jt,K,be,Be,Gt)}}return V};sn.buildBinary=function(V,K,be,Be,Gt,Wt){if(Be.type==="PrivateIdentifier")this.raise(Be.start,"Private identifier can only be left side of binary expression");var Kt=this.startNodeAt(V,K);return Kt.left=be,Kt.operator=Gt,Kt.right=Be,this.finishNode(Kt,Wt?"LogicalExpression":"BinaryExpression")};sn.parseMaybeUnary=function(V,K,be,Be){var Gt=this.start,Wt=this.startLoc,Kt;if(this.isContextual("await")&&this.canAwait)Kt=this.parseAwait(Be),K=!0;else if(this.type.prefix){var Vt=this.startNode(),Ut=this.type===Xt.incDec;if(Vt.operator=this.value,Vt.prefix=!0,this.next(),Vt.argument=this.parseMaybeUnary(null,!0,Ut,Be),this.checkExpressionErrors(V,!0),Ut)this.checkLValSimple(Vt.argument);else if(this.strict&&Vt.operator==="delete"&&Ko(Vt.argument))this.raiseRecoverable(Vt.start,"Deleting local variable in strict mode");else if(Vt.operator==="delete"&&Mi(Vt.argument))this.raiseRecoverable(Vt.start,"Private fields can not be deleted");else K=!0;Kt=this.finishNode(Vt,Ut?"UpdateExpression":"UnaryExpression")}else if(!K&&this.type===Xt.privateId){if((Be||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Kt=this.parsePrivateIdent(),this.type!==Xt._in)this.unexpected()}else{if(Kt=this.parseExprSubscripts(V,Be),this.checkExpressionErrors(V))return Kt;while(this.type.postfix&&!this.canInsertSemicolon()){var Ht=this.startNodeAt(Gt,Wt);Ht.operator=this.value,Ht.prefix=!1,Ht.argument=Kt,this.checkLValSimple(Kt),this.next(),Kt=this.finishNode(Ht,"UpdateExpression")}}if(!be&&!(Kt.type==="ArrowFunctionExpression"&&Kt.start===Gt)&&this.eat(Xt.starstar))if(K)this.unexpected(this.lastTokStart);else return this.buildBinary(Gt,Wt,Kt,this.parseMaybeUnary(null,!1,!1,Be),"**",!1);else return Kt};function Ko(V){return V.type==="Identifier"||V.type==="ParenthesizedExpression"&&Ko(V.expression)}function Mi(V){return V.type==="MemberExpression"&&V.property.type==="PrivateIdentifier"||V.type==="ChainExpression"&&Mi(V.expression)||V.type==="ParenthesizedExpression"&&Mi(V.expression)}sn.parseExprSubscripts=function(V,K){var be=this.start,Be=this.startLoc,Gt=this.parseExprAtom(V,K);if(Gt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Gt;var Wt=this.parseSubscripts(Gt,be,Be,!1,K);if(V&&Wt.type==="MemberExpression"){if(V.parenthesizedAssign>=Wt.start)V.parenthesizedAssign=-1;if(V.parenthesizedBind>=Wt.start)V.parenthesizedBind=-1;if(V.trailingComma>=Wt.start)V.trailingComma=-1}return Wt};sn.parseSubscripts=function(V,K,be,Be,Gt){var Wt=this.options.ecmaVersion>=8&&V.type==="Identifier"&&V.name==="async"&&this.lastTokEnd===V.end&&!this.canInsertSemicolon()&&V.end-V.start===5&&this.potentialArrowAt===V.start,Kt=!1;while(!0){var Vt=this.parseSubscript(V,K,be,Be,Wt,Kt,Gt);if(Vt.optional)Kt=!0;if(Vt===V||Vt.type==="ArrowFunctionExpression"){if(Kt){var Ut=this.startNodeAt(K,be);Ut.expression=Vt,Vt=this.finishNode(Ut,"ChainExpression")}return Vt}V=Vt}};sn.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Xt.arrow)};sn.parseSubscriptAsyncArrow=function(V,K,be,Be){return this.parseArrowExpression(this.startNodeAt(V,K),be,!0,Be)};sn.parseSubscript=function(V,K,be,Be,Gt,Wt,Kt){var Vt=this.options.ecmaVersion>=11,Ut=Vt&&this.eat(Xt.questionDot);if(Be&&Ut)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Ht=this.eat(Xt.bracketL);if(Ht||Ut&&this.type!==Xt.parenL&&this.type!==Xt.backQuote||this.eat(Xt.dot)){var zt=this.startNodeAt(K,be);if(zt.object=V,Ht)zt.property=this.parseExpression(),this.expect(Xt.bracketR);else if(this.type===Xt.privateId&&V.type!=="Super")zt.property=this.parsePrivateIdent();else zt.property=this.parseIdent(this.options.allowReserved!=="never");if(zt.computed=!!Ht,Vt)zt.optional=Ut;V=this.finishNode(zt,"MemberExpression")}else if(!Be&&this.eat(Xt.parenL)){var Yt=new qs,Jt=this.yieldPos,Qt=this.awaitPos,Zt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var tn=this.parseExprList(Xt.parenR,this.options.ecmaVersion>=8,!1,Yt);if(Gt&&!Ut&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Yt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=Jt,this.awaitPos=Qt,this.awaitIdentPos=Zt,this.parseSubscriptAsyncArrow(K,be,tn,Kt)}this.checkExpressionErrors(Yt,!0),this.yieldPos=Jt||this.yieldPos,this.awaitPos=Qt||this.awaitPos,this.awaitIdentPos=Zt||this.awaitIdentPos;var en=this.startNodeAt(K,be);if(en.callee=V,en.arguments=tn,Vt)en.optional=Ut;V=this.finishNode(en,"CallExpression")}else if(this.type===Xt.backQuote){if(Ut||Wt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var rn=this.startNodeAt(K,be);rn.tag=V,rn.quasi=this.parseTemplate({isTagged:!0}),V=this.finishNode(rn,"TaggedTemplateExpression")}return V};sn.parseExprAtom=function(V,K,be){if(this.type===Xt.slash)this.readRegexp();var Be,Gt=this.potentialArrowAt===this.start;switch(this.type){case Xt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Be=this.startNode(),this.next(),this.type===Xt.parenL&&!this.allowDirectSuper)this.raise(Be.start,"super() call outside constructor of a subclass");if(this.type!==Xt.dot&&this.type!==Xt.bracketL&&this.type!==Xt.parenL)this.unexpected();return this.finishNode(Be,"Super");case Xt._this:return Be=this.startNode(),this.next(),this.finishNode(Be,"ThisExpression");case Xt.name:var Wt=this.start,Kt=this.startLoc,Vt=this.containsEsc,Ut=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Vt&&Ut.name==="async"&&!this.canInsertSemicolon()&&this.eat(Xt._function))return this.overrideContext(ln.f_expr),this.parseFunction(this.startNodeAt(Wt,Kt),0,!1,!0,K);if(Gt&&!this.canInsertSemicolon()){if(this.eat(Xt.arrow))return this.parseArrowExpression(this.startNodeAt(Wt,Kt),[Ut],!1,K);if(this.options.ecmaVersion>=8&&Ut.name==="async"&&this.type===Xt.name&&!Vt&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Ut=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Xt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Wt,Kt),[Ut],!0,K)}}return Ut;case Xt.regexp:var Ht=this.value;return Be=this.parseLiteral(Ht.value),Be.regex={pattern:Ht.pattern,flags:Ht.flags},Be;case Xt.num:case Xt.string:return this.parseLiteral(this.value);case Xt._null:case Xt._true:case Xt._false:return Be=this.startNode(),Be.value=this.type===Xt._null?null:this.type===Xt._true,Be.raw=this.type.keyword,this.next(),this.finishNode(Be,"Literal");case Xt.parenL:var zt=this.start,Yt=this.parseParenAndDistinguishExpression(Gt,K);if(V){if(V.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Yt))V.parenthesizedAssign=zt;if(V.parenthesizedBind<0)V.parenthesizedBind=zt}return Yt;case Xt.bracketL:return Be=this.startNode(),this.next(),Be.elements=this.parseExprList(Xt.bracketR,!0,!0,V),this.finishNode(Be,"ArrayExpression");case Xt.braceL:return this.overrideContext(ln.b_expr),this.parseObj(!1,V);case Xt._function:return Be=this.startNode(),this.next(),this.parseFunction(Be,0);case Xt._class:return this.parseClass(this.startNode(),!1);case Xt._new:return this.parseNew();case Xt.backQuote:return this.parseTemplate();case Xt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(be);else return this.unexpected();default:return this.parseExprAtomDefault()}};sn.parseExprAtomDefault=function(){this.unexpected()};sn.parseExprImport=function(V){var K=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Xt.parenL&&!V)return this.parseDynamicImport(K);else if(this.type===Xt.dot){var be=this.startNodeAt(K.start,K.loc&&K.loc.start);return be.name="import",K.meta=this.finishNode(be,"Identifier"),this.parseImportMeta(K)}else this.unexpected()};sn.parseDynamicImport=function(V){if(this.next(),V.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Xt.parenR))if(this.expect(Xt.comma),!this.afterTrailingComma(Xt.parenR)){if(V.options=this.parseMaybeAssign(),!this.eat(Xt.parenR)){if(this.expect(Xt.comma),!this.afterTrailingComma(Xt.parenR))this.unexpected()}}else V.options=null;else V.options=null;else if(!this.eat(Xt.parenR)){var K=this.start;if(this.eat(Xt.comma)&&this.eat(Xt.parenR))this.raiseRecoverable(K,"Trailing comma is not allowed in import()");else this.unexpected(K)}return this.finishNode(V,"ImportExpression")};sn.parseImportMeta=function(V){this.next();var K=this.containsEsc;if(V.property=this.parseIdent(!0),V.property.name!=="meta")this.raiseRecoverable(V.property.start,"The only valid meta property for import is 'import.meta'");if(K)this.raiseRecoverable(V.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(V.start,"Cannot use 'import.meta' outside a module");return this.finishNode(V,"MetaProperty")};sn.parseLiteral=function(V){var K=this.startNode();if(K.value=V,K.raw=this.input.slice(this.start,this.end),K.raw.charCodeAt(K.raw.length-1)===110)K.bigint=K.value!=null?K.value.toString():K.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(K,"Literal")};sn.parseParenExpression=function(){this.expect(Xt.parenL);var V=this.parseExpression();return this.expect(Xt.parenR),V};sn.shouldParseArrow=function(V){return!this.canInsertSemicolon()};sn.parseParenAndDistinguishExpression=function(V,K){var be=this.start,Be=this.startLoc,Gt,Wt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Kt=this.start,Vt=this.startLoc,Ut=[],Ht=!0,zt=!1,Yt=new qs,Jt=this.yieldPos,Qt=this.awaitPos,Zt;this.yieldPos=0,this.awaitPos=0;while(this.type!==Xt.parenR)if(Ht?Ht=!1:this.expect(Xt.comma),Wt&&this.afterTrailingComma(Xt.parenR,!0)){zt=!0;break}else if(this.type===Xt.ellipsis){if(Zt=this.start,Ut.push(this.parseParenItem(this.parseRestBinding())),this.type===Xt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Ut.push(this.parseMaybeAssign(!1,Yt,this.parseParenItem));var tn=this.lastTokEnd,en=this.lastTokEndLoc;if(this.expect(Xt.parenR),V&&this.shouldParseArrow(Ut)&&this.eat(Xt.arrow))return this.checkPatternErrors(Yt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Jt,this.awaitPos=Qt,this.parseParenArrowList(be,Be,Ut,K);if(!Ut.length||zt)this.unexpected(this.lastTokStart);if(Zt)this.unexpected(Zt);if(this.checkExpressionErrors(Yt,!0),this.yieldPos=Jt||this.yieldPos,this.awaitPos=Qt||this.awaitPos,Ut.length>1)Gt=this.startNodeAt(Kt,Vt),Gt.expressions=Ut,this.finishNodeAt(Gt,"SequenceExpression",tn,en);else Gt=Ut[0]}else Gt=this.parseParenExpression();if(this.options.preserveParens){var rn=this.startNodeAt(be,Be);return rn.expression=Gt,this.finishNode(rn,"ParenthesizedExpression")}else return Gt};sn.parseParenItem=function(V){return V};sn.parseParenArrowList=function(V,K,be,Be){return this.parseArrowExpression(this.startNodeAt(V,K),be,!1,Be)};var Bc=[];sn.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var V=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Xt.dot){var K=this.startNodeAt(V.start,V.loc&&V.loc.start);K.name="new",V.meta=this.finishNode(K,"Identifier"),this.next();var be=this.containsEsc;if(V.property=this.parseIdent(!0),V.property.name!=="target")this.raiseRecoverable(V.property.start,"The only valid meta property for new is 'new.target'");if(be)this.raiseRecoverable(V.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(V.start,"'new.target' can only be used in functions and class static block");return this.finishNode(V,"MetaProperty")}var Be=this.start,Gt=this.startLoc;if(V.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Be,Gt,!0,!1),V.callee.type==="Super")this.raiseRecoverable(Be,"Invalid use of 'super'");if(this.eat(Xt.parenL))V.arguments=this.parseExprList(Xt.parenR,this.options.ecmaVersion>=8,!1);else V.arguments=Bc;return this.finishNode(V,"NewExpression")};sn.parseTemplateElement=function(V){var K=V.isTagged,be=this.startNode();if(this.type===Xt.invalidTemplate){if(!K)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");be.value={raw:this.value.replace(/\r\n?/g,`
|
|
6
|
-
`),cooked:null}}else be.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
7
|
-
`),cooked:this.value};return this.next(),be.tail=this.type===Xt.backQuote,this.finishNode(be,"TemplateElement")};sn.parseTemplate=function(V){if(V===void 0)V={};var K=V.isTagged;if(K===void 0)K=!1;var be=this.startNode();this.next(),be.expressions=[];var Be=this.parseTemplateElement({isTagged:K});be.quasis=[Be];while(!Be.tail){if(this.type===Xt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Xt.dollarBraceL),be.expressions.push(this.parseExpression()),this.expect(Xt.braceR),be.quasis.push(Be=this.parseTemplateElement({isTagged:K}))}return this.next(),this.finishNode(be,"TemplateLiteral")};sn.isAsyncProp=function(V){return!V.computed&&V.key.type==="Identifier"&&V.key.name==="async"&&(this.type===Xt.name||this.type===Xt.num||this.type===Xt.string||this.type===Xt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Xt.star)&&!En.test(this.input.slice(this.lastTokEnd,this.start))};sn.parseObj=function(V,K){var be=this.startNode(),Be=!0,Gt={};be.properties=[],this.next();while(!this.eat(Xt.braceR)){if(!Be){if(this.expect(Xt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Xt.braceR))break}else Be=!1;var Wt=this.parseProperty(V,K);if(!V)this.checkPropClash(Wt,Gt,K);be.properties.push(Wt)}return this.finishNode(be,V?"ObjectPattern":"ObjectExpression")};sn.parseProperty=function(V,K){var be=this.startNode(),Be,Gt,Wt,Kt;if(this.options.ecmaVersion>=9&&this.eat(Xt.ellipsis)){if(V){if(be.argument=this.parseIdent(!1),this.type===Xt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(be,"RestElement")}if(be.argument=this.parseMaybeAssign(!1,K),this.type===Xt.comma&&K&&K.trailingComma<0)K.trailingComma=this.start;return this.finishNode(be,"SpreadElement")}if(this.options.ecmaVersion>=6){if(be.method=!1,be.shorthand=!1,V||K)Wt=this.start,Kt=this.startLoc;if(!V)Be=this.eat(Xt.star)}var Vt=this.containsEsc;if(this.parsePropertyName(be),!V&&!Vt&&this.options.ecmaVersion>=8&&!Be&&this.isAsyncProp(be))Gt=!0,Be=this.options.ecmaVersion>=9&&this.eat(Xt.star),this.parsePropertyName(be);else Gt=!1;return this.parsePropertyValue(be,V,Be,Gt,Wt,Kt,K,Vt),this.finishNode(be,"Property")};sn.parseGetterSetter=function(V){var K=V.key.name;this.parsePropertyName(V),V.value=this.parseMethod(!1),V.kind=K;var be=V.kind==="get"?0:1;if(V.value.params.length!==be){var Be=V.value.start;if(V.kind==="get")this.raiseRecoverable(Be,"getter should have no params");else this.raiseRecoverable(Be,"setter should have exactly one param")}else if(V.kind==="set"&&V.value.params[0].type==="RestElement")this.raiseRecoverable(V.value.params[0].start,"Setter cannot use rest params")};sn.parsePropertyValue=function(V,K,be,Be,Gt,Wt,Kt,Vt){if((be||Be)&&this.type===Xt.colon)this.unexpected();if(this.eat(Xt.colon))V.value=K?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Kt),V.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Xt.parenL){if(K)this.unexpected();V.method=!0,V.value=this.parseMethod(be,Be),V.kind="init"}else if(!K&&!Vt&&this.options.ecmaVersion>=5&&!V.computed&&V.key.type==="Identifier"&&(V.key.name==="get"||V.key.name==="set")&&(this.type!==Xt.comma&&this.type!==Xt.braceR&&this.type!==Xt.eq)){if(be||Be)this.unexpected();this.parseGetterSetter(V)}else if(this.options.ecmaVersion>=6&&!V.computed&&V.key.type==="Identifier"){if(be||Be)this.unexpected();if(this.checkUnreserved(V.key),V.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Gt;if(K)V.value=this.parseMaybeDefault(Gt,Wt,this.copyNode(V.key));else if(this.type===Xt.eq&&Kt){if(Kt.shorthandAssign<0)Kt.shorthandAssign=this.start;V.value=this.parseMaybeDefault(Gt,Wt,this.copyNode(V.key))}else V.value=this.copyNode(V.key);V.kind="init",V.shorthand=!0}else this.unexpected()};sn.parsePropertyName=function(V){if(this.options.ecmaVersion>=6)if(this.eat(Xt.bracketL))return V.computed=!0,V.key=this.parseMaybeAssign(),this.expect(Xt.bracketR),V.key;else V.computed=!1;return V.key=this.type===Xt.num||this.type===Xt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};sn.initFunction=function(V){if(V.id=null,this.options.ecmaVersion>=6)V.generator=V.expression=!1;if(this.options.ecmaVersion>=8)V.async=!1};sn.parseMethod=function(V,K,be){var Be=this.startNode(),Gt=this.yieldPos,Wt=this.awaitPos,Kt=this.awaitIdentPos;if(this.initFunction(Be),this.options.ecmaVersion>=6)Be.generator=V;if(this.options.ecmaVersion>=8)Be.async=!!K;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Vi(K,Be.generator)|Ks|(be?jo:0)),this.expect(Xt.parenL),Be.params=this.parseBindingList(Xt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Be,!1,!0,!1),this.yieldPos=Gt,this.awaitPos=Wt,this.awaitIdentPos=Kt,this.finishNode(Be,"FunctionExpression")};sn.parseArrowExpression=function(V,K,be,Be){var Gt=this.yieldPos,Wt=this.awaitPos,Kt=this.awaitIdentPos;if(this.enterScope(Vi(be,!1)|Bi),this.initFunction(V),this.options.ecmaVersion>=8)V.async=!!be;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,V.params=this.toAssignableList(K,!0),this.parseFunctionBody(V,!0,!1,Be),this.yieldPos=Gt,this.awaitPos=Wt,this.awaitIdentPos=Kt,this.finishNode(V,"ArrowFunctionExpression")};sn.parseFunctionBody=function(V,K,be,Be){var Gt=K&&this.type!==Xt.braceL,Wt=this.strict,Kt=!1;if(Gt)V.body=this.parseMaybeAssign(Be),V.expression=!0,this.checkParams(V,!1);else{var Vt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(V.params);if(!Wt||Vt){if(Kt=this.strictDirective(this.end),Kt&&Vt)this.raiseRecoverable(V.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Ut=this.labels;if(this.labels=[],Kt)this.strict=!0;if(this.checkParams(V,!Wt&&!Kt&&!K&&!be&&this.isSimpleParamList(V.params)),this.strict&&V.id)this.checkLValSimple(V.id,Wo);V.body=this.parseBlock(!1,void 0,Kt&&!Wt),V.expression=!1,this.adaptDirectivePrologue(V.body.body),this.labels=Ut}this.exitScope()};sn.isSimpleParamList=function(V){for(var K=0,be=V;K<be.length;K+=1){var Be=be[K];if(Be.type!=="Identifier")return!1}return!0};sn.checkParams=function(V,K){var be=Object.create(null);for(var Be=0,Gt=V.params;Be<Gt.length;Be+=1){var Wt=Gt[Be];this.checkLValInnerPattern(Wt,Gi,K?null:be)}};sn.parseExprList=function(V,K,be,Be){var Gt=[],Wt=!0;while(!this.eat(V)){if(!Wt){if(this.expect(Xt.comma),K&&this.afterTrailingComma(V))break}else Wt=!1;var Kt=void 0;if(be&&this.type===Xt.comma)Kt=null;else if(this.type===Xt.ellipsis){if(Kt=this.parseSpread(Be),Be&&this.type===Xt.comma&&Be.trailingComma<0)Be.trailingComma=this.start}else Kt=this.parseMaybeAssign(!1,Be);Gt.push(Kt)}return Gt};sn.checkUnreserved=function(V){var{start:K,end:be,name:Be}=V;if(this.inGenerator&&Be==="yield")this.raiseRecoverable(K,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Be==="await")this.raiseRecoverable(K,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Hs)&&Be==="arguments")this.raiseRecoverable(K,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Be==="arguments"||Be==="await"))this.raise(K,"Cannot use "+Be+" in class static initialization block");if(this.keywords.test(Be))this.raise(K,"Unexpected keyword '"+Be+"'");if(this.options.ecmaVersion<6&&this.input.slice(K,be).indexOf("\\")!==-1)return;var Gt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Gt.test(Be)){if(!this.inAsync&&Be==="await")this.raiseRecoverable(K,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(K,"The keyword '"+Be+"' is reserved")}};sn.parseIdent=function(V){var K=this.parseIdentNode();if(this.next(!!V),this.finishNode(K,"Identifier"),!V){if(this.checkUnreserved(K),K.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=K.start}return K};sn.parseIdentNode=function(){var V=this.startNode();if(this.type===Xt.name)V.name=this.value;else if(this.type.keyword){if(V.name=this.type.keyword,(V.name==="class"||V.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Xt.name}else this.unexpected();return V};sn.parsePrivateIdent=function(){var V=this.startNode();if(this.type===Xt.privateId)V.name=this.value;else this.unexpected();if(this.next(),this.finishNode(V,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(V.start,"Private field '#"+V.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(V);return V};sn.parseYield=function(V){if(!this.yieldPos)this.yieldPos=this.start;var K=this.startNode();if(this.next(),this.type===Xt.semi||this.canInsertSemicolon()||this.type!==Xt.star&&!this.type.startsExpr)K.delegate=!1,K.argument=null;else K.delegate=this.eat(Xt.star),K.argument=this.parseMaybeAssign(V);return this.finishNode(K,"YieldExpression")};sn.parseAwait=function(V){if(!this.awaitPos)this.awaitPos=this.start;var K=this.startNode();return this.next(),K.argument=this.parseMaybeUnary(null,!0,!1,V),this.finishNode(K,"AwaitExpression")};var Gs=r.prototype;Gs.raise=function(V,K){var be=Oo(this.input,V);if(K+=" ("+be.line+":"+be.column+")",this.sourceFile)K+=" in "+this.sourceFile;var Be=SyntaxError(K);throw Be.pos=V,Be.loc=be,Be.raisedAt=this.pos,Be};Gs.raiseRecoverable=Gs.raise;Gs.curPosition=function(){if(this.options.locations)return new Ss(this.curLine,this.pos-this.lineStart)};var Bn=r.prototype,Vc=function(V){this.flags=V,this.var=[],this.lexical=[],this.functions=[]};Bn.enterScope=function(V){this.scopeStack.push(new Vc(V))};Bn.exitScope=function(){this.scopeStack.pop()};Bn.treatFunctionsAsVarInScope=function(V){return V.flags&Jn||!this.inModule&&V.flags&Xn};Bn.declareName=function(V,K,be){var Be=!1;if(K===Mn){var Gt=this.currentScope();if(Be=Gt.lexical.indexOf(V)>-1||Gt.functions.indexOf(V)>-1||Gt.var.indexOf(V)>-1,Gt.lexical.push(V),this.inModule&&Gt.flags&Xn)delete this.undefinedExports[V]}else if(K===Go){var Wt=this.currentScope();Wt.lexical.push(V)}else if(K===Vo){var Kt=this.currentScope();if(this.treatFunctionsAsVar)Be=Kt.lexical.indexOf(V)>-1;else Be=Kt.lexical.indexOf(V)>-1||Kt.var.indexOf(V)>-1;Kt.functions.push(V)}else for(var Vt=this.scopeStack.length-1;Vt>=0;--Vt){var Ut=this.scopeStack[Vt];if(Ut.lexical.indexOf(V)>-1&&!(Ut.flags&Fo&&Ut.lexical[0]===V)||!this.treatFunctionsAsVarInScope(Ut)&&Ut.functions.indexOf(V)>-1){Be=!0;break}if(Ut.var.push(V),this.inModule&&Ut.flags&Xn)delete this.undefinedExports[V];if(Ut.flags&Hs)break}if(Be)this.raiseRecoverable(be,"Identifier '"+V+"' has already been declared")};Bn.checkLocalExport=function(V){if(this.scopeStack[0].lexical.indexOf(V.name)===-1&&this.scopeStack[0].var.indexOf(V.name)===-1)this.undefinedExports[V.name]=V};Bn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Bn.currentVarScope=function(){for(var V=this.scopeStack.length-1;;V--){var K=this.scopeStack[V];if(K.flags&(Hs|ws|Yn))return K}};Bn.currentThisScope=function(){for(var V=this.scopeStack.length-1;;V--){var K=this.scopeStack[V];if(K.flags&(Hs|ws|Yn)&&!(K.flags&Bi))return K}};var zs=function(V,K,be){if(this.type="",this.start=K,this.end=0,V.options.locations)this.loc=new Us(V,be);if(V.options.directSourceFile)this.sourceFile=V.options.directSourceFile;if(V.options.ranges)this.range=[K,0]},Ts=r.prototype;Ts.startNode=function(){return new zs(this,this.start,this.startLoc)};Ts.startNodeAt=function(V,K){return new zs(this,V,K)};function Ho(V,K,be,Be){if(V.type=K,V.end=be,this.options.locations)V.loc.end=Be;if(this.options.ranges)V.range[1]=be;return V}Ts.finishNode=function(V,K){return Ho.call(this,V,K,this.lastTokEnd,this.lastTokEndLoc)};Ts.finishNodeAt=function(V,K,be,Be){return Ho.call(this,V,K,be,Be)};Ts.copyNode=function(V){var K=new zs(this,V.start,this.startLoc);for(var be in V)K[be]=V[be];return K};var qo=function(){};qo.prototype.reset=function(){};r.prototype.validateRegExpFlags=function(){};r.prototype.validateRegExpPattern=function(){};var Ui=function(V){if(this.type=V.type,this.value=V.value,this.start=V.start,this.end=V.end,V.options.locations)this.loc=new Us(V,V.startLoc,V.endLoc);if(V.options.ranges)this.range=[V.start,V.end]},on=r.prototype;on.next=function(V){if(!V&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new Ui(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};on.getToken=function(){return this.next(),new Ui(this)};if(typeof Symbol<"u")on[Symbol.iterator]=function(){var V=this;return{next:function(){var K=V.getToken();return{done:K.type===Xt.eof,value:K}}}};on.nextToken=function(){var V=this.curContext();if(!V||!V.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Xt.eof);if(V.override)return V.override(this);else this.readToken(this.fullCharCodeAtPos())};on.readToken=function(V){if(m(V,this.options.ecmaVersion>=6)||V===92)return this.readWord();return this.getTokenFromCode(V)};on.fullCharCodeAt=function(V){var K=this.input.charCodeAt(V);if(K<=55295||K>=56320)return K;var be=this.input.charCodeAt(V+1);return be<=56319||be>=57344?K:(K<<10)+be-56613888};on.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};on.skipBlockComment=function(){var V=this.options.onComment&&this.curPosition(),K=this.pos,be=this.input.indexOf("*/",this.pos+=2);if(be===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=be+2,this.options.locations)for(var Be=void 0,Gt=K;(Be=Io(this.input,Gt,this.pos))>-1;)++this.curLine,Gt=this.lineStart=Be;if(this.options.onComment)this.options.onComment(!0,this.input.slice(K+2,be),K,this.pos,V,this.curPosition())};on.skipLineComment=function(V){var K=this.pos,be=this.options.onComment&&this.curPosition(),Be=this.input.charCodeAt(this.pos+=V);while(this.pos<this.input.length&&!os(Be))Be=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(K+V,this.pos),K,this.pos,be,this.curPosition())};on.skipSpace=function(){e:while(this.pos<this.input.length){var V=this.input.charCodeAt(this.pos);switch(V){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(V>8&&V<14||V>=5760&&Lo.test(String.fromCharCode(V)))++this.pos;else break e}}};on.finishToken=function(V,K){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var be=this.type;this.type=V,this.value=K,this.updateContext(be)};on.readToken_dot=function(){var V=this.input.charCodeAt(this.pos+1);if(V>=48&&V<=57)return this.readNumber(!0);var K=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&V===46&&K===46)return this.pos+=3,this.finishToken(Xt.ellipsis);else return++this.pos,this.finishToken(Xt.dot)};on.readToken_slash=function(){var V=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(V===61)return this.finishOp(Xt.assign,2);return this.finishOp(Xt.slash,1)};on.readToken_mult_modulo_exp=function(V){var K=this.input.charCodeAt(this.pos+1),be=1,Be=V===42?Xt.star:Xt.modulo;if(this.options.ecmaVersion>=7&&V===42&&K===42)++be,Be=Xt.starstar,K=this.input.charCodeAt(this.pos+2);if(K===61)return this.finishOp(Xt.assign,be+1);return this.finishOp(Be,be)};on.readToken_pipe_amp=function(V){var K=this.input.charCodeAt(this.pos+1);if(K===V){if(this.options.ecmaVersion>=12){var be=this.input.charCodeAt(this.pos+2);if(be===61)return this.finishOp(Xt.assign,3)}return this.finishOp(V===124?Xt.logicalOR:Xt.logicalAND,2)}if(K===61)return this.finishOp(Xt.assign,2);return this.finishOp(V===124?Xt.bitwiseOR:Xt.bitwiseAND,1)};on.readToken_caret=function(){var V=this.input.charCodeAt(this.pos+1);if(V===61)return this.finishOp(Xt.assign,2);return this.finishOp(Xt.bitwiseXOR,1)};on.readToken_plus_min=function(V){var K=this.input.charCodeAt(this.pos+1);if(K===V){if(K===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(Xt.incDec,2)}if(K===61)return this.finishOp(Xt.assign,2);return this.finishOp(Xt.plusMin,1)};on.readToken_lt_gt=function(V){var K=this.input.charCodeAt(this.pos+1),be=1;if(K===V){if(be=V===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+be)===61)return this.finishOp(Xt.assign,be+1);return this.finishOp(Xt.bitShift,be)}if(K===33&&V===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(K===61)be=2;return this.finishOp(Xt.relational,be)};on.readToken_eq_excl=function(V){var K=this.input.charCodeAt(this.pos+1);if(K===61)return this.finishOp(Xt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(V===61&&K===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Xt.arrow);return this.finishOp(V===61?Xt.eq:Xt.prefix,1)};on.readToken_question=function(){var V=this.options.ecmaVersion;if(V>=11){var K=this.input.charCodeAt(this.pos+1);if(K===46){var be=this.input.charCodeAt(this.pos+2);if(be<48||be>57)return this.finishOp(Xt.questionDot,2)}if(K===63){if(V>=12){var Be=this.input.charCodeAt(this.pos+2);if(Be===61)return this.finishOp(Xt.assign,3)}return this.finishOp(Xt.coalesce,2)}}return this.finishOp(Xt.question,1)};on.readToken_numberSign=function(){var V=this.options.ecmaVersion,K=35;if(V>=13){if(++this.pos,K=this.fullCharCodeAtPos(),m(K,!0)||K===92)return this.finishToken(Xt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+Ws(K)+"'")};on.getTokenFromCode=function(V){switch(V){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Xt.parenL);case 41:return++this.pos,this.finishToken(Xt.parenR);case 59:return++this.pos,this.finishToken(Xt.semi);case 44:return++this.pos,this.finishToken(Xt.comma);case 91:return++this.pos,this.finishToken(Xt.bracketL);case 93:return++this.pos,this.finishToken(Xt.bracketR);case 123:return++this.pos,this.finishToken(Xt.braceL);case 125:return++this.pos,this.finishToken(Xt.braceR);case 58:return++this.pos,this.finishToken(Xt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Xt.backQuote);case 48:var K=this.input.charCodeAt(this.pos+1);if(K===120||K===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(K===111||K===79)return this.readRadixNumber(8);if(K===98||K===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(V);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(V);case 124:case 38:return this.readToken_pipe_amp(V);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(V);case 60:case 62:return this.readToken_lt_gt(V);case 61:case 33:return this.readToken_eq_excl(V);case 63:return this.readToken_question();case 126:return this.finishOp(Xt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ws(V)+"'")};on.finishOp=function(V,K){var be=this.input.slice(this.pos,this.pos+K);return this.pos+=K,this.finishToken(V,be)};on.readRegexp=function(){var V,K,be=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(be,"Unterminated regular expression");var Be=this.input.charAt(this.pos);if(En.test(Be))this.raise(be,"Unterminated regular expression");if(!V){if(Be==="[")K=!0;else if(Be==="]"&&K)K=!1;else if(Be==="/"&&!K)break;V=Be==="\\"}else V=!1;++this.pos}var Gt=this.input.slice(be,this.pos);++this.pos;var Wt=this.pos,Kt=this.readWord1();if(this.containsEsc)this.unexpected(Wt);var Vt=this.regexpState||(this.regexpState=new qo(this));Vt.reset(be,Gt,Kt),this.validateRegExpFlags(Vt),this.validateRegExpPattern(Vt);var Ut=null;try{Ut=new RegExp(Gt,Kt)}catch(Ht){}return this.finishToken(Xt.regexp,{pattern:Gt,flags:Kt,value:Ut})};on.readInt=function(V,K,be){var Be=this.options.ecmaVersion>=12&&K===void 0,Gt=be&&this.input.charCodeAt(this.pos)===48,Wt=this.pos,Kt=0,Vt=0;for(var Ut=0,Ht=K==null?1/0:K;Ut<Ht;++Ut,++this.pos){var zt=this.input.charCodeAt(this.pos),Yt=void 0;if(Be&&zt===95){if(Gt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Vt===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Ut===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Vt=zt;continue}if(zt>=97)Yt=zt-97+10;else if(zt>=65)Yt=zt-65+10;else if(zt>=48&&zt<=57)Yt=zt-48;else Yt=1/0;if(Yt>=V)break;Vt=zt,Kt=Kt*V+Yt}if(Be&&Vt===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Wt||K!=null&&this.pos-Wt!==K)return null;return Kt};function Gc(V,K){if(K)return parseInt(V,8);return parseFloat(V.replace(/_/g,""))}function zo(V){if(typeof BigInt!=="function")return null;return BigInt(V.replace(/_/g,""))}on.readRadixNumber=function(V){var K=this.pos;this.pos+=2;var be=this.readInt(V);if(be==null)this.raise(this.start+2,"Expected number in radix "+V);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)be=zo(this.input.slice(K,this.pos)),++this.pos;else if(m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Xt.num,be)};on.readNumber=function(V){var K=this.pos;if(!V&&this.readInt(10,void 0,!0)===null)this.raise(K,"Invalid number");var be=this.pos-K>=2&&this.input.charCodeAt(K)===48;if(be&&this.strict)this.raise(K,"Invalid number");var Be=this.input.charCodeAt(this.pos);if(!be&&!V&&this.options.ecmaVersion>=11&&Be===110){var Gt=zo(this.input.slice(K,this.pos));if(++this.pos,m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Xt.num,Gt)}if(be&&/[89]/.test(this.input.slice(K,this.pos)))be=!1;if(Be===46&&!be)++this.pos,this.readInt(10),Be=this.input.charCodeAt(this.pos);if((Be===69||Be===101)&&!be){if(Be=this.input.charCodeAt(++this.pos),Be===43||Be===45)++this.pos;if(this.readInt(10)===null)this.raise(K,"Invalid number")}if(m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Wt=Gc(this.input.slice(K,this.pos),be);return this.finishToken(Xt.num,Wt)};on.readCodePoint=function(){var V=this.input.charCodeAt(this.pos),K;if(V===123){if(this.options.ecmaVersion<6)this.unexpected();var be=++this.pos;if(K=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,K>1114111)this.invalidStringToken(be,"Code point out of bounds")}else K=this.readHexChar(4);return K};on.readString=function(V){var K="",be=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Be=this.input.charCodeAt(this.pos);if(Be===V)break;if(Be===92)K+=this.input.slice(be,this.pos),K+=this.readEscapedChar(!1),be=this.pos;else if(Be===8232||Be===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(os(Be))this.raise(this.start,"Unterminated string constant");++this.pos}}return K+=this.input.slice(be,this.pos++),this.finishToken(Xt.string,K)};var Xo={};on.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(V){if(V===Xo)this.readInvalidTemplateToken();else throw V}this.inTemplateElement=!1};on.invalidStringToken=function(V,K){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Xo;else this.raise(V,K)};on.readTmplToken=function(){var V="",K=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var be=this.input.charCodeAt(this.pos);if(be===96||be===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Xt.template||this.type===Xt.invalidTemplate))if(be===36)return this.pos+=2,this.finishToken(Xt.dollarBraceL);else return++this.pos,this.finishToken(Xt.backQuote);return V+=this.input.slice(K,this.pos),this.finishToken(Xt.template,V)}if(be===92)V+=this.input.slice(K,this.pos),V+=this.readEscapedChar(!0),K=this.pos;else if(os(be)){switch(V+=this.input.slice(K,this.pos),++this.pos,be){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:V+=`
|
|
8
|
-
`;break;default:V+=String.fromCharCode(be);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;K=this.pos}else++this.pos}};on.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(Xt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
9
|
-
`)++this.pos;case`
|
|
10
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};on.readEscapedChar=function(V){var K=this.input.charCodeAt(++this.pos);switch(++this.pos,K){case 110:return`
|
|
11
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ws(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(V){var be=this.pos-1;this.invalidStringToken(be,"Invalid escape sequence in template string")}default:if(K>=48&&K<=55){var Be=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Gt=parseInt(Be,8);if(Gt>255)Be=Be.slice(0,-1),Gt=parseInt(Be,8);if(this.pos+=Be.length-1,K=this.input.charCodeAt(this.pos),(Be!=="0"||K===56||K===57)&&(this.strict||V))this.invalidStringToken(this.pos-1-Be.length,V?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Gt)}if(os(K)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(K)}};on.readHexChar=function(V){var K=this.pos,be=this.readInt(16,V);if(be===null)this.invalidStringToken(K,"Bad character escape sequence");return be};on.readWord1=function(){this.containsEsc=!1;var V="",K=!0,be=this.pos,Be=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Gt=this.fullCharCodeAtPos();if(S(Gt,Be))this.pos+=Gt<=65535?1:2;else if(Gt===92){this.containsEsc=!0,V+=this.input.slice(be,this.pos);var Wt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Kt=this.readCodePoint();if(!(K?m:S)(Kt,Be))this.invalidStringToken(Wt,"Invalid Unicode escape");V+=Ws(Kt),be=this.pos}else break;K=!1}return V+this.input.slice(be,this.pos)};on.readWord=function(){var V=this.readWord1(),K=Xt.name;if(this.keywords.test(V))K=Fi[V];return this.finishToken(K,V)};var Wc="8.18.0";r.acorn={Parser:r,version:Wc,defaultOptions:Li,Position:Ss,SourceLocation:Us,getLineInfo:Oo,Node:zs,TokenType:pn,tokTypes:Xt,keywordTypes:Fi,TokContext:$n,tokContexts:ln,isIdentifierChar:S,isIdentifierStart:m,Token:Ui,isNewLine:os,lineBreak:En,lineBreakG:Ac,nonASCIIwhitespace:Lo};function ks(V){return(K)=>V(K)}function Xs(...V){return r.extend(...V)}function Ps(V,K,be){for(let Be=K;Be<be;Be++){let Gt=V.charCodeAt(Be);if(Gt===10||Gt===13||Gt===8232||Gt===8233)return!0}return!1}var _o=new WeakMap;function bn(V,K){if(V===void 0)return!1;if(V.length<16)return V.includes(K);let be=_o.get(V);if(be===void 0||be.length>V.length)be={names:new Set,length:0},_o.set(V,be);while(be.length<V.length)be.names.add(V[be.length++]);return be.names.has(K)}var Hi=Array(2048).fill(void 0);function Uc(){Hi.fill(void 0)}function Jo(V,K,be,Be){let Gt=Be&2047,Wt=Hi[Gt];if(Wt!==void 0&&Wt.length===be-K&&V.startsWith(Wt,K))return Wt;let Kt=V.slice(K,be);return Hi[Gt]=Kt,Kt}var cs="",Nn=[0],Gn=0,ps=0,Vn;function ee(V){Uc(),cs=V,Nn=[0],Gn=0,ps=0,Vn=void 0}function qi(V){while(Gn<=V){let K=cs.indexOf(`
|
|
12
|
-
`,Gn);if(K===-1){Gn=Number.POSITIVE_INFINITY;return}Gn=K+1,Nn.push(Gn)}}function Kc(V){let K=[0],be=V.indexOf(`
|
|
13
|
-
`);while(be!==-1)K.push(be+1),be=V.indexOf(`
|
|
14
|
-
`,be+1);return K}function zi(V,K,be){let Be=0,Gt=V.length-1;if(K>=V[be])Be=be;else Gt=be-1;if(Be<Gt&&K<V[Be+1])Gt=Be;while(Be<Gt){let Wt=Be+Gt+1>>>1;if(V[Wt]<=K)Be=Wt;else Gt=Wt-1}return Be}function h(V){return qi(V),ps=zi(Nn,V,ps),{line:ps+1,column:V-Nn[ps],character:V}}var Ki=/\r\n?|\n|\u2028|\u2029/g,Hc=/[\r\u2028\u2029]/;function Yo(V){if(Vn===void 0){Vn=Hc.test(cs)?[]:null,Ki.lastIndex=0;while(Vn!==null&&Ki.exec(cs)!==null)Vn.push(Ki.lastIndex)}if(Vn===null)return qi(V),zi(Nn,V,ps);let K=0,be=Vn.length;while(K<be){let Be=K+be>>>1;if(Vn[Be]<=V)K=Be+1;else be=Be}return K}function D(V){let{line:K,column:be}=h(V);return{line:K,column:be}}function Qo(V){while(Nn.length<=V+1&&Gn!==Number.POSITIVE_INFINITY)qi(Gn);if(V>=Nn.length)return;let K=V+1<Nn.length?Nn[V+1]-1:cs.length;return cs.slice(Nn[V],K)}function we(V){let K,be=0;return(Be)=>(K??=Kc(V),be=zi(K,Be,be),{line:be+1,column:Be-K[be]})}function Fn(V){return typeof V==="object"&&V!==null&&typeof Qn(V).type==="string"}function Qn(V){return V}function U(V,K){let be=Qn(V);for(let Be in be){let Gt=be[Be];if(Array.isArray(Gt)){for(let Wt=0;Wt<Gt.length;Wt++)if(Fn(Gt[Wt]))Gt[Wt]=K(Gt[Wt])}else if(Fn(Gt))be[Be]=K(Gt)}}function te(V,...K){if(!K.some((be)=>be===V.type))throw Error(`expected ${K.join(" or ")}, got ${V.type}`)}function fe(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var qc=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(V,K,be){super(`${be}
|
|
15
|
-
https://svelte.dev/e/${K}`);this.code=K,this.reason=be;let Be=typeof V==="number"?V:V?.start,Gt=typeof V==="number"?V:V?.end;if(Be!==void 0)this.position=[Be,Gt??Be],this.start=h(this.position[0]),this.end=h(this.position[1]),this.frame=zc(this.start.line-1,this.end.column)}}var Zo=(V)=>V.replace(qc,(K)=>" ".repeat(K.length));function zc(V,K){let be=Math.max(0,V-2),Be=[];for(let Wt=be;Wt<V+3;Wt++){let Kt=Qo(Wt);if(Kt===void 0)break;Be.push(Kt)}let Gt=String(be+Be.length+1).length;return Be.map((Wt,Kt)=>{let Vt=`${String(be+Kt+1).padStart(Gt," ")}: ${Zo(Wt)}`;if(be+Kt!==V)return Vt;return`${Vt}
|
|
16
|
-
${" ".repeat(Gt+2+Zo(Wt.slice(0,K)).length)}^`}).join(`
|
|
17
|
-
`)}function Ve(V){throw new e(V,"attribute_duplicate","Attributes need to be unique")}function Ue(V){throw new e(V,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function We(V,K){throw new e(V,"block_duplicate_clause",`${K} cannot appear more than once within a block`)}function He(V){throw new e(V,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function Ge(V){throw new e(V,"block_invalid_elseif","'elseif' should be 'else if'")}function ze(V,K,be){throw new e(V,"block_invalid_placement",`{#${K} ...} block cannot be ${be}`)}function Xe(V){throw new e(V,"block_unclosed","Block was left open")}function Qe(V){throw new e(V,"block_unexpected_close","Unexpected block closing tag")}function Ye(V){throw new e(V,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Ze(V){throw new e(V,"css_empty_declaration","Declaration cannot be empty")}function Ae(V){throw new e(V,"css_expected_identifier","Expected a valid CSS identifier")}function Ke(V){throw new e(V,"css_selector_invalid","Invalid selector")}function et(V){throw new e(V,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function _e(V){throw new e(V,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function tt(V){throw new e(V,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function nt(V,K){throw new e(V,"directive_missing_name",`\`${K}\` name cannot be empty`)}function rt(V,K){throw new e(V,"element_invalid_closing_tag",`\`</${K}>\` attempted to close an element that was not open`)}function it(V,K,be){throw new e(V,"element_invalid_closing_tag_autoclosed",`\`</${K}>\` attempted to close element that was already automatically closed by \`<${be}>\` (cannot nest \`<${be}>\` inside \`<${K}>\`)`)}function Ne(V,K){throw new e(V,"element_unclosed",`\`<${K}>\` was left open`)}function Ie(V){throw new e(V,"expected_attribute_value","Expected attribute value")}function st(V){throw new e(V,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function Re(V){throw new e(V,"expected_identifier","Expected an identifier")}function ot(V){throw new e(V,"expected_pattern","Expected identifier or destructure pattern")}function at(V){throw new e(V,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function v(V,K){throw new e(V,"expected_token",`Expected token ${K}`)}function ct(V){throw new e(V,"expected_whitespace","Expected whitespace")}function Xc(V,K){throw new e(V,"js_parse_error",`${K}`)}function pt(V){throw new e(V,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ut(V){throw new e(V,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function lt(V,K){throw new e(V,"script_invalid_attribute_value",`If the \`${K}\` attribute is supplied, it must be a boolean attribute`)}function ft(V){throw new e(V,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function dt(V,K){throw new e(V,"script_reserved_attribute",`The \`${K}\` attribute is reserved and cannot be used`)}function mt(V){throw new e(V,"style_duplicate","A component can have a single top-level `<style>` element")}function ht(V){throw new e(V,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function gt(V){throw new e(V,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function Le(V){throw new e(V,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function yt(V,K){throw new e(V,"svelte_meta_duplicate",`A component can only have one \`<${K}>\` element`)}function xt(V,K){throw new e(V,"svelte_meta_invalid_content",`<${K}> cannot have children`)}function Tt(V,K){throw new e(V,"svelte_meta_invalid_placement",`\`<${K}>\` tags cannot be inside elements or blocks`)}function Et(V,K){throw new e(V,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${K}`)}function St(V){throw new e(V,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function kt(V){throw new e(V,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function de(V,K){throw new e(V,"svelte_options_invalid_attribute_value",`Value must be ${K}, if specified`)}function bt(V){throw new e(V,"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 wt(V){throw new e(V,"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 vt(V){throw new e(V,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function Oe(V){throw new e(V,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function Ct(V){throw new e(V,"svelte_options_reserved_tagname","Tag name is reserved")}function Dt(V,K){throw new e(V,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${K}'`)}function Pt(V){throw new e(V,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function At(V,K,be){throw new e(V,"tag_invalid_placement",`{@${K} ...} tag cannot be ${be}`)}function f(V){throw new e(V,"unexpected_eof","Unexpected end of input")}function _t(V,K){throw new e(V,"unexpected_reserved_word",`'${K}' is a reserved word in JavaScript and cannot be used here`)}function Nt(V){throw new e(V,"unterminated_string_constant","Unterminated string constant")}function It(V){throw new e(V,"void_element_invalid_content","Void elements cannot have children or closing tags")}var ls="",na=[],Ys=0,fn=[],mn=0;function Jc(V,K){ls=V,na=K,Ys=0}function Yc(){return Ys}function Qc(V,K,be,Be){Ys=Be}function Zc(V,K,be,Be,Gt,Wt){Ys=Be;let Kt=K;if(V&&Kt.includes(`
|
|
18
|
-
`)){let Ut=ls.lastIndexOf(`
|
|
19
|
-
`,be-1)+1,Ht=Ut,zt=ls.charCodeAt(Ht);while(zt===32||zt===9)zt=ls.charCodeAt(++Ht);if(Ht>Ut)Kt=el(Kt,ls.slice(Ut,Ht))}let Vt={type:V?"Block":"Line",value:Kt,start:be,end:Be};if(Gt&&Wt)Vt.loc={start:Gt,end:Wt};na.push(Vt)}function el(V,K){let be=V.startsWith(K)?K.length:0,Be="",Gt=V.indexOf(`
|
|
20
|
-
`,be);while(Gt!==-1){if(Be+=V.slice(be,Gt+1),be=Gt+1,V.startsWith(K,be))be+=K.length;Gt=V.indexOf(`
|
|
21
|
-
`,be)}return Be+V.slice(be)}function tl(V,K,be){let Be=0,Gt=K.length;while(Be<Gt){let Wt=Be+Gt>>>1;if(K[Wt].start<be)Be=Wt+1;else Gt=Wt}if(Be>=K.length)return;if(fn=K.slice(Be).map(({type:Wt,value:Kt,start:Vt,end:Ut})=>({type:Wt,value:Kt,start:Vt,end:Ut})),mn=0,Ji(V,void 0,!1),mn<fn.length&&(fn[mn].start>=V.end||V.type==="Program")){V.trailingComments??=[];while(mn<fn.length)V.trailingComments.push(fn[mn++])}}var nl=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function ea(V,K){for(let be=V;be<K;be++){let Be=ls.charCodeAt(be);if(Be!==44&&Be!==41&&Be!==32&&Be!==9)return!0}return!1}function Ji(V,K,be){while(mn<fn.length&&fn[mn].start<V.start)V.leadingComments??=[],V.leadingComments.push(fn[mn++]);if(mn>=fn.length)return;let Be=fn[mn].start;if(Be<V.end||!ea(V.end,Be)){let Gt=Qn(V),Wt=nl.get(V.type),Kt=Wt===void 0?void 0:Gt[Wt],Vt=Array.isArray(Kt)&&Kt.length===0;for(let Ut in Gt){if(mn>=fn.length)return;if(Ut==="type")continue;let Ht=Gt[Ut];if(Array.isArray(Ht)){let zt=Ut===Wt;for(let Yt=0;Yt<Ht.length;Yt++){let Jt=Ht[Yt];if(Fn(Jt))Ji(Jt,V,zt?Yt===Ht.length-1:Vt)}}else if(Fn(Ht))Ji(Ht,V,Vt)}if(mn>=fn.length)return}if(K!==void 0&&V.end===K.end)return;if(be)while(mn<fn.length){if(K&&fn[mn].start>=K.end)break;V.trailingComments??=[],V.trailingComments.push(fn[mn++])}else if(V.end<=fn[mn].start&&!ea(V.end,fn[mn].start))V.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(" ")),Qs=!1,$s=1,sl=2,il=32,rl=256,ol=$s|sl|rl,al=2,pl=3,cl=4,ll=/\r\n?|\n|\u2028|\u2029/,ta=new Map;function Js(V){if(!(V instanceof RegExp))return V;let K=ta.get(V);if(!K){let be=new Set(V.source.slice(4,-2).split("|"));K={test:(Be)=>be.has(Be)},ta.set(V,K)}return K}var Yi=ks((V)=>class extends V{declareName(K,be,Be){let Gt=!1;if(be===al){let Wt=this.currentScope();if(Gt=bn(Wt.lexical,K)||bn(Wt.functions,K)||bn(Wt.var,K),Wt.lexical.push(K),this.inModule&&Wt.flags&$s)delete this.undefinedExports[K]}else if(be===cl)this.currentScope().lexical.push(K);else if(be===pl){let Wt=this.currentScope();Gt=this.treatFunctionsAsVar?bn(Wt.lexical,K):bn(Wt.lexical,K)||bn(Wt.var,K),Wt.functions.push(K)}else for(let Wt=this.scopeStack.length-1;Wt>=0;--Wt){let Kt=this.scopeStack[Wt];if(bn(Kt.lexical,K)&&!(Kt.flags&il&&Kt.lexical[0]===K)||!this.treatFunctionsAsVarInScope(Kt)&&bn(Kt.functions,K)){Gt=!0;break}if(Kt.var.push(K),this.inModule&&Kt.flags&$s)delete this.undefinedExports[K];if(Kt.flags&ol)break}if(Gt)this.raiseRecoverable(Be,`Identifier '${K}' has already been declared`)}}),Qi=ks((V)=>{let{keywordTypes:K,tokTypes:be}=V.acorn,Be=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((Wt)=>[Wt,K[Wt]])),Gt;return class extends V{constructor(Wt,Kt,Vt){super(Wt,Kt,Vt);this.keywords=Js(this.keywords),this.reservedWords=Js(this.reservedWords),this.reservedWordsStrict=Js(this.reservedWordsStrict),this.reservedWordsStrictBind=Js(this.reservedWordsStrictBind),Gt??=this.context[0]}reset(Wt,Kt,Vt){if(super.reset?.(Wt,Kt,Vt),this.input=Wt,this.containsEsc=!1,this.pos=Kt,Vt)this.lineStart=Kt-Vt.column,this.curLine=Vt.line;else this.lineStart=Wt.lastIndexOf(`
|
|
22
|
-
`,Kt-1)+1,this.curLine=this.options.locations?Wt.slice(0,this.lineStart).split(ll).length:1;this.type=be.eof,this.value=null,this.start=this.end=Kt,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=Kt;let Ut=this.context;if(Ut.length!==1||Ut[0]!==Gt)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let Yt in this.undefinedExports){this.undefinedExports=Object.create(null);break}let Ht=this.scopeStack,zt=Ht[0];if(Ht.length!==1||zt.flags!==$s||zt.var.length>0||zt.lexical.length>0||zt.functions.length>0||zt.tsTypes!==void 0||zt.tsExportOnly!==void 0||zt.tsEnums!==void 0)this.scopeStack=[],this.enterScope($s);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(Wt,Kt){let Vt=super.parseParenAndDistinguishExpression(Wt,Kt);if(Vt.type==="ParenthesizedExpression")Qs=!0;return Vt}checkUnreserved(Wt){if(me.has(Wt.name))super.checkUnreserved(Wt)}canInsertSemicolon(){let Wt=this.type;return Wt===be.eof||Wt===be.braceR||Ps(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let Wt=this.input,Kt=this.options.locations,Vt=this.pos,Ut=Wt.charCodeAt(Vt);for(;;)if(Ut===32||Ut===9)Ut=Wt.charCodeAt(++Vt);else if(Ut===10){if(Ut=Wt.charCodeAt(++Vt),Kt)this.curLine++,this.lineStart=Vt}else break;if(this.pos=Vt,Ut===47||Ut<33||Ut>=128)super.skipSpace()}readWord1(){let Wt=this.input,Kt=this.pos,Vt=Kt,Ut=Wt.charCodeAt(Vt),Ht=0;while(Ut>=97&&Ut<=122||Ut>=65&&Ut<=90||Ut>=48&&Ut<=57||Ut===95||Ut===36)Ht=Math.imul(Ht,31)+Ut|0,Ut=Wt.charCodeAt(++Vt);if(Ut>=128||Ut===92)return super.readWord1();return this.containsEsc=!1,this.pos=Vt,Jo(Wt,Kt,Vt,Ht)}readWord(){let Wt=this.readWord1();return this.finishToken(Be.get(Wt)??be.name,Wt)}}}),sa=Xs(Yi,Qi),ul=/ \(\d+:\d+\)$/;function As(V){return V}function ia(V){return V instanceof SyntaxError&&"pos"in V&&typeof V.pos==="number"}function Zi(V,K,be,Be,Gt,Wt=V.root.comments.length){let Kt=V.root.comments;Jc(K,Kt);let Vt={onComment:V.comments?Zc:Qc,sourceType:"module",ecmaVersion:16,locations:V.loc,preserveParens:Be};if(V.lfOnly)Vt.startLocation=h(be);let Ut=V.isTypeScript?V.typescript:sa;if(!Ut)fe();let Ht;try{Ht=Gt(Ut,Vt)}catch(zt){if(!ia(zt))throw zt;Xc(zt.pos,zt.message.replace(ul,""))}if(Kt.length>Wt)tl(As(Ht),Kt,be);return Ht}function he(V,K,be=0){return As(Zi(V,K,0,!1,(Be,Gt)=>{if(be>0&&Gt.locations)Gt.startLocation=h(be);let Wt=new Be(Gt,K,be).parse();return Wt.start=0,Wt},0))}function hl(V,K){if(!K)return{line:1,column:0};let{column:be}=h(V);return{line:Yo(V-be)+1,column:be}}var dl={count:0},Xi,fl=(V)=>V.parseExpression();function ml(V,K,be,Be,Gt){let Wt=Xi;if(Xi=void 0,Wt?.ParserClass===V&&Wt.onComment===K.onComment&&Wt.locations===K.locations&&Wt.parser.reset)Wt.parser.reset(be,Be,K.startLocation);else Wt={ParserClass:V,onComment:K.onComment,locations:K.locations,parser:new V(K,be,Be)};let Kt=Wt.parser;Kt.nextToken();let Vt=Gt(Kt);return Kt.input="",Xi=Wt,Vt}function ra(V,K,be,Be){return dl.count+=1,Qs=!1,Zi(V,K,be,!0,(Gt,Wt)=>(Wt.startLocation??=hl(be,Wt.locations),ml(Gt,Wt,K,be,Be)))}function O(V,K,be,Be=!1){let Gt=As(ra(V,K,be,fl)),Wt=Math.max(Gt.end,Yc());return{node:Qs&&!Be?er(Gt):Gt,end:Wt}}function Rt(V,K,be){let Be=V.root.comments.length,Gt=!0,Wt=ra(V,K,be,(Vt)=>{let Ut={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Ht=Vt.parseMaybeConditional(void 0,Ut);if(Vt.type!==sa.acorn.tokTypes.eof)return Gt=!1,Ht;let zt=Vt.toAssignable(Ht,!1,Ut);return Vt.checkLValPattern(zt),zt});if(!Gt){V.root.comments.length=Be;return}let Kt=As(Wt);return Qs?er(Kt):Kt}function Lt(V,K,be){return As(Zi(V,K,be,!1,(Be,Gt)=>{let Wt=new Be(Gt,K,be);try{return Wt.nextToken(),Wt.parseStatement(null,!0,Object.create(null))}catch(Kt){if(ia(Kt)&&Kt.pos===K.length)f(K.length);throw Kt}}))}function er(V){let K=V;while(K.type==="ParenthesizedExpression")K=K.expression;return U(K,er),K}var tr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,gl=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"]]),yl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),xl=new Set("public private protected readonly override".split(" ")),vl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),El=new Set("var let const function class interface enum".split(" ")),oa=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),aa=1,bl=32,Sl=256,Cl=0,wl=1,Ds=2,Tl=3,kl=4,nr=6,pa=7,fa=256,or=1024,Pl=8|or,$l=Ds|fa,ca=1,Al=2,la=40,Dl=41,Nl=44,ua=46,ha=58,Zs=61,da=60,ei=123,_l=91,sr=42,Rl=35,ir=34,rr=39,Il=SyntaxError("speculative parse failed"),le=ks((V)=>{let{tokTypes:K,keywordTypes:be,isIdentifierChar:Be,isIdentifierStart:Gt}=V.acorn,Wt=new V.acorn.TokenType("@");class Kt extends V{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Vt,Ut,Ht){super(Vt,Ut,Ht);let zt=this.options.onComment;if(typeof zt==="function")this.options.onComment=(Yt,Jt,Qt,Zt,tn,en)=>{if(Qt<this.$t)return;this.$t=Zt,zt.call(this,Yt,Jt,Qt,Zt,tn,en)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Vt){if(Vt===64)return++this.pos,this.finishToken(Wt);return super.getTokenFromCode(Vt)}readToken_lt_gt(Vt){if(this.inType)return this.finishOp(K.relational,1);return super.readToken_lt_gt(Vt)}$a(Vt){let Ut=this.inType;this.inType=!0;let Ht=Vt();if(this.inType=Ut,!Ut&&this.type===K.relational)this.pos=this.start,this.nextToken();return Ht}$1(){return this.type===K.relational&&this.value==="<"}$p(){if(this.type===K.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(K.relational,"<");return this.$1()}$c(){return this.type===K.relational&&this.value===">"}$u(){return this.type===K.prefix&&this.value==="!"}hasPrecedingLineBreak(){return Ps(this.input,this.lastTokEnd,this.start)}$d(Vt=this.pos){return tr.lastIndex=Vt,tr.exec(this.input),tr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Vt=this.$d(),Ut=Vt;while(Ut<this.input.length&&Be(this.input.charCodeAt(Ut)))Ut++;return this.input.slice(Vt,Ut)}$b(){return!Ps(this.input,this.pos,this.$d())}$14(){return this.$b()&&Gt(this.$2())&&!Object.hasOwn(be,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(Vt){this.pos=Vt.pos,this.type=Vt.type,this.value=Vt.value,this.start=Vt.start,this.end=Vt.end,this.startLoc=Vt.startLoc,this.endLoc=Vt.endLoc,this.lastTokStart=Vt.lastTokStart,this.lastTokEnd=Vt.lastTokEnd,this.lastTokStartLoc=Vt.lastTokStartLoc,this.lastTokEndLoc=Vt.lastTokEndLoc,this.curLine=Vt.curLine,this.lineStart=Vt.lineStart,this.context=Vt.context,this.exprAllowed=Vt.exprAllowed,this.containsEsc=Vt.containsEsc,this.inType=Vt.inType,this.$4=Vt.$4,this.$5=Vt.$5,this.$7=Vt.$7,this.scopeStack.length=Vt.scopes,this.privateNameStack.length=Vt.privateNames,this.labels=Vt.labels,this.labels.length=Vt.labelCount,this.strict=Vt.strict,this.yieldPos=Vt.yieldPos,this.awaitPos=Vt.awaitPos,this.awaitIdentPos=Vt.awaitIdentPos,this.potentialArrowAt=Vt.potentialArrowAt,this.potentialArrowInForAwait=Vt.potentialArrowInForAwait}raise(Vt,Ut){if(this.$n>0)throw Il;return super.raise(Vt,Ut)}$1y(Vt,Ut){try{super.raise(Vt,Ut)}catch(Ht){if(Ht instanceof SyntaxError)Ht.$1z=!0;throw Ht}throw Error("unreachable")}$g(Vt,Ut=!1){let Ht=this.$15();this.$n++;try{let zt=Vt();if(Ut||zt===void 0)this.$16(Ht);return zt}catch(zt){if(!(zt instanceof SyntaxError)||!Ut&&zt.$1z)throw zt;this.$16(Ht);return}finally{this.$n--}}$v(Vt){return this.$g(Vt,!0)===!0}$17(Vt){if(Vt.end=this.lastTokEnd,this.options.locations)Vt.loc.end=this.lastTokEndLoc}$q(Vt,Ut){if(Vt.start=Ut.start,this.options.locations)Vt.loc.start=Ut.loc.start}$6(Vt=!1){let Ut=this.startNode();return Ut.typeAnnotation=this.$a(()=>(this.next(),Vt?this.$20():this.$0())),this.finishNode(Ut,"TSTypeAnnotation")}$h(Vt,Ut){if(Ut&&this.eat(K.question))Vt.optional=!0,this.$17(Vt);if(this.type===K.colon)Vt.typeAnnotation=this.$6(),this.$17(Vt);return Vt}$20(){if(this.type!==K.name&&this.type!==K._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Gt(this.$2())){let Vt=this.startNode();if(this.next(),Vt.parameterName=this.type===K._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Vt,!0);return Vt.asserts=!0,Vt.typeAnnotation=null,this.finishNode(Vt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Vt=this.startNode();return Vt.parameterName=this.type===K._this?this.$w():this.parseIdent(!0),this.$x(Vt,!1)}return this.$0()}$x(Vt,Ut){this.next();let Ht=this.startNode();return Ht.typeAnnotation=this.$0(),Vt.typeAnnotation=this.finishNode(Ht,"TSTypeAnnotation"),Vt.asserts=Ut,this.finishNode(Vt,"TSTypePredicate")}$w(){let Vt=this.startNode();return this.next(),this.finishNode(Vt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Vt=this.$0();if(this.type!==K.eof)this.unexpected();return Vt}$0(){let Vt=this.$18();if(this.$4||this.type!==K._extends||this.hasPrecedingLineBreak())return Vt;let Ut=this.startNodeAt(Vt.start,Vt.loc?.start);return this.next(),Ut.checkType=Vt,Ut.extendsType=this.$i(!0,()=>this.$18()),this.expect(K.question),Ut.trueType=this.$i(!1,()=>this.$0()),this.expect(K.colon),Ut.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Ut,"TSConditionalType")}$i(Vt,Ut){let Ht=this.$4;this.$4=Vt;let zt=Ut();return this.$4=Ht,zt}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===K._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",K.bitwiseOR,()=>this.$1a("TSIntersectionType",K.bitwiseAND,()=>this.$1b()))}$19(Vt){let Ut=this.startNode();if(Vt==="TSConstructorType"){if(Ut.abstract=this.isContextual("abstract"),Ut.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Ut,K.arrow)),this.finishNode(Ut,Vt)}$r(Vt,Ut){if(this.$1())Vt.typeParameters=this.$8();if(this.expect(K.parenL),Vt.parameters=this.parseBindingList(K.parenR,!1,!0),this.type===Ut)Vt.typeAnnotation=this.$6(!0);else if(Ut===K.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==K.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===K.parenR||this.type===K.ellipsis)return!0;if(this.type===K.name||this.type===K._this)this.next();else if(this.type===K.braceL||this.type===K.bracketL)this.parseBindingAtom();else return!1;let Vt=this.type;if(Vt===K.colon||Vt===K.comma||Vt===K.question||Vt===K.eq)return!0;if(Vt!==K.parenR)return!1;return this.next(),this.type===K.arrow})}$1a(Vt,Ut,Ht){let zt=this.startNode(),Yt=this.eat(Ut),Jt=[];do Jt.push(Ht());while(this.eat(Ut));if(Jt.length===1&&!Yt)return Jt[0];return zt.types=Jt,this.finishNode(zt,Vt)}$1b(){if(this.type===K.name&&!this.containsEsc){let Vt=this.value;if(Vt==="keyof"||Vt==="unique"||Vt==="readonly"){let Ut=this.startNode();return this.next(),Ut.operator=Vt,Ut.typeAnnotation=this.$1b(),this.finishNode(Ut,"TSTypeOperator")}if(Vt==="infer"){let Ut=this.startNode();this.next();let Ht=this.startNode();Ht.name=this.$y();let zt=this.$g(()=>this.$22());if(zt)Ht.constraint=zt;return Ut.typeParameter=this.finishNode(Ht,"TSTypeParameter"),this.finishNode(Ut,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(K._extends))return;let Vt=this.$i(!0,()=>this.$0());return this.$4||this.type!==K.question?Vt:void 0}$y(){if(this.type!==K.name&&!this.type.keyword)this.unexpected();let Vt=this.type===K.name?this.value:this.type.keyword;return this.next(),Vt}$23(){let Vt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(K.bracketL)){let Ut=this.startNodeAt(Vt.start,Vt.loc?.start);if(this.eat(K.bracketR))Ut.elementType=Vt,Vt=this.finishNode(Ut,"TSArrayType");else Ut.objectType=Vt,Ut.indexType=this.$0(),this.expect(K.bracketR),Vt=this.finishNode(Ut,"TSIndexedAccessType")}return Vt}$24(){switch(this.type){case K.name:case K._void:case K._null:{let Vt=gl.get(this.value);if(Vt&&(this.type!==K.name||!this.containsEsc&&this.$2()!==ua)){let Ut=this.startNode();return this.next(),this.finishNode(Ut,Vt)}return this.$1c()}case K.string:case K.num:case K._true:case K._false:{let Vt=this.startNode();return Vt.literal=this.parseExprAtom(),this.finishNode(Vt,"TSLiteralType")}case K.plusMin:{if(this.value!=="-")break;let Vt=this.startNode(),Ut=this.startNode();if(this.next(),this.type!==K.num)this.unexpected();return Ut.operator="-",Ut.prefix=!0,Ut.argument=this.parseExprAtom(),Vt.literal=this.finishNode(Ut,"UnaryExpression"),this.finishNode(Vt,"TSLiteralType")}case K.backQuote:return this.$25();case K._this:{let Vt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Ut=this.startNodeAt(Vt.start,Vt.loc?.start);return Ut.parameterName=Vt,this.$x(Ut,!1)}return Vt}case K._typeof:return this.$26();case K._import:return this.$1d();case K.braceL:return this.$27()?this.$28():this.$29();case K.bracketL:return this.$2a();case K.parenL:{let Vt=this.startNode();return this.next(),Vt.typeAnnotation=this.$0(),this.expect(K.parenR),this.finishNode(Vt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Vt=this.startNode();if(Vt.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Vt.typeArguments=this.$e();return this.finishNode(Vt,"TSTypeReference")}$j(){let Vt=this.parseIdent(!0);while(this.eat(K.dot)){let Ut=this.startNodeAt(Vt.start,Vt.loc?.start);Ut.left=Vt,Ut.right=this.parseIdent(!0),Vt=this.finishNode(Ut,"TSQualifiedName")}return Vt}$26(){let Vt=this.startNode();if(this.next(),Vt.exprName=this.type===K._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Vt.typeArguments=this.$e();return this.finishNode(Vt,"TSTypeQuery")}$1d(){let Vt=this.startNode();if(this.next(),Vt.argument=this.$1e(),this.eat(K.dot))Vt.qualifier=this.$j();if(this.$1())Vt.typeArguments=this.$e();return this.finishNode(Vt,"TSImportType")}$z(){if(this.type!==K.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(K.parenL);let Vt=this.$z();return this.expect(K.parenR),Vt}$25(){let Vt=this.startNode(),Ut=this.startNode();this.next(),Ut.expressions=[];let Ht=this.parseTemplateElement({isTagged:!1});Ut.quasis=[Ht];while(!Ht.tail){if(this.type===K.eof)this.raise(this.pos,"Unterminated template literal");this.expect(K.dollarBraceL),Ut.expressions.push(this.$0()),this.expect(K.braceR),Ht=this.parseTemplateElement({isTagged:!1}),Ut.quasis.push(Ht)}return this.next(),Vt.literal=this.finishNode(Ut,"TemplateLiteral"),this.finishNode(Vt,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===K.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==K.bracketL)return!1;if(this.next(),this.type!==K.name)return!1;return this.next(),this.type===K._in})}$28(){let Vt=this.startNode();if(this.expect(K.braceL),this.type===K.plusMin)Vt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Vt.readonly=!0;this.expect(K.bracketL);let Ut=this.startNode();if(Ut.name=this.$y(),this.expect(K._in),Ut.constraint=this.$0(),Vt.typeParameter=this.finishNode(Ut,"TSTypeParameter"),Vt.nameType=this.eatContextual("as")?this.$0():null,this.expect(K.bracketR),this.type===K.plusMin)Vt.optional=this.value,this.next(),this.expect(K.question);else if(this.eat(K.question))Vt.optional=!0;if(this.eat(K.colon))Vt.typeAnnotation=this.$0();return this.semicolon(),this.expect(K.braceR),this.finishNode(Vt,"TSMappedType")}$29(){let Vt=this.startNode();return Vt.members=this.$1f(),this.finishNode(Vt,"TSTypeLiteral")}$1f(){this.expect(K.braceL);let Vt=[];while(!this.eat(K.braceR))Vt.push(this.$2b());return Vt}$2b(){let Vt=this.startNode(),Ut="TSPropertySignature",Ht=this.type===K._new?this.$2():-1;if(this.type===K.parenL||this.$1())Ut="TSCallSignatureDeclaration",this.$r(Vt,K.colon);else if(Ht===la||Ht===da)Ut="TSConstructSignatureDeclaration",this.next(),this.$r(Vt,K.colon);else{let zt=this.type===K._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Vt.readonly=!0;if(this.type===K.bracketL&&this.$1g())return this.$1h(Vt);let Yt="method";if(zt)Vt.key=zt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Yt=this.value,this.next();this.parsePropertyName(Vt)}if(this.eat(K.question))Vt.optional=!0;if(this.type===K.parenL||this.$1()){if(Ut="TSMethodSignature",Yt!=="method")Vt.kind=Yt;this.$r(Vt,K.colon),Vt.kind=Yt}else if(this.type===K.colon)Vt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Vt,Ut)}$1i(){if(!this.eat(K.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==K.name)return!1;return this.next(),this.type===K.colon})}$1h(Vt){if(this.expect(K.bracketL),Vt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(K.bracketR),this.type===K.colon)Vt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Vt,"TSIndexSignature")}$2a(){let Vt=this.startNode();this.expect(K.bracketL),Vt.elementTypes=[];while(!this.eat(K.bracketR))if(Vt.elementTypes.push(this.$2c()),this.type!==K.bracketR)this.expect(K.comma);return this.finishNode(Vt,"TSTupleType")}$2c(){let Vt=this.start,Ut=this.startLoc,Ht=this.eat(K.ellipsis),zt;if((this.type===K.name||this.type.keyword)&&this.$2d()){let Yt=this.startNode();Yt.label=this.parseIdent(!0),Yt.optional=this.eat(K.question),this.expect(K.colon),Yt.elementType=this.$0(),zt=this.finishNode(Yt,"TSNamedTupleMember")}else if(zt=this.$0(),this.eat(K.question)){let Yt=this.startNodeAt(zt.start,zt.loc?.start);Yt.typeAnnotation=zt,zt=this.finishNode(Yt,"TSOptionalType")}if(Ht){let Yt=this.startNodeAt(Vt,Ut);Yt.typeAnnotation=zt,zt=this.finishNode(Yt,"TSRestType")}return zt}$2d(){let Vt=this.$d();if(this.input.charCodeAt(Vt)===63)Vt=this.$d(Vt+1);return this.input.charCodeAt(Vt)===ha}$8(){return this.$a(()=>{let Vt=this.startNode();this.next(),Vt.params=[];while(!this.$c()){let Ut=this.startNode();while((this.type===K._const||this.type===K._in||this.isContextual("out"))&&Gt(this.$2()))Ut[this.value]=!0,this.next();if(Ut.name=this.$y(),this.eat(K._extends))Ut.constraint=this.$0();if(this.eat(K.eq))Ut.default=this.$0();if(Vt.params.push(this.finishNode(Ut,"TSTypeParameter")),!this.$c()){if(this.expect(K.comma),this.$c())Vt.extra={trailingComma:this.lastTokStart}}}if(this.next(),Vt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Vt,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Vt=this.startNode();this.next(),Vt.params=[];while(!this.$c())if(Vt.params.push(this.$0()),!this.$c())this.expect(K.comma);if(Vt.params.length===0)this.unexpected();return this.next(),this.finishNode(Vt,"TSTypeParameterInstantiation")})}$1j(){let Vt=[];do{let Ut=this.startNode();if(Ut.expression=this.$j(),this.$1())Ut.typeParameters=this.$e();Vt.push(this.finishNode(Ut,"TSExpressionWithTypeArguments"))}while(this.eat(K.comma));return Vt}$1k(Vt=!1){if(this.type!==K.name||this.containsEsc){if(this.type===K._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Vt);return this.$1l(this.startNode(),this.value)}$2e(Vt){switch(Vt){case"interface":case"type":case"namespace":return this.$14();case"enum":return Gt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Ut=this.$2();return this.$b()&&(Ut===ir||Ut===rr||Gt(Ut))}case"declare":return this.$b()&&vl.has(this.$3());case"global":return this.$b()&&this.$2()===ei}return!1}$1l(Vt,Ut){switch(Ut){case"interface":return this.$1m(Vt);case"type":return this.$2g(Vt);case"enum":return this.$10(Vt);case"abstract":return this.$1n(Vt,!0);case"global":return Vt.global=!0,Vt.id=this.parseIdent(),Vt.body=this.$11(),this.finishNode(Vt,"TSModuleDeclaration")}return this.$2h(Vt)}$2f(Vt){let Ut=this.$5;this.$5=!0;let Ht=this.startNode();this.next();let zt=this.value;if(zt==="const"&&this.$3()==="enum")Ht.const=!0;if(!Vt&&El.has(zt))Ht.declare=!0;let Yt;if(Ht.const)Yt=this.$10(Ht);else if(zt==="var"||zt==="let"||zt==="const")Yt=this.parseVarStatement(Ht,zt,!0);else if(zt==="function")this.next(),Yt=this.parseFunction(Ht,ca,!1,!1);else if(zt==="class")Yt=this.parseClass(Ht,!0);else Yt=this.$1l(Ht,zt);return Yt.declare=!0,this.$5=Ut,Yt}$1n(Vt,Ut){return this.next(),Vt.abstract=!0,this.parseClass(Vt,Ut)}$1m(Vt){if(this.next(),Vt.id=this.parseIdent(),this.checkLValSimple(Vt.id,pa),this.$1())Vt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(K._extends))Vt.extends=this.$1j();let Ut=this.startNode();Ut.body=this.$1f(),Vt.body=this.finishNode(Ut,"TSInterfaceBody")}),this.finishNode(Vt,"TSInterfaceDeclaration")}$2g(Vt){if(this.next(),Vt.id=this.parseIdent(),this.checkLValSimple(Vt.id,nr),this.$1())Vt.typeParameters=this.$8();return Vt.typeAnnotation=this.$a(()=>(this.expect(K.eq),this.$0())),this.semicolon(),this.finishNode(Vt,"TSTypeAliasDeclaration")}$10(Vt){if(this.type===K._const)Vt.const=!0,this.next();this.next(),Vt.id=this.parseIdent(),this.checkLValSimple(Vt.id,$l),this.expect(K.braceL),Vt.members=[];while(!this.eat(K.braceR)){let Ut=this.startNode();if(Ut.id=this.type===K.string?this.parseExprAtom():this.parseIdent(!0),this.eat(K.eq))Ut.initializer=this.parseMaybeAssign();if(Vt.members.push(this.finishNode(Ut,"TSEnumMember")),this.type!==K.braceR)this.expect(K.comma)}return this.finishNode(Vt,"TSEnumDeclaration")}$2h(Vt){if(this.next(),this.type===K.string){if(Vt.id=this.parseExprAtom(),this.type===K.braceL)Vt.body=this.$11();else this.semicolon();return this.finishNode(Vt,"TSModuleDeclaration")}return Vt.id=this.parseIdent(),this.checkLValSimple(Vt.id,Pl),this.$1o(Vt)}$1o(Vt){if(this.eat(K.dot)){let Ut=this.startNode();Ut.id=this.parseIdent(),Vt.body=this.$1o(Ut)}else Vt.body=this.$11();return this.finishNode(Vt,"TSModuleDeclaration")}$11(){this.enterScope(Sl);let Vt=this.startNode();this.enterScope(0),this.expect(K.braceL),Vt.body=[];while(!this.eat(K.braceR))Vt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Vt,"TSModuleBlock")}$1p(Vt,Ut){if(Vt.isExport=Ut,Vt.id=this.parseIdent(),this.checkLValSimple(Vt.id,Ds),this.expect(K.eq),this.isContextual("require")&&this.$2()===la){let Ht=this.startNode();this.next(),Ht.expression=this.$1e(),Vt.moduleReference=this.finishNode(Ht,"TSExternalModuleReference")}else Vt.moduleReference=this.$j();return this.semicolon(),this.finishNode(Vt,"TSImportEqualsDeclaration")}$2i(){let Vt=this.$d();if(this.input.charCodeAt(Vt)!==Zs)return!1;let Ut=this.input.charCodeAt(Vt+1);return Ut!==Zs&&Ut!==62}parseStatement(Vt,Ut,Ht){if(this.type===Wt)this.$1q(!0);let zt=this.$1k();if(zt)return zt;return super.parseStatement(Vt,Ut,Ht)}parseVarStatement(Vt,Ut,Ht){return super.parseVarStatement(Vt,Ut,Ht||this.$5)}parseVarId(Vt,Ut){if(super.parseVarId(Vt,Ut),Vt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Vt.definite=!0;this.$h(Vt.id,!1)}parseCatchClauseParam(){let Vt=this.$h(this.parseBindingAtom(),!1),Ut=Vt.type==="Identifier";return this.enterScope(Ut?bl:0),this.checkLValPattern(Vt,Ut?kl:Ds),this.expect(K.parenR),Vt}parseImport(Vt){if(this.next(),Vt.importKind="value",this.type===K.string)Vt.specifiers=[],Vt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Ut=this.$2();if(Ut===ei||Ut===sr||Gt(Ut)&&this.$3()!=="from")Vt.importKind="type",this.next()}if(this.type===K.name&&this.$2i())return this.$1p(Vt,!1);Vt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Vt.source=this.$z()}return this.$1r(Vt),this.semicolon(),this.finishNode(Vt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=K._with;return this.type===K._with?super.parseWithClause():void 0}$1r(Vt){let Ut=this.parseWithClause();if(Ut)Vt.attributes=Ut}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Vt){return this.$1s("exportKind",()=>super.parseExportSpecifier(Vt))}$1s(Vt,Ut){let Ht=this.isContextual("type")?this.$2():-1;if(Ht===ir||Ht===rr||Gt(Ht)&&this.$3()!=="as"){let Yt=this.startNode();this.next();let Jt=Ut();return this.$q(Jt,Yt),Jt[Vt]="type",Jt}let zt=Ut();return zt[Vt]="value",zt}parseExport(Vt,Ut){if(this.next(),this.eat(K._import)){if(Vt.importKind="value",this.isContextual("type")&&Gt(this.$2())&&this.$3()!=="from")Vt.importKind="type",this.next();return this.$1p(Vt,!0)}if(this.eat(K.eq))return Vt.expression=this.parseExpression(),this.semicolon(),this.finishNode(Vt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Vt.id=this.parseIdent(),this.semicolon(),this.finishNode(Vt,"TSNamespaceExportDeclaration");if(Vt.exportKind="value",this.isContextual("type")){let Yt=this.$2();if(Yt===ei||Yt===sr)Vt.exportKind="type",this.next()}if(this.eat(K.star))return this.parseExportAllDeclaration(Vt,Ut);if(this.eat(K._default)){if(this.isContextual("interface")&&this.$14())Vt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Vt.declaration=this.$1n(this.startNode(),"nullableID");else Vt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Vt,"ExportDefaultDeclaration")}let Ht=this.isContextual("declare"),zt=this.$1k(!0);if(zt||this.shouldParseExportStatement()){if(Vt.declaration=zt??this.parseStatement(null),Ht||Vt.declaration.type==="TSInterfaceDeclaration"||Vt.declaration.type==="TSTypeAliasDeclaration")Vt.exportKind="type";return Vt.specifiers=[],Vt.source=null,this.finishNode(Vt,"ExportNamedDeclaration")}if(Vt.declaration=null,Vt.specifiers=this.parseExportSpecifiers(Ut),this.eatContextual("from"))Vt.source=this.$z(),this.$1r(Vt);else{for(let Yt of Vt.specifiers)if(this.checkUnreserved(Yt.local),this.checkLocalExport(Yt.local),Yt.local.type==="Literal")this.raise(Yt.local.start,"A string literal cannot be used as an exported binding without `from`.");Vt.source=null}return this.semicolon(),this.finishNode(Vt,"ExportNamedDeclaration")}parseFunction(Vt,Ut,Ht,zt,Yt){let Jt=Ut&ca;if(Jt)this.$f=Vt,this.$o=Vt.start;super.parseFunction(Vt,Ut,Ht,zt,Yt),this.$f=null;let Qt=!Vt.body;if(Qt)Vt.type="TSDeclareFunction";if(Jt&&Vt.id){if(Qt){if(this.$5&&this.currentScope().flags&aa)this.declareName(Vt.id.name,or,Vt.id.start);this.checkLValSimple(Vt.id,Cl)}else if(!(Ut&Al)){let Zt=Tl;if(this.strict||Vt.generator||Vt.async)Zt=this.treatFunctionsAsVar?wl:Ds;this.checkLValSimple(Vt.id,Zt)}}return Vt}parseFunctionParams(Vt){if(this.$1())Vt.typeParameters=this.$8();if(super.parseFunctionParams(Vt),this.type===K.colon)Vt.returnType=this.$6(!0)}parseFunctionBody(Vt,Ut,Ht,zt){if(Ht&&this.type===K.colon)Vt.returnType=this.$6(!0);if(Ut||this.type===K.braceL||Vt.start!==this.$o){super.parseFunctionBody(Vt,Ut,Ht,zt);return}this.semicolon(),this.exitScope()}parseMethod(Vt,Ut,Ht){let zt=this.$k;this.$k=null;let Yt=super.parseMethod(Vt,Ut,Ht);if(!Yt.body)Yt.type="TSDeclareMethod";if(zt)Yt.typeParameters=zt;return Yt}parseBindingList(Vt,Ut,Ht,zt){let Yt=zt===!0||this.$l;return this.$l=!1,super.parseBindingList(Vt,Ut,Ht,Yt)}$s(Vt){if(!Vt&&!this.$b())return!1;let Ut=this.$2();return Ut===_l||Ut===ei||Ut===sr||Ut===ua||Ut===Rl||Ut===ir||Ut===rr||Ut>=48&&Ut<=57||Gt(Ut)}parseAssignableListItem(Vt){let Ut=this.$12(),Ht=this.start,zt=this.startLoc,Yt,Jt=!1,Qt=!1;if(Vt)while(this.type===K.name&&xl.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")Jt=!0;else if(this.value==="override")Qt=!0;else Yt=this.value;this.next()}let Zt;if(this.type===K._this)Zt=this.startNode(),Zt.name="this",this.next(),this.finishNode(Zt,"Identifier");else Zt=this.parseBindingAtom();let tn=this.type===K.eq?this.parseMaybeDefault(Ht,zt,Zt):this.parseMaybeDefault(Zt.start,Zt.loc?.start,this.$h(Zt,!0));if(Ut.length>0)tn.decorators=Ut;if(!Yt&&!Jt&&!Qt)return tn;let en=this.startNodeAt(Ht,zt);if(Yt)en.accessibility=Yt;if(Jt)en.readonly=!0;if(Qt)en.override=!0;return en.parameter=tn,this.finishNode(en,"TSParameterProperty")}parseBindingListItem(Vt){if(Vt.type==="RestElement")this.$h(Vt,!0);return Vt}checkLValSimple(Vt,Ut,Ht){if(this.$f&&Vt===this.$f.id){this.$f=null;return}if(!Ut&&oa.has(Vt.type)){this.checkLValSimple(Vt.expression,Ut,Ht);return}switch(Vt.type){case"TSParameterProperty":this.checkLValInnerPattern(Vt.parameter,Ut,Ht);return;case"Identifier":if(Vt.name==="this")return}super.checkLValSimple(Vt,Ut,Ht)}toAssignable(Vt,Ut,Ht){if(Vt&&!Ut&&oa.has(Vt.type))return Vt;return super.toAssignable(Vt,Ut,Ht)}declareName(Vt,Ut,Ht){let zt=this.currentScope();if(Ut&or){this.$1t(zt,Vt),zt.$1u??=[],zt.$1u.push(Vt);return}if(Ut===nr||Ut===pa){if(zt.$13??=[],Ut===nr&&bn(zt.$13,Vt))this.raise(Ht,`type '${Vt}' has already been declared.`);zt.$13.push(Vt),this.$1t(zt,Vt);return}if(Ut&fa){if(zt.$1v??=[],bn(zt.$1v,Vt))return;super.declareName(Vt,Ds,Ht),zt.$1v.push(Vt);return}super.declareName(Vt,Ut,Ht)}$1t(Vt,Ut){if(this.inModule&&Vt.flags&aa)delete this.undefinedExports[Ut]}checkLocalExport(Vt){for(let Ut=this.scopeStack.length-1;Ut>=0;Ut--){let Ht=this.scopeStack[Ut];if(bn(Ht.$13,Vt.name)||bn(Ht.$1u,Vt.name))return}super.checkLocalExport(Vt)}checkExport(){}raiseRecoverable(Vt,Ut){if(Ut==="Duplicate constructor in the same class")return;super.raiseRecoverable(Vt,Ut)}$12(){let Vt=[];while(this.type===Wt)Vt.push(this.$1w());return Vt}$1q(Vt){let Ut=this.$9[this.$9.length-1];while(this.type===Wt)Ut.push(this.$1w());if(this.type===K._export){if(!Vt)this.unexpected()}else if(this.type!==K._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 Vt=this.startNode();this.next(),this.$9.push([]);let Ut=this.start,Ht=this.startLoc,zt;if(this.type===K.parenL){if(this.next(),zt=this.parseExpression(),this.expect(K.parenR),this.options.preserveParens){let Jt=this.startNodeAt(Ut,Ht);Jt.expression=zt,zt=this.finishNode(Jt,"ParenthesizedExpression")}}else{zt=this.parseIdent(!1);while(this.eat(K.dot)){let Jt=this.startNodeAt(Ut,Ht);Jt.object=zt,Jt.property=this.parseIdent(!0),Jt.computed=!1,zt=this.finishNode(Jt,"MemberExpression")}}let Yt=this.$p()?this.$e():void 0;if(this.eat(K.parenL)){let Jt=this.startNodeAt(zt.start,zt.loc?.start);if(Jt.callee=zt,Jt.arguments=this.parseExprList(K.parenR,!1,!1),Yt)Jt.typeArguments=Yt;zt=this.finishNode(Jt,"CallExpression")}else if(Yt){let Jt=this.startNodeAt(zt.start,zt.loc?.start);Jt.expression=zt,Jt.typeArguments=Yt,zt=this.finishNode(Jt,"TSInstantiationExpression")}return Vt.expression=zt,this.$9.pop(),this.finishNode(Vt,"Decorator")}shouldParseExportStatement(){return this.type===Wt||super.shouldParseExportStatement()}parseExprAtom(Vt,Ut,Ht){if(this.type===Wt)this.$1q(!1);return super.parseExprAtom(Vt,Ut,Ht)}parseProperty(Vt,Ut){if(Vt||this.type!==Wt)return super.parseProperty(Vt,Ut);let Ht=this.$12(),zt=super.parseProperty(Vt,Ut);if(zt.type==="SpreadElement")this.raise(zt.start,"Decorators can't be used with SpreadElement");return zt.decorators=Ht,zt}parseClassId(Vt,Ut){let Ht=this.$9.length-1,zt=this.$9[Ht];if(zt.length>0)Vt.decorators=zt,this.$q(Vt,zt[0]),this.$9[Ht]=[];if(!this.isContextual("implements")||Ut===!0)super.parseClassId(Vt,Ut);if(this.$1())Vt.typeParameters=this.$8()}parseClassSuper(Vt){if(super.parseClassSuper(Vt),Vt.superClass&&this.$1())Vt.superTypeParameters=this.$e();if(this.eatContextual("implements"))Vt.implements=this.$a(()=>this.$1j())}parseClassElement(Vt){if(this.type===Wt){let Qt=this.$12();if(this.type===K.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Zt=this.parseClassElement(Vt);return Zt.decorators=Qt,this.$q(Zt,Qt[0]),Zt}if(this.eat(K.semi))return null;let Ut=this.startNode();while(this.type===K.name&&yl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let Qt=this.value;if(this.next(),Qt==="static"&&this.type===K.braceL)return this.next(),this.parseClassStaticBlock(Ut),Ut;if(Qt==="public"||Qt==="private"||Qt==="protected")Ut.accessibility=Qt;else Ut[Qt]=!0}if(this.type===K.bracketL&&this.$1g())return this.$1h(Ut);Ut.static??=!1;let Ht="",zt=!1,Yt=!1,Jt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===K.star)&&!this.canInsertSemicolon())Yt=!0;else Ht="async";if(!Ht&&this.eat(K.star))zt=!0;if(!Ht&&!Yt&&!zt){let Qt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Jt=Qt;else Ht=Qt}if(Ht)Ut.computed=!1,Ut.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Ut.key.name=Ht,this.finishNode(Ut.key,"Identifier");else this.parseClassElementName(Ut);if(this.eat(K.question))Ut.optional=!0;if(this.type===K.parenL||this.$1()||Jt!=="method"||zt||Yt){let Qt=Ut.key,Zt=!Ut.static&&!Ut.computed&&(Qt.type==="Identifier"&&Qt.name==="constructor"||Qt.type==="Literal"&&Qt.value==="constructor");if(Ut.kind=Zt?"constructor":Jt,this.$1())Ut.typeParameters=this.$8();this.$l=Zt,this.$o=this.start,this.parseClassMethod(Ut,zt,Yt,Zt&&Vt)}else{if(!Ut.optional&&this.$u())this.next(),Ut.definite=!0;if(this.type===K.colon)Ut.typeAnnotation=this.$6();this.parseClassField(Ut)}return Ut}parseMaybeAssign(Vt,Ut,Ht){if(this.$p()){let zt=this.$g(()=>{let Yt=this.$8(),Jt=super.parseMaybeAssign(Vt,Ut,Ht);if(Jt.type!=="ArrowFunctionExpression")return;return Jt.typeParameters=Yt,this.$q(Jt,Yt),Jt});if(zt)return zt}return super.parseMaybeAssign(Vt,Ut,Ht)}parseMaybeUnary(Vt,Ut,Ht,zt){if(this.$p()){let Yt=this.startNode();return Yt.typeAnnotation=this.$a(()=>{this.next();let Jt=this.$0();if(!this.$c())this.unexpected();return this.next(),Jt}),Yt.expression=this.parseMaybeUnary(null,!1,!1,zt),this.finishNode(Yt,"TSTypeAssertion")}return super.parseMaybeUnary(Vt,Ut,Ht,zt)}parseMaybeConditional(Vt,Ut){let Ht=this.start,zt=this.startLoc,Yt=this.parseExprOps(Vt,Ut);if(this.checkExpressionErrors(Ut))return Yt;if(this.type===K.question&&!(Yt.type==="ArrowFunctionExpression"&&Yt.start===Ht)&&!this.$2j()){this.next();let Jt=this.startNodeAt(Ht,zt);return Jt.test=Yt,Jt.consequent=this.parseMaybeAssign(),this.expect(K.colon),Jt.alternate=this.parseMaybeAssign(Vt),this.finishNode(Jt,"ConditionalExpression")}return Yt}$2j(){let Vt=this.$d(),Ut=this.input.charCodeAt(Vt);if(Ut===ha||Ut===Nl||Ut===Dl)return!0;return Ut===Zs&&this.input.charCodeAt(Vt+1)!==Zs}parseParenItem(Vt){return this.$h(Vt,!0)}$1x(){if(this.type!==K.colon)return!0;let Vt=this.$g(()=>{let Ut=this.$6(!0);return this.type===K.arrow&&!this.canInsertSemicolon()?Ut:void 0});if(!Vt)return!1;return this.$7=Vt,!0}shouldParseArrow(Vt){return this.$1x()&&super.shouldParseArrow(Vt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Vt,Ut,Ht,zt){if(this.$7)Vt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Vt,Ut,Ht,zt)}parseExprList(Vt,Ut,Ht,zt){if(!this.$m)return super.parseExprList(Vt,Ut,Ht,zt);this.$m=!1;let Yt=[],Jt=!0;while(!this.eat(Vt)){if(Jt)Jt=!1;else if(this.expect(K.comma),Ut&&this.afterTrailingComma(Vt))break;if(this.type===K.ellipsis){let Qt=this.parseSpread(zt);if(this.eat(K.question))Qt.optional=!0;if(this.type===K.colon)Qt.typeAnnotation=this.$6();Yt.push(Qt)}else Yt.push(this.parseMaybeAssign(!1,zt,this.parseParenItem))}return Yt}parseSubscript(Vt,Ut,Ht,zt,Yt,Jt,Qt){if(this.$u()&&!this.hasPrecedingLineBreak()){let tn=this.startNodeAt(Ut,Ht);return this.exprAllowed=!1,this.next(),tn.expression=Vt,this.finishNode(tn,"TSNonNullExpression")}if(Yt&&this.$1()){let tn=this.$g(()=>this.$2k(Ut,Ht,Qt));if(tn)return tn}let Zt=this.type===K.questionDot&&this.$2()===da;if(this.$1()||Zt||this.type===K.bitShift&&this.value==="<<"){let tn=this.$g(()=>{if(Zt)this.next();this.$p();let en=this.$e();if(this.type===K.parenL&&!zt)return en;if(this.type===K.backQuote)return Zt?void 0:en;if(Zt)return;if(this.$c()||this.type===K.bitShift||this.type.startsExpr&&this.type!==K.parenL&&!this.hasPrecedingLineBreak())return;return en});if(tn){let en=this.startNodeAt(Ut,Ht);if(this.type===K.parenL&&!zt){if(this.next(),en.callee=Vt,en.arguments=this.parseExprList(K.parenR,!0,!1),en.typeArguments=tn,Zt)Vt.optional=!0;if(Zt||Jt)en.optional=Zt;return this.finishNode(en,"CallExpression")}if(this.type===K.backQuote)return en.tag=Vt,en.quasi=this.parseTemplate({isTagged:!0}),en.typeArguments=tn,this.finishNode(en,"TaggedTemplateExpression");return en.expression=Vt,en.typeArguments=tn,this.finishNode(en,"TSInstantiationExpression")}}if(Yt&&this.type===K.parenL)this.$m=!0;return super.parseSubscript(Vt,Ut,Ht,zt,Yt,Jt,Qt)}$2k(Vt,Ut,Ht){let zt=this.startNodeAt(Vt,Ut);if(zt.typeParameters=this.$8(),this.expect(K.parenL),zt.params=this.parseBindingList(K.parenR,!1,!0),this.type===K.colon)zt.returnType=this.$6(!0);if(this.type!==K.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(zt,zt.params,!0,Ht)}parseDynamicImport(Vt){if(this.next(),Vt.source=this.parseMaybeAssign(),this.eat(K.comma)&&this.type!==K.parenR)Vt.arguments=[this.parseExpression()];return this.expect(K.parenR),this.finishNode(Vt,"ImportExpression")}parseNew(){let Vt=super.parseNew();if(Vt.callee?.type!=="TSInstantiationExpression")return Vt;let Ut=this.startNodeAt(Vt.start,Vt.loc?.start);return Ut.callee=Vt.callee.expression,Ut.typeArguments=Vt.callee.typeArguments,Ut.arguments=Vt.arguments,this.finishNodeAt(Ut,"NewExpression",Vt.end,Vt.loc?.end)}parseExprOp(Vt,Ut,Ht,zt,Yt){if(K._in.binop>zt&&this.type===K.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let Jt=this.value==="satisfies",Qt=this.startNodeAt(Ut,Ht);return Qt.expression=Vt,Qt.typeAnnotation=this.$a(()=>{if(this.next(),!Jt&&this.type===K._const){let Zt=this.startNode();return Zt.typeName=this.parseIdent(!0),this.finishNode(Zt,"TSTypeReference")}return this.$0()}),this.finishNode(Qt,Jt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(Qt,Ut,Ht,zt,Yt)}return super.parseExprOp(Vt,Ut,Ht,zt,Yt)}parseGetterSetter(Vt){Vt.kind=Vt.key.name,super.parseGetterSetter(Vt)}parsePropertyValue(Vt,Ut,Ht,zt,Yt,Jt,Qt,Zt){if(!Ut&&this.$1()){if(this.$k=this.$8(),this.type!==K.parenL)this.unexpected();Vt.kind="init"}return super.parsePropertyValue(Vt,Ut,Ht,zt,Yt,Jt,Qt,Zt)}}return Kt});var M=Xs(Yi,le,Qi);function ma(V,K,be){return ee(V),he({isTypeScript:K.typescript??!1,typescript:be,loc:K.loc??!1,comments:K.comments??!0,root:{comments:[]}},V)}function ge(V,K={}){return ma(V,K,M)}import ga,{sep as ar}from"node:path";var _n=/\.svelte$/,us=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],ya=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function hs(V){if(!V.endsWith(".svelte"))return!1;let K=V.length-7;if(K===0)return!1;let be=V.charCodeAt(K-1);return be!==47&&(ar==="/"||be!==92)}function n(V){return ar==="/"?V:V.split(ar).join("/")}function xa(V,K){return n(ga.join(K,ga.normalize(V)))}function Ns(V){return`${JSON.stringify(V,null,2)}
|
|
23
|
-
`}var va="sveld",ti="0.38.2";var Ot={name:va,version:ti,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:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"tsc --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",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",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:"tsc --noEmit && tsc --project tsconfig.excluded.json"},devDependencies:{"@biomejs/biome":"2.5.14","@types/bun":"^1.4.2","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",ostia:"^0.2.7",sveast:"^0.9.3",svelte:"^5.57.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 Ll=/\*\//g;function E(V){return V.replace(Ll,"*\\/")}function y(V){return V.map((K)=>`${K.name}${K.optional?"?":""}: ${K.type}`).join(", ")}var Ol=new Intl.Collator("en");function u(V,K){return Ol.compare(V,K)}var _s="5.57.1";var ni=1;function Wn(V){return V.some((K)=>K.internal)?V.filter((K)=>!K.internal):V}function Fl(V){return{...V,props:Wn(V.props),moduleExports:Wn(V.moduleExports),slots:Wn(V.slots),events:Wn(V.events),typedefs:Wn(V.typedefs),...V.contexts?{contexts:Wn(V.contexts).map((K)=>({...K,properties:Wn(K.properties)}))}:{}}}function d(V,K={}){let be=Array.from(V.values(),(Wt)=>{let{diagnostics:Kt,...Vt}=Wt;return Fl(Vt)}).sort((Wt,Kt)=>u(Wt.moduleName,Kt.moduleName)),Be={schemaVersion:ni,generator:{name:va,version:ti,svelteVersion:_s},total:be.length,components:be},Gt=K.entryExports?Wn(K.entryExports):void 0;if(Gt&&Gt.length>0)Be.totalExports=Gt.length,Be.exports=Gt;return Be}import{readFile as Bl}from"node:fs/promises";import ur from"node:path";function ds(V,K,be=0,Be=V.length,Gt=0){let Wt=Gt;for(let Kt=be;Kt<Be;Kt++){let Vt=V.charCodeAt(Kt);if(Vt===34||Vt===39||Vt===96){Kt=jl(V,Kt,Be);continue}if(Vt===123||Vt===40||Vt===91||Vt===60)Wt++;else if(Vt===125||Vt===41||Vt===93||Vt===62&&V.charCodeAt(Kt-1)!==61){if(Wt>0)Wt--}if(K?.(Kt,Wt)===!0)break}return Wt}function jl(V,K,be){let Be=V.charCodeAt(K);for(let Gt=K+1;Gt<be;Gt++){let Wt=V.charCodeAt(Gt);if(Wt===92)Gt++;else if(Wt===Be)return Gt}return be-1}function s(V,K){let be=[],Be=0;return ds(V,(Gt,Wt)=>{if(Wt===0&&K.includes(V[Gt]))be.push(V.slice(Be,Gt)),Be=Gt+1;return!1}),be.push(V.slice(Be)),be}function ne(V,K){let be=-1;return ds(V,(Be,Gt)=>{if(Gt===0&&K.includes(V[Be]))be=Be;return be!==-1}),be}function cr(V){let K=-1;return ds(V,(be,Be)=>{if(Be===0&&V[be]==="="&&V[be+1]===">")K=be;return K!==-1}),K}function A(V,K){let be=-1;return ds(V,(Be,Gt)=>{if(Gt===0)be=Be;return be!==-1},K),be}function lr(V){let K=V.trim();return K.startsWith("[")&&A(K,0)===K.length-1}function re(V){if(!V)return;let K=cr(V);if(K===-1)return;return V.slice(K+2).trim()||void 0}var Vl=/[:=]/,hr="COMPONENT_API.json",si={none:0,patch:1,minor:2,major:3};function Gl(V,K){return si[K]>si[V]?K:V}function Wl(V){return V.reduce((K,be)=>Gl(K,be.bump),"none")}function wa(V,K){return si[V]>=si[K]}function Ea(V){return new Set(s(V,"|").map((K)=>K.trim()).filter((K)=>K.length>0))}function ba(V){let K=cr(V);if(K===-1)return;let be=V.slice(0,K).trim(),Be=V.slice(K+2).trim();if(!be.startsWith("(")||!be.endsWith(")"))return;let Gt=be.slice(1,-1).trim();return{params:Gt.length===0?[]:s(Gt,",").map((Kt)=>Kt.trim()),returnType:Be}}function Ul(V){return(V.split(Vl,1)[0]??"").trimEnd().endsWith("?")}function Kl(V,K){if(V.returnType!==K.returnType)return"major";if(K.params.length<V.params.length)return"major";for(let Be=0;Be<V.params.length;Be++)if(V.params[Be]!==K.params[Be])return"major";if(K.params.length===V.params.length)return"none";return K.params.slice(V.params.length).every(Ul)?"minor":"major"}function dr(V,K){if(V===K)return"none";if(V===void 0||K===void 0)return"major";let be=ba(V),Be=ba(K);if(be&&Be)return Kl(be,Be);let Gt=Ea(V),Wt=Ea(K),Kt=[...Wt].some((Ut)=>!Gt.has(Ut));if(![...Gt].some((Ut)=>!Wt.has(Ut)))return Kt?"minor":"none";return"major"}function Sa(V){return V.bindable===!0||V.binding==="writable"}function ri(V,K,be){let Be=new Map(V.map((Ut)=>[be(Ut),Ut])),Gt=new Map(K.map((Ut)=>[be(Ut),Ut])),Wt=[...Gt].filter(([Ut])=>!Be.has(Ut)),Kt=[...Be.keys()].filter((Ut)=>!Gt.has(Ut)),Vt=[];for(let[Ut,Ht]of Be){let zt=Gt.get(Ut);if(zt)Vt.push([Ut,Ht,zt])}return{added:Wt,removed:Kt,common:Vt}}function Ca(V,K,be,Be){let Gt=K==="prop"?"prop":"export",Wt=[],Kt=(zt,Yt,Jt)=>Wt.push({component:V,kind:K,name:zt,bump:Yt,message:`${Gt} "${zt}" ${Jt}`}),{added:Vt,removed:Ut,common:Ht}=ri(be,Be,(zt)=>zt.name);for(let[zt,Yt]of Vt)Kt(zt,Yt.isRequired?"major":"minor",`added${Yt.isRequired?" (required)":""}`);for(let zt of Ut)Kt(zt,"major","removed");for(let[zt,Yt,Jt]of Ht){if(Yt.isRequired!==Jt.isRequired)Kt(zt,Jt.isRequired?"major":"minor",`became ${Jt.isRequired?"required":"optional"}`);let Qt=dr(Yt.type,Jt.type);if(Qt!=="none")Kt(zt,Qt,`type changed from \`${Yt.type??"unknown"}\` to \`${Jt.type??"unknown"}\``);let Zt=Sa(Jt);if(Sa(Yt)!==Zt)Kt(zt,Zt?"minor":"major",Zt?"gained a writable binding":"lost its writable binding");if(Yt.value!==Jt.value&&Qt==="none")Kt(zt,"patch",`default changed from \`${Yt.value??"none"}\` to \`${Jt.value??"none"}\``);let tn=Jt.deprecated!==void 0;if(Yt.deprecated!==void 0!==tn)Kt(zt,tn?"minor":"patch",tn?"marked as deprecated":"no longer deprecated");if(Yt.constant!==Jt.constant)Kt(zt,"minor",Jt.constant?"became constant":"became mutable");if(Yt.reactive!==Jt.reactive)Kt(zt,"minor",Jt.reactive?"became reactive":"stopped being reactive")}return Wt}function Hl(V,K,be){let Be=[],{added:Gt,removed:Wt,common:Kt}=ri(K,be,(Vt)=>Vt.name);for(let[Vt]of Gt)Be.push({component:V,kind:"event",name:Vt,bump:"minor",message:`event "${Vt}" added`});for(let Vt of Wt)Be.push({component:V,kind:"event",name:Vt,bump:"major",message:`event "${Vt}" removed`});for(let[Vt,Ut,Ht]of Kt){if(Ut.type!==Ht.type){Be.push({component:V,kind:"event",name:Vt,bump:"major",message:`event "${Vt}" changed from ${Ut.type} to ${Ht.type}`});continue}let zt=Ut.type==="dispatched"?Ut.detail:void 0,Yt=Ht.type==="dispatched"?Ht.detail:void 0,Jt=dr(zt,Yt);if(Jt!=="none")Be.push({component:V,kind:"event",name:Vt,bump:Jt,message:`event "${Vt}" detail changed from \`${zt??"unknown"}\` to \`${Yt??"unknown"}\``})}return Be}function ql(V,K,be){let Be=[],{added:Gt,removed:Wt,common:Kt}=ri(K,be,(Vt)=>Vt.name??"default");for(let[Vt]of Gt)Be.push({component:V,kind:"slot",name:Vt,bump:"minor",message:`slot "${Vt}" added`});for(let Vt of Wt)Be.push({component:V,kind:"slot",name:Vt,bump:"major",message:`slot "${Vt}" removed`});for(let[Vt,Ut,Ht]of Kt){let zt=dr(Ut.slot_props,Ht.slot_props);if(zt!=="none")Be.push({component:V,kind:"slot",name:Vt,bump:zt,message:`slot "${Vt}" props changed from \`${Ut.slot_props??"none"}\` to \`${Ht.slot_props??"none"}\``})}return Be}var zl=new Set(["description","source","componentCommentSource","tags"]);function ii(V){if(Array.isArray(V))return V.map(ii);if(V!==null&&typeof V==="object"){let K={};for(let[be,Be]of Object.entries(V)){if(zl.has(be))continue;K[be]=ii(Be)}return K}return V}var Xl=["generics","rest_props","extends","contexts","typedefs"];function Jl(V,K,be){let Be=[];for(let Gt of Xl){let Wt=JSON.stringify(ii(K[Gt])),Kt=JSON.stringify(ii(be[Gt]));if(Wt!==Kt)Be.push({component:V,kind:"shape",name:Gt,bump:"major",message:`"${Gt}" changed (breaking)`})}return Be}function Yl(V,K){let be=K.moduleName;return[...Ca(be,"prop",V.props,K.props),...Ca(be,"moduleExport",V.moduleExports,K.moduleExports),...Hl(be,V.events,K.events),...ql(be,V.slots,K.slots),...Jl(be,V,K)]}function Mt(V,K){let be=[],{added:Be,removed:Gt,common:Wt}=ri(V.components,K.components,(Kt)=>Kt.moduleName);for(let[Kt]of Be)be.push({component:Kt,kind:"component",bump:"minor",message:`component "${Kt}" added`});for(let Kt of Gt)be.push({component:Kt,kind:"component",bump:"major",message:`component "${Kt}" removed`});for(let[,Kt,Vt]of Wt)be.push(...Yl(Kt,Vt));return be}async function Ql(V){let K;try{K=await Bl(ur.resolve(V),"utf-8")}catch(be){if(be.code==="ENOENT")return null;throw be}try{return JSON.parse(K)}catch{throw Error(`sveld: could not parse "${V}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function xe(V){if(typeof V.check==="string")return V.check;return V.jsonOptions?.outFile??hr}function Te(V,K){if(!V.json||V.stdout||V.jsonOptions?.outDir)return!1;return ur.resolve(V.jsonOptions?.outFile??hr)===ur.resolve(K)}async function B(V,K,be={}){let Be=await Ql(K);if(Be===null)return{snapshotExists:!1,snapshotFile:K,changes:[],bump:"none"};if(Be.schemaVersion!==ni)return{snapshotExists:!0,snapshotFile:K,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Be.schemaVersion} differs from ${ni}; regenerate the snapshot`}],bump:"none"};let Gt=d(V,{entryExports:be.entryExports}),Wt=Mt(Be,Gt);return{snapshotExists:!0,snapshotFile:K,changes:Wt,bump:Wl(Wt)}}var Zl={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function Ee(V){if(!V.snapshotExists){let Gt=V.snapshotFile===hr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${V.snapshotFile}"\``;return`sveld --check: no snapshot found at "${V.snapshotFile}". Generate it with ${Gt} and commit it.`}if(V.changes.length===0)return`sveld --check: no API changes detected against "${V.snapshotFile}".`;let K=V.changes.length,be=[`sveld --check: ${K} API change${K===1?"":"s"} detected against "${V.snapshotFile}".`,`Suggested semver bump: ${V.bump}.`],Be=new Map;for(let Gt of V.changes){let Wt=Be.get(Gt.component)??[];Wt.push(Gt),Be.set(Gt.component,Wt)}for(let[Gt,Wt]of Be){be.push("",` ${Gt}`);for(let Kt of Wt){let Vt=Kt.kind==="schema"?"schema":Zl[Kt.bump];be.push(` [${Vt}] ${Kt.message}`)}}return be.join(`
|
|
24
|
-
`)}var $t=1;function Se(V){let K={kind:"check-report",schemaVersion:$t,...V};return Ns(K)}import{existsSync as su}from"node:fs";import{join as iu}from"node:path";import{pathToFileURL as ru}from"node:url";function i(V){return typeof V==="object"&&V!==null}function je(V){return i(V)&&V.type==="VariableDeclaration"&&Array.isArray(V.declarations)}function P(V){return i(V)&&V.type==="Literal"}function t(V){return i(V)&&V.type==="Identifier"&&typeof V.name==="string"}function k(V){return i(V)&&V.type==="MemberExpression"}function l(V){return i(V)&&V.type==="ObjectExpression"&&Array.isArray(V.properties)}function eu(V){return i(V)&&V.type==="CallExpression"}function g(V,K){return eu(V)&&t(V.callee)&&V.callee.name===K}function H(V){return V?.type==="TSAsExpression"||V?.type==="TSSatisfiesExpression"?H(V.expression):V}function Je(V){return V?.type==="TSAsExpression"||V?.type==="TSSatisfiesExpression"?V.typeAnnotation:void 0}function tu(V){return i(V)&&V.type==="NewExpression"}function Ce(V,K){return tu(V)&&t(V.callee)&&V.callee.name===K}function b(V){if(!i(V)||typeof V.type!=="string")return null;if(V.type==="Literal"){let K=V.value;if(typeof K==="string")return K;return K==null?null:String(K)}if(V.type==="TemplateLiteral"){let K=V.quasis;if(K?.length===1)return K[0]?.value?.cooked??null}return null}function c(V){if(t(V))return V.name;if(P(V))return V.value==null?void 0:String(V.value);return}function nu(V,K){let be=V.length+1,Be=K.length+1,Gt=Array.from({length:be},()=>Array(Be).fill(0));for(let Wt=0;Wt<be;Wt++)Gt[Wt][0]=Wt;for(let Wt=0;Wt<Be;Wt++)Gt[0][Wt]=Wt;for(let Wt=1;Wt<be;Wt++)for(let Kt=1;Kt<Be;Kt++){let Vt=V[Wt-1]===K[Kt-1]?0:1;if(Gt[Wt][Kt]=Math.min(Gt[Wt-1][Kt]+1,Gt[Wt][Kt-1]+1,Gt[Wt-1][Kt-1]+Vt),Wt>1&&Kt>1&&V[Wt-1]===K[Kt-2]&&V[Wt-2]===K[Kt-1])Gt[Wt][Kt]=Math.min(Gt[Wt][Kt],Gt[Wt-2][Kt-2]+1)}return Gt[be-1][Be-1]}function _(V,K,be=3){let Be,Gt=Number.POSITIVE_INFINITY;for(let Wt of K){let Kt=nu(V,Wt);if(Kt<Gt)Be=Wt,Gt=Kt}return Gt<=be?Be:void 0}var ou=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function qt(V){return V}function au(V=process.cwd()){for(let K of ou){let be=iu(V,K);if(su(be))return be}return null}async function Y(V){let K;try{K=await import(`${ru(V).href}?t=${Date.now()}`)}catch(Be){let Gt=Be instanceof Error?Be.message:String(Be);throw Error(`sveld: failed to load config file "${V}".
|
|
25
|
-
${Gt}`)}let be=K.default;if(!i(be)||Array.isArray(be))throw Error(`sveld: config file "${V}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return be}async function j(V=process.cwd()){let K=au(V);return K===null?{}:Y(K)}function N(...V){let K={};for(let be of V){if(!be)continue;for(let[Be,Gt]of Object.entries(be)){let Wt=K[Be];K[Be]=i(Wt)&&!Array.isArray(Wt)&&i(Gt)&&!Array.isArray(Gt)?{...Wt,...Gt}:Gt}}return K}var Ta=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],pu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function ka(V,K,be){let Be=V===null?K:`${V}.${K}`,Gt=_(K,be),Wt=Gt===void 0?void 0:V===null?Gt:`${V}.${Gt}`;console.warn(`sveld: unknown option "${Be}".${Wt?` Did you mean "${Wt}"?`:""}`)}function J(V){for(let K of Object.keys(V))if(!Ta.includes(K))ka(null,K,Ta);for(let[K,be]of Object.entries(pu)){let Be=V[K];if(!i(Be))continue;for(let Gt of Object.keys(Be))if(!be.includes(Gt))ka(K,Gt,be)}}function ke(V){if(V instanceof e)return V.start?`${V.reason} (${V.start.line}:${V.start.column})`:V.reason;return V instanceof Error?V.message:String(V)}import{dirname as gc,isAbsolute as mm,resolve as gm}from"node:path";import{lstatSync as If}from"node:fs";import{readFile as Lf}from"node:fs/promises";import{resolve as Vp}from"node:path";import{dirname as Sh}from"node:path";var x=Symbol("sveld.parsedComponentTypeScriptMetadata");function Pa(V){return V[x]}var cu=" ",lu=120,uu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,hu=200,Na=/\s/,du=/\s{2}|[^\S ]/,fu=/["'`{}/]/g,mu=/["'`{};/]/g,_a=9,fr=10,gu=13,Rs=32,ai=34,yu=38,pi=39,xu=40,vu=41,oi=42,$a=46,gr=47,Ra=59,Eu=62,bu=91,yr=92,Su=93,ci=96,xr=123,Cu=124,vr=125;function wu(V){return uu.test(ku(V,hu))}var Aa=[""];function Tu(V){let K=Aa[V];if(K===void 0)K=cu.repeat(V),Aa[V]=K;return K}function ku(V,K){let be="";for(let Be=V.length-1;Be>=0&&be.length<K;Be--)be=V[Be]+be;return be.length>K?be.slice(-K):be}function Pu(V){if(V.length===0)return!1;let K=V[V.length-1];return K.charCodeAt(K.length-1)===fr}function $u(V){while(V.length>0){let K=V[V.length-1],be=K.length;while(be>0){let Be=K.charCodeAt(be-1);if(Be!==Rs&&Be!==_a)break;be--}if(be===K.length)return;if(be===0){V.pop();continue}V[V.length-1]=K.slice(0,be);return}}function Au(V){while(V.length>0){let K=V[V.length-1];if(!Na.test(K[K.length-1]))return;let be=K.trimEnd();if(be.length===K.length)return;if(be.length===0){V.pop();continue}V[V.length-1]=be;return}}function Du(V){if(V.includes("{"))return!1;let K=0,be=0;for(let Be=0;Be<V.length;Be++){let Gt=V.charCodeAt(Be);if(K!==0){if(Gt===K&&V.charCodeAt(Be-1)!==yr)K=0;continue}if(Gt===ai||Gt===pi||Gt===ci){K=Gt;continue}if(Gt===Ra&&++be>=2)return!0}return!1}function Nu(V){if(!du.test(V))return V.trimEnd();let K="",be=null,Be=!1;for(let Gt=0;Gt<V.length;Gt++){let Wt=V[Gt],Kt=V[Gt-1];if(be){if(K+=Wt,be==="double"&&Wt==='"'&&Kt!=="\\"||be==="single"&&Wt==="'"&&Kt!=="\\"||be==="template"&&Wt==="`"&&Kt!=="\\")be=null;Be=!1;continue}if(Wt==='"'||Wt==="'"||Wt==="`"){be=Wt==='"'?"double":Wt==="'"?"single":"template",K+=Wt,Be=!1;continue}if(Na.test(Wt)){if(!Be&&K.length>0)K+=" ",Be=!0;continue}K+=Wt,Be=!1}return K.trimEnd()}function Ia(V,K){let be=V[K],Be=V.indexOf(be,K+1);while(Be!==-1&&V.charCodeAt(Be-1)===yr)Be=V.indexOf(be,Be+1);return Be}function La(V,K){let be=V.indexOf("*/",K+1);return be===-1?-1:be+1}function _u(V){let K=new Map,be=[],Be=fu,Gt=0;while(Gt<V.length){if(Be.lastIndex=Gt,!Be.test(V))break;Gt=Be.lastIndex-1;let Wt=V.charCodeAt(Gt);if(Wt===gr){if(V.charCodeAt(Gt+1)===oi){let Kt=La(V,Gt);if(Kt===-1)break;Gt=Kt}}else if(Wt===ai||Wt===pi||Wt===ci){let Kt=Ia(V,Gt);if(Kt===-1)break;Gt=Kt}else if(Wt===xr)be.push(Gt);else if(Wt===vr&&be.length>0)K.set(be.pop(),Gt);Gt++}return K}function Ru(V,K,be){for(let Be=K;Be<be;Be++)if(!mr(V.charCodeAt(Be)))return!1;return!0}function mr(V){if(V<=Rs)return V===Rs||V>=_a&&V<=gu;if(V<160)return!1;return V===160||V===5760||V>=8192&&V<=8202||V===8232||V===8233||V===8239||V===8287||V===12288||V===65279}function Oa(V,K,be,Be){let Gt=[],Wt=mu,Kt=K,Vt=K;while(Vt<be){if(Wt.lastIndex=Vt,!Wt.test(V))break;if(Vt=Wt.lastIndex-1,Vt>=be)break;let Ut=V.charCodeAt(Vt);if(Ut===gr){if(V.charCodeAt(Vt+1)===oi){let Ht=La(V,Vt);if(Ht===-1)break;Vt=Ht}Vt++;continue}if(Ut===ai||Ut===pi||Ut===ci){let Ht=Ia(V,Vt);if(Ht===-1)break;Vt=Ht+1;continue}if(Ut===xr){let Ht=Be.get(Vt);if(Ht===void 0||Ht>=be){Vt++;continue}if(Kt<Vt)Gt.push(V.slice(Kt,Vt));let zt=Vt+1;if(Ru(V,zt,Ht)){Gt.push("{}"),Vt=Ht+1,Kt=Vt;continue}let Yt=V.slice(zt,Ht),Jt=V.charCodeAt(zt)===fr;if(!Jt&&!Yt.includes("/*")&&!Du(Yt)&&!wu(Gt)){let Qt=Oa(V,zt,Ht,Be),Zt=Qt.trim();if(!Zt.includes(`
|
|
26
|
-
`)){let tn=Zt.endsWith(";")?Zt.slice(0,-1):Zt,en=`{ ${Nu(tn)} }`;if(en.length<=lu){Gt.push(en),Vt=Ht+1,Kt=Vt;continue}}if(Gt.push("{"),Qt.charCodeAt(0)!==Ra)Gt.push(`
|
|
27
|
-
`);if(Qt.length>0)Gt.push(Qt);Vt=Ht,Kt=Ht;continue}if(Gt.push("{"),!Jt)Gt.push(`
|
|
28
|
-
`);Vt=zt,Kt=zt;continue}if(Ut===vr){if(Kt<Vt)Gt.push(V.slice(Kt,Vt));if($u(Gt),!Pu(Gt))Gt.push(`
|
|
29
|
-
`);Gt.push("}"),Vt++,Kt=Vt;continue}if(Kt<Vt)Gt.push(V.slice(Kt,Vt));if(Au(Gt),Gt.push(";"),V.charCodeAt(Vt+1)!==fr)Gt.push(`
|
|
30
|
-
`);Vt++,Kt=Vt}if(Kt<be)Gt.push(V.slice(Kt,be));return Gt.join("")}function Iu(V){if(!V.includes(" "))return V;let K="",be=0;for(let Be=0;Be<V.length;Be++){let Gt=V.charCodeAt(Be);if(be!==0){if(K+=V[Be],Gt===be&&V.charCodeAt(Be-1)!==yr)be=0;continue}if(Gt===ai||Gt===pi||Gt===ci){be=Gt,K+=V[Be];continue}if(Gt===Rs&&K.charCodeAt(K.length-1)===Rs)continue;K+=V[Be]}return K}function Lu(V){return V===vr||V===Su||V===vu||V===Eu}function Ou(V,K,be){return be-K>=3&&V.charCodeAt(K)===gr&&V.charCodeAt(K+1)===oi&&V.charCodeAt(K+2)===oi}function Da(V,K,be){let Be=V.indexOf("*/",K);return Be!==-1&&Be+2<=be}function Mu(V,K,be){let Be=V.charCodeAt(K);if(Be===Cu||Be===yu)return!0;return Be===$a&&K+1<be&&V.charCodeAt(K+1)!==$a}function Fu(V){let K=[],be=[],Be=V.length,Gt=0,Wt=!1,Kt=0,Vt=0;while(Vt<=Be){let zt=V.indexOf(`
|
|
31
|
-
`,Vt);if(zt===-1)zt=Be;let Yt=zt+1,Jt=Vt,Qt=zt;while(Jt<Qt&&mr(V.charCodeAt(Jt)))Jt++;while(Qt>Jt&&mr(V.charCodeAt(Qt-1)))Qt--;if(Jt===Qt){let cn=be.length>0?be[be.length-1]:void 0;if(cn!==void 0&&cn!==""){let un=cn.charCodeAt(cn.length-1);if(un!==xr&&un!==xu&&un!==bu)K.push(0),be.push("")}Vt=Yt;continue}if(Wt){if(K.push(Kt),be.push(` ${V.slice(Jt,Qt)}`),Da(V,Jt,Qt))Wt=!1;Vt=Yt;continue}let Zt=Ou(V,Jt,Qt),tn=Zt&&Da(V,Jt,Qt);if(Zt&&!tn){K.push(Gt),be.push(V.slice(Jt,Qt)),Wt=!0,Kt=Gt,Vt=Yt;continue}let en=Lu(V.charCodeAt(Jt)),rn=Math.max(0,Gt-(en?1:0))+(Mu(V,Jt,Qt)?1:0);if(en&&rn===0&&be.length>0&&be[be.length-1]==="")K.pop(),be.pop();if(K.push(rn),be.push(Iu(V.slice(Jt,Qt))),Vt=Yt,tn)continue;Gt=ds(V,void 0,Jt,Qt,Gt)}let Ut=be.length;while(Ut>0&&be[Ut-1]==="")Ut--;let Ht=[];for(let zt=0;zt<Ut;zt++){if(zt>0)Ht.push(`
|
|
32
|
-
`);let Yt=K[zt];if(Yt>0)Ht.push(Tu(Yt));Ht.push(be[zt])}return Ht.join("")}function Ma(V){return`${Fu(Oa(V,0,V.length,_u(V)))}
|
|
33
|
-
`}var Rn="any",In="",ju="Record<string, any>",Is="Record<string, never>",Wa=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Bu=/CustomEvent/,Vu=/^[A-Z]/,Gu=/\n/,Ua=/=>/,Wu=/(?:^|\n)@default\b/,br=/\n/g,Uu=/^([ \t]*\*) +$/gm,Ku=/\s+/g,fs=/(^|[^.\w])Snippet(?:\s*<|\b)/,Hu=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,qu=/[.*+?^${}()|[\]\\]/g,zu=/^const\s+/,Xu=/^export /,Ju=/[^\w$]/g;function Ka(V){return V.replace(zu,"")}function Yu(V){if(!V)return;return V.replace(br,`
|
|
34
|
-
* `)}function Sr(V){if(!V)return"";return`/** ${E(V)} */`}function Cr(V){if(!V)return"";return`/**
|
|
35
|
-
* ${E(V).replace(br,`
|
|
36
|
-
* `)}
|
|
37
|
-
*/`}function Ha(V){return V?.includes(`
|
|
38
|
-
`)?Cr(V):Sr(V)}function qa(V){if(V===void 0)return;return V===!0?"@deprecated":`@deprecated ${V}`}function Qu(V){let K=qa(V);if(K===void 0)return;return`* ${K.replace(br,`
|
|
39
|
-
* `)}
|
|
40
|
-
`}function Zu(V,K){if(!K)return[`@${V}`];if(!K.includes(`
|
|
41
|
-
`))return[`@${V} ${K}`];return[`@${V}`,...K.split(`
|
|
42
|
-
`)]}function wr(V){let K=[];for(let{name:be,body:Be}of V??[])K.push(...Zu(be,Be));return K}function Tr(V,K,be){let Be=qa(be),Gt=wr(K);if(!(Gt.length>0)&&!Be)return Ha(V);let Kt=[];if(V)Kt.push(...V.split(`
|
|
43
|
-
`));if(Kt.push(...Gt),Be)Kt.push(...Be.split(`
|
|
44
|
-
`));return`/**
|
|
45
|
-
* ${E(Kt.join(`
|
|
46
|
-
* `))}
|
|
47
|
-
*/`}function eh(V){let K=wr(V);if(K.length===0)return"";return K.map((be)=>`* ${be}
|
|
48
|
-
`).join("")}function li(V){if(V===void 0)return Rn;return`${V}
|
|
49
|
-
`}function ui(V){if(V.typedefs.length===0)return In;return V.typedefs.map((K)=>{let be,Be=wr(K.tags);if(Be.length===0)be=K.description?`${Cr(K.description)}
|
|
50
|
-
`:"";else{let Gt=K.description?[...K.description.split(`
|
|
51
|
-
`),...Be]:Be;be=`/**
|
|
52
|
-
* ${E(Gt.join(`
|
|
53
|
-
* `))}
|
|
54
|
-
*/
|
|
55
|
-
`}return`${be}export ${K.ts}`.replace(Uu,"$1")}).join(`
|
|
56
|
-
|
|
57
|
-
`)}var Fa=new Map;function th(V,K){let be=Fa.get(K);if(be===void 0){let Be=K.replace(qu,"\\$&");be=new RegExp(`\\b${Be}\\b`),Fa.set(K,be)}return be.test(V)}var ja,Ba=[];function za(V){if(V!==ja)ja=V,Ba=s(V,",");return Ba}function nh(V){if(V===null)return[];return V[0].split(",").map((K,be)=>({name:K.trim(),constraint:(za(V[1]??"")[be]??K).trim()}))}function Xa(V,K){let be=nh(V).filter(({name:Be})=>th(K,Be));if(be.length===0)return{declSuffix:In,refSuffix:In};return{declSuffix:`<${be.map(({constraint:Be})=>Ka(Be)).join(", ")}>`,refSuffix:`<${be.map(({name:Be})=>Be).join(", ")}>`}}function Ja(V){if(!V.contexts||V.contexts.length===0)return In;return V.contexts.map((K)=>{let be=K.properties.map((Kt)=>{let Vt=Kt.description?`${Sr(Kt.description)}
|
|
58
|
-
`:"",Ut=Kt.optional?"?":"";return`${Vt}${Kt.name}${Ut}: ${Kt.type};`}).join(`
|
|
59
|
-
`),Be=K.description?`${Cr(K.description)}
|
|
60
|
-
`:"",{declSuffix:Gt}=Xa(V.generics,[K.type??"",...K.properties.map((Kt)=>Kt.type)].join(`
|
|
61
|
-
`));if(K.type!==void 0)return`${Be}export type ${K.typeName}${Gt} = ${K.type};`;if(K.properties.length===0)return`${Be}export type ${K.typeName} = ${K.hasUnresolvedSpread?"Record<string, any>":Is};`;let Wt=K.hasUnresolvedSpread?" & Record<string, any>":"";return`${Be}export type ${K.typeName}${Gt} = {
|
|
62
|
-
${be}
|
|
63
|
-
}${Wt};`}).join(`
|
|
64
|
-
|
|
65
|
-
`)}function Ln(V){return Wa.test(V)?V:JSON.stringify(V)}function Ya(V,K){if(!V)return;return`* ${K||V}
|
|
66
|
-
`}function ms(V,K,be){return[Ya(Yu(V)),Qu(K),eh(be)].filter(Boolean).join("")}function Zn(V){return V.length>0?`/**
|
|
67
|
-
${E(V)}*/`:In}function Va(V,K){let be=Tr(K.description,K.tags,K.deprecated),Be=be?`${be}
|
|
68
|
-
`:"",Gt=!K.slot_props||K.slot_props===Is?"[]":ih(K.slot_props),Wt=Gt==="[]"?"(this: void) => void":`(this: void, ...args: ${Gt}) => void`;return`
|
|
69
|
-
${Be}${V}?: ${Wt};`}function sh(V){let K=V.props.filter((Jt)=>!Jt.isFunctionDeclaration&&Jt.kind!=="const"),be=new Set([...K.map((Jt)=>Jt.name),...Array.from(V.canonicalPropNames??[])]),Gt=(V.canonicalPropsType?K.filter((Jt)=>!V.canonicalPropNames?.has(Jt.name)):K).map((Jt)=>{let Qt=typeof Jt.value==="string"?Jt.value.replace(Ku," "):Jt.value,Zt=Wu.test(Jt.description??"")||Jt.value===void 0||Jt.value==="undefined",tn=[ms(Jt.description,Jt.deprecated,Jt.tags),Ya(Jt.constant,"@constant"),Zt?null:`* @default ${Qt}
|
|
70
|
-
`].filter(Boolean).join(""),en=Jt.constant&&!Jt.isFunction?Jt.value:Jt.type||Rn;return`
|
|
71
|
-
${Zn(tn)}
|
|
72
|
-
${Ln(Jt.name)}${Jt.isRequired?"":"?"}: ${en};`});for(let Jt of V.slots)if(!Jt.default&&Jt.name!=null&&!be.has(Jt.name))Gt.push(Va(Ln(Jt.name),Jt));let Wt=V.slots.find((Jt)=>Jt.default||Jt.name===null);if(Wt&&!be.has("children"))Gt.push(Va("children",Wt));let Kt=Gt.join(`
|
|
73
|
-
`),Vt=gs(V.moduleName),Ut=V.generics?`<${za(V.generics[1]).map((Jt)=>Ka(Jt.trim())).join(", ")}>`:"",Ht=V.generics?`<${V.generics[0]}>`:"",zt=V.extends===void 0?"":`Omit<${V.extends.interface}, keyof $Props${Ht}> & `;if(V.rest_props?.type==="Element"){let{name:Jt,thisValue:Qt,description:Zt}=V.rest_props,tn;if(Jt!=="svelte:element")tn=Jt.split("|").map((hn)=>`SvelteHTMLElements["${hn.trim()}"]`).join(" & ");else if(Qt)tn=`SvelteHTMLElements["${Qt}"]`;else tn="HTMLAttributes<HTMLElement>";let en="[key: `data-${string}`]: unknown;",rn=Zt?`${Ha(Zt)}
|
|
74
|
-
`:"",cn=V.canonicalPropsType?`type $Props${Ut} = (${V.canonicalPropsType}) & {${Kt}
|
|
75
|
-
|
|
76
|
-
${en}
|
|
77
|
-
};`:`type $Props${Ut} = {
|
|
78
|
-
${Kt}
|
|
79
|
-
|
|
80
|
-
${en}
|
|
81
|
-
};`,un=V.extends===void 0?`keyof $Props${Ht}`:`keyof ($Props${Ht} & ${V.extends.interface})`;return{props_name:Vt,prop_def:`
|
|
82
|
-
${rn}type $RestProps = ${tn};
|
|
83
|
-
|
|
84
|
-
${cn}
|
|
85
|
-
|
|
86
|
-
export type ${Vt}${Ut} = Omit<$RestProps, ${un}> & ${zt}$Props${Ht};
|
|
87
|
-
`}}let Yt;if(V.canonicalPropsType)Yt=`
|
|
88
|
-
${`
|
|
89
|
-
type $Props${Ut} = ${V.canonicalPropsType}${Kt.trim()===""?"":` & {${Kt}
|
|
90
|
-
}`};
|
|
91
|
-
`}
|
|
92
|
-
export type ${Vt}${Ut} = ${zt}$Props${Ht};
|
|
93
|
-
`;else if(V.extends===void 0)Yt=Kt.trim()===""?`
|
|
94
|
-
export type ${Vt}${Ut} = ${Is};
|
|
95
|
-
`:`
|
|
96
|
-
export type ${Vt}${Ut} = {
|
|
97
|
-
${Kt}
|
|
98
|
-
};
|
|
99
|
-
`;else Yt=`
|
|
100
|
-
type $Props${Ut} = {
|
|
101
|
-
${Kt}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export type ${Vt}${Ut} = ${zt}$Props${Ht};
|
|
105
|
-
`;return{props_name:Vt,prop_def:Yt}}function ih(V){return lr(V)?V:`[${V}]`}function rh(V){let K=V.slots.filter((Be)=>!lr(Be.slot_props??""));if(K.length===0)return Is;let be=K.map(({name:Be,slot_props:Gt,...Wt})=>{let Kt=Wt.default||Be===null?"default":Ln(Be??""),Vt=Tr(Wt.description,Wt.tags,Wt.deprecated);return`${Vt?`${Vt}
|
|
106
|
-
`:""}${Kt}: ${li(Gt)};`}).join(`
|
|
107
|
-
`);return K.length===1?`{${be}}`:`{
|
|
108
|
-
${be}
|
|
109
|
-
}`}var oh=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 Er(V=Rn){if(Bu.test(V))return V;return`CustomEvent<${V}>`}function ah(V){switch(V.type){case"dispatched":return Er(V.detail);case"forwarded":{let K=V.element,Be=!(K&&Vu.test(K))||oh.has(V.name),Gt=V.detail!==void 0&&V.detail!=="undefined"&&!(V.detail==="null"&&Be),Wt=V.detail==="null"&&!Be;if(Gt||Wt)return Er(V.detail);return Be?`WindowEventMap["${V.name}"]`:Er()}default:return V}}function Ga(V){if(V.events.length===0)return ju;let K=V.events.map((be)=>{let Be=Tr(be.description,be.tags,be.deprecated);return`${Be?`${Be}
|
|
110
|
-
`:""}${Ln(be.name)}: ${ah(be)};
|
|
111
|
-
`}).join("");return V.events.length===1?`{${K}}`:`{
|
|
112
|
-
${K}}`}function ph(V){let K=V.type==="() => any";if(V.type&&Ua.test(V.type)&&!K)return V.type;if(V.params&&V.params.length>0)return`(${y(V.params)}) => ${V.returnType||Rn}`;if(V.returnType)return`() => ${V.returnType}`;return V.type||Rn}function Qa(V){return V.props.filter((K)=>K.isFunctionDeclaration||K.kind==="const").map((K)=>{let be=ms(K.description,K.deprecated,K.tags);return`
|
|
113
|
-
${Zn(be)}
|
|
114
|
-
${Ln(K.name)}: ${ph(K)};`}).join(`
|
|
115
|
-
`)}function ch(V){let K=Ls(V.moduleName),be=Qa({props:V.props});if(be.trim()==="")return{exports_name:K,exports_ref:K,exports_def:`export type ${K} = ${Is};`};let{declSuffix:Be,refSuffix:Gt}=Xa(V.generics,be);return{exports_name:K,exports_ref:`${K}${Gt}`,exports_def:`export type ${K}${Be} = {${be}
|
|
116
|
-
};`}}function lh(V){return V.props.filter((K)=>K.bindable===!0||K.binding==="writable").map((K)=>JSON.stringify(K.name)).join(" | ")}function Za(V){return V==="default"?"$$Component":V}function uh(V){let K=Za(V.moduleName),be=V.bindings===In?'""':V.bindings;return`declare const ${K}: Component<
|
|
117
|
-
${V.propsRef},
|
|
118
|
-
${V.exportsRef},
|
|
119
|
-
${be}
|
|
120
|
-
>;
|
|
121
|
-
export default ${K};`}function hh(V){let K=Za(V.moduleName),be=`${K}Component`,Be=V.bindings===In?'""':V.bindings,Gt=V.eventsRef?`$on?<K extends keyof ${V.eventsRef} & string>(type: K, callback: (e: ${V.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${be} {
|
|
122
|
-
new ${V.generic}(
|
|
123
|
-
options: ComponentConstructorOptions<${V.propsRef}>
|
|
124
|
-
): SvelteComponent<${V.propsRef}${V.eventsRef?`, ${V.eventsRef}`:""}> & ${V.exportsRef};
|
|
125
|
-
${V.generic}(
|
|
126
|
-
this: void,
|
|
127
|
-
internals: ComponentInternals,
|
|
128
|
-
props: ${V.propsRef}
|
|
129
|
-
): {
|
|
130
|
-
${Gt}
|
|
131
|
-
$set?(props: Partial<${V.propsRef}>): void;
|
|
132
|
-
} & ${V.exportsRef};
|
|
133
|
-
element?: typeof HTMLElement;
|
|
134
|
-
z_$$bindings?: ${Be};
|
|
135
|
-
}
|
|
136
|
-
declare const ${K}: ${be};
|
|
137
|
-
export default ${K};`}function dh(V){if(V.extends===void 0)return"";return`import type { ${V.extends.interface} } from ${V.extends.import};`}function fh(V){if(!V.componentComment)return"";if(!Gu.test(V.componentComment))return Sr(V.componentComment.trim());return`/*${E(V.componentComment).split(`
|
|
138
|
-
`).map((K)=>`* ${K}`).join(`
|
|
139
|
-
`)}
|
|
140
|
-
*/`}function mh(V){let K=[],be=new Map;for(let Be of V.moduleExports){if(Be.kind!=="re-export"||!Be.reExport)continue;let{from:Gt,imported:Wt}=Be.reExport,Kt=ms(Be.description,Be.deprecated,Be.tags),Vt=Ln(Be.name);if(Wt==="*"){let zt=Be.name==="*"?"*":`* as ${Vt}`;K.push(`${Zn(Kt)}
|
|
141
|
-
export ${zt} from ${JSON.stringify(Gt)};`);continue}let Ut=`${Gt}\x00${Kt}`,Ht=be.get(Ut);if(!Ht)Ht={comments:Kt,from:Gt,specifiers:[]},be.set(Ut,Ht),K.push(Ut);Ht.specifiers.push(Wt===Be.name?Vt:`${Ln(Wt)} as ${Vt}`)}return K.map((Be)=>{let Gt=be.get(Be);if(!Gt)return Be;return`${Zn(Gt.comments)}
|
|
142
|
-
export { ${Gt.specifiers.join(", ")} } from ${JSON.stringify(Gt.from)};`}).join(`
|
|
143
|
-
|
|
144
|
-
`)}function kr(V){let K=[V.static?"static ":"",V.abstract?"abstract ":"",V.readonly?"readonly ":""].join(""),be=V.optional?"?":"";if(V.kind==="property")return`${K}${Ln(V.name)}${be}: ${V.type??Rn}`;let Be=y(V.params??[]);if(V.kind==="constructor")return`constructor(${Be})`;let Gt=V.typeParameters?`<${V.typeParameters}>`:"";return`${K}${Ln(V.name)}${be}${Gt}(${Be}): ${V.returnType??Rn}`}function gh(V,K){let be=V.localName??V.name,Be=be!==V.name,Gt=`export { ${be}${Be?` as ${Ln(V.name)}`:""} };`;if(K.has(be))return Gt;K.add(be);let Wt=V.typeParameters?`<${V.typeParameters}>`:"",Kt=(V.members??[]).map((zt)=>[Zn(ms(zt.description,zt.deprecated,zt.tags)),`${kr(zt)};`].filter(Boolean).join(`
|
|
145
|
-
`)).join(`
|
|
146
|
-
|
|
147
|
-
`),Vt=`${V.extends?` extends ${V.extends}`:""}${V.implements?.length?` implements ${V.implements.join(", ")}`:""}`,Ut=`${Be?"":"export "}declare ${V.abstract?"abstract ":""}class ${be}${Wt}${Vt}`;return`
|
|
148
|
-
${[Zn(ms(V.description,V.deprecated,V.tags)),Kt?`${Ut} {
|
|
149
|
-
${Kt}
|
|
150
|
-
}`:`${Ut} {}`,Be?Gt:""].filter(Boolean).join(`
|
|
151
|
-
`)}`}function yh(V){let K=mh(V),be=new Set,Be=V.moduleExports.filter((Gt)=>Gt.kind!=="re-export").map((Gt)=>{if(Gt.kind==="class")return gh(Gt,be);let Wt=!Wa.test(Gt.name),Kt=Wt?{...Gt,name:xh(Gt.name)}:Gt,Vt=ms(Kt.description,Kt.deprecated,Kt.tags),Ut,Ht=Kt.type!==void 0&&Ua.test(Kt.type),zt=Kt.typeParameters?`<${Kt.typeParameters}>`:"";if(Kt.kind==="const"&&!Ht)Ut=`export declare const ${Kt.name}: ${Kt.type||Rn};
|
|
152
|
-
`;else if(Kt.params&&Kt.params.length>0)Ut=`export declare function ${Kt.name}${zt}(${y(Kt.params)}): ${Kt.returnType||Rn};`;else if(Kt.returnType)Ut=`export declare function ${Kt.name}${zt}(): ${Kt.returnType};`;else if(Ht&&Kt.type){let[Yt,Jt,...Qt]=Kt.type.split("=>"),Zt=Qt.map((tn)=>` => ${tn.trim()}`).join("");Ut=`export declare function ${Kt.name}${Yt.trimEnd()}: ${Jt.trim()}${Zt};`}else Ut=`export declare let ${Kt.name}: ${Kt.type||Rn};`;if(Wt)Ut=`${Ut.replace(Xu,"").trimEnd()}
|
|
153
|
-
export { ${Kt.name} as ${JSON.stringify(Gt.name)} };`;return`
|
|
154
|
-
${Zn(Vt)}
|
|
155
|
-
${Ut}`}).join(`
|
|
156
|
-
`);return[K,Be].filter(Boolean).join(`
|
|
157
|
-
|
|
158
|
-
`)}function xh(V){return`__export_${V.replace(Ju,"_")}`}var vh=120;function Eh(V){let be=`export default class ${V.moduleName==="default"?"":V.moduleName}${V.generic} extends SvelteComponentTyped<`,Be=[V.genericProps,V.events,V.slots];if(V.accessors.trim()===""&&Be.every((Gt)=>!Gt.includes(`
|
|
159
|
-
`))){let Gt=`${be}${Be.join(", ")}> {}`;if(Gt.length<=vh)return Gt}return`${be}
|
|
160
|
-
${V.genericProps},
|
|
161
|
-
${V.events},
|
|
162
|
-
${V.slots}
|
|
163
|
-
> {
|
|
164
|
-
${V.accessors}
|
|
165
|
-
}`}function gs(V){return`${V}Props`}function Ls(V){return`${V}Exports`}function Pr(V){return{format:V.format}}var bh={format:"class"};function ep(V){let K=Pr(V??{}),be={};for(let[Be,Gt]of Object.entries(K))be[Be]=Gt??bh[Be];return JSON.stringify(be)}function $r(V,K){let be=Pa(V),{moduleName:Be,typedefs:Gt,generics:Wt,props:Kt,moduleExports:Vt,slots:Ut,events:Ht,rest_props:zt,extends:Yt,componentComment:Jt,contexts:Qt}=V,Zt=K?.format==="component",tn=Wt!==null,{props_name:en,prop_def:rn}=sh({moduleName:Be,props:Kt,rest_props:zt,extends:Yt,generics:Wt,slots:Ut,canonicalPropNames:new Set(be?.canonicalPropNames??[]),canonicalPropsType:be?.canonicalPropsType}),cn=Wt?`<${Wt[1]}>`:"",un=Wt?`${en}<${Wt[0]}>`:en,hn=Zt&&Ht.length>0?`type $Events${cn} = ${Ga({events:Ht})};`:"",yn=Wt?`$Events<${Wt[0]}>`:"$Events",zn=Zt&&(tn||hn!==""),Es=yh({moduleExports:Vt}),Sn=ui({typedefs:Gt}),rs=Ja({contexts:Qt,generics:Wt}),xo=(be?.typeImportStatements??[]).join(`
|
|
166
|
-
`),vo=[...be?.localTypeDeclarations??[],...be?.moduleTypeDeclarations??[]].join(`
|
|
167
|
-
|
|
168
|
-
`),{exports_ref:Eo,exports_def:bo}=Zt?ch({props:Kt,moduleName:Be,generics:Wt}):{exports_ref:In,exports_def:In},So=Zt?lh({props:Kt}):In,Ni=!Hu.test(xo)&&(fs.test(rn)||fs.test(Es)||fs.test(Sn)||fs.test(rs)||fs.test(vo)||fs.test(bo)),yc=zt?.type==="Element"&&(zt.name!=="svelte:element"||zt.thisValue),xc=zt?.type==="Element"&&zt.name==="svelte:element"&&!zt.thisValue,vc=[Zt?zn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Ni?", Snippet":""} } from "svelte";`:`import type { Component${Ni?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${Ni?", type Snippet":""} } from "svelte";`,yc?'import type { SvelteHTMLElements } from "svelte/elements";':"",xc?'import type { HTMLAttributes } from "svelte/elements";':"",xo,dh({extends:Yt})].filter(Boolean).join(`
|
|
169
|
-
`),Ec=Zt?zn?hh({moduleName:Be,generic:cn,propsRef:un,exportsRef:Eo,bindings:So,...hn?{eventsRef:yn}:{}}):uh({moduleName:Be,propsRef:un,exportsRef:Eo,bindings:So}):Eh({moduleName:Be,generic:cn,genericProps:un,events:Ga({events:Ht}),slots:rh({slots:Ut}),accessors:Qa({props:Kt})}),bc=[Es,Sn,vo,rs,rn,bo,hn,[fh({componentComment:Jt}),Ec].filter(Boolean).join(`
|
|
170
|
-
`)].map((Sc)=>Sc.trim()).filter(Boolean).join(`
|
|
171
|
-
|
|
172
|
-
`);return Ma([vc,bc].filter(Boolean).join(`
|
|
173
|
-
|
|
174
|
-
`))}var Ch=[...us,".svelte"];function wh(V){let K=V.trim();if(K.length<2)return;let be=K[0],Be=K[K.length-1];if((be==='"'||be==="'"||be==="`")&&be===Be)return K.slice(1,-1);return}function tp(V){let K=[],be=V.moduleExports.filter((Gt)=>Gt.kind==="re-export");if(be.length===0)return K;let Be=new Set([gs(V.moduleName),Ls(V.moduleName)]);for(let Gt of be){if(!Be.has(Gt.name))continue;K.push(o({component:V.filePath,kind:"module-export-conflict",name:Gt.name,message:`Re-export "${Gt.name}" has the same name as the generated "${Gt.name}" type; the .d.ts won't type-check if "${Gt.reExport?.from}" exports a type by that name.`,source:Gt.source}))}return K}function np(V,K,be){let Be=new Map(Array.from(V.values()).map((Gt)=>[K(Gt.filePath),Gt]));return(Gt)=>{let Wt=Gt.extends;if(!Wt)return[];let Kt=wh(Wt.import);if(Kt===void 0||!Kt.startsWith(".")&&!Kt.startsWith("/"))return[];let Vt=K(Gt.filePath),Ut=be.resolve(Kt,Sh(Vt),Ch);if(Ut===null)return[o({component:Gt.filePath,kind:"extend-props-target-missing",name:Wt.interface,message:`@extends/@extendProps target "${Kt}" was not found on disk.`})];let Ht=Be.get(Ut);if(!Ht)return[];let zt=gs(Ht.moduleName);if(Wt.interface!==zt)return[o({component:Gt.filePath,kind:"extend-props-target-missing",name:Wt.interface,message:`@extends/@extendProps names "${Wt.interface}", but "${Kt}" generates "${zt}".`})];let Yt=[];for(let Jt of Gt.props){let Qt=Ht.props.find((Zt)=>Zt.name===Jt.name);if(Qt&&Qt.type!==Jt.type)Yt.push(o({component:Gt.filePath,kind:"extend-props-override",name:Jt.name,message:`Own prop "${Jt.name}" (${Jt.type}) overrides "${zt}"'s "${Jt.name}" (${Qt.type}).`}))}return Yt}}import{lstatSync as Xh,readFileSync as Jh,realpathSync as Yh,statSync as Qh}from"node:fs";import{dirname as Zh,isAbsolute as ed,join as mp,parse as td,relative as Mr,resolve as mi}from"node:path";function Z(V){return V}function Un(V){if(V==="")return V;return V.startsWith(".")?V:`./${V}`}import{readFileSync as dp}from"node:fs";import{dirname as Lr,join as qh,relative as lp,resolve as up}from"node:path";import{readFileSync as Fh,statSync as jh}from"node:fs";import{basename as Ir,dirname as fi,isAbsolute as Bh,join as Vh,resolve as Gh}from"node:path";import{existsSync as Th,readdirSync as kh}from"node:fs";import{join as Ph}from"node:path";function sp(V){return V.normalize("NFC").toLowerCase()}class Ar{listings=new Map;clear(){this.listings.clear()}entries(V){return this.read(V)?.entries??null}entry(V,K){let be=this.read(V);if(be===null)return;if(be.byName===void 0){be.byName=new Map;for(let Be of be.entries)be.byName.set(Be.name,Be)}return be.byName.get(K)}has(V,K){let be=this.read(V);if(be===null)return!1;if(be.names.has(K))return!0;if(be.folded===void 0){be.folded=new Map;for(let Gt of be.names)be.folded.set(sp(Gt),Gt)}let Be=be.folded.get(sp(K));return Be!==void 0&&Be!==K&&Th(Ph(V,K))}read(V){let K=this.listings.get(V);if(K!==void 0)return K;try{let be=kh(V,{withFileTypes:!0}),Be=new Set;for(let Gt of be)Be.add(Gt.name);K={entries:be,names:Be}}catch{K=null}return this.listings.set(V,K),K}}var Dr=!1;function q(V){Dr=V}function jn(V){if(!Dr)console.error(V)}function ip(V){if(!Dr)console.error(V)}var Os=null,Nr=null;function Kn(){if(Os)return Promise.resolve(Os);if(!Nr)Nr=import("./chunk-80eafzch.js").then((V)=>(Os=V,V));return Nr}function An(){if(!Os)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Os}import{existsSync as hi,readFileSync as $h}from"node:fs";import{dirname as _r,isAbsolute as Ah,join as Dh,relative as Nh,resolve as di}from"node:path";function rp(V){if(!i(V))return{};let K={};if(typeof V.svelte==="string")K.svelte=V.svelte;if(typeof V.name==="string")K.name=V.name;if(typeof V.description==="string")K.description=V.description;return K}function op(V){if(!i(V))return{};let K={};if(typeof V.extends==="string")K.extends=V.extends;if(i(V.compilerOptions)){let be={};if(typeof V.compilerOptions.baseUrl==="string")be.baseUrl=V.compilerOptions.baseUrl;if(i(V.compilerOptions.paths)){let Be={};for(let[Gt,Wt]of Object.entries(V.compilerOptions.paths))if(Array.isArray(Wt)&&Wt.every((Kt)=>typeof Kt==="string"))Be[Gt]=Wt;if(Object.keys(Be).length>0)be.paths=Be}if(Object.keys(be).length>0)K.compilerOptions=be}return K}var ap=new Map,_h=/\/\*[\s\S]*?\*\/|\/\/.*/g,Rh=/[.+?^${}()|[\]\\]/g,Ih=[".svelte",...us];class F extends Error{specifier;fromFile;searched;constructor(V,K,be){super(`cannot resolve "${V}" from ${K||"."} (${be})`);this.name="UnresolvedModuleError",this.specifier=V,this.fromFile=K,this.searched=be}}function Lh(V){if(hi(V))return!0;return Ih.some((K)=>hi(V+K))}function pp(V){let K=V.indexOf("*");return K===-1?V.length:K}function Oh(V){let K=V,be=di(K,"/");while(K!==be){for(let Be of["tsconfig.json","jsconfig.json"]){let Gt=Dh(K,Be);if(hi(Gt))return Gt}K=_r(K)}return null}function cp(V,K){if(K.has(V))return K.get(V)??null;try{let be=$h(V,"utf-8"),Be;try{Be=JSON.parse(be)}catch{let Wt=be.replace(_h,"");Be=JSON.parse(Wt)}let Gt=op(Be);if(Gt.extends){let Wt=Ah(Gt.extends)?Gt.extends:di(_r(V),Gt.extends),Kt=Wt.endsWith(".json")?Wt:`${Wt}.json`;if(hi(Kt)){let Vt=cp(Kt,K);if(Vt)Gt.compilerOptions={...Vt.compilerOptions,...Gt.compilerOptions,paths:{...Vt.compilerOptions?.paths,...Gt.compilerOptions?.paths}}}}return K.set(V,Gt),Gt}catch{return K.set(V,null),null}}function Mh(V){let K=ap.get(V);if(!K){let be=V.split("*").map((Be)=>Be.replace(Rh,"\\$&")).join("(.*)");K=new RegExp(`^${be}$`),ap.set(V,K)}return K}class Rr{configs=new Map;lookup(V,K){if(V.startsWith(".")||V.startsWith("/"))return{resolved:V,unresolved:!1,searched:""};let be=Oh(K),Be=be?cp(be,this.configs)?.compilerOptions:void 0,Gt=Be?.paths;if(!be||!Be||!Gt)return{resolved:V,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Wt=di(_r(be),Be.baseUrl??"."),Kt=Object.entries(Gt).sort(([Vt],[Ut])=>pp(Ut)-pp(Vt));for(let[Vt,Ut]of Kt){let Ht=V.match(Mh(Vt));if(!Ht)continue;let zt;for(let Yt of Ut){let Jt=Yt;for(let Zt=1;Zt<Ht.length;Zt++)Jt=Jt.replace("*",Ht[Zt]);let Qt=di(Wt,Jt);if(zt??=Qt,Lh(Qt))return{resolved:Qt,unresolved:!1,searched:be}}return{resolved:zt??V,unresolved:!1,searched:be}}return{resolved:V,unresolved:!0,searched:`tsconfig paths (${be})`}}absolute(V,K){return this.lookup(V,K).resolved}relative(V,K){let be=this.absolute(V,K);if(be===V)return V;let Be=n(Nh(K,be));return Be.startsWith(".")?Be:`./${Be}`}}var Wh=/\.[mc]?jsx?$/,Uh={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function Kh(V){return V==="."||V===".."||V.startsWith("./")||V.startsWith("../")||Bh(V)}class Hn{aliases=new Rr;listings=new Ar;modules=new Map;programs=new Map;listDirectory(V){return this.listings.entries(V)}exists(V){return this.listings.has(fi(V),Ir(V))}resolve(V,K,be=us){let Be=this.aliases.absolute(V,K);if(Be===V&&!Kh(V))return null;let Gt=Gh(K,Be),Wt=fi(Gt),Kt=Ir(Gt),Vt=this.listings.has(Wt,Kt),Ut;if(Vt){let Ht=this.listings.entry(Wt,Kt);if(Ut=Ht&&!Ht.isSymbolicLink()?Ht:jh(Gt,{throwIfNoEntry:!1}),Ut?.isFile())return Gt}for(let Ht of be)if(this.listings.has(Wt,Kt+Ht))return Gt+Ht;if(!Vt)return this.typeScriptCounterpart(Gt)??null;if(Ut?.isDirectory()){for(let Ht of be)if(this.listings.has(Gt,`index${Ht}`))return Vh(Gt,`index${Ht}`)}return null}parse(V){let K=this.modules.get(V);if(K===void 0)K=Hh(V),this.modules.set(V,K);return K}parseJavaScript(V,K){let be=this.programs.get(V);if(be?.source===K)return be.ast;let Be;try{Be=ge(K)}catch(Gt){throw Error(ke(Gt))}return this.programs.set(V,{source:K,ast:Be}),Be}invalidate(...V){this.listings.clear();for(let K of V)this.modules.delete(K),this.programs.delete(K)}typeScriptCounterpart(V){let K=Wh.exec(V)?.[0];if(K===void 0)return;let be=V.slice(0,-K.length),Be=fi(be),Gt=Ir(be);for(let Wt of Uh[K]??[])if(this.listings.has(Be,Gt+Wt))return be+Wt;return}}function Hh(V){let K;try{K=Fh(V,"utf-8")}catch{return null}try{let be=V.endsWith(".svelte")?An().parseSvelteScripts(K).module?.content.body??[]:An().parseModule(K,{typescript:!0}).body;return{source:{text:K,filePath:V,dir:fi(V)},body:be}}catch(be){return ip(`Warning: sveld couldn't parse ${V} to read its exports (${ke(be)}); skipping it.`),null}}function hp(V){return V.type==="Identifier"?V.name:V.value}function zh(V,K,be,Be){let Gt=V.resolve(K,be);if(!Gt)return null;let Wt=Lr(Gt);if(Be.has(Gt))return{dir:Wt,exports:{}};Be.add(Gt);try{return{dir:Wt,exports:Or(V,dp(Gt,"utf-8"),Wt,Be,Gt)}}catch{return{dir:Wt,exports:{}}}finally{Be.delete(Gt)}}function fp(V,K,be=new Hn,Be=new Set){return Or(be,V,K,Be,K)}function Or(V,K,be,Be,Gt){let Wt=V.parseJavaScript(Gt,K),Kt={};for(let Vt of Wt.body)if(Vt.type==="ExportDefaultDeclaration"){if(Vt.declaration.type!=="Identifier")continue;let Ut=Vt.declaration.name;if(Ut in Kt)Kt[Ut].default=!0;else Kt[Ut]={source:Un(""),default:!0}}else if(Vt.type==="ExportAllDeclaration"){let Ut=Vt.source.value,Ht=V.resolve(Ut,be);if(!Ht){let Jt=V.aliases.lookup(Ut,be);throw new F(Ut,Gt,Jt.unresolved?Jt.searched:"no matching file or index found")}if(Be.has(Ht))continue;Be.add(Ht);let zt=dp(Ht,"utf-8"),Yt=Or(V,zt,Lr(Ht),Be,Ht);Be.delete(Ht);for(let[Jt,Qt]of Object.entries(Yt)){let Zt=Un(n(Qt.source.startsWith(".")?`./${lp(be,up(Lr(Ht),Qt.source))}`:`./${qh(Ut,Qt.source)}`));Kt[Jt]={...Qt,source:Zt}}}else if(Vt.type==="ExportNamedDeclaration"){let Ut=Vt.source?.value,Ht=Ut!==void 0&&_n.test(Ut);if(Ht){let Jt=V.aliases.lookup(Ut,be);if(Jt.unresolved)throw new F(Ut,Gt,Jt.searched)}let Yt=Ut!==void 0&&!Ht?zh(V,Ut,be,Be):void 0;if(Yt===null){console.warn(`sveld: could not resolve re-exported module "${Ut}" from barrel "${be||"."}"; skipping.`);continue}for(let Jt of Vt.specifiers){let Qt=hp(Jt.exported),Zt=hp(Jt.local),tn=Qt||Zt,en=Yt?.exports[Zt],rn=en?Un(n(`./${lp(be,up(Yt.dir,en.source))}`)):Un(V.aliases.relative(Ut??"",be)),cn=en?en.default:Zt==="default";if(tn in Kt){if(Kt[tn].mixed=!0,!Kt[tn].source)Kt[tn].source=rn}else Kt[tn]={source:rn,default:cn}}}else if(Vt.type==="ImportDeclaration"){let Ut=Vt.specifiers[0];if(!Ut)continue;let Ht=Ut.local.name,zt=Un(V.aliases.relative(Vt.source.value,be));if(Ht in Kt){if(!Kt[Ht].source)Kt[Ht].source=zt}else Kt[Ht]={source:zt,default:Ht==="default"}}return Kt}var nd=/-/g,sd=/[^A-Za-z0-9_$]/g,id=/^[0-9]/;function rd(V,K){let be=V.replace(sd,""),Be=id.test(be)?`_${be}`:be;if(Be!==V&&!K?.has(V))K?.add(V),console.warn(`Warning: "${V}" is not a valid identifier; using "${Be}" instead.`);return Be}function gp(V,K){return rd(td(V).name.replace(nd,""),K)}function yp(V,K,be=[],Be=new Set,Gt){let Wt;try{Wt=Gt??Yh(K)}catch{return be}if(Be.has(Wt))return be;Be.add(Wt);let Kt=V.listDirectory(K);if(Kt===null)return be;for(let Vt of Kt){if(Vt.name.startsWith("."))continue;let Ut=mp(K,Vt.name),Ht=Vt.isSymbolicLink(),zt=Ht?Qh(Ut,{throwIfNoEntry:!1}):Vt;if(!zt)continue;if(zt.isDirectory())yp(V,Ut,be,Be,Ht?void 0:mp(Wt,Vt.name));else if(zt.isFile()&&Vt.name.endsWith(".svelte"))be.push(Ut)}return be}function od(V,K){return yp(V,K).map((be)=>({moduleName:gp(be),source:Un(n(`./${Mr(K,be)}`))})).sort((be,Be)=>u(be.source,Be.source))}function ad(V){return!hs(V)}function pd(V,K){let be=V.endsWith("/")?V:`${V}/`;return K.startsWith(be)}function gi(V,K){return{seenPaths:new Set(V.map(([,be])=>K(be.source))),seenModuleNamePaths:new Map(V.map(([be,Be])=>[be,K(Be.source)])),warnedModuleNames:new Set}}function Fr(V,K,be,Be,Gt,Wt){for(let{moduleName:Kt,source:Vt}of od(V,K)){let Ut=Gt(Vt),Ht=be[Kt];if(Ht&&ad(Ht.source)&&pd(Ht.source,Vt)){Wt.seenPaths.delete(Gt(Ht.source)),Ht.source=Vt,Wt.seenPaths.add(Ut),Wt.seenModuleNamePaths.set(Kt,Ut);continue}if(Wt.seenPaths.has(Ut))continue;Wt.seenPaths.add(Ut);let zt=Wt.seenModuleNamePaths.get(Kt);if(zt===void 0)Wt.seenModuleNamePaths.set(Kt,Ut);else if(zt!==Ut&&!Wt.warnedModuleNames.has(Kt))Wt.warnedModuleNames.add(Kt),console.warn(`Warning: multiple components named "${Kt}" found (${n(Mr(K,zt))} and ${n(Mr(K,Ut))}). Both are included in TypeScript definitions, but only one can be the named export.`);Be.push([Kt,{source:Vt,default:!1}])}}function jr(V,K,be,Be){let Gt=Xh(V).isFile(),Wt=Gt?Zh(V):V,Kt=mi(Wt),Vt=new Map,Ut=(Yt)=>{let Jt=Vt.get(Yt);if(Jt===void 0)Jt=ed(Yt)?mi(Yt):mi(Kt,Yt),Vt.set(Yt,Jt);return Jt},Ht={};if(Gt){let Yt=Jh(V,"utf-8");try{Ht=fp(Yt,Kt,Be,new Set([mi(V)]))}catch(Jt){if(!be)throw Jt;let Qt=Jt instanceof Error?Jt.message:String(Jt);console.warn(`Warning: Failed to parse component exports from ${V}: ${Qt}`)}}let zt=Object.entries(Ht);if(K){let Yt=gi(zt,Ut);if(Fr(Be,Kt,Ht,zt,Ut,Yt),!Gt)Ht=Object.fromEntries(zt.map(([Jt,Qt])=>[Jt,{...Qt,default:!0}]))}return{exports:Ht,allComponentEntries:zt,rootDir:Kt,resolveComponentFilePath:Ut}}function Br(V,K,be,Be){if(be!==1||V!=="default")return V;return gp(K,Be)}import{resolve as Pd}from"node:path";var Vr="/**",xp="*",yi="*/",cd="```",Gr=/^\s+/,vp=/\s/,ld=/^@[^\s/]+(?=\s|$)/,ud=/^@(\S+)\s*/,hd=new Set(["extends","extendProps","generics","template","typedef"]);function z(V){let K=0;while(K<V.length){let be=V.charCodeAt(K);if(be!==32&&be!==9&&be!==13&&be!==10&&!vp.test(V[K]))break;K++}return K}function dd(V,K){let be=V.slice(z(V)),Be=!1;if(K)be=be.slice(Vr.length),Be=!0;else if(be.startsWith(xp)&&!be.startsWith(yi))be=be.slice(xp.length),Be=!0;let Gt=be.slice(0,z(be));be=be.slice(Gt.length);let Wt=be.trimEnd(),Kt=Wt.endsWith(yi)?Wt.slice(0,-yi.length).trimEnd():be;return{indent:Be?Gt.slice(1):Gt,content:Kt}}function fd(V,K,be){let Be=be>K&&V.charCodeAt(be-1)===13?be-1:be;return V.slice(K,Be)}function md(V){let K=[],be=0;while(!0){let Be=V.indexOf(Vr,be);if(Be===-1)break;let Gt=V.lastIndexOf(`
|
|
175
|
-
`,Be-1)+1;if(V.charCodeAt(Be+Vr.length)===42||V.slice(Gt,Be).trim()!==""){be=Be+1;continue}let Wt=[],Kt=Gt,Vt=!1,Ut=0;while(Kt<=V.length){let Ht=V.indexOf(`
|
|
176
|
-
`,Kt),zt=Ht===-1?V.length:Ht,Yt=fd(V,Kt,zt),{indent:Jt,content:Qt}=dd(Yt,Wt.length===0);Wt.push({raw:Yt,start:Kt,number:Wt.length,indent:Jt,content:Qt});let Zt=Yt.trimEnd();if(Zt.endsWith(yi)){Vt=!0,Ut=Kt+Zt.length,be=zt;break}if(Ht===-1)break;Kt=Ht+1}if(!Vt)break;K.push({start:Be,end:Ut,lines:Wt})}return K}function gd(V){let K=V;if(K.length>0&&K[0].content==="")K=K.slice(1);if(K.length>0&&K[K.length-1].content==="")K=K.slice(0,-1);return K}function yd(V){let K=[[]],be=!1;for(let Be of V){if(ld.test(Be.content)&&!be)K.push([Be]);else K[K.length-1].push(Be);if(X(Be.content))be=!be}return K}function X(V){return xd(V,cd)%2===1}function xd(V,K){let be=0,Be=V.indexOf(K);while(Be!==-1)be++,Be=V.indexOf(K,Be+K.length);return be}function Ep(V){return V.map((K)=>K.indent+K.content).join(`
|
|
177
|
-
`)}function vd(V){let K=0;while(K<V.length-1&&V[K].content.trim()==="")K++;if(V[K].content[0]!=="{")return null;let be=V.slice(K).map((Ut)=>Ut.content).join(`
|
|
178
|
-
`),Be=A(be,0);if(Be===-1)return null;let Gt=[],Wt=Be+1;for(let Ut=K;Wt>0;Ut++){let Ht=V[Ut].content.length;Gt.push(Math.min(Wt,Ht)),Wt-=Ht+1}let Kt=K+Gt.length-1;return{type:Gt.map((Ut,Ht)=>{let zt=K+Ht,Yt=V[zt].content.slice(0,Ut);if(V[zt].content=V[zt].content.slice(Ut).replace(Gr,""),zt>0)V[zt].continuesType=!0;return Ht===0?Yt:V[zt].indent+Yt}).join(`
|
|
179
|
-
`).slice(1,-1),endIndex:Kt}}function Ed(V){let K=V.content.match(Gr)?.[0]??"",be=V.content.slice(K.length),Be=0,Gt=0;for(let Ht of be){if(Be===0&&vp.test(Ht))break;if(Ht==="[")Be++;if(Ht==="]")Be--;Gt++}let Wt=Be===0?be.slice(0,Gt):"";if(!Wt)return null;let Kt=Wt,Vt=!1,Ut;if(Wt.startsWith("[")&&Wt.endsWith("]")){Vt=!0;let zt=Wt.slice(1,-1).split("=");if(Kt=zt[0].trim(),zt.length>1)Ut=zt.slice(1).join("=").trim();if(!Kt)return null}if(Kt.length>1&&(Kt[0]==='"'||Kt[0]==="'")&&Kt[Kt.length-1]===Kt[0])Kt=Kt.slice(1,-1);return V.content=be.slice(Gt).replace(Gr,""),{name:Kt,optional:Vt,default:Ut}}function bd(V){let K=V[0],be=K.content.match(ud),Be=be?be[1]:"",Gt=be?K.content.slice(be[0].length):K.content,Wt=Gt.trimEnd(),Kt=V.slice(1).map((Qt)=>Qt.indent+Qt.content),Vt=(Wt?[Wt,...Kt]:Kt).join(`
|
|
180
|
-
`);K.content=Gt,K.tag=Be;let Ut=vd(V),Ht=Ut?.type??"",zt=Ut?.endIndex??0;if(hd.has(Be))while(zt<V.length-1&&V[zt].content.trim()==="")zt++;let Yt=Ed(V[zt]),Jt=Ep(V.slice(zt));return{tag:Be,name:Yt?.name??"",type:Ht,optional:Yt?.optional??!1,default:Yt?.default,description:Jt,text:Vt,lines:V}}function Sd(V,K,be){let Be=gd(V);Be.forEach((Kt,Vt)=>{Kt.number=Vt});let Gt=yd(Be),Wt=Gt.slice(1).map(bd);return{description:Ep(Gt[0]),tags:Wt,start:K,end:be,lines:Be}}function w(V){return md(V).map(({start:K,end:be,lines:Be})=>Sd(Be,K,be))}function ve(V){let K=[];return es(V,K),K}function es(V,K){switch(V.type){case"Identifier":K.push(V);return;case"ObjectPattern":for(let be of V.properties)es(be.type==="RestElement"?be.argument:be.value,K);return;case"ArrayPattern":for(let be of V.elements)if(be!==null)es(be,K);return;case"RestElement":es(V.argument,K);return;case"AssignmentPattern":es(V.left,K);return;case"TSParameterProperty":es(V.parameter,K);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":es(V.expression,K)}}function W(V,K){if(V.type!=="Identifier")return!1;if(K===null)return!0;switch(K.type){case"MemberExpression":return K.computed||V===K.object;case"MethodDefinition":return K.computed;case"Property":case"PropertyDefinition":return K.computed||V===K.value;case"ExportSpecifier":case"ImportSpecifier":return V===K.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 V===K.expression;case"TSEnumMember":return V===K.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!K.type.startsWith("TS")}}var ys={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"],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 Cd=Object.assign(Object.create(null),ys),wd=[],T=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function a(V,K,be){xi(V,null,null,null,K,be===void 0||be===ys?Td:(Be)=>Object.hasOwn(be,Be.type)?be[Be.type]:void 0)}function xi(V,K,be,Be,Gt,Wt){let Kt=Wt(V);if(Kt===void 0)throw Error(`unknown node type: ${V.type}`);let Vt=Gt.enter?.(V,K,be,Be);if(Vt===T)return!0;if(Vt!==p){if(Vt!==V&&Fn(Vt))return kd(Vt,K,be,Be,Gt,Wt);let Ut=Qn(V);for(let Ht=0;Ht<Kt.length;Ht++){let zt=Kt[Ht],Yt=Ut[zt];if(Array.isArray(Yt))for(let Jt=0;Jt<Yt.length;Jt++){let Qt=Yt[Jt];if(Fn(Qt)&&xi(Qt,V,zt,Jt,Gt,Wt))return!0}else if(Fn(Yt)&&xi(Yt,V,zt,null,Gt,Wt))return!0}}return Gt.leave?.(V,K,be,Be)===T}function Td(V){let K=V.type;if(K==="Identifier")return V.typeAnnotation===void 0&&V.decorators===void 0?wd:ys.Identifier;if(K==="Literal")return ys.Literal;if(K==="Text")return ys.Text;return Cd[K]}function kd(V,K,be,Be,Gt,Wt){if(K===null||be===null)throw Error("walk can't replace the node it was called with");let Kt=Qn(K),Vt=Kt[be];if(Be===null)Kt[be]=V;else if(Array.isArray(Vt))Vt[Be]=V;return xi(V,K,be,Be,Gt,Wt)}function pe(V){return V==="TSTypeAnnotation"||V==="TSTypeAliasDeclaration"||V==="TSInterfaceDeclaration"||V==="TSTypeParameterDeclaration"||V==="TSTypeParameterInstantiation"}function ue(V){let K=[];return a(V,{enter(be){if(be.type==="FunctionDeclaration"||be.type==="FunctionExpression"||be.type==="ArrowFunctionExpression")return p;if(be.type==="ReturnStatement")K.push(be.argument??null)}}),K}var $d=/\r?\n/,Ad=/^\s*\*+/;function vi(V){return{graph:V,cache:new Map,computing:new Set}}function xn(V){return V?.type==="Identifier"?V.name:void 0}function Dd(V){let K=V.trimEnd();for(;;){let be=K.lastIndexOf(`
|
|
181
|
-
`)+1;if(K.slice(be).trimStart().startsWith("//")){K=K.slice(0,be).trimEnd();continue}let Be=K.endsWith("*/")?K.lastIndexOf("/*",K.length-3):-1;if(Be!==-1&&K[Be+2]!=="*"){K=K.slice(0,Be).trimEnd();continue}return K}}function Nd(V,K){let be=Dd(V.slice(0,K));if(!be.endsWith("*/"))return;let Be=be.length-2,Gt=be.lastIndexOf("/**",Be);if(Gt===-1)return;return be.slice(Gt,Be+2)}function _d(V){let K=[];for(let be of V.slice(3,-2).split($d)){let Be=be.replace(Ad,"").trim();if(Be.startsWith("@"))break;if(Be)K.push(Be)}return K.join(" ")||void 0}function ts(V,K){if(!K)return;return V.text.slice(K.start,K.end)}function Rd(V,K){return"typeAnnotation"in K?ts(V,K.typeAnnotation?.typeAnnotation):void 0}function Wr(V,K){return ts(V,K.returnType?.typeAnnotation)}function Ur(V,K){let be=K.params.map((Gt)=>ts(V,Gt)??"").join(", "),Be=Wr(V,K);return`(${be})${Be?` => ${Be}`:""}`}function Cp(V){if(V.type==="Literal"){let K=V.value;if(typeof K==="string")return"string";if(typeof K==="number")return"number";if(typeof K==="boolean")return"boolean"}if(V.type==="TemplateLiteral")return"string";return}function Id(V,K){let be=ts(V,K);if(be===void 0)return;if(K.type==="Literal"){let Gt=K.value;if(typeof Gt==="string"||typeof Gt==="number"||typeof Gt==="boolean")return{raw:be,value:Gt,type:typeof Gt};return}if(K.type==="UnaryExpression"&&K.operator==="-"){let Gt=K.argument;if(Gt.type==="Literal"&&typeof Gt.value==="number")return{raw:be,value:-Gt.value,type:"number"};return}let Be=K.type==="TemplateLiteral"?b(K):null;return Be===null?void 0:{raw:be,value:Be,type:"string"}}function Ld(V,K){if(V.type!=="CallExpression"&&V.type!=="NewExpression")return;let be=V.callee;if(!(xn(be)==="Symbol"||be.type==="MemberExpression"&&!be.computed&&xn(be.object)==="Symbol"&&xn(be.property)==="for"))return;return b(V.arguments[0])||K}var Od=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Md=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Fd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function jd(V,K){let be=K?An().getCommentTags(w(K)).type?.type.trim():void 0,Be=V?{type:V,source:"typescript"}:be?{type:be,source:"jsdoc"}:void 0;if(!Be||Be.type.includes("`"))return;return(Be.type.replace(Md,'""').match(Fd)??[]).every((Wt)=>Od.has(Wt))?Be:void 0}function bp(V){if(V.async||V.generator||V.type==="TSDeclareFunction")return;let K=V.body,be=K.type==="BlockStatement"?ue(K):[K];if(be.length===0)return;let Be;for(let Gt of be){if(!Gt)return;let Wt=Cp(Gt);if(!Wt)return;if(Be===void 0)Be=Wt;else if(Be!==Wt)return}return Be}function Bd(V){let K=V.initializer;if(!K)return;if(K.type==="Literal"){let be=K.value;return typeof be==="string"||typeof be==="number"?be:void 0}if(K.type==="UnaryExpression"&&K.operator==="-"){let be=K.argument;if(be.type==="Literal"&&typeof be.value==="number")return-be.value}return}function Vd(V){let K=V.members;if(K.length===0)return;let be=[],Be=0;for(let Gt of K){if(!Gt.initializer){be.push(String(Be)),Be+=1;continue}let Wt=Bd(Gt);if(Wt===void 0)return;be.push(typeof Wt==="string"?JSON.stringify(Wt):String(Wt)),Be=typeof Wt==="number"?Wt+1:Be}return be.join(" | ")}function Kr(V,K,be,Be){let Gt=Nd(V.text,be),Wt=Gt?_d(Gt):void 0,Kt=Gt?An().extractJsDocReturnType(Gt):void 0,{deprecated:Vt,tags:Ut,internal:Ht}=Gt?An().extractJsDocDeprecatedAndTags(Gt):{deprecated:void 0,tags:void 0,internal:!1},zt={description:Wt,deprecated:Vt,tags:Ut,...Ht?{internal:!0}:{},declFile:V.filePath};if(K.type==="VariableDeclaration"){let Yt=K.kind==="let"||K.kind==="var"?K.kind:"const",Jt=[];for(let Qt of K.declarations){let Zt=Qt.id,tn=xn(Zt);if(!tn)continue;let en=Rd(V,Zt),rn=en,cn,un,hn,yn,zn,Es,Sn=Qt.init;if(Sn)if(Sn.type==="ArrowFunctionExpression"||Sn.type==="FunctionExpression"){if(Es=Sn,!rn)rn=Ur(V,Sn);un=Wr(V,Sn)??Kt??re(rn)??bp(Sn)}else{if(cn=ts(V,Sn),!rn)rn=Cp(Sn);let rs=H(Sn);if(hn=b(rs)??Ld(rs,tn),Yt==="const")yn=Id(V,rs),zn=jd(en,Gt)}Jt.push({name:tn,kind:Yt,type:rn,value:cn,returnType:un,literalValue:hn,primitiveLiteral:yn,declaredType:zn,functionNode:Es,...zt,isTypeOnly:!1})}return Jt}if(K.type==="FunctionDeclaration"||K.type==="TSDeclareFunction"){let Yt=xn(K.id)??Be;if(!Yt)return[];return[{name:Yt,kind:"function",type:Ur(V,K),returnType:Wr(V,K)??Kt??bp(K),...K.type==="FunctionDeclaration"?{functionNode:K}:{},...zt,isTypeOnly:!1}]}if(K.type==="ClassDeclaration"){let Yt=xn(K.id),Jt=Yt??Be;if(!Jt)return[];return[{name:Jt,kind:"class",...Yt?{type:Yt}:{},...zt,isTypeOnly:!1}]}if(K.type==="TSTypeAliasDeclaration"){let Yt=xn(K.id);if(!Yt)return[];return[{name:Yt,kind:"type",type:ts(V,K.typeAnnotation),...zt,isTypeOnly:!0}]}if(K.type==="TSInterfaceDeclaration"){let Yt=xn(K.id);if(!Yt)return[];return[{name:Yt,kind:"interface",type:ts(V,K.body),...zt,isTypeOnly:!0}]}if(K.type==="TSEnumDeclaration"){let Yt=xn(K.id);if(!Yt)return[];return[{name:Yt,kind:"enum",type:Vd(K)??Yt,...zt,isTypeOnly:!1}]}return[]}function Gd(V,K,be){let Be=K.declaration;if(Be.type==="FunctionDeclaration"||Be.type==="TSDeclareFunction"||Be.type==="ClassDeclaration"){let[Kt]=Kr(V,Be,K.start,"default");return Kt?{...Kt,name:"default"}:void 0}if(Be.type==="FunctionExpression"||Be.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Ur(V,Be),functionNode:Be,declFile:V.filePath,isTypeOnly:!1};let Gt=xn(Be),Wt=Gt?be(Gt):null;return Wt?{...Wt,name:"default"}:void 0}function Wd(V,K){for(let be of V){if(be.type!=="ImportDeclaration")continue;let Be=be.source.value;for(let Gt of be.specifiers){if(Gt.local.name!==K)continue;let Wt=be.importKind==="type"||Gt.type==="ImportSpecifier"&&Gt.importKind==="type";if(Gt.type==="ImportDefaultSpecifier")return{specifier:Be,importedName:"default",isTypeOnly:Wt};if(Gt.type==="ImportNamespaceSpecifier")return{specifier:Be,importedName:"*",isTypeOnly:Wt};if(Gt.type==="ImportSpecifier"){let Kt=xn(Gt.imported)??K;return{specifier:Be,importedName:Kt,isTypeOnly:Wt}}}}return null}function Sp(V,K,be){return{name:V,kind:"const",declFile:K,namespaceFile:K,isTypeOnly:be}}function Ei(V,K){let be=K.cache.get(V);if(be)return be;if(K.computing.has(V))return[];K.computing.add(V);let Be=K.graph.parse(V);if(!Be)return K.computing.delete(V),K.cache.set(V,[]),[];let{source:Gt,body:Wt}=Be,Kt=[],Vt=new Map;for(let Jt of Wt){let Qt=Jt.type==="ExportNamedDeclaration"?Jt.declaration:Jt;if(!Qt)continue;for(let Zt of Kr(Gt,Qt,Qt.start))Vt.set(Zt.name,Zt)}let Ut=(Jt,Qt)=>({name:Jt,kind:"const",declFile:Pd(Gt.dir,Qt),isTypeOnly:!1}),Ht=(Jt)=>{let Qt=Vt.get(Jt);if(Qt)return Qt;let Zt=Wd(Wt,Jt);if(!Zt)return null;if(Zt.specifier.endsWith(".svelte"))return Ut(Jt,Zt.specifier);let tn=K.graph.resolve(Zt.specifier,Gt.dir);if(!tn)return null;if(Zt.importedName==="*")return Sp(Jt,tn,Zt.isTypeOnly);return ns(tn,Zt.importedName,K)??null},zt=new Map;for(let Jt of Wt){if(Jt.type==="ExportAllDeclaration"){let en=Jt.source.value;if(en.endsWith(".svelte"))continue;let rn=K.graph.resolve(en,Gt.dir);if(!rn)continue;let cn=Jt.exportKind==="type",un=xn(Jt.exported);if(un){Kt.push(Sp(un,rn,cn));continue}for(let hn of Ei(rn,K)){let yn=zt.get(hn.name)??[];yn.push(cn?{...hn,isTypeOnly:!0}:hn),zt.set(hn.name,yn)}continue}if(Jt.type==="ExportDefaultDeclaration"){let en=Gd(Gt,Jt,Ht);if(en)Kt.push(en);continue}if(Jt.type!=="ExportNamedDeclaration")continue;let Qt=Jt.declaration;if(Qt){Kt.push(...Kr(Gt,Qt,Jt.start));continue}let Zt=Jt.source?.value;if(Zt?.endsWith(".svelte")){for(let en of Jt.specifiers){let rn=xn(en.exported);if(rn)Kt.push(Ut(rn,Zt))}continue}let tn=Jt.exportKind==="type";for(let en of Jt.specifiers){let rn=xn(en.exported),cn=xn(en.local);if(!rn||!cn)continue;let un=tn||en.exportKind==="type",hn=null;if(Zt){let yn=K.graph.resolve(Zt,Gt.dir);if(yn)hn=ns(yn,cn,K)??null}else hn=Ht(cn);if(hn)Kt.push({...hn,name:rn,isTypeOnly:hn.isTypeOnly||un});else if(cn!=="default")Kt.push({name:rn,kind:un?"type":"const",declFile:V,isTypeOnly:un})}}let Yt=new Set(Kt.map((Jt)=>Jt.name));for(let[Jt,Qt]of zt){if(Yt.has(Jt)||Jt==="default")continue;if(Qt.every((Zt)=>Zt.declFile===Qt[0].declFile))Kt.push(...Qt);else K.onAmbiguousStarExport?.(V,Jt,Qt)}return K.computing.delete(V),K.cache.set(V,Kt),Kt}function ns(V,K,be){return Ei(V,be).findLast((Be)=>Be.name===K)}function xs(V,{importedName:K,members:be=[]},Be){let Gt=ns(V,K,Be);for(let Wt of be){if(Gt?.namespaceFile===void 0)return;Gt=ns(Gt.namespaceFile,Wt,Be)}return Gt}import{dirname as Ud}from"node:path";function qn(V,K,be){if(V[K]===void 0)delete V[K];V[K]=be}function bi(V,K){return(K.location==="props"?V.props:V.moduleExports).find((Be)=>Be.name===K.propName)}function Si(V,K){if(K.location!=="props")return;V.diagnostics=(V.diagnostics??[]).filter((be)=>!(be.kind==="prop-unknown-type"&&be.name===K.propName))}var Kd=/\.[^./\\]+$/;function Hd(V,K){if(V.endsWith(".d.ts"))return null;let be=V.replace(Kd,".d.ts");return K.exists(be)?be:null}function qd(V,K,be){let Be=Ud(V);return K.map((Gt)=>{if(!Gt.importSource||!Gt.importedName)return{candidate:Gt};let Wt=be.graph.resolve(Gt.importSource,Be);if(!Wt)return{candidate:Gt,failureReason:"module-not-found"};let Kt=ns(Wt,Gt.importedName,be);if(!Kt)return{candidate:Gt,failureReason:"export-not-found"};if(Kt.returnType)return{candidate:Gt,type:Kt.returnType};let Vt=Hd(Wt,be.graph);if(Vt){let Ut=ns(Vt,Gt.importedName,be);if(Ut?.returnType)return{candidate:Gt,type:Ut.returnType}}return{candidate:Gt,failureReason:"return-type-unresolved"}})}function zd(V,K){switch(K){case"module-not-found":return`Prop "${V.propName}" default calls "${V.calleeName}()", but "${V.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${V.propName}" default calls "${V.calleeName}()", but "${V.importedName}" is not exported from "${V.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${V.propName}" default calls "${V.calleeName}()" imported from "${V.importSource}", but its return type could not be resolved; falling back to "any".`}}function Xd(V,K){for(let{candidate:be,type:Be,failureReason:Gt}of K){let Wt=bi(V,be);if(Wt?.typeSource!=="unknown")continue;if(Be){qn(Wt,"type",Be),qn(Wt,"typeSource","typescript"),Si(V,be);continue}if(be.location==="props"&&Gt){let Kt=V.diagnostics?.find((Vt)=>Vt.kind==="prop-unknown-type"&&Vt.name===be.propName);if(Kt)Kt.message=zd(be,Gt)}}}var wp={collect:(V)=>V.pendingCallDefaultCandidates?.filter((K)=>K.importSource!==void 0)??[],resolve:qd,apply:Xd};import{dirname as Jd}from"node:path";function Yd(V,K,be){let Be=Jd(V);return K.map((Gt)=>{let Wt=be.graph.resolve(Gt.importSource,Be);if(!Wt)return{candidate:Gt};let Kt=xs(Wt,Gt,be);if(!Kt?.primitiveLiteral)return{candidate:Gt};return{candidate:Gt,literal:Kt.primitiveLiteral,declaredType:Kt.declaredType}})}function Qd(V,K){for(let{candidate:be,literal:Be,declaredType:Gt}of K){if(!Be)continue;let Wt=bi(V,be);if(!Wt)continue;if(qn(Wt,"value",Be.raw),qn(Wt,"defaultValue",{raw:Be.raw,kind:"literal",value:Be.value}),Wt.typeSource!=="unknown")continue;qn(Wt,"type",Gt?.type??Be.type),qn(Wt,"typeSource",Gt?.source??"default"),Si(V,be)}}var Tp={collect:(V)=>V.pendingConstDefaultCandidates??[],resolve:Yd,apply:Qd};import{dirname as tf}from"node:path";var Zd=/(?:_|[^\p{ID_Continue}$])+/u,ef=/^[\p{ID_Start}$]/u;function L(V){let Be=`${V.split(Zd).map((Gt)=>Gt.charAt(0).toUpperCase()+Gt.slice(1)).join("")}Context`;return ef.test(Be)?Be:`_${Be}`}function Q(V,K){let be=K.source.value;if(typeof be!=="string"||K.importKind==="type")return;for(let Be of K.specifiers){if(Be.type!=="ImportSpecifier"||Be.importKind==="type")continue;let Gt=Be.local.name,{imported:Wt}=Be,Kt=Wt.type==="Identifier"?Wt.name:typeof Wt.value==="string"?Wt.value:Gt;V.valueImportBindingsByLocalName.set(Gt,{localName:Gt,importedName:Kt,source:be})}}function ae(V){return[V.importedName,...V.members??[]].join(".")}function De(V,K){let be=[],Be=K;while(k(Be)){if(Be.computed||!t(Be.property))return;be.unshift(Be.property.name),Be=Be.object}if(!t(Be))return;let Gt=Be.name,Wt=(Vt,Ut,Ht)=>Ht.length>0?{source:Vt,importedName:Ut,members:Ht}:{source:Vt,importedName:Ut},Kt=V.valueImportBindingsByLocalName.get(Gt);if(Kt)return Wt(Kt.source,Kt.importedName,be);for(let Vt of[V.parsed?.instance,V.parsed?.module])for(let Ut of Vt?.content.body??[]){if(Ut.type!=="ImportDeclaration")continue;let Ht=Ut.source.value;if(Ut.importKind==="type"||typeof Ht!=="string")continue;let zt=Ut.specifiers.find((Yt)=>Yt.local.name===Gt);if(zt?.type==="ImportDefaultSpecifier")return Wt(Ht,"default",be);if(zt?.type==="ImportNamespaceSpecifier"&&be.length>0)return Wt(Ht,be[0],be.slice(1))}return}function ce(V,K){if(!k(K))return;return De(V,K)}function Fe(V){let K=new Map;for(let be of V.content.body){if(be.type!=="ImportDeclaration"||be.importKind==="type")continue;let Be=be.source.value;if(typeof Be!=="string")continue;for(let Gt of be.specifiers){if(Gt.type==="ImportSpecifier"&&Gt.importKind==="type")continue;let Wt=Gt.local.name,Kt;if(Gt.type==="ImportDefaultSpecifier")Kt="default";else if(Gt.type==="ImportNamespaceSpecifier")Kt="*";else if(Gt.imported.type==="Identifier")Kt=Gt.imported.name;else Kt=String(Gt.imported.value??Wt);K.set(Wt,{from:Be,imported:Kt})}}return K}function Pe(V,K){for(let be of K?.content.body??[]){if(be.type==="ImportDeclaration"){Q(V,be);continue}let Be=be.type==="ExportNamedDeclaration"&&be.declaration?be.declaration:be;if(Be.type==="FunctionDeclaration"&&Be.id?.name)V.funcDecls.set(Be.id.name,Be)}}function nf(V,K,be){let Be=tf(V);return K.map((Gt)=>{let Wt=be.graph.resolve(Gt.importSource,Be);if(!Wt)return{candidate:Gt};let Kt=xs(Wt,Gt,be);if(Kt?.kind!=="const"||Kt.literalValue===void 0)return{candidate:Gt};return{candidate:Gt,key:Kt.literalValue}})}function sf(V,K){for(let{candidate:be,key:Be}of K){if(!Be){let Vt=ae(be);V.diagnostics=[...V.diagnostics??[],o({component:V.filePath,kind:"context-key-unresolved",name:Vt,message:`setContext key \`${Vt}\` from "${be.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...be.source?{source:be.source}:{}})];continue}let Gt=[...V.contexts??[]],Wt=Gt.findIndex((Vt)=>Vt.key===Be);if(Wt!==-1){let Vt=Gt[Wt],Ut=kp(Vt.source,be.source),Ht=Ut?Vt.source:be.source;if(V.diagnostics=[...V.diagnostics??[],o({component:V.filePath,kind:"context-duplicate-key",name:Be,message:`setContext("${Be}", ...) was called more than once; only the first call's shape is used.`,...Ht?{source:Ht}:{}})],!Ut)continue;Gt.splice(Wt,1)}let Kt=Gt.findIndex((Vt)=>kp(Vt.source,be.source));Gt.splice(Kt===-1?Gt.length:Kt,0,{key:Be,typeName:L(Be),...be.type===void 0?{}:{type:be.type},description:be.description,properties:be.properties,...be.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...be.internal?{internal:!0}:{},source:be.source}),V.contexts=Gt}}function kp(V,K){if(!V||!K)return!1;let{line:be,column:Be}=V.start;return be>K.start.line||be===K.start.line&&Be>K.start.column}var Pp={collect:(V)=>V.pendingContextKeyCandidates??[],resolve:nf,apply:sf};import{dirname as rf}from"node:path";function ye(V,K){let be=u(V.name,K.name);if(be!==0)return be;let Be=u(V.type,K.type);if(Be!==0)return Be;if(V.type==="forwarded"&&K.type==="forwarded"){let Gt=u(V.element,K.element);if(Gt!==0)return Gt}return u(V.detail??"",K.detail??"")}function of(V,K,be){let Be=rf(V);return K.map((Gt)=>{let Wt=be.graph.resolve(Gt.importSource,Be);if(!Wt)return{candidate:Gt,failureReason:"module-not-found"};let Kt=xs(Wt,Gt,be)?.functionNode;if(!Kt)return{candidate:Gt,failureReason:"not-a-function"};let Vt=af(Kt,Gt);if(!Vt)return{candidate:Gt,failureReason:"parameter-not-found"};return lf(Kt,Vt,Gt)})}function $p(V){return V?.type==="AssignmentPattern"?V.left:V}function af(V,K){let be=$p(V.params[K.argumentIndex]);if(K.property===void 0)return be?.type==="Identifier"?{name:be.name}:void 0;if(!K.property)return;if(be?.type==="Identifier")return{object:be.name,property:K.property};if(be?.type!=="ObjectPattern")return;for(let Be of be.properties){if(Be.type!=="Property"||Be.computed)continue;if(Be.key.type!=="Identifier"||Be.key.name!==K.property)continue;let Gt=$p(Be.value);return Gt?.type==="Identifier"?{name:Gt.name}:void 0}return}function Hr(V){if(!V)return null;if(V.type==="ConditionalExpression"){let be=Hr(V.consequent),Be=Hr(V.alternate);return be&&Be?[...be,...Be]:null}let K=b(V);return K?[K]:null}var pf={variableType:()=>{return}};function cf(V){if(!V)return"null";let{deriveLiteralDetailType:K,literalDetailToTypeText:be}=An();if(V.type==="Literal")return be(V.value);return K(pf,V)??"any"}function Ap(V,K){if("name"in K)return V.type==="Identifier"&&V.name===K.name;if(V.type!=="MemberExpression"||V.computed)return!1;return V.object.type==="Identifier"&&V.object.name===K.object&&V.property.type==="Identifier"&&V.property.name===K.property}function lf(V,K,be){let Be=new Map,Gt="name"in K?K.name:K.object,Wt;if(a(V.body,{enter(Vt,Ut,Ht){if(Vt.type==="CallExpression"){if(!Ap(Vt.callee,K))return;let Yt=Vt.arguments,Jt=Hr(Yt[0]);if(!Jt)return Wt="dynamic-event-name",T;for(let Qt of Jt){let Zt=Be.get(Qt)??new Set;Zt.add(cf(Yt[1])),Be.set(Qt,Zt)}return}let zt=Ut?.type==="CallExpression"&&Ht==="callee";if(Vt.type==="MemberExpression"&&Ap(Vt,K)&&!zt)return Wt="passed-on",T;if(Vt.type!=="Identifier"||Vt.name!==Gt)return;if(zt)return;if(!("name"in K)&&Ut?.type==="MemberExpression"&&Ht==="object")return;if(!W(Vt,Ut))return;return Wt="passed-on",T}}),Wt)return{candidate:be,failureReason:Wt};let Kt=Array.from(Be,([Vt,Ut])=>{let Ht=Array.from(Ut);return{name:Vt,detail:Ht.includes("any")?"any":Ht.join(" | ")}});return{candidate:be,events:Kt}}function uf(V,K){let be=V.members?`"${V.calleeText}"`:V.importedName==="default"?"the default export":`"${V.importedName}"`;switch(K){case"module-not-found":return`"${V.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${be} isn't a function declared in "${V.importSource}"`;case"parameter-not-found":return`no parameter of ${be} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${be} passes it on`}}function hf(V,K,{deferredEventNoSourceDiagnostics:be=[],untypedJsDocEventNames:Be=[]}){let Gt=new Map,Wt=[...V.diagnostics??[]],Kt=!0;for(let{candidate:Qt,events:Zt,failureReason:tn}of K){if(tn){Kt=!1,Wt.push(o({component:V.filePath,kind:"dispatch-escapes",name:Qt.dispatcherName,message:`\`${Qt.dispatcherName}\` is passed to \`${Qt.calleeText}\`, but sveld couldn't read the events it dispatches: ${uf(Qt,tn)}. Document them with @event tags.`,...Qt.source?{source:Qt.source}:{},...Qt.ignored?{ignored:!0}:{}}));continue}for(let en of Zt??[]){if(Gt.has(en.name))continue;Gt.set(en.name,{type:"dispatched",name:en.name,detail:en.detail,...Qt.source?{source:Qt.source}:{}})}}if(Kt){for(let Qt of be)if(!Gt.has(Qt.name))Wt.push(Qt)}if(V.diagnostics=Wt,Gt.size===0)return;let Vt=new Map,Ut=new Set;for(let Qt of V.events)if(Qt.type==="dispatched")Ut.add(Qt.name);else if(!Vt.has(Qt.name))Vt.set(Qt.name,Qt);let Ht=new Set(Be),zt=new Map,Yt=[];for(let Qt of Gt.values()){if(Ut.has(Qt.name)){if(Ht.has(Qt.name)&&Qt.detail!==void 0)zt.set(Qt.name,Qt.detail);continue}let Zt=Vt.get(Qt.name);if(!Zt){Yt.push(Qt);continue}let tn=Qt.source??Zt.source;Yt.push({type:"dispatched",name:Qt.name,detail:Zt.detail??Qt.detail,...Zt.description?{description:Zt.description}:{},...Zt.deprecated===void 0?{}:{deprecated:Zt.deprecated},...Zt.tags?{tags:Zt.tags}:{},...Zt.internal?{internal:!0}:{},...tn?{source:tn}:{}})}if(Yt.length===0&&zt.size===0)return;let Jt=new Set(Yt.map((Qt)=>Qt.name));V.events=[...V.events.filter((Qt)=>Qt.type==="dispatched"||!Jt.has(Qt.name)).map((Qt)=>{let Zt=Qt.type==="dispatched"?zt.get(Qt.name):void 0;return Zt===void 0?Qt:{...Qt,detail:Zt}}),...Yt].sort(ye)}var Dp={collect:(V)=>V.pendingDispatchEscapeCandidates??[],resolve:of,apply:hf};function Ci(V){return(K)=>{let be=V.collect(K);if(be.length===0)return;return(Be,Gt,Wt)=>V.apply(Be,V.resolve(Gt,be,Wt),K)}}var df=[Ci(wp),Ci(Tp),Ci(Pp),Ci(Dp)];async function Np(V,K,be,Be){let Gt=[];for(let Kt of V){let Vt=be(Kt);if(Vt===void 0)continue;let Ut=df.flatMap((Ht)=>Ht(Vt)??[]);if(Ut.length>0)Gt.push({component:Kt,passes:Ut})}let Wt=new Map;if(Gt.length===0)return Wt;await Kn();for(let{component:Kt,passes:Vt}of Gt){let Ut=vi(Be),Ht=K(Kt.filePath);for(let zt of Vt)zt(Kt,Ht,Ut);Wt.set(Kt.filePath,Array.from(Ut.cache.keys()))}return Wt}var ff=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,mf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),gf=new Set(["svelte","html"]);function yf(V){let K=V.trim();if(K==="")return null;let be=K.match(ff);if(be){let Be=be[1].toLowerCase(),Gt=be[2].trim();if(Gt==="")return null;if(mf.has(Be))return{kind:"compile",code:Gt};if(gf.has(Be))return{kind:"syntax",code:Gt};return null}if(K.startsWith("<"))return null;return{kind:"compile",code:K}}function _p(V){if(!V.isFunction)return"any";return`(${(V.params??[]).map((be)=>`${be.name}${be.optional?"?":""}: any`).join(", ")}) => any`}function wi(V,K,be,Be,Gt){let Wt=(V??[]).filter((Vt)=>Vt.name==="example"),Kt=Wt.length>1;return Wt.flatMap((Vt,Ut)=>{let Ht=yf(Vt.body);if(Ht===null)return[];return[{id:Kt?`${K}#${Ut}`:K,name:Kt?`${be} (example ${Ut+1})`:be,type:Be,code:Ht.code,kind:Ht.kind,...Gt?{source:Gt}:{}}]})}function xf(V){let K=[];for(let be of V.props)K.push(...wi(be.tags,`prop:${be.name}`,be.name,_p(be),be.source));for(let be of V.moduleExports)K.push(...wi(be.tags,`export:${be.name}`,be.name,_p(be),be.source));for(let be of V.slots){let Be=be.name??"default";K.push(...wi(be.tags,`slot:${Be}`,Be,"any",be.source))}for(let be of V.events)K.push(...wi(be.tags,`event:${be.name}`,be.name,"any",be.source));return K}function Rp(V,K){return V.flatMap(({component:be,sources:Be})=>{let Gt=Be.filter((Wt)=>Wt.kind===K);return Gt.length===0?[]:[{component:be,sources:Gt}]})}async function vf(V){let{formatParseError:K,parseSvelte:be}=await Kn(),Be=new Map;for(let{component:Gt,sources:Wt}of V){let Kt=[];for(let Vt of Wt)try{be(Vt.code)}catch(Ut){Kt.push(o({component:Gt.filePath,kind:"example-syntax-error",name:Vt.name,message:K(Ut),...Vt.source?{source:Vt.source}:{}}))}Be.set(Gt,Kt)}return Be}async function Ef(V,K,be){let Be=await K.checkExamples(V.map(({component:Wt,sources:Kt})=>({moduleName:Wt.moduleName,filePath:be(Wt.filePath),sources:Kt}))),Gt=new Map;for(let{component:Wt,sources:Kt}of V){let Vt=Be.get(be(Wt.filePath));if(!Vt||Vt.length===0)continue;let Ut=new Map(Kt.map((Ht)=>[Ht.id,Ht.source]));Gt.set(Wt,Vt.map((Ht)=>{let zt=Ut.get(Ht.id);return o({component:Wt.filePath,kind:"example-compile-error",name:Ht.name,message:Ht.message,...zt?{source:zt}:{}})}))}return Gt}async function Ip(V,K,be,Be){let Gt=Array.from(V,(Ht)=>({component:Ht,sources:xf(Ht)})),Wt=K===!0?Rp(Gt,"compile"):[],Kt=Rp(Gt,"syntax"),Vt=new Map,Ut=(Ht)=>{for(let[zt,Yt]of Ht)Vt.set(zt,[...Vt.get(zt)??[],...Yt])};if(Kt.length>0)Ut(await vf(Kt));if(Wt.length>0){let{TypeResolver:Ht}=await import("./chunk-261qwh99.js"),zt=await Ht.create(be);if(!zt.ok)throw Error(`sveld: \`checkExamples\` ${zt.message}.`);let Yt=zt.resolver;try{Ut(await Ef(Wt,Yt,Be))}finally{await Yt.dispose()}}return Vt}import{hash as bf}from"node:crypto";import{existsSync as Sf,mkdirSync as Cf,readFileSync as wf,renameSync as Tf,writeFileSync as Lp}from"node:fs";import{dirname as qr,isAbsolute as kf,join as Op,resolve as Ti}from"node:path";var Mp=10,Pf=Op("node_modules",".cache","sveld","parse-cache.json"),$f="2dffee7711b6cc03";function Fp(){return`${ti}+${$f}+svelte@${_s}`}function Af(V){for(let K=Ti(V);;K=qr(K)){if(Sf(Op(K,"package.json")))return K;if(qr(K)===K)return Ti(V)}}function jp(V,K){let be=Af(V);if(typeof K==="string")return kf(K)?K:Ti(be,K);return Ti(be,Pf)}function ki(V){return bf("sha256",V,"hex")}function zr(){return{formatVersion:Mp,toolchainVersion:Fp(),entries:{}}}function Df(V){try{let K=JSON.parse(wf(V,"utf-8"));if(K.formatVersion!==Mp||K.toolchainVersion!==Fp())return zr();return K}catch{return zr()}}class Xr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(V){this.cacheFilePath=V,this.file=Df(V),this.savedEntryCount=Object.keys(this.file.entries).length}has(V,K){return this.lookup(V,K)!==void 0}lookup(V,K){let be=this.next.get(V);if(be?.hash===K)return be;let Be=this.file.entries[V];return Be?.hash===K?Be:void 0}get(V,K){let be=this.lookup(V,K);if(be===void 0)return null;this.next.set(V,be);let{component:Be,typeScriptMetadata:Gt,pending:Wt}=structuredClone({component:be.component,typeScriptMetadata:be.typeScriptMetadata,pending:be.pending});if(Gt!==void 0)Be[x]=Gt;return Wt===void 0?{component:Be}:{component:Be,pending:Wt}}set(V,K,{component:be,pending:Be}){this.dirty=!0,this.next.set(V,{hash:K,...structuredClone({component:be,typeScriptMetadata:be[x],pending:Be})})}getGeneratedText(V,K){let be=this.next.get(V);if(be?.generatedText===void 0||be.generatedText.key!==K)return;return be.generatedText.text}setGeneratedText(V,K,be){let Be=this.next.get(V);if(Be===void 0)return;if(Be.generatedText?.key===K&&Be.generatedText.text===be)return;Be.generatedText={key:K,text:be},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,Cf(qr(this.cacheFilePath),{recursive:!0});let V={...zr(),entries:Object.fromEntries(this.next)},K=JSON.stringify(V),be=`${this.cacheFilePath}.${process.pid}.tmp`;try{Lp(be,K),Tf(be,this.cacheFilePath)}catch{try{Lp(this.cacheFilePath,K)}catch{}}}}import{dirname as Nf,relative as _f,resolve as Rf}from"node:path";async function Bp(V,K={}){await Kn();let be=Rf(V),Be=Nf(be),Gt=(Vt)=>n(`./${_f(Be,Vt)}`),Wt=Ei(be,{...vi(K.graph??new Hn),onAmbiguousStarExport:(Vt,Ut,Ht)=>{if(Vt!==be||!K.diagnostics)return;if(Ht.every((Qt)=>Qt.declFile.endsWith(".svelte")))return;let zt=Array.from(new Set(Ht.map((Qt)=>Gt(Qt.declFile)))),Yt=zt.map((Qt)=>`"${Qt}"`),Jt=`${Yt.slice(0,-1).join(", ")} and ${Yt[Yt.length-1]}`;K.diagnostics.push(o({component:Gt(be),kind:"export-ambiguous",name:Ut,message:`"${Ut}" is exported by ${Jt} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${Ut} } from "${zt[0]}"\`).`}))}}),Kt=new Map;for(let Vt of Wt){if(Vt.name==="default"||Vt.declFile.endsWith(".svelte"))continue;let{declFile:Ut,returnType:Ht,literalValue:zt,primitiveLiteral:Yt,declaredType:Jt,functionNode:Qt,namespaceFile:Zt,...tn}=Vt,en=Gt(Ut);if(Zt!==void 0)tn.type=`typeof import(${JSON.stringify(Gt(Zt))})`;Kt.set(Vt.name,{...tn,source:en})}return Array.from(Kt.values()).sort((Vt,Ut)=>u(Vt.name,Ut.name))}async function Of(V){let K=await Promise.all(Array.from(V,async(be)=>{try{return[be,await Lf(be,"utf-8")]}catch(Be){return console.warn(`Warning: Failed to read file ${be}:`,Be),[be,null]}}));return new Map(K)}function Gp(V){if(V.length===0)return;console.error(`sveld: failed to parse ${V.length} component(s):`);for(let{filePath:K,message:be}of V)console.error(` - ${K}: ${be}`)}class Ms{input;glob;options;graph=new Hn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(V,K,be={}){this.input=V,this.glob=K,this.options=be}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Hn,this.collected=jr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=gi(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=If(this.input).isFile()?Vp(this.input):null,this.cache=this.options.cache===!1?void 0:new Xr(jp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),Gp(Array.from(this.parseErrors.values())),this.assemble()}async update(V){let K=V.map((Ht)=>Vp(Ht));if(this.graph.invalidate(...K),K.length===0)return{result:this.assemble(),reparsed:[]};let be=this.entryFile!==null&&K.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Ht,exports:zt,allComponentEntries:Yt,resolveComponentFilePath:Jt}=this.collected;Fr(this.graph,Ht,zt,Yt,Jt,this.globMergeState)}this.indexEntries();let Be=this.componentPaths();for(let Ht of this.records.keys())if(!Be.has(Ht))this.records.delete(Ht);for(let Ht of this.parseErrors.keys())if(!Be.has(Ht))this.parseErrors.delete(Ht);let Gt=Array.from(this.records).flatMap(([Ht,{crossFileReads:zt}])=>zt?.some((Yt)=>K.includes(Yt))?[Ht]:[]),Wt=new Set([...K.filter((Ht)=>_n.test(Ht)),...be,...Gt]),Kt=new Set(Array.from(Be).filter((Ht)=>Wt.has(Ht))),Vt=await this.process(Kt),Ut=this.assemble();return Gp(Ut.errors),{result:Ut,reparsed:Vt}}async recollect(){let V=this.collected,K=jr(this.input,this.glob,this.documentExports,this.graph),be=[];for(let[Be,Gt]of Object.entries(K.exports)){let Wt=K.resolveComponentFilePath(Gt.source),Kt=Object.hasOwn(V.exports,Be)?V.exports[Be]:void 0;if(Kt===void 0||V.resolveComponentFilePath(Kt.source)!==Wt)be.push(Wt)}return this.collected=K,this.globMergeState=gi(K.allComponentEntries,K.resolveComponentFilePath),await this.readEntryExports(),be}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Bp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:V,allComponentEntries:K,resolveComponentFilePath:be}=this.collected,Be=new Set;for(let[,Gt]of[...Object.entries(V),...K])if(hs(Gt.source))Be.add(be(Gt.source));return Be}indexEntries(){let{exports:V,allComponentEntries:K,resolveComponentFilePath:be}=this.collected;this.canonicalEntries=new Map;for(let Be of[Object.entries(V),K])for(let[Gt,Wt]of Be){if(!hs(Wt.source))continue;this.canonicalEntries.set(be(Wt.source),{moduleName:Br(Gt,Wt.source,Be.length,this.warnedModuleNames),filePath:n(Wt.source)})}}canonicalEntry(V){let K=this.canonicalEntries.get(V);if(K===void 0)throw Error(`sveld: no entry lists ${V}.`);return K}async process(V){let K=new Map,be=await this.parse(V,K);this.cache?.save();let Be=await this.settle(be);for(let Gt of V)this.records.delete(Gt),this.parseErrors.delete(Gt);for(let[Gt,Wt]of Be)this.records.set(Gt,Wt);for(let[Gt,Wt]of K)this.parseErrors.set(Gt,Wt);return Array.from(Be.keys())}async parse(V,K){let be=await Of(V),Be=this.cache,Gt=new Map,Wt=new Set;if(Be)for(let[Vt,Ut]of be){if(Ut===null)continue;let Ht=ki(Ut);if(Gt.set(Vt,Ht),!Be.has(Vt,Ht))Wt.add(Vt)}if(V.size>0&&(!Be||Wt.size>0))await Kn();let Kt=new Map;for(let Vt of V){let Ut=be.get(Vt);if(Ut===null||Ut===void 0)continue;let Ht=this.parseOne(Vt,Ut,Gt.get(Vt),K);if(Ht)Kt.set(Vt,Ht)}return Kt}parseOne(V,K,be,Be){let Gt=be===void 0?null:this.cache?.get(V,be);if(Gt)return Gt;let{moduleName:Wt,filePath:Kt}=this.canonicalEntry(V),Vt;try{Vt=new(An()).ComponentParser().parse(K,{moduleName:Wt,filePath:Kt})}catch(Ut){if(this.options.failFast)throw Ut;Be.set(V,{filePath:Kt,moduleName:Wt,message:Ut instanceof Error?Ut.message:String(Ut),stack:Ut instanceof Error?Ut.stack:void 0});return}if(be!==void 0)this.cache?.set(V,be,Vt);return Vt}async settle(V){let{rootDir:K,resolveComponentFilePath:be}=this.collected,Be=new Map,Gt=new Map;for(let[Ut,{component:Ht,pending:zt}]of V){let Yt={...this.canonicalEntry(Ut),...Ht};Be.set(Ut,Yt),Gt.set(Yt,zt)}let{checkExamples:Wt}=this.options;if(Wt){let Ut=await Ip(Be.values(),Wt,K,be);for(let[Ht,zt]of Ut)_i(Ht,zt)}let Kt=await Np(Be.values(),be,(Ut)=>Gt.get(Ut),this.graph),Vt=new Map;for(let[Ut,Ht]of Be){let{moduleName:zt,filePath:Yt,...Jt}=Ht,Qt=Kt.get(Yt);Vt.set(Ut,Qt===void 0?{component:Jt}:{component:Jt,crossFileReads:Qt})}return Vt}assemble(){let{exports:V,allComponentEntries:K,resolveComponentFilePath:be}=this.collected,Be=this.cache,Gt=(Yt,[Jt,Qt])=>{if(!hs(Qt.source))return;let Zt=this.records.get(be(Qt.source));if(Zt===void 0)return;return{component:{moduleName:Br(Jt,Qt.source,Yt.length,this.warnedModuleNames),filePath:n(Qt.source),...Zt.component},record:Zt}},Wt=new Map,Kt=Be?new Map:void 0,Vt=Be?new Map:void 0;for(let Yt of K){let Jt=Gt(K,Yt);if(Jt===void 0)continue;let{filePath:Qt}=Jt.component;Wt.set(Qt,Jt.component),(Jt.record.crossFileReads===void 0?Kt:Vt)?.set(Qt,be(Yt[1].source))}let Ut=np(Wt,be,this.graph);for(let Yt of Wt.values())_i(Yt,[...Ut(Yt),...tp(Yt)]);let Ht=new Map,zt=Object.entries(V);for(let Yt of zt){let Jt=Gt(zt,Yt);if(Jt===void 0)continue;let Qt=Wt.get(Jt.component.filePath);if(Qt)Jt.component.diagnostics=Qt.diagnostics;Ht.set(Jt.component.moduleName,Jt.component)}return{exports:V,entryExports:this.entryExports,components:Ht,allComponentsForTypes:Wt,errors:Array.from(this.parseErrors.values()),diagnostics:To($o([...Array.from(Wt.values()).flatMap((Yt)=>Yt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Be,resolvedPathByFilePath:Kt,crossFileResolvedPathByFilePath:Vt}}}function C(V){return{failFast:V?.failFast,documentExports:V?.documentExports===!0,cache:V?.cache,checkExamples:V?.checkExamples==="syntax"?"syntax":V?.checkExamples===!0,diagnostics:V?.diagnostics}}async function I(V,K,be={}){return new Ms(V,K,be).build()}import{existsSync as Jr,readFileSync as Mf}from"node:fs";import{isAbsolute as Ff,join as Up}from"node:path";var Fs='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Wp(V){return Ff(V)?V:Up(process.cwd(),V)}function Me(V){if(V){let Gt=Wp(V);if(Jr(Gt))return{entry:Z(V)};return{entry:null,configured:!0,message:`Invalid entry point: ${Gt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let K=Up(process.cwd(),"package.json");if(!Jr(K))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let be;try{be=rp(JSON.parse(Mf(K,"utf-8")))}catch(Gt){throw console.error("Error reading package.json:",Gt),Gt}let Be=be.svelte?.trim();if(!Be)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(!Jr(Wp(Be)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Be}", which does not exist.`};return{entry:Z(Be)}}function Pi(V){let K=Me(V);if(K.entry===null)console.error(K.message);return K.entry}async function Kp(V,K,be={}){let Be=new Ms(V,K,{...be,failFast:!1}),Gt=await Be.build();return{get result(){return Promise.resolve(Gt)},async update(Wt){let Kt=await Be.update(Wt);return Gt=Kt.result,Kt}}}import Qr from"node:path";function Hp(V){let K=new Map;for(let[Be,Gt]of Object.entries(V)){let Wt=K.get(Gt.source)??[];Wt.push({id:Be,exportee:Gt}),K.set(Gt.source,Wt)}let be=[];for(let[Be,Gt]of K){let Wt=_n.test(Be),Kt=Gt.some(({id:Jt,exportee:Qt})=>Jt!=="default"&&Qt.default),Vt=Gt.some(({exportee:Jt})=>!Jt.default),Ut=Wt&&Kt&&Vt,Ht=[],zt=[],Yt=[];for(let{id:Jt,exportee:Qt}of Gt){if(Jt==="default"){zt.push(`export { default } from "${Be}";`);continue}if(Qt.default)if(Qt.mixed)zt.push(`export { default as ${Jt} } from "${Be}";`),zt.push(`export { default } from "${Be}";`);else Yt.push(`default as ${Jt}`);else if(Wt&&!Ut)Yt.push(`default as ${Jt}`);else Ht.push(Jt)}if(Yt.length>0&&Ht.length>0)be.push(`export { ${[...Yt,...Ht].join(", ")} } from "${Be}";`);else{if(Ht.length>0)be.push(`export { ${Ht.join(", ")} } from "${Be}";`);if(Yt.length>0)be.push(`export { ${Yt.join(", ")} } from "${Be}";`)}be.push(...zt)}return be.join(`
|
|
182
|
-
`)}function qp(V){return V.filter((K)=>K.names.length>0).map((K)=>`export type { ${K.names.join(", ")} } from "${K.source}";`).join(`
|
|
183
|
-
`)}function zp(V){return V.replace(_n,"")}function Yr(V){return V.replace(_n,".svelte.d.ts")}import{mkdir as jf,readFile as Bf,writeFile as Vf}from"node:fs/promises";import{parse as Gf}from"node:path";class On{ensuredDirs=new Set;async write(V,K){try{if(await Bf(V,"utf-8")===K)return!1}catch{}let be=Gf(V).dir;if(!this.ensuredDirs.has(be))await jf(be,{recursive:!0}),this.ensuredDirs.add(be);return await Vf(V,K),!0}}function Wf(V){return typeof V==="object"&&V!==null&&!Array.isArray(V)&&"start"in V&&"end"in V}function $i(V){if(Array.isArray(V))return V.map((K)=>$i(K));if(V!==null&&typeof V==="object"){let K={};for(let[be,Be]of Object.entries(V)){if((be==="source"||be==="componentCommentSource")&&Wf(Be))continue;K[be]=$i(Be)}return K}return V}function Xp(V,K){return V.map((be)=>({...be,filePath:xa(be.filePath,K)}))}function Uf(V,K,be){if(!K)return`${V.moduleName}.api.json`;if(!be.has(V.moduleName))be.add(V.moduleName),console.warn(`Warning: multiple components named "${V.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${zp(V.filePath)}.api.json`}async function Kf(V,K,be){let Be=d(V),Gt=Xp(Be.components,K.inputDir);if(K.source===!1)Gt=$i(Gt);let Wt=new Map;for(let Ut of Gt)Wt.set(Ut.moduleName,(Wt.get(Ut.moduleName)??0)+1);let Kt=new Set,Vt=new On;await Promise.all(Gt.map(async(Ut)=>{let Ht=(Wt.get(Ut.moduleName)??0)>1,zt=Uf(Ut,Ht,Kt),Yt=Qr.resolve(Qr.join(be,zt)),Jt=await Vt.write(Yt,Ns(Ut));jn(`${Jt?"created":"unchanged"} "${Yt}".`)}))}function Zr(V,K){let be=d(V,{entryExports:K.entryExports}),Be={...be,components:Xp(be.components,K.inputDir)};return K.source===!1?$i(Be):Be}function eo(V,K){return Ns(Zr(V,K))}async function to(V,K){if(K.outDir){await Kf(V,K,K.outDir);return}let be=await new On().write(Qr.resolve(K.outFile),eo(V,K));jn(`${be?"created":"unchanged"} "${K.outFile}".`)}import{join as fc,resolve as fo}from"node:path";var Jp=/`/g,Yp=/\s+/g,Dn="--",Qp=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
184
|
-
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
185
|
-
`,Zp=`| Slot name | Default | Props | Fallback | Description |
|
|
186
|
-
| :- | :- | :- | :- | :- |
|
|
187
|
-
`,ec=`| Event name | Type | Detail | Description |
|
|
188
|
-
| :- | :- | :- | :- |
|
|
189
|
-
`,io=`| Name | Kind | Type | Description |
|
|
190
|
-
| :- | :- | :- | :- |
|
|
191
|
-
`,Hf=`| Member | Signature | Description |
|
|
192
|
-
| :- | :- | :- |
|
|
193
|
-
`,tc=`| Part name | Description |
|
|
194
|
-
| :- | :- |
|
|
195
|
-
`,nc=`| Property name | Type | Default value | Description |
|
|
196
|
-
| :- | :- | :- | :- |
|
|
197
|
-
`,ro=/\|/g,qf=/</g,zf=/>/g,ss=/\n/g,Xf=/^[A-Za-z_$][\w$]*$/,Jf=/\s*\n\s*/g,Yf=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,Qf=/[&<|`*\\_]/;function oo(V){if(!Qf.test(V))return V;return V.replace(Yf,(K)=>K==="&"?"&":K==="<"?"<":K==="_"?"_":`&#${K.charCodeAt(0)};`)}function sc(V){return`<code>${oo(V.includes(`
|
|
198
|
-
`)?V.replace(Jf," "):V)}</code>`}var Zf=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function em(V){if(!V.includes("{@link"))return V;return V.replace(Zf,(K,be,Be)=>`[${Be===void 0?be:Be.trim()}](${be})`)}function no(V){return V.includes("```")||V.includes("~~~")}function so(V){return ac(em(V))}var tm=/^([ \t]*)(`{3,}|~{3,})(.*)$/,nm=/^\n/,sm=/\n$/;function ic(V){let K=(Wt)=>({kind:"prose",text:so(Wt.join(`
|
|
199
|
-
`))});if(!no(V))return[K([V])];let be=V.split(`
|
|
200
|
-
`),Be=[],Gt=[];for(let Wt=0;Wt<be.length;Wt++){let Kt=tm.exec(be[Wt]),[,Vt="",Ut="",Ht=""]=Kt??[];if(!Kt||Ut[0]==="`"&&Ht.includes("`")){Gt.push(be[Wt]);continue}if(Gt.push(""),Gt.length>1)Be.push(K(Gt));let zt=[],Yt=new RegExp(`^[ \\t]*${Ut[0]}{${Ut.length},}[ \\t]*$`);for(Wt++;Wt<be.length&&!Yt.test(be[Wt]);Wt++){let Jt=be[Wt],Qt=0;while(Qt<Vt.length&&(Jt[Qt]===" "||Jt[Qt]==="\t"))Qt++;zt.push(Jt.slice(Qt))}Be.push({kind:"code",code:zt.join(`
|
|
201
|
-
`)}),Gt=[""]}if(Gt.length>1||Be.length===0)Be.push(K(Gt));return Be}function rc(V){let K="";for(let be=0;be<V.length;be++){let Be=V[be];if(Be.kind==="code"){K+=`<pre><code>${oo(Be.code).replace(ss,"<br />")}</code></pre>`;continue}let Gt=Be.text;if(V[be-1]?.kind==="code")Gt=Gt.replace(nm,"");if(V[be+1]?.kind==="code")Gt=Gt.replace(sm,"");K+=Gt.replace(ro,"|").replace(ss,"<br />")}return K}function Pn(V){if(V===void 0)return Dn;return sc(V)}function oc(V){if(!V.reExport)return Pn(V.type);let{from:K,imported:be}=V.reExport,Be=be==="*"?"":Xf.test(be)?`.${be}`:`[${JSON.stringify(be)}]`;return Pn(`typeof import(${JSON.stringify(K)})${Be}`)}function ac(V){if(!V.includes("<")&&!V.includes(">"))return V;return V.replace(qf,"<").replace(zf,">")}function ao(V){if(V===void 0)return Dn;return sc(V)}function is(V,K){if(K===void 0)return V;let be=typeof K==="string"&&K.trim().length>0?`: ${ac(K).replace(ss," ").replace(ro,"|")}`:"";return`<s>${V}</s><br />**Deprecated**${be}`}function Ai(V){if(V===void 0||V.trim().length===0)return Dn;return rc(ic(V))}function pc(V){if(V===void 0||V==="{}")return Dn;return Pn(li(V).replace(ss," "))}function cc(V){if(V===void 0)return Dn;return`<code>${oo(V).replace(ss,"<br />")}</code>`}function vs(V,K){let be=V!==void 0&&V.trim().length>0;if(!(be&&no(V))&&!K?.some(({body:Kt})=>Kt&&no(Kt))){let Kt=be?[so(V)]:[];for(let{name:Vt,body:Ut}of K??[]){let Ht=Ut?.trim();Kt.push(Ht?`@${Vt} ${so(Ht)}`:`@${Vt}`)}if(Kt.length===0)return Dn;return Kt.join(`
|
|
202
|
-
`).replace(ro,"|").replace(ss,"<br />")}let Be=[],Gt=(Kt)=>{let Vt=Be.at(-1);if(Vt?.kind==="prose")Vt.text+=Kt;else Be.push({kind:"prose",text:Kt})},Wt=(Kt,Vt)=>{if(Be.length>0)Gt(`
|
|
203
|
-
`);if(Kt)Gt(Kt);for(let Ut of ic(Vt))if(Ut.kind==="prose")Gt(Ut.text);else Be.push(Ut)};if(be)Wt("",V);for(let{name:Kt,body:Vt}of K??[]){let Ut=Vt?.trim();Wt(Ut?`@${Kt} `:`@${Kt}`,Ut??"")}if(Be.length===0)return Dn;return rc(Be)}function lc(V){if(V===void 0)return Dn;return Pn(V.replace(ss," "))}function im(V){let K=[V.extends?`Extends ${Pn(V.extends)}.`:"",V.implements?.length?`Implements ${V.implements.map((be)=>Pn(be)).join(", ")}.`:""].filter(Boolean);return K.length>0?K.join(" "):void 0}function uc(V,K){let be=new Set;for(let Be of K){if(Be.kind!=="class")continue;let Gt=im(Be);if(!Be.members?.length&&!Gt)continue;let Wt=Be.localName??Be.name;if(be.has(Wt))continue;if(be.add(Wt),V.append("h4",`\`${Wt}\` members`),Gt)V.append("raw",`${Gt}
|
|
204
|
-
|
|
205
|
-
`);if(!Be.members?.length)continue;V.append("raw",Hf);for(let Kt of Be.members)V.append("raw",`| ${is(Kt.name,Kt.deprecated)} | ${Pn(kr(Kt))} | ${vs(Kt.description,Kt.tags)} |
|
|
206
|
-
`);V.append("raw",`
|
|
207
|
-
`)}}function co(V,K,be){if(V.append("h1","Component Index"),V.append("h2","Components").tableOfContents(),V.append("divider"),be&&be.length>0)dc(V,be);for(let Be of d(K).components)lo(V,Be)}function hc(V,K,be){V.append("h1","Component Index"),V.append("h2","Components");for(let Be of K)V.append("raw",`- [${Be.moduleName}](./${Be.moduleName}.md)
|
|
208
|
-
`);if(V.append("raw",`
|
|
209
|
-
`),V.append("divider"),be&&be.length>0)dc(V,be)}function dc(V,K){V.append("h2","Exports"),V.append("raw",io);for(let be of K){let Be=(be.type??be.value)?.replace(Yp," ").trim();V.append("raw",`| ${is(be.name,be.deprecated)} | <code>${be.kind}</code> | ${Pn(Be)} | ${Ai(be.description)} |
|
|
210
|
-
`)}V.append("raw",`
|
|
211
|
-
`),V.append("divider")}function rm(V){return V.kind==="const"||V.isFunctionDeclaration}function om(V,K){V.append("h3","Module exports"),V.append("raw",io);for(let be of K)V.append("raw",`| ${is(be.name,be.deprecated)} | <code>${be.kind}</code> | ${oc(be)} | ${vs(be.description,be.tags)} |
|
|
212
|
-
`);V.append("raw",`
|
|
213
|
-
`),uc(V,K)}function po(V,K,be){if(K.length>0)be(),V.append("raw",`
|
|
214
|
-
`);else V.append("p","None.")}function lo(V,K){if(V.append("h2",`\`${K.moduleName}\``),K.generics)V.append("p",`**Type parameters:** ${Pn(`<${K.generics[1]}>`)}`);if(K.typedefs.length>0)V.append("h3","Types").append("raw",`\`\`\`ts
|
|
215
|
-
${ui({typedefs:K.typedefs})}
|
|
216
|
-
\`\`\`
|
|
217
|
-
|
|
218
|
-
`);if(V.append("h3","Props"),po(V,K.props,()=>{V.append("raw",Qp);let be=(Gt)=>Gt.reactive?0:Gt.constant?2:1,Be=K.props.map((Gt,Wt)=>({prop:Gt,index:Wt})).sort((Gt,Wt)=>be(Gt.prop)-be(Wt.prop)||Gt.index-Wt.index).map(({prop:Gt})=>Gt);for(let Gt of Be){let Wt=rm(Gt)?"accessor":Gt.kind;V.append("raw",`| ${is(Gt.name,Gt.deprecated)} | ${Gt.isRequired?"Yes":"No"} | <code>${Wt}</code> | ${Gt.reactive?"Yes":"No"} | ${Gt.binding??"--"} | ${Pn(Gt.type)} | ${ao(Gt.value)} | ${vs(Gt.description,Gt.tags)} |
|
|
219
|
-
`)}}),K.moduleExports.length>0)om(V,K.moduleExports);if(V.append("h3","Slots"),po(V,K.slots,()=>{V.append("raw",Zp);for(let be of K.slots)V.append("raw",`| ${is(be.default?Dn:be.name??Dn,be.deprecated)} | ${be.default?"Yes":"No"} | ${pc(be.slot_props)} | ${cc(be.fallback)} | ${vs(be.description,be.tags)} |
|
|
220
|
-
`)}),V.append("h3","Events"),po(V,K.events,()=>{V.append("raw",ec);for(let be of K.events)V.append("raw",`| ${is(be.name,be.deprecated)} | ${be.type} | ${lc(be.detail)} | ${vs(be.description,be.tags)} |
|
|
221
|
-
`)}),K.cssParts&&K.cssParts.length>0){V.append("h3","CSS Parts"),V.append("raw",tc);for(let be of K.cssParts)V.append("raw",`| ${be.name} | ${Ai(be.description)} |
|
|
222
|
-
`);V.append("raw",`
|
|
223
|
-
`)}if(K.cssProperties&&K.cssProperties.length>0){V.append("h3","CSS Custom Properties"),V.append("raw",nc);for(let be of K.cssProperties)V.append("raw",`| ${be.name} | ${Pn(be.type)} | ${ao(be.default)} | ${Ai(be.description)} |
|
|
224
|
-
`);V.append("raw",`
|
|
225
|
-
`)}}var am=/[^\w\- ]+/g,pm=/\s+/g,uo="<!-- __TOC__ -->";function cm(V,K){let be=V.toLowerCase().replace(Jp,"").replace(am,"").replace(pm,"-"),Be=K.get(be)??0;return K.set(be,Be+1),Be===0?be:`${be}-${Be}`}class ho{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(V={}){this.onAppend=V.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
226
|
-
|
|
227
|
-
`),this}append(V,K){switch(V){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(V.slice(-1)))} ${K}`),this.hasToC&&V==="h2")this.toc.push({indent:0,raw:K??""});break}case"quote":this.sourceParts.push(`> ${K}`);break;case"p":this.sourceParts.push(K??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(K??"");break}if(V!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,V,this),this}tableOfContents(){return this.sourceParts.push(uo),this.hasToC=!0,this.appendLineBreaks(),this}end(){let V=this.sourceParts.join("");if(!this.hasToC)return V;let K=V.indexOf(uo);if(K===-1)return V;let be=new Map,Be=this.toc.map(({indent:Gt,raw:Wt})=>`${" ".repeat(Gt)}- [${Wt}](#${cm(Wt,be)})`).join(`
|
|
228
|
-
`);return V.slice(0,K)+Be+V.slice(K+uo.length)}}function Di(V,K){return new ho({onAppend:(be,Be)=>{K?.onAppend?.call(null,be,Be,V)}})}async function lm(V,K,be){let Be=d(V,{entryExports:K.entryExports}),Gt=new On,Wt=Di(V,K);hc(Wt,Be.components,K.entryExports);let Kt=fo(fc(be,"README.md")),Vt=await Gt.write(Kt,Wt.end());jn(`${Vt?"created":"unchanged"} "${Kt}".`),await Promise.all(Be.components.map(async(Ut)=>{let Ht=Di(V,K);lo(Ht,Ut);let zt=fo(fc(be,`${Ut.moduleName}.md`)),Yt=await Gt.write(zt,Ht.end());jn(`${Yt?"created":"unchanged"} "${zt}".`)}))}function mo(V,K){let be=Di(V,K);return co(be,V,K.entryExports),be.end()}async function go(V,K){if(K.outDir){await lm(V,K,K.outDir);return}let be=fo(K.outFile),Be=await new On().write(be,mo(V,K));jn(`${Be?"created":"unchanged"} "${K.outFile}".`)}import{join as um,resolve as hm}from"node:path";function dm(V,K){if(!K.indexTypes)return[];let be=K.format==="component",Be=new Set,Gt=[];for(let Wt of Object.values(K.exports)){if(!Wt.default||!_n.test(Wt.source))continue;let Kt=n(Wt.source);if(Be.has(Kt))continue;Be.add(Kt);let Vt=V.components.find((Ht)=>Ht.filePath===Kt);if(!Vt)continue;let Ut=[gs(Vt.moduleName)];if(be)Ut.push(Ls(Vt.moduleName));Gt.push({source:Wt.source,names:Ut})}return Gt}async function mc(V,K,be){if(!V)return K;try{let Be=await V(K,be);if(typeof Be!=="string")throw TypeError(`must return a string, got ${typeof Be}`);return Be}catch(Be){let Gt=Be instanceof Error?Be.message:String(Be);throw Error(`sveld: typesOptions.transform failed for "${be.filePath}": ${Gt}`,{cause:Be})}}function fm(V,K){return`${V}
|
|
229
|
-
${ep(K)}`}async function yo(V,K){let be=hm(K.outDir,"index.d.ts"),Be=new On,Gt=d(V),Wt=qp(dm(Gt,K)),Kt=K.preamble+[Hp(K.exports),Wt].filter((Qt)=>Qt!=="").join(`
|
|
230
|
-
|
|
231
|
-
`),Vt=Pr(K),Ut=Gt.components.map(async(Qt)=>{let Zt=Yr(um(K.outDir,Qt.filePath)),tn=n(Yr(Qt.filePath)),en=K.resolvedPathByFilePath?.get(Qt.filePath),rn=en?void 0:K.crossFileResolvedPathByFilePath?.get(Qt.filePath),cn=en??rn,un=fm(Qt.moduleName,Vt),hn=rn?`${un}
|
|
232
|
-
${ki(JSON.stringify(Qt))}`:un,yn=cn?K.cache?.getGeneratedText(cn,hn):void 0;if(yn===void 0){if(yn=$r(Qt,Vt),cn)K.cache?.setGeneratedText(cn,hn,yn)}let zn=await mc(K.transform,yn,{kind:"component",component:Qt,filePath:tn});return Be.write(Zt,zn)}),Ht=(async()=>{let Qt=await mc(K.transform,Kt,{kind:"index",filePath:"index.d.ts"});return Be.write(be,`${Qt}
|
|
233
|
-
`)})(),zt=(await Promise.all([...Ut,Ht])).filter(Boolean).length,Yt=Ut.length+1,Jt=zt===0?`unchanged ${Yt}`:`created ${zt} of ${Yt}`;jn(`${Jt} TypeScript definitions in "${K.outDir}".`)}var ym=["reportDiagnostics","strict","check","checkLevel","stdout","format"],xm=50;function vm(V){let K=Promise.resolve();return()=>{K=K.then(V,V)}}function Bt(V){let K=V?.watch===!0,be,Be,Gt=V??{},Wt,Kt=null,Vt,Ut=new Set,zt=vm(async()=>{if(Kt==null||Be==null||Ut.size===0)return;let Jt=Array.from(Ut);Ut.clear();try{let{result:Qt}=await Kt.update(Jt);await R(Qt,Gt,Be),Qt.cache?.save()}catch(Qt){console.error("sveld: failed to regenerate types in watch mode:",Qt)}}),Yt=(Jt)=>{if(!K||Kt==null||!ya.test(Jt))return;Ut.add(Jt),clearTimeout(Vt),Vt=setTimeout(zt,xm)};return{name:"vite-plugin-sveld",apply:K?void 0:"build",enforce:"post",configResolved(Jt){Wt=Jt.root},async buildStart(){if(V?.config){let Qt=Wt??process.cwd(),Zt=typeof V.config==="string"?await Y(mm(V.config)?V.config:gm(Qt,V.config)):await j(Qt);Gt=N(Zt,V)}J(Gt);let Jt=ym.filter((Qt)=>(Qt in Gt));if(Jt.length>0)console.warn(`sveld: the Vite plugin ignores ${Jt.map((Qt)=>`"${Qt}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(q(Gt.quiet===!0),Be=Pi(Gt.entry),K&&Be!=null)try{Kt=await Kp(Be,Gt.glob===!0,C(Gt));let Qt=await Kt.result;await R(Qt,Gt,Be),Qt.cache?.save()}catch(Qt){console.error("sveld: failed to generate initial types in watch mode:",Qt)}},async generateBundle(){if(K)return;if(Be==null)this.error(Fs);be=await I(Be,Gt.glob===!0,C(Gt))},async writeBundle(){if(K)return;if(Be==null)this.error(Fs);await R(be,Gt,Be),be.cache?.save()},handleHotUpdate(Jt){Yt(Jt.file)},watchChange(Jt){Yt(Jt)}}}async function R(V,K,be){let Be=gc(be);if(K.types!==!1)await yo(V.allComponentsForTypes,{outDir:"types",preamble:"",...K.typesOptions,exports:V.exports,inputDir:Be,cache:V.cache,resolvedPathByFilePath:V.resolvedPathByFilePath,crossFileResolvedPathByFilePath:V.crossFileResolvedPathByFilePath});if(K.json)await to(V.components,{outFile:"COMPONENT_API.json",...K.jsonOptions,inputDir:Be,entryExports:V.entryExports});if(K.markdown)await go(V.components,{outFile:"COMPONENT_INDEX.md",...K.markdownOptions,entryExports:V.entryExports})}async function jt(V,K,be){if(K.json){let Be=eo(V.components,{...K.jsonOptions,inputDir:gc(be),entryExports:V.entryExports});process.stdout.write(Be);return}if(K.markdown){let Be=mo(V.components,{...K.markdownOptions,entryExports:V.entryExports});process.stdout.write(Be)}}import{dirname as Em}from"node:path";function $e(V){if(V.check&&!V.check.snapshotExists&&!V.writesSnapshot)return 1;if(V.check?.changes.some((K)=>K.kind==="schema"))return 1;if(V.errors.length>0)return 2;if(V.check&&wa(V.check.bump,V.checkLevel??"major"))return 3;if(wo(V.diagnostics,V.strict).length>0)return 4;return 0}async function Ft(V){if(V&&"input"in V)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:K,...be}=V??{},Be=await j(),Gt=Pi(K??Be.entry);if(Gt===null)throw Error(Fs);let Wt=N(Be,be,{entry:Gt});J(Wt),q(Wt.quiet===!0);let Kt=await I(Gt,Wt.glob===!0,C(Wt)),Vt=Wt.check?await B(Kt.components,xe(Wt),{entryExports:Kt.entryExports}):void 0;await R(Kt,Wt,Gt),Kt.cache?.save();let Ut=Wt.reportDiagnostics||Wt.strict,Ht=ie(Kt.diagnostics,Ut);if(Ut&&Ht.length>0)if(Wt.format==="json")process.stderr.write(oe(Ht));else console.error(se(Ht));let zt=$e({errors:Kt.errors,check:Vt,writesSnapshot:Vt?Te(Wt,Vt.snapshotFile):!1,checkLevel:Wt.checkLevel,diagnostics:Ht,strict:Wt.strict}),Yt=Zr(Kt.components,{inputDir:Em(Gt),entryExports:Kt.entryExports,source:Wt.jsonOptions?.source});return{diagnostics:Ht,check:Vt,errors:Kt.errors,document:Yt,exitCode:zt}}
|
|
234
|
-
export{x,ee,h,D,we,U,te,ve,W,T,p,a,i,je,P,t,k,l,g,H,Je,Ce,b,c,s,ne,A,re,o,ie,G,se,qe,oe,z,X,w,L,E,y,u,Q,ae,De,ce,Fe,Pe,pe,ue,m,S,r,le,fe,e,Ve,Ue,We,He,Ge,ze,Xe,Qe,Ye,Ze,Ae,Ke,et,_e,tt,nt,rt,it,Ne,Ie,st,Re,ot,at,v,ct,pt,ut,lt,ft,dt,mt,ht,gt,Le,yt,xt,Tt,Et,St,kt,de,bt,wt,vt,Oe,Ct,Dt,Pt,At,f,_t,Nt,It,me,he,O,Rt,Lt,M,ge,ye,_,n,Ot,d,Mt,xe,Te,B,Ee,$t,Se,qt,Y,j,N,J,Z,q,ke,F,C,I,Me,Bt,R,jt,$e,Ft};
|