eslint-plugin-sukka 6.6.0 → 6.7.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 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 aH={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"}}}}()),lI=/*@__PURE__*/ix(/*@__PURE__*/function(){if(aQ)return aJ;aQ=1;let{isParenthesized:e,isNotSemicolonToken:t}=sc,{needsSemicolon:r}=/*@__PURE__*/sV(),{removeSpacesAfter:n}=/*@__PURE__*/sQ(),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 aJ={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`."}}}}()),lF=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a1)return a0;a1=1;let{isMethodCall:e,isNumberLiteral:t}=/*@__PURE__*/sv(),{getCallExpressionTokens:r}=/*@__PURE__*/sV(),n="no-magic-array-flat-depth";return a0={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."}}}}()),lO=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a3)return a2;a3=1;let{removeParentheses:e,fixSpaceAroundKeyword:t,addParenthesizesToReturnOrThrowExpression:r}=/*@__PURE__*/sQ(),{getParenthesizedRange:n,isParenthesized:u}=/*@__PURE__*/sp(),a=/*@__PURE__*/sO(),i=/*@__PURE__*/sN(),o="no-negated-condition";return a2={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."}}}}()),lj=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a5)return a4;a5=1;let{isFunction:e}=/*@__PURE__*/sv(),t="identifier",r="non-identifier";return a4={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."}}}}()),lB=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a7)return a9;a7=1;let{getNegativeIndexLengthNode:e,removeLengthNode:t}=/*@__PURE__*/function(){if(a6)return a8;a6=1;let e=/*@__PURE__*/sj(),{getParenthesizedRange:t}=/*@__PURE__*/sp(),{isNumberLiteral:r}=/*@__PURE__*/sv(),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 a8={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__*/dV(),{isLiteral:n}=/*@__PURE__*/sv(),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 a9={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}}`."}}}}()),lN=/*@__PURE__*/iS(ib),lL=/*@__PURE__*/ix(/*@__PURE__*/function(){if(ii)return ia;ii=1;let e=function(){if(iu)return ir;iu=1;let e=new Set(function(){if(it)return ie;it=1;let{builtinModules:e}=lN,t=["sys"];return ie=(e||(process.binding?Object.keys(process.binding("natives")):[])||[]).filter(e=>!/^_|^(internal|v8|node-inspect)\/|\//.test(e)&&!t.includes(e)).sort()}()),t="node:";return ir=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__*/sQ(),r=/*@__PURE__*/sb(),n="prefer-node-protocol";return ia={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 lR=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),lM=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),l$=Symbol("rule-id-no-match");var lU=il.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=lR.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=lM.exec(e.trim());return t?t.groups?.ruleId:l$}(n.value);u===l$||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),lV=il.createRule({name:"import-dedupe",meta:{type:"problem",docs:{description:"Fix duplication in imports"},fixable:"code",schema:[],messages:{"import-dedupe":"Expect no duplication in imports"}},create:e=>({ImportDeclaration(t){if(t.specifiers.length<=1)return;let r=new Set;t.specifiers.forEach(n=>{let u=n.local.name;r.has(u)&&e.report({node:t,loc:{start:n.loc.end,end:n.loc.start},messageId:"import-dedupe",fix(t){let r=n.range[0],u=n.range[1];return","===e.sourceCode.text[u]&&(u+=1),t.removeRange([r,u])}}),r.add(u)})}})}),lz=il.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===ic.AST_NODE_TYPES.ArrowFunctionExpression||(t.parent?.type===ic.AST_NODE_TYPES.ReturnStatement?!lq(t.parent):(t.parent?.type===ic.AST_NODE_TYPES.ConditionalExpression&&(t===t.parent.consequent||t===t.parent.alternate)||t.parent?.type===ic.AST_NODE_TYPES.LogicalExpression&&t===t.parent.right||t.parent?.type===ic.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(;!ic.ASTUtils.isFunction(t)&&t.type!==ic.AST_NODE_TYPES.Program;){if(t.parent.type===ic.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=il.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=il.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=il.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!==ic.AST_NODE_TYPES.IfStatement&&lJ(t.consequent)&&function(e){if(e.alternate)return lJ(e.alternate);let{parent:t}=e;if(t.type===ic.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===ic.AST_NODE_TYPES.BlockStatement?r.body[0]:r).argument.value,i=!(((n=t.test).type===ic.AST_NODE_TYPES.UnaryExpression||n.type===ic.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===ic.AST_NODE_TYPES.ReturnStatement&&e.argument?.type===ic.AST_NODE_TYPES.Literal&&"boolean"==typeof e.argument.value}function lJ(e){return void 0!==e&&(e.type===ic.AST_NODE_TYPES.BlockStatement&&1===e.body.length&&lX(e.body[0])||lX(e))}var lQ=il.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===ic.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===ic.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===ic.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===ic.AST_NODE_TYPES.BreakStatement?e.slice(0,-1):e}var l3=il.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===ic.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===ic.AST_NODE_TYPES.SwitchStatement)return r[e];throw Error("A switch case should have an enclosing switch statement")}(r)).discriminant.type===ic.AST_NODE_TYPES.Literal&&!0===n.discriminant.value)){let e=function e(t,r){if("||"===t.operator)return t.left.type===ic.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))}il.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!==ic.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===ic.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===ic.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=il.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===ic.AST_NODE_TYPES.ImportDeclaration||e.type===ic.AST_NODE_TYPES.ExportNamedDeclaration||e.type===ic.AST_NODE_TYPES.ExportDefaultDeclaration||e.type===ic.AST_NODE_TYPES.ExportAllDeclaration))))}};function t(t){let r;let n=new Map;t.forEach(t=>{let u=function(t){if(t.type===ic.AST_NODE_TYPES.ExpressionStatement)return function(t){if(t.type===ic.AST_NODE_TYPES.AssignmentExpression&&"="===t.operator&&t.left.type===ic.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===ic.AST_NODE_TYPES.CallExpression&&e.callee.type===ic.AST_NODE_TYPES.MemberExpression){let t=e.callee;if(t.property.type===ic.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===ic.AST_NODE_TYPES.Literal){let{value:t}=e;return"number"==typeof t||"string"==typeof t?String(t):void 0}if(e.type===ic.AST_NODE_TYPES.Identifier)return e.name}new class{get(e){let t=this.map.get(e),r=Date.now();if(t){if(t.expire>r)return t.expire=r+2e4,t.value;this.map.delete(e)}return null}set(e,t){let r=this.map.get(e),n=Date.now()+2e4;r?(r.value=t,r.expire=n):this.map.set(e,{value:t,expire:n})}constructor(){var e;e=new Map,"map"in this?Object.defineProperty(this,"map",{value:e,enumerable:!0,configurable:!0,writable:!0}):this.map=e}};const l9=Object.entries({"deep-equal":"https://www.npmjs.com/package/dequal","fast-deep-equal":"https://www.npmjs.com/package/dequal",chalk:"simple color https://www.npmjs.com/package/picocolors, hex color https://github.com/webdiscus/ansis",kleur:"https://www.npmjs.com/package/picocolors","ansi-escapes":"https://www.npmjs.com/package/sisteransi","mime-db":"https://www.npmjs.com/package/mrmime","mime-types":"https://www.npmjs.com/package/mrmime","tiny-lru":"https://www.npmjs.com/package/flru","lru-cache":"https://www.npmjs.com/package/flru","tmp-cache":"https://www.npmjs.com/package/flru",premove:"Node.js built-in fs.rmdir & fs.rm API",mkdirp:"Node.js built-in fs.mkdir API","make-dir":"Node.js built-in fs.mkdir API","mk-dirs":"Node.js built-in fs.mkdir API",axios:"https://www.npmjs.com/package/ky","node-fetch":"https://www.npmjs.com/package/undici (preferred) or https://www.npmjs.com/package/node-fetch-native",got:"https://www.npmjs.com/package/undici and https://www.npmjs.com/package/async-retry","get-port":"https://www.npmjs.com/package/get-port-please","react-query":"https://swr.vercel.app","@tanstack/react-query":"https://swr.vercel.app","@tanstack/react-query-devtools":"https://swr.vercel.app",ahooks:"https://foxact.skk.moe and https://swr.vercel.app","clone-deep":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser","deep-copy":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser","fast-copy":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser","lodash.clonedeep":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser",clone:"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser",ms:"https://www.npmjs.com/package/@lukeed/ms",classnames:"https://www.npmjs.com/package/clsx",classcat:"https://www.npmjs.com/package/clsx","p-limit":"https://www.npmjs.com/package/async-sema or https://www.npmjs.com/package/@henrygd/queue","p-retry":"https://www.npmjs.com/package/async-retry",ora:"https://www.npmjs.com/package/nanospinner","ts-results":"https://www.npmjs.com/package/ts-results-es",dayjs:"https://www.npmjs.com/package/date-fns",tldjs:"https://www.npmjs.com/package/tldts","types-package-json":"https://www.npmjs.com/package/@package-json/types"}).map(([e,t])=>({name:e,message:`Use ${t} instead.`})),l7=[{name:"date-fns/esm",message:"Please use date-fns/{submodule} instead."},{name:"idb/with-async-ittr-cjs",message:"Please use idb/with-async-ittr instead."},{name:"lodash-unified",message:"Do not import lodash-unified directly"},{name:"react-fast-compare",message:"What's faster than a really fast deep comparison? No deep comparison at all."}],ce=[{name:"lodash",message:"Avoid using type unsafe methods.",importNames:["get"]},{name:"lodash-es",message:"Avoid using type unsafe methods.",importNames:["get"]},{name:"lodash",message:"Use https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser instead",importNames:["cloneDeep"]},{name:"lodash-es",message:"Use https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser instead",importNames:["cloneDeep"]},{name:"uuid",importNames:["v4"],message:"Use https://www.npmjs.com/package/@lukeed/uuid instead"},{name:"assert",importNames:["deepEqual"],message:"Use https://www.npmjs.com/package/dequal instead"},{name:"react",importNames:["useLayoutEffect"],message:"Use https://foxact.skk.moe/use-isomorphic-layout-effect instead"}];function ct(e){if(!e?.program)throw Error("see https://typescript-eslint.io/docs/linting/type-linting")}[...l7,...l9,...ce],[...l7,...l9,...ce],[...l7,...l9];var cr=il.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=il.isParserWithTypeInformation(t)?cn:ca;return{AssignmentExpression({left:n,right:u}){if(n.type===ic.AST_NODE_TYPES.MemberExpression&&r(u,t)){let[t,r]=[n.object,n.property];if(t.type===ic.AST_NODE_TYPES.MemberExpression&&r.type===ic.AST_NODE_TYPES.Identifier){let[u,a]=[t.object,t.property];u.type===ic.AST_NODE_TYPES.Identifier&&a.type===ic.AST_NODE_TYPES.Identifier&&"prototype"===a.name&&e.report({messageId:"declareClass",data:{class:u.name,declaration:r.name},node:n})}}}}}});function cn(e,t){ct(t);let r=t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e));return!!r.symbol&&(r.symbol.flags&ip.SymbolFlags.Function)!=0}const cu=new Set(["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]);function ca(e,t){return cu.has(e.type)}var ci=il.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===ic.AST_NODE_TYPES.Identifier&&function(e){return!!e.optional&&!!e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ic.AST_NODE_TYPES.TSBooleanKeyword||function(e){if(e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ic.AST_NODE_TYPES.TSUnionType){let t=e.typeAnnotation.typeAnnotation.types;return 2===t.length&&t.some(e=>e.type===ic.AST_NODE_TYPES.TSBooleanKeyword)&&t.some(e=>e.type===ic.AST_NODE_TYPES.TSUndefinedKeyword)}return!1}(e)}(r)&&e.report({messageId:"provideDefault",data:{parameter:r.name},node:r})}})}),co=il.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!==ic.AST_NODE_TYPES.CallExpression&&1===r.arguments.length){let n=r.typeArguments??r.callee,u=(t.getLastTokenBetween(n,r.arguments[0],cs)??t.getLastToken(n)).loc.end.line,{start:a}=t.getTokenAfter(n,cd).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 cs(e){return e.type===ic.AST_TOKEN_TYPES.Punctuator&&")"===e.value}function cd(e){return!cs(e)}var cl=il.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&&cc.test(e.charAt(t-1)),a=n<=e.length-1&&cc.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 cc=RegExp("\\p{Letter}","u"),cf=["Array","Map","Set","WeakSet","WeakMap"],cp=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 ch=il.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===ic.TSESLint.Scope.DefinitionType.Parameter||e.type===ic.TSESLint.Scope.DefinitionType.ImportBinding))return;let r=[],n=!1;for(let e of t.references)if(e.isWriteOnly()){if(!function(e){let t=cm(e.identifier,e=>e.type===ic.AST_NODE_TYPES.VariableDeclarator||e.type===ic.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ic.AST_NODE_TYPES.VariableDeclarator&&t.init)return cb(t.init);if(t.type===ic.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ic.AST_NODE_TYPES.AssignmentExpression&&cy(e,r.left)&&cb(r.right)}}return!1}(e))return;n=!0}else{if(!(function(e){let{parent:t}=e.identifier;if(t&&t.type===ic.AST_NODE_TYPES.MemberExpression){let e=t.parent;if(e&&e.type===ic.AST_NODE_TYPES.CallExpression)return cE(t.property,...cp)}return!1}(e)||function(e){let t=cm(e.identifier,e=>e.type===ic.AST_NODE_TYPES.ForOfStatement||e.type===ic.AST_NODE_TYPES.ForInStatement);return t&&t.right===e.identifier}(e)||function(e){let{parent:t}=e.identifier;return t&&t.type===ic.AST_NODE_TYPES.MemberExpression&&t.computed&&!function(e){let t=cg(e,new Set),r=t.find(e=>e.type===ic.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!==ic.TSESLint.Scope.ScopeType.global&&e.variables.forEach(t),e.childScopes.forEach(r)};return{"Program:exit":t=>{r(e.sourceCode.getScope(t))}}}});function cm(e,t){return cg(e,new Set).find(t)}function cg(e,t){let r=[],n=e.parent;for(;n&&(r.push(n),!t.has(n.type));)n=n.parent;return r}function cy(e,t){return t.type===ic.AST_NODE_TYPES.Identifier&&t===e.identifier}function cb(e){return e&&e.type===ic.AST_NODE_TYPES.ArrayExpression?0===e.elements.length:!!e&&(e.type===ic.AST_NODE_TYPES.CallExpression||e.type===ic.AST_NODE_TYPES.NewExpression)&&cE(e.callee,...cf)&&0===e.arguments.length}function cE(e,...t){return e?.type===ic.AST_NODE_TYPES.Identifier&&(0===t.length||t.some(t=>t===e.name))}const cv=new Set(["!=","==","!==","==="]),cx=new Set(["!==","!="]),cS=new Set(["+=","-="]);var cA=il.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===ic.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===ic.AST_NODE_TYPES.BinaryExpression&&cv.has(n.operator)&&function e(t){return!!cC(t)||t.type===ic.AST_NODE_TYPES.UpdateExpression||t.type===ic.AST_NODE_TYPES.SequenceExpression&&t.expressions.every(e)}(r.update)&&!(function(e){let t=e.test,r=[];return function e(t,r){let n;cC(t)?n=t.left:t.type===ic.AST_NODE_TYPES.UpdateExpression?n=t.argument:t.type===ic.AST_NODE_TYPES.SequenceExpression&&t.expressions.forEach(t=>e(t,r)),n&&n.type===ic.AST_NODE_TYPES.Identifier&&r.push(n.name)}(e.update,r),t.left.type!==ic.AST_NODE_TYPES.Identifier||!r.includes(t.left.name)}(r)||function(e){let r=e.init,n=e.test;if(r&&c_(n)){let u=function(e,r){if(e.type===ic.AST_NODE_TYPES.UpdateExpression&&!t(e.argument,r)||function(e){if(cC(e)){let t=e.right;return t.type===ic.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=cD(r),t=cD(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 cC(e){return e.type===ic.AST_NODE_TYPES.AssignmentExpression&&cS.has(e.operator)}function c_(e){return e.type===ic.AST_NODE_TYPES.BinaryExpression&&cx.has(e.operator)}function cD(e){return c_(e)?cw(e.right):e.type===ic.AST_NODE_TYPES.VariableDeclaration&&1===e.declarations.length?cw(e.declarations[0].init):e.type===ic.AST_NODE_TYPES.AssignmentExpression?cw(e.right):void 0}function cw(e){if(e&&e.type===ic.AST_NODE_TYPES.Literal&&"number"==typeof e.value)return e.value}var cT=il.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===ic.AST_NODE_TYPES.ClassDeclaration||e.type===ic.AST_NODE_TYPES.ClassExpression);if((r===ic.TSESLint.Scope.ScopeType.global||r===ic.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})}}})}),cP=il.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?cF(r,t):void 0;if(void 0!==n)return e.slice(1).every(e=>cF(e,t)===n);if(r?.type===ic.AST_NODE_TYPES.Identifier){let n=ck(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 ck(e,t){let r=t.set.get(e);if(r&&!r.references.slice(1).some(e=>e.isWrite()||function(e){let t=cm(e.identifier,e=>e.type===ic.AST_NODE_TYPES.ExpressionStatement||cu.has(e.type));return t&&t.type===ic.AST_NODE_TYPES.ExpressionStatement&&(cI(t,e)||t.expression.type===ic.AST_NODE_TYPES.CallExpression)}(e))){let e=null;return 1===r.defs.length&&r.defs[0].type===ic.TSESLint.Scope.DefinitionType.Variable&&(e=r.defs[0].node.init),{variable:r,initExpression:e}}return null}function cI(e,t,r=!0){return e.expression.type===ic.AST_NODE_TYPES.AssignmentExpression&&function e(t,r,n=!0){return t.type===ic.AST_NODE_TYPES.MemberExpression&&(cy(r,t.object)||n&&e(t.object,r,n))}(e.expression.left,t,r)}function cF(e,t){if(e){if(e.type===ic.AST_NODE_TYPES.Literal)return e.value;if(e.type===ic.AST_NODE_TYPES.UnaryExpression){let r=cF(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===ic.AST_NODE_TYPES.Identifier){let r=ck(e.name,t);if(r?.initExpression)return cF(r.initExpression,t)}}}function cO(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cj(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 cB extends Set{constructor(...e){super(...e),cO(this,"type","AssignedValues")}}const cN=e=>new cB([e]),cL={type:"UnknownValue"};class cR{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,cL);return}let n=cM(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 cB;"AssignedValues"===e.type&&"AssignedValues"===r.type?(r.forEach(t=>e.add(t)),this.in.set(t,e)):this.in.set(t,cL)}}constructor(e){cO(this,"segment",void 0),cO(this,"in",void 0),cO(this,"out",void 0),cO(this,"references",void 0),this.segment=e,this.in=new Map,this.out=new Map,this.references=new Set}}function cM(e,t,r,n){if(!t)return cL;switch(t.type){case ic.AST_NODE_TYPES.Literal:return t.raw?cN(t.raw):cL;case ic.AST_NODE_TYPES.Identifier:{let u=cj(t,n);if(u&&u!==e)return r.get(u)??cL;return cL}default:return cL}}class c${constructor(e){cO(this,"codePath",void 0),cO(this,"reachingDefinitionsMap",void 0),cO(this,"reachingDefinitionsStack",void 0),cO(this,"segments",void 0),cO(this,"assignmentStack",void 0),this.codePath=e,this.reachingDefinitionsMap=new Map,this.reachingDefinitionsStack=[],this.segments=new Map,this.assignmentStack=[]}}class cU{isRhs(e){return this.node.type===ic.AST_NODE_TYPES.AssignmentExpression?this.node.right===e:this.node.init===e}isLhs(e){return this.node.type===ic.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){cO(this,"node",void 0),cO(this,"lhs",void 0),cO(this,"rhs",void 0),this.node=e,this.lhs=new Set,this.rhs=new Set}}function cV(e){return e[e.length-1]}var cz=il.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===ic.AST_NODE_TYPES.TSEnumBody||r.parent.type===ic.AST_NODE_TYPES.TSEnumDeclaration||r.parent.type===ic.AST_NODE_TYPES.TSEnumMember||e.sourceCode.getAncestors(r).some(e=>e.type===ic.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=cV(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 cR(e)),a.push(e)},onCodePathStart(e){var r;r=new c$(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=cV(t).assignmentStack.pop();e.rhs.forEach(d),e.lhs.forEach(d)}function o(e){cV(t).assignmentStack.push(new cU(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===ic.AST_NODE_TYPES.Identifier&&e.identifier.parent?.type===ic.AST_NODE_TYPES.AssignmentPattern)&&!t.name.startsWith("_")&&!function(e){if(e?.parent){let t=e.parent;return t&&t.type===ic.AST_NODE_TYPES.AssignmentExpression&&"="!==t.operator}return!1}(e.writeExpr)&&(e.writeExpr?.type!==ic.AST_NODE_TYPES.Identifier||e.resolved!==cj(e.writeExpr,e.from))&&!t.defs.some(e=>e.type===ic.TSESLint.Scope.DefinitionType.Parameter||e.type===ic.TSESLint.Scope.DefinitionType.Variable&&!e.node.init)&&!(n.get(t).size>1)}(t))return;let a=r.get(u),i=cM(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}=cV(t);if(n.length>0)cV(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 cR(e),r.set(e.id,t)),t})(a[t]).add(e)}}}),cq=il.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===ic.AST_NODE_TYPES.IfStatement&&u&&u.type===ic.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)}}}),cW=il.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 cY=["Array","Map","Set","WeakSet","WeakMap"],cG=["copyWithin","fill","pop","push","reverse","set","shift","sort","splice","unshift","add","clear","delete"];var cZ=il.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!==ic.TSESLint.Scope.ScopeType.global&&t.variables.filter(cK).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 cK(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=cm(e.identifier,e=>e.type===ic.AST_NODE_TYPES.VariableDeclarator||e.type===ic.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ic.AST_NODE_TYPES.VariableDeclarator&&t.init)return cH(t.init);if(t.type===ic.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ic.AST_NODE_TYPES.AssignmentExpression&&cy(e,r.left)&&cH(r.right)}}return!1}(r))return!1;t=!0}else if(function(e){let t=cm(e.identifier,e=>e.type===ic.AST_NODE_TYPES.ExpressionStatement);return!t||!(cI(t,e,!1)||function(e,t){if(e.expression.type===ic.AST_NODE_TYPES.CallExpression){let{callee:r}=e.expression;if(r.type===ic.AST_NODE_TYPES.MemberExpression){let{property:e,object:n}=r;return cy(t,n)&&cE(e,...cG)}}return!1}(t,e))}(r))return!1;return t}function cH(e){return!!e&&e.type===ic.AST_NODE_TYPES.ArrayExpression||!!e&&(e.type===ic.AST_NODE_TYPES.CallExpression||e.type===ic.AST_NODE_TYPES.NewExpression)&&cE(e.callee,...cY)}var cX=il.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===ic.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===ic.AST_NODE_TYPES.UpdateExpression&&!r.prefix){let n=e.left;n.type===ic.AST_NODE_TYPES.Identifier&&r.argument.type===ic.AST_NODE_TYPES.Identifier&&r.argument.name===n.name&&t(r)}}}}});function cJ(e){return!(e<48)&&(e<58||!(e<65)&&(e<91||95===e||!(e<97)&&(e<123||cQ(e)||c0(e,null!=t?t:t=c1("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 cQ(t){return c0(t,null!=e?e:e=c1("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 c0(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 c1(e){let t=0;return e.split(" ").map(e=>t+=0|parseInt(e,36))}class c2{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 c3=new Set(["General_Category","gc"]),c4=new Set(["Script","Script_Extensions","sc","scx"]),c5=new c2("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","","","","","","",""),c8=new c2("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","",""),c6=new c2("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","","","",""),c9=new c2("","","","","","","Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence","");function c7(e,t,r){return c3.has(t)?e>=2018&&c5.es2018.has(r):!!c4.has(t)&&(e>=2018&&c8.es2018.has(r)||e>=2019&&c8.es2019.has(r)||e>=2020&&c8.es2020.has(r)||e>=2021&&c8.es2021.has(r)||e>=2022&&c8.es2022.has(r)||e>=2023&&c8.es2023.has(r))}function fe(e){return e>=65&&e<=90||e>=97&&e<=122}function ft(e){return e>=48&&e<=57}function fr(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function fn(e){return e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:e-48}function fu(e){return e>=55296&&e<=56319}function fa(e){return e>=56320&&e<=57343}function fi(e,t){return(e-55296)*1024+(t-56320)+65536}class fo{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 fs{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 fs(this,null)}sibling(){return new fs(this.parent,this.base)}}class fd{constructor(){this.branchID=new fs(null,null),this.groupNames=new Map}clear(){this.branchID=new fs(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 fl={at:(e,t,r)=>r<t?e.charCodeAt(r):-1,width:e=>1},fc={at:(e,t,r)=>r<t?e.codePointAt(r):-1,width:e=>e>65535?2:1};class ff{constructor(){this._impl=fl,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?fc:fl,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 fp extends SyntaxError{constructor(e,t){super(e),this.index=t}}const fh=new Set([94,36,92,46,42,43,63,40,41,91,93,123,125,124]),fm=new Set([38,33,35,36,37,42,43,44,46,58,59,60,61,62,63,64,94,96,126]),fg=new Set([40,41,91,93,123,125,47,45,92,124]),fy=new Set([38,45,33,35,37,44,58,59,60,61,62,64,96,126]);function fb(e){return fe(e)||95===e}class fE{constructor(e){this._reader=new ff,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 fd:new fo}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=new Set,u=!1,a=!1,i=!1,o=!1,s=!1,d=!1,l=!1,c=!1;for(let f=t;f<r;++f){let r=e.charCodeAt(f);n.has(r)&&this.raise(`Duplicated flag '${e[f]}'`,{index:t}),n.add(r),103===r?u=!0:105===r?a=!0:109===r?i=!0:117===r&&this.ecmaVersion>=2015?s=!0:121===r&&this.ecmaVersion>=2015?o=!0:115===r&&this.ecmaVersion>=2018?d=!0:100===r&&this.ecmaVersion>=2022?l=!0:118===r&&this.ecmaVersion>=2024?c=!0:this.raise(`Invalid flag '${e[f]}'`,{index:t})}this.onRegExpFlags(t,r,{global:u,ignoreCase:a,multiline:i,unicode:s,sticky:o,dotAll:d,hasIndices:l,unicodeSets:c})}_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)}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 fp(`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.consumeUncapturingGroup()||this.consumeCapturingGroup()}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.eat3(40,63,58)&&(this.onGroupEnter(e),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this.onGroupLeave(e,this.index),!0)}consumeCapturingGroup(){let e=this.index;if(this.eat(40)){let t=null;return this.ecmaVersion>=2018?this.consumeGroupSpecifier()&&(t=this._lastStrValue):63===this.currentCodePoint&&this.raise("Invalid group"),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.consumeUncapturingGroup()||this.consumeCapturingGroup()||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||fh.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(){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.raise("Invalid group")}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&&(ft(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&&fm.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||!fm.has(r))&&-1!==r&&!fg.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,fy.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&&fu(u)&&fa(this.currentCodePoint)&&(u=fi(u,this.currentCodePoint),this.advance()),!((t=e=u)<65)&&(t<91||!(t<97)&&(t<123||cQ(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&&fu(n)&&fa(this.currentCodePoint)&&(n=fi(n,this.currentCodePoint),this.advance()),cJ(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||ft(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!!fe(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(fu(t)&&this.eat(92)&&this.eat(117)&&this.eatFixedHexDigits(4)){let e=this._lastIntValue;if(fa(e))return this._lastIntValue=fi(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?fh.has(e)||47===e:this.strict?!cJ(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(c7(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(c7(this.ecmaVersion,"General_Category",e))return{key:"General_Category",value:e||null};if((t=this.ecmaVersion)>=2018&&c6.es2018.has(e)||t>=2019&&c6.es2019.has(e)||t>=2021&&c6.es2021.has(e))return{key:e,value:null};if(this._unicodeSetsMode&&this.ecmaVersion>=2024&&c9.es2024.has(e))return{key:e,value:null,strings:!0};this.raise("Invalid property name")}return null}eatUnicodePropertyName(){for(this._lastStrValue="";fb(this.currentCodePoint);)this._lastStrValue+=String.fromCodePoint(this.currentCodePoint),this.advance();return""!==this._lastStrValue}eatUnicodePropertyValue(){var e;for(this._lastStrValue="";fb(e=this.currentCodePoint)||ft(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;ft(this.currentCodePoint);)this._lastIntValue=10*this._lastIntValue+fn(this.currentCodePoint),this.advance();return this.index!==e}eatHexDigits(){let e=this.index;for(this._lastIntValue=0;fr(this.currentCodePoint);)this._lastIntValue=16*this._lastIntValue+fn(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(!fr(e))return this.rewind(t),!1;this._lastIntValue=16*this._lastIntValue+fn(e),this.advance()}return!0}}const fv={},fx={},fS={};function fA(e){return"Character"===e.type||"CharacterSet"===e.type||"CharacterClass"===e.type||"ExpressionCharacterClass"===e.type||"ClassStringDisjunction"===e.type}class fC{constructor(e){var t;this._node=fv,this._expressionBufferMap=new Map,this._flags=fx,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:"",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}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:fS};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&&!fA(a)||!fA(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&&!fA(a)||!fA(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 f_=/^[!=]=/,fD=new class{constructor(e){this._state=new fC(e),this._validator=new fE(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 fw=il.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){il.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"===ih.getTypeName(r,n)}function a(e,t){let r=ic.ASTUtils.getStaticValue(e,n);return null!=r&&r.value===t}function i(e){let t=ic.ASTUtils.getStaticValue(e,n);return null!=t&&"string"==typeof t.value&&t.value[0]===t.value}function o(t,r){if(t.type===ic.AST_NODE_TYPES.MemberExpression)return"length"===ic.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=ic.ASTUtils.getStaticValue(t,n),a=ic.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===ic.AST_NODE_TYPES.UnaryExpression&&"-"===e.operator&&o(e.argument,t)||e.type===ic.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,r)&&o(e.right,t)}function d(t){return[e.sourceCode.getTokenAfter(t.object,ic.ASTUtils.isNotClosingParenToken).range[0],t.range[1]]}function l(e){let t=ic.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=fD.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===ic.AST_NODE_TYPES.ChainExpression)return e(t.expression);if((r=t.type===ic.AST_NODE_TYPES.CallExpression?t.callee:t).type!==ic.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=fT(t),l=d.type===ic.AST_NODE_TYPES.CallExpression,f=null;if(d.type===ic.AST_NODE_TYPES.CallExpression?(1===d.arguments.length&&(f=d.arguments[0]),d=fT(d)):f=t.property,null==f||!fP(d)||!u(t.object))return;let p=(r=f,s=t.object,r.type===ic.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=ic.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=fT(t),n=fT(r);1===r.arguments.length&&fP(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=fT(t),n=fT(r);1===r.arguments.length&&fP(n)&&n.right.type===ic.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=fT(t),a=fT(r);if(!fP(a)||!function(e){let t=ic.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=fT(t),n=fT(r);if(!fP(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!==ic.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===ic.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,t.object)&&o(e.right,n.right)||l&&e.type===ic.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=fT(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!==ic.AST_NODE_TYPES.Literal&&n.type!==ic.AST_NODE_TYPES.TemplateLiteral&&n.type!==ic.AST_NODE_TYPES.Identifier&&n.type!==ic.AST_NODE_TYPES.MemberExpression&&n.type!==ic.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 fT(e){return ic.ESLintUtils.nullThrows(e.parent?.type===ic.AST_NODE_TYPES.ChainExpression?e.parent.parent:e.parent,ic.ESLintUtils.NullThrowsReasons.MissingParent)}function fP(e){return e.type===ic.AST_NODE_TYPES.BinaryExpression&&f_.test(e.operator)}var fk=il.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=ic.ASTUtils.findVariable(e.sourceCode.getScope(t),r);n?.defs.forEach(r=>{r.node.type===ic.AST_NODE_TYPES.TSEnumDeclaration&&r.node.const&&e.report({node:t,messageId:"noConstEnum"})})};return{ExportNamedDeclaration(r){let n=r.declaration;if(n?.type===ic.AST_NODE_TYPES.TSEnumDeclaration&&n.const){e.report({node:r,messageId:"noConstEnum"});return}if(n?.type===ic.AST_NODE_TYPES.VariableDeclaration){let e=n.declarations[0].id;e.type===ic.AST_NODE_TYPES.Identifier&&t(r,e)}},ExportDefaultDeclaration(e){let r=e.declaration;r.type===ic.AST_NODE_TYPES.Identifier&&t(e,r)}}}}),fI=il.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 il.ensureParserWithTypeInformation(t),e.symbol&&fO.has(e.symbol.name)||((r=e).flags&ip.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){il.ensureParserWithTypeInformation(t);let u=fF(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 fF(e,t){return t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e))}const fO=new Set(["Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Set","Map"]);var fj=il.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 ct(t),{AwaitExpression(r){let n=fF(r.argument,t);(function(e,t){var r;if(e.argument.type!==ic.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===ip.SyntaxKind.MethodSignature||e.kind===ip.SyntaxKind.MethodDeclaration||e.kind===ip.SyntaxKind.PropertyDeclaration)}(n)||n.flags&ip.TypeFlags.Any||n.flags&ip.TypeFlags.Unknown||n.flags&ip.TypeFlags.Union||e.report({messageId:"refactorAwait",node:r})}}}}),fB=il.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 ct(t),{CallExpression(r){let{arguments:n}=r;if(0===n.length)return;let u=n[n.length-1];u.type===ic.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&&fN.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 fN=new Set([ip.SyntaxKind.FunctionDeclaration,ip.SyntaxKind.FunctionExpression,ip.SyntaxKind.ArrowFunction,ip.SyntaxKind.MethodDeclaration,ip.SyntaxKind.Constructor,ip.SyntaxKind.GetAccessor,ip.SyntaxKind.SetAccessor]);function fL(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fR{visit(e,t){let r=e=>{switch(e.type){case ic.AST_NODE_TYPES.AwaitExpression:case ic.AST_NODE_TYPES.CallExpression:case ic.AST_NODE_TYPES.NewExpression:this.callLikeExpressions.push(e);break;case ic.AST_NODE_TYPES.FunctionDeclaration:case ic.AST_NODE_TYPES.FunctionExpression:case ic.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(){fL(this,"callLikeExpressions",[])}}fL(fR,"getCallExpressions",(e,t)=>{let r=new fR;return r.visit(e,t),r.callLikeExpressions});var fM={rules:{"array/no-unneeded-flat-map":iU,"browser/prefer-location-assign":iz,"jsx/no-template-literal":iW,"jsx/no-unneeded-nested":iY,"string/no-locale-case":iZ,"string/no-simple-template-literal":iH,"type/no-instanceof-wrapper":iJ,"unicode/no-bidi":i5,"unicode/no-invisible":i6,"ban-eslint-disable":lU,"no-redundant-variable":i9,"no-single-return":oe,"prefer-early-return":or,"prefer-fetch":on,"prefer-timer-id":oi,"import-dedupe":lV,"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":ci,"call-argument-line":co,"class-prototype":cr,"comma-or-logical-or-case":l3,"track-todo-fixme-comment":cl,"no-element-overwrite":l5,"no-empty-collection":ch,"no-equals-in-for-termination":cA,"no-top-level-this":cT,"no-invariant-returns":cP,"no-redundant-assignments":cz,"no-same-line-conditional":cq,"no-small-switch":cW,"no-unused-collection":cZ,"no-useless-plusplus":cX,"string/prefer-string-starts-ends-with":fw,"string/no-unneeded-to-string":oo,"type/no-force-cast-via-top-type":os,"type/no-wrapper-type-reference":ol,"no-default-error":oc,"no-export-const-enum":fk,"no-for-in-iterable":fI,"only-await-thenable":fj,"no-undefined-optional-parameters":fB,"no-try-promise":il.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 il.ensureParserWithTypeInformation(t),{TryStatement(r){if(r.handler){let n=[],u=[],a=!1;fR.getCallExpressions(r.block,e).forEach(e=>{if(e.type===ic.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&ip.SymbolFlags.Method)}(e,t)){a=!0;return}!(e.parent&&(e.parent.type===ic.AST_NODE_TYPES.AwaitExpression||e.parent.type===ic.AST_NODE_TYPES.YieldExpression)||e.parent&&e.parent.type===ic.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ic.AST_NODE_TYPES.Identifier&&"then"===e.parent.property.name||e.type===ic.AST_NODE_TYPES.CallExpression&&e.callee.type===ic.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===ic.AST_NODE_TYPES.Identifier&&"catch"===e.callee.property.name)&&(e.parent&&e.parent.type===ic.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ic.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":il.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(il.ensureParserWithTypeInformation(t),(fF(n,t).flags&iE.TypeFlags.StringLike)!=0&&u.type===ic.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":dj,"unicorn/catch-error-name":lT,"unicorn/custom-error-definition":lk,"unicorn/no-nested-ternary":sf,"unicorn/prefer-event-target":sz,"unicorn/prefer-keyboard-event-key":sq,"unicorn/prefer-text-content":sW,"unicorn/require-array-join-separator":s0,"unicorn/no-thenable":s1,"unicorn/no-invalid-remove-event-listener":s2,"unicorn/consistent-function-scoping":s3,"unicorn/no-new-buffer":s5,"unicorn/no-console-spaces":s8,"unicorn/no-empty-file":s6,"unicorn/no-useless-fallback-in-spread":s9,"unicorn/no-useless-length-check":s7,"unicorn/no-useless-promise-resolve-reject":de,"unicorn/no-zero-fractions":dt,"unicorn/prefer-export-from":dr,"unicorn/prefer-native-coercion-functions":dn,"unicorn/no-document-cookie":da,"unicorn/prefer-add-event-listener":di,"unicorn/prefer-array-index-of":ds,"unicorn/prefer-blob-reading-methods":dd,"unicorn/prefer-date-now":dl,"unicorn/prefer-dom-node-dataset":dc,"unicorn/prefer-modern-math-apis":df,"unicorn/number-literal-case":dm,"unicorn/prefer-number-properties":dg,"unicorn/prefer-reflect-apply":dy,"unicorn/prefer-set-size":db,"unicorn/prefer-string-replace-all":dv,"unicorn/prefer-string-slice":dx,"unicorn/prefer-string-trim-start-end":dS,"unicorn/no-unreadable-iife":dA,"unicorn/throw-new-error":dC,"unicorn/escape-case":dB,"unicorn/no-hex-escape":dN,"unicorn/prefer-prototype-methods":dL,"unicorn/error-message":dR,"unicorn/no-instanceof-array":dM,"unicorn/prefer-type-error":d$,"unicorn/consistent-destructuring":dU,"unicorn/new-for-builtins":dz,"unicorn/no-array-push-push":dq,"unicorn/no-process-exit":dW,"unicorn/no-static-only-class":dZ,"unicorn/no-unreadable-array-destructuring":dK,"unicorn/no-useless-spread":dH,"unicorn/no-useless-switch-case":dX,"unicorn/no-useless-undefined":dJ,"unicorn/numeric-separators-style":dQ,"unicorn/prefer-array-find":d0,"unicorn/prefer-array-flat-map":d1,"unicorn/prefer-array-flat":d2,"unicorn/prefer-array-some":d3,"unicorn/prefer-code-point":d4,"unicorn/prefer-default-parameters":d5,"unicorn/prefer-logical-operator-over-ternary":d8,"unicorn/prefer-optional-catch-binding":d6,"unicorn/prefer-regexp-test":d9,"unicorn/prefer-set-has":d7,"unicorn/prefer-string-raw":le,"unicorn/prefer-switch":lt,"unicorn/require-number-to-fixed-digits-argument":lr,"unicorn/template-indent":lC,"unicorn/no-single-promise-in-promise-methods":dY,"unicorn/no-await-in-promise-methods":l_,"unicorn/no-negation-in-equality-check":lD,"unicorn/no-length-as-slice-end":lw,"unicorn/no-lonely-if":lI,"unicorn/no-magic-array-flat-depth":lF,"unicorn/no-negated-condition":lO,"unicorn/no-object-as-default-parameter":lj,"unicorn/prefer-negative-index":lB,"unicorn/prefer-node-protocol":lL}).reduce((e,[t,r])=>{var n;return e[t]={...r,meta:{schema:[],...r.meta,docs:{description:"",...r.meta.docs,url:iD(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(iw(e)||(e=[e]),e))if(r){if(r.fix&&(r.fix=ik(r.fix)),iw(r.suggest))for(let e of r.suggest)"fix"in e&&"function"==typeof e.fix&&(e.fix=ik(e.fix)),e.data={...r.data,...e.data};t.report(r)}}}(n(...t),e)}]))})},e},{})}};module.exports=fM;
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 aH={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"}}}}()),lI=/*@__PURE__*/ix(/*@__PURE__*/function(){if(aQ)return aJ;aQ=1;let{isParenthesized:e,isNotSemicolonToken:t}=sc,{needsSemicolon:r}=/*@__PURE__*/sV(),{removeSpacesAfter:n}=/*@__PURE__*/sQ(),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 aJ={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`."}}}}()),lF=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a1)return a0;a1=1;let{isMethodCall:e,isNumberLiteral:t}=/*@__PURE__*/sv(),{getCallExpressionTokens:r}=/*@__PURE__*/sV(),n="no-magic-array-flat-depth";return a0={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."}}}}()),lO=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a3)return a2;a3=1;let{removeParentheses:e,fixSpaceAroundKeyword:t,addParenthesizesToReturnOrThrowExpression:r}=/*@__PURE__*/sQ(),{getParenthesizedRange:n,isParenthesized:u}=/*@__PURE__*/sp(),a=/*@__PURE__*/sO(),i=/*@__PURE__*/sN(),o="no-negated-condition";return a2={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."}}}}()),lj=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a5)return a4;a5=1;let{isFunction:e}=/*@__PURE__*/sv(),t="identifier",r="non-identifier";return a4={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."}}}}()),lB=/*@__PURE__*/ix(/*@__PURE__*/function(){if(a7)return a9;a7=1;let{getNegativeIndexLengthNode:e,removeLengthNode:t}=/*@__PURE__*/function(){if(a6)return a8;a6=1;let e=/*@__PURE__*/sj(),{getParenthesizedRange:t}=/*@__PURE__*/sp(),{isNumberLiteral:r}=/*@__PURE__*/sv(),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 a8={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__*/dV(),{isLiteral:n}=/*@__PURE__*/sv(),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 a9={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}}`."}}}}()),lN=/*@__PURE__*/iS(ib),lL=/*@__PURE__*/ix(/*@__PURE__*/function(){if(ii)return ia;ii=1;let e=function(){if(iu)return ir;iu=1;let e=new Set(function(){if(it)return ie;it=1;let{builtinModules:e}=lN,t=["sys"];return ie=(e||(process.binding?Object.keys(process.binding("natives")):[])||[]).filter(e=>!/^_|^(internal|v8|node-inspect)\/|\//.test(e)&&!t.includes(e)).sort()}()),t="node:";return ir=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__*/sQ(),r=/*@__PURE__*/sb(),n="prefer-node-protocol";return ia={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 lR=RegExp("^\\s*(?<directive>eslint-disable(?:-(?:next-)?line)?)"),lM=RegExp("^eslint-disable(?:-next-line|-line)?(?<ruleId>$|(?:\\s+(?:@(?:[\\w-]+\\/){1,2})?[\\w-]+)?)"),l$=Symbol("rule-id-no-match");var lU=il.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=lR.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=lM.exec(e.trim());return t?t.groups?.ruleId:l$}(n.value);u===l$||u||e.report({node:n,messageId:"require-specific-rule"})}}}}),lV=il.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===ic.AST_NODE_TYPES.ArrowFunctionExpression||(t.parent?.type===ic.AST_NODE_TYPES.ReturnStatement?!lz(t.parent):(t.parent?.type===ic.AST_NODE_TYPES.ConditionalExpression&&(t===t.parent.consequent||t===t.parent.alternate)||t.parent?.type===ic.AST_NODE_TYPES.LogicalExpression&&t===t.parent.right||t.parent?.type===ic.AST_NODE_TYPES.SequenceExpression&&t===t.parent.expressions.at(-1))&&e(t.parent))})(t)&&!lz(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 lz(e){let t=e;for(;!ic.ASTUtils.isFunction(t)&&t.type!==ic.AST_NODE_TYPES.Program;){if(t.parent.type===ic.AST_NODE_TYPES.TryStatement&&(t===t.parent.block||t===t.parent.handler&&t.parent.finalizer))return!0;t=t.parent}return!1}function lq(e){return e.includes("\r\n")?"\r\n":"\n"}var lW=il.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=lq(t);return{MemberExpression(n){let u=n.object.range[1],a=lY(t.slice(u));if(a.includes("\n")){let t=r+((lY(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 lY(e){return e.slice(0,e.length-e.trimStart().length)}var lG=il.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=lq(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(lZ)||t.properties.some(s),c=lZ(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 lZ(e){return e.includes("\n")}var lK=il.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!==ic.AST_NODE_TYPES.IfStatement&&lX(t.consequent)&&function(e){if(e.alternate)return lX(e.alternate);let{parent:t}=e;if(t.type===ic.AST_NODE_TYPES.BlockStatement){let r=t.body.indexOf(e);return lH(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===ic.AST_NODE_TYPES.BlockStatement?r.body[0]:r).argument.value,i=!(((n=t.test).type===ic.AST_NODE_TYPES.UnaryExpression||n.type===ic.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 lH(e){return e?.type===ic.AST_NODE_TYPES.ReturnStatement&&e.argument?.type===ic.AST_NODE_TYPES.Literal&&"boolean"==typeof e.argument.value}function lX(e){return void 0!==e&&(e.type===ic.AST_NODE_TYPES.BlockStatement&&1===e.body.length&&lH(e.body[0])||lH(e))}var lJ=il.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===ic.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===ic.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=l0(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=>l1(e.consequent)),endsWithDefault:a}),s=i.filter(e=>l1(lQ(e.consequent)).length>0);if(r(s.map(e=>l1(lQ(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=l1(lQ(i[r].consequent));if(t(u)){for(let t=0;t<r;t++)if(l0(u,l1(lQ(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)=>l0(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 lQ(e){if(1===e.length){let t=e[0];if(t.type===ic.AST_NODE_TYPES.BlockStatement)return t.body}return e}function l0(e,t,r){var n,u;return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>l0(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 l1(e){return e.length>0&&e[e.length-1].type===ic.AST_NODE_TYPES.BreakStatement?e.slice(0,-1):e}var l2=il.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===ic.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===ic.AST_NODE_TYPES.SwitchStatement)return r[e];throw Error("A switch case should have an enclosing switch statement")}(r)).discriminant.type===ic.AST_NODE_TYPES.Literal&&!0===n.discriminant.value)){let e=function e(t,r){if("||"===t.operator)return t.left.type===ic.AST_NODE_TYPES.LogicalExpression?e(t.left,r+1):[t.left,r+1]}(r,0);e&&t(r,e[0],e[1]+1)}}}}});function l3(e,t,r){var n,u;return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>l3(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))}il.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!==ic.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===ic.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===ic.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)=>l3(r,t[n],e.sourceCode))}}});var l4=il.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===ic.AST_NODE_TYPES.ImportDeclaration||e.type===ic.AST_NODE_TYPES.ExportNamedDeclaration||e.type===ic.AST_NODE_TYPES.ExportDefaultDeclaration||e.type===ic.AST_NODE_TYPES.ExportAllDeclaration))))}};function t(t){let r;let n=new Map;t.forEach(t=>{let u=function(t){if(t.type===ic.AST_NODE_TYPES.ExpressionStatement)return function(t){if(t.type===ic.AST_NODE_TYPES.AssignmentExpression&&"="===t.operator&&t.left.type===ic.AST_NODE_TYPES.MemberExpression&&t.left.computed){let{left:r,right:n}=t,u=l8(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(l5(e,n[0]))for(let e=t,r=0;e<u.length&&r<n.length;e++,r++)if(l5(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===ic.AST_NODE_TYPES.CallExpression&&e.callee.type===ic.AST_NODE_TYPES.MemberExpression){let t=e.callee;if(t.property.type===ic.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=l8(e.arguments[0]);if(r)return{collectionNode:t.object,indexOrKey:r,node:e}}}}}(t.expression)}(t);if(u){r&&!l3(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 l5(e,t){return e.value===t.value}function l8(e){if(e.type===ic.AST_NODE_TYPES.Literal){let{value:t}=e;return"number"==typeof t||"string"==typeof t?String(t):void 0}if(e.type===ic.AST_NODE_TYPES.Identifier)return e.name}new class{get(e){let t=this.map.get(e),r=Date.now();if(t){if(t.expire>r)return t.expire=r+2e4,t.value;this.map.delete(e)}return null}set(e,t){let r=this.map.get(e),n=Date.now()+2e4;r?(r.value=t,r.expire=n):this.map.set(e,{value:t,expire:n})}constructor(){var e;e=new Map,"map"in this?Object.defineProperty(this,"map",{value:e,enumerable:!0,configurable:!0,writable:!0}):this.map=e}};const l6=Object.entries({"deep-equal":"https://www.npmjs.com/package/dequal","fast-deep-equal":"https://www.npmjs.com/package/dequal",chalk:"simple color https://www.npmjs.com/package/picocolors, hex color https://github.com/webdiscus/ansis",kleur:"https://www.npmjs.com/package/picocolors","ansi-escapes":"https://www.npmjs.com/package/sisteransi","mime-db":"https://www.npmjs.com/package/mrmime","mime-types":"https://www.npmjs.com/package/mrmime","tiny-lru":"https://www.npmjs.com/package/flru","lru-cache":"https://www.npmjs.com/package/flru","tmp-cache":"https://www.npmjs.com/package/flru",premove:"Node.js built-in fs.rmdir & fs.rm API",mkdirp:"Node.js built-in fs.mkdir API","make-dir":"Node.js built-in fs.mkdir API","mk-dirs":"Node.js built-in fs.mkdir API",axios:"https://www.npmjs.com/package/ky","node-fetch":"https://www.npmjs.com/package/undici (preferred) or https://www.npmjs.com/package/node-fetch-native",got:"https://www.npmjs.com/package/undici and https://www.npmjs.com/package/async-retry","get-port":"https://www.npmjs.com/package/get-port-please","react-query":"https://swr.vercel.app","@tanstack/react-query":"https://swr.vercel.app","@tanstack/react-query-devtools":"https://swr.vercel.app",ahooks:"https://foxact.skk.moe and https://swr.vercel.app","clone-deep":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser","deep-copy":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser","fast-copy":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser","lodash.clonedeep":"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser",clone:"https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser",ms:"https://www.npmjs.com/package/@lukeed/ms",classnames:"https://www.npmjs.com/package/clsx",classcat:"https://www.npmjs.com/package/clsx","p-limit":"https://www.npmjs.com/package/async-sema or https://www.npmjs.com/package/@henrygd/queue","p-retry":"https://www.npmjs.com/package/async-retry",ora:"https://www.npmjs.com/package/nanospinner","ts-results":"https://www.npmjs.com/package/ts-results-es",dayjs:"https://www.npmjs.com/package/date-fns",tldjs:"https://www.npmjs.com/package/tldts","types-package-json":"https://www.npmjs.com/package/@package-json/types"}).map(([e,t])=>({name:e,message:`Use ${t} instead.`})),l9=[{name:"date-fns/esm",message:"Please use date-fns/{submodule} instead."},{name:"idb/with-async-ittr-cjs",message:"Please use idb/with-async-ittr instead."},{name:"lodash-unified",message:"Do not import lodash-unified directly"},{name:"react-fast-compare",message:"What's faster than a really fast deep comparison? No deep comparison at all."}],l7=[{name:"lodash",message:"Avoid using type unsafe methods.",importNames:["get"]},{name:"lodash-es",message:"Avoid using type unsafe methods.",importNames:["get"]},{name:"lodash",message:"Use https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser instead",importNames:["cloneDeep"]},{name:"lodash-es",message:"Use https://www.npmjs.com/package/rfdc for Node.js / https://www.npmjs.com/package/klona for Browser instead",importNames:["cloneDeep"]},{name:"uuid",importNames:["v4"],message:"Use https://www.npmjs.com/package/@lukeed/uuid instead"},{name:"assert",importNames:["deepEqual"],message:"Use https://www.npmjs.com/package/dequal instead"},{name:"react",importNames:["useLayoutEffect"],message:"Use https://foxact.skk.moe/use-isomorphic-layout-effect instead"}];function ce(e){if(!e?.program)throw Error("see https://typescript-eslint.io/docs/linting/type-linting")}[...l9,...l6,...l7],[...l9,...l6,...l7],[...l9,...l6];var ct=il.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=il.isParserWithTypeInformation(t)?cr:cu;return{AssignmentExpression({left:n,right:u}){if(n.type===ic.AST_NODE_TYPES.MemberExpression&&r(u,t)){let[t,r]=[n.object,n.property];if(t.type===ic.AST_NODE_TYPES.MemberExpression&&r.type===ic.AST_NODE_TYPES.Identifier){let[u,a]=[t.object,t.property];u.type===ic.AST_NODE_TYPES.Identifier&&a.type===ic.AST_NODE_TYPES.Identifier&&"prototype"===a.name&&e.report({messageId:"declareClass",data:{class:u.name,declaration:r.name},node:n})}}}}}});function cr(e,t){ce(t);let r=t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e));return!!r.symbol&&(r.symbol.flags&ip.SymbolFlags.Function)!=0}const cn=new Set(["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"]);function cu(e,t){return cn.has(e.type)}var ca=il.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===ic.AST_NODE_TYPES.Identifier&&function(e){return!!e.optional&&!!e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ic.AST_NODE_TYPES.TSBooleanKeyword||function(e){if(e.typeAnnotation&&e.typeAnnotation.typeAnnotation.type===ic.AST_NODE_TYPES.TSUnionType){let t=e.typeAnnotation.typeAnnotation.types;return 2===t.length&&t.some(e=>e.type===ic.AST_NODE_TYPES.TSBooleanKeyword)&&t.some(e=>e.type===ic.AST_NODE_TYPES.TSUndefinedKeyword)}return!1}(e)}(r)&&e.report({messageId:"provideDefault",data:{parameter:r.name},node:r})}})}),ci=il.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!==ic.AST_NODE_TYPES.CallExpression&&1===r.arguments.length){let n=r.typeArguments??r.callee,u=(t.getLastTokenBetween(n,r.arguments[0],co)??t.getLastToken(n)).loc.end.line,{start:a}=t.getTokenAfter(n,cs).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 co(e){return e.type===ic.AST_TOKEN_TYPES.Punctuator&&")"===e.value}function cs(e){return!co(e)}var cd=il.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&&cl.test(e.charAt(t-1)),a=n<=e.length-1&&cl.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 cl=RegExp("\\p{Letter}","u"),cc=["Array","Map","Set","WeakSet","WeakMap"],cf=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 cp=il.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===ic.TSESLint.Scope.DefinitionType.Parameter||e.type===ic.TSESLint.Scope.DefinitionType.ImportBinding))return;let r=[],n=!1;for(let e of t.references)if(e.isWriteOnly()){if(!function(e){let t=ch(e.identifier,e=>e.type===ic.AST_NODE_TYPES.VariableDeclarator||e.type===ic.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ic.AST_NODE_TYPES.VariableDeclarator&&t.init)return cy(t.init);if(t.type===ic.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ic.AST_NODE_TYPES.AssignmentExpression&&cg(e,r.left)&&cy(r.right)}}return!1}(e))return;n=!0}else{if(!(function(e){let{parent:t}=e.identifier;if(t&&t.type===ic.AST_NODE_TYPES.MemberExpression){let e=t.parent;if(e&&e.type===ic.AST_NODE_TYPES.CallExpression)return cb(t.property,...cf)}return!1}(e)||function(e){let t=ch(e.identifier,e=>e.type===ic.AST_NODE_TYPES.ForOfStatement||e.type===ic.AST_NODE_TYPES.ForInStatement);return t&&t.right===e.identifier}(e)||function(e){let{parent:t}=e.identifier;return t&&t.type===ic.AST_NODE_TYPES.MemberExpression&&t.computed&&!function(e){let t=cm(e,new Set),r=t.find(e=>e.type===ic.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!==ic.TSESLint.Scope.ScopeType.global&&e.variables.forEach(t),e.childScopes.forEach(r)};return{"Program:exit":t=>{r(e.sourceCode.getScope(t))}}}});function ch(e,t){return cm(e,new Set).find(t)}function cm(e,t){let r=[],n=e.parent;for(;n&&(r.push(n),!t.has(n.type));)n=n.parent;return r}function cg(e,t){return t.type===ic.AST_NODE_TYPES.Identifier&&t===e.identifier}function cy(e){return e&&e.type===ic.AST_NODE_TYPES.ArrayExpression?0===e.elements.length:!!e&&(e.type===ic.AST_NODE_TYPES.CallExpression||e.type===ic.AST_NODE_TYPES.NewExpression)&&cb(e.callee,...cc)&&0===e.arguments.length}function cb(e,...t){return e?.type===ic.AST_NODE_TYPES.Identifier&&(0===t.length||t.some(t=>t===e.name))}const cE=new Set(["!=","==","!==","==="]),cv=new Set(["!==","!="]),cx=new Set(["+=","-="]);var cS=il.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===ic.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===ic.AST_NODE_TYPES.BinaryExpression&&cE.has(n.operator)&&function e(t){return!!cA(t)||t.type===ic.AST_NODE_TYPES.UpdateExpression||t.type===ic.AST_NODE_TYPES.SequenceExpression&&t.expressions.every(e)}(r.update)&&!(function(e){let t=e.test,r=[];return function e(t,r){let n;cA(t)?n=t.left:t.type===ic.AST_NODE_TYPES.UpdateExpression?n=t.argument:t.type===ic.AST_NODE_TYPES.SequenceExpression&&t.expressions.forEach(t=>e(t,r)),n&&n.type===ic.AST_NODE_TYPES.Identifier&&r.push(n.name)}(e.update,r),t.left.type!==ic.AST_NODE_TYPES.Identifier||!r.includes(t.left.name)}(r)||function(e){let r=e.init,n=e.test;if(r&&cC(n)){let u=function(e,r){if(e.type===ic.AST_NODE_TYPES.UpdateExpression&&!t(e.argument,r)||function(e){if(cA(e)){let t=e.right;return t.type===ic.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=c_(r),t=c_(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 cA(e){return e.type===ic.AST_NODE_TYPES.AssignmentExpression&&cx.has(e.operator)}function cC(e){return e.type===ic.AST_NODE_TYPES.BinaryExpression&&cv.has(e.operator)}function c_(e){return cC(e)?cD(e.right):e.type===ic.AST_NODE_TYPES.VariableDeclaration&&1===e.declarations.length?cD(e.declarations[0].init):e.type===ic.AST_NODE_TYPES.AssignmentExpression?cD(e.right):void 0}function cD(e){if(e&&e.type===ic.AST_NODE_TYPES.Literal&&"number"==typeof e.value)return e.value}var cw=il.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===ic.AST_NODE_TYPES.ClassDeclaration||e.type===ic.AST_NODE_TYPES.ClassExpression);if((r===ic.TSESLint.Scope.ScopeType.global||r===ic.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})}}})}),cT=il.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?cI(r,t):void 0;if(void 0!==n)return e.slice(1).every(e=>cI(e,t)===n);if(r?.type===ic.AST_NODE_TYPES.Identifier){let n=cP(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 cP(e,t){let r=t.set.get(e);if(r&&!r.references.slice(1).some(e=>e.isWrite()||function(e){let t=ch(e.identifier,e=>e.type===ic.AST_NODE_TYPES.ExpressionStatement||cn.has(e.type));return t&&t.type===ic.AST_NODE_TYPES.ExpressionStatement&&(ck(t,e)||t.expression.type===ic.AST_NODE_TYPES.CallExpression)}(e))){let e=null;return 1===r.defs.length&&r.defs[0].type===ic.TSESLint.Scope.DefinitionType.Variable&&(e=r.defs[0].node.init),{variable:r,initExpression:e}}return null}function ck(e,t,r=!0){return e.expression.type===ic.AST_NODE_TYPES.AssignmentExpression&&function e(t,r,n=!0){return t.type===ic.AST_NODE_TYPES.MemberExpression&&(cg(r,t.object)||n&&e(t.object,r,n))}(e.expression.left,t,r)}function cI(e,t){if(e){if(e.type===ic.AST_NODE_TYPES.Literal)return e.value;if(e.type===ic.AST_NODE_TYPES.UnaryExpression){let r=cI(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===ic.AST_NODE_TYPES.Identifier){let r=cP(e.name,t);if(r?.initExpression)return cI(r.initExpression,t)}}}function cF(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cO(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 cj extends Set{constructor(...e){super(...e),cF(this,"type","AssignedValues")}}const cB=e=>new cj([e]),cN={type:"UnknownValue"};class cL{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,cN);return}let n=cR(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 cj;"AssignedValues"===e.type&&"AssignedValues"===r.type?(r.forEach(t=>e.add(t)),this.in.set(t,e)):this.in.set(t,cN)}}constructor(e){cF(this,"segment",void 0),cF(this,"in",void 0),cF(this,"out",void 0),cF(this,"references",void 0),this.segment=e,this.in=new Map,this.out=new Map,this.references=new Set}}function cR(e,t,r,n){if(!t)return cN;switch(t.type){case ic.AST_NODE_TYPES.Literal:return t.raw?cB(t.raw):cN;case ic.AST_NODE_TYPES.Identifier:{let u=cO(t,n);if(u&&u!==e)return r.get(u)??cN;return cN}default:return cN}}class cM{constructor(e){cF(this,"codePath",void 0),cF(this,"reachingDefinitionsMap",void 0),cF(this,"reachingDefinitionsStack",void 0),cF(this,"segments",void 0),cF(this,"assignmentStack",void 0),this.codePath=e,this.reachingDefinitionsMap=new Map,this.reachingDefinitionsStack=[],this.segments=new Map,this.assignmentStack=[]}}class c${isRhs(e){return this.node.type===ic.AST_NODE_TYPES.AssignmentExpression?this.node.right===e:this.node.init===e}isLhs(e){return this.node.type===ic.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){cF(this,"node",void 0),cF(this,"lhs",void 0),cF(this,"rhs",void 0),this.node=e,this.lhs=new Set,this.rhs=new Set}}function cU(e){return e[e.length-1]}var cV=il.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===ic.AST_NODE_TYPES.TSEnumBody||r.parent.type===ic.AST_NODE_TYPES.TSEnumDeclaration||r.parent.type===ic.AST_NODE_TYPES.TSEnumMember||e.sourceCode.getAncestors(r).some(e=>e.type===ic.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=cU(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 cL(e)),a.push(e)},onCodePathStart(e){var r;r=new cM(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=cU(t).assignmentStack.pop();e.rhs.forEach(d),e.lhs.forEach(d)}function o(e){cU(t).assignmentStack.push(new c$(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===ic.AST_NODE_TYPES.Identifier&&e.identifier.parent?.type===ic.AST_NODE_TYPES.AssignmentPattern)&&!t.name.startsWith("_")&&!function(e){if(e?.parent){let t=e.parent;return t&&t.type===ic.AST_NODE_TYPES.AssignmentExpression&&"="!==t.operator}return!1}(e.writeExpr)&&(e.writeExpr?.type!==ic.AST_NODE_TYPES.Identifier||e.resolved!==cO(e.writeExpr,e.from))&&!t.defs.some(e=>e.type===ic.TSESLint.Scope.DefinitionType.Parameter||e.type===ic.TSESLint.Scope.DefinitionType.Variable&&!e.node.init)&&!(n.get(t).size>1)}(t))return;let a=r.get(u),i=cR(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}=cU(t);if(n.length>0)cU(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 cL(e),r.set(e.id,t)),t})(a[t]).add(e)}}}),cz=il.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===ic.AST_NODE_TYPES.IfStatement&&u&&u.type===ic.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)}}}),cq=il.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 cW=["Array","Map","Set","WeakSet","WeakMap"],cY=["copyWithin","fill","pop","push","reverse","set","shift","sort","splice","unshift","add","clear","delete"];var cG=il.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!==ic.TSESLint.Scope.ScopeType.global&&t.variables.filter(cZ).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 cZ(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=ch(e.identifier,e=>e.type===ic.AST_NODE_TYPES.VariableDeclarator||e.type===ic.AST_NODE_TYPES.ExpressionStatement);if(t){if(t.type===ic.AST_NODE_TYPES.VariableDeclarator&&t.init)return cK(t.init);if(t.type===ic.AST_NODE_TYPES.ExpressionStatement){let{expression:r}=t;return r.type===ic.AST_NODE_TYPES.AssignmentExpression&&cg(e,r.left)&&cK(r.right)}}return!1}(r))return!1;t=!0}else if(function(e){let t=ch(e.identifier,e=>e.type===ic.AST_NODE_TYPES.ExpressionStatement);return!t||!(ck(t,e,!1)||function(e,t){if(e.expression.type===ic.AST_NODE_TYPES.CallExpression){let{callee:r}=e.expression;if(r.type===ic.AST_NODE_TYPES.MemberExpression){let{property:e,object:n}=r;return cg(t,n)&&cb(e,...cY)}}return!1}(t,e))}(r))return!1;return t}function cK(e){return!!e&&e.type===ic.AST_NODE_TYPES.ArrayExpression||!!e&&(e.type===ic.AST_NODE_TYPES.CallExpression||e.type===ic.AST_NODE_TYPES.NewExpression)&&cb(e.callee,...cW)}var cH=il.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===ic.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===ic.AST_NODE_TYPES.UpdateExpression&&!r.prefix){let n=e.left;n.type===ic.AST_NODE_TYPES.Identifier&&r.argument.type===ic.AST_NODE_TYPES.Identifier&&r.argument.name===n.name&&t(r)}}}}});function cX(e){return!(e<48)&&(e<58||!(e<65)&&(e<91||95===e||!(e<97)&&(e<123||cJ(e)||cQ(e,null!=t?t:t=c0("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 cJ(t){return cQ(t,null!=e?e:e=c0("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 cQ(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 c0(e){let t=0;return e.split(" ").map(e=>t+=0|parseInt(e,36))}class c1{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 c2=new Set(["General_Category","gc"]),c3=new Set(["Script","Script_Extensions","sc","scx"]),c4=new c1("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","","","","","","",""),c5=new c1("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","",""),c8=new c1("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","","","",""),c6=new c1("","","","","","","Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence","");function c9(e,t,r){return c2.has(t)?e>=2018&&c4.es2018.has(r):!!c3.has(t)&&(e>=2018&&c5.es2018.has(r)||e>=2019&&c5.es2019.has(r)||e>=2020&&c5.es2020.has(r)||e>=2021&&c5.es2021.has(r)||e>=2022&&c5.es2022.has(r)||e>=2023&&c5.es2023.has(r))}function c7(e){return e>=65&&e<=90||e>=97&&e<=122}function fe(e){return e>=48&&e<=57}function ft(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function fr(e){return e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:e-48}function fn(e){return e>=55296&&e<=56319}function fu(e){return e>=56320&&e<=57343}function fa(e,t){return(e-55296)*1024+(t-56320)+65536}class fi{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 fo{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 fo(this,null)}sibling(){return new fo(this.parent,this.base)}}class fs{constructor(){this.branchID=new fo(null,null),this.groupNames=new Map}clear(){this.branchID=new fo(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 fd={at:(e,t,r)=>r<t?e.charCodeAt(r):-1,width:e=>1},fl={at:(e,t,r)=>r<t?e.codePointAt(r):-1,width:e=>e>65535?2:1};class fc{constructor(){this._impl=fd,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?fl:fd,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 ff extends SyntaxError{constructor(e,t){super(e),this.index=t}}const fp=new Set([94,36,92,46,42,43,63,40,41,91,93,123,125,124]),fh=new Set([38,33,35,36,37,42,43,44,46,58,59,60,61,62,63,64,94,96,126]),fm=new Set([40,41,91,93,123,125,47,45,92,124]),fg=new Set([38,45,33,35,37,44,58,59,60,61,62,64,96,126]);function fy(e){return c7(e)||95===e}class fb{constructor(e){this._reader=new fc,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 fs:new fi}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=new Set,u=!1,a=!1,i=!1,o=!1,s=!1,d=!1,l=!1,c=!1;for(let f=t;f<r;++f){let r=e.charCodeAt(f);n.has(r)&&this.raise(`Duplicated flag '${e[f]}'`,{index:t}),n.add(r),103===r?u=!0:105===r?a=!0:109===r?i=!0:117===r&&this.ecmaVersion>=2015?s=!0:121===r&&this.ecmaVersion>=2015?o=!0:115===r&&this.ecmaVersion>=2018?d=!0:100===r&&this.ecmaVersion>=2022?l=!0:118===r&&this.ecmaVersion>=2024?c=!0:this.raise(`Invalid flag '${e[f]}'`,{index:t})}this.onRegExpFlags(t,r,{global:u,ignoreCase:a,multiline:i,unicode:s,sticky:o,dotAll:d,hasIndices:l,unicodeSets:c})}_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)}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 ff(`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.consumeUncapturingGroup()||this.consumeCapturingGroup()}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.eat3(40,63,58)&&(this.onGroupEnter(e),this.consumeDisjunction(),this.eat(41)||this.raise("Unterminated group"),this.onGroupLeave(e,this.index),!0)}consumeCapturingGroup(){let e=this.index;if(this.eat(40)){let t=null;return this.ecmaVersion>=2018?this.consumeGroupSpecifier()&&(t=this._lastStrValue):63===this.currentCodePoint&&this.raise("Invalid group"),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.consumeUncapturingGroup()||this.consumeCapturingGroup()||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||fp.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(){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.raise("Invalid group")}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&&(fe(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&&fh.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||!fh.has(r))&&-1!==r&&!fm.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,fg.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&&fn(u)&&fu(this.currentCodePoint)&&(u=fa(u,this.currentCodePoint),this.advance()),!((t=e=u)<65)&&(t<91||!(t<97)&&(t<123||cJ(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&&fn(n)&&fu(this.currentCodePoint)&&(n=fa(n,this.currentCodePoint),this.advance()),cX(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||fe(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!!c7(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(fn(t)&&this.eat(92)&&this.eat(117)&&this.eatFixedHexDigits(4)){let e=this._lastIntValue;if(fu(e))return this._lastIntValue=fa(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?fp.has(e)||47===e:this.strict?!cX(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(c9(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(c9(this.ecmaVersion,"General_Category",e))return{key:"General_Category",value:e||null};if((t=this.ecmaVersion)>=2018&&c8.es2018.has(e)||t>=2019&&c8.es2019.has(e)||t>=2021&&c8.es2021.has(e))return{key:e,value:null};if(this._unicodeSetsMode&&this.ecmaVersion>=2024&&c6.es2024.has(e))return{key:e,value:null,strings:!0};this.raise("Invalid property name")}return null}eatUnicodePropertyName(){for(this._lastStrValue="";fy(this.currentCodePoint);)this._lastStrValue+=String.fromCodePoint(this.currentCodePoint),this.advance();return""!==this._lastStrValue}eatUnicodePropertyValue(){var e;for(this._lastStrValue="";fy(e=this.currentCodePoint)||fe(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;fe(this.currentCodePoint);)this._lastIntValue=10*this._lastIntValue+fr(this.currentCodePoint),this.advance();return this.index!==e}eatHexDigits(){let e=this.index;for(this._lastIntValue=0;ft(this.currentCodePoint);)this._lastIntValue=16*this._lastIntValue+fr(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(!ft(e))return this.rewind(t),!1;this._lastIntValue=16*this._lastIntValue+fr(e),this.advance()}return!0}}const fE={},fv={},fx={};function fS(e){return"Character"===e.type||"CharacterSet"===e.type||"CharacterClass"===e.type||"ExpressionCharacterClass"===e.type||"ClassStringDisjunction"===e.type}class fA{constructor(e){var t;this._node=fE,this._expressionBufferMap=new Map,this._flags=fv,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:"",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}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:fx};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&&!fS(a)||!fS(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&&!fS(a)||!fS(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 fC=/^[!=]=/,f_=new class{constructor(e){this._state=new fA(e),this._validator=new fb(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 fD=il.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){il.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"===ih.getTypeName(r,n)}function a(e,t){let r=ic.ASTUtils.getStaticValue(e,n);return null!=r&&r.value===t}function i(e){let t=ic.ASTUtils.getStaticValue(e,n);return null!=t&&"string"==typeof t.value&&t.value[0]===t.value}function o(t,r){if(t.type===ic.AST_NODE_TYPES.MemberExpression)return"length"===ic.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=ic.ASTUtils.getStaticValue(t,n),a=ic.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===ic.AST_NODE_TYPES.UnaryExpression&&"-"===e.operator&&o(e.argument,t)||e.type===ic.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,r)&&o(e.right,t)}function d(t){return[e.sourceCode.getTokenAfter(t.object,ic.ASTUtils.isNotClosingParenToken).range[0],t.range[1]]}function l(e){let t=ic.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=f_.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===ic.AST_NODE_TYPES.ChainExpression)return e(t.expression);if((r=t.type===ic.AST_NODE_TYPES.CallExpression?t.callee:t).type!==ic.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=fw(t),l=d.type===ic.AST_NODE_TYPES.CallExpression,f=null;if(d.type===ic.AST_NODE_TYPES.CallExpression?(1===d.arguments.length&&(f=d.arguments[0]),d=fw(d)):f=t.property,null==f||!fT(d)||!u(t.object))return;let p=(r=f,s=t.object,r.type===ic.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=ic.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=fw(t),n=fw(r);1===r.arguments.length&&fT(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=fw(t),n=fw(r);1===r.arguments.length&&fT(n)&&n.right.type===ic.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=fw(t),a=fw(r);if(!fT(a)||!function(e){let t=ic.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=fw(t),n=fw(r);if(!fT(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!==ic.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===ic.AST_NODE_TYPES.BinaryExpression&&"-"===e.operator&&o(e.left,t.object)&&o(e.right,n.right)||l&&e.type===ic.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=fw(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!==ic.AST_NODE_TYPES.Literal&&n.type!==ic.AST_NODE_TYPES.TemplateLiteral&&n.type!==ic.AST_NODE_TYPES.Identifier&&n.type!==ic.AST_NODE_TYPES.MemberExpression&&n.type!==ic.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 fw(e){return ic.ESLintUtils.nullThrows(e.parent?.type===ic.AST_NODE_TYPES.ChainExpression?e.parent.parent:e.parent,ic.ESLintUtils.NullThrowsReasons.MissingParent)}function fT(e){return e.type===ic.AST_NODE_TYPES.BinaryExpression&&fC.test(e.operator)}var fP=il.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=ic.ASTUtils.findVariable(e.sourceCode.getScope(t),r);n?.defs.forEach(r=>{r.node.type===ic.AST_NODE_TYPES.TSEnumDeclaration&&r.node.const&&e.report({node:t,messageId:"noConstEnum"})})};return{ExportNamedDeclaration(r){let n=r.declaration;if(n?.type===ic.AST_NODE_TYPES.TSEnumDeclaration&&n.const){e.report({node:r,messageId:"noConstEnum"});return}if(n?.type===ic.AST_NODE_TYPES.VariableDeclaration){let e=n.declarations[0].id;e.type===ic.AST_NODE_TYPES.Identifier&&t(r,e)}},ExportDefaultDeclaration(e){let r=e.declaration;r.type===ic.AST_NODE_TYPES.Identifier&&t(e,r)}}}}),fk=il.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 il.ensureParserWithTypeInformation(t),e.symbol&&fF.has(e.symbol.name)||((r=e).flags&ip.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){il.ensureParserWithTypeInformation(t);let u=fI(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 fI(e,t){return t.program.getTypeChecker().getTypeAtLocation(t.esTreeNodeToTSNodeMap.get(e))}const fF=new Set(["Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Set","Map"]);var fO=il.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 ce(t),{AwaitExpression(r){let n=fI(r.argument,t);(function(e,t){var r;if(e.argument.type!==ic.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===ip.SyntaxKind.MethodSignature||e.kind===ip.SyntaxKind.MethodDeclaration||e.kind===ip.SyntaxKind.PropertyDeclaration)}(n)||n.flags&ip.TypeFlags.Any||n.flags&ip.TypeFlags.Unknown||n.flags&ip.TypeFlags.Union||e.report({messageId:"refactorAwait",node:r})}}}}),fj=il.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 ce(t),{CallExpression(r){let{arguments:n}=r;if(0===n.length)return;let u=n[n.length-1];u.type===ic.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([ip.SyntaxKind.FunctionDeclaration,ip.SyntaxKind.FunctionExpression,ip.SyntaxKind.ArrowFunction,ip.SyntaxKind.MethodDeclaration,ip.SyntaxKind.Constructor,ip.SyntaxKind.GetAccessor,ip.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 fL{visit(e,t){let r=e=>{switch(e.type){case ic.AST_NODE_TYPES.AwaitExpression:case ic.AST_NODE_TYPES.CallExpression:case ic.AST_NODE_TYPES.NewExpression:this.callLikeExpressions.push(e);break;case ic.AST_NODE_TYPES.FunctionDeclaration:case ic.AST_NODE_TYPES.FunctionExpression:case ic.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(fL,"getCallExpressions",(e,t)=>{let r=new fL;return r.visit(e,t),r.callLikeExpressions});var fR={rules:{"array/no-unneeded-flat-map":iU,"browser/prefer-location-assign":iz,"jsx/no-template-literal":iW,"jsx/no-unneeded-nested":iY,"string/no-locale-case":iZ,"string/no-simple-template-literal":iH,"type/no-instanceof-wrapper":iJ,"unicode/no-bidi":i5,"unicode/no-invisible":i6,"ban-eslint-disable":lU,"no-redundant-variable":i9,"no-single-return":oe,"prefer-early-return":or,"prefer-fetch":on,"prefer-timer-id":oi,"no-return-await":lV,"no-expression-empty-lines":lW,"object-format":lG,"prefer-single-boolean-return":lK,"no-all-duplicated-branches":lJ,"no-duplicated-branches":lJ,"bool-param-default":ca,"call-argument-line":ci,"class-prototype":ct,"comma-or-logical-or-case":l2,"track-todo-fixme-comment":cd,"no-element-overwrite":l4,"no-empty-collection":cp,"no-equals-in-for-termination":cS,"no-top-level-this":cw,"no-invariant-returns":cT,"no-redundant-assignments":cV,"no-same-line-conditional":cz,"no-small-switch":cq,"no-unused-collection":cG,"no-useless-plusplus":cH,"string/prefer-string-starts-ends-with":fD,"string/no-unneeded-to-string":oo,"type/no-force-cast-via-top-type":os,"type/no-wrapper-type-reference":ol,"no-default-error":oc,"no-export-const-enum":fP,"no-for-in-iterable":fk,"only-await-thenable":fO,"no-undefined-optional-parameters":fj,"no-try-promise":il.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 il.ensureParserWithTypeInformation(t),{TryStatement(r){if(r.handler){let n=[],u=[],a=!1;fL.getCallExpressions(r.block,e).forEach(e=>{if(e.type===ic.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&ip.SymbolFlags.Method)}(e,t)){a=!0;return}!(e.parent&&(e.parent.type===ic.AST_NODE_TYPES.AwaitExpression||e.parent.type===ic.AST_NODE_TYPES.YieldExpression)||e.parent&&e.parent.type===ic.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ic.AST_NODE_TYPES.Identifier&&"then"===e.parent.property.name||e.type===ic.AST_NODE_TYPES.CallExpression&&e.callee.type===ic.AST_NODE_TYPES.MemberExpression&&e.callee.property.type===ic.AST_NODE_TYPES.Identifier&&"catch"===e.callee.property.name)&&(e.parent&&e.parent.type===ic.AST_NODE_TYPES.MemberExpression&&e.parent.property.type===ic.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":il.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(il.ensureParserWithTypeInformation(t),(fI(n,t).flags&iE.TypeFlags.StringLike)!=0&&u.type===ic.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":dj,"unicorn/catch-error-name":lT,"unicorn/custom-error-definition":lk,"unicorn/no-nested-ternary":sf,"unicorn/prefer-event-target":sz,"unicorn/prefer-keyboard-event-key":sq,"unicorn/prefer-text-content":sW,"unicorn/require-array-join-separator":s0,"unicorn/no-thenable":s1,"unicorn/no-invalid-remove-event-listener":s2,"unicorn/consistent-function-scoping":s3,"unicorn/no-new-buffer":s5,"unicorn/no-console-spaces":s8,"unicorn/no-empty-file":s6,"unicorn/no-useless-fallback-in-spread":s9,"unicorn/no-useless-length-check":s7,"unicorn/no-useless-promise-resolve-reject":de,"unicorn/no-zero-fractions":dt,"unicorn/prefer-export-from":dr,"unicorn/prefer-native-coercion-functions":dn,"unicorn/no-document-cookie":da,"unicorn/prefer-add-event-listener":di,"unicorn/prefer-array-index-of":ds,"unicorn/prefer-blob-reading-methods":dd,"unicorn/prefer-date-now":dl,"unicorn/prefer-dom-node-dataset":dc,"unicorn/prefer-modern-math-apis":df,"unicorn/number-literal-case":dm,"unicorn/prefer-number-properties":dg,"unicorn/prefer-reflect-apply":dy,"unicorn/prefer-set-size":db,"unicorn/prefer-string-replace-all":dv,"unicorn/prefer-string-slice":dx,"unicorn/prefer-string-trim-start-end":dS,"unicorn/no-unreadable-iife":dA,"unicorn/throw-new-error":dC,"unicorn/escape-case":dB,"unicorn/no-hex-escape":dN,"unicorn/prefer-prototype-methods":dL,"unicorn/error-message":dR,"unicorn/no-instanceof-array":dM,"unicorn/prefer-type-error":d$,"unicorn/consistent-destructuring":dU,"unicorn/new-for-builtins":dz,"unicorn/no-array-push-push":dq,"unicorn/no-process-exit":dW,"unicorn/no-static-only-class":dZ,"unicorn/no-unreadable-array-destructuring":dK,"unicorn/no-useless-spread":dH,"unicorn/no-useless-switch-case":dX,"unicorn/no-useless-undefined":dJ,"unicorn/numeric-separators-style":dQ,"unicorn/prefer-array-find":d0,"unicorn/prefer-array-flat-map":d1,"unicorn/prefer-array-flat":d2,"unicorn/prefer-array-some":d3,"unicorn/prefer-code-point":d4,"unicorn/prefer-default-parameters":d5,"unicorn/prefer-logical-operator-over-ternary":d8,"unicorn/prefer-optional-catch-binding":d6,"unicorn/prefer-regexp-test":d9,"unicorn/prefer-set-has":d7,"unicorn/prefer-string-raw":le,"unicorn/prefer-switch":lt,"unicorn/require-number-to-fixed-digits-argument":lr,"unicorn/template-indent":lC,"unicorn/no-single-promise-in-promise-methods":dY,"unicorn/no-await-in-promise-methods":l_,"unicorn/no-negation-in-equality-check":lD,"unicorn/no-length-as-slice-end":lw,"unicorn/no-lonely-if":lI,"unicorn/no-magic-array-flat-depth":lF,"unicorn/no-negated-condition":lO,"unicorn/no-object-as-default-parameter":lj,"unicorn/prefer-negative-index":lB,"unicorn/prefer-node-protocol":lL}).reduce((e,[t,r])=>{var n;return e[t]={...r,meta:{schema:[],...r.meta,docs:{description:"",...r.meta.docs,url:iD(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(iw(e)||(e=[e]),e))if(r){if(r.fix&&(r.fix=ik(r.fix)),iw(r.suggest))for(let e of r.suggest)"fix"in e&&"function"==typeof e.fix&&(e.fix=ik(e.fix)),e.data={...r.data,...e.data};t.report(r)}}}(n(...t),e)}]))})},e},{})}};module.exports=fR;