eslint-plugin-sukka 6.10.0 → 6.11.0
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/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -29,4 +29,4 @@ ${r}}`))}(t,o,d))}}}({discriminant:d,ifStatements:f},s,a)),yield p}}}},meta:{typ
|
|
|
29
29
|
super();
|
|
30
30
|
this.name = '${e}';
|
|
31
31
|
}
|
|
32
|
-
`,a=e=>{if(!e.superClass)return!1;let{name:t,type:n,property:u}=e.superClass;return"MemberExpression"===n&&({name:t}=u),r.test(t)},i=e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&"Super"===e.expression.callee.type,o=(e,t)=>{if("ExpressionStatement"!==e.type||"AssignmentExpression"!==e.expression.type)return!1;let r=e.expression.left;return!!r.object&&"ThisExpression"===r.object.type&&r.property.name===t},s=(e,t)=>"PropertyDefinition"===e.type&&!e.computed&&"Identifier"===e.key.type&&e.key.name===t;function*d(e,t){if(!a(t)||null===t.id)return;let{name:r}=t.id,d=n(r);r!==d&&(yield{node:t.id,message:`Invalid class name, use \`${d}\`.`});let{body:l,range:c}=t.body,f=l.find(e=>"constructor"===e.kind);if(!f){yield{node:t,message:"Add a constructor to your error.",fix:e=>e.insertTextAfterRange([c[0],c[0]+1],u(r))};return}let p=f.value.body;if(!p)return;let h=p.body,m=h.find(e=>i(e)),g=h.findIndex(e=>o(e,"message"));if(m){if(-1!==g){let e=h[g];yield{node:m,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(t){if(0===m.expression.arguments.length){let r=e.expression.right;yield t.insertTextAfterRange([m.range[0],m.range[0]+6],r.raw||r.name)}yield t.removeRange([0===g?p.range[0]:h[g-1].range[1],e.range[1]])}}}}else yield{node:p,message:"Missing call to `super()` in constructor."};let y=h.find(e=>o(e,"name"));if(y)y.expression.right.value!==r&&(yield{node:y?.expression.right??p,message:`The \`name\` property should be set to \`${r}\`.`});else{let e=l.find(e=>s(e,"name"));e?.value&&e.value.value===r||(yield{node:e?.value??p,message:`The \`name\` property should be set to \`${r}\`.`})}}let l=(e,r)=>{let n=r.left.property.name,u=r.right;if("ClassExpression"!==u.type||!a(u)||!u.id)return;let i=u.id.name;if(n!==i)return{node:r.left.property,messageId:t,fix:e=>e.replaceText(r.left.property,i)}};return aJ={create:e=>{e.on("ClassDeclaration",t=>d(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return d(e,t.right)}),e.on("AssignmentExpression",t=>{if("MemberExpression"===t.left.type&&"Identifier"===t.left.object.type&&"exports"===t.left.object.name)return l(e,t)})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[t]:"Exported error name should match error class"}}}}()),lF=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a1)return a0;a1=1;let{isParenthesized:e,isNotSemicolonToken:t}=sp,{needsSemicolon:r}=/*@__PURE__*/sq(),{removeSpacesAfter:n}=/*@__PURE__*/s1(),u="no-lonely-if",a=e=>"IfStatement"===e.type&&!e.alternate,i=e=>"LogicalExpression"===e.type&&("||"===e.operator||"??"===e.operator)||"ConditionalExpression"===e.type||"AssignmentExpression"===e.type||"YieldExpression"===e.type||"SequenceExpression"===e.type;function o(e,t){let r={};r.ifToken=t.getFirstToken(e),r.openingParenthesisToken=t.getFirstToken(e,1);let{consequent:n}=e;return r.closingParenthesisToken=t.getTokenBefore(n),"BlockStatement"===n.type&&(r.openingBraceToken=t.getFirstToken(n),r.closingBraceToken=t.getLastToken(n)),r}return a0={create:s=>({IfStatement(d){var l;if(a(d)&&("BlockStatement"===d.parent.type&&1===d.parent.body.length&&d.parent.body[0]===d&&a(d.parent.parent)&&d.parent.parent.consequent===d.parent||a(d.parent)&&d.parent.consequent===d))return{node:d,messageId:u,fix:(l=s.sourceCode,function*(u){let a=("BlockStatement"===d.parent.type?d.parent:d).parent,s={...a,...o(a,l)},c={...d,...o(d,l)};if(yield u.remove(c.ifToken),yield n(c.ifToken,l,u),s.openingBraceToken){yield u.remove(s.openingBraceToken),yield n(s.openingBraceToken,l,u),yield u.remove(s.closingBraceToken);let e=l.getTokenBefore(s.closingBraceToken,{includeComments:!0});yield n(e,l,u)}for(let{test:t,openingParenthesisToken:r,closingParenthesisToken:a}of(yield u.insertTextBefore(s.openingParenthesisToken,"("),yield u.insertTextAfter(c.closingParenthesisToken,`)${"EmptyStatement"===c.consequent.type?"":" "}`),yield u.insertTextAfter(s.closingParenthesisToken," && "),[s,c]))(e(t,l)||!i(t))&&(yield u.remove(r),yield u.remove(a)),yield n(a,l,u);if("BlockStatement"!==c.consequent.type){let e=l.getLastToken(c.consequent);if(t(e)){let t=l.getTokenAfter(s);t&&r(e,l,t.value)&&(yield u.insertTextBefore(t,";"))}}})}}}),meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:!0},fixable:"code",messages:{[u]:"Unexpected `if` as the only statement in a `if` block without `else`."}}}}()),lO=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a3)return a2;a3=1;let{isMethodCall:e,isNumberLiteral:t}=/*@__PURE__*/sS(),{getCallExpressionTokens:r}=/*@__PURE__*/sq(),n="no-magic-array-flat-depth";return a2={create:u=>({CallExpression(a){if(!e(a,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[i]=a.arguments;if(!t(i)||1===i.value)return;let{sourceCode:o}=u,{openingParenthesisToken:s,closingParenthesisToken:d}=r(o,a);if(!o.commentsExistBetween(s,d))return{node:i,messageId:n}}}),meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:!0},messages:{[n]:"Magic number as depth is not allowed."}}}}()),lB=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a5)return a4;a5=1;let{removeParentheses:e,fixSpaceAroundKeyword:t,addParenthesizesToReturnOrThrowExpression:r}=/*@__PURE__*/s1(),{getParenthesizedRange:n,isParenthesized:u}=/*@__PURE__*/sm(),a=/*@__PURE__*/sN(),i=/*@__PURE__*/sR(),o="no-negated-condition";return a4={create:s=>{s.on(["IfStatement","ConditionalExpression"],d=>{if("IfStatement"===d.type&&(!d.alternate||"IfStatement"===d.alternate.type))return;let{test:l}=d;if(!(("UnaryExpression"!==l.type||"!"!==l.operator)&&("BinaryExpression"!==l.type||"!="!==l.operator&&"!=="!==l.operator)))return{node:l,messageId:o,*fix(o){let{sourceCode:c}=s;if(yield*function*(t,r,n){let{test:u}=r;if("UnaryExpression"===u.type){let a=n.getFirstToken(u);"IfStatement"===r.type&&(yield*e(u.argument,t,n)),yield t.remove(a);return}let a=n.getTokenAfter(u.left,e=>"Punctuator"===e.type&&e.value===u.operator);yield t.replaceText(a,"="+a.value.slice(1))}(o,d,c),yield*function*(e,t,r){let u="IfStatement"===t.type,[a,i]=[t.consequent,t.alternate].map(e=>{let t=n(e,r),a=r.text.slice(...t);return u&&"BlockStatement"!==e.type&&(a=`{${a}}`),{range:t,text:a}});a.text!==i.text&&(yield e.replaceTextRange(a.range,i.text),yield e.replaceTextRange(i.range,a.text))}(o,d,c),"ConditionalExpression"!==d.type||"UnaryExpression"!==l.type)return;yield*t(o,d,c);let{parent:f}=d,[p,h]=c.getFirstTokens(l,2);if(("ReturnStatement"===f.type||"ThrowStatement"===f.type)&&f.argument===d&&!a(p,h)&&!u(d,c)&&!u(l,c)){yield*r(o,f,c);return}i(c.getTokenBefore(d),c,h.value)&&(yield o.insertTextBefore(d,";"))}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:!0},fixable:"code",messages:{[o]:"Unexpected negated condition."}}}}()),lN=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a6)return a8;a6=1;let{isFunction:e}=/*@__PURE__*/sS(),t="identifier",r="non-identifier";return a8={create:()=>({AssignmentPattern(n){if(!("ObjectExpression"===n.right.type&&n.right.properties.length>0&&e(n.parent)&&n.parent.params.includes(n)))return;let{left:u,right:a}=n;return"Identifier"===u.type?{node:u,messageId:t,data:{parameter:u.name}}:{node:a,messageId:r}}}),meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:!0},messages:{[t]:"Do not use an object literal as default for parameter `{{parameter}}`.",[r]:"Do not use an object literal as default."}}}}()),lj=/*@__PURE__*/iA(/*@__PURE__*/function(){if(it)return ie;it=1;let{getNegativeIndexLengthNode:e,removeLengthNode:t}=/*@__PURE__*/function(){if(a7)return a9;a7=1;let e=/*@__PURE__*/sj(),{getParenthesizedRange:t}=/*@__PURE__*/sm(),{isNumberLiteral:r}=/*@__PURE__*/sS(),n=e=>"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.property.type&&"length"===e.property.name,u=e=>r(e)&&e.value>0;return a9={getNegativeIndexLengthNode:function t(r,a){if(!r)return;let{type:i,operator:o,left:s,right:d}=r;return"BinaryExpression"===i&&"-"===o&&u(d)?n(s)&&e(s.object,a)?s:t(s,a):void 0},removeLengthNode:function(e,r,n){let[u,a]=t(e,n);return r.removeRange([u,a+n.text.slice(a).match(/\S|$/).index])}}}(),r=/*@__PURE__*/dz(),{isLiteral:n}=/*@__PURE__*/sS(),u="prefer-negative-index",a=new Map([["slice",{argumentsIndexes:[0,1],supportObjects:new Set(["Array","String","ArrayBuffer",...r])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new Set(r)}],["splice",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new Set(["Array","String",...r])}],["with",{argumentsIndexes:[0],supportObjects:new Set(["Array",...r])}]]),i=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};return ie={create:r=>({CallExpression(o){if("MemberExpression"!==o.callee.type)return;let s=function(e){let{callee:t,arguments:r}=e,u=t.property.name,o=t.object,s=r;if(a.has(u))return{method:u,target:o,argumentsNodes:s};if("call"!==u&&"apply"!==u)return;let d="apply"===u;if(u=i(t.object),!a.has(u))return;let{supportObjects:l}=a.get(u),c=t.object.object;if("ArrayExpression"===c.type&&0===c.elements.length||"slice"===u&&n(c,"")||"prototype"===i(c)&&"Identifier"===c.object.type&&l.has(c.object.name)){if([o]=r,d){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;s=e.elements}else s=r.slice(1);return{method:u,target:o,argumentsNodes:s}}}(o);if(!s)return;let{method:d,target:l,argumentsNodes:c}=s,{argumentsIndexes:f}=a.get(d),p=f.map(t=>e(c[t],l)).filter(Boolean);if(0!==p.length)return{node:o,messageId:u,data:{method:d},*fix(e){let{sourceCode:n}=r;for(let r of p)yield t(r,e,n)}}}}),meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:!0},fixable:"code",messages:{[u]:"Prefer negative index over length minus index for `{{method}}`."}}}}()),lL=/*@__PURE__*/iC(iv),lR=/*@__PURE__*/iA(/*@__PURE__*/function(){if(is)return io;is=1;let e=function(){if(ii)return ia;ii=1;let e=new Set(function(){if(iu)return ir;iu=1;let{builtinModules:e}=lL,t=["sys"];return ir=(e||(process.binding?Object.keys(process.binding("natives")):[])||[]).filter(e=>!/^_|^(internal|v8|node-inspect)\/|\//.test(e)&&!t.includes(e)).sort()}()),t="node:";return ia=r=>{if("string"!=typeof r)throw TypeError("Expected a string");r.startsWith(t)&&(r=r.slice(t.length));let n=r.indexOf("/");return -1!==n&&n!==r.length-1&&(r=r.slice(0,n)),e.has(r)}}(),{replaceStringLiteral:t}=/*@__PURE__*/s1(),r=/*@__PURE__*/sv(),n="prefer-node-protocol";return io={create:()=>({Literal(u){if(!(("ImportDeclaration"===u.parent.type||"ExportNamedDeclaration"===u.parent.type||"ImportExpression"===u.parent.type)&&u.parent.source===u||r(u.parent)&&u.parent.arguments[0]===u))return;let{value:a}=u;if(!("string"!=typeof a||a.startsWith("node:")||/^bun(?::|$)/.test(a))&&e(a))return{node:u,messageId:n,data:{moduleName:a},fix:e=>t(e,u,"node:",0,0)}}}),meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:!0},fixable:"code",messages:{[n]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."}}}}());const lM=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),l$=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),lU=Symbol("rule-id-no-match");var lV=ip.createRule({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,t="allow-with-description")=>!1===t?{}:{Program(r){if(r.comments&&0!==r.comments.length)for(let n of r.comments){let r=function(e){let t=lM.exec(e);return t?.groups?.directive}(n.value);if(r&&!("allow-with-description"===t&&n.value.includes("--"))){let u="allow-with-description"===t?"require-description":"do-not-use";e.report({node:n,data:{directive:r},messageId:u})}let u=function(e){let t=l$.exec(e.trim());return t?t.groups?.ruleId:lU}(n.value);u===lU||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),lz=ip.createRule({name:"no-return-await",meta:{type:"suggestion",hasSuggestions:!0,docs:{description:"Disallows unnecessary `return await`"},fixable:void 0,deprecated:!1,schema:[],messages:{removeAwait:"Remove redundant `await`.",redundantUseOfAwait:"Redundant use of `await` on a return value."}},create:e=>({AwaitExpression(t){(function e(t){return t.parent?.type===ih.AST_NODE_TYPES.ArrowFunctionExpression||(t.parent?.type===ih.AST_NODE_TYPES.ReturnStatement?!lq(t.parent):(t.parent?.type===ih.AST_NODE_TYPES.ConditionalExpression&&(t===t.parent.consequent||t===t.parent.alternate)||t.parent?.type===ih.AST_NODE_TYPES.LogicalExpression&&t===t.parent.right||t.parent?.type===ih.AST_NODE_TYPES.SequenceExpression&&t===t.parent.expressions.at(-1))&&e(t.parent))})(t)&&!lq(t)&&e.report({node:e.sourceCode.getFirstToken(t),loc:t.loc,messageId:"redundantUseOfAwait",suggest:[{messageId:"removeAwait",fix(r){let n=e.sourceCode,[u,a]=n.getFirstTokens(t,2);if(u.loc.start.line!==a.loc.start.line)return null;let[i,o]=u.range,s=n.text[o];return r.removeRange([i,o+(" "===s?1:0)])}}]})}})});function lq(e){let t=e;for(;!ih.ASTUtils.isFunction(t)&&t.type!==ih.AST_NODE_TYPES.Program;){if(t.parent.type===ih.AST_NODE_TYPES.TryStatement&&(t===t.parent.block||t===t.parent.handler&&t.parent.finalizer))return!0;t=t.parent}return!1}function lW(e){return e.includes("\r\n")?"\r\n":"\n"}var lY=ip.createRule({name:"no-expression-empty-lines",meta:{messages:{unexpectedEmptyLine:"Unexpected empty line before"},docs:{description:"Disallows empty lines inside expressions."},fixable:"whitespace",type:"suggestion",schema:[]},create(e){let t=e.sourceCode.getText(),r=lW(t);return{MemberExpression(n){let u=n.object.range[1],a=lG(t.slice(u));if(a.includes("\n")){let t=r+((lG(a).split(/\r\n|\n/u).at(-1)??"")+a.trimStart());a!==t&&e.report({fix:()=>({range:[u,u+a.length],text:t}),messageId:"unexpectedEmptyLine",node:n.property})}}}}});function lG(e){return e.slice(0,e.length-e.trimStart().length)}var lZ=ip.createRule({name:"object-format",meta:{fixable:"whitespace",schema:[{type:"object",properties:{maxLineLength:{type:"number",default:80},maxObjectSize:{type:"number",default:3}},additionalProperties:!1}],docs:{description:"Requires multiline or single-line object format.",recommended:"stylistic"},messages:{preferMultiline:"Prefer multiline object literal",preferSingleLine:"Prefer single-line object literal"},type:"layout"},create(e,t={}){let r=e.sourceCode.getText(),n=t=>r.slice(Math.min(t.range[0],...e.sourceCode.getCommentsBefore(t).map(e=>e.range[0])),t.range[1]),u=lW(r),a=`,${u}`,{maxLineLength:i=80,maxObjectSize:o=3}=t,s=e=>r.slice(e.range[1]).trimStart().startsWith("//");return{ObjectExpression(t){let d=t.properties.map(e=>n(e).trim());if(d.length>0){let n=e.sourceCode.getText(t),l=d.length>o||d.some(lK)||t.properties.some(s),c=lK(n),f=!n.includes("\n");l&&f&&e.report({fix:()=>({range:t.range,text:`{${u}${d.join(a)}${u}}`}),messageId:"preferMultiline",node:t}),!l&&c&&function(){var n;let u=e.sourceCode.getLocFromIndex(t.range[0]).column;return u+d.reduce((e,t)=>e+t.length,0)+2*(d.length-1)+4+("number"==typeof(n=t.range[1])?r.slice(n):r.slice(...n.range)).split(/\r\n|\n/u)[0].replace(/^((?: as const)?\S*).*/u,"$1").length}()<=i&&e.report({fix:()=>({range:t.range,text:`{${d.join(",")}}`}),messageId:"preferSingleLine",node:t})}}}}});function lK(e){return e.includes("\n")}var lH=ip.createRule({name:"prefer-single-boolean-return",meta:{messages:{replaceIfThenElseByReturn:"Replace this if-then-else flow by a single return statement.",suggest:"Replace with single return statement",suggestCast:'Replace with single return statement using "!!" cast',suggestBoolean:"Replace with single return statement without cast (condition should be boolean!)"},schema:[],type:"suggestion",hasSuggestions:!0,docs:{description:'Return of boolean expressions should not be wrapped into an "if-then-else" statement',recommended:"recommended"}},create:e=>({IfStatement(t){t.parent.type!==ih.AST_NODE_TYPES.IfStatement&&lJ(t.consequent)&&function(e){if(e.alternate)return lJ(e.alternate);let{parent:t}=e;if(t.type===ih.AST_NODE_TYPES.BlockStatement){let r=t.body.indexOf(e);return lX(t.body[r+1])}return!1}(t)&&e.report({messageId:"replaceIfThenElseByReturn",node:t,suggest:function(t){var r,n;let u=e=>r=>{let n=`return ${e};`;if(t.alternate)return r.replaceText(t,n);let u=t.parent,a=u.body.indexOf(t),i=u.body[a+1],o=[t.range[0],i.range[1]];return r.replaceTextRange(o,n)},a=!1===((r=t.consequent).type===ih.AST_NODE_TYPES.BlockStatement?r.body[0]:r).argument.value,i=!(((n=t.test).type===ih.AST_NODE_TYPES.UnaryExpression||n.type===ih.AST_NODE_TYPES.BinaryExpression)&&["!","==","===","!=","!==","<","<=",">",">=","in","instanceof"].includes(n.operator)),o=e.sourceCode.getText(t.test);return a?[{messageId:"suggest",fix:u(`!(${o})`)}]:i?[{messageId:"suggestCast",fix:u(`!!(${o})`)},{messageId:"suggestBoolean",fix:u(o)}]:[{messageId:"suggest",fix:u(o)}]}(t)})}})});function lX(e){return e?.type===ih.AST_NODE_TYPES.ReturnStatement&&e.argument?.type===ih.AST_NODE_TYPES.Literal&&"boolean"==typeof e.argument.value}function lJ(e){return void 0!==e&&(e.type===ih.AST_NODE_TYPES.BlockStatement&&1===e.body.length&&lX(e.body[0])||lX(e))}var lQ=ip.createRule({name:"no-duplicated-branches",meta:{schema:[],type:"suggestion",docs:{description:"Two branches in a conditional structure should not have exactly the same implementation",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1871/javascript"},messages:{sameConditionalBlock:"This {{type}}'s code block is the same as the block for the {{type}} on line {{line}}."}},create(e){return{IfStatement(u){!function(u){if(u.parent.type===ih.AST_NODE_TYPES.IfStatement)return;let{branches:a,endsWithElse:i}=function(e){let t=[e.consequent],r=!1,n=e.alternate;for(;n;)if(n.type===ih.AST_NODE_TYPES.IfStatement)t.push(n.consequent),n=n.alternate;else{t.push(n),r=!0;break}return{branches:t,endsWithElse:r}}(u);if(r(a,i)){a.slice(1).forEach((e,t)=>n(e,a[t],"branch"));return}for(let r=1;r<a.length;r++)if(t([a[r]]))for(let t=0;t<r&&!function(t,r){let u=l1(t,r,e.sourceCode);return u&&"loc"in r&&n(t,r,"branch"),u}(a[r],a[t]);t++);}(u)},SwitchStatement(u){!function(u){let a;let{cases:i}=u,{endsWithDefault:o}=(a=!1,{branches:u.cases.filter((e,t)=>(e.test||(a=!0),t===u.cases.length-1||e.consequent.length>0)).map(e=>l2(e.consequent)),endsWithDefault:a}),s=i.filter(e=>l2(l0(e.consequent)).length>0);if(r(s.map(e=>l2(l0(e.consequent))),o)){s.slice(1).forEach((e,t)=>n(e,s[t],"case"));return}for(let r=1;r<i.length;r++){let u=l2(l0(i[r].consequent));if(t(u)){for(let t=0;t<r;t++)if(l1(u,l2(l0(i[t].consequent)),e.sourceCode)){n(i[r],i[t],"case");break}}}}(u)}};function t(t){if(t.length>0){let r=[...e.sourceCode.getTokens(t[0]),...e.sourceCode.getTokens(t[t.length-1])].filter(e=>"{"!==e.value&&"}"!==e.value);return r.length>0&&r[r.length-1].loc.end.line>r[0].loc.start.line}return!1}function r(t,r){return!r&&t.length>1&&t.slice(1).every((r,n)=>l1(r,t[n],e.sourceCode))}function n(t,r,n){let u=r.loc;e.report({messageId:"sameConditionalBlock",data:{type:n,line:String(u.start.line)},node:t})}}});function l0(e){if(1===e.length){let t=e[0];if(t.type===ih.AST_NODE_TYPES.BlockStatement)return t.body}return e}function l1(e,t,r){var n,u;return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>l1(e,t[n],r)):!(Array.isArray(e)||Array.isArray(t))&&e.type===t.type&&(n=r.getTokens(e),u=r.getTokens(t),n.length===u.length&&n.every((e,t)=>e.value===u[t].value))}function l2(e){return e.length>0&&e[e.length-1].type===ih.AST_NODE_TYPES.BreakStatement?e.slice(0,-1):e}var l3=ip.createRule({name:"comma-or-logical-or-case",meta:{type:"problem",docs:{description:"Comma and logical OR operators should not be used in switch cases",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S3616/javascript"},schema:[],messages:{specifyCase:'Explicitly specify {{nesting}} separate cases that fall through; currently this case clause only works for "{{expression}}".'}},create(e){function t(t,r,n){e.report({messageId:"specifyCase",data:{nesting:n.toString(),expression:String(r.type===ih.AST_NODE_TYPES.Literal?r.value:e.sourceCode.getText(r))},node:t})}return{"SwitchCase > SequenceExpression":function(e){let r=e.expressions;t(e,r[r.length-1],r.length)},"SwitchCase > LogicalExpression":function(r){var n;if(!((n=function(t){let r=e.sourceCode.getAncestors(t);for(let e=r.length-1;e>=0;e--)if(r[e].type===ih.AST_NODE_TYPES.SwitchStatement)return r[e];throw Error("A switch case should have an enclosing switch statement")}(r)).discriminant.type===ih.AST_NODE_TYPES.Literal&&!0===n.discriminant.value)){let e=function e(t,r){if("||"===t.operator)return t.left.type===ih.AST_NODE_TYPES.LogicalExpression?e(t.left,r+1):[t.left,r+1]}(r,0);e&&t(r,e[0],e[1]+1)}}}}});function l4(e,t,r){var n,u;return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>l4(e,t[n],r)):!(Array.isArray(e)||Array.isArray(t))&&e.type===t.type&&(n=r.getTokens(e),u=r.getTokens(t),n.length===u.length&&n.every((e,t)=>e.value===u[t].value))}ip.createRule({name:"no-all-duplicated-branches",meta:{messages:{removeOrEditConditionalStructure:"Remove this conditional structure or edit its code blocks so that they're not all the same.",returnsTheSameValue:'This conditional operation returns the same value whether the condition is "true" or "false".'},schema:[],type:"problem",docs:{description:"All branches in a conditional structure should not have exactly the same implementation",recommended:"recommended"}},create(e){return{IfStatement(r){if(r.parent?.type!==ih.AST_NODE_TYPES.IfStatement){let{branches:n,endsWithElse:u}=function(e){let t=[e.consequent],r=!1,n=e.alternate;for(;n;)if(n.type===ih.AST_NODE_TYPES.IfStatement)t.push(n.consequent),n=n.alternate;else{t.push(n),r=!0;break}return{branches:t,endsWithElse:r}}(r);u&&t(n)&&e.report({messageId:"removeOrEditConditionalStructure",node:r})}},SwitchStatement(r){let n;let{branches:u,endsWithDefault:a}=(n=!1,{branches:r.cases.filter((e,t)=>(e.test||(n=!0),t===r.cases.length-1||e.consequent.length>0)).map(e=>{var t;return(t=e.consequent).length>0&&t[t.length-1].type===ih.AST_NODE_TYPES.BreakStatement?t.slice(0,-1):t}),endsWithDefault:n});a&&t(u)&&e.report({messageId:"removeOrEditConditionalStructure",node:r})},ConditionalExpression(r){t([r.consequent,r.alternate])&&e.report({messageId:"returnsTheSameValue",node:r})}};function t(t){return t.length>1&&t.slice(1).every((r,n)=>l4(r,t[n],e.sourceCode))}}});var l5=ip.createRule({name:"no-element-overwrite",meta:{schema:[],type:"problem",docs:{description:"Collection elements should not be replaced unconditionally",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4143/javascript"},messages:{verifyIntendedIndex:'Verify this is the index that was intended; "{{index}}" was already set on line {{line}}.'}},create(e){return{SwitchCase(e){t(e.consequent)},BlockStatement(e){t(e.body)},Program(e){t(e.body.filter(e=>!(e&&(e.type===ih.AST_NODE_TYPES.ImportDeclaration||e.type===ih.AST_NODE_TYPES.ExportNamedDeclaration||e.type===ih.AST_NODE_TYPES.ExportDefaultDeclaration||e.type===ih.AST_NODE_TYPES.ExportAllDeclaration))))}};function t(t){let r;let n=new Map;t.forEach(t=>{let u=function(t){if(t.type===ih.AST_NODE_TYPES.ExpressionStatement)return function(t){if(t.type===ih.AST_NODE_TYPES.AssignmentExpression&&"="===t.operator&&t.left.type===ih.AST_NODE_TYPES.MemberExpression&&t.left.computed){let{left:r,right:n}=t,u=l6(r.property);if(void 0!==u&&!function(t,r){let n=e.sourceCode.getTokens(t),u=e.sourceCode.getTokens(r);return void 0!==u.find((e,t)=>{if(l8(e,n[0]))for(let e=t,r=0;e<u.length&&r<n.length;e++,r++)if(l8(u[e],n[r])){if(r===n.length-1)return!0}else break;return!1})}(r.object,n))return{collectionNode:r.object,indexOrKey:u,node:t}}}(t.expression)||function(e){if(e.type===ih.AST_NODE_TYPES.CallExpression&&e.callee.type===ih.AST_NODE_TYPES.MemberExpression){let t=e.callee;if(t.property.type===ih.AST_NODE_TYPES.Identifier){let r=t.property.name,n="add"===r&&1===e.arguments.length,u="set"===r&&2===e.arguments.length;if(n||u){let r=l6(e.arguments[0]);if(r)return{collectionNode:t.object,indexOrKey:r,node:e}}}}}(t.expression)}(t);if(u){r&&!l4(u.collectionNode,r,e.sourceCode)&&n.clear();let t=n.get(u.indexOrKey);t?.node.loc&&e.report({node:u.node,messageId:"verifyIntendedIndex",data:{index:u.indexOrKey,line:t.node.loc.start.line}}),n.set(u.indexOrKey,u),r=u.collectionNode}else n.clear()})}}});function l8(e,t){return e.value===t.value}function l6(e){if(e.type===ih.AST_NODE_TYPES.Literal){let{value:t}=e;return"number"==typeof t||"string"==typeof t?String(t):void 0}if(e.type===ih.AST_NODE_TYPES.Identifier)return e.name}var l9=ip.createRule({name:"class-prototype",meta:{schema:[],type:"suggestion",docs:{description:'Class methods should be used instead of "prototype" assignments',recommended:"recommended"},messages:{declareClass:'Declare a "{{class}}" class and move this declaration of "{{declaration}}" into it.'}},create(e){let t=e.sourceCode.parserServices,r=ip.isParserWithTypeInformation(t)?l7:ct;return{AssignmentExpression({left:n,right:u}){if(n.type===ih.AST_NODE_TYPES.MemberExpression&&r(u,t)){let[t,r]=[n.object,n.property];if(t.type===ih.AST_NODE_TYPES.MemberExpression&&r.type===ih.AST_NODE_TYPES.Identifier){let[u,a]=[t.object,t.property];u.type===ih.AST_NODE_TYPES.Identifier&&a.type===ih.AST_NODE_TYPES.Identifier&&"prototype"===a.name&&e.report({messageId:"declareClass",data:{class:u.name,declaration:r.name},node:n})}}}}}});function l7(e,t){ip.ensureParserWithTypeInformation(t);let r=t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e));return!!r.symbol&&(r.symbol.flags&im.SymbolFlags.Function)!=0}const ce=new Set(["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]);function ct(e,t){return ce.has(e.type)}var cr=ip.createRule({name:"bool-param-default",meta:{schema:[],type:"suggestion",docs:{description:"Optional boolean parameters should have default value"},messages:{provideDefault:"Provide a default value for '{{parameter}}' so that the logic of the function is more evident when this parameter is missing. Consider defining another function if providing default value is not possible."}},create:e=>({"FunctionDeclaration, FunctionExpression, ArrowFunctionExpression":t=>{for(let r of t.params)r.type===ih.AST_NODE_TYPES.Identifier&&function(e){return!!e.optional&&!!e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ih.AST_NODE_TYPES.TSBooleanKeyword||function(e){if(e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ih.AST_NODE_TYPES.TSUnionType){let t=e.typeAnnotation.typeAnnotation.types;return 2===t.length&&t.some(e=>e.type===ih.AST_NODE_TYPES.TSBooleanKeyword)&&t.some(e=>e.type===ih.AST_NODE_TYPES.TSUndefinedKeyword)}return!1}(e)}(r)&&e.report({messageId:"provideDefault",data:{parameter:r.name},node:r})}})}),cn=ip.createRule({name:"call-argument-line",meta:{type:"suggestion",docs:{description:"Function call arguments should not start on new lines",recommended:"recommended"},schema:[],messages:{moveArguments:"Make those call arguments start on line {{line}}.",moveTemplateLiteral:"Make this template literal start on line {{line}}."}},create(e){let t=e.sourceCode;return{CallExpression(r){if(r.callee.type!==ih.AST_NODE_TYPES.CallExpression&&1===r.arguments.length){let n=r.typeArguments??r.callee,u=(t.getLastTokenBetween(n,r.arguments[0],cu)??t.getLastToken(n)).loc.end.line,{start:a}=t.getTokenAfter(n,ca).loc;if(u!==a.line){let{end:n}=t.getLastToken(r).loc;n.line===a.line?e.report({messageId:"moveArguments",data:{line:u.toString()},loc:{start:a,end:n}}):e.report({messageId:"moveArguments",data:{line:u.toString()},loc:a})}}},TaggedTemplateExpression(r){let{quasi:n}=r,u=t.getTokenBefore(n);if(u&&n.loc&&u.loc.end.line!==n.loc.start.line){let t={start:n.loc.start,end:{line:n.loc.start.line,column:n.loc.start.column+1}};e.report({messageId:"moveTemplateLiteral",data:{line:u.loc.start.line.toString()},loc:t})}}}}});function cu(e){return e.type===ih.AST_TOKEN_TYPES.Punctuator&&")"===e.value}function ca(e){return!cu(e)}var ci=ip.createRule({name:"track-todo-fixme-comment",meta:{type:"suggestion",docs:{description:'Track uses of "FIXME" and "TODO" tags',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1134/javascript"},schema:[],messages:{fixme:"Take the required action to fix the issue indicated by this comment.",todo:'Complete the task associated to this "TODO" comment.'}},create(e){function t(t,r){e.sourceCode.getAllComments().forEach(n=>{let u=n.value.toLowerCase();if(u.includes(t)){let a=u.split(/\r\n?|\n/);for(let u=0;u<a.length;u++){let i=a[u].indexOf(t);i>=0&&!function(e,t,r){let n=t+r.length,u=t>0&&co.test(e.charAt(t-1)),a=n<=e.length-1&&co.test(e.charAt(n));return u||a}(a[u],i,t)&&e.report({messageId:r,loc:function(e,t,r,n){let u=r.loc.start.line+e,a=(0===e?r.loc.start.column+2:0)+t;return{start:{line:u,column:a},end:{line:u,column:a+n.length}}}(u,i,n,t)})}}})}return{"Program:exit":()=>{t("fixme","fixme"),t("todo","todo")}}}});const co=RegExp("\\p{Letter}","u"),cs=["Array","Map","Set","WeakSet","WeakMap"],cd=new Set(["copyWithin","pop","reverse","shift","sort","clear","delete","concat","flat","flatMap","includes","indexOf","join","lastIndexOf","slice","toSource","toString","toLocaleString","get","has","entries","every","filter","find","findIndex","forEach","keys","map","reduce","reduceRight","some","values"]);var cl=ip.createRule({name:"no-empty-collection",meta:{schema:[],type:"problem",docs:{description:"Empty collections should not be accessed or iterated",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4158/javascript"},messages:{reviewUsageOfIdentifier:'Review this usage of "{{identifierName}}" as it can only be empty here.'}},create(e){let t=t=>{if(t.references.length<=1||t.defs.some(e=>e.type===ih.TSESLint.Scope.DefinitionType.Parameter||e.type===ih.TSESLint.Scope.DefinitionType.ImportBinding))return;let r=[],n=!1;for(let e of t.references)if(e.isWriteOnly()){if(!function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.VariableDeclarator||e.type===ih.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ih.AST_NODE_TYPES.VariableDeclarator&&t.init)return ch(t.init);if(t.type===ih.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ih.AST_NODE_TYPES.AssignmentExpression&&cp(e,r.left)&&ch(r.right)}}return!1}(e))return;n=!0}else{if(!(function(e){let{parent:t}=e.identifier;if(t&&t.type===ih.AST_NODE_TYPES.MemberExpression){let e=t.parent;if(e&&e.type===ih.AST_NODE_TYPES.CallExpression)return cm(t.property,...cd)}return!1}(e)||function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.ForOfStatement||e.type===ih.AST_NODE_TYPES.ForInStatement);return t&&t.right===e.identifier}(e)||function(e){let{parent:t}=e.identifier;return t&&t.type===ih.AST_NODE_TYPES.MemberExpression&&t.computed&&!function(e){let t=cf(e,new Set),r=t.find(e=>e.type===ih.AST_NODE_TYPES.AssignmentExpression);return!!r&&"="===r.operator&&[e,...t].includes(r.left)}(t)}(e)))return;r.push(e)}n&&r.forEach(t=>{e.report({messageId:"reviewUsageOfIdentifier",data:{identifierName:t.identifier.name},node:t.identifier})})},r=e=>{e.type!==ih.TSESLint.Scope.ScopeType.global&&e.variables.forEach(t),e.childScopes.forEach(r)};return{"Program:exit":t=>{r(e.sourceCode.getScope(t))}}}});function cc(e,t){return cf(e,new Set).find(t)}function cf(e,t){let r=[],n=e.parent;for(;n&&(r.push(n),!t.has(n.type));)n=n.parent;return r}function cp(e,t){return t.type===ih.AST_NODE_TYPES.Identifier&&t===e.identifier}function ch(e){return e&&e.type===ih.AST_NODE_TYPES.ArrayExpression?0===e.elements.length:!!e&&(e.type===ih.AST_NODE_TYPES.CallExpression||e.type===ih.AST_NODE_TYPES.NewExpression)&&cm(e.callee,...cs)&&0===e.arguments.length}function cm(e,...t){return e?.type===ih.AST_NODE_TYPES.Identifier&&(0===t.length||t.some(t=>t===e.name))}const cg=new Set(["!=","==","!==","==="]),cy=new Set(["!==","!="]),cb=new Set(["+=","-="]);var cE=ip.createRule({name:"no-equals-in-for-termination",meta:{schema:[],messages:{replaceOperator:"Replace '{{operator}}' operator with one of '<=', '>=', '<', or '>' comparison operators."},type:"suggestion",docs:{description:'Equality operators should not be used in "for" loop termination conditions',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S888/javascript"}},create(e){function t(t,r){if(t.type===ih.AST_NODE_TYPES.Identifier){var n;let u=(n=t.name,function(e,t){let r;for(;null==r&&null!=e;)r=e.variables.find(e=>e.name===t),e=e.upper;return r}(e.sourceCode.getScope(t),n)),a=r.range;if(u&&a)return u.references.some(e=>{var t;return(t=e.identifier).range&&t.range[0]>a[0]&&t.range[1]<a[1]})}return!1}return{ForStatement(r){if(!r.test||!r.update)return;let n=r.test;n.type===ih.AST_NODE_TYPES.BinaryExpression&&cg.has(n.operator)&&function e(t){return!!cv(t)||t.type===ih.AST_NODE_TYPES.UpdateExpression||t.type===ih.AST_NODE_TYPES.SequenceExpression&&t.expressions.every(e)}(r.update)&&!(function(e){let t=e.test,r=[];return function e(t,r){let n;cv(t)?n=t.left:t.type===ih.AST_NODE_TYPES.UpdateExpression?n=t.argument:t.type===ih.AST_NODE_TYPES.SequenceExpression&&t.expressions.forEach(t=>e(t,r)),n&&n.type===ih.AST_NODE_TYPES.Identifier&&r.push(n.name)}(e.update,r),t.left.type!==ih.AST_NODE_TYPES.Identifier||!r.includes(t.left.name)}(r)||function(e){let r=e.init,n=e.test;if(r&&cx(n)){let u=function(e,r){if(e.type===ih.AST_NODE_TYPES.UpdateExpression&&!t(e.argument,r)||function(e){if(cv(e)){let t=e.right;return t.type===ih.AST_NODE_TYPES.Literal&&1===t.value}return!1}(e)&&!t(e.left,r)){if("++"===e.operator||"+="===e.operator)return 1;if("--"===e.operator||"-="===e.operator)return -1}return 0}(e.update,e.body);if(0!==u){let e=cS(r),t=cS(n);return void 0!==e&&void 0!==t&&u===Math.sign(t-e)}}return!1}(r))&&e.report({messageId:"replaceOperator",data:{operator:n.operator},node:n})}}}});function cv(e){return e.type===ih.AST_NODE_TYPES.AssignmentExpression&&cb.has(e.operator)}function cx(e){return e.type===ih.AST_NODE_TYPES.BinaryExpression&&cy.has(e.operator)}function cS(e){return cx(e)?cA(e.right):e.type===ih.AST_NODE_TYPES.VariableDeclaration&&1===e.declarations.length?cA(e.declarations[0].init):e.type===ih.AST_NODE_TYPES.AssignmentExpression?cA(e.right):void 0}function cA(e){if(e&&e.type===ih.AST_NODE_TYPES.Literal&&"number"==typeof e.value)return e.value}var cC=ip.createRule({name:"no-top-level-this",meta:{hasSuggestions:!0,schema:[],messages:{removeThis:'Remove the use of "this".',suggestRemoveThis:'Remove "this"',suggestUseGlobalThis:'Replace "this" with "globalThis" object'},type:"suggestion",docs:{description:'The global "this" object should not be used',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S2990/javascript"},fixable:"code"},create:e=>({'MemberExpression[object.type="ThisExpression"]':t=>{let r=e.sourceCode.getScope(t).variableScope.type,n=e.sourceCode.getAncestors(t).some(e=>e.type===ih.AST_NODE_TYPES.ClassDeclaration||e.type===ih.AST_NODE_TYPES.ClassExpression);if((r===ih.TSESLint.Scope.ScopeType.global||r===ih.TSESLint.Scope.ScopeType.module)&&!n){let r=[];if(!t.computed){let n=e.sourceCode.getText(t.property);r.push({messageId:"suggestRemoveThis",fix:e=>e.replaceText(t,n)},{messageId:"suggestUseGlobalThis",fix:e=>e.replaceText(t.object,"globalThis")})}e.report({messageId:"removeThis",node:t.object,suggest:r})}}})}),c_=ip.createRule({name:"no-invariant-returns",meta:{schema:[],type:"suggestion",docs:{description:"Function returns should not be invariant",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S3516/javascript",requiresTypeChecking:!1},messages:{refactorReturn:"Refactor this function to only return once or not always return the same value."}},create(e){let t=[],r=[],n=[],u=r=>(function(t,r){!(!r||n.some(e=>e.reachable)||r.containsReturnWithoutValue||r.returnStatements.length<=1||r.codePath.thrownSegments.length>0)&&function(e,t){let r=e[0],n=r?cT(r,t):void 0;if(void 0!==n)return e.slice(1).every(e=>cT(e,t)===n);if(r?.type===ih.AST_NODE_TYPES.Identifier){let n=cD(r.name,t);if(n){let t=new Set(n.variable.references.slice(1).map(e=>e.identifier));return e.every(e=>t.has(e))}}return!1}(r.returnStatements.map(e=>e.argument),e.sourceCode.getScope(t))&&e.report({messageId:"refactorReturn",node:t})})(r,t[t.length-1]);return{onCodePathStart(e){t.push({codePath:e,containsReturnWithoutValue:!1,returnStatements:[]}),r.push(n),n=[]},onCodePathEnd(){t.pop(),n=r.pop()||[]},onCodePathSegmentStart(e){n.push(e)},onCodePathSegmentEnd(){n.pop()},ReturnStatement(e){if(t.length){let r=t[t.length-1];r.containsReturnWithoutValue=r.containsReturnWithoutValue||!e.argument,r.returnStatements.push(e)}},"FunctionDeclaration:exit":u,"FunctionExpression:exit":u,"ArrowFunctionExpression:exit":u}}});function cD(e,t){let r=t.set.get(e);if(r&&!r.references.slice(1).some(e=>e.isWrite()||function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.ExpressionStatement||ce.has(e.type));return t&&t.type===ih.AST_NODE_TYPES.ExpressionStatement&&(cw(t,e)||t.expression.type===ih.AST_NODE_TYPES.CallExpression)}(e))){let e=null;return 1===r.defs.length&&r.defs[0].type===ih.TSESLint.Scope.DefinitionType.Variable&&(e=r.defs[0].node.init),{variable:r,initExpression:e}}return null}function cw(e,t,r=!0){return e.expression.type===ih.AST_NODE_TYPES.AssignmentExpression&&function e(t,r,n=!0){return t.type===ih.AST_NODE_TYPES.MemberExpression&&(cp(r,t.object)||n&&e(t.object,r,n))}(e.expression.left,t,r)}function cT(e,t){if(e){if(e.type===ih.AST_NODE_TYPES.Literal)return e.value;if(e.type===ih.AST_NODE_TYPES.UnaryExpression){let r=cT(e.argument,t);return void 0===r?void 0:function(e,t){switch(e){case"-":return-Number(t);case"+":return Number(t);case"~":return~Number(t);case"!":return!t;case"typeof":return typeof t}}(e.operator,r)}if(e.type===ih.AST_NODE_TYPES.Identifier){let r=cD(e.name,t);if(r?.initExpression)return cT(r.initExpression,t)}}}function cP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ck(e,t){let r=t.variables.find(t=>t.name===e.name);return!r&&t.upper&&(r=t.upper.variables.find(t=>t.name===e.name)),r}class cI extends Set{constructor(...e){super(...e),cP(this,"type","AssignedValues")}}const cF=e=>new cI([e]),cO={type:"UnknownValue"};class cB{add(e){e.resolved&&this.references.add(e)}propagate(e){this.in.clear(),this.segment.prevSegments.forEach(t=>{this.join(e.get(t.id).out)});let t=new Map;return this.references.forEach(e=>this.updateProgramState(e,t)),!function(e,t){if(e.size!==t.size)return!1;for(let[n,u]of e){var r;if(!t.has(n)||("AssignedValues"===(r=t.get(n)).type&&"AssignedValues"===u.type?!function(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}(r,u):r!==u))return!1}return!0}(this.out,t)&&(this.out=t,!0)}updateProgramState(e,t){let r=e.resolved;if(!r||!e.isWrite())return;if(!e.writeExpr){t.set(r,cO);return}let n=cN(r,e.writeExpr,t,e.from);t.set(r,n)}join(e){for(let[t,r]of e.entries()){let e=this.in.get(t)??new cI;"AssignedValues"===e.type&&"AssignedValues"===r.type?(r.forEach(t=>e.add(t)),this.in.set(t,e)):this.in.set(t,cO)}}constructor(e){cP(this,"segment",void 0),cP(this,"in",void 0),cP(this,"out",void 0),cP(this,"references",void 0),this.segment=e,this.in=new Map,this.out=new Map,this.references=new Set}}function cN(e,t,r,n){if(!t)return cO;switch(t.type){case ih.AST_NODE_TYPES.Literal:return t.raw?cF(t.raw):cO;case ih.AST_NODE_TYPES.Identifier:{let u=ck(t,n);if(u&&u!==e)return r.get(u)??cO;return cO}default:return cO}}class cj{constructor(e){cP(this,"codePath",void 0),cP(this,"reachingDefinitionsMap",void 0),cP(this,"reachingDefinitionsStack",void 0),cP(this,"segments",void 0),cP(this,"assignmentStack",void 0),this.codePath=e,this.reachingDefinitionsMap=new Map,this.reachingDefinitionsStack=[],this.segments=new Map,this.assignmentStack=[]}}class cL{isRhs(e){return this.node.type===ih.AST_NODE_TYPES.AssignmentExpression?this.node.right===e:this.node.init===e}isLhs(e){return this.node.type===ih.AST_NODE_TYPES.AssignmentExpression?this.node.left===e:this.node.id===e}add(e){let t=e.identifier;for(;t;){if(this.isLhs(t)){this.lhs.add(e);break}if(this.isRhs(t)){this.rhs.add(e);break}t=t.parent}}constructor(e){cP(this,"node",void 0),cP(this,"lhs",void 0),cP(this,"rhs",void 0),this.node=e,this.lhs=new Set,this.rhs=new Set}}function cR(e){return e[e.length-1]}var cM=ip.createRule({name:"no-redundant-assignments",meta:{schema:[],type:"suggestion",docs:{description:"Assignments should not be redundant",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4165/javascript"},messages:{reviewAssignment:'Review this redundant assignment: "{{symbol}}" already holds the assigned value along all execution paths.'}},create(e){let t=[],r=new Map,n=new Map,u=[],a=[];return{AssignmentExpression:o,"VariableDeclarator[init]":o,"AssignmentExpression:exit":i,"VariableDeclarator[init]:exit":i,Identifier(r){!(r.parent.type===ih.AST_NODE_TYPES.TSEnumBody||r.parent.type===ih.AST_NODE_TYPES.TSEnumDeclaration||r.parent.type===ih.AST_NODE_TYPES.TSEnumMember||e.sourceCode.getAncestors(r).some(e=>e.type===ih.AST_NODE_TYPES.TSEnumDeclaration))&&!function(r){let{ref:u,variable:a}=function e(t,r){if(null===r)return{ref:null,variable:null};let n=r.references.find(e=>e.identifier===t);if(n)return{ref:n,variable:n.resolved};let u=r.variables.find(e=>e.defs.find(e=>e.name===t));return u?{ref:null,variable:u}:e(t,r.upper)}(r,e.sourceCode.getScope(r));if(u&&d(u),a){let e=cR(t).codePath.id;n.has(a)?n.get(a).add(e):n.set(a,new Set([e]))}}(r)},"Program:exit":()=>{!function(e){let t=Array.from(e.values(),e=>e.segment);for(;t.length;){let r=t.pop();e.get(r.id).propagate(e)&&r.nextSegments.forEach(e=>t.push(e))}}(r),r.forEach(s),r.clear(),n.clear(),t.length=0},onCodePathSegmentStart(e){r.set(e.id,new cB(e)),a.push(e)},onCodePathStart(e){var r;r=new cj(e),t.push(r),u.push(a),a.length=0},onCodePathEnd(){t.pop(),u.pop()||(a.length=0)},onCodePathSegmentEnd(){a.pop()}};function i(){let e=cR(t).assignmentStack.pop();e.rhs.forEach(d),e.lhs.forEach(d)}function o(e){cR(t).assignmentStack.push(new cL(e))}function s(t){let r=new Map(t.in);t.references.forEach(t=>{let u=t.resolved;if(!u||!t.isWrite()||!function(e){let t=e.resolved;return t&&!(e.identifier.type===ih.AST_NODE_TYPES.Identifier&&e.identifier.parent?.type===ih.AST_NODE_TYPES.AssignmentPattern)&&!t.name.startsWith("_")&&!function(e){if(e?.parent){let t=e.parent;return t&&t.type===ih.AST_NODE_TYPES.AssignmentExpression&&"="!==t.operator}return!1}(e.writeExpr)&&(e.writeExpr?.type!==ih.AST_NODE_TYPES.Identifier||e.resolved!==ck(e.writeExpr,e.from))&&!t.defs.some(e=>e.type===ih.TSESLint.Scope.DefinitionType.Parameter||e.type===ih.TSESLint.Scope.DefinitionType.Variable&&!e.node.init)&&!(n.get(t).size>1)}(t))return;let a=r.get(u),i=cN(u,t.writeExpr,r,t.from);if(a?.type==="AssignedValues"&&1===a.size){let[r]=[...a];!function({resolved:t},r,n,u,a){if("UnknownValue"===u.type||1!==u.size)return;let[i]=[...u];1===t.references.filter(e=>e.isWrite()).length||n!==i||e.report({node:r,messageId:"reviewAssignment",data:{symbol:a}})}(t,t.writeExpr,r,i,u.name)}r.set(u,i)})}function d(e){let{assignmentStack:n}=cR(t);if(n.length>0)cR(n).add(e);else for(let t=0,n=a.length;t<n;t++)(function(e){let t;return r.has(e.id)?t=r.get(e.id):(t=new cB(e),r.set(e.id,t)),t})(a[t]).add(e)}}}),c$=ip.createRule({name:"no-same-line-conditional",meta:{schema:[],type:"layout",docs:{description:"Conditionals should start on new lines",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S3972/javascript"},fixable:"whitespace",messages:{sameLineCondition:'Move this "if" to a new line or add the missing "else".'}},create(e){function t(t){let{sourceCode:r}=e;t.reduce((e,r,n)=>{let u=t[n-1];return r.type===ih.AST_NODE_TYPES.IfStatement&&u&&u.type===ih.AST_NODE_TYPES.IfStatement?[{first:u,following:r},...e]:e},[]).forEach(t=>{let n=t.first,u=t.following;if(n.loc&&u.loc&&n.loc.end.line===u.loc.start.line&&n.loc.start.line!==u.loc.end.line){let t=r.getFirstToken(u);e.report({messageId:"sameLineCondition",loc:t.loc,fix:e=>e.replaceTextRange([n.range[1],u.range[0]],"\n"+" ".repeat(n.loc.start.column))})}})}return{Program:e=>t(e.body),BlockStatement:e=>t(e.body),SwitchCase:e=>t(e.consequent)}}}),cU=ip.createRule({name:"no-small-switch",meta:{schema:[],messages:{replaceSwitch:'Replace this "switch" statement by "if" statements to increase readability.'},type:"suggestion",docs:{description:'"if" statements should be preferred over "switch" when simpler',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1301/javascript"}},create:e=>({SwitchStatement(t){let{cases:r}=t,n=r.some(e=>!e.test);if(r.length<2||2===r.length&&n){let r=e.sourceCode.getFirstToken(t);r&&e.report({messageId:"replaceSwitch",loc:r.loc})}}})});const cV=["Array","Map","Set","WeakSet","WeakMap"],cz=["copyWithin","fill","pop","push","reverse","set","shift","sort","splice","unshift","add","clear","delete"];var cq=ip.createRule({name:"no-unused-collection",meta:{schema:[],messages:{unusedCollection:"Either use this collection's contents or remove the collection."},type:"suggestion",docs:{description:"Collection contents should be used",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4030/javascript",requiresTypeChecking:!1}},create:e=>({"Program:exit":t=>{let r=[];(function e(t,r){t.type!==ih.TSESLint.Scope.ScopeType.global&&t.variables.filter(cW).forEach(e=>{r.push(e)}),t.childScopes.forEach(t=>{e(t,r)})})(e.sourceCode.getScope(t),r),r.forEach(t=>{e.report({messageId:"unusedCollection",node:t.identifiers[0]})})}})});function cW(e){if(function(e){if(!e.defs.length)return;let t=e.defs[0];return t.node.parent?.parent?.type.startsWith("Export")}(e)||e.references.length<=1)return!1;let t=!1;for(let r of e.references)if(r.isWriteOnly()){if(!function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.VariableDeclarator||e.type===ih.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ih.AST_NODE_TYPES.VariableDeclarator&&t.init)return cY(t.init);if(t.type===ih.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ih.AST_NODE_TYPES.AssignmentExpression&&cp(e,r.left)&&cY(r.right)}}return!1}(r))return!1;t=!0}else if(function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.ExpressionStatement);return!t||!(cw(t,e,!1)||function(e,t){if(e.expression.type===ih.AST_NODE_TYPES.CallExpression){let{callee:r}=e.expression;if(r.type===ih.AST_NODE_TYPES.MemberExpression){let{property:e,object:n}=r;return cp(t,n)&&cm(e,...cz)}}return!1}(t,e))}(r))return!1;return t}function cY(e){return!!e&&e.type===ih.AST_NODE_TYPES.ArrayExpression||!!e&&(e.type===ih.AST_NODE_TYPES.CallExpression||e.type===ih.AST_NODE_TYPES.NewExpression)&&cm(e.callee,...cV)}var cG=ip.createRule({name:"no-useless-plusplus",meta:{schema:[],type:"problem",docs:{description:"Values should not be uselessly incremented",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S2123/javascript"},messages:{removeIncrement:"Remove this {{updateOperator}}rement or correct the code not to waste it."}},create(e){function t(t){let r="++"===t.operator?"inc":"dec";e.report({messageId:"removeIncrement",data:{updateOperator:r},node:t})}return{"ReturnStatement > UpdateExpression":function(r){let n=r.argument;!r.prefix&&n.type===ih.AST_NODE_TYPES.Identifier&&e.sourceCode.getScope(r).variables.some(e=>e.identifiers.some(e=>e.name===n.name))&&t(r)},AssignmentExpression(e){let r=e.right;if(r.type===ih.AST_NODE_TYPES.UpdateExpression&&!r.prefix){let n=e.left;n.type===ih.AST_NODE_TYPES.Identifier&&r.argument.type===ih.AST_NODE_TYPES.Identifier&&r.argument.name===n.name&&t(r)}}}}});function cZ(e){return!(e<48)&&(e<58||!(e<65)&&(e<91||95===e||!(e<97)&&(e<123||cK(e)||cH(e,null!=t?t:t=cX("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 0 21 a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 2 h 2 6 b 1 3 9 i 2 1l 0 2 6 3 1 3 2 a 0 b 1 3 9 f 0 3 2 1l 0 2 4 5 1 3 2 4 0 l b 4 0 c 2 1l 0 2 7 2 2 2 2 l 1 3 9 b 5 2 2 1l 0 2 6 3 1 3 2 8 2 b 1 3 9 j 0 1o 4 4 2 2 3 a 0 f 9 h 4 1k 0 2 6 2 2 2 3 8 1 c 1 3 9 i 2 1l 0 2 6 2 2 2 3 8 1 c 1 3 9 4 0 d 3 1k 1 2 6 2 2 2 3 a 0 b 1 3 9 i 2 1z 0 5 5 2 0 2 7 7 9 3 1 1q 0 3 6 d 7 2 9 2g 0 3 8 c 6 2 9 1r 1 7 9 c 0 2 0 2 0 5 1 1e j 2 1 6 a 2 z a 0 2t j 2 9 d 3 5 2 2 2 3 6 4 3 e b 2 e jk 2 a 8 pt 3 t 2 u 1 v 1 1t v a 0 3 9 y 2 2 a 40 0 3b b 5 b b 9 3l a 1p 4 1m 9 2 s 3 a 7 9 n d 2 f 1e 4 1c g c 9 i 8 d 2 v c 3 9 19 d 1d j 9 9 7 9 3b 2 2 k 5 0 7 0 3 2 5j 1r el 1 1e 1 k 0 3g c 5 0 4 b 2db 2 3y 0 2p v ff 5 2y 1 2p 0 n51 9 1y 0 5 9 x 1 29 1 7l 0 4 0 5 0 o 4 5 0 2c 1 1f h b 9 7 h e a t 7 q c 19 3 1c d g 9 c 0 b 9 1c d d 0 9 1 3 9 y 2 1f 0 2 2 3 1 6 1 2 0 16 4 6 1 6l 7 2 1 3 9 fmt 0 ki f h f 4 1 p 2 5d 9 12 0 12 0 ig 0 6b 0 46 4 86 9 120 2 2 1 6 3 15 2 5 0 4m 1 fy 3 9 9 7 9 w 4 8u 1 28 3 1z a 1e 3 3f 2 1i e w a 3 1 b 3 1a a 8 0 1a 9 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 3 0 4e b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 1w 8 2 0 3 0 2 3 2 4 2 0 f 1 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f 9j 9 1i 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 96 3 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 k6 6 32 6 6 9 3o7 9 gvt3 6n")))))}function cK(t){return cH(t,null!=e?e:e=cX("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 3 0 7 14 20 q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 6 n 2 5 i 15 1n 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 3 0 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 w 1 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 h c 2u 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 1u 3 1 2 0 2 7 m f 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 7 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 1z 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 2 1o s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 5k w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 94 i g 0 2 c 2 x 3h 0 28 pl 2v 32 i 5f 219 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r 3l 22 6 0 1v c 1t 1 2 0 t 4qf 9 yd 16 9 6w8 3 2 6 2 1 2 82 g 0 u 2 3 0 f 3 9 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9f 3 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1f9 u 7 5 7a 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 ds 6 2 3 2 1 2 e 2 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyn x 37d 7 65 3 4g1 f 5rk g h9 1wj f1 15v 3t6 6 38f"))}function cH(e,t){let r=0,n=t.length/2|0,u=0,a=0,i=0;for(;r<n;)if(a=t[2*(u=(r+n)/2|0)],i=t[2*u+1],e<a)n=u;else{if(!(e>i))return!0;r=u+1}return!1}function cX(e){let t=0;return e.split(" ").map(e=>t+=0|parseInt(e,36))}class cJ{constructor(e,t,r,n,u,a,i,o){this._raw2018=e,this._raw2019=t,this._raw2020=r,this._raw2021=n,this._raw2022=u,this._raw2023=a,this._raw2024=i,this._raw2025=o}get es2018(){var e;return null!==(e=this._set2018)&&void 0!==e?e:this._set2018=new Set(this._raw2018.split(" "))}get es2019(){var e;return null!==(e=this._set2019)&&void 0!==e?e:this._set2019=new Set(this._raw2019.split(" "))}get es2020(){var e;return null!==(e=this._set2020)&&void 0!==e?e:this._set2020=new Set(this._raw2020.split(" "))}get es2021(){var e;return null!==(e=this._set2021)&&void 0!==e?e:this._set2021=new Set(this._raw2021.split(" "))}get es2022(){var e;return null!==(e=this._set2022)&&void 0!==e?e:this._set2022=new Set(this._raw2022.split(" "))}get es2023(){var e;return null!==(e=this._set2023)&&void 0!==e?e:this._set2023=new Set(this._raw2023.split(" "))}get es2024(){var e;return null!==(e=this._set2024)&&void 0!==e?e:this._set2024=new Set(this._raw2024.split(" "))}get es2025(){var e;return null!==(e=this._set2025)&&void 0!==e?e:this._set2025=new Set(this._raw2025.split(" "))}}const cQ=new Set(["General_Category","gc"]),c0=new Set(["Script","Script_Extensions","sc","scx"]),c1=new cJ("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct","","","","","","",""),c2=new cJ("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy","Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo","Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho","Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi","Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi","Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz","",""),c3=new cJ("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space","Extended_Pictographic","","EBase EComp EMod EPres ExtPict","","","",""),c4=new cJ("","","","","","","Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence","");function c5(e,t,r){return cQ.has(t)?e>=2018&&c1.es2018.has(r):!!c0.has(t)&&(e>=2018&&c2.es2018.has(r)||e>=2019&&c2.es2019.has(r)||e>=2020&&c2.es2020.has(r)||e>=2021&&c2.es2021.has(r)||e>=2022&&c2.es2022.has(r)||e>=2023&&c2.es2023.has(r))}function c8(e){return e>=65&&e<=90||e>=97&&e<=122}function c6(e){return e>=48&&e<=57}function c9(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function c7(e){return e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:e-48}function fe(e){return e>=55296&&e<=56319}function ft(e){return e>=56320&&e<=57343}function fr(e,t){return(e-55296)*1024+(t-56320)+65536}class fn{constructor(){this.groupName=new Set}clear(){this.groupName.clear()}isEmpty(){return!this.groupName.size}hasInPattern(e){return this.groupName.has(e)}hasInScope(e){return this.hasInPattern(e)}addToScope(e){this.groupName.add(e)}enterDisjunction(){}enterAlternative(){}leaveDisjunction(){}}class fu{constructor(e,t){this.parent=e,this.base=null!=t?t:this}separatedFrom(e){var t,r;return!!(this.base===e.base&&this!==e||e.parent&&this.separatedFrom(e.parent))||null!==(r=null===(t=this.parent)||void 0===t?void 0:t.separatedFrom(e))&&void 0!==r&&r}child(){return new fu(this,null)}sibling(){return new fu(this.parent,this.base)}}class fa{constructor(){this.branchID=new fu(null,null),this.groupNames=new Map}clear(){this.branchID=new fu(null,null),this.groupNames.clear()}isEmpty(){return!this.groupNames.size}enterDisjunction(){this.branchID=this.branchID.child()}enterAlternative(e){0!==e&&(this.branchID=this.branchID.sibling())}leaveDisjunction(){this.branchID=this.branchID.parent}hasInPattern(e){return this.groupNames.has(e)}hasInScope(e){let t=this.groupNames.get(e);if(!t)return!1;for(let e of t)if(!e.separatedFrom(this.branchID))return!0;return!1}addToScope(e){let t=this.groupNames.get(e);if(t){t.push(this.branchID);return}this.groupNames.set(e,[this.branchID])}}const fi={at:(e,t,r)=>r<t?e.charCodeAt(r):-1,width:e=>1},fo={at:(e,t,r)=>r<t?e.codePointAt(r):-1,width:e=>e>65535?2:1};class fs{constructor(){this._impl=fi,this._s="",this._i=0,this._end=0,this._cp1=-1,this._w1=1,this._cp2=-1,this._w2=1,this._cp3=-1,this._w3=1,this._cp4=-1}get source(){return this._s}get index(){return this._i}get currentCodePoint(){return this._cp1}get nextCodePoint(){return this._cp2}get nextCodePoint2(){return this._cp3}get nextCodePoint3(){return this._cp4}reset(e,t,r,n){this._impl=n?fo:fi,this._s=e,this._end=r,this.rewind(t)}rewind(e){let t=this._impl;this._i=e,this._cp1=t.at(this._s,this._end,e),this._w1=t.width(this._cp1),this._cp2=t.at(this._s,this._end,e+this._w1),this._w2=t.width(this._cp2),this._cp3=t.at(this._s,this._end,e+this._w1+this._w2),this._w3=t.width(this._cp3),this._cp4=t.at(this._s,this._end,e+this._w1+this._w2+this._w3)}advance(){if(-1!==this._cp1){let e=this._impl;this._i+=this._w1,this._cp1=this._cp2,this._w1=this._w2,this._cp2=this._cp3,this._w2=e.width(this._cp2),this._cp3=this._cp4,this._w3=e.width(this._cp3),this._cp4=e.at(this._s,this._end,this._i+this._w1+this._w2+this._w3)}}eat(e){return this._cp1===e&&(this.advance(),!0)}eat2(e,t){return this._cp1===e&&this._cp2===t&&(this.advance(),this.advance(),!0)}eat3(e,t,r){return this._cp1===e&&this._cp2===t&&this._cp3===r&&(this.advance(),this.advance(),this.advance(),!0)}}class fd extends SyntaxError{constructor(e,t){super(e),this.index=t}}const fl=new Set([94,36,92,46,42,43,63,40,41,91,93,123,125,124]),fc=new Set([38,33,35,36,37,42,43,44,46,58,59,60,61,62,63,64,94,96,126]),ff=new Set([40,41,91,93,123,125,47,45,92,124]),fp=new Set([38,45,33,35,37,44,58,59,60,61,62,64,96,126]),fh={global:103,ignoreCase:105,multiline:109,unicode:117,sticky:121,dotAll:115,hasIndices:100,unicodeSets:118},fm=Object.fromEntries(Object.entries(fh).map(([e,t])=>[t,e]));function fg(e){return c8(e)||95===e}class fy{constructor(e){this._reader=new fs,this._unicodeMode=!1,this._unicodeSetsMode=!1,this._nFlag=!1,this._lastIntValue=0,this._lastRange={min:0,max:Number.POSITIVE_INFINITY},this._lastStrValue="",this._lastAssertionIsQuantifiable=!1,this._numCapturingParens=0,this._backreferenceNames=new Set,this._srcCtx=null,this._options=null!=e?e:{},this._groupSpecifiers=this.ecmaVersion>=2025?new fa:new fn}validateLiteral(e,t=0,r=e.length){if(this._srcCtx={source:e,start:t,end:r,kind:"literal"},this._unicodeSetsMode=this._unicodeMode=this._nFlag=!1,this.reset(e,t,r),this.onLiteralEnter(t),this.eat(47)&&this.eatRegExpBody()&&this.eat(47)){let n=this.index,u=e.includes("u",n),a=e.includes("v",n);this.validateFlagsInternal(e,n,r),this.validatePatternInternal(e,t+1,n-1,{unicode:u,unicodeSets:a})}else if(t>=r)this.raise("Empty");else{let e=String.fromCodePoint(this.currentCodePoint);this.raise(`Unexpected character '${e}'`)}this.onLiteralLeave(t,r)}validateFlags(e,t=0,r=e.length){this._srcCtx={source:e,start:t,end:r,kind:"flags"},this.validateFlagsInternal(e,t,r)}validatePattern(e,t=0,r=e.length,n){this._srcCtx={source:e,start:t,end:r,kind:"pattern"},this.validatePatternInternal(e,t,r,n)}validatePatternInternal(e,t=0,r=e.length,n){let u=this._parseFlagsOptionToMode(n,r);this._unicodeMode=u.unicodeMode,this._nFlag=u.nFlag,this._unicodeSetsMode=u.unicodeSetsMode,this.reset(e,t,r),this.consumePattern(),this._nFlag||!(this.ecmaVersion>=2018)||this._groupSpecifiers.isEmpty()||(this._nFlag=!0,this.rewind(t),this.consumePattern())}validateFlagsInternal(e,t,r){let n=this.parseFlags(e,t,r);this.onRegExpFlags(t,r,n)}_parseFlagsOptionToMode(e,t){let r=!1,n=!1;return e&&this.ecmaVersion>=2015&&("object"==typeof e?(r=!!e.unicode,this.ecmaVersion>=2024&&(n=!!e.unicodeSets)):r=e),r&&n&&this.raise("Invalid regular expression flags",{index:t+1,unicode:r,unicodeSets:n}),{unicodeMode:r||n,nFlag:r&&this.ecmaVersion>=2018||n||!!(this._options.strict&&this.ecmaVersion>=2023),unicodeSetsMode:n}}get strict(){return!!this._options.strict||this._unicodeMode}get ecmaVersion(){var e;return null!==(e=this._options.ecmaVersion)&&void 0!==e?e:2025}onLiteralEnter(e){this._options.onLiteralEnter&&this._options.onLiteralEnter(e)}onLiteralLeave(e,t){this._options.onLiteralLeave&&this._options.onLiteralLeave(e,t)}onRegExpFlags(e,t,r){this._options.onRegExpFlags&&this._options.onRegExpFlags(e,t,r),this._options.onFlags&&this._options.onFlags(e,t,r.global,r.ignoreCase,r.multiline,r.unicode,r.sticky,r.dotAll,r.hasIndices)}onPatternEnter(e){this._options.onPatternEnter&&this._options.onPatternEnter(e)}onPatternLeave(e,t){this._options.onPatternLeave&&this._options.onPatternLeave(e,t)}onDisjunctionEnter(e){this._options.onDisjunctionEnter&&this._options.onDisjunctionEnter(e)}onDisjunctionLeave(e,t){this._options.onDisjunctionLeave&&this._options.onDisjunctionLeave(e,t)}onAlternativeEnter(e,t){this._options.onAlternativeEnter&&this._options.onAlternativeEnter(e,t)}onAlternativeLeave(e,t,r){this._options.onAlternativeLeave&&this._options.onAlternativeLeave(e,t,r)}onGroupEnter(e){this._options.onGroupEnter&&this._options.onGroupEnter(e)}onGroupLeave(e,t){this._options.onGroupLeave&&this._options.onGroupLeave(e,t)}onModifiersEnter(e){this._options.onModifiersEnter&&this._options.onModifiersEnter(e)}onModifiersLeave(e,t){this._options.onModifiersLeave&&this._options.onModifiersLeave(e,t)}onAddModifiers(e,t,r){this._options.onAddModifiers&&this._options.onAddModifiers(e,t,r)}onRemoveModifiers(e,t,r){this._options.onRemoveModifiers&&this._options.onRemoveModifiers(e,t,r)}onCapturingGroupEnter(e,t){this._options.onCapturingGroupEnter&&this._options.onCapturingGroupEnter(e,t)}onCapturingGroupLeave(e,t,r){this._options.onCapturingGroupLeave&&this._options.onCapturingGroupLeave(e,t,r)}onQuantifier(e,t,r,n,u){this._options.onQuantifier&&this._options.onQuantifier(e,t,r,n,u)}onLookaroundAssertionEnter(e,t,r){this._options.onLookaroundAssertionEnter&&this._options.onLookaroundAssertionEnter(e,t,r)}onLookaroundAssertionLeave(e,t,r,n){this._options.onLookaroundAssertionLeave&&this._options.onLookaroundAssertionLeave(e,t,r,n)}onEdgeAssertion(e,t,r){this._options.onEdgeAssertion&&this._options.onEdgeAssertion(e,t,r)}onWordBoundaryAssertion(e,t,r,n){this._options.onWordBoundaryAssertion&&this._options.onWordBoundaryAssertion(e,t,r,n)}onAnyCharacterSet(e,t,r){this._options.onAnyCharacterSet&&this._options.onAnyCharacterSet(e,t,r)}onEscapeCharacterSet(e,t,r,n){this._options.onEscapeCharacterSet&&this._options.onEscapeCharacterSet(e,t,r,n)}onUnicodePropertyCharacterSet(e,t,r,n,u,a,i){this._options.onUnicodePropertyCharacterSet&&this._options.onUnicodePropertyCharacterSet(e,t,r,n,u,a,i)}onCharacter(e,t,r){this._options.onCharacter&&this._options.onCharacter(e,t,r)}onBackreference(e,t,r){this._options.onBackreference&&this._options.onBackreference(e,t,r)}onCharacterClassEnter(e,t,r){this._options.onCharacterClassEnter&&this._options.onCharacterClassEnter(e,t,r)}onCharacterClassLeave(e,t,r){this._options.onCharacterClassLeave&&this._options.onCharacterClassLeave(e,t,r)}onCharacterClassRange(e,t,r,n){this._options.onCharacterClassRange&&this._options.onCharacterClassRange(e,t,r,n)}onClassIntersection(e,t){this._options.onClassIntersection&&this._options.onClassIntersection(e,t)}onClassSubtraction(e,t){this._options.onClassSubtraction&&this._options.onClassSubtraction(e,t)}onClassStringDisjunctionEnter(e){this._options.onClassStringDisjunctionEnter&&this._options.onClassStringDisjunctionEnter(e)}onClassStringDisjunctionLeave(e,t){this._options.onClassStringDisjunctionLeave&&this._options.onClassStringDisjunctionLeave(e,t)}onStringAlternativeEnter(e,t){this._options.onStringAlternativeEnter&&this._options.onStringAlternativeEnter(e,t)}onStringAlternativeLeave(e,t,r){this._options.onStringAlternativeLeave&&this._options.onStringAlternativeLeave(e,t,r)}get index(){return this._reader.index}get currentCodePoint(){return this._reader.currentCodePoint}get nextCodePoint(){return this._reader.nextCodePoint}get nextCodePoint2(){return this._reader.nextCodePoint2}get nextCodePoint3(){return this._reader.nextCodePoint3}reset(e,t,r){this._reader.reset(e,t,r,this._unicodeMode)}rewind(e){this._reader.rewind(e)}advance(){this._reader.advance()}eat(e){return this._reader.eat(e)}eat2(e,t){return this._reader.eat2(e,t)}eat3(e,t,r){return this._reader.eat3(e,t,r)}raise(e,t){var r,n,u;throw function(e,t,r,n){let u="";if("literal"===e.kind){let t=e.source.slice(e.start,e.end);t&&(u=`: ${t}`)}else if("pattern"===e.kind){let r=e.source.slice(e.start,e.end),n=`${t.unicode?"u":""}${t.unicodeSets?"v":""}`;u=`: /${r}/${n}`}return new fd(`Invalid regular expression${u}: ${n}`,r)}(this._srcCtx,{unicode:null!==(r=null==t?void 0:t.unicode)&&void 0!==r?r:this._unicodeMode&&!this._unicodeSetsMode,unicodeSets:null!==(n=null==t?void 0:t.unicodeSets)&&void 0!==n?n:this._unicodeSetsMode},null!==(u=null==t?void 0:t.index)&&void 0!==u?u:this.index,e)}eatRegExpBody(){let e=this.index,t=!1,r=!1;for(;;){var n;let u=this.currentCodePoint;if(-1===u||10===(n=u)||13===n||8232===n||8233===n){let e=t?"character class":"regular expression";this.raise(`Unterminated ${e}`)}if(r)r=!1;else if(92===u)r=!0;else if(91===u)t=!0;else if(93===u)t=!1;else if(47===u&&!t||42===u&&this.index===e)break;this.advance()}return this.index!==e}consumePattern(){let e=this.index;this._numCapturingParens=this.countCapturingParens(),this._groupSpecifiers.clear(),this._backreferenceNames.clear(),this.onPatternEnter(e),this.consumeDisjunction();let t=this.currentCodePoint;if(-1!==this.currentCodePoint){41===t&&this.raise("Unmatched ')'"),92===t&&this.raise("\\ at end of pattern"),(93===t||125===t)&&this.raise("Lone quantifier brackets");let e=String.fromCodePoint(t);this.raise(`Unexpected character '${e}'`)}for(let e of this._backreferenceNames)this._groupSpecifiers.hasInPattern(e)||this.raise("Invalid named capture referenced");this.onPatternLeave(e,this.index)}countCapturingParens(){let e=this.index,t=!1,r=!1,n=0,u=0;for(;-1!==(u=this.currentCodePoint);)r?r=!1:92===u?r=!0:91===u?t=!0:93===u?t=!1:40!==u||t||63===this.nextCodePoint&&(60!==this.nextCodePoint2||61===this.nextCodePoint3||33===this.nextCodePoint3)||(n+=1),this.advance();return this.rewind(e),n}consumeDisjunction(){let e=this.index,t=0;this._groupSpecifiers.enterDisjunction(),this.onDisjunctionEnter(e);do this.consumeAlternative(t++);while(this.eat(124));this.consumeQuantifier(!0)&&this.raise("Nothing to repeat"),this.eat(123)&&this.raise("Lone quantifier brackets"),this.onDisjunctionLeave(e,this.index),this._groupSpecifiers.leaveDisjunction()}consumeAlternative(e){let t=this.index;for(this._groupSpecifiers.enterAlternative(e),this.onAlternativeEnter(t,e);-1!==this.currentCodePoint&&this.consumeTerm(););this.onAlternativeLeave(t,this.index,e)}consumeTerm(){return this._unicodeMode||this.strict?this.consumeAssertion()||this.consumeAtom()&&this.consumeOptionalQuantifier():this.consumeAssertion()&&(!this._lastAssertionIsQuantifiable||this.consumeOptionalQuantifier())||this.consumeExtendedAtom()&&this.consumeOptionalQuantifier()}consumeOptionalQuantifier(){return this.consumeQuantifier(),!0}consumeAssertion(){let e=this.index;if(this._lastAssertionIsQuantifiable=!1,this.eat(94))return this.onEdgeAssertion(e,this.index,"start"),!0;if(this.eat(36))return this.onEdgeAssertion(e,this.index,"end"),!0;if(this.eat2(92,66))return this.onWordBoundaryAssertion(e,this.index,"word",!0),!0;if(this.eat2(92,98))return this.onWordBoundaryAssertion(e,this.index,"word",!1),!0;if(this.eat2(40,63)){let t=this.ecmaVersion>=2018&&this.eat(60),r=!1;if(this.eat(61)||(r=this.eat(33))){let n=t?"lookbehind":"lookahead";return this.onLookaroundAssertionEnter(e,n,r),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this._lastAssertionIsQuantifiable=!t&&!this.strict,this.onLookaroundAssertionLeave(e,this.index,n,r),!0}this.rewind(e)}return!1}consumeQuantifier(e=!1){let t=this.index,r=0,n=0,u=!1;if(this.eat(42))r=0,n=Number.POSITIVE_INFINITY;else if(this.eat(43))r=1,n=Number.POSITIVE_INFINITY;else if(this.eat(63))r=0,n=1;else{if(!this.eatBracedQuantifier(e))return!1;({min:r,max:n}=this._lastRange)}return u=!this.eat(63),e||this.onQuantifier(t,this.index,r,n,u),!0}eatBracedQuantifier(e){let t=this.index;if(this.eat(123)){if(this.eatDecimalDigits()){let t=this._lastIntValue,r=t;if(this.eat(44)&&(r=this.eatDecimalDigits()?this._lastIntValue:Number.POSITIVE_INFINITY),this.eat(125))return!e&&r<t&&this.raise("numbers out of order in {} quantifier"),this._lastRange={min:t,max:r},!0}!e&&(this._unicodeMode||this.strict)&&this.raise("Incomplete quantifier"),this.rewind(t)}return!1}consumeAtom(){return this.consumePatternCharacter()||this.consumeDot()||this.consumeReverseSolidusAtomEscape()||!!this.consumeCharacterClass()||this.consumeCapturingGroup()||this.consumeUncapturingGroup()}consumeDot(){return!!this.eat(46)&&(this.onAnyCharacterSet(this.index-1,this.index,"any"),!0)}consumeReverseSolidusAtomEscape(){let e=this.index;if(this.eat(92)){if(this.consumeAtomEscape())return!0;this.rewind(e)}return!1}consumeUncapturingGroup(){let e=this.index;return!!this.eat2(40,63)&&(this.onGroupEnter(e),this.ecmaVersion>=2025&&this.consumeModifiers(),this.eat(58)||(this.rewind(e+1),this.raise("Invalid group")),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this.onGroupLeave(e,this.index),!0)}consumeModifiers(){let e=this.index,t=this.eatModifiers(),r=this.index,n=this.eat(45);if(!t&&!n)return!1;this.onModifiersEnter(e);let u=this.parseModifiers(e,r);if(this.onAddModifiers(e,r,u),n){let e=this.index;this.eatModifiers()||t||58!==this.currentCodePoint||this.raise("Invalid empty flags");let r=this.parseModifiers(e,this.index);for(let[e]of Object.entries(r).filter(([,e])=>e))u[e]&&this.raise(`Duplicated flag '${String.fromCodePoint(fh[e])}'`);this.onRemoveModifiers(e,this.index,r)}return this.onModifiersLeave(e,this.index),!0}consumeCapturingGroup(){let e=this.index;if(this.eat(40)){let t=null;if(this.ecmaVersion>=2018){if(this.consumeGroupSpecifier())t=this._lastStrValue;else if(63===this.currentCodePoint)return this.rewind(e),!1}else if(63===this.currentCodePoint)return this.rewind(e),!1;return this.onCapturingGroupEnter(e,t),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this.onCapturingGroupLeave(e,this.index,t),!0}return!1}consumeExtendedAtom(){return this.consumeDot()||this.consumeReverseSolidusAtomEscape()||this.consumeReverseSolidusFollowedByC()||!!this.consumeCharacterClass()||this.consumeCapturingGroup()||this.consumeUncapturingGroup()||this.consumeInvalidBracedQuantifier()||this.consumeExtendedPatternCharacter()}consumeReverseSolidusFollowedByC(){let e=this.index;return 92===this.currentCodePoint&&99===this.nextCodePoint&&(this._lastIntValue=this.currentCodePoint,this.advance(),this.onCharacter(e,this.index,92),!0)}consumeInvalidBracedQuantifier(){return this.eatBracedQuantifier(!0)&&this.raise("Nothing to repeat"),!1}consumePatternCharacter(){let e=this.index,t=this.currentCodePoint;return!(-1===t||fl.has(t))&&(this.advance(),this.onCharacter(e,this.index,t),!0)}consumeExtendedPatternCharacter(){let e=this.index,t=this.currentCodePoint;return -1!==t&&94!==t&&36!==t&&92!==t&&46!==t&&42!==t&&43!==t&&63!==t&&40!==t&&41!==t&&91!==t&&124!==t&&(this.advance(),this.onCharacter(e,this.index,t),!0)}consumeGroupSpecifier(){let e=this.index;if(this.eat(63)){if(this.eatGroupName()){if(!this._groupSpecifiers.hasInScope(this._lastStrValue))return this._groupSpecifiers.addToScope(this._lastStrValue),!0;this.raise("Duplicate capture group name")}this.rewind(e)}return!1}consumeAtomEscape(){return!!(this.consumeBackreference()||this.consumeCharacterClassEscape()||this.consumeCharacterEscape()||this._nFlag&&this.consumeKGroupName())||((this.strict||this._unicodeMode)&&this.raise("Invalid escape"),!1)}consumeBackreference(){let e=this.index;if(this.eatDecimalEscape()){let t=this._lastIntValue;if(t<=this._numCapturingParens)return this.onBackreference(e-1,this.index,t),!0;(this.strict||this._unicodeMode)&&this.raise("Invalid escape"),this.rewind(e)}return!1}consumeCharacterClassEscape(){var e;let t=this.index;if(this.eat(100))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"digit",!1),{};if(this.eat(68))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"digit",!0),{};if(this.eat(115))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"space",!1),{};if(this.eat(83))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"space",!0),{};if(this.eat(119))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"word",!1),{};if(this.eat(87))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"word",!0),{};let r=!1;if(this._unicodeMode&&this.ecmaVersion>=2018&&(this.eat(112)||(r=this.eat(80)))){this._lastIntValue=-1;let n=null;if(this.eat(123)&&(n=this.eatUnicodePropertyValueExpression())&&this.eat(125))return r&&n.strings&&this.raise("Invalid property name"),this.onUnicodePropertyCharacterSet(t-1,this.index,"property",n.key,n.value,r,null!==(e=n.strings)&&void 0!==e&&e),{mayContainStrings:n.strings};this.raise("Invalid property name")}return null}consumeCharacterEscape(){let e=this.index;return!!(this.eatControlEscape()||this.eatCControlLetter()||this.eatZero()||this.eatHexEscapeSequence()||this.eatRegExpUnicodeEscapeSequence()||!this.strict&&!this._unicodeMode&&this.eatLegacyOctalEscapeSequence()||this.eatIdentityEscape())&&(this.onCharacter(e-1,this.index,this._lastIntValue),!0)}consumeKGroupName(){let e=this.index;if(this.eat(107)){if(this.eatGroupName()){let t=this._lastStrValue;return this._backreferenceNames.add(t),this.onBackreference(e-1,this.index,t),!0}this.raise("Invalid named reference")}return!1}consumeCharacterClass(){let e=this.index;if(this.eat(91)){let t=this.eat(94);this.onCharacterClassEnter(e,t,this._unicodeSetsMode);let r=this.consumeClassContents();return this.eat(93)||(-1===this.currentCodePoint&&this.raise("Unterminated character class"),this.raise("Invalid character in character class")),t&&r.mayContainStrings&&this.raise("Negated character class may contain strings"),this.onCharacterClassLeave(e,this.index,t),r}return null}consumeClassContents(){if(this._unicodeSetsMode)return 93===this.currentCodePoint?{}:this.consumeClassSetExpression();let e=this.strict||this._unicodeMode;for(;;){let t=this.index;if(!this.consumeClassAtom())break;let r=this._lastIntValue;if(!this.eat(45))continue;if(this.onCharacter(this.index-1,this.index,45),!this.consumeClassAtom())break;let n=this._lastIntValue;if(-1===r||-1===n){e&&this.raise("Invalid character class");continue}r>n&&this.raise("Range out of order in character class"),this.onCharacterClassRange(t,this.index,r,n)}return{}}consumeClassAtom(){let e=this.index,t=this.currentCodePoint;if(-1!==t&&92!==t&&93!==t)return this.advance(),this._lastIntValue=t,this.onCharacter(e,this.index,this._lastIntValue),!0;if(this.eat(92)){if(this.consumeClassEscape())return!0;if(!this.strict&&99===this.currentCodePoint)return this._lastIntValue=92,this.onCharacter(e,this.index,this._lastIntValue),!0;(this.strict||this._unicodeMode)&&this.raise("Invalid escape"),this.rewind(e)}return!1}consumeClassEscape(){let e=this.index;if(this.eat(98))return this._lastIntValue=8,this.onCharacter(e-1,this.index,this._lastIntValue),!0;if(this._unicodeMode&&this.eat(45))return this._lastIntValue=45,this.onCharacter(e-1,this.index,this._lastIntValue),!0;let t=0;return!this.strict&&!this._unicodeMode&&99===this.currentCodePoint&&(c6(t=this.nextCodePoint)||95===t)?(this.advance(),this.advance(),this._lastIntValue=t%32,this.onCharacter(e-1,this.index,this._lastIntValue),!0):!!this.consumeCharacterClassEscape()||this.consumeCharacterEscape()}consumeClassSetExpression(){let e=this.index,t=!1,r=null;if(this.consumeClassSetCharacter()){if(this.consumeClassSetRangeFromOperator(e))return this.consumeClassUnionRight({}),{};t=!1}else if(r=this.consumeClassSetOperand())t=r.mayContainStrings;else{let e=this.currentCodePoint;92===e&&(this.advance(),this.raise("Invalid escape")),e===this.nextCodePoint&&fc.has(e)&&this.raise("Invalid set operation in character class"),this.raise("Invalid character in character class")}if(this.eat2(38,38)){for(;38!==this.currentCodePoint&&(r=this.consumeClassSetOperand());)if(this.onClassIntersection(e,this.index),r.mayContainStrings||(t=!1),!this.eat2(38,38))return{mayContainStrings:t};this.raise("Invalid character in character class")}if(this.eat2(45,45)){for(;this.consumeClassSetOperand();)if(this.onClassSubtraction(e,this.index),!this.eat2(45,45))return{mayContainStrings:t};this.raise("Invalid character in character class")}return this.consumeClassUnionRight({mayContainStrings:t})}consumeClassUnionRight(e){let t=e.mayContainStrings;for(;;){let e=this.index;if(this.consumeClassSetCharacter()){this.consumeClassSetRangeFromOperator(e);continue}let r=this.consumeClassSetOperand();if(r){r.mayContainStrings&&(t=!0);continue}break}return{mayContainStrings:t}}consumeClassSetRangeFromOperator(e){let t=this.index,r=this._lastIntValue;if(this.eat(45)){if(this.consumeClassSetCharacter()){let t=this._lastIntValue;return(-1===r||-1===t)&&this.raise("Invalid character class"),r>t&&this.raise("Range out of order in character class"),this.onCharacterClassRange(e,this.index,r,t),!0}this.rewind(t)}return!1}consumeClassSetOperand(){let e=null;return(e=this.consumeNestedClass())||(e=this.consumeClassStringDisjunction())?e:this.consumeClassSetCharacter()?{}:null}consumeNestedClass(){let e=this.index;if(this.eat(91)){let t=this.eat(94);this.onCharacterClassEnter(e,t,!0);let r=this.consumeClassContents();return this.eat(93)||this.raise("Unterminated character class"),t&&r.mayContainStrings&&this.raise("Negated character class may contain strings"),this.onCharacterClassLeave(e,this.index,t),r}if(this.eat(92)){let t=this.consumeCharacterClassEscape();if(t)return t;this.rewind(e)}return null}consumeClassStringDisjunction(){let e=this.index;if(this.eat3(92,113,123)){this.onClassStringDisjunctionEnter(e);let t=0,r=!1;do this.consumeClassString(t++).mayContainStrings&&(r=!0);while(this.eat(124));if(this.eat(125))return this.onClassStringDisjunctionLeave(e,this.index),{mayContainStrings:r};this.raise("Unterminated class string disjunction")}return null}consumeClassString(e){let t=this.index,r=0;for(this.onStringAlternativeEnter(t,e);-1!==this.currentCodePoint&&this.consumeClassSetCharacter();)r++;return this.onStringAlternativeLeave(t,this.index,e),{mayContainStrings:1!==r}}consumeClassSetCharacter(){var e;let t=this.index,r=this.currentCodePoint;if((r!==this.nextCodePoint||!fc.has(r))&&-1!==r&&!ff.has(r))return this._lastIntValue=r,this.advance(),this.onCharacter(t,this.index,this._lastIntValue),!0;if(this.eat(92)){if(this.consumeCharacterEscape())return!0;if(e=this.currentCodePoint,fp.has(e))return this._lastIntValue=this.currentCodePoint,this.advance(),this.onCharacter(t,this.index,this._lastIntValue),!0;if(this.eat(98))return this._lastIntValue=8,this.onCharacter(t,this.index,this._lastIntValue),!0;this.rewind(t)}return!1}eatGroupName(){if(this.eat(60)){if(this.eatRegExpIdentifierName()&&this.eat(62))return!0;this.raise("Invalid capture group name")}return!1}eatRegExpIdentifierName(){if(this.eatRegExpIdentifierStart()){for(this._lastStrValue=String.fromCodePoint(this._lastIntValue);this.eatRegExpIdentifierPart();)this._lastStrValue+=String.fromCodePoint(this._lastIntValue);return!0}return!1}eatRegExpIdentifierStart(){var e,t;let r=this.index,n=!this._unicodeMode&&this.ecmaVersion>=2020,u=this.currentCodePoint;return(this.advance(),92===u&&this.eatRegExpUnicodeEscapeSequence(n)?u=this._lastIntValue:n&&fe(u)&&ft(this.currentCodePoint)&&(u=fr(u,this.currentCodePoint),this.advance()),!((t=e=u)<65)&&(t<91||!(t<97)&&(t<123||cK(t)))||36===e||95===e)?(this._lastIntValue=u,!0):(this.index!==r&&this.rewind(r),!1)}eatRegExpIdentifierPart(){var e;let t=this.index,r=!this._unicodeMode&&this.ecmaVersion>=2020,n=this.currentCodePoint;return(this.advance(),92===n&&this.eatRegExpUnicodeEscapeSequence(r)?n=this._lastIntValue:r&&fe(n)&&ft(this.currentCodePoint)&&(n=fr(n,this.currentCodePoint),this.advance()),cZ(e=n)||36===e||8204===e||8205===e)?(this._lastIntValue=n,!0):(this.index!==t&&this.rewind(t),!1)}eatCControlLetter(){let e=this.index;if(this.eat(99)){if(this.eatControlLetter())return!0;this.rewind(e)}return!1}eatZero(){return!(48!==this.currentCodePoint||c6(this.nextCodePoint))&&(this._lastIntValue=0,this.advance(),!0)}eatControlEscape(){return this.eat(102)?(this._lastIntValue=12,!0):this.eat(110)?(this._lastIntValue=10,!0):this.eat(114)?(this._lastIntValue=13,!0):this.eat(116)?(this._lastIntValue=9,!0):!!this.eat(118)&&(this._lastIntValue=11,!0)}eatControlLetter(){let e=this.currentCodePoint;return!!c8(e)&&(this.advance(),this._lastIntValue=e%32,!0)}eatRegExpUnicodeEscapeSequence(e=!1){let t=this.index,r=e||this._unicodeMode;if(this.eat(117)){if(r&&this.eatRegExpUnicodeSurrogatePairEscape()||this.eatFixedHexDigits(4)||r&&this.eatRegExpUnicodeCodePointEscape())return!0;(this.strict||r)&&this.raise("Invalid unicode escape"),this.rewind(t)}return!1}eatRegExpUnicodeSurrogatePairEscape(){let e=this.index;if(this.eatFixedHexDigits(4)){let t=this._lastIntValue;if(fe(t)&&this.eat(92)&&this.eat(117)&&this.eatFixedHexDigits(4)){let e=this._lastIntValue;if(ft(e))return this._lastIntValue=fr(t,e),!0}this.rewind(e)}return!1}eatRegExpUnicodeCodePointEscape(){var e;let t=this.index;return!!(this.eat(123)&&this.eatHexDigits()&&this.eat(125))&&(e=this._lastIntValue)>=0&&e<=1114111||(this.rewind(t),!1)}eatIdentityEscape(){let e=this.currentCodePoint;return!!this.isValidIdentityEscape(e)&&(this._lastIntValue=e,this.advance(),!0)}isValidIdentityEscape(e){return -1!==e&&(this._unicodeMode?fl.has(e)||47===e:this.strict?!cZ(e):this._nFlag?!(99===e||107===e):99!==e)}eatDecimalEscape(){this._lastIntValue=0;let e=this.currentCodePoint;if(e>=49&&e<=57){do this._lastIntValue=10*this._lastIntValue+(e-48),this.advance();while((e=this.currentCodePoint)>=48&&e<=57);return!0}return!1}eatUnicodePropertyValueExpression(){let e=this.index;if(this.eatUnicodePropertyName()&&this.eat(61)){let e=this._lastStrValue;if(this.eatUnicodePropertyValue()){let t=this._lastStrValue;if(c5(this.ecmaVersion,e,t))return{key:e,value:t||null};this.raise("Invalid property name")}}if(this.rewind(e),this.eatLoneUnicodePropertyNameOrValue()){var t;let e=this._lastStrValue;if(c5(this.ecmaVersion,"General_Category",e))return{key:"General_Category",value:e||null};if((t=this.ecmaVersion)>=2018&&c3.es2018.has(e)||t>=2019&&c3.es2019.has(e)||t>=2021&&c3.es2021.has(e))return{key:e,value:null};if(this._unicodeSetsMode&&this.ecmaVersion>=2024&&c4.es2024.has(e))return{key:e,value:null,strings:!0};this.raise("Invalid property name")}return null}eatUnicodePropertyName(){for(this._lastStrValue="";fg(this.currentCodePoint);)this._lastStrValue+=String.fromCodePoint(this.currentCodePoint),this.advance();return""!==this._lastStrValue}eatUnicodePropertyValue(){var e;for(this._lastStrValue="";fg(e=this.currentCodePoint)||c6(e);)this._lastStrValue+=String.fromCodePoint(this.currentCodePoint),this.advance();return""!==this._lastStrValue}eatLoneUnicodePropertyNameOrValue(){return this.eatUnicodePropertyValue()}eatHexEscapeSequence(){let e=this.index;if(this.eat(120)){if(this.eatFixedHexDigits(2))return!0;(this._unicodeMode||this.strict)&&this.raise("Invalid escape"),this.rewind(e)}return!1}eatDecimalDigits(){let e=this.index;for(this._lastIntValue=0;c6(this.currentCodePoint);)this._lastIntValue=10*this._lastIntValue+c7(this.currentCodePoint),this.advance();return this.index!==e}eatHexDigits(){let e=this.index;for(this._lastIntValue=0;c9(this.currentCodePoint);)this._lastIntValue=16*this._lastIntValue+c7(this.currentCodePoint),this.advance();return this.index!==e}eatLegacyOctalEscapeSequence(){if(this.eatOctalDigit()){let e=this._lastIntValue;if(this.eatOctalDigit()){let t=this._lastIntValue;e<=3&&this.eatOctalDigit()?this._lastIntValue=64*e+8*t+this._lastIntValue:this._lastIntValue=8*e+t}else this._lastIntValue=e;return!0}return!1}eatOctalDigit(){let e=this.currentCodePoint;return e>=48&&e<=55?(this.advance(),this._lastIntValue=e-48,!0):(this._lastIntValue=0,!1)}eatFixedHexDigits(e){let t=this.index;this._lastIntValue=0;for(let r=0;r<e;++r){let e=this.currentCodePoint;if(!c9(e))return this.rewind(t),!1;this._lastIntValue=16*this._lastIntValue+c7(e),this.advance()}return!0}eatModifiers(){var e;let t=!1;for(;105===(e=this.currentCodePoint)||109===e||115===e;)this.advance(),t=!0;return t}parseModifiers(e,t){let{ignoreCase:r,multiline:n,dotAll:u}=this.parseFlags(this._reader.source,e,t);return{ignoreCase:r,multiline:n,dotAll:u}}parseFlags(e,t,r){let n={global:!1,ignoreCase:!1,multiline:!1,unicode:!1,sticky:!1,dotAll:!1,hasIndices:!1,unicodeSets:!1},u=new Set;u.add(103),u.add(105),u.add(109),this.ecmaVersion>=2015&&(u.add(117),u.add(121),this.ecmaVersion>=2018&&(u.add(115),this.ecmaVersion>=2022&&(u.add(100),this.ecmaVersion>=2024&&u.add(118))));for(let a=t;a<r;++a){let r=e.charCodeAt(a);if(u.has(r)){let u=fm[r];n[u]&&this.raise(`Duplicated flag '${e[a]}'`,{index:t}),n[u]=!0}else this.raise(`Invalid flag '${e[a]}'`,{index:t})}return n}}const fb={},fE={},fv={};function fx(e){return"Character"===e.type||"CharacterSet"===e.type||"CharacterClass"===e.type||"ExpressionCharacterClass"===e.type||"ClassStringDisjunction"===e.type}class fS{constructor(e){var t;this._node=fb,this._expressionBufferMap=new Map,this._flags=fE,this._backreferences=[],this._capturingGroups=[],this.source="",this.strict=!!(null==e?void 0:e.strict),this.ecmaVersion=null!==(t=null==e?void 0:e.ecmaVersion)&&void 0!==t?t:2025}get pattern(){if("Pattern"!==this._node.type)throw Error("UnknownError");return this._node}get flags(){if("Flags"!==this._flags.type)throw Error("UnknownError");return this._flags}onRegExpFlags(e,t,{global:r,ignoreCase:n,multiline:u,unicode:a,sticky:i,dotAll:o,hasIndices:s,unicodeSets:d}){this._flags={type:"Flags",parent:null,start:e,end:t,raw:this.source.slice(e,t),global:r,ignoreCase:n,multiline:u,unicode:a,sticky:i,dotAll:o,hasIndices:s,unicodeSets:d}}onPatternEnter(e){this._node={type:"Pattern",parent:null,start:e,end:e,raw:"",alternatives:[]},this._backreferences.length=0,this._capturingGroups.length=0}onPatternLeave(e,t){for(let r of(this._node.end=t,this._node.raw=this.source.slice(e,t),this._backreferences)){let e=r.ref,t="number"==typeof e?[this._capturingGroups[e-1]]:this._capturingGroups.filter(t=>t.name===e);if(1===t.length){let e=t[0];r.ambiguous=!1,r.resolved=e}else r.ambiguous=!0,r.resolved=t;for(let e of t)e.references.push(r)}}onAlternativeEnter(e){let t=this._node;if("Assertion"!==t.type&&"CapturingGroup"!==t.type&&"Group"!==t.type&&"Pattern"!==t.type)throw Error("UnknownError");this._node={type:"Alternative",parent:t,start:e,end:e,raw:"",elements:[]},t.alternatives.push(this._node)}onAlternativeLeave(e,t){let r=this._node;if("Alternative"!==r.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onGroupEnter(e){let t=this._node;if("Alternative"!==t.type)throw Error("UnknownError");this._node={type:"Group",parent:t,start:e,end:e,raw:"",modifiers:null,alternatives:[]},t.elements.push(this._node)}onGroupLeave(e,t){let r=this._node;if("Group"!==r.type||"Alternative"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onModifiersEnter(e){let t=this._node;if("Group"!==t.type)throw Error("UnknownError");this._node={type:"Modifiers",parent:t,start:e,end:e,raw:"",add:null,remove:null},t.modifiers=this._node}onModifiersLeave(e,t){let r=this._node;if("Modifiers"!==r.type||"Group"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onAddModifiers(e,t,{ignoreCase:r,multiline:n,dotAll:u}){let a=this._node;if("Modifiers"!==a.type)throw Error("UnknownError");a.add={type:"ModifierFlags",parent:a,start:e,end:t,raw:this.source.slice(e,t),ignoreCase:r,multiline:n,dotAll:u}}onRemoveModifiers(e,t,{ignoreCase:r,multiline:n,dotAll:u}){let a=this._node;if("Modifiers"!==a.type)throw Error("UnknownError");a.remove={type:"ModifierFlags",parent:a,start:e,end:t,raw:this.source.slice(e,t),ignoreCase:r,multiline:n,dotAll:u}}onCapturingGroupEnter(e,t){let r=this._node;if("Alternative"!==r.type)throw Error("UnknownError");this._node={type:"CapturingGroup",parent:r,start:e,end:e,raw:"",name:t,alternatives:[],references:[]},r.elements.push(this._node),this._capturingGroups.push(this._node)}onCapturingGroupLeave(e,t){let r=this._node;if("CapturingGroup"!==r.type||"Alternative"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onQuantifier(e,t,r,n,u){let a=this._node;if("Alternative"!==a.type)throw Error("UnknownError");let i=a.elements.pop();if(null==i||"Quantifier"===i.type||"Assertion"===i.type&&"lookahead"!==i.kind)throw Error("UnknownError");let o={type:"Quantifier",parent:a,start:i.start,end:t,raw:this.source.slice(i.start,t),min:r,max:n,greedy:u,element:i};a.elements.push(o),i.parent=o}onLookaroundAssertionEnter(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");let u=this._node={type:"Assertion",parent:n,start:e,end:e,raw:"",kind:t,negate:r,alternatives:[]};n.elements.push(u)}onLookaroundAssertionLeave(e,t){let r=this._node;if("Assertion"!==r.type||"Alternative"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onEdgeAssertion(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");n.elements.push({type:"Assertion",parent:n,start:e,end:t,raw:this.source.slice(e,t),kind:r})}onWordBoundaryAssertion(e,t,r,n){let u=this._node;if("Alternative"!==u.type)throw Error("UnknownError");u.elements.push({type:"Assertion",parent:u,start:e,end:t,raw:this.source.slice(e,t),kind:r,negate:n})}onAnyCharacterSet(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");n.elements.push({type:"CharacterSet",parent:n,start:e,end:t,raw:this.source.slice(e,t),kind:r})}onEscapeCharacterSet(e,t,r,n){let u=this._node;if("Alternative"!==u.type&&"CharacterClass"!==u.type)throw Error("UnknownError");u.elements.push({type:"CharacterSet",parent:u,start:e,end:t,raw:this.source.slice(e,t),kind:r,negate:n})}onUnicodePropertyCharacterSet(e,t,r,n,u,a,i){let o=this._node;if("Alternative"!==o.type&&"CharacterClass"!==o.type)throw Error("UnknownError");let s={type:"CharacterSet",parent:null,start:e,end:t,raw:this.source.slice(e,t),kind:r,strings:null,key:n};if(i){if("CharacterClass"===o.type&&!o.unicodeSets||a||null!==u)throw Error("UnknownError");o.elements.push(Object.assign(Object.assign({},s),{parent:o,strings:i,value:u,negate:a}))}else o.elements.push(Object.assign(Object.assign({},s),{parent:o,strings:i,value:u,negate:a}))}onCharacter(e,t,r){let n=this._node;if("Alternative"!==n.type&&"CharacterClass"!==n.type&&"StringAlternative"!==n.type)throw Error("UnknownError");n.elements.push({type:"Character",parent:n,start:e,end:t,raw:this.source.slice(e,t),value:r})}onBackreference(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");let u={type:"Backreference",parent:n,start:e,end:t,raw:this.source.slice(e,t),ref:r,ambiguous:!1,resolved:fv};n.elements.push(u),this._backreferences.push(u)}onCharacterClassEnter(e,t,r){let n=this._node,u={type:"CharacterClass",parent:n,start:e,end:e,raw:"",unicodeSets:r,negate:t,elements:[]};if("Alternative"===n.type){let e=Object.assign(Object.assign({},u),{parent:n});this._node=e,n.elements.push(e)}else if("CharacterClass"===n.type&&n.unicodeSets&&r){let e=Object.assign(Object.assign({},u),{parent:n,unicodeSets:r});this._node=e,n.elements.push(e)}else throw Error("UnknownError")}onCharacterClassLeave(e,t){let r=this._node;if("CharacterClass"!==r.type||"Alternative"!==r.parent.type&&"CharacterClass"!==r.parent.type)throw Error("UnknownError");let n=r.parent;r.end=t,r.raw=this.source.slice(e,t),this._node=n;let u=this._expressionBufferMap.get(r);if(!u)return;if(r.elements.length>0)throw Error("UnknownError");this._expressionBufferMap.delete(r);let a={type:"ExpressionCharacterClass",parent:n,start:r.start,end:r.end,raw:r.raw,negate:r.negate,expression:u};if(u.parent=a,r!==n.elements.pop())throw Error("UnknownError");n.elements.push(a)}onCharacterClassRange(e,t){let r=this._node;if("CharacterClass"!==r.type)throw Error("UnknownError");let n=r.elements,u=n.pop();if(!u||"Character"!==u.type)throw Error("UnknownError");if(!r.unicodeSets){let e=n.pop();if(!e||"Character"!==e.type||45!==e.value)throw Error("UnknownError")}let a=n.pop();if(!a||"Character"!==a.type)throw Error("UnknownError");let i={type:"CharacterClassRange",parent:r,start:e,end:t,raw:this.source.slice(e,t),min:a,max:u};a.parent=i,u.parent=i,n.push(i)}onClassIntersection(e,t){var r;let n=this._node;if("CharacterClass"!==n.type||!n.unicodeSets)throw Error("UnknownError");let u=n.elements.pop(),a=null!==(r=this._expressionBufferMap.get(n))&&void 0!==r?r:n.elements.pop();if(!a||!u||"ClassSubtraction"===a.type||"ClassIntersection"!==a.type&&!fx(a)||!fx(u))throw Error("UnknownError");let i={type:"ClassIntersection",parent:n,start:e,end:t,raw:this.source.slice(e,t),left:a,right:u};a.parent=i,u.parent=i,this._expressionBufferMap.set(n,i)}onClassSubtraction(e,t){var r;let n=this._node;if("CharacterClass"!==n.type||!n.unicodeSets)throw Error("UnknownError");let u=n.elements.pop(),a=null!==(r=this._expressionBufferMap.get(n))&&void 0!==r?r:n.elements.pop();if(!a||!u||"ClassIntersection"===a.type||"ClassSubtraction"!==a.type&&!fx(a)||!fx(u))throw Error("UnknownError");let i={type:"ClassSubtraction",parent:n,start:e,end:t,raw:this.source.slice(e,t),left:a,right:u};a.parent=i,u.parent=i,this._expressionBufferMap.set(n,i)}onClassStringDisjunctionEnter(e){let t=this._node;if("CharacterClass"!==t.type||!t.unicodeSets)throw Error("UnknownError");this._node={type:"ClassStringDisjunction",parent:t,start:e,end:e,raw:"",alternatives:[]},t.elements.push(this._node)}onClassStringDisjunctionLeave(e,t){let r=this._node;if("ClassStringDisjunction"!==r.type||"CharacterClass"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onStringAlternativeEnter(e){let t=this._node;if("ClassStringDisjunction"!==t.type)throw Error("UnknownError");this._node={type:"StringAlternative",parent:t,start:e,end:e,raw:"",elements:[]},t.alternatives.push(this._node)}onStringAlternativeLeave(e,t){let r=this._node;if("StringAlternative"!==r.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}}const fA=/^[!=]=/,fC=new class{constructor(e){this._state=new fS(e),this._validator=new fy(this._state)}parseLiteral(e,t=0,r=e.length){this._state.source=e,this._validator.validateLiteral(e,t,r);let n=this._state.pattern,u=this._state.flags,a={type:"RegExpLiteral",parent:null,start:t,end:r,raw:e,pattern:n,flags:u};return n.parent=a,u.parent=a,a}parseFlags(e,t=0,r=e.length){return this._state.source=e,this._validator.validateFlags(e,t,r),this._state.flags}parsePattern(e,t=0,r=e.length,n){return this._state.source=e,this._validator.validatePattern(e,t,r,n),this._state.pattern}};var f_=ip.createRule({name:"prefer-string-starts-ends-with",meta:{type:"suggestion",docs:{description:"Enforce using `String#startsWith` and `String#endsWith` over other equivalent methods of checking substrings"},messages:{preferStartsWith:"Use 'String#startsWith' method instead.",preferEndsWith:"Use the 'String#endsWith' method instead."},schema:[],fixable:"code"},create(e){ip.ensureParserWithTypeInformation(e.sourceCode.parserServices);let t=e.sourceCode.parserServices,r=t.program.getTypeChecker(),n=e.sourceCode.scopeManager?.scopes[0];function u(e){let n=t.getTypeAtLocation(e);return"string"===ig.getTypeName(r,n)}function a(e,t){let r=ih.ASTUtils.getStaticValue(e,n);return null!=r&&r.value===t}function i(e){let t=ih.ASTUtils.getStaticValue(e,n);return null!=t&&"string"==typeof t.value&&t.value[0]===t.value}function o(t,r){if(t.type===ih.AST_NODE_TYPES.MemberExpression)return"length"===ih.ASTUtils.getPropertyName(t,n)&&function(t,r){let n=e.sourceCode.getTokens(t),u=e.sourceCode.getTokens(r);if(n.length!==u.length)return!1;for(let e=0,t=n.length;e<t;++e){let t=n[e],r=u[e];if(t.type!==r.type||t.value!==r.value)return!1}return!0}(t.object,r);let u=ih.ASTUtils.getStaticValue(t,n),a=ih.ASTUtils.getStaticValue(r,n);return null!=u&&null!=a&&"number"==typeof u.value&&"string"==typeof a.value&&u.value===a.value.length}function s(e,t,r){return e.type===ih.AST_NODE_TYPES.UnaryExpression&&"-"===e.operator&&o(e.argument,t)||e.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,r)&&o(e.right,t)}function d(t){return[e.sourceCode.getTokenAfter(t.object,ih.ASTUtils.isNotClosingParenToken).range[0],t.range[1]]}function l(e){let t=ih.ASTUtils.getStaticValue(e,n);if(null==t||!(t.value instanceof RegExp))return null;let{source:r,flags:u}=t.value,a=r.startsWith("^"),i=r.endsWith("$");if(a===i||u.includes("i")||u.includes("m"))return null;let o=function(e,t){let r=fC.parsePattern(e,void 0,void 0,{unicode:t});if(1!==r.alternatives.length)return null;let n=r.alternatives[0].elements,u=n[0];return("Assertion"===u.type&&"start"===u.kind?n.shift():n.pop(),n.every(e=>"Character"===e.type))?String.fromCodePoint(...n.map(e=>e.value)):null}(r,u.includes("u"));return null==o?null:{isEndsWith:i,isStartsWith:a,text:o}}function*c(e,t,r,n,u){let a=d(function e(t){let r;if(t.type===ih.AST_NODE_TYPES.ChainExpression)return e(t.expression);if((r=t.type===ih.AST_NODE_TYPES.CallExpression?t.callee:t).type!==ih.AST_NODE_TYPES.MemberExpression)throw Error(`Expected a MemberExpression, got ${r.type}`);return r}(t.left));n&&(yield e.insertTextBefore(t,"!")),yield e.replaceTextRange([a[0],t.right.range[0]],`${u?"?.":"."}${r}sWith(`),yield e.replaceTextRange([t.right.range[1],t.range[1]],")")}function*f(e,t,r,n,u,a,i){a&&(yield e.insertTextBefore(t,"!")),yield e.replaceTextRange(d(n),`${i?"?.":"."}${u}sWith`),yield e.removeRange([r.range[1],t.range[1]])}return{'BinaryExpression > MemberExpression.left[computed=true], BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="charAt"][computed=false], BinaryExpression > ChainExpression.left > MemberExpression[computed=true], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="charAt"][computed=false]'(t){var r,s;let d=fD(t),l=d.type===ih.AST_NODE_TYPES.CallExpression,f=null;if(d.type===ih.AST_NODE_TYPES.CallExpression?(1===d.arguments.length&&(f=d.arguments[0]),d=fD(d)):f=t.property,null==f||!fw(d)||!u(t.object))return;let p=(r=f,s=t.object,r.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===r.operator&&o(r.left,s)&&a(r.right,1)),h=!p&&a(f,0);if(!h&&!p)return;let m=d;h&&!l&&function(e){if(!i(e))return!1;let t=ih.ASTUtils.getStaticValue(e,n);return null!=t&&"string"==typeof t.value&&t.value[0]===t.value&&function(e){let t=e.codePointAt(0);return null!=t&&t>=0&&t<=127}(t.value)}(m.right)||e.report({node:d,messageId:h?"preferStartsWith":"preferEndsWith",fix:e=>i(m.right)?c(e,m,h?"start":"end",m.operator.startsWith("!"),t.optional):null})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="indexOf"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="indexOf"][computed=false]'(t){let r=fD(t),n=fD(r);1===r.arguments.length&&fw(n)&&a(n.right,0)&&u(t.object)&&e.report({node:n,messageId:"preferStartsWith",fix:e=>f(e,n,r,t,"start",n.operator.startsWith("!"),t.optional)})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="lastIndexOf"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="lastIndexOf"][computed=false]'(t){let r=fD(t),n=fD(r);1===r.arguments.length&&fw(n)&&n.right.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===n.right.operator&&o(n.right.left,t.object)&&o(n.right.right,r.arguments[0])&&u(t.object)&&e.report({node:n,messageId:"preferEndsWith",fix:e=>f(e,n,r,t,"end",n.operator.startsWith("!"),t.optional)})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="match"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="match"][computed=false]'(t){let r=fD(t),a=fD(r);if(!fw(a)||!function(e){let t=ih.ASTUtils.getStaticValue(e,n);return null!=t&&null==t.value}(a.right)||!u(t.object))return;let i=1===r.arguments.length?l(r.arguments[0]):null;if(null==i)return;let{isStartsWith:o,text:s}=i;e.report({node:r,messageId:o?"preferStartsWith":"preferEndsWith",*fix(e){a.operator.startsWith("!")||(yield e.insertTextBefore(a,"!")),yield e.replaceTextRange(d(t),`${t.optional?"?.":"."}${o?"start":"end"}sWith`),yield e.replaceText(r.arguments[0],JSON.stringify(s)),yield e.removeRange([r.range[1],a.range[1]])}})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="slice"][computed=false], BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="substring"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="slice"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="substring"][computed=false]'(t){let r=fD(t),n=fD(r);if(!fw(n)||!u(t.object))return;let i=!1,d=!1;if(1===r.arguments.length?s(r.arguments[0],n.right,t.object)&&(i=!0):2===r.arguments.length&&(a(r.arguments[0],0)&&o(r.arguments[1],n.right)?d=!0:(o(r.arguments[1],t.object)||a(r.arguments[1],0))&&s(r.arguments[0],n.right,t.object)&&(i=!0)),!d&&!i)return;let l="slice"===t.property.name;e.report({node:n,messageId:d?"preferStartsWith":"preferEndsWith",fix(e){if(2===n.operator.length&&(n.right.type!==ih.AST_NODE_TYPES.Literal||"string"!=typeof n.right.value))return null;if(d){if(!o(r.arguments[1],n.right))return null}else{let e=r.arguments[0];if(!(e.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,t.object)&&o(e.right,n.right)||l&&e.type===ih.AST_NODE_TYPES.UnaryExpression&&"-"===e.operator&&o(e.argument,n.right)))return null}return c(e,n,d?"start":"end",n.operator.startsWith("!"),t.optional)}})},'CallExpression > MemberExpression.callee[property.name="test"][computed=false]':function(t){let r=fD(t),n=1===r.arguments.length?l(t.object):null;if(null==n)return;let{isStartsWith:u,text:a}=n,i=u?"startsWith":"endsWith";e.report({node:r,messageId:u?"preferStartsWith":"preferEndsWith",*fix(e){let n=r.arguments[0],u=n.type!==ih.AST_NODE_TYPES.Literal&&n.type!==ih.AST_NODE_TYPES.TemplateLiteral&&n.type!==ih.AST_NODE_TYPES.Identifier&&n.type!==ih.AST_NODE_TYPES.MemberExpression&&n.type!==ih.AST_NODE_TYPES.CallExpression;yield e.removeRange([r.range[0],n.range[0]]),u&&(yield e.insertTextBefore(n,"("),yield e.insertTextAfter(n,")")),yield e.insertTextAfter(n,`${t.optional?"?.":"."}${i}(${JSON.stringify(a)}`)}})}}}});function fD(e){return ih.ESLintUtils.nullThrows(e.parent?.type===ih.AST_NODE_TYPES.ChainExpression?e.parent.parent:e.parent,ih.ESLintUtils.NullThrowsReasons.MissingParent)}function fw(e){return e.type===ih.AST_NODE_TYPES.BinaryExpression&&fA.test(e.operator)}var fT=ip.createRule({name:"no-export-const-enum",meta:{type:"suggestion",docs:{description:"Disallow using `const enum` expression as it can not be inlined and tree-shaken by swc/esbuild/babel/webpack/rollup/vite/bun/rspack"},messages:{noConstEnum:"Do not use `const enum` expression"},schema:[]},create(e){let t=(t,r)=>{let n=ih.ASTUtils.findVariable(e.sourceCode.getScope(t),r);n?.defs.forEach(r=>{r.node.type===ih.AST_NODE_TYPES.TSEnumDeclaration&&r.node.const&&e.report({node:t,messageId:"noConstEnum"})})};return{ExportNamedDeclaration(r){let n=r.declaration;if(n?.type===ih.AST_NODE_TYPES.TSEnumDeclaration&&n.const){e.report({node:r,messageId:"noConstEnum"});return}if(n?.type===ih.AST_NODE_TYPES.VariableDeclaration){let e=n.declarations[0].id;e.type===ih.AST_NODE_TYPES.Identifier&&t(r,e)}},ExportDefaultDeclaration(e){let r=e.declaration;r.type===ih.AST_NODE_TYPES.Identifier&&t(e,r)}}}}),fP=ip.createRule({name:"no-for-in-iterable",meta:{schema:[],type:"suggestion",docs:{description:'"for in" should not be used with iterables',recommended:"strict",url:"https://sonarsource.github.io/rspec/#/rspec/S4139/javascript"},messages:{useForOf:'Use "for...of" to iterate over this "{{iterable}}".'}},create(e){let t=e.sourceCode.parserServices,r=e=>{var r;return ip.ensureParserWithTypeInformation(t),e.symbol&&fI.has(e.symbol.name)||((r=e).flags&im.TypeFlags.StringLike)>0||r.symbol?.name==="String"||function(e,t){for(let r of e.isUnion()?e.types:[e])if(!function(e,t){let r=t.program.getTypeChecker();return"isArrayType"in r&&"function"==typeof r.isArrayType&&r.isArrayType(e)}(r,t))return!1;return!0}(t.program.getTypeChecker().getBaseConstraintOfType(e)??e,t)};return{ForInStatement(n){ip.ensureParserWithTypeInformation(t);let u=fk(n.right,t);if(r(u)){let t=u.symbol?u.symbol.name:"String";e.report({messageId:"useForOf",data:{iterable:t},loc:e.sourceCode.getFirstToken(n).loc})}}}}});function fk(e,t){return t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e))}const fI=new Set(["Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Set","Map"]);var fF=ip.createRule({name:"only-await-thenable",meta:{schema:[],type:"suggestion",docs:{description:'"await" should only be used with promises',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4123/javascript"},messages:{refactorAwait:"Refactor this redundant 'await' on a non-promise."}},create(e){let t=e.sourceCode.parserServices;return ip.ensureParserWithTypeInformation(t),{AwaitExpression(r){let n=fk(r.argument,t);(function(e,t){var r;if(e.argument.type!==ih.AST_NODE_TYPES.CallExpression)return!1;let n=(r=e.argument,t.program.getTypeChecker().getResolvedSignature(t.esTreeNodeToTSNodeMap.get(r)));return n?.declaration&&function(e){let t=new Set(["return","returns"]);if(!e.jsDoc)return!1;for(let r of e.jsDoc)if(r.tags?.some(e=>t.has(e.tagName.escapedText.toString())))return!0;return!1}(n.declaration)})(r,t)||function(e){let t=e.getProperty("then");return t?.declarations?.some(e=>e.kind===im.SyntaxKind.MethodSignature||e.kind===im.SyntaxKind.MethodDeclaration||e.kind===im.SyntaxKind.PropertyDeclaration)}(n)||n.flags&im.TypeFlags.Any||n.flags&im.TypeFlags.Unknown||n.flags&im.TypeFlags.Union||e.report({messageId:"refactorAwait",node:r})}}}}),fO=ip.createRule({name:"no-undefined-optional-parameters",meta:{schema:[],type:"suggestion",docs:{description:'"undefined" should not be passed as the value of optional parameters',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4623/javascript",requiresTypeChecking:!0},fixable:"code",hasSuggestions:!0,messages:{removeUndefined:'Remove this redundant "undefined".',suggestRemoveUndefined:"Remove this redundant argument"}},create(e){let t=e.sourceCode.parserServices;return ip.ensureParserWithTypeInformation(t),{CallExpression(r){let{arguments:n}=r;if(0===n.length)return;let u=n[n.length-1];u.type===ih.AST_NODE_TYPES.Identifier&&"undefined"===u.name&&function(e,t,r){let n=r.program.getTypeChecker().getResolvedSignature(r.esTreeNodeToTSNodeMap.get(t));if(n){let t=n.declaration;if(t&&fB.has(t.kind)){let{parameters:r}=t,n=r[e];return n&&(n.initializer||n.questionToken)}}return!1}(n.length-1,r,t)&&e.report({messageId:"removeUndefined",node:u,suggest:[{messageId:"suggestRemoveUndefined",fix(t){if(1===r.arguments.length){let n=e.sourceCode.getTokenAfter(r.callee),u=e.sourceCode.getLastToken(r),[,a]=n.range,[i]=u.range;return t.removeRange([a,i])}let[,a]=n[n.length-2].range,[,i]=u.range;return t.removeRange([a,i])}}]})}}}});const fB=new Set([im.SyntaxKind.FunctionDeclaration,im.SyntaxKind.FunctionExpression,im.SyntaxKind.ArrowFunction,im.SyntaxKind.MethodDeclaration,im.SyntaxKind.Constructor,im.SyntaxKind.GetAccessor,im.SyntaxKind.SetAccessor]);function fN(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fj{visit(e,t){let r=e=>{switch(e.type){case ih.AST_NODE_TYPES.AwaitExpression:case ih.AST_NODE_TYPES.CallExpression:case ih.AST_NODE_TYPES.NewExpression:this.callLikeExpressions.push(e);break;case ih.AST_NODE_TYPES.FunctionDeclaration:case ih.AST_NODE_TYPES.FunctionExpression:case ih.AST_NODE_TYPES.ArrowFunctionExpression:return}(function(e,t){let r=[],n=t[e.type];if(n?.length)for(let t of n){let n=e[t];Array.isArray(n)?r.push(...n):r.push(n)}return r.filter(Boolean)})(e,t.sourceCode.visitorKeys).forEach(r)};r(e)}constructor(){fN(this,"callLikeExpressions",[])}}fN(fj,"getCallExpressions",(e,t)=>{let r=new fj;return r.visit(e,t),r.callLikeExpressions});var fL={rules:{"array/no-unneeded-flat-map":iz,"browser/prefer-location-assign":iW,"jsx/no-template-literal":iG,"jsx/no-unneeded-nested":iZ,"string/no-locale-case":iH,"string/no-simple-template-literal":iJ,"type/no-instanceof-wrapper":i0,"unicode/no-bidi":i6,"unicode/no-invisible":i7,"ban-eslint-disable":lV,"no-redundant-variable":oe,"no-single-return":or,"prefer-early-return":ou,"prefer-fetch":oa,"prefer-timer-id":os,"no-return-await":lz,"no-expression-empty-lines":lY,"object-format":lZ,"prefer-single-boolean-return":lH,"no-all-duplicated-branches":lQ,"no-duplicated-branches":lQ,"bool-param-default":cr,"call-argument-line":cn,"class-prototype":l9,"comma-or-logical-or-case":l3,"track-todo-fixme-comment":ci,"no-element-overwrite":l5,"no-empty-collection":cl,"no-equals-in-for-termination":cE,"no-top-level-this":cC,"no-invariant-returns":c_,"no-redundant-assignments":cM,"no-same-line-conditional":c$,"no-small-switch":cU,"no-unused-collection":cq,"no-useless-plusplus":cG,"string/prefer-string-starts-ends-with":f_,"string/no-unneeded-to-string":od,"type/no-force-cast-via-top-type":ol,"type/no-wrapper-type-reference":of,"no-default-error":op,"no-export-const-enum":fT,"no-for-in-iterable":fP,"only-await-thenable":fF,"no-undefined-optional-parameters":fO,"no-try-promise":ip.createRule({name:"no-try-promise",meta:{schema:[],type:"problem",docs:{description:'Promise rejections should not be caught by "try" blocks',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4822/javascript",requiresTypeChecking:!0},messages:{addAwait:"Consider using 'await' for the promise{{ending}} inside this 'try' or replace it with 'Promise.prototype.catch(...)' usage{{ending}}.",removeTry:"Consider removing this 'try' statement as promise{{ending}} rejection is already captured by '.catch()' method."}},create(e){let t=e.sourceCode.parserServices;return ip.ensureParserWithTypeInformation(t),{TryStatement(r){if(r.handler){let n=[],u=[],a=!1;fj.getCallExpressions(r.block,e).forEach(e=>{if(e.type===ih.AST_NODE_TYPES.AwaitExpression||!function(e,t){let r=t.esTreeNodeToTSNodeMap.get(e),n=t.program.getTypeChecker().getTypeAtLocation(r).getProperty("then");return!!(n&&n.flags&im.SymbolFlags.Method)}(e,t)){a=!0;return}!(e.parent&&(e.parent.type===ih.AST_NODE_TYPES.AwaitExpression||e.parent.type===ih.AST_NODE_TYPES.YieldExpression)||e.parent&&e.parent.type===ih.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ih.AST_NODE_TYPES.Identifier&&"then"===e.parent.property.name||e.type===ih.AST_NODE_TYPES.CallExpression&&e.callee.type===ih.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===ih.AST_NODE_TYPES.Identifier&&"catch"===e.callee.property.name)&&(e.parent&&e.parent.type===ih.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ih.AST_NODE_TYPES.Identifier&&"catch"===e.parent.property.name?u:n).push(e)}),a||(function(t,r){if(r.length>0){let n=r.length>1?"s":"",u=e.sourceCode.getFirstToken(t);e.report({messageId:"addAwait",data:{ending:n},loc:u.loc})}}(r,n),function(t,r,n){if(0===r.length&&n.length>0){let r=n.length>1?"s":"",u=e.sourceCode.getFirstToken(t);e.report({messageId:"removeTry",data:{ending:r},loc:u.loc})}}(r,n,u))}}}}}),"no-useless-string-operation":ip.createRule({name:"no-useless-string-operation",meta:{schema:[],messages:{uselessStringOp:"{{symbol}} is an immutable object; you must either store or return the result of the operation."},type:"problem",docs:{description:"Results of operations on strings should not be ignored",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1154/javascript"}},create(e){let t=e.sourceCode.parserServices;return{'ExpressionStatement > CallExpression[callee.type="MemberExpression"]':r=>{let{object:n,property:u}=r.callee;if(ip.ensureParserWithTypeInformation(t),(fk(n,t).flags&ix.TypeFlags.StringLike)!=0&&u.type===ih.AST_NODE_TYPES.Identifier){let t;e.report({messageId:"uselessStringOp",data:{symbol:((t=e.sourceCode.getText(n)).length>30&&(t="String"),t)},node:u})}}}}}),...Object.entries({"unicorn/better-regex":dN,"unicorn/catch-error-name":lP,"unicorn/custom-error-definition":lI,"unicorn/no-nested-ternary":sh,"unicorn/prefer-event-target":sW,"unicorn/prefer-keyboard-event-key":sY,"unicorn/prefer-text-content":sG,"unicorn/require-array-join-separator":s2,"unicorn/no-thenable":s3,"unicorn/no-invalid-remove-event-listener":s4,"unicorn/consistent-function-scoping":s5,"unicorn/no-new-buffer":s8,"unicorn/no-console-spaces":s6,"unicorn/no-empty-file":s9,"unicorn/no-useless-fallback-in-spread":s7,"unicorn/no-useless-length-check":de,"unicorn/no-useless-promise-resolve-reject":dt,"unicorn/no-zero-fractions":dr,"unicorn/prefer-export-from":dn,"unicorn/prefer-native-coercion-functions":du,"unicorn/no-document-cookie":di,"unicorn/prefer-add-event-listener":ds,"unicorn/prefer-array-index-of":dd,"unicorn/prefer-blob-reading-methods":dl,"unicorn/prefer-date-now":dc,"unicorn/prefer-dom-node-dataset":df,"unicorn/prefer-modern-math-apis":dp,"unicorn/number-literal-case":dg,"unicorn/prefer-number-properties":dy,"unicorn/prefer-reflect-apply":db,"unicorn/prefer-set-size":dE,"unicorn/prefer-string-replace-all":dx,"unicorn/prefer-string-slice":dS,"unicorn/prefer-string-trim-start-end":dA,"unicorn/no-unreadable-iife":dC,"unicorn/throw-new-error":d_,"unicorn/escape-case":dj,"unicorn/no-hex-escape":dL,"unicorn/prefer-prototype-methods":dR,"unicorn/error-message":dM,"unicorn/no-instanceof-array":d$,"unicorn/prefer-type-error":dU,"unicorn/consistent-destructuring":dV,"unicorn/new-for-builtins":dq,"unicorn/no-array-push-push":dW,"unicorn/no-process-exit":dY,"unicorn/no-static-only-class":dK,"unicorn/no-unreadable-array-destructuring":dH,"unicorn/no-useless-spread":dX,"unicorn/no-useless-switch-case":dJ,"unicorn/no-useless-undefined":dQ,"unicorn/numeric-separators-style":d0,"unicorn/prefer-array-find":d1,"unicorn/prefer-array-flat-map":d2,"unicorn/prefer-array-flat":d3,"unicorn/prefer-array-some":d4,"unicorn/prefer-code-point":d5,"unicorn/prefer-default-parameters":d8,"unicorn/prefer-logical-operator-over-ternary":d6,"unicorn/prefer-optional-catch-binding":d9,"unicorn/prefer-regexp-test":d7,"unicorn/prefer-set-has":le,"unicorn/prefer-string-raw":lt,"unicorn/prefer-switch":lr,"unicorn/require-number-to-fixed-digits-argument":ln,"unicorn/template-indent":l_,"unicorn/no-single-promise-in-promise-methods":dG,"unicorn/no-await-in-promise-methods":lD,"unicorn/no-negation-in-equality-check":lw,"unicorn/no-length-as-slice-end":lT,"unicorn/no-lonely-if":lF,"unicorn/no-magic-array-flat-depth":lO,"unicorn/no-negated-condition":lB,"unicorn/no-object-as-default-parameter":lN,"unicorn/prefer-negative-index":lj,"unicorn/prefer-node-protocol":lR}).reduce((e,[t,r])=>{var n;return e[t]={...r,meta:{schema:[],...r.meta,docs:{description:"",...r.meta.docs,url:iT(t)}},create:(n=r.create,e=>{let t={},r=(e,r)=>{t[e]??(t[e]=[]),t[e].push(r)};for(let[t,u]of Object.entries(n(new Proxy(e,{get:(e,t,n)=>"on"===t?(e,t)=>{for(let n of Array.isArray(e)?e:[e])r(n,t)}:"onExit"===t?(e,t)=>{for(let n of Array.isArray(e)?e:[e])r(`${n}:exit`,t)}:Reflect.get(e,t,n)}),void 0)||{}))u&&r(t,u);return Object.fromEntries(Object.entries(t).map(([t,r])=>[t,(...t)=>{for(let n of r)n&&function(e,t){if(e){for(let r of(iP(e)||(e=[e]),e))if(r){if(r.fix&&(r.fix=iF(r.fix)),iP(r.suggest))for(let e of r.suggest)"fix"in e&&"function"==typeof e.fix&&(e.fix=iF(e.fix)),e.data={...r.data,...e.data};t.report(r)}}}(n(...t),e)}]))})},e},{})}};module.exports=fL;
|
|
32
|
+
`,a=e=>{if(!e.superClass)return!1;let{name:t,type:n,property:u}=e.superClass;return"MemberExpression"===n&&({name:t}=u),r.test(t)},i=e=>"ExpressionStatement"===e.type&&"CallExpression"===e.expression.type&&"Super"===e.expression.callee.type,o=(e,t)=>{if("ExpressionStatement"!==e.type||"AssignmentExpression"!==e.expression.type)return!1;let r=e.expression.left;return!!r.object&&"ThisExpression"===r.object.type&&r.property.name===t},s=(e,t)=>"PropertyDefinition"===e.type&&!e.computed&&"Identifier"===e.key.type&&e.key.name===t;function*d(e,t){if(!a(t)||null===t.id)return;let{name:r}=t.id,d=n(r);r!==d&&(yield{node:t.id,message:`Invalid class name, use \`${d}\`.`});let{body:l,range:c}=t.body,f=l.find(e=>"constructor"===e.kind);if(!f){yield{node:t,message:"Add a constructor to your error.",fix:e=>e.insertTextAfterRange([c[0],c[0]+1],u(r))};return}let p=f.value.body;if(!p)return;let h=p.body,m=h.find(e=>i(e)),g=h.findIndex(e=>o(e,"message"));if(m){if(-1!==g){let e=h[g];yield{node:m,message:"Pass the error message to `super()` instead of setting `this.message`.",*fix(t){if(0===m.expression.arguments.length){let r=e.expression.right;yield t.insertTextAfterRange([m.range[0],m.range[0]+6],r.raw||r.name)}yield t.removeRange([0===g?p.range[0]:h[g-1].range[1],e.range[1]])}}}}else yield{node:p,message:"Missing call to `super()` in constructor."};let y=h.find(e=>o(e,"name"));if(y)y.expression.right.value!==r&&(yield{node:y?.expression.right??p,message:`The \`name\` property should be set to \`${r}\`.`});else{let e=l.find(e=>s(e,"name"));e?.value&&e.value.value===r||(yield{node:e?.value??p,message:`The \`name\` property should be set to \`${r}\`.`})}}let l=(e,r)=>{let n=r.left.property.name,u=r.right;if("ClassExpression"!==u.type||!a(u)||!u.id)return;let i=u.id.name;if(n!==i)return{node:r.left.property,messageId:t,fix:e=>e.replaceText(r.left.property,i)}};return aJ={create:e=>{e.on("ClassDeclaration",t=>d(e,t)),e.on("AssignmentExpression",t=>{if("ClassExpression"===t.right.type)return d(e,t.right)}),e.on("AssignmentExpression",t=>{if("MemberExpression"===t.left.type&&"Identifier"===t.left.object.type&&"exports"===t.left.object.name)return l(e,t)})},meta:{type:"problem",docs:{description:"Enforce correct `Error` subclassing.",recommended:!1},fixable:"code",messages:{[t]:"Exported error name should match error class"}}}}()),lF=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a1)return a0;a1=1;let{isParenthesized:e,isNotSemicolonToken:t}=sp,{needsSemicolon:r}=/*@__PURE__*/sq(),{removeSpacesAfter:n}=/*@__PURE__*/s1(),u="no-lonely-if",a=e=>"IfStatement"===e.type&&!e.alternate,i=e=>"LogicalExpression"===e.type&&("||"===e.operator||"??"===e.operator)||"ConditionalExpression"===e.type||"AssignmentExpression"===e.type||"YieldExpression"===e.type||"SequenceExpression"===e.type;function o(e,t){let r={};r.ifToken=t.getFirstToken(e),r.openingParenthesisToken=t.getFirstToken(e,1);let{consequent:n}=e;return r.closingParenthesisToken=t.getTokenBefore(n),"BlockStatement"===n.type&&(r.openingBraceToken=t.getFirstToken(n),r.closingBraceToken=t.getLastToken(n)),r}return a0={create:s=>({IfStatement(d){var l;if(a(d)&&("BlockStatement"===d.parent.type&&1===d.parent.body.length&&d.parent.body[0]===d&&a(d.parent.parent)&&d.parent.parent.consequent===d.parent||a(d.parent)&&d.parent.consequent===d))return{node:d,messageId:u,fix:(l=s.sourceCode,function*(u){let a=("BlockStatement"===d.parent.type?d.parent:d).parent,s={...a,...o(a,l)},c={...d,...o(d,l)};if(yield u.remove(c.ifToken),yield n(c.ifToken,l,u),s.openingBraceToken){yield u.remove(s.openingBraceToken),yield n(s.openingBraceToken,l,u),yield u.remove(s.closingBraceToken);let e=l.getTokenBefore(s.closingBraceToken,{includeComments:!0});yield n(e,l,u)}for(let{test:t,openingParenthesisToken:r,closingParenthesisToken:a}of(yield u.insertTextBefore(s.openingParenthesisToken,"("),yield u.insertTextAfter(c.closingParenthesisToken,`)${"EmptyStatement"===c.consequent.type?"":" "}`),yield u.insertTextAfter(s.closingParenthesisToken," && "),[s,c]))(e(t,l)||!i(t))&&(yield u.remove(r),yield u.remove(a)),yield n(a,l,u);if("BlockStatement"!==c.consequent.type){let e=l.getLastToken(c.consequent);if(t(e)){let t=l.getTokenAfter(s);t&&r(e,l,t.value)&&(yield u.insertTextBefore(t,";"))}}})}}}),meta:{type:"suggestion",docs:{description:"Disallow `if` statements as the only statement in `if` blocks without `else`.",recommended:!0},fixable:"code",messages:{[u]:"Unexpected `if` as the only statement in a `if` block without `else`."}}}}()),lO=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a3)return a2;a3=1;let{isMethodCall:e,isNumberLiteral:t}=/*@__PURE__*/sS(),{getCallExpressionTokens:r}=/*@__PURE__*/sq(),n="no-magic-array-flat-depth";return a2={create:u=>({CallExpression(a){if(!e(a,{method:"flat",argumentsLength:1,optionalCall:!1}))return;let[i]=a.arguments;if(!t(i)||1===i.value)return;let{sourceCode:o}=u,{openingParenthesisToken:s,closingParenthesisToken:d}=r(o,a);if(!o.commentsExistBetween(s,d))return{node:i,messageId:n}}}),meta:{type:"suggestion",docs:{description:"Disallow a magic number as the `depth` argument in `Array#flat(…).`",recommended:!0},messages:{[n]:"Magic number as depth is not allowed."}}}}()),lB=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a5)return a4;a5=1;let{removeParentheses:e,fixSpaceAroundKeyword:t,addParenthesizesToReturnOrThrowExpression:r}=/*@__PURE__*/s1(),{getParenthesizedRange:n,isParenthesized:u}=/*@__PURE__*/sm(),a=/*@__PURE__*/sN(),i=/*@__PURE__*/sR(),o="no-negated-condition";return a4={create:s=>{s.on(["IfStatement","ConditionalExpression"],d=>{if("IfStatement"===d.type&&(!d.alternate||"IfStatement"===d.alternate.type))return;let{test:l}=d;if(!(("UnaryExpression"!==l.type||"!"!==l.operator)&&("BinaryExpression"!==l.type||"!="!==l.operator&&"!=="!==l.operator)))return{node:l,messageId:o,*fix(o){let{sourceCode:c}=s;if(yield*function*(t,r,n){let{test:u}=r;if("UnaryExpression"===u.type){let a=n.getFirstToken(u);"IfStatement"===r.type&&(yield*e(u.argument,t,n)),yield t.remove(a);return}let a=n.getTokenAfter(u.left,e=>"Punctuator"===e.type&&e.value===u.operator);yield t.replaceText(a,"="+a.value.slice(1))}(o,d,c),yield*function*(e,t,r){let u="IfStatement"===t.type,[a,i]=[t.consequent,t.alternate].map(e=>{let t=n(e,r),a=r.text.slice(...t);return u&&"BlockStatement"!==e.type&&(a=`{${a}}`),{range:t,text:a}});a.text!==i.text&&(yield e.replaceTextRange(a.range,i.text),yield e.replaceTextRange(i.range,a.text))}(o,d,c),"ConditionalExpression"!==d.type||"UnaryExpression"!==l.type)return;yield*t(o,d,c);let{parent:f}=d,[p,h]=c.getFirstTokens(l,2);if(("ReturnStatement"===f.type||"ThrowStatement"===f.type)&&f.argument===d&&!a(p,h)&&!u(d,c)&&!u(l,c)){yield*r(o,f,c);return}i(c.getTokenBefore(d),c,h.value)&&(yield o.insertTextBefore(d,";"))}}})},meta:{type:"suggestion",docs:{description:"Disallow negated conditions.",recommended:!0},fixable:"code",messages:{[o]:"Unexpected negated condition."}}}}()),lN=/*@__PURE__*/iA(/*@__PURE__*/function(){if(a6)return a8;a6=1;let{isFunction:e}=/*@__PURE__*/sS(),t="identifier",r="non-identifier";return a8={create:()=>({AssignmentPattern(n){if(!("ObjectExpression"===n.right.type&&n.right.properties.length>0&&e(n.parent)&&n.parent.params.includes(n)))return;let{left:u,right:a}=n;return"Identifier"===u.type?{node:u,messageId:t,data:{parameter:u.name}}:{node:a,messageId:r}}}),meta:{type:"problem",docs:{description:"Disallow the use of objects as default parameters.",recommended:!0},messages:{[t]:"Do not use an object literal as default for parameter `{{parameter}}`.",[r]:"Do not use an object literal as default."}}}}()),lj=/*@__PURE__*/iA(/*@__PURE__*/function(){if(it)return ie;it=1;let{getNegativeIndexLengthNode:e,removeLengthNode:t}=/*@__PURE__*/function(){if(a7)return a9;a7=1;let e=/*@__PURE__*/sj(),{getParenthesizedRange:t}=/*@__PURE__*/sm(),{isNumberLiteral:r}=/*@__PURE__*/sS(),n=e=>"MemberExpression"===e.type&&!e.computed&&!e.optional&&"Identifier"===e.property.type&&"length"===e.property.name,u=e=>r(e)&&e.value>0;return a9={getNegativeIndexLengthNode:function t(r,a){if(!r)return;let{type:i,operator:o,left:s,right:d}=r;return"BinaryExpression"===i&&"-"===o&&u(d)?n(s)&&e(s.object,a)?s:t(s,a):void 0},removeLengthNode:function(e,r,n){let[u,a]=t(e,n);return r.removeRange([u,a+n.text.slice(a).match(/\S|$/).index])}}}(),r=/*@__PURE__*/dz(),{isLiteral:n}=/*@__PURE__*/sS(),u="prefer-negative-index",a=new Map([["slice",{argumentsIndexes:[0,1],supportObjects:new Set(["Array","String","ArrayBuffer",...r])}],["subarray",{argumentsIndexes:[0,1],supportObjects:new Set(r)}],["splice",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["toSpliced",{argumentsIndexes:[0],supportObjects:new Set(["Array"])}],["at",{argumentsIndexes:[0],supportObjects:new Set(["Array","String",...r])}],["with",{argumentsIndexes:[0],supportObjects:new Set(["Array",...r])}]]),i=e=>{let{type:t,property:r}=e;if("MemberExpression"===t&&"Identifier"===r.type)return r.name};return ie={create:r=>({CallExpression(o){if("MemberExpression"!==o.callee.type)return;let s=function(e){let{callee:t,arguments:r}=e,u=t.property.name,o=t.object,s=r;if(a.has(u))return{method:u,target:o,argumentsNodes:s};if("call"!==u&&"apply"!==u)return;let d="apply"===u;if(u=i(t.object),!a.has(u))return;let{supportObjects:l}=a.get(u),c=t.object.object;if("ArrayExpression"===c.type&&0===c.elements.length||"slice"===u&&n(c,"")||"prototype"===i(c)&&"Identifier"===c.object.type&&l.has(c.object.name)){if([o]=r,d){let[,e]=r;if(!e||"ArrayExpression"!==e.type)return;s=e.elements}else s=r.slice(1);return{method:u,target:o,argumentsNodes:s}}}(o);if(!s)return;let{method:d,target:l,argumentsNodes:c}=s,{argumentsIndexes:f}=a.get(d),p=f.map(t=>e(c[t],l)).filter(Boolean);if(0!==p.length)return{node:o,messageId:u,data:{method:d},*fix(e){let{sourceCode:n}=r;for(let r of p)yield t(r,e,n)}}}}),meta:{type:"suggestion",docs:{description:"Prefer negative index over `.length - index` when possible.",recommended:!0},fixable:"code",messages:{[u]:"Prefer negative index over length minus index for `{{method}}`."}}}}()),lL=/*@__PURE__*/iC(iv),lR=/*@__PURE__*/iA(/*@__PURE__*/function(){if(is)return io;is=1;let e=function(){if(ii)return ia;ii=1;let e=new Set(function(){if(iu)return ir;iu=1;let{builtinModules:e}=lL,t=["sys"];return ir=(e||(process.binding?Object.keys(process.binding("natives")):[])||[]).filter(e=>!/^_|^(internal|v8|node-inspect)\/|\//.test(e)&&!t.includes(e)).sort()}()),t="node:";return ia=r=>{if("string"!=typeof r)throw TypeError("Expected a string");r.startsWith(t)&&(r=r.slice(t.length));let n=r.indexOf("/");return -1!==n&&n!==r.length-1&&(r=r.slice(0,n)),e.has(r)}}(),{replaceStringLiteral:t}=/*@__PURE__*/s1(),r=/*@__PURE__*/sv(),n="prefer-node-protocol";return io={create:()=>({Literal(u){if(!(("ImportDeclaration"===u.parent.type||"ExportNamedDeclaration"===u.parent.type||"ImportExpression"===u.parent.type)&&u.parent.source===u||r(u.parent)&&u.parent.arguments[0]===u))return;let{value:a}=u;if(!("string"!=typeof a||a.startsWith("node:")||/^bun(?::|$)/.test(a))&&e(a))return{node:u,messageId:n,data:{moduleName:a},fix:e=>t(e,u,"node:",0,0)}}}),meta:{type:"suggestion",docs:{description:"Prefer using the `node:` protocol when importing Node.js builtin modules.",recommended:!0},fixable:"code",messages:{[n]:"Prefer `node:{{moduleName}}` over `{{moduleName}}`."}}}}());const lM=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),l$=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),lU=Symbol("rule-id-no-match");var lV=ip.createRule({name:"ban-eslint-disable",meta:{type:"problem",docs:{description:"Ban `eslint-disable` comment directive"},schema:[{oneOf:[{type:"boolean"},{type:"string",enum:["allow-with-description"]}]}],messages:{"do-not-use":"Do not use `{{directive}}`","require-description":"Include a description after the `{{directive}}` directive to explain why the `{{directive}}` is necessary.","require-specific-rule":"Enforce specifying rules to disable in `eslint-disable` comments. If you want to disable ESLint on a file altogether, you should ignore it through ESLint configuration."}},create:(e,t="allow-with-description")=>!1===t?{}:{Program(r){if(r.comments&&0!==r.comments.length)for(let n of r.comments){let r=function(e){let t=lM.exec(e);return t?.groups?.directive}(n.value);if(r&&!("allow-with-description"===t&&n.value.includes("--"))){let u="allow-with-description"===t?"require-description":"do-not-use";e.report({node:n,data:{directive:r},messageId:u})}let u=function(e){let t=l$.exec(e.trim());return t?t.groups?.ruleId:lU}(n.value);u===lU||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),lz=ip.createRule({name:"no-return-await",meta:{type:"suggestion",hasSuggestions:!0,docs:{description:"Disallows unnecessary `return await`"},fixable:void 0,deprecated:!1,schema:[],messages:{removeAwait:"Remove redundant `await`.",redundantUseOfAwait:"Redundant use of `await` on a return value."}},create:e=>({AwaitExpression(t){(function e(t){return t.parent?.type===ih.AST_NODE_TYPES.ArrowFunctionExpression||(t.parent?.type===ih.AST_NODE_TYPES.ReturnStatement?!lq(t.parent):(t.parent?.type===ih.AST_NODE_TYPES.ConditionalExpression&&(t===t.parent.consequent||t===t.parent.alternate)||t.parent?.type===ih.AST_NODE_TYPES.LogicalExpression&&t===t.parent.right||t.parent?.type===ih.AST_NODE_TYPES.SequenceExpression&&t===t.parent.expressions.at(-1))&&e(t.parent))})(t)&&!lq(t)&&e.report({node:e.sourceCode.getFirstToken(t),loc:t.loc,messageId:"redundantUseOfAwait",suggest:[{messageId:"removeAwait",fix(r){let n=e.sourceCode,[u,a]=n.getFirstTokens(t,2);if(u.loc.start.line!==a.loc.start.line)return null;let[i,o]=u.range,s=n.text[o];return r.removeRange([i,o+(" "===s?1:0)])}}]})}})});function lq(e){let t=e;for(;!ih.ASTUtils.isFunction(t)&&t.type!==ih.AST_NODE_TYPES.Program;){if(t.parent.type===ih.AST_NODE_TYPES.TryStatement&&(t===t.parent.block||t===t.parent.handler&&t.parent.finalizer))return!0;t=t.parent}return!1}function lW(e){return e.includes("\r\n")?"\r\n":"\n"}var lY=ip.createRule({name:"no-expression-empty-lines",meta:{messages:{unexpectedEmptyLine:"Unexpected empty line before"},docs:{description:"Disallows empty lines inside expressions."},fixable:"whitespace",type:"suggestion",schema:[]},create(e){let t=e.sourceCode.getText(),r=lW(t);return{MemberExpression(n){let u=n.object.range[1],a=lG(t.slice(u));if(a.includes("\n")){let t=r+((lG(a).split(/\r\n|\n/u).at(-1)??"")+a.trimStart());a!==t&&e.report({fix:()=>({range:[u,u+a.length],text:t}),messageId:"unexpectedEmptyLine",node:n.property})}}}}});function lG(e){return e.slice(0,e.length-e.trimStart().length)}var lZ=ip.createRule({name:"object-format",meta:{fixable:"whitespace",schema:[{type:"object",properties:{maxLineLength:{type:"number",default:80},maxObjectSize:{type:"number",default:3}},additionalProperties:!1}],docs:{description:"Requires multiline or single-line object format.",recommended:"stylistic"},messages:{preferMultiline:"Prefer multiline object literal",preferSingleLine:"Prefer single-line object literal"},type:"layout"},create(e,t={}){let r=e.sourceCode.getText(),n=t=>r.slice(Math.min(t.range[0],...e.sourceCode.getCommentsBefore(t).map(e=>e.range[0])),t.range[1]),u=lW(r),a=`,${u}`,{maxLineLength:i=80,maxObjectSize:o=3}=t,s=e=>r.slice(e.range[1]).trimStart().startsWith("//");return{ObjectExpression(t){let d=t.properties.map(e=>n(e).trim());if(d.length>0){let n=e.sourceCode.getText(t),l=d.length>o||d.some(lK)||t.properties.some(s),c=lK(n),f=!n.includes("\n");l&&f&&e.report({fix:()=>({range:t.range,text:`{${u}${d.join(a)}${u}}`}),messageId:"preferMultiline",node:t}),!l&&c&&function(){var n;let u=e.sourceCode.getLocFromIndex(t.range[0]).column;return u+d.reduce((e,t)=>e+t.length,0)+2*(d.length-1)+4+("number"==typeof(n=t.range[1])?r.slice(n):r.slice(...n.range)).split(/\r\n|\n/u)[0].replace(/^((?: as const)?\S*).*/u,"$1").length}()<=i&&e.report({fix:()=>({range:t.range,text:`{${d.join(",")}}`}),messageId:"preferSingleLine",node:t})}}}}});function lK(e){return e.includes("\n")}var lH=ip.createRule({name:"prefer-single-boolean-return",meta:{messages:{replaceIfThenElseByReturn:"Replace this if-then-else flow by a single return statement.",suggest:"Replace with single return statement",suggestCast:'Replace with single return statement using "!!" cast',suggestBoolean:"Replace with single return statement without cast (condition should be boolean!)"},schema:[],type:"suggestion",hasSuggestions:!0,docs:{description:'Return of boolean expressions should not be wrapped into an "if-then-else" statement',recommended:"recommended"}},create:e=>({IfStatement(t){t.parent.type!==ih.AST_NODE_TYPES.IfStatement&&lJ(t.consequent)&&function(e){if(e.alternate)return lJ(e.alternate);let{parent:t}=e;if(t.type===ih.AST_NODE_TYPES.BlockStatement){let r=t.body.indexOf(e);return lX(t.body[r+1])}return!1}(t)&&e.report({messageId:"replaceIfThenElseByReturn",node:t,suggest:function(t){var r,n;let u=e=>r=>{let n=`return ${e};`;if(t.alternate)return r.replaceText(t,n);let u=t.parent,a=u.body.indexOf(t),i=u.body[a+1],o=[t.range[0],i.range[1]];return r.replaceTextRange(o,n)},a=!1===((r=t.consequent).type===ih.AST_NODE_TYPES.BlockStatement?r.body[0]:r).argument.value,i=!(((n=t.test).type===ih.AST_NODE_TYPES.UnaryExpression||n.type===ih.AST_NODE_TYPES.BinaryExpression)&&["!","==","===","!=","!==","<","<=",">",">=","in","instanceof"].includes(n.operator)),o=e.sourceCode.getText(t.test);return a?[{messageId:"suggest",fix:u(`!(${o})`)}]:i?[{messageId:"suggestCast",fix:u(`!!(${o})`)},{messageId:"suggestBoolean",fix:u(o)}]:[{messageId:"suggest",fix:u(o)}]}(t)})}})});function lX(e){return e?.type===ih.AST_NODE_TYPES.ReturnStatement&&e.argument?.type===ih.AST_NODE_TYPES.Literal&&"boolean"==typeof e.argument.value}function lJ(e){return void 0!==e&&(e.type===ih.AST_NODE_TYPES.BlockStatement&&1===e.body.length&&lX(e.body[0])||lX(e))}var lQ=ip.createRule({name:"no-duplicated-branches",meta:{schema:[],type:"suggestion",docs:{description:"Two branches in a conditional structure should not have exactly the same implementation",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1871/javascript"},messages:{sameConditionalBlock:"This {{type}}'s code block is the same as the block for the {{type}} on line {{line}}."}},create(e){return{IfStatement(u){!function(u){if(u.parent.type===ih.AST_NODE_TYPES.IfStatement)return;let{branches:a,endsWithElse:i}=function(e){let t=[e.consequent],r=!1,n=e.alternate;for(;n;)if(n.type===ih.AST_NODE_TYPES.IfStatement)t.push(n.consequent),n=n.alternate;else{t.push(n),r=!0;break}return{branches:t,endsWithElse:r}}(u);if(r(a,i)){a.slice(1).forEach((e,t)=>n(e,a[t],"branch"));return}for(let r=1;r<a.length;r++)if(t([a[r]]))for(let t=0;t<r&&!function(t,r){let u=l1(t,r,e.sourceCode);return u&&"loc"in r&&n(t,r,"branch"),u}(a[r],a[t]);t++);}(u)},SwitchStatement(u){!function(u){let a;let{cases:i}=u,{endsWithDefault:o}=(a=!1,{branches:u.cases.filter((e,t)=>(e.test||(a=!0),t===u.cases.length-1||e.consequent.length>0)).map(e=>l2(e.consequent)),endsWithDefault:a}),s=i.filter(e=>l2(l0(e.consequent)).length>0);if(r(s.map(e=>l2(l0(e.consequent))),o)){s.slice(1).forEach((e,t)=>n(e,s[t],"case"));return}for(let r=1;r<i.length;r++){let u=l2(l0(i[r].consequent));if(t(u)){for(let t=0;t<r;t++)if(l1(u,l2(l0(i[t].consequent)),e.sourceCode)){n(i[r],i[t],"case");break}}}}(u)}};function t(t){if(t.length>0){let r=[...e.sourceCode.getTokens(t[0]),...e.sourceCode.getTokens(t[t.length-1])].filter(e=>"{"!==e.value&&"}"!==e.value);return r.length>0&&r[r.length-1].loc.end.line>r[0].loc.start.line}return!1}function r(t,r){return!r&&t.length>1&&t.slice(1).every((r,n)=>l1(r,t[n],e.sourceCode))}function n(t,r,n){let u=r.loc;e.report({messageId:"sameConditionalBlock",data:{type:n,line:String(u.start.line)},node:t})}}});function l0(e){if(1===e.length){let t=e[0];if(t.type===ih.AST_NODE_TYPES.BlockStatement)return t.body}return e}function l1(e,t,r){var n,u;return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>l1(e,t[n],r)):!(Array.isArray(e)||Array.isArray(t))&&e.type===t.type&&(n=r.getTokens(e),u=r.getTokens(t),n.length===u.length&&n.every((e,t)=>e.value===u[t].value))}function l2(e){return e.length>0&&e[e.length-1].type===ih.AST_NODE_TYPES.BreakStatement?e.slice(0,-1):e}var l3=ip.createRule({name:"comma-or-logical-or-case",meta:{type:"problem",docs:{description:"Comma and logical OR operators should not be used in switch cases",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S3616/javascript"},schema:[],messages:{specifyCase:'Explicitly specify {{nesting}} separate cases that fall through; currently this case clause only works for "{{expression}}".'}},create(e){function t(t,r,n){e.report({messageId:"specifyCase",data:{nesting:n.toString(),expression:String(r.type===ih.AST_NODE_TYPES.Literal?r.value:e.sourceCode.getText(r))},node:t})}return{"SwitchCase > SequenceExpression":function(e){let r=e.expressions;t(e,r[r.length-1],r.length)},"SwitchCase > LogicalExpression":function(r){var n;if(!((n=function(t){let r=e.sourceCode.getAncestors(t);for(let e=r.length-1;e>=0;e--)if(r[e].type===ih.AST_NODE_TYPES.SwitchStatement)return r[e];throw Error("A switch case should have an enclosing switch statement")}(r)).discriminant.type===ih.AST_NODE_TYPES.Literal&&!0===n.discriminant.value)){let e=function e(t,r){if("||"===t.operator)return t.left.type===ih.AST_NODE_TYPES.LogicalExpression?e(t.left,r+1):[t.left,r+1]}(r,0);e&&t(r,e[0],e[1]+1)}}}}});function l4(e,t,r){var n,u;return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>l4(e,t[n],r)):!(Array.isArray(e)||Array.isArray(t))&&e.type===t.type&&(n=r.getTokens(e),u=r.getTokens(t),n.length===u.length&&n.every((e,t)=>e.value===u[t].value))}ip.createRule({name:"no-all-duplicated-branches",meta:{messages:{removeOrEditConditionalStructure:"Remove this conditional structure or edit its code blocks so that they're not all the same.",returnsTheSameValue:'This conditional operation returns the same value whether the condition is "true" or "false".'},schema:[],type:"problem",docs:{description:"All branches in a conditional structure should not have exactly the same implementation",recommended:"recommended"}},create(e){return{IfStatement(r){if(r.parent?.type!==ih.AST_NODE_TYPES.IfStatement){let{branches:n,endsWithElse:u}=function(e){let t=[e.consequent],r=!1,n=e.alternate;for(;n;)if(n.type===ih.AST_NODE_TYPES.IfStatement)t.push(n.consequent),n=n.alternate;else{t.push(n),r=!0;break}return{branches:t,endsWithElse:r}}(r);u&&t(n)&&e.report({messageId:"removeOrEditConditionalStructure",node:r})}},SwitchStatement(r){let n;let{branches:u,endsWithDefault:a}=(n=!1,{branches:r.cases.filter((e,t)=>(e.test||(n=!0),t===r.cases.length-1||e.consequent.length>0)).map(e=>{var t;return(t=e.consequent).length>0&&t[t.length-1].type===ih.AST_NODE_TYPES.BreakStatement?t.slice(0,-1):t}),endsWithDefault:n});a&&t(u)&&e.report({messageId:"removeOrEditConditionalStructure",node:r})},ConditionalExpression(r){t([r.consequent,r.alternate])&&e.report({messageId:"returnsTheSameValue",node:r})}};function t(t){return t.length>1&&t.slice(1).every((r,n)=>l4(r,t[n],e.sourceCode))}}});var l5=ip.createRule({name:"no-element-overwrite",meta:{schema:[],type:"problem",docs:{description:"Collection elements should not be replaced unconditionally",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4143/javascript"},messages:{verifyIntendedIndex:'Verify this is the index that was intended; "{{index}}" was already set on line {{line}}.'}},create(e){return{SwitchCase(e){t(e.consequent)},BlockStatement(e){t(e.body)},Program(e){t(e.body.filter(e=>!(e&&(e.type===ih.AST_NODE_TYPES.ImportDeclaration||e.type===ih.AST_NODE_TYPES.ExportNamedDeclaration||e.type===ih.AST_NODE_TYPES.ExportDefaultDeclaration||e.type===ih.AST_NODE_TYPES.ExportAllDeclaration))))}};function t(t){let r;let n=new Map;t.forEach(t=>{let u=function(t){if(t.type===ih.AST_NODE_TYPES.ExpressionStatement)return function(t){if(t.type===ih.AST_NODE_TYPES.AssignmentExpression&&"="===t.operator&&t.left.type===ih.AST_NODE_TYPES.MemberExpression&&t.left.computed){let{left:r,right:n}=t,u=l6(r.property);if(void 0!==u&&!function(t,r){let n=e.sourceCode.getTokens(t),u=e.sourceCode.getTokens(r);return void 0!==u.find((e,t)=>{if(l8(e,n[0]))for(let e=t,r=0;e<u.length&&r<n.length;e++,r++)if(l8(u[e],n[r])){if(r===n.length-1)return!0}else break;return!1})}(r.object,n))return{collectionNode:r.object,indexOrKey:u,node:t}}}(t.expression)||function(e){if(e.type===ih.AST_NODE_TYPES.CallExpression&&e.callee.type===ih.AST_NODE_TYPES.MemberExpression){let t=e.callee;if(t.property.type===ih.AST_NODE_TYPES.Identifier){let r=t.property.name,n="add"===r&&1===e.arguments.length,u="set"===r&&2===e.arguments.length;if(n||u){let r=l6(e.arguments[0]);if(r)return{collectionNode:t.object,indexOrKey:r,node:e}}}}}(t.expression)}(t);if(u){r&&!l4(u.collectionNode,r,e.sourceCode)&&n.clear();let t=n.get(u.indexOrKey);t?.node.loc&&e.report({node:u.node,messageId:"verifyIntendedIndex",data:{index:u.indexOrKey,line:t.node.loc.start.line}}),n.set(u.indexOrKey,u),r=u.collectionNode}else n.clear()})}}});function l8(e,t){return e.value===t.value}function l6(e){if(e.type===ih.AST_NODE_TYPES.Literal){let{value:t}=e;return"number"==typeof t||"string"==typeof t?String(t):void 0}if(e.type===ih.AST_NODE_TYPES.Identifier)return e.name}var l9=ip.createRule({name:"class-prototype",meta:{schema:[],type:"suggestion",docs:{description:'Class methods should be used instead of "prototype" assignments',recommended:"recommended"},messages:{declareClass:'Declare a "{{class}}" class and move this declaration of "{{declaration}}" into it.'}},create(e){let t=e.sourceCode.parserServices,r=ip.isParserWithTypeInformation(t)?l7:ct;return{AssignmentExpression({left:n,right:u}){if(n.type===ih.AST_NODE_TYPES.MemberExpression&&r(u,t)){let[t,r]=[n.object,n.property];if(t.type===ih.AST_NODE_TYPES.MemberExpression&&r.type===ih.AST_NODE_TYPES.Identifier){let[u,a]=[t.object,t.property];u.type===ih.AST_NODE_TYPES.Identifier&&a.type===ih.AST_NODE_TYPES.Identifier&&"prototype"===a.name&&e.report({messageId:"declareClass",data:{class:u.name,declaration:r.name},node:n})}}}}}});function l7(e,t){ip.ensureParserWithTypeInformation(t);let r=t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e));return!!r.symbol&&(r.symbol.flags&im.SymbolFlags.Function)!=0}const ce=new Set(["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]);function ct(e,t){return ce.has(e.type)}var cr=ip.createRule({name:"bool-param-default",meta:{schema:[],type:"suggestion",docs:{description:"Optional boolean parameters should have default value"},messages:{provideDefault:"Provide a default value for '{{parameter}}' so that the logic of the function is more evident when this parameter is missing. Consider defining another function if providing default value is not possible."}},create:e=>({"FunctionDeclaration, FunctionExpression, ArrowFunctionExpression":t=>{for(let r of t.params)r.type===ih.AST_NODE_TYPES.Identifier&&function(e){return!!e.optional&&!!e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ih.AST_NODE_TYPES.TSBooleanKeyword||function(e){if(e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ih.AST_NODE_TYPES.TSUnionType){let t=e.typeAnnotation.typeAnnotation.types;return 2===t.length&&t.some(e=>e.type===ih.AST_NODE_TYPES.TSBooleanKeyword)&&t.some(e=>e.type===ih.AST_NODE_TYPES.TSUndefinedKeyword)}return!1}(e)}(r)&&e.report({messageId:"provideDefault",data:{parameter:r.name},node:r})}})}),cn=ip.createRule({name:"call-argument-line",meta:{type:"suggestion",docs:{description:"Function call arguments should not start on new lines",recommended:"recommended"},schema:[],messages:{moveArguments:"Make those call arguments start on line {{line}}.",moveTemplateLiteral:"Make this template literal start on line {{line}}."}},create(e){let t=e.sourceCode;return{CallExpression(r){if(r.callee.type!==ih.AST_NODE_TYPES.CallExpression&&1===r.arguments.length){let n=r.typeArguments??r.callee,u=(t.getLastTokenBetween(n,r.arguments[0],cu)??t.getLastToken(n)).loc.end.line,{start:a}=t.getTokenAfter(n,ca).loc;if(u!==a.line){let{end:n}=t.getLastToken(r).loc;n.line===a.line?e.report({messageId:"moveArguments",data:{line:u.toString()},loc:{start:a,end:n}}):e.report({messageId:"moveArguments",data:{line:u.toString()},loc:a})}}},TaggedTemplateExpression(r){let{quasi:n}=r,u=t.getTokenBefore(n);if(u&&n.loc&&u.loc.end.line!==n.loc.start.line){let t={start:n.loc.start,end:{line:n.loc.start.line,column:n.loc.start.column+1}};e.report({messageId:"moveTemplateLiteral",data:{line:u.loc.start.line.toString()},loc:t})}}}}});function cu(e){return e.type===ih.AST_TOKEN_TYPES.Punctuator&&")"===e.value}function ca(e){return!cu(e)}var ci=ip.createRule({name:"track-todo-fixme-comment",meta:{type:"suggestion",docs:{description:'Track uses of "FIXME" and "TODO" tags',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1134/javascript"},schema:[],messages:{fixme:"Take the required action to fix the issue indicated by this comment.",todo:'Complete the task associated to this "TODO" comment.'}},create(e){function t(t,r){e.sourceCode.getAllComments().forEach(n=>{let u=n.value.toLowerCase();if(u.includes(t)){let a=u.split(/\r\n?|\n/);for(let u=0;u<a.length;u++){let i=a[u].indexOf(t);i>=0&&!function(e,t,r){let n=t+r.length,u=t>0&&co.test(e.charAt(t-1)),a=n<=e.length-1&&co.test(e.charAt(n));return u||a}(a[u],i,t)&&e.report({messageId:r,loc:function(e,t,r,n){let u=r.loc.start.line+e,a=(0===e?r.loc.start.column+2:0)+t;return{start:{line:u,column:a},end:{line:u,column:a+n.length}}}(u,i,n,t)})}}})}return{"Program:exit":()=>{t("fixme","fixme"),t("todo","todo")}}}});const co=RegExp("\\p{Letter}","u"),cs=["Array","Map","Set","WeakSet","WeakMap"],cd=new Set(["copyWithin","pop","reverse","shift","sort","clear","delete","concat","flat","flatMap","includes","indexOf","join","lastIndexOf","slice","toSource","toString","toLocaleString","get","has","entries","every","filter","find","findIndex","forEach","keys","map","reduce","reduceRight","some","values"]);var cl=ip.createRule({name:"no-empty-collection",meta:{schema:[],type:"problem",docs:{description:"Empty collections should not be accessed or iterated",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4158/javascript"},messages:{reviewUsageOfIdentifier:'Review this usage of "{{identifierName}}" as it can only be empty here.'}},create(e){let t=t=>{if(t.references.length<=1||t.defs.some(e=>e.type===ih.TSESLint.Scope.DefinitionType.Parameter||e.type===ih.TSESLint.Scope.DefinitionType.ImportBinding))return;let r=[],n=!1;for(let e of t.references)if(e.isWriteOnly()){if(!function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.VariableDeclarator||e.type===ih.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ih.AST_NODE_TYPES.VariableDeclarator&&t.init)return ch(t.init);if(t.type===ih.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ih.AST_NODE_TYPES.AssignmentExpression&&cp(e,r.left)&&ch(r.right)}}return!1}(e))return;n=!0}else{if(!(function(e){let{parent:t}=e.identifier;if(t&&t.type===ih.AST_NODE_TYPES.MemberExpression){let e=t.parent;if(e&&e.type===ih.AST_NODE_TYPES.CallExpression)return cm(t.property,...cd)}return!1}(e)||function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.ForOfStatement||e.type===ih.AST_NODE_TYPES.ForInStatement);return t&&t.right===e.identifier}(e)||function(e){let{parent:t}=e.identifier;return t&&t.type===ih.AST_NODE_TYPES.MemberExpression&&t.computed&&!function(e){let t=cf(e,new Set),r=t.find(e=>e.type===ih.AST_NODE_TYPES.AssignmentExpression);return!!r&&"="===r.operator&&[e,...t].includes(r.left)}(t)}(e)))return;r.push(e)}n&&r.forEach(t=>{e.report({messageId:"reviewUsageOfIdentifier",data:{identifierName:t.identifier.name},node:t.identifier})})},r=e=>{e.type!==ih.TSESLint.Scope.ScopeType.global&&e.variables.forEach(t),e.childScopes.forEach(r)};return{"Program:exit":t=>{r(e.sourceCode.getScope(t))}}}});function cc(e,t){return cf(e,new Set).find(t)}function cf(e,t){let r=[],n=e.parent;for(;n&&(r.push(n),!t.has(n.type));)n=n.parent;return r}function cp(e,t){return t.type===ih.AST_NODE_TYPES.Identifier&&t===e.identifier}function ch(e){return e&&e.type===ih.AST_NODE_TYPES.ArrayExpression?0===e.elements.length:!!e&&(e.type===ih.AST_NODE_TYPES.CallExpression||e.type===ih.AST_NODE_TYPES.NewExpression)&&cm(e.callee,...cs)&&0===e.arguments.length}function cm(e,...t){return e?.type===ih.AST_NODE_TYPES.Identifier&&(0===t.length||t.some(t=>t===e.name))}const cg=new Set(["!=","==","!==","==="]),cy=new Set(["!==","!="]),cb=new Set(["+=","-="]);var cE=ip.createRule({name:"no-equals-in-for-termination",meta:{schema:[],messages:{replaceOperator:"Replace '{{operator}}' operator with one of '<=', '>=', '<', or '>' comparison operators."},type:"suggestion",docs:{description:'Equality operators should not be used in "for" loop termination conditions',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S888/javascript"}},create(e){function t(t,r){if(t.type===ih.AST_NODE_TYPES.Identifier){var n;let u=(n=t.name,function(e,t){let r;for(;null==r&&null!=e;)r=e.variables.find(e=>e.name===t),e=e.upper;return r}(e.sourceCode.getScope(t),n)),a=r.range;if(u&&a)return u.references.some(e=>{var t;return(t=e.identifier).range&&t.range[0]>a[0]&&t.range[1]<a[1]})}return!1}return{ForStatement(r){if(!r.test||!r.update)return;let n=r.test;n.type===ih.AST_NODE_TYPES.BinaryExpression&&cg.has(n.operator)&&function e(t){return!!cv(t)||t.type===ih.AST_NODE_TYPES.UpdateExpression||t.type===ih.AST_NODE_TYPES.SequenceExpression&&t.expressions.every(e)}(r.update)&&!(function(e){let t=e.test,r=[];return function e(t,r){let n;cv(t)?n=t.left:t.type===ih.AST_NODE_TYPES.UpdateExpression?n=t.argument:t.type===ih.AST_NODE_TYPES.SequenceExpression&&t.expressions.forEach(t=>e(t,r)),n&&n.type===ih.AST_NODE_TYPES.Identifier&&r.push(n.name)}(e.update,r),t.left.type!==ih.AST_NODE_TYPES.Identifier||!r.includes(t.left.name)}(r)||function(e){let r=e.init,n=e.test;if(r&&cx(n)){let u=function(e,r){if(e.type===ih.AST_NODE_TYPES.UpdateExpression&&!t(e.argument,r)||function(e){if(cv(e)){let t=e.right;return t.type===ih.AST_NODE_TYPES.Literal&&1===t.value}return!1}(e)&&!t(e.left,r)){if("++"===e.operator||"+="===e.operator)return 1;if("--"===e.operator||"-="===e.operator)return -1}return 0}(e.update,e.body);if(0!==u){let e=cS(r),t=cS(n);return void 0!==e&&void 0!==t&&u===Math.sign(t-e)}}return!1}(r))&&e.report({messageId:"replaceOperator",data:{operator:n.operator},node:n})}}}});function cv(e){return e.type===ih.AST_NODE_TYPES.AssignmentExpression&&cb.has(e.operator)}function cx(e){return e.type===ih.AST_NODE_TYPES.BinaryExpression&&cy.has(e.operator)}function cS(e){return cx(e)?cA(e.right):e.type===ih.AST_NODE_TYPES.VariableDeclaration&&1===e.declarations.length?cA(e.declarations[0].init):e.type===ih.AST_NODE_TYPES.AssignmentExpression?cA(e.right):void 0}function cA(e){if(e&&e.type===ih.AST_NODE_TYPES.Literal&&"number"==typeof e.value)return e.value}var cC=ip.createRule({name:"no-top-level-this",meta:{hasSuggestions:!0,schema:[],messages:{removeThis:'Remove the use of "this".',suggestRemoveThis:'Remove "this"',suggestUseGlobalThis:'Replace "this" with "globalThis" object'},type:"suggestion",docs:{description:'The global "this" object should not be used',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S2990/javascript"},fixable:"code"},create:e=>({'MemberExpression[object.type="ThisExpression"]':t=>{let r=e.sourceCode.getScope(t).variableScope.type,n=e.sourceCode.getAncestors(t).some(e=>e.type===ih.AST_NODE_TYPES.ClassDeclaration||e.type===ih.AST_NODE_TYPES.ClassExpression);if((r===ih.TSESLint.Scope.ScopeType.global||r===ih.TSESLint.Scope.ScopeType.module)&&!n){let r=[];if(!t.computed){let n=e.sourceCode.getText(t.property);r.push({messageId:"suggestRemoveThis",fix:e=>e.replaceText(t,n)},{messageId:"suggestUseGlobalThis",fix:e=>e.replaceText(t.object,"globalThis")})}e.report({messageId:"removeThis",node:t.object,suggest:r})}}})}),c_=ip.createRule({name:"no-invariant-returns",meta:{schema:[],type:"suggestion",docs:{description:"Function returns should not be invariant",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S3516/javascript",requiresTypeChecking:!1},messages:{refactorReturn:"Refactor this function to only return once or not always return the same value."}},create(e){let t=[],r=[],n=[],u=r=>(function(t,r){!(!r||n.some(e=>e.reachable)||r.containsReturnWithoutValue||r.returnStatements.length<=1||r.codePath.thrownSegments.length>0)&&function(e,t){let r=e[0],n=r?cT(r,t):void 0;if(void 0!==n)return e.slice(1).every(e=>cT(e,t)===n);if(r?.type===ih.AST_NODE_TYPES.Identifier){let n=cD(r.name,t);if(n){let t=new Set(n.variable.references.slice(1).map(e=>e.identifier));return e.every(e=>t.has(e))}}return!1}(r.returnStatements.map(e=>e.argument),e.sourceCode.getScope(t))&&e.report({messageId:"refactorReturn",node:t})})(r,t[t.length-1]);return{onCodePathStart(e){t.push({codePath:e,containsReturnWithoutValue:!1,returnStatements:[]}),r.push(n),n=[]},onCodePathEnd(){t.pop(),n=r.pop()||[]},onCodePathSegmentStart(e){n.push(e)},onCodePathSegmentEnd(){n.pop()},ReturnStatement(e){if(t.length){let r=t[t.length-1];r.containsReturnWithoutValue=r.containsReturnWithoutValue||!e.argument,r.returnStatements.push(e)}},"FunctionDeclaration:exit":u,"FunctionExpression:exit":u,"ArrowFunctionExpression:exit":u}}});function cD(e,t){let r=t.set.get(e);if(r&&!r.references.slice(1).some(e=>e.isWrite()||function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.ExpressionStatement||ce.has(e.type));return t&&t.type===ih.AST_NODE_TYPES.ExpressionStatement&&(cw(t,e)||t.expression.type===ih.AST_NODE_TYPES.CallExpression)}(e))){let e=null;return 1===r.defs.length&&r.defs[0].type===ih.TSESLint.Scope.DefinitionType.Variable&&(e=r.defs[0].node.init),{variable:r,initExpression:e}}return null}function cw(e,t,r=!0){return e.expression.type===ih.AST_NODE_TYPES.AssignmentExpression&&function e(t,r,n=!0){return t.type===ih.AST_NODE_TYPES.MemberExpression&&(cp(r,t.object)||n&&e(t.object,r,n))}(e.expression.left,t,r)}function cT(e,t){if(e){if(e.type===ih.AST_NODE_TYPES.Literal)return e.value;if(e.type===ih.AST_NODE_TYPES.UnaryExpression){let r=cT(e.argument,t);return void 0===r?void 0:function(e,t){switch(e){case"-":return-Number(t);case"+":return Number(t);case"~":return~Number(t);case"!":return!t;case"typeof":return typeof t}}(e.operator,r)}if(e.type===ih.AST_NODE_TYPES.Identifier){let r=cD(e.name,t);if(r?.initExpression)return cT(r.initExpression,t)}}}function cP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ck(e,t){let r=t.variables.find(t=>t.name===e.name);return!r&&t.upper&&(r=t.upper.variables.find(t=>t.name===e.name)),r}class cI extends Set{constructor(...e){super(...e),cP(this,"type","AssignedValues")}}const cF=e=>new cI([e]),cO={type:"UnknownValue"};class cB{add(e){e.resolved&&this.references.add(e)}propagate(e){this.in.clear(),this.segment.prevSegments.forEach(t=>{this.join(e.get(t.id).out)});let t=new Map;return this.references.forEach(e=>this.updateProgramState(e,t)),!function(e,t){if(e.size!==t.size)return!1;for(let[n,u]of e){var r;if(!t.has(n)||("AssignedValues"===(r=t.get(n)).type&&"AssignedValues"===u.type?!function(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}(r,u):r!==u))return!1}return!0}(this.out,t)&&(this.out=t,!0)}updateProgramState(e,t){let r=e.resolved;if(!r||!e.isWrite())return;if(!e.writeExpr){t.set(r,cO);return}let n=cN(r,e.writeExpr,t,e.from);t.set(r,n)}join(e){for(let[t,r]of e.entries()){let e=this.in.get(t)??new cI;"AssignedValues"===e.type&&"AssignedValues"===r.type?(r.forEach(t=>e.add(t)),this.in.set(t,e)):this.in.set(t,cO)}}constructor(e){cP(this,"segment",void 0),cP(this,"in",void 0),cP(this,"out",void 0),cP(this,"references",void 0),this.segment=e,this.in=new Map,this.out=new Map,this.references=new Set}}function cN(e,t,r,n){if(!t)return cO;switch(t.type){case ih.AST_NODE_TYPES.Literal:return t.raw?cF(t.raw):cO;case ih.AST_NODE_TYPES.Identifier:{let u=ck(t,n);if(u&&u!==e)return r.get(u)??cO;return cO}default:return cO}}class cj{constructor(e){cP(this,"codePath",void 0),cP(this,"reachingDefinitionsMap",void 0),cP(this,"reachingDefinitionsStack",void 0),cP(this,"segments",void 0),cP(this,"assignmentStack",void 0),this.codePath=e,this.reachingDefinitionsMap=new Map,this.reachingDefinitionsStack=[],this.segments=new Map,this.assignmentStack=[]}}class cL{isRhs(e){return this.node.type===ih.AST_NODE_TYPES.AssignmentExpression?this.node.right===e:this.node.init===e}isLhs(e){return this.node.type===ih.AST_NODE_TYPES.AssignmentExpression?this.node.left===e:this.node.id===e}add(e){let t=e.identifier;for(;t;){if(this.isLhs(t)){this.lhs.add(e);break}if(this.isRhs(t)){this.rhs.add(e);break}t=t.parent}}constructor(e){cP(this,"node",void 0),cP(this,"lhs",void 0),cP(this,"rhs",void 0),this.node=e,this.lhs=new Set,this.rhs=new Set}}function cR(e){return e[e.length-1]}var cM=ip.createRule({name:"no-redundant-assignments",meta:{schema:[],type:"suggestion",docs:{description:"Assignments should not be redundant",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4165/javascript"},messages:{reviewAssignment:'Review this redundant assignment: "{{symbol}}" already holds the assigned value along all execution paths.'}},create(e){let t=[],r=new Map,n=new Map,u=[],a=[];return{AssignmentExpression:o,"VariableDeclarator[init]":o,"AssignmentExpression:exit":i,"VariableDeclarator[init]:exit":i,Identifier(r){!(r.parent.type===ih.AST_NODE_TYPES.TSEnumBody||r.parent.type===ih.AST_NODE_TYPES.TSEnumDeclaration||r.parent.type===ih.AST_NODE_TYPES.TSEnumMember||e.sourceCode.getAncestors(r).some(e=>e.type===ih.AST_NODE_TYPES.TSEnumDeclaration))&&!function(r){let{ref:u,variable:a}=function e(t,r){if(null===r)return{ref:null,variable:null};let n=r.references.find(e=>e.identifier===t);if(n)return{ref:n,variable:n.resolved};let u=r.variables.find(e=>e.defs.find(e=>e.name===t));return u?{ref:null,variable:u}:e(t,r.upper)}(r,e.sourceCode.getScope(r));if(u&&d(u),a){let e=cR(t).codePath.id;n.has(a)?n.get(a).add(e):n.set(a,new Set([e]))}}(r)},"Program:exit":()=>{!function(e){let t=Array.from(e.values(),e=>e.segment);for(;t.length;){let r=t.pop();e.get(r.id).propagate(e)&&r.nextSegments.forEach(e=>t.push(e))}}(r),r.forEach(s),r.clear(),n.clear(),t.length=0},onCodePathSegmentStart(e){r.set(e.id,new cB(e)),a.push(e)},onCodePathStart(e){var r;r=new cj(e),t.push(r),u.push(a),a.length=0},onCodePathEnd(){t.pop(),u.pop()||(a.length=0)},onCodePathSegmentEnd(){a.pop()}};function i(){let e=cR(t).assignmentStack.pop();e.rhs.forEach(d),e.lhs.forEach(d)}function o(e){cR(t).assignmentStack.push(new cL(e))}function s(t){let r=new Map(t.in);t.references.forEach(t=>{let u=t.resolved;if(!u||!t.isWrite()||!function(e){let t=e.resolved;return t&&!(e.identifier.type===ih.AST_NODE_TYPES.Identifier&&e.identifier.parent?.type===ih.AST_NODE_TYPES.AssignmentPattern)&&!t.name.startsWith("_")&&!function(e){if(e?.parent){let t=e.parent;return t&&t.type===ih.AST_NODE_TYPES.AssignmentExpression&&"="!==t.operator}return!1}(e.writeExpr)&&(e.writeExpr?.type!==ih.AST_NODE_TYPES.Identifier||e.resolved!==ck(e.writeExpr,e.from))&&!t.defs.some(e=>e.type===ih.TSESLint.Scope.DefinitionType.Parameter||e.type===ih.TSESLint.Scope.DefinitionType.Variable&&!e.node.init)&&!(n.get(t).size>1)}(t))return;let a=r.get(u),i=cN(u,t.writeExpr,r,t.from);if(a?.type==="AssignedValues"&&1===a.size){let[r]=[...a];!function({resolved:t},r,n,u,a){if("UnknownValue"===u.type||1!==u.size)return;let[i]=[...u];1===t.references.filter(e=>e.isWrite()).length||n!==i||e.report({node:r,messageId:"reviewAssignment",data:{symbol:a}})}(t,t.writeExpr,r,i,u.name)}r.set(u,i)})}function d(e){let{assignmentStack:n}=cR(t);if(n.length>0)cR(n).add(e);else for(let t=0,n=a.length;t<n;t++)(function(e){let t;return r.has(e.id)?t=r.get(e.id):(t=new cB(e),r.set(e.id,t)),t})(a[t]).add(e)}}}),c$=ip.createRule({name:"no-same-line-conditional",meta:{schema:[],type:"layout",docs:{description:"Conditionals should start on new lines",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S3972/javascript"},fixable:"whitespace",messages:{sameLineCondition:'Move this "if" to a new line or add the missing "else".'}},create(e){function t(t){let{sourceCode:r}=e;t.reduce((e,r,n)=>{let u=t[n-1];return r.type===ih.AST_NODE_TYPES.IfStatement&&u&&u.type===ih.AST_NODE_TYPES.IfStatement?[{first:u,following:r},...e]:e},[]).forEach(t=>{let n=t.first,u=t.following;if(n.loc&&u.loc&&n.loc.end.line===u.loc.start.line&&n.loc.start.line!==u.loc.end.line){let t=r.getFirstToken(u);e.report({messageId:"sameLineCondition",loc:t.loc,fix:e=>e.replaceTextRange([n.range[1],u.range[0]],"\n"+" ".repeat(n.loc.start.column))})}})}return{Program:e=>t(e.body),BlockStatement:e=>t(e.body),SwitchCase:e=>t(e.consequent)}}}),cU=ip.createRule({name:"no-small-switch",meta:{schema:[],messages:{replaceSwitch:'Replace this "switch" statement by "if" statements to increase readability.'},type:"suggestion",docs:{description:'"if" statements should be preferred over "switch" when simpler',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1301/javascript"}},create:e=>({SwitchStatement(t){let{cases:r}=t,n=r.some(e=>!e.test);if(r.length<2||2===r.length&&n){let r=e.sourceCode.getFirstToken(t);r&&e.report({messageId:"replaceSwitch",loc:r.loc})}}})});const cV=["Array","Map","Set","WeakSet","WeakMap"],cz=["copyWithin","fill","pop","push","reverse","set","shift","sort","splice","unshift","add","clear","delete"];var cq=ip.createRule({name:"no-unused-collection",meta:{schema:[],messages:{unusedCollection:"Either use this collection's contents or remove the collection."},type:"suggestion",docs:{description:"Collection contents should be used",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4030/javascript",requiresTypeChecking:!1}},create:e=>({"Program:exit":t=>{let r=[];(function e(t,r){t.type!==ih.TSESLint.Scope.ScopeType.global&&t.variables.filter(cW).forEach(e=>{r.push(e)}),t.childScopes.forEach(t=>{e(t,r)})})(e.sourceCode.getScope(t),r),r.forEach(t=>{e.report({messageId:"unusedCollection",node:t.identifiers[0]})})}})});function cW(e){if(function(e){if(!e.defs.length)return;let t=e.defs[0];return t.node.parent?.parent?.type.startsWith("Export")}(e)||e.references.length<=1)return!1;let t=!1;for(let r of e.references)if(r.isWriteOnly()){if(!function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.VariableDeclarator||e.type===ih.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ih.AST_NODE_TYPES.VariableDeclarator&&t.init)return cY(t.init);if(t.type===ih.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ih.AST_NODE_TYPES.AssignmentExpression&&cp(e,r.left)&&cY(r.right)}}return!1}(r))return!1;t=!0}else if(function(e){let t=cc(e.identifier,e=>e.type===ih.AST_NODE_TYPES.ExpressionStatement);return!t||!(cw(t,e,!1)||function(e,t){if(e.expression.type===ih.AST_NODE_TYPES.CallExpression){let{callee:r}=e.expression;if(r.type===ih.AST_NODE_TYPES.MemberExpression){let{property:e,object:n}=r;return cp(t,n)&&cm(e,...cz)}}return!1}(t,e))}(r))return!1;return t}function cY(e){return!!e&&e.type===ih.AST_NODE_TYPES.ArrayExpression||!!e&&(e.type===ih.AST_NODE_TYPES.CallExpression||e.type===ih.AST_NODE_TYPES.NewExpression)&&cm(e.callee,...cV)}var cG=ip.createRule({name:"no-useless-plusplus",meta:{schema:[],type:"problem",docs:{description:"Values should not be uselessly incremented",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S2123/javascript"},messages:{removeIncrement:"Remove this {{updateOperator}}rement or correct the code not to waste it."}},create(e){function t(t){let r="++"===t.operator?"inc":"dec";e.report({messageId:"removeIncrement",data:{updateOperator:r},node:t})}return{"ReturnStatement > UpdateExpression":function(r){let n=r.argument;!r.prefix&&n.type===ih.AST_NODE_TYPES.Identifier&&e.sourceCode.getScope(r).variables.some(e=>e.identifiers.some(e=>e.name===n.name))&&t(r)},AssignmentExpression(e){let r=e.right;if(r.type===ih.AST_NODE_TYPES.UpdateExpression&&!r.prefix){let n=e.left;n.type===ih.AST_NODE_TYPES.Identifier&&r.argument.type===ih.AST_NODE_TYPES.Identifier&&r.argument.name===n.name&&t(r)}}}}});function cZ(e){return!(e<48)&&(e<58||!(e<65)&&(e<91||95===e||!(e<97)&&(e<123||cK(e)||cH(e,null!=t?t:t=cX("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 0 21 a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 2 h 2 6 b 1 3 9 i 2 1l 0 2 6 3 1 3 2 a 0 b 1 3 9 f 0 3 2 1l 0 2 4 5 1 3 2 4 0 l b 4 0 c 2 1l 0 2 7 2 2 2 2 l 1 3 9 b 5 2 2 1l 0 2 6 3 1 3 2 8 2 b 1 3 9 j 0 1o 4 4 2 2 3 a 0 f 9 h 4 1k 0 2 6 2 2 2 3 8 1 c 1 3 9 i 2 1l 0 2 6 2 2 2 3 8 1 c 1 3 9 4 0 d 3 1k 1 2 6 2 2 2 3 a 0 b 1 3 9 i 2 1z 0 5 5 2 0 2 7 7 9 3 1 1q 0 3 6 d 7 2 9 2g 0 3 8 c 6 2 9 1r 1 7 9 c 0 2 0 2 0 5 1 1e j 2 1 6 a 2 z a 0 2t j 2 9 d 3 5 2 2 2 3 6 4 3 e b 2 e jk 2 a 8 pt 3 t 2 u 1 v 1 1t v a 0 3 9 y 2 2 a 40 0 3b b 5 b b 9 3l a 1p 4 1m 9 2 s 3 a 7 9 n d 2 f 1e 4 1c g c 9 i 8 d 2 v c 3 9 19 d 1d j 9 9 7 9 3b 2 2 k 5 0 7 0 3 2 5j 1r el 1 1e 1 k 0 3g c 5 0 4 b 2db 2 3y 0 2p v ff 5 2y 1 2p 0 n51 9 1y 0 5 9 x 1 29 1 7l 0 4 0 5 0 o 4 5 0 2c 1 1f h b 9 7 h e a t 7 q c 19 3 1c d g 9 c 0 b 9 1c d d 0 9 1 3 9 y 2 1f 0 2 2 3 1 6 1 2 0 16 4 6 1 6l 7 2 1 3 9 fmt 0 ki f h f 4 1 p 2 5d 9 12 0 12 0 ig 0 6b 0 46 4 86 9 120 2 2 1 6 3 15 2 5 0 4m 1 fy 3 9 9 7 9 w 4 8u 1 28 3 1z a 1e 3 3f 2 1i e w a 3 1 b 3 1a a 8 0 1a 9 7 2 11 d 2 9 6 1 19 0 d 2 1d d 9 3 2 b 2b b 7 0 3 0 4e b 6 9 7 3 1k 1 2 6 3 1 3 2 a 0 b 1 3 6 4 4 1w 8 2 0 3 0 2 3 2 4 2 0 f 1 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m e 5 9 6r e 4m 9 1z 5 2 1 3 3 2 0 2 1 d 9 3c 6 3 6 4 0 t 9 15 6 2 3 9 0 a a 1b f 9j 9 1i 7 2 7 h 9 1l l 2 d 3f 5 4 0 2 1 2 6 2 0 9 9 1d 4 2 1 2 4 9 9 96 3 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 4 4 5 9 7 3 6 v 3 45 2 13e 1d e9 1i 5 1d 9 0 f 0 n 4 2 e 11t 6 2 g 3 6 2 1 2 4 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 k6 6 32 6 6 9 3o7 9 gvt3 6n")))))}function cK(t){return cH(t,null!=e?e:e=cX("4q 0 b 0 5 0 6 m 2 u 2 cp 5 b f 4 8 0 2 0 3m 4 2 1 3 3 2 0 7 0 2 2 2 0 2 j 2 2a 2 3u 9 4l 2 11 3 0 7 14 20 q 5 3 1a 16 10 1 2 2q 2 0 g 1 8 1 b 2 3 0 h 0 2 t u 2g c 0 p w a 1 5 0 6 l 5 0 a 0 4 0 o o 8 a 6 n 2 5 i 15 1n 1h 4 0 j 0 8 9 g f 5 7 3 1 3 l 2 6 2 0 4 3 4 0 h 0 e 1 2 2 f 1 b 0 9 5 5 1 3 l 2 6 2 1 2 1 2 1 w 3 2 0 k 2 h 8 2 2 2 l 2 6 2 1 2 4 4 0 j 0 g 1 o 0 c 7 3 1 3 l 2 6 2 1 2 4 4 0 v 1 2 2 g 0 i 0 2 5 4 2 2 3 4 1 2 0 2 1 4 1 4 2 4 b n 0 1h 7 2 2 2 m 2 f 4 0 r 2 3 0 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 w 1 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 h c 2u 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 1 d 11 2 0 6 0 3 1j 8 0 h m a 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 fb 2 q 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 1u 3 1 2 0 2 7 m f 2 2 2 3 2 m u 1f f 1d 1r 5 4 0 2 1 c r b m q s 8 1a t 0 h 4 2 9 b 4 2 14 o 2 2 7 l m 4 0 4 1d 2 0 4 1 3 4 3 0 2 0 p 2 3 a 8 2 d 5 3 5 3 5 a 6 2 6 2 16 2 d 7 36 u 8mb d m 5 1c 6it a5 3 2x 13 6 d 4 6 0 2 9 2 c 2 4 2 0 2 1 2 1 2 2z y a2 j 1r 3 1h 15 b 39 4 2 3q 11 p 7 p c 2g 4 5 3 5 3 5 3 2 10 b 2 p 2 i 2 1 2 e 3 d z 3e 1y 1g 7g s 4 1c 1c v e t 6 11 b t 3 z 5 7 2 4 17 4d j z 5 z 5 13 9 1f d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 5 3 0 2 17 2 1 4 0 3 m b m a u 1u i 2 1 b l b p 1z 1j 7 1 1t 0 g 3 2 2 2 s 17 s 4 s 10 7 2 r s 1h b l b i e h 33 20 1k 1e e 1e e z 13 r a m 6z 15 7 1 h 2 1o s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 18 x o r z u 0 3 0 9 y 4 0 d 1b f 3 m 0 2 0 10 h 2 o k 1 1s 6 2 0 2 3 2 e 2 9 8 1a 13 7 3 1 3 l 2 6 2 1 2 4 4 0 j 0 d 4 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 1g j 3 l 2 v 1b l 1 2 0 55 1a 16 3 11 1b l 0 1o 16 e 0 20 q 12 6 56 17 39 1r w 7 3 0 3 7 2 1 2 n g 0 2 0 2n 7 3 12 h 0 2 0 t 0 b 13 8 0 m 0 c 19 k 0 j 20 5k w w 8 2 10 i 0 1e t 35 6 2 1 2 11 m 0 q 5 2 1 2 v f 0 94 i g 0 2 c 2 x 3h 0 28 pl 2v 32 i 5f 219 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r 3l 22 6 0 1v c 1t 1 2 0 t 4qf 9 yd 16 9 6w8 3 2 6 2 1 2 82 g 0 u 2 3 0 f 3 9 az 1s5 2y 6 c 4 8 8 9 4mf 2c 2 1y 2 1 3 0 3 1 3 3 2 b 2 0 2 6 2 1s 2 3 3 7 2 6 2 r 2 3 2 4 2 0 4 6 2 9f 3 o 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 u 2 o 2 7 1f9 u 7 5 7a 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 ds 6 2 3 2 1 2 e 2 5g 1o 1v 8 0 xh 3 2 q 2 1 2 0 3 0 2 9 2 3 2 0 2 0 7 0 5 0 2 0 2 0 2 2 2 1 2 0 3 0 2 0 2 0 2 0 2 0 2 1 2 0 3 3 2 6 2 3 2 3 2 0 2 9 2 g 6 2 2 4 2 g 3et wyn x 37d 7 65 3 4g1 f 5rk g h9 1wj f1 15v 3t6 6 38f"))}function cH(e,t){let r=0,n=t.length/2|0,u=0,a=0,i=0;for(;r<n;)if(a=t[2*(u=(r+n)/2|0)],i=t[2*u+1],e<a)n=u;else{if(!(e>i))return!0;r=u+1}return!1}function cX(e){let t=0;return e.split(" ").map(e=>t+=0|parseInt(e,36))}class cJ{constructor(e,t,r,n,u,a,i,o){this._raw2018=e,this._raw2019=t,this._raw2020=r,this._raw2021=n,this._raw2022=u,this._raw2023=a,this._raw2024=i,this._raw2025=o}get es2018(){var e;return null!==(e=this._set2018)&&void 0!==e?e:this._set2018=new Set(this._raw2018.split(" "))}get es2019(){var e;return null!==(e=this._set2019)&&void 0!==e?e:this._set2019=new Set(this._raw2019.split(" "))}get es2020(){var e;return null!==(e=this._set2020)&&void 0!==e?e:this._set2020=new Set(this._raw2020.split(" "))}get es2021(){var e;return null!==(e=this._set2021)&&void 0!==e?e:this._set2021=new Set(this._raw2021.split(" "))}get es2022(){var e;return null!==(e=this._set2022)&&void 0!==e?e:this._set2022=new Set(this._raw2022.split(" "))}get es2023(){var e;return null!==(e=this._set2023)&&void 0!==e?e:this._set2023=new Set(this._raw2023.split(" "))}get es2024(){var e;return null!==(e=this._set2024)&&void 0!==e?e:this._set2024=new Set(this._raw2024.split(" "))}get es2025(){var e;return null!==(e=this._set2025)&&void 0!==e?e:this._set2025=new Set(this._raw2025.split(" "))}}const cQ=new Set(["General_Category","gc"]),c0=new Set(["Script","Script_Extensions","sc","scx"]),c1=new cJ("C Cased_Letter Cc Cf Close_Punctuation Cn Co Combining_Mark Connector_Punctuation Control Cs Currency_Symbol Dash_Punctuation Decimal_Number Enclosing_Mark Final_Punctuation Format Initial_Punctuation L LC Letter Letter_Number Line_Separator Ll Lm Lo Lowercase_Letter Lt Lu M Mark Math_Symbol Mc Me Mn Modifier_Letter Modifier_Symbol N Nd Nl No Nonspacing_Mark Number Open_Punctuation Other Other_Letter Other_Number Other_Punctuation Other_Symbol P Paragraph_Separator Pc Pd Pe Pf Pi Po Private_Use Ps Punctuation S Sc Separator Sk Sm So Space_Separator Spacing_Mark Surrogate Symbol Titlecase_Letter Unassigned Uppercase_Letter Z Zl Zp Zs cntrl digit punct","","","","","","",""),c2=new cJ("Adlam Adlm Aghb Ahom Anatolian_Hieroglyphs Arab Arabic Armenian Armi Armn Avestan Avst Bali Balinese Bamu Bamum Bass Bassa_Vah Batak Batk Beng Bengali Bhaiksuki Bhks Bopo Bopomofo Brah Brahmi Brai Braille Bugi Buginese Buhd Buhid Cakm Canadian_Aboriginal Cans Cari Carian Caucasian_Albanian Chakma Cham Cher Cherokee Common Copt Coptic Cprt Cuneiform Cypriot Cyrillic Cyrl Deseret Deva Devanagari Dsrt Dupl Duployan Egyp Egyptian_Hieroglyphs Elba Elbasan Ethi Ethiopic Geor Georgian Glag Glagolitic Gonm Goth Gothic Gran Grantha Greek Grek Gujarati Gujr Gurmukhi Guru Han Hang Hangul Hani Hano Hanunoo Hatr Hatran Hebr Hebrew Hira Hiragana Hluw Hmng Hung Imperial_Aramaic Inherited Inscriptional_Pahlavi Inscriptional_Parthian Ital Java Javanese Kaithi Kali Kana Kannada Katakana Kayah_Li Khar Kharoshthi Khmer Khmr Khoj Khojki Khudawadi Knda Kthi Lana Lao Laoo Latin Latn Lepc Lepcha Limb Limbu Lina Linb Linear_A Linear_B Lisu Lyci Lycian Lydi Lydian Mahajani Mahj Malayalam Mand Mandaic Mani Manichaean Marc Marchen Masaram_Gondi Meetei_Mayek Mend Mende_Kikakui Merc Mero Meroitic_Cursive Meroitic_Hieroglyphs Miao Mlym Modi Mong Mongolian Mro Mroo Mtei Mult Multani Myanmar Mymr Nabataean Narb Nbat New_Tai_Lue Newa Nko Nkoo Nshu Nushu Ogam Ogham Ol_Chiki Olck Old_Hungarian Old_Italic Old_North_Arabian Old_Permic Old_Persian Old_South_Arabian Old_Turkic Oriya Orkh Orya Osage Osge Osma Osmanya Pahawh_Hmong Palm Palmyrene Pau_Cin_Hau Pauc Perm Phag Phags_Pa Phli Phlp Phnx Phoenician Plrd Prti Psalter_Pahlavi Qaac Qaai Rejang Rjng Runic Runr Samaritan Samr Sarb Saur Saurashtra Sgnw Sharada Shavian Shaw Shrd Sidd Siddham SignWriting Sind Sinh Sinhala Sora Sora_Sompeng Soyo Soyombo Sund Sundanese Sylo Syloti_Nagri Syrc Syriac Tagalog Tagb Tagbanwa Tai_Le Tai_Tham Tai_Viet Takr Takri Tale Talu Tamil Taml Tang Tangut Tavt Telu Telugu Tfng Tglg Thaa Thaana Thai Tibetan Tibt Tifinagh Tirh Tirhuta Ugar Ugaritic Vai Vaii Wara Warang_Citi Xpeo Xsux Yi Yiii Zanabazar_Square Zanb Zinh Zyyy","Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo","Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho","Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi","Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi","Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz","",""),c3=new cJ("AHex ASCII ASCII_Hex_Digit Alpha Alphabetic Any Assigned Bidi_C Bidi_Control Bidi_M Bidi_Mirrored CI CWCF CWCM CWKCF CWL CWT CWU Case_Ignorable Cased Changes_When_Casefolded Changes_When_Casemapped Changes_When_Lowercased Changes_When_NFKC_Casefolded Changes_When_Titlecased Changes_When_Uppercased DI Dash Default_Ignorable_Code_Point Dep Deprecated Dia Diacritic Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Ext Extender Gr_Base Gr_Ext Grapheme_Base Grapheme_Extend Hex Hex_Digit IDC IDS IDSB IDST IDS_Binary_Operator IDS_Trinary_Operator ID_Continue ID_Start Ideo Ideographic Join_C Join_Control LOE Logical_Order_Exception Lower Lowercase Math NChar Noncharacter_Code_Point Pat_Syn Pat_WS Pattern_Syntax Pattern_White_Space QMark Quotation_Mark RI Radical Regional_Indicator SD STerm Sentence_Terminal Soft_Dotted Term Terminal_Punctuation UIdeo Unified_Ideograph Upper Uppercase VS Variation_Selector White_Space XIDC XIDS XID_Continue XID_Start space","Extended_Pictographic","","EBase EComp EMod EPres ExtPict","","","",""),c4=new cJ("","","","","","","Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence","");function c5(e,t,r){return cQ.has(t)?e>=2018&&c1.es2018.has(r):!!c0.has(t)&&(e>=2018&&c2.es2018.has(r)||e>=2019&&c2.es2019.has(r)||e>=2020&&c2.es2020.has(r)||e>=2021&&c2.es2021.has(r)||e>=2022&&c2.es2022.has(r)||e>=2023&&c2.es2023.has(r))}function c8(e){return e>=65&&e<=90||e>=97&&e<=122}function c6(e){return e>=48&&e<=57}function c9(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function c7(e){return e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:e-48}function fe(e){return e>=55296&&e<=56319}function ft(e){return e>=56320&&e<=57343}function fr(e,t){return(e-55296)*1024+(t-56320)+65536}class fn{constructor(){this.groupName=new Set}clear(){this.groupName.clear()}isEmpty(){return!this.groupName.size}hasInPattern(e){return this.groupName.has(e)}hasInScope(e){return this.hasInPattern(e)}addToScope(e){this.groupName.add(e)}enterDisjunction(){}enterAlternative(){}leaveDisjunction(){}}class fu{constructor(e,t){this.parent=e,this.base=null!=t?t:this}separatedFrom(e){var t,r;return!!(this.base===e.base&&this!==e||e.parent&&this.separatedFrom(e.parent))||null!==(r=null===(t=this.parent)||void 0===t?void 0:t.separatedFrom(e))&&void 0!==r&&r}child(){return new fu(this,null)}sibling(){return new fu(this.parent,this.base)}}class fa{constructor(){this.branchID=new fu(null,null),this.groupNames=new Map}clear(){this.branchID=new fu(null,null),this.groupNames.clear()}isEmpty(){return!this.groupNames.size}enterDisjunction(){this.branchID=this.branchID.child()}enterAlternative(e){0!==e&&(this.branchID=this.branchID.sibling())}leaveDisjunction(){this.branchID=this.branchID.parent}hasInPattern(e){return this.groupNames.has(e)}hasInScope(e){let t=this.groupNames.get(e);if(!t)return!1;for(let e of t)if(!e.separatedFrom(this.branchID))return!0;return!1}addToScope(e){let t=this.groupNames.get(e);if(t){t.push(this.branchID);return}this.groupNames.set(e,[this.branchID])}}const fi={at:(e,t,r)=>r<t?e.charCodeAt(r):-1,width:e=>1},fo={at:(e,t,r)=>r<t?e.codePointAt(r):-1,width:e=>e>65535?2:1};class fs{constructor(){this._impl=fi,this._s="",this._i=0,this._end=0,this._cp1=-1,this._w1=1,this._cp2=-1,this._w2=1,this._cp3=-1,this._w3=1,this._cp4=-1}get source(){return this._s}get index(){return this._i}get currentCodePoint(){return this._cp1}get nextCodePoint(){return this._cp2}get nextCodePoint2(){return this._cp3}get nextCodePoint3(){return this._cp4}reset(e,t,r,n){this._impl=n?fo:fi,this._s=e,this._end=r,this.rewind(t)}rewind(e){let t=this._impl;this._i=e,this._cp1=t.at(this._s,this._end,e),this._w1=t.width(this._cp1),this._cp2=t.at(this._s,this._end,e+this._w1),this._w2=t.width(this._cp2),this._cp3=t.at(this._s,this._end,e+this._w1+this._w2),this._w3=t.width(this._cp3),this._cp4=t.at(this._s,this._end,e+this._w1+this._w2+this._w3)}advance(){if(-1!==this._cp1){let e=this._impl;this._i+=this._w1,this._cp1=this._cp2,this._w1=this._w2,this._cp2=this._cp3,this._w2=e.width(this._cp2),this._cp3=this._cp4,this._w3=e.width(this._cp3),this._cp4=e.at(this._s,this._end,this._i+this._w1+this._w2+this._w3)}}eat(e){return this._cp1===e&&(this.advance(),!0)}eat2(e,t){return this._cp1===e&&this._cp2===t&&(this.advance(),this.advance(),!0)}eat3(e,t,r){return this._cp1===e&&this._cp2===t&&this._cp3===r&&(this.advance(),this.advance(),this.advance(),!0)}}class fd extends SyntaxError{constructor(e,t){super(e),this.index=t}}const fl=new Set([94,36,92,46,42,43,63,40,41,91,93,123,125,124]),fc=new Set([38,33,35,36,37,42,43,44,46,58,59,60,61,62,63,64,94,96,126]),ff=new Set([40,41,91,93,123,125,47,45,92,124]),fp=new Set([38,45,33,35,37,44,58,59,60,61,62,64,96,126]),fh={global:103,ignoreCase:105,multiline:109,unicode:117,sticky:121,dotAll:115,hasIndices:100,unicodeSets:118},fm=Object.fromEntries(Object.entries(fh).map(([e,t])=>[t,e]));function fg(e){return c8(e)||95===e}class fy{constructor(e){this._reader=new fs,this._unicodeMode=!1,this._unicodeSetsMode=!1,this._nFlag=!1,this._lastIntValue=0,this._lastRange={min:0,max:Number.POSITIVE_INFINITY},this._lastStrValue="",this._lastAssertionIsQuantifiable=!1,this._numCapturingParens=0,this._backreferenceNames=new Set,this._srcCtx=null,this._options=null!=e?e:{},this._groupSpecifiers=this.ecmaVersion>=2025?new fa:new fn}validateLiteral(e,t=0,r=e.length){if(this._srcCtx={source:e,start:t,end:r,kind:"literal"},this._unicodeSetsMode=this._unicodeMode=this._nFlag=!1,this.reset(e,t,r),this.onLiteralEnter(t),this.eat(47)&&this.eatRegExpBody()&&this.eat(47)){let n=this.index,u=e.includes("u",n),a=e.includes("v",n);this.validateFlagsInternal(e,n,r),this.validatePatternInternal(e,t+1,n-1,{unicode:u,unicodeSets:a})}else if(t>=r)this.raise("Empty");else{let e=String.fromCodePoint(this.currentCodePoint);this.raise(`Unexpected character '${e}'`)}this.onLiteralLeave(t,r)}validateFlags(e,t=0,r=e.length){this._srcCtx={source:e,start:t,end:r,kind:"flags"},this.validateFlagsInternal(e,t,r)}validatePattern(e,t=0,r=e.length,n){this._srcCtx={source:e,start:t,end:r,kind:"pattern"},this.validatePatternInternal(e,t,r,n)}validatePatternInternal(e,t=0,r=e.length,n){let u=this._parseFlagsOptionToMode(n,r);this._unicodeMode=u.unicodeMode,this._nFlag=u.nFlag,this._unicodeSetsMode=u.unicodeSetsMode,this.reset(e,t,r),this.consumePattern(),this._nFlag||!(this.ecmaVersion>=2018)||this._groupSpecifiers.isEmpty()||(this._nFlag=!0,this.rewind(t),this.consumePattern())}validateFlagsInternal(e,t,r){let n=this.parseFlags(e,t,r);this.onRegExpFlags(t,r,n)}_parseFlagsOptionToMode(e,t){let r=!1,n=!1;return e&&this.ecmaVersion>=2015&&("object"==typeof e?(r=!!e.unicode,this.ecmaVersion>=2024&&(n=!!e.unicodeSets)):r=e),r&&n&&this.raise("Invalid regular expression flags",{index:t+1,unicode:r,unicodeSets:n}),{unicodeMode:r||n,nFlag:r&&this.ecmaVersion>=2018||n||!!(this._options.strict&&this.ecmaVersion>=2023),unicodeSetsMode:n}}get strict(){return!!this._options.strict||this._unicodeMode}get ecmaVersion(){var e;return null!==(e=this._options.ecmaVersion)&&void 0!==e?e:2025}onLiteralEnter(e){this._options.onLiteralEnter&&this._options.onLiteralEnter(e)}onLiteralLeave(e,t){this._options.onLiteralLeave&&this._options.onLiteralLeave(e,t)}onRegExpFlags(e,t,r){this._options.onRegExpFlags&&this._options.onRegExpFlags(e,t,r),this._options.onFlags&&this._options.onFlags(e,t,r.global,r.ignoreCase,r.multiline,r.unicode,r.sticky,r.dotAll,r.hasIndices)}onPatternEnter(e){this._options.onPatternEnter&&this._options.onPatternEnter(e)}onPatternLeave(e,t){this._options.onPatternLeave&&this._options.onPatternLeave(e,t)}onDisjunctionEnter(e){this._options.onDisjunctionEnter&&this._options.onDisjunctionEnter(e)}onDisjunctionLeave(e,t){this._options.onDisjunctionLeave&&this._options.onDisjunctionLeave(e,t)}onAlternativeEnter(e,t){this._options.onAlternativeEnter&&this._options.onAlternativeEnter(e,t)}onAlternativeLeave(e,t,r){this._options.onAlternativeLeave&&this._options.onAlternativeLeave(e,t,r)}onGroupEnter(e){this._options.onGroupEnter&&this._options.onGroupEnter(e)}onGroupLeave(e,t){this._options.onGroupLeave&&this._options.onGroupLeave(e,t)}onModifiersEnter(e){this._options.onModifiersEnter&&this._options.onModifiersEnter(e)}onModifiersLeave(e,t){this._options.onModifiersLeave&&this._options.onModifiersLeave(e,t)}onAddModifiers(e,t,r){this._options.onAddModifiers&&this._options.onAddModifiers(e,t,r)}onRemoveModifiers(e,t,r){this._options.onRemoveModifiers&&this._options.onRemoveModifiers(e,t,r)}onCapturingGroupEnter(e,t){this._options.onCapturingGroupEnter&&this._options.onCapturingGroupEnter(e,t)}onCapturingGroupLeave(e,t,r){this._options.onCapturingGroupLeave&&this._options.onCapturingGroupLeave(e,t,r)}onQuantifier(e,t,r,n,u){this._options.onQuantifier&&this._options.onQuantifier(e,t,r,n,u)}onLookaroundAssertionEnter(e,t,r){this._options.onLookaroundAssertionEnter&&this._options.onLookaroundAssertionEnter(e,t,r)}onLookaroundAssertionLeave(e,t,r,n){this._options.onLookaroundAssertionLeave&&this._options.onLookaroundAssertionLeave(e,t,r,n)}onEdgeAssertion(e,t,r){this._options.onEdgeAssertion&&this._options.onEdgeAssertion(e,t,r)}onWordBoundaryAssertion(e,t,r,n){this._options.onWordBoundaryAssertion&&this._options.onWordBoundaryAssertion(e,t,r,n)}onAnyCharacterSet(e,t,r){this._options.onAnyCharacterSet&&this._options.onAnyCharacterSet(e,t,r)}onEscapeCharacterSet(e,t,r,n){this._options.onEscapeCharacterSet&&this._options.onEscapeCharacterSet(e,t,r,n)}onUnicodePropertyCharacterSet(e,t,r,n,u,a,i){this._options.onUnicodePropertyCharacterSet&&this._options.onUnicodePropertyCharacterSet(e,t,r,n,u,a,i)}onCharacter(e,t,r){this._options.onCharacter&&this._options.onCharacter(e,t,r)}onBackreference(e,t,r){this._options.onBackreference&&this._options.onBackreference(e,t,r)}onCharacterClassEnter(e,t,r){this._options.onCharacterClassEnter&&this._options.onCharacterClassEnter(e,t,r)}onCharacterClassLeave(e,t,r){this._options.onCharacterClassLeave&&this._options.onCharacterClassLeave(e,t,r)}onCharacterClassRange(e,t,r,n){this._options.onCharacterClassRange&&this._options.onCharacterClassRange(e,t,r,n)}onClassIntersection(e,t){this._options.onClassIntersection&&this._options.onClassIntersection(e,t)}onClassSubtraction(e,t){this._options.onClassSubtraction&&this._options.onClassSubtraction(e,t)}onClassStringDisjunctionEnter(e){this._options.onClassStringDisjunctionEnter&&this._options.onClassStringDisjunctionEnter(e)}onClassStringDisjunctionLeave(e,t){this._options.onClassStringDisjunctionLeave&&this._options.onClassStringDisjunctionLeave(e,t)}onStringAlternativeEnter(e,t){this._options.onStringAlternativeEnter&&this._options.onStringAlternativeEnter(e,t)}onStringAlternativeLeave(e,t,r){this._options.onStringAlternativeLeave&&this._options.onStringAlternativeLeave(e,t,r)}get index(){return this._reader.index}get currentCodePoint(){return this._reader.currentCodePoint}get nextCodePoint(){return this._reader.nextCodePoint}get nextCodePoint2(){return this._reader.nextCodePoint2}get nextCodePoint3(){return this._reader.nextCodePoint3}reset(e,t,r){this._reader.reset(e,t,r,this._unicodeMode)}rewind(e){this._reader.rewind(e)}advance(){this._reader.advance()}eat(e){return this._reader.eat(e)}eat2(e,t){return this._reader.eat2(e,t)}eat3(e,t,r){return this._reader.eat3(e,t,r)}raise(e,t){var r,n,u;throw function(e,t,r,n){let u="";if("literal"===e.kind){let t=e.source.slice(e.start,e.end);t&&(u=`: ${t}`)}else if("pattern"===e.kind){let r=e.source.slice(e.start,e.end),n=`${t.unicode?"u":""}${t.unicodeSets?"v":""}`;u=`: /${r}/${n}`}return new fd(`Invalid regular expression${u}: ${n}`,r)}(this._srcCtx,{unicode:null!==(r=null==t?void 0:t.unicode)&&void 0!==r?r:this._unicodeMode&&!this._unicodeSetsMode,unicodeSets:null!==(n=null==t?void 0:t.unicodeSets)&&void 0!==n?n:this._unicodeSetsMode},null!==(u=null==t?void 0:t.index)&&void 0!==u?u:this.index,e)}eatRegExpBody(){let e=this.index,t=!1,r=!1;for(;;){var n;let u=this.currentCodePoint;if(-1===u||10===(n=u)||13===n||8232===n||8233===n){let e=t?"character class":"regular expression";this.raise(`Unterminated ${e}`)}if(r)r=!1;else if(92===u)r=!0;else if(91===u)t=!0;else if(93===u)t=!1;else if(47===u&&!t||42===u&&this.index===e)break;this.advance()}return this.index!==e}consumePattern(){let e=this.index;this._numCapturingParens=this.countCapturingParens(),this._groupSpecifiers.clear(),this._backreferenceNames.clear(),this.onPatternEnter(e),this.consumeDisjunction();let t=this.currentCodePoint;if(-1!==this.currentCodePoint){41===t&&this.raise("Unmatched ')'"),92===t&&this.raise("\\ at end of pattern"),(93===t||125===t)&&this.raise("Lone quantifier brackets");let e=String.fromCodePoint(t);this.raise(`Unexpected character '${e}'`)}for(let e of this._backreferenceNames)this._groupSpecifiers.hasInPattern(e)||this.raise("Invalid named capture referenced");this.onPatternLeave(e,this.index)}countCapturingParens(){let e=this.index,t=!1,r=!1,n=0,u=0;for(;-1!==(u=this.currentCodePoint);)r?r=!1:92===u?r=!0:91===u?t=!0:93===u?t=!1:40!==u||t||63===this.nextCodePoint&&(60!==this.nextCodePoint2||61===this.nextCodePoint3||33===this.nextCodePoint3)||(n+=1),this.advance();return this.rewind(e),n}consumeDisjunction(){let e=this.index,t=0;this._groupSpecifiers.enterDisjunction(),this.onDisjunctionEnter(e);do this.consumeAlternative(t++);while(this.eat(124));this.consumeQuantifier(!0)&&this.raise("Nothing to repeat"),this.eat(123)&&this.raise("Lone quantifier brackets"),this.onDisjunctionLeave(e,this.index),this._groupSpecifiers.leaveDisjunction()}consumeAlternative(e){let t=this.index;for(this._groupSpecifiers.enterAlternative(e),this.onAlternativeEnter(t,e);-1!==this.currentCodePoint&&this.consumeTerm(););this.onAlternativeLeave(t,this.index,e)}consumeTerm(){return this._unicodeMode||this.strict?this.consumeAssertion()||this.consumeAtom()&&this.consumeOptionalQuantifier():this.consumeAssertion()&&(!this._lastAssertionIsQuantifiable||this.consumeOptionalQuantifier())||this.consumeExtendedAtom()&&this.consumeOptionalQuantifier()}consumeOptionalQuantifier(){return this.consumeQuantifier(),!0}consumeAssertion(){let e=this.index;if(this._lastAssertionIsQuantifiable=!1,this.eat(94))return this.onEdgeAssertion(e,this.index,"start"),!0;if(this.eat(36))return this.onEdgeAssertion(e,this.index,"end"),!0;if(this.eat2(92,66))return this.onWordBoundaryAssertion(e,this.index,"word",!0),!0;if(this.eat2(92,98))return this.onWordBoundaryAssertion(e,this.index,"word",!1),!0;if(this.eat2(40,63)){let t=this.ecmaVersion>=2018&&this.eat(60),r=!1;if(this.eat(61)||(r=this.eat(33))){let n=t?"lookbehind":"lookahead";return this.onLookaroundAssertionEnter(e,n,r),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this._lastAssertionIsQuantifiable=!t&&!this.strict,this.onLookaroundAssertionLeave(e,this.index,n,r),!0}this.rewind(e)}return!1}consumeQuantifier(e=!1){let t=this.index,r=0,n=0,u=!1;if(this.eat(42))r=0,n=Number.POSITIVE_INFINITY;else if(this.eat(43))r=1,n=Number.POSITIVE_INFINITY;else if(this.eat(63))r=0,n=1;else{if(!this.eatBracedQuantifier(e))return!1;({min:r,max:n}=this._lastRange)}return u=!this.eat(63),e||this.onQuantifier(t,this.index,r,n,u),!0}eatBracedQuantifier(e){let t=this.index;if(this.eat(123)){if(this.eatDecimalDigits()){let t=this._lastIntValue,r=t;if(this.eat(44)&&(r=this.eatDecimalDigits()?this._lastIntValue:Number.POSITIVE_INFINITY),this.eat(125))return!e&&r<t&&this.raise("numbers out of order in {} quantifier"),this._lastRange={min:t,max:r},!0}!e&&(this._unicodeMode||this.strict)&&this.raise("Incomplete quantifier"),this.rewind(t)}return!1}consumeAtom(){return this.consumePatternCharacter()||this.consumeDot()||this.consumeReverseSolidusAtomEscape()||!!this.consumeCharacterClass()||this.consumeCapturingGroup()||this.consumeUncapturingGroup()}consumeDot(){return!!this.eat(46)&&(this.onAnyCharacterSet(this.index-1,this.index,"any"),!0)}consumeReverseSolidusAtomEscape(){let e=this.index;if(this.eat(92)){if(this.consumeAtomEscape())return!0;this.rewind(e)}return!1}consumeUncapturingGroup(){let e=this.index;return!!this.eat2(40,63)&&(this.onGroupEnter(e),this.ecmaVersion>=2025&&this.consumeModifiers(),this.eat(58)||(this.rewind(e+1),this.raise("Invalid group")),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this.onGroupLeave(e,this.index),!0)}consumeModifiers(){let e=this.index,t=this.eatModifiers(),r=this.index,n=this.eat(45);if(!t&&!n)return!1;this.onModifiersEnter(e);let u=this.parseModifiers(e,r);if(this.onAddModifiers(e,r,u),n){let e=this.index;this.eatModifiers()||t||58!==this.currentCodePoint||this.raise("Invalid empty flags");let r=this.parseModifiers(e,this.index);for(let[e]of Object.entries(r).filter(([,e])=>e))u[e]&&this.raise(`Duplicated flag '${String.fromCodePoint(fh[e])}'`);this.onRemoveModifiers(e,this.index,r)}return this.onModifiersLeave(e,this.index),!0}consumeCapturingGroup(){let e=this.index;if(this.eat(40)){let t=null;if(this.ecmaVersion>=2018){if(this.consumeGroupSpecifier())t=this._lastStrValue;else if(63===this.currentCodePoint)return this.rewind(e),!1}else if(63===this.currentCodePoint)return this.rewind(e),!1;return this.onCapturingGroupEnter(e,t),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this.onCapturingGroupLeave(e,this.index,t),!0}return!1}consumeExtendedAtom(){return this.consumeDot()||this.consumeReverseSolidusAtomEscape()||this.consumeReverseSolidusFollowedByC()||!!this.consumeCharacterClass()||this.consumeCapturingGroup()||this.consumeUncapturingGroup()||this.consumeInvalidBracedQuantifier()||this.consumeExtendedPatternCharacter()}consumeReverseSolidusFollowedByC(){let e=this.index;return 92===this.currentCodePoint&&99===this.nextCodePoint&&(this._lastIntValue=this.currentCodePoint,this.advance(),this.onCharacter(e,this.index,92),!0)}consumeInvalidBracedQuantifier(){return this.eatBracedQuantifier(!0)&&this.raise("Nothing to repeat"),!1}consumePatternCharacter(){let e=this.index,t=this.currentCodePoint;return!(-1===t||fl.has(t))&&(this.advance(),this.onCharacter(e,this.index,t),!0)}consumeExtendedPatternCharacter(){let e=this.index,t=this.currentCodePoint;return -1!==t&&94!==t&&36!==t&&92!==t&&46!==t&&42!==t&&43!==t&&63!==t&&40!==t&&41!==t&&91!==t&&124!==t&&(this.advance(),this.onCharacter(e,this.index,t),!0)}consumeGroupSpecifier(){let e=this.index;if(this.eat(63)){if(this.eatGroupName()){if(!this._groupSpecifiers.hasInScope(this._lastStrValue))return this._groupSpecifiers.addToScope(this._lastStrValue),!0;this.raise("Duplicate capture group name")}this.rewind(e)}return!1}consumeAtomEscape(){return!!(this.consumeBackreference()||this.consumeCharacterClassEscape()||this.consumeCharacterEscape()||this._nFlag&&this.consumeKGroupName())||((this.strict||this._unicodeMode)&&this.raise("Invalid escape"),!1)}consumeBackreference(){let e=this.index;if(this.eatDecimalEscape()){let t=this._lastIntValue;if(t<=this._numCapturingParens)return this.onBackreference(e-1,this.index,t),!0;(this.strict||this._unicodeMode)&&this.raise("Invalid escape"),this.rewind(e)}return!1}consumeCharacterClassEscape(){var e;let t=this.index;if(this.eat(100))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"digit",!1),{};if(this.eat(68))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"digit",!0),{};if(this.eat(115))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"space",!1),{};if(this.eat(83))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"space",!0),{};if(this.eat(119))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"word",!1),{};if(this.eat(87))return this._lastIntValue=-1,this.onEscapeCharacterSet(t-1,this.index,"word",!0),{};let r=!1;if(this._unicodeMode&&this.ecmaVersion>=2018&&(this.eat(112)||(r=this.eat(80)))){this._lastIntValue=-1;let n=null;if(this.eat(123)&&(n=this.eatUnicodePropertyValueExpression())&&this.eat(125))return r&&n.strings&&this.raise("Invalid property name"),this.onUnicodePropertyCharacterSet(t-1,this.index,"property",n.key,n.value,r,null!==(e=n.strings)&&void 0!==e&&e),{mayContainStrings:n.strings};this.raise("Invalid property name")}return null}consumeCharacterEscape(){let e=this.index;return!!(this.eatControlEscape()||this.eatCControlLetter()||this.eatZero()||this.eatHexEscapeSequence()||this.eatRegExpUnicodeEscapeSequence()||!this.strict&&!this._unicodeMode&&this.eatLegacyOctalEscapeSequence()||this.eatIdentityEscape())&&(this.onCharacter(e-1,this.index,this._lastIntValue),!0)}consumeKGroupName(){let e=this.index;if(this.eat(107)){if(this.eatGroupName()){let t=this._lastStrValue;return this._backreferenceNames.add(t),this.onBackreference(e-1,this.index,t),!0}this.raise("Invalid named reference")}return!1}consumeCharacterClass(){let e=this.index;if(this.eat(91)){let t=this.eat(94);this.onCharacterClassEnter(e,t,this._unicodeSetsMode);let r=this.consumeClassContents();return this.eat(93)||(-1===this.currentCodePoint&&this.raise("Unterminated character class"),this.raise("Invalid character in character class")),t&&r.mayContainStrings&&this.raise("Negated character class may contain strings"),this.onCharacterClassLeave(e,this.index,t),r}return null}consumeClassContents(){if(this._unicodeSetsMode)return 93===this.currentCodePoint?{}:this.consumeClassSetExpression();let e=this.strict||this._unicodeMode;for(;;){let t=this.index;if(!this.consumeClassAtom())break;let r=this._lastIntValue;if(!this.eat(45))continue;if(this.onCharacter(this.index-1,this.index,45),!this.consumeClassAtom())break;let n=this._lastIntValue;if(-1===r||-1===n){e&&this.raise("Invalid character class");continue}r>n&&this.raise("Range out of order in character class"),this.onCharacterClassRange(t,this.index,r,n)}return{}}consumeClassAtom(){let e=this.index,t=this.currentCodePoint;if(-1!==t&&92!==t&&93!==t)return this.advance(),this._lastIntValue=t,this.onCharacter(e,this.index,this._lastIntValue),!0;if(this.eat(92)){if(this.consumeClassEscape())return!0;if(!this.strict&&99===this.currentCodePoint)return this._lastIntValue=92,this.onCharacter(e,this.index,this._lastIntValue),!0;(this.strict||this._unicodeMode)&&this.raise("Invalid escape"),this.rewind(e)}return!1}consumeClassEscape(){let e=this.index;if(this.eat(98))return this._lastIntValue=8,this.onCharacter(e-1,this.index,this._lastIntValue),!0;if(this._unicodeMode&&this.eat(45))return this._lastIntValue=45,this.onCharacter(e-1,this.index,this._lastIntValue),!0;let t=0;return!this.strict&&!this._unicodeMode&&99===this.currentCodePoint&&(c6(t=this.nextCodePoint)||95===t)?(this.advance(),this.advance(),this._lastIntValue=t%32,this.onCharacter(e-1,this.index,this._lastIntValue),!0):!!this.consumeCharacterClassEscape()||this.consumeCharacterEscape()}consumeClassSetExpression(){let e=this.index,t=!1,r=null;if(this.consumeClassSetCharacter()){if(this.consumeClassSetRangeFromOperator(e))return this.consumeClassUnionRight({}),{};t=!1}else if(r=this.consumeClassSetOperand())t=r.mayContainStrings;else{let e=this.currentCodePoint;92===e&&(this.advance(),this.raise("Invalid escape")),e===this.nextCodePoint&&fc.has(e)&&this.raise("Invalid set operation in character class"),this.raise("Invalid character in character class")}if(this.eat2(38,38)){for(;38!==this.currentCodePoint&&(r=this.consumeClassSetOperand());)if(this.onClassIntersection(e,this.index),r.mayContainStrings||(t=!1),!this.eat2(38,38))return{mayContainStrings:t};this.raise("Invalid character in character class")}if(this.eat2(45,45)){for(;this.consumeClassSetOperand();)if(this.onClassSubtraction(e,this.index),!this.eat2(45,45))return{mayContainStrings:t};this.raise("Invalid character in character class")}return this.consumeClassUnionRight({mayContainStrings:t})}consumeClassUnionRight(e){let t=e.mayContainStrings;for(;;){let e=this.index;if(this.consumeClassSetCharacter()){this.consumeClassSetRangeFromOperator(e);continue}let r=this.consumeClassSetOperand();if(r){r.mayContainStrings&&(t=!0);continue}break}return{mayContainStrings:t}}consumeClassSetRangeFromOperator(e){let t=this.index,r=this._lastIntValue;if(this.eat(45)){if(this.consumeClassSetCharacter()){let t=this._lastIntValue;return(-1===r||-1===t)&&this.raise("Invalid character class"),r>t&&this.raise("Range out of order in character class"),this.onCharacterClassRange(e,this.index,r,t),!0}this.rewind(t)}return!1}consumeClassSetOperand(){let e=null;return(e=this.consumeNestedClass())||(e=this.consumeClassStringDisjunction())?e:this.consumeClassSetCharacter()?{}:null}consumeNestedClass(){let e=this.index;if(this.eat(91)){let t=this.eat(94);this.onCharacterClassEnter(e,t,!0);let r=this.consumeClassContents();return this.eat(93)||this.raise("Unterminated character class"),t&&r.mayContainStrings&&this.raise("Negated character class may contain strings"),this.onCharacterClassLeave(e,this.index,t),r}if(this.eat(92)){let t=this.consumeCharacterClassEscape();if(t)return t;this.rewind(e)}return null}consumeClassStringDisjunction(){let e=this.index;if(this.eat3(92,113,123)){this.onClassStringDisjunctionEnter(e);let t=0,r=!1;do this.consumeClassString(t++).mayContainStrings&&(r=!0);while(this.eat(124));if(this.eat(125))return this.onClassStringDisjunctionLeave(e,this.index),{mayContainStrings:r};this.raise("Unterminated class string disjunction")}return null}consumeClassString(e){let t=this.index,r=0;for(this.onStringAlternativeEnter(t,e);-1!==this.currentCodePoint&&this.consumeClassSetCharacter();)r++;return this.onStringAlternativeLeave(t,this.index,e),{mayContainStrings:1!==r}}consumeClassSetCharacter(){var e;let t=this.index,r=this.currentCodePoint;if((r!==this.nextCodePoint||!fc.has(r))&&-1!==r&&!ff.has(r))return this._lastIntValue=r,this.advance(),this.onCharacter(t,this.index,this._lastIntValue),!0;if(this.eat(92)){if(this.consumeCharacterEscape())return!0;if(e=this.currentCodePoint,fp.has(e))return this._lastIntValue=this.currentCodePoint,this.advance(),this.onCharacter(t,this.index,this._lastIntValue),!0;if(this.eat(98))return this._lastIntValue=8,this.onCharacter(t,this.index,this._lastIntValue),!0;this.rewind(t)}return!1}eatGroupName(){if(this.eat(60)){if(this.eatRegExpIdentifierName()&&this.eat(62))return!0;this.raise("Invalid capture group name")}return!1}eatRegExpIdentifierName(){if(this.eatRegExpIdentifierStart()){for(this._lastStrValue=String.fromCodePoint(this._lastIntValue);this.eatRegExpIdentifierPart();)this._lastStrValue+=String.fromCodePoint(this._lastIntValue);return!0}return!1}eatRegExpIdentifierStart(){var e,t;let r=this.index,n=!this._unicodeMode&&this.ecmaVersion>=2020,u=this.currentCodePoint;return(this.advance(),92===u&&this.eatRegExpUnicodeEscapeSequence(n)?u=this._lastIntValue:n&&fe(u)&&ft(this.currentCodePoint)&&(u=fr(u,this.currentCodePoint),this.advance()),!((t=e=u)<65)&&(t<91||!(t<97)&&(t<123||cK(t)))||36===e||95===e)?(this._lastIntValue=u,!0):(this.index!==r&&this.rewind(r),!1)}eatRegExpIdentifierPart(){var e;let t=this.index,r=!this._unicodeMode&&this.ecmaVersion>=2020,n=this.currentCodePoint;return(this.advance(),92===n&&this.eatRegExpUnicodeEscapeSequence(r)?n=this._lastIntValue:r&&fe(n)&&ft(this.currentCodePoint)&&(n=fr(n,this.currentCodePoint),this.advance()),cZ(e=n)||36===e||8204===e||8205===e)?(this._lastIntValue=n,!0):(this.index!==t&&this.rewind(t),!1)}eatCControlLetter(){let e=this.index;if(this.eat(99)){if(this.eatControlLetter())return!0;this.rewind(e)}return!1}eatZero(){return!(48!==this.currentCodePoint||c6(this.nextCodePoint))&&(this._lastIntValue=0,this.advance(),!0)}eatControlEscape(){return this.eat(102)?(this._lastIntValue=12,!0):this.eat(110)?(this._lastIntValue=10,!0):this.eat(114)?(this._lastIntValue=13,!0):this.eat(116)?(this._lastIntValue=9,!0):!!this.eat(118)&&(this._lastIntValue=11,!0)}eatControlLetter(){let e=this.currentCodePoint;return!!c8(e)&&(this.advance(),this._lastIntValue=e%32,!0)}eatRegExpUnicodeEscapeSequence(e=!1){let t=this.index,r=e||this._unicodeMode;if(this.eat(117)){if(r&&this.eatRegExpUnicodeSurrogatePairEscape()||this.eatFixedHexDigits(4)||r&&this.eatRegExpUnicodeCodePointEscape())return!0;(this.strict||r)&&this.raise("Invalid unicode escape"),this.rewind(t)}return!1}eatRegExpUnicodeSurrogatePairEscape(){let e=this.index;if(this.eatFixedHexDigits(4)){let t=this._lastIntValue;if(fe(t)&&this.eat(92)&&this.eat(117)&&this.eatFixedHexDigits(4)){let e=this._lastIntValue;if(ft(e))return this._lastIntValue=fr(t,e),!0}this.rewind(e)}return!1}eatRegExpUnicodeCodePointEscape(){var e;let t=this.index;return!!(this.eat(123)&&this.eatHexDigits()&&this.eat(125))&&(e=this._lastIntValue)>=0&&e<=1114111||(this.rewind(t),!1)}eatIdentityEscape(){let e=this.currentCodePoint;return!!this.isValidIdentityEscape(e)&&(this._lastIntValue=e,this.advance(),!0)}isValidIdentityEscape(e){return -1!==e&&(this._unicodeMode?fl.has(e)||47===e:this.strict?!cZ(e):this._nFlag?!(99===e||107===e):99!==e)}eatDecimalEscape(){this._lastIntValue=0;let e=this.currentCodePoint;if(e>=49&&e<=57){do this._lastIntValue=10*this._lastIntValue+(e-48),this.advance();while((e=this.currentCodePoint)>=48&&e<=57);return!0}return!1}eatUnicodePropertyValueExpression(){let e=this.index;if(this.eatUnicodePropertyName()&&this.eat(61)){let e=this._lastStrValue;if(this.eatUnicodePropertyValue()){let t=this._lastStrValue;if(c5(this.ecmaVersion,e,t))return{key:e,value:t||null};this.raise("Invalid property name")}}if(this.rewind(e),this.eatLoneUnicodePropertyNameOrValue()){var t;let e=this._lastStrValue;if(c5(this.ecmaVersion,"General_Category",e))return{key:"General_Category",value:e||null};if((t=this.ecmaVersion)>=2018&&c3.es2018.has(e)||t>=2019&&c3.es2019.has(e)||t>=2021&&c3.es2021.has(e))return{key:e,value:null};if(this._unicodeSetsMode&&this.ecmaVersion>=2024&&c4.es2024.has(e))return{key:e,value:null,strings:!0};this.raise("Invalid property name")}return null}eatUnicodePropertyName(){for(this._lastStrValue="";fg(this.currentCodePoint);)this._lastStrValue+=String.fromCodePoint(this.currentCodePoint),this.advance();return""!==this._lastStrValue}eatUnicodePropertyValue(){var e;for(this._lastStrValue="";fg(e=this.currentCodePoint)||c6(e);)this._lastStrValue+=String.fromCodePoint(this.currentCodePoint),this.advance();return""!==this._lastStrValue}eatLoneUnicodePropertyNameOrValue(){return this.eatUnicodePropertyValue()}eatHexEscapeSequence(){let e=this.index;if(this.eat(120)){if(this.eatFixedHexDigits(2))return!0;(this._unicodeMode||this.strict)&&this.raise("Invalid escape"),this.rewind(e)}return!1}eatDecimalDigits(){let e=this.index;for(this._lastIntValue=0;c6(this.currentCodePoint);)this._lastIntValue=10*this._lastIntValue+c7(this.currentCodePoint),this.advance();return this.index!==e}eatHexDigits(){let e=this.index;for(this._lastIntValue=0;c9(this.currentCodePoint);)this._lastIntValue=16*this._lastIntValue+c7(this.currentCodePoint),this.advance();return this.index!==e}eatLegacyOctalEscapeSequence(){if(this.eatOctalDigit()){let e=this._lastIntValue;if(this.eatOctalDigit()){let t=this._lastIntValue;e<=3&&this.eatOctalDigit()?this._lastIntValue=64*e+8*t+this._lastIntValue:this._lastIntValue=8*e+t}else this._lastIntValue=e;return!0}return!1}eatOctalDigit(){let e=this.currentCodePoint;return e>=48&&e<=55?(this.advance(),this._lastIntValue=e-48,!0):(this._lastIntValue=0,!1)}eatFixedHexDigits(e){let t=this.index;this._lastIntValue=0;for(let r=0;r<e;++r){let e=this.currentCodePoint;if(!c9(e))return this.rewind(t),!1;this._lastIntValue=16*this._lastIntValue+c7(e),this.advance()}return!0}eatModifiers(){var e;let t=!1;for(;105===(e=this.currentCodePoint)||109===e||115===e;)this.advance(),t=!0;return t}parseModifiers(e,t){let{ignoreCase:r,multiline:n,dotAll:u}=this.parseFlags(this._reader.source,e,t);return{ignoreCase:r,multiline:n,dotAll:u}}parseFlags(e,t,r){let n={global:!1,ignoreCase:!1,multiline:!1,unicode:!1,sticky:!1,dotAll:!1,hasIndices:!1,unicodeSets:!1},u=new Set;u.add(103),u.add(105),u.add(109),this.ecmaVersion>=2015&&(u.add(117),u.add(121),this.ecmaVersion>=2018&&(u.add(115),this.ecmaVersion>=2022&&(u.add(100),this.ecmaVersion>=2024&&u.add(118))));for(let a=t;a<r;++a){let r=e.charCodeAt(a);if(u.has(r)){let u=fm[r];n[u]&&this.raise(`Duplicated flag '${e[a]}'`,{index:t}),n[u]=!0}else this.raise(`Invalid flag '${e[a]}'`,{index:t})}return n}}const fb={},fE={},fv={};function fx(e){return"Character"===e.type||"CharacterSet"===e.type||"CharacterClass"===e.type||"ExpressionCharacterClass"===e.type||"ClassStringDisjunction"===e.type}class fS{constructor(e){var t;this._node=fb,this._expressionBufferMap=new Map,this._flags=fE,this._backreferences=[],this._capturingGroups=[],this.source="",this.strict=!!(null==e?void 0:e.strict),this.ecmaVersion=null!==(t=null==e?void 0:e.ecmaVersion)&&void 0!==t?t:2025}get pattern(){if("Pattern"!==this._node.type)throw Error("UnknownError");return this._node}get flags(){if("Flags"!==this._flags.type)throw Error("UnknownError");return this._flags}onRegExpFlags(e,t,{global:r,ignoreCase:n,multiline:u,unicode:a,sticky:i,dotAll:o,hasIndices:s,unicodeSets:d}){this._flags={type:"Flags",parent:null,start:e,end:t,raw:this.source.slice(e,t),global:r,ignoreCase:n,multiline:u,unicode:a,sticky:i,dotAll:o,hasIndices:s,unicodeSets:d}}onPatternEnter(e){this._node={type:"Pattern",parent:null,start:e,end:e,raw:"",alternatives:[]},this._backreferences.length=0,this._capturingGroups.length=0}onPatternLeave(e,t){for(let r of(this._node.end=t,this._node.raw=this.source.slice(e,t),this._backreferences)){let e=r.ref,t="number"==typeof e?[this._capturingGroups[e-1]]:this._capturingGroups.filter(t=>t.name===e);if(1===t.length){let e=t[0];r.ambiguous=!1,r.resolved=e}else r.ambiguous=!0,r.resolved=t;for(let e of t)e.references.push(r)}}onAlternativeEnter(e){let t=this._node;if("Assertion"!==t.type&&"CapturingGroup"!==t.type&&"Group"!==t.type&&"Pattern"!==t.type)throw Error("UnknownError");this._node={type:"Alternative",parent:t,start:e,end:e,raw:"",elements:[]},t.alternatives.push(this._node)}onAlternativeLeave(e,t){let r=this._node;if("Alternative"!==r.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onGroupEnter(e){let t=this._node;if("Alternative"!==t.type)throw Error("UnknownError");this._node={type:"Group",parent:t,start:e,end:e,raw:"",modifiers:null,alternatives:[]},t.elements.push(this._node)}onGroupLeave(e,t){let r=this._node;if("Group"!==r.type||"Alternative"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onModifiersEnter(e){let t=this._node;if("Group"!==t.type)throw Error("UnknownError");this._node={type:"Modifiers",parent:t,start:e,end:e,raw:"",add:null,remove:null},t.modifiers=this._node}onModifiersLeave(e,t){let r=this._node;if("Modifiers"!==r.type||"Group"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onAddModifiers(e,t,{ignoreCase:r,multiline:n,dotAll:u}){let a=this._node;if("Modifiers"!==a.type)throw Error("UnknownError");a.add={type:"ModifierFlags",parent:a,start:e,end:t,raw:this.source.slice(e,t),ignoreCase:r,multiline:n,dotAll:u}}onRemoveModifiers(e,t,{ignoreCase:r,multiline:n,dotAll:u}){let a=this._node;if("Modifiers"!==a.type)throw Error("UnknownError");a.remove={type:"ModifierFlags",parent:a,start:e,end:t,raw:this.source.slice(e,t),ignoreCase:r,multiline:n,dotAll:u}}onCapturingGroupEnter(e,t){let r=this._node;if("Alternative"!==r.type)throw Error("UnknownError");this._node={type:"CapturingGroup",parent:r,start:e,end:e,raw:"",name:t,alternatives:[],references:[]},r.elements.push(this._node),this._capturingGroups.push(this._node)}onCapturingGroupLeave(e,t){let r=this._node;if("CapturingGroup"!==r.type||"Alternative"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onQuantifier(e,t,r,n,u){let a=this._node;if("Alternative"!==a.type)throw Error("UnknownError");let i=a.elements.pop();if(null==i||"Quantifier"===i.type||"Assertion"===i.type&&"lookahead"!==i.kind)throw Error("UnknownError");let o={type:"Quantifier",parent:a,start:i.start,end:t,raw:this.source.slice(i.start,t),min:r,max:n,greedy:u,element:i};a.elements.push(o),i.parent=o}onLookaroundAssertionEnter(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");let u=this._node={type:"Assertion",parent:n,start:e,end:e,raw:"",kind:t,negate:r,alternatives:[]};n.elements.push(u)}onLookaroundAssertionLeave(e,t){let r=this._node;if("Assertion"!==r.type||"Alternative"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onEdgeAssertion(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");n.elements.push({type:"Assertion",parent:n,start:e,end:t,raw:this.source.slice(e,t),kind:r})}onWordBoundaryAssertion(e,t,r,n){let u=this._node;if("Alternative"!==u.type)throw Error("UnknownError");u.elements.push({type:"Assertion",parent:u,start:e,end:t,raw:this.source.slice(e,t),kind:r,negate:n})}onAnyCharacterSet(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");n.elements.push({type:"CharacterSet",parent:n,start:e,end:t,raw:this.source.slice(e,t),kind:r})}onEscapeCharacterSet(e,t,r,n){let u=this._node;if("Alternative"!==u.type&&"CharacterClass"!==u.type)throw Error("UnknownError");u.elements.push({type:"CharacterSet",parent:u,start:e,end:t,raw:this.source.slice(e,t),kind:r,negate:n})}onUnicodePropertyCharacterSet(e,t,r,n,u,a,i){let o=this._node;if("Alternative"!==o.type&&"CharacterClass"!==o.type)throw Error("UnknownError");let s={type:"CharacterSet",parent:null,start:e,end:t,raw:this.source.slice(e,t),kind:r,strings:null,key:n};if(i){if("CharacterClass"===o.type&&!o.unicodeSets||a||null!==u)throw Error("UnknownError");o.elements.push(Object.assign(Object.assign({},s),{parent:o,strings:i,value:u,negate:a}))}else o.elements.push(Object.assign(Object.assign({},s),{parent:o,strings:i,value:u,negate:a}))}onCharacter(e,t,r){let n=this._node;if("Alternative"!==n.type&&"CharacterClass"!==n.type&&"StringAlternative"!==n.type)throw Error("UnknownError");n.elements.push({type:"Character",parent:n,start:e,end:t,raw:this.source.slice(e,t),value:r})}onBackreference(e,t,r){let n=this._node;if("Alternative"!==n.type)throw Error("UnknownError");let u={type:"Backreference",parent:n,start:e,end:t,raw:this.source.slice(e,t),ref:r,ambiguous:!1,resolved:fv};n.elements.push(u),this._backreferences.push(u)}onCharacterClassEnter(e,t,r){let n=this._node,u={type:"CharacterClass",parent:n,start:e,end:e,raw:"",unicodeSets:r,negate:t,elements:[]};if("Alternative"===n.type){let e=Object.assign(Object.assign({},u),{parent:n});this._node=e,n.elements.push(e)}else if("CharacterClass"===n.type&&n.unicodeSets&&r){let e=Object.assign(Object.assign({},u),{parent:n,unicodeSets:r});this._node=e,n.elements.push(e)}else throw Error("UnknownError")}onCharacterClassLeave(e,t){let r=this._node;if("CharacterClass"!==r.type||"Alternative"!==r.parent.type&&"CharacterClass"!==r.parent.type)throw Error("UnknownError");let n=r.parent;r.end=t,r.raw=this.source.slice(e,t),this._node=n;let u=this._expressionBufferMap.get(r);if(!u)return;if(r.elements.length>0)throw Error("UnknownError");this._expressionBufferMap.delete(r);let a={type:"ExpressionCharacterClass",parent:n,start:r.start,end:r.end,raw:r.raw,negate:r.negate,expression:u};if(u.parent=a,r!==n.elements.pop())throw Error("UnknownError");n.elements.push(a)}onCharacterClassRange(e,t){let r=this._node;if("CharacterClass"!==r.type)throw Error("UnknownError");let n=r.elements,u=n.pop();if(!u||"Character"!==u.type)throw Error("UnknownError");if(!r.unicodeSets){let e=n.pop();if(!e||"Character"!==e.type||45!==e.value)throw Error("UnknownError")}let a=n.pop();if(!a||"Character"!==a.type)throw Error("UnknownError");let i={type:"CharacterClassRange",parent:r,start:e,end:t,raw:this.source.slice(e,t),min:a,max:u};a.parent=i,u.parent=i,n.push(i)}onClassIntersection(e,t){var r;let n=this._node;if("CharacterClass"!==n.type||!n.unicodeSets)throw Error("UnknownError");let u=n.elements.pop(),a=null!==(r=this._expressionBufferMap.get(n))&&void 0!==r?r:n.elements.pop();if(!a||!u||"ClassSubtraction"===a.type||"ClassIntersection"!==a.type&&!fx(a)||!fx(u))throw Error("UnknownError");let i={type:"ClassIntersection",parent:n,start:e,end:t,raw:this.source.slice(e,t),left:a,right:u};a.parent=i,u.parent=i,this._expressionBufferMap.set(n,i)}onClassSubtraction(e,t){var r;let n=this._node;if("CharacterClass"!==n.type||!n.unicodeSets)throw Error("UnknownError");let u=n.elements.pop(),a=null!==(r=this._expressionBufferMap.get(n))&&void 0!==r?r:n.elements.pop();if(!a||!u||"ClassIntersection"===a.type||"ClassSubtraction"!==a.type&&!fx(a)||!fx(u))throw Error("UnknownError");let i={type:"ClassSubtraction",parent:n,start:e,end:t,raw:this.source.slice(e,t),left:a,right:u};a.parent=i,u.parent=i,this._expressionBufferMap.set(n,i)}onClassStringDisjunctionEnter(e){let t=this._node;if("CharacterClass"!==t.type||!t.unicodeSets)throw Error("UnknownError");this._node={type:"ClassStringDisjunction",parent:t,start:e,end:e,raw:"",alternatives:[]},t.elements.push(this._node)}onClassStringDisjunctionLeave(e,t){let r=this._node;if("ClassStringDisjunction"!==r.type||"CharacterClass"!==r.parent.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}onStringAlternativeEnter(e){let t=this._node;if("ClassStringDisjunction"!==t.type)throw Error("UnknownError");this._node={type:"StringAlternative",parent:t,start:e,end:e,raw:"",elements:[]},t.alternatives.push(this._node)}onStringAlternativeLeave(e,t){let r=this._node;if("StringAlternative"!==r.type)throw Error("UnknownError");r.end=t,r.raw=this.source.slice(e,t),this._node=r.parent}}const fA=/^[!=]=/,fC=new class{constructor(e){this._state=new fS(e),this._validator=new fy(this._state)}parseLiteral(e,t=0,r=e.length){this._state.source=e,this._validator.validateLiteral(e,t,r);let n=this._state.pattern,u=this._state.flags,a={type:"RegExpLiteral",parent:null,start:t,end:r,raw:e,pattern:n,flags:u};return n.parent=a,u.parent=a,a}parseFlags(e,t=0,r=e.length){return this._state.source=e,this._validator.validateFlags(e,t,r),this._state.flags}parsePattern(e,t=0,r=e.length,n){return this._state.source=e,this._validator.validatePattern(e,t,r,n),this._state.pattern}};var f_=ip.createRule({name:"prefer-string-starts-ends-with",meta:{type:"suggestion",docs:{description:"Enforce using `String#startsWith` and `String#endsWith` over other equivalent methods of checking substrings"},messages:{preferStartsWith:"Use 'String#startsWith' method instead.",preferEndsWith:"Use the 'String#endsWith' method instead."},schema:[],fixable:"code"},create(e){ip.ensureParserWithTypeInformation(e.sourceCode.parserServices);let t=e.sourceCode.parserServices,r=t.program.getTypeChecker(),n=e.sourceCode.scopeManager?.scopes[0];function u(e){let n=t.getTypeAtLocation(e);return"string"===ig.getTypeName(r,n)}function a(e,t){let r=ih.ASTUtils.getStaticValue(e,n);return null!=r&&r.value===t}function i(e){let t=ih.ASTUtils.getStaticValue(e,n);return null!=t&&"string"==typeof t.value&&t.value[0]===t.value}function o(t,r){if(t.type===ih.AST_NODE_TYPES.MemberExpression)return"length"===ih.ASTUtils.getPropertyName(t,n)&&function(t,r){let n=e.sourceCode.getTokens(t),u=e.sourceCode.getTokens(r);if(n.length!==u.length)return!1;for(let e=0,t=n.length;e<t;++e){let t=n[e],r=u[e];if(t.type!==r.type||t.value!==r.value)return!1}return!0}(t.object,r);let u=ih.ASTUtils.getStaticValue(t,n),a=ih.ASTUtils.getStaticValue(r,n);return null!=u&&null!=a&&"number"==typeof u.value&&"string"==typeof a.value&&u.value===a.value.length}function s(e,t,r){return e.type===ih.AST_NODE_TYPES.UnaryExpression&&"-"===e.operator&&o(e.argument,t)||e.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,r)&&o(e.right,t)}function d(t){return[e.sourceCode.getTokenAfter(t.object,ih.ASTUtils.isNotClosingParenToken).range[0],t.range[1]]}function l(e){let t=ih.ASTUtils.getStaticValue(e,n);if(null==t||!(t.value instanceof RegExp))return null;let{source:r,flags:u}=t.value,a=r.startsWith("^"),i=r.endsWith("$");if(a===i||u.includes("i")||u.includes("m"))return null;let o=function(e,t){let r=fC.parsePattern(e,void 0,void 0,{unicode:t});if(1!==r.alternatives.length)return null;let n=r.alternatives[0].elements,u=n[0];return("Assertion"===u.type&&"start"===u.kind?n.shift():n.pop(),n.every(e=>"Character"===e.type))?String.fromCodePoint(...n.map(e=>e.value)):null}(r,u.includes("u"));return null==o?null:{isEndsWith:i,isStartsWith:a,text:o}}function*c(e,t,r,n,u){let a=d(function e(t){let r;if(t.type===ih.AST_NODE_TYPES.ChainExpression)return e(t.expression);if((r=t.type===ih.AST_NODE_TYPES.CallExpression?t.callee:t).type!==ih.AST_NODE_TYPES.MemberExpression)throw Error(`Expected a MemberExpression, got ${r.type}`);return r}(t.left));n&&(yield e.insertTextBefore(t,"!")),yield e.replaceTextRange([a[0],t.right.range[0]],`${u?"?.":"."}${r}sWith(`),yield e.replaceTextRange([t.right.range[1],t.range[1]],")")}function*f(e,t,r,n,u,a,i){a&&(yield e.insertTextBefore(t,"!")),yield e.replaceTextRange(d(n),`${i?"?.":"."}${u}sWith`),yield e.removeRange([r.range[1],t.range[1]])}return{'BinaryExpression > MemberExpression.left[computed=true], BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="charAt"][computed=false], BinaryExpression > ChainExpression.left > MemberExpression[computed=true], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="charAt"][computed=false]'(t){var r,s;let d=fD(t),l=d.type===ih.AST_NODE_TYPES.CallExpression,f=null;if(d.type===ih.AST_NODE_TYPES.CallExpression?(1===d.arguments.length&&(f=d.arguments[0]),d=fD(d)):f=t.property,null==f||!fw(d)||!u(t.object))return;let p=(r=f,s=t.object,r.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===r.operator&&o(r.left,s)&&a(r.right,1)),h=!p&&a(f,0);if(!h&&!p)return;let m=d;h&&!l&&function(e){if(!i(e))return!1;let t=ih.ASTUtils.getStaticValue(e,n);return null!=t&&"string"==typeof t.value&&t.value[0]===t.value&&function(e){let t=e.codePointAt(0);return null!=t&&t>=0&&t<=127}(t.value)}(m.right)||e.report({node:d,messageId:h?"preferStartsWith":"preferEndsWith",fix:e=>i(m.right)?c(e,m,h?"start":"end",m.operator.startsWith("!"),t.optional):null})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="indexOf"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="indexOf"][computed=false]'(t){let r=fD(t),n=fD(r);1===r.arguments.length&&fw(n)&&a(n.right,0)&&u(t.object)&&e.report({node:n,messageId:"preferStartsWith",fix:e=>f(e,n,r,t,"start",n.operator.startsWith("!"),t.optional)})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="lastIndexOf"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="lastIndexOf"][computed=false]'(t){let r=fD(t),n=fD(r);1===r.arguments.length&&fw(n)&&n.right.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===n.right.operator&&o(n.right.left,t.object)&&o(n.right.right,r.arguments[0])&&u(t.object)&&e.report({node:n,messageId:"preferEndsWith",fix:e=>f(e,n,r,t,"end",n.operator.startsWith("!"),t.optional)})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="match"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="match"][computed=false]'(t){let r=fD(t),a=fD(r);if(!fw(a)||!function(e){let t=ih.ASTUtils.getStaticValue(e,n);return null!=t&&null==t.value}(a.right)||!u(t.object))return;let i=1===r.arguments.length?l(r.arguments[0]):null;if(null==i)return;let{isStartsWith:o,text:s}=i;e.report({node:r,messageId:o?"preferStartsWith":"preferEndsWith",*fix(e){a.operator.startsWith("!")||(yield e.insertTextBefore(a,"!")),yield e.replaceTextRange(d(t),`${t.optional?"?.":"."}${o?"start":"end"}sWith`),yield e.replaceText(r.arguments[0],JSON.stringify(s)),yield e.removeRange([r.range[1],a.range[1]])}})},'BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="slice"][computed=false], BinaryExpression > CallExpression.left > MemberExpression.callee[property.name="substring"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="slice"][computed=false], BinaryExpression > ChainExpression.left > CallExpression > MemberExpression.callee[property.name="substring"][computed=false]'(t){let r=fD(t),n=fD(r);if(!fw(n)||!u(t.object))return;let i=!1,d=!1;if(1===r.arguments.length?s(r.arguments[0],n.right,t.object)&&(i=!0):2===r.arguments.length&&(a(r.arguments[0],0)&&o(r.arguments[1],n.right)?d=!0:(o(r.arguments[1],t.object)||a(r.arguments[1],0))&&s(r.arguments[0],n.right,t.object)&&(i=!0)),!d&&!i)return;let l="slice"===t.property.name;e.report({node:n,messageId:d?"preferStartsWith":"preferEndsWith",fix(e){if(2===n.operator.length&&(n.right.type!==ih.AST_NODE_TYPES.Literal||"string"!=typeof n.right.value))return null;if(d){if(!o(r.arguments[1],n.right))return null}else{let e=r.arguments[0];if(!(e.type===ih.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,t.object)&&o(e.right,n.right)||l&&e.type===ih.AST_NODE_TYPES.UnaryExpression&&"-"===e.operator&&o(e.argument,n.right)))return null}return c(e,n,d?"start":"end",n.operator.startsWith("!"),t.optional)}})},'CallExpression > MemberExpression.callee[property.name="test"][computed=false]':function(t){let r=fD(t),n=1===r.arguments.length?l(t.object):null;if(null==n)return;let{isStartsWith:u,text:a}=n,i=u?"startsWith":"endsWith";e.report({node:r,messageId:u?"preferStartsWith":"preferEndsWith",*fix(e){let n=r.arguments[0],u=n.type!==ih.AST_NODE_TYPES.Literal&&n.type!==ih.AST_NODE_TYPES.TemplateLiteral&&n.type!==ih.AST_NODE_TYPES.Identifier&&n.type!==ih.AST_NODE_TYPES.MemberExpression&&n.type!==ih.AST_NODE_TYPES.CallExpression;yield e.removeRange([r.range[0],n.range[0]]),u&&(yield e.insertTextBefore(n,"("),yield e.insertTextAfter(n,")")),yield e.insertTextAfter(n,`${t.optional?"?.":"."}${i}(${JSON.stringify(a)}`)}})}}}});function fD(e){return ih.ESLintUtils.nullThrows(e.parent?.type===ih.AST_NODE_TYPES.ChainExpression?e.parent.parent:e.parent,ih.ESLintUtils.NullThrowsReasons.MissingParent)}function fw(e){return e.type===ih.AST_NODE_TYPES.BinaryExpression&&fA.test(e.operator)}var fT=ip.createRule({name:"no-export-const-enum",meta:{type:"suggestion",docs:{description:"Disallow using `const enum` expression as it can not be inlined and tree-shaken by swc/esbuild/babel/webpack/rollup/vite/bun/rspack"},messages:{noConstEnum:"Do not use `const enum` expression"},schema:[]},create(e){let t=(t,r)=>{let n=ih.ASTUtils.findVariable(e.sourceCode.getScope(t),r);n?.defs.forEach(r=>{r.node.type===ih.AST_NODE_TYPES.TSEnumDeclaration&&r.node.const&&e.report({node:t,messageId:"noConstEnum"})})};return{ExportNamedDeclaration(r){let n=r.declaration;if(n?.type===ih.AST_NODE_TYPES.TSEnumDeclaration&&n.const){e.report({node:r,messageId:"noConstEnum"});return}if(n?.type===ih.AST_NODE_TYPES.VariableDeclaration){let e=n.declarations[0].id;e.type===ih.AST_NODE_TYPES.Identifier&&t(r,e)}},ExportDefaultDeclaration(e){let r=e.declaration;r.type===ih.AST_NODE_TYPES.Identifier&&t(e,r)}}}}),fP=ip.createRule({name:"no-for-in-iterable",meta:{schema:[],type:"suggestion",docs:{description:'"for in" should not be used with iterables',recommended:"strict",url:"https://sonarsource.github.io/rspec/#/rspec/S4139/javascript"},messages:{useForOf:'Use "for...of" to iterate over this "{{iterable}}".'}},create(e){let t=e.sourceCode.parserServices,r=e=>{var r;return ip.ensureParserWithTypeInformation(t),e.symbol&&fI.has(e.symbol.name)||((r=e).flags&im.TypeFlags.StringLike)>0||r.symbol?.name==="String"||function(e,t){for(let r of e.isUnion()?e.types:[e])if(!function(e,t){let r=t.program.getTypeChecker();return"isArrayType"in r&&"function"==typeof r.isArrayType&&r.isArrayType(e)}(r,t))return!1;return!0}(t.program.getTypeChecker().getBaseConstraintOfType(e)??e,t)};return{ForInStatement(n){ip.ensureParserWithTypeInformation(t);let u=fk(n.right,t);if(r(u)){let t=u.symbol?u.symbol.name:"String";e.report({messageId:"useForOf",data:{iterable:t},loc:e.sourceCode.getFirstToken(n).loc})}}}}});function fk(e,t){return t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e))}const fI=new Set(["Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Set","Map"]);var fF=ip.createRule({name:"only-await-thenable",meta:{schema:[],type:"suggestion",docs:{description:'"await" should only be used with promises',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4123/javascript"},messages:{refactorAwait:"Refactor this redundant 'await' on a non-promise."}},create(e){let t=e.sourceCode.parserServices;return ip.ensureParserWithTypeInformation(t),{AwaitExpression(r){let n=fk(r.argument,t);(function(e,t){var r;if(e.argument.type!==ih.AST_NODE_TYPES.CallExpression)return!1;let n=(r=e.argument,t.program.getTypeChecker().getResolvedSignature(t.esTreeNodeToTSNodeMap.get(r)));return n?.declaration&&function(e){let t=new Set(["return","returns"]);if(!e.jsDoc)return!1;for(let r of e.jsDoc)if(r.tags?.some(e=>t.has(e.tagName.escapedText.toString())))return!0;return!1}(n.declaration)})(r,t)||function(e){let t=e.getProperty("then");return t?.declarations?.some(e=>e.kind===im.SyntaxKind.MethodSignature||e.kind===im.SyntaxKind.MethodDeclaration||e.kind===im.SyntaxKind.PropertyDeclaration)}(n)||n.flags&im.TypeFlags.Any||n.flags&im.TypeFlags.Unknown||n.flags&im.TypeFlags.Union||e.report({messageId:"refactorAwait",node:r})}}}}),fO=ip.createRule({name:"no-undefined-optional-parameters",meta:{schema:[],type:"suggestion",docs:{description:'"undefined" should not be passed as the value of optional parameters',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4623/javascript",requiresTypeChecking:!0},fixable:"code",hasSuggestions:!0,messages:{removeUndefined:'Remove this redundant "undefined".',suggestRemoveUndefined:"Remove this redundant argument"}},create(e){let t=e.sourceCode.parserServices;return ip.ensureParserWithTypeInformation(t),{CallExpression(r){let{arguments:n}=r;if(0===n.length)return;let u=n[n.length-1];u.type===ih.AST_NODE_TYPES.Identifier&&"undefined"===u.name&&function(e,t,r){let n=r.program.getTypeChecker().getResolvedSignature(r.esTreeNodeToTSNodeMap.get(t));if(n){let t=n.declaration;if(t&&fB.has(t.kind)){let{parameters:r}=t,n=r[e];return n&&(n.initializer||n.questionToken)}}return!1}(n.length-1,r,t)&&e.report({messageId:"removeUndefined",node:u,suggest:[{messageId:"suggestRemoveUndefined",fix(t){if(1===r.arguments.length){let n=e.sourceCode.getTokenAfter(r.callee),u=e.sourceCode.getLastToken(r),[,a]=n.range,[i]=u.range;return t.removeRange([a,i])}let[,a]=n[n.length-2].range,[,i]=u.range;return t.removeRange([a,i])}}]})}}}});const fB=new Set([im.SyntaxKind.FunctionDeclaration,im.SyntaxKind.FunctionExpression,im.SyntaxKind.ArrowFunction,im.SyntaxKind.MethodDeclaration,im.SyntaxKind.Constructor,im.SyntaxKind.GetAccessor,im.SyntaxKind.SetAccessor]);function fN(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fj{visit(e,t){let r=e=>{switch(e.type){case ih.AST_NODE_TYPES.AwaitExpression:case ih.AST_NODE_TYPES.CallExpression:case ih.AST_NODE_TYPES.NewExpression:this.callLikeExpressions.push(e);break;case ih.AST_NODE_TYPES.FunctionDeclaration:case ih.AST_NODE_TYPES.FunctionExpression:case ih.AST_NODE_TYPES.ArrowFunctionExpression:return}(function(e,t){let r=[],n=t[e.type];if(n?.length)for(let t of n){let n=e[t];Array.isArray(n)?r.push(...n):r.push(n)}return r.filter(Boolean)})(e,t.sourceCode.visitorKeys).forEach(r)};r(e)}constructor(){fN(this,"callLikeExpressions",[])}}fN(fj,"getCallExpressions",(e,t)=>{let r=new fj;return r.visit(e,t),r.callLikeExpressions});var fL={rules:{"array/no-unneeded-flat-map":iz,"browser/prefer-location-assign":iW,"jsx/no-template-literal":iG,"jsx/no-unneeded-nested":iZ,"string/no-locale-case":iH,"string/no-simple-template-literal":iJ,"type/no-instanceof-wrapper":i0,"unicode/no-bidi":i6,"unicode/no-invisible":i7,"ban-eslint-disable":lV,"no-redundant-variable":oe,"no-single-return":or,"prefer-early-return":ou,"prefer-fetch":oa,"prefer-timer-id":os,"no-return-await":lz,"no-expression-empty-lines":lY,"object-format":lZ,"prefer-single-boolean-return":lH,"no-all-duplicated-branches":lQ,"no-duplicated-branches":lQ,"bool-param-default":cr,"call-argument-line":cn,"class-prototype":l9,"comma-or-logical-or-case":l3,"track-todo-fixme-comment":ci,"no-element-overwrite":l5,"no-empty-collection":cl,"no-equals-in-for-termination":cE,"no-top-level-this":cC,"no-invariant-returns":c_,"no-redundant-assignments":cM,"no-same-line-conditional":c$,"no-small-switch":cU,"no-unused-collection":cq,"no-useless-plusplus":cG,"string/prefer-string-starts-ends-with":f_,"string/no-unneeded-to-string":od,"type/no-force-cast-via-top-type":ol,"type/no-wrapper-type-reference":of,"no-default-error":op,"no-export-const-enum":fT,"no-for-in-iterable":fP,"only-await-thenable":fF,"no-undefined-optional-parameters":fO,"no-try-promise":ip.createRule({name:"no-try-promise",meta:{schema:[],type:"problem",docs:{description:'Promise rejections should not be caught by "try" blocks',recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S4822/javascript",requiresTypeChecking:!0},messages:{addAwait:"Consider using 'await' for the promise{{ending}} inside this 'try' or replace it with 'Promise.prototype.catch(...)' usage{{ending}}.",removeTry:"Consider removing this 'try' statement as promise{{ending}} rejection is already captured by '.catch()' method."}},create(e){let t=e.sourceCode.parserServices;return ip.ensureParserWithTypeInformation(t),{TryStatement(r){if(r.handler){let n=[],u=[],a=!1;fj.getCallExpressions(r.block,e).forEach(e=>{if(e.type===ih.AST_NODE_TYPES.AwaitExpression||!function(e,t){let r=t.esTreeNodeToTSNodeMap.get(e),n=t.program.getTypeChecker().getTypeAtLocation(r).getProperty("then");return!!(n&&n.flags&im.SymbolFlags.Method)}(e,t)){a=!0;return}!(e.parent&&(e.parent.type===ih.AST_NODE_TYPES.AwaitExpression||e.parent.type===ih.AST_NODE_TYPES.YieldExpression)||e.parent&&e.parent.type===ih.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ih.AST_NODE_TYPES.Identifier&&"then"===e.parent.property.name||e.type===ih.AST_NODE_TYPES.CallExpression&&e.callee.type===ih.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===ih.AST_NODE_TYPES.Identifier&&"catch"===e.callee.property.name)&&(e.parent&&e.parent.type===ih.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ih.AST_NODE_TYPES.Identifier&&"catch"===e.parent.property.name?u:n).push(e)}),a||(function(t,r){if(r.length>0){let n=r.length>1?"s":"",u=e.sourceCode.getFirstToken(t);e.report({messageId:"addAwait",data:{ending:n},loc:u.loc})}}(r,n),function(t,r,n){if(0===r.length&&n.length>0){let r=n.length>1?"s":"",u=e.sourceCode.getFirstToken(t);e.report({messageId:"removeTry",data:{ending:r},loc:u.loc})}}(r,n,u))}}}}}),"no-useless-string-operation":ip.createRule({name:"no-useless-string-operation",meta:{schema:[],messages:{uselessStringOp:"{{symbol}} is an immutable object; you must either store or return the result of the operation."},type:"problem",docs:{description:"Results of operations on strings should not be ignored",recommended:"recommended",url:"https://sonarsource.github.io/rspec/#/rspec/S1154/javascript"}},create(e){let t=e.sourceCode.parserServices;return{'ExpressionStatement > CallExpression[callee.type="MemberExpression"]':r=>{let{object:n,property:u}=r.callee;if(ip.ensureParserWithTypeInformation(t),(fk(n,t).flags&ix.TypeFlags.StringLike)!=0&&u.type===ih.AST_NODE_TYPES.Identifier){let t;e.report({messageId:"uselessStringOp",data:{symbol:((t=e.sourceCode.getText(n)).length>30&&(t="String"),t)},node:u})}}}}}),...Object.entries({"unicorn/better-regex":dN,"unicorn/catch-error-name":lP,"unicorn/custom-error-definition":lI,"unicorn/no-nested-ternary":sh,"unicorn/prefer-event-target":sW,"unicorn/prefer-keyboard-event-key":sY,"unicorn/prefer-text-content":sG,"unicorn/require-array-join-separator":s2,"unicorn/no-thenable":s3,"unicorn/no-invalid-remove-event-listener":s4,"unicorn/consistent-function-scoping":s5,"unicorn/no-new-buffer":s8,"unicorn/no-console-spaces":s6,"unicorn/no-empty-file":s9,"unicorn/no-useless-fallback-in-spread":s7,"unicorn/no-useless-length-check":de,"unicorn/no-useless-promise-resolve-reject":dt,"unicorn/no-zero-fractions":dr,"unicorn/prefer-export-from":dn,"unicorn/prefer-native-coercion-functions":du,"unicorn/no-document-cookie":di,"unicorn/prefer-add-event-listener":ds,"unicorn/prefer-array-index-of":dd,"unicorn/prefer-blob-reading-methods":dl,"unicorn/prefer-date-now":dc,"unicorn/prefer-dom-node-dataset":df,"unicorn/prefer-modern-math-apis":dp,"unicorn/number-literal-case":dg,"unicorn/prefer-number-properties":dy,"unicorn/prefer-reflect-apply":db,"unicorn/prefer-set-size":dE,"unicorn/prefer-string-replace-all":dx,"unicorn/prefer-string-slice":dS,"unicorn/prefer-string-trim-start-end":dA,"unicorn/no-unreadable-iife":dC,"unicorn/throw-new-error":d_,"unicorn/escape-case":dj,"unicorn/no-hex-escape":dL,"unicorn/prefer-prototype-methods":dR,"unicorn/error-message":dM,"unicorn/no-instanceof-array":d$,"unicorn/prefer-type-error":dU,"unicorn/consistent-destructuring":dV,"unicorn/new-for-builtins":dq,"unicorn/no-array-push-push":dW,"unicorn/no-process-exit":dY,"unicorn/no-static-only-class":dK,"unicorn/no-unreadable-array-destructuring":dH,"unicorn/no-useless-spread":dX,"unicorn/no-useless-switch-case":dJ,"unicorn/no-useless-undefined":dQ,"unicorn/numeric-separators-style":d0,"unicorn/prefer-array-find":d1,"unicorn/prefer-array-flat-map":d2,"unicorn/prefer-array-flat":d3,"unicorn/prefer-array-some":d4,"unicorn/prefer-code-point":d5,"unicorn/prefer-default-parameters":d8,"unicorn/prefer-logical-operator-over-ternary":d6,"unicorn/prefer-optional-catch-binding":d9,"unicorn/prefer-regexp-test":d7,"unicorn/prefer-set-has":le,"unicorn/prefer-string-raw":lt,"unicorn/prefer-switch":lr,"unicorn/require-number-to-fixed-digits-argument":ln,"unicorn/template-indent":l_,"unicorn/no-single-promise-in-promise-methods":dG,"unicorn/no-await-in-promise-methods":lD,"unicorn/no-negation-in-equality-check":lw,"unicorn/no-length-as-slice-end":lT,"unicorn/no-lonely-if":lF,"unicorn/no-magic-array-flat-depth":lO,"unicorn/no-negated-condition":lB,"unicorn/no-object-as-default-parameter":lN,"unicorn/prefer-negative-index":lj,"unicorn/prefer-node-protocol":lR}).reduce((e,[t,r])=>{var n;return e[t]={...r,meta:{schema:[],...r.meta,docs:{description:"",...r.meta.docs,url:iT(t)},..."defaultOptions"in r?{defaultOptions:r.defaultOptions}:{}},create:(n=r.create,e=>{let t={},r=(e,r)=>{t[e]??(t[e]=[]),t[e].push(r)};for(let[t,u]of Object.entries(n(new Proxy(e,{get:(e,t,n)=>"on"===t?(e,t)=>{for(let n of Array.isArray(e)?e:[e])r(n,t)}:"onExit"===t?(e,t)=>{for(let n of Array.isArray(e)?e:[e])r(`${n}:exit`,t)}:Reflect.get(e,t,n)}),void 0)||{}))u&&r(t,u);return Object.fromEntries(Object.entries(t).map(([t,r])=>[t,(...t)=>{for(let n of r)n&&function(e,t){if(e){for(let r of(iP(e)||(e=[e]),e))if(r){if(r.fix&&(r.fix=iF(r.fix)),iP(r.suggest))for(let e of r.suggest)"fix"in e&&"function"==typeof e.fix&&(e.fix=iF(e.fix)),e.data={...r.data,...e.data};t.report(r)}}}(n(...t),e)}]))})},e},{})}};module.exports=fL;
|